<?php
$this->load->view('top');
?>
 
 <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>
<div class="container">
  
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
     <h1 class="heading-h1" style="color: #e47812;font-size: 25px;font-weight: bold;margin-left: 14px;margin-top: 10px;">
       <?php if ($ordmaster['payment_status'] == 'Paid' || $ordmaster['payment_method'] == 'Cash') { ?>
        Order Placed
       <?php } else { ?> 
        Payment Failed
       <?php } ?>
     </h1>
    <div class="main">
      <section class="thank-you p-pb">
        <div class="container">
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12 ">
              <h4 class="mb-70 thankyou-text"> <?php if ($ordmaster['payment_status'] == 'Paid' || $ordmaster['payment_method'] == 'Cash') {  ?>
              Thank you for choosing life Optoelectronics<br/>
              <b>Order Confirmation Number/Tracking Number</b>: lifeOptoelectronics_<?php echo $ordmaster['order_id']; ?> is Confirmed!           
              <?php
            } else {
              ?>
              <b>Your Order</b> #<?php echo $ordmaster['order_id']; ?> has been canceled/declined!
              <?php
            }
            ?></h4>
            <br/>
             <table class="table table-bordered table-hover hidden-xs">
            <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'];
				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 display_price($ordmaster['shipping_amount']); ?></td>
                </tr>
                <tr>
                  <td colspan="3" align="left"><strong>GST:</strong></td>
                  <td align="right"> <?php echo display_price($ordmaster['vat_amount']); ?></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($ordmaster['total_amount']+$ordmaster['vat_amount']); ?></td>
                </tr>
            </tfoot>
          </table>
                  <table class="table table-bordered table-hover hidden-lg hidden-md hidden-sm">
            <tbody>
              <?php
              //trace($ordmaster);
              $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"><?php echo display_price($ordmaster['vat_amount']); ?></td>
                </tr>
                <tr>
                  <td align="left"><strong>Total:</strong></td>
                  <td align="right"> <?php echo display_price($ordmaster['total_amount']+$ordmaster['vat_amount']); ?></td>
                </tr>
            </tfoot>
          </table>
            
                
                <a href="<?=site_url();?>" class="btn btn-default btn-bg text-uppercase thnk-btn" title="Home">Home</a>
              <a href="<?=base_url('products');?>" class="btn btn-default btn-bg text-uppercase thnk-btn" title="Continue Shopping">Continue Shopping</a>
            <br/><br/></div>
          </div>
        </div>
      </section>
    </div>
  </div>
</div>


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