<?php
$this->load->view('top');
?>
<section class="banner_category" style="background-image: url('<?php echo theme_url();?>images/listing-banner.jpg');">
    <div class="container">

        <h1 class="banner_title">Payment Overview</h1>
    </div>
</section>
<div class="page_breadcrumbs">
    <div class="container">
        <ul>
            <li><a href="<?=site_url();?>" title="Home">Home</a>
            </li>
            <li>Thank You</li>
        </ul>
    </div>
</div>
<section class="sec-message">
    <div class="container">

        <div class="sec-content">

            <h1 class="mt-0">
                <?php if ($ordmaster['payment_status'] == 'Paid' || $ordmaster['payment_method'] == 'Cash') { ?>
                <img src="<?php echo theme_url();?>images/check.gif" class="check-icon" />
                Your Order is Confirmed!
                <?php } else { ?>
                <img src="<?php echo theme_url();?>images/failed.gif" class="check-icon" />
                Payment Failed
                <?php } ?>
            </h1>
            <p class="thankyou-text">
                <?php if ($ordmaster['payment_status'] == 'Paid' || $ordmaster['payment_method'] == 'Cash') {  ?>
                Thank you for choosing <?php echo SITENAME;?><br />
                <b>Order Confirmation Number</b>: TYZ000DEL0<?php echo $ordmaster['order_id']; ?> is Confirmed!
                <?php
            } else {
              ?>
                <b>Your Order</b> TYZ000DEL0<?php echo $ordmaster['order_id']; ?> has been canceled/declined!
                <?php
            }
            ?>
            </p>

            <table class="table table-bordered table-hover mobile_hide">
                <thead>
                    <tr>
                        <th>Product</th>
                        <th>Price</th>
                        <th>Quantity</th>
                        <th>Sub Total</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
              //trace($ordmaster);
              $gTotal = 0;
//        echo '<pre>'; print_r($orddetail); exit();
              foreach ($orddetail as $key => $val) {
                $gTotal += ($val['product_price'] * $val['quantity']);
                $gTotal = $gTotal+ $ordmaster['shipping_amount']+$ordmaster['vat_amount'];
        if (!is_array($val['size_id'])) {
          $size_name = get_db_field_value("wps_sizes", "size_name", "WHERE size_id = '" . $val['size_id'] . "'");
        }
        if (!is_array($val['color_id'])) {
          $color_name = get_db_field_value("wps_colors", "color_name", "WHERE color_id = '" . $val['color_id'] . "'");
        }
                ?>
                    <tr>
                        <td align="left">
                            <b><?php echo $val['product_name']; ?></b><br>
                            <?php if(isset($val['size_id']) && $val['size_id']!=''){ ?>
                            <strong>Size: </strong><?=$size_name;?>
                            <?php if(isset($color_name) && $color_name!=''){ ?><br /><strong>Color:
                            </strong><?=$color_name;?> <?php } ?>
                            <?php } ?>
                        </td>
                        <td align="right"> <?php echo display_price($val['product_price']); ?></td>
                        <td><?php echo $val['quantity']; ?></td>
                        <td align="right"> <?php echo display_price($val['product_price'] * $val['quantity']); ?></td>
                    </tr>
                    <?php
              }
              ?>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="3" align="left"><strong>Payment Method:</strong></td>
                        <td align="right"><?php echo $ordmaster['payment_method']; ?></td>
                    </tr>
                    <tr>
                        <td colspan="3" align="left"><strong>Shipping Amount:</strong></td>
                        <td align="right"><?php echo ($ordmaster['shipping_amount']>0)?display_price($ordmaster['shipping_amount']):'Excluding'; ?></td>
                    </tr>

                    <tr>
                        <td colspan="3" align="left"><strong>GST(18%):</strong></td>
                        <td align="right"> Included</td>
                    </tr>

                    <?php if ($ordmaster['coupon_discount_amount'] >0) { ?>
                    <tr>
                        <td colspan="3" align="left"><strong>Discount Amount:</strong></td>
                        <td align="right">- <?php echo display_price($ordmaster['coupon_discount_amount']); ?></td>
                    </tr>
                    <?php } ?>
                    <tr>
                        <td colspan="3" align="left"><strong>Total:</strong></td>
                        <td align="right"> <?php echo display_price($gTotal); ?></td>
                    </tr>
                </tfoot>
            </table>
            <table class="table table-bordered table-hover mobile_display">
                <tbody>
                    <?php
//              trace($ordmaster);
//                exit;
              $gTotal = 0;
              foreach ($orddetail as $key => $val) {
                $gTotal += ($val['product_price'] * $val['quantity']);
                $gTotal = $gTotal+ $ordmaster['shipping_amount'];
                
                ?>
                    <tr>
                        <td>Product</td>
                        <td align="left">
                            <b><?php echo $val['product_name']; ?></b>
                        </td>
                    </tr>
                    <tr>
                        <td>Unit Price</td>
                        <td> <?php echo display_price($val['product_price']); ?></td>
                    </tr>
                    <tr>
                        <td>Quantity</td>
                        <td><?php echo $val['quantity']; ?></td>
                    </tr>
                    <tr>
                        <td>Sub Total</td>
                        <td> <?php echo display_price($val['product_price'] * $val['quantity']); ?></td>
                    </tr>
                    <?php
              }
              ?>
                </tbody>
                <tfoot>
                    <tr>
                        <td align="left"><strong>Payment Method:</strong></td>
                        <td align="right"><?php echo $ordmaster['payment_method']; ?></td>
                    </tr>
                    <tr>
                        <td align="left"><strong>Shipping Amount:</strong></td>
                        <td align="right"> <?php echo display_price($ordmaster['shipping_amount']); ?></td>
                    </tr>
                    <?php if ($ordmaster['coupon_discount_amount'] >0) { ?>
                    <tr>
                        <td align="left"><strong>Discount Amount:</strong></td>
                        <td align="right">- <?php echo display_price($ordmaster['coupon_discount_amount']); ?></td>
                    </tr>
                    <?php } ?>

                    <tr>
                        <td align="left"><strong>GST:</strong></td>
                        <td align="right">Included</td>
                    </tr>

                    <tr>
                        <td align="left"><strong>Total:</strong></td>
                        <td align="right"> <?php echo display_price($gTotal); ?></td>
                    </tr>
                </tfoot>
            </table>


            <a href="<?=site_url();?>" class="btn default-btn" title="Home">Home</a>
            <a href="<?=base_url('products');?>" class="btn default-btn" title="Continue Shopping">Continue Shopping</a>
        </div>





    </div>

</section>
<?php $this->load->view('bottom'); ?>
