<!---------================================
    Printable Page
    inline/interna css/js required here
=========================================-->

<?php
$CI = &get_instance();
$CI->load->model('Soft_settings');
$Soft_settings = $CI->Soft_settings->retrieve_setting_editdata();
$image = $Soft_settings[0]['invoice_logo'];
$invoice_logo = "my-assets/image/logo/" . substr($image, strrpos($image, '/') + 1);

?>
<!-- Order pdf start -->
<!-- <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap" rel="stylesheet">

<link href="<?php echo MOD_URL . 'dashboard/assets/css/pdf.css'; ?>" rel="stylesheet" type="text/css"/>
<br>
<br> -->

<!-- new heading -->
<!-- <table>

  <tr>
    <td style="width: 60%;" align="left"><p><?php echo $companytitle; ?>
        <?php if (!empty($whatsapp)) {
	echo "<br>";
	echo display('mobile');
	echo " : ";
	echo $whatsapp;
}?>

        <?php if (!empty($email)) {
	echo "<br>";
	echo display('email');
	echo " : ";
	echo $email;

}?>
</p></td>
    <td style="width: 40%" valign="top">
        <table style="width: 100%;height:100%;" >
            <tr>
                <td style="width: 20%" align="left">
                    <p>1</p>
                </td>
                <td style="width: 80%" align="left">
                    <p>2</p>
                </td>
            </tr>
        </table>

    </td>

</tr>
</table> -->
<?php

$tablerowspan = 20;
if (!empty($payinfo)) {
	$tablerowspan = $tablerowspan + 1;
}

?>


<table style="width:100%"><tr><td align="left" style="width:50%" rowspan="<?php echo $tablerowspan; ?>">
    <img src="http://bigmacmall3.artech-system.com/my-assets/image/logo/02e8d370b8cf0f38b2897a21f183dddb.png" width="70" height="100">
    <p><?php echo $companytitle; ?>
        <?php if (!empty($whatsapp)) {
	echo "<br>";
	echo display('mobile');
	echo " : ";
	echo $whatsapp;
}?>

        <?php if (!empty($email)) {
	echo "<br>";
	echo display('email');
	echo " : ";
	echo $email;

}?>
</p></td>
<td style="width:20%" align="left" valign="top"><?php echo display('order_no') ?>:</td>
<td style="width:30%" align="right" valign="top">
 #<?php echo $order_no; ?>
</td>
</tr>
<tr>
     <td style="width:20%" align="left" ><?php echo display('order_date') ?>:</td>
    <td style="width:30%" align="right">
        {final_date}
    </td>
</tr>
 <?php if (!empty($payinfo)) {?>
    <tr>
    <td style="width:20%" align="left"><?php echo display('payment_method') ?>:</td>
    <td style="width:30%"  align="right"><?php echo (($payinfo['payment_id'] > 1) ? ucfirst($payinfo['payment_method']) : 'Cash on Delivery') ?></td>
    </tr>
<?php }?>
<tr>
<td style="width:20%" align="left"></td>
<td style="width:30%" align="right"></td>
</tr>
<tr>
<td style="width:20%" align="left"><?php echo display('order') ?>:</td>
<td style="width:30%" align="right"></td>
</tr>
<tr>
<td style="width:50%" align="left">{customer_name}</td>
</tr>
<tr>
<td style="width:20%" align="left"><?php echo display('address') ?></td>
<td style="width:30%" align="left"><?php echo $customer_address_1; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"></td>
<td style="width:30%" align="left"><?php echo $customer_address_2; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"></td>
<td style="width:30%" align="left"><?php echo $city . "," . $state; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"></td>
<td style="width:30%" align="left"><?php echo $country . "," . $zip; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"><?php echo display('mobile') ?></td>
<td style="width:30%" align="left"><?php echo $customer_mobile; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"><?php echo display('email') ?></td>
<td style="width:30%" align="left"><?php echo $customer_email; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"></td>
<td style="width:30%" align="left"></td>
</tr>
<tr>
<td style="width:20%" align="left"><?php echo display('delivery_method') ?></td>
<td style="width:30%" align="left"></td>
</tr>
<tr>
<td style="width:50%" align="left"><?php echo $ship_customer_name; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"><?php echo display('address') ?></td>
<td style="width:30%" align="left"><?php echo $ship_customer_address_1; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"></td>
<td style="width:30%" align="left"><?php echo $ship_customer_address_2; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"></td>
<td style="width:30%" align="left"><?php echo $ship_city . "," . $ship_state; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"></td>
<td style="width:30%" align="left"><?php echo $ship_country . "," . $ship_zip; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"><?php echo display('mobile') ?></td>
<td style="width:30%" align="left"><?php echo $ship_customer_mobile; ?></td>
</tr>
<tr>
<td style="width:20%" align="left"><?php echo display('email') ?></td>
<td style="width:30%" align="left"><?php echo $ship_customer_email; ?></td>
</tr>
</table>





<!-- end new heading -->



<!-- <table>
    <tr style="height:300px;">
        <td width="66%" style="text-align: left;">
             <img src="<?php if (isset($invoice_logo)) {echo getcwd() . '/' . $invoice_logo;}?>" class="" alt="" class="inv_logo" style="width: auto;height: 50px;">
                            <br>
                            <span class="label label-success-outline m-r-15 p-10" ><?php echo display('order_to') ?></span>
                            <span class="label label-success-outline m-r-15 p-10" >{company_info}</span>
                            <address class="mt_10">
                                <abbr><strong>{company_name}</strong></abbr><br>
                                <abbr>{address}<br>
                                <abbr><b><?php echo display('mobile') ?>:</b></abbr> <?php echo $mobile1; ?><br>
                                <abbr><b><?php echo display('email') ?>:</b></abbr>
                                {email}<br>
                                <abbr><b><?php echo display('website') ?>:</b></abbr>
                                {website}
                            </address>
                            {/company_info}
        </td>
         <td width="34%" style="text-align: left;">
            <h2 class="m-t-0"><?php echo display('order') ?></h2>
                            <div><?php echo display('order_no') ?>: {order_no}<br><?php echo display('order_date') ?>: {final_date}
                            <?php if (!empty($payinfo)) {?>
                            <br><strong><?php echo display('payment_method') ?>: <?php echo (($payinfo['payment_id'] > 1) ? ucfirst($payinfo['payment_method']) : 'Cash on Delivery') ?></strong>
                            <?php }?>
                            <br>

                            <?php echo display('order_from') ?>
                              <br>{customer_name}
                              <br><abbr><?php echo display('address') ?>:</abbr>
                                    <?php if ($customer_address) {?>
                                    <c class="m_p_0">{customer_address}</c>
                                    <?php }?><br>
                                    <abbr><?php echo display('mobile') ?>:</abbr><?php if ($customer_mobile) {?>{customer_mobile}<?php }if ($customer_email) {?>
                                    <br>
                                    <abbr><?php echo display('email') ?>:</abbr>{customer_email}
                                    <?php }?>

                        </div>
        </td>
    </tr>
</table> -->

<br>
<br>
<table class="table table-striped table-bordered cizgili" border="0" cellspacing="0" cellpadding="0" width="100%">
                            <thead>
                                 <tr>
                                    <th width="10%"><?php echo display('sl') ?></th>
                                    <th width="30%"><?php echo display('product_name') ?></th>
                                    <th width="10%"><?php echo display('variant') ?></th>
                                    <th width="10%"><?php echo display('unit') ?></th>
                                    <th width="10%"><?php echo display('quantity') ?></th>
                                    <th width="10%"><?php echo display('rate') ?></th>
                                    <th width="10%"><?php echo display('discount') ?></th>
                                    <th width="10%"><?php echo display('ammount') ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
$ordertotal = 0;
foreach ($order_detail as $order_data) {
	$ordertotal = $ordertotal + $order_data['total_price'];
} //foreach ($order_all_data as $order_data) {
// var_dump($order_detail);
?>
                                {order_all_data}

                                <tr>
                                    <td width="10%">{sl}</td>
                                    <td width="30%"><strong>{product_name} - ({product_model})</strong></td>
                                    <td width="10%">{variant_name}</td>
                                    <td width="10%">{unit_short_name}</td>
                                    <td width="10%">{quantity}</td>
                                    <td width="10%"><?php echo (($position == 0) ? "$currency {rate}" : "{rate} $currency") ?></td>
                                    <td width="10%"><?php echo (($position == 0) ? "$currency {discount}" : "{discount} $currency") ?></td>
                                    <td width="10%"><?php echo (($position == 0) ? "$currency {total_price}" : "{total_price} $currency") ?></td>

                                </tr>
                                {/order_all_data}
                            </tbody>
                        </table>

<table class="table table-striped table-bordered cizgili" border="0" cellspacing="0" cellpadding="0">
                                    <?php if ($order_all_data[0]['discount'] != 0) {?>
                                    <tr>
                                        <th class="b1" width="80%" align="right"><?php echo display('total_discount') ?> : </th>
                                        <td width="20%"><?php echo (($position == 0) ? "$currency {order_discount}" : "{order_discount} $currency") ?> </td>
                                    </tr>
                                    <?php }
$this->db->select('a.*,b.tax_name');
$this->db->from('order_tax_col_summary a');
$this->db->join('tax b', 'a.tax_id = b.tax_id');
$this->db->where('a.order_id', $order_id);
$this->db->where('a.tax_id', 'H5MQN4NXJBSDX4L');
$tax_info = $this->db->get()->row();

if ($tax_info) {?>
                                    <tr>
                                        <th class="b1 total_cgst" width="80%" align="right"><?php echo html_escape($tax_info->tax_name) ?> :</th>
                                        <td class="total_cgst" width="20%"><?php echo (($position == 0) ? $currency . $tax_info->tax_amount : $tax_info->tax_amount . $currency); ?>
                                        </td>
                                    </tr>
                                    <?php }
$this->db->select('a.*,b.tax_name');
$this->db->from('order_tax_col_summary a');
$this->db->join('tax b', 'a.tax_id = b.tax_id');
$this->db->where('a.order_id', $order_id);
$this->db->where('a.tax_id', '52C2SKCKGQY6Q9J');
$tax_info = $this->db->get()->row();

if ($tax_info) {?>
                                    <tr>
                                        <th class="b1 total_sgst" width="80%" align="right"><?php echo html_escape($tax_info->tax_name) ?> :</th>
                                        <td class="total_sgst" width="20%"><?php echo (($position == 0) ? $currency . $tax_info->tax_amount : $tax_info->tax_amount . $currency); ?>
                                        </td>
                                    </tr>
                                    <?php }
$this->db->select('a.*,b.tax_name');
$this->db->from('order_tax_col_summary a');
$this->db->join('tax b', 'a.tax_id = b.tax_id');
$this->db->where('a.order_id', $order_id);
$this->db->where('a.tax_id', '5SN9PRWPN131T4V');
$tax_info = $this->db->get()->row();

if ($tax_info) {
	?>
                                    <tr>
                                        <th class="b1 total_igst" width="80%" align="right"><?php echo html_escape($tax_info->tax_name) ?> :</th>
                                        <td class="total_igst" width="20%"><?php echo (($position == 0) ? $currency . $tax_info->tax_amount : $tax_info->tax_amount . $currency); ?>
                                        </td>
                                    </tr>
                                    <?php }?>
                                    <?php if ($order_all_data[0]['service_charge'] != 0) {?>
                                    <tr>
                                        <th class="b1 service_charge" width="80%" align="right"><?php echo display('service_charge') ?> :</th>
                                        <td class="service_charge" width="20%"><?php echo (($position == 0) ? "$currency {service_charge}" : "{service_charge} $currency") ?></td>
                                    </tr>
                                    <?php }?>
                                     <tr>
                                        <th class="b1 grand_total" width="80%" align="right"><?php echo display('sub_total') ?> :</th>
                                        <td class="grand_total" width="20%"><?php echo (($position == 0) ? "$currency.$ordertotal" : "$ordertotal. $currency") ?></td>
                                    </tr>
                                     <?php if ($order_usedrewardpoint != 0) {?>
                                      <tr>
                                        <th class="b1 grand_total" width="80%" align="right"><?php echo display('fun_payment') ?> :</th>
                                        <td class="grand_total" width="20%"><?php echo (($position == 0) ? "$currency.$order_usedrewardpoint" : "$order_usedrewardpoint. $currency") ?></td>
                                    </tr>
                                     <?php } //if()?>

                                    <tr>
                                        <th class="b1" width="80%" align="right"><?php echo display('paid_ammount') ?> : </th>
                                        <td width="20%"><?php echo (($position == 0) ? "$currency {paid_amount}" : "{paid_amount} $currency") ?></td>
                                    </tr>
                                     <tr>
                                        <th class="b1 grand_total" width="80%" align="right"><?php echo display('grand_total') ?> :</th>
                                        <td class="grand_total" width="20%"><?php echo (($position == 0) ? "$currency {total_amount}" : "{total_amount} $currency") ?></td>
                                    </tr>

                                    <!-- <?php if ($order_all_data[0]['due_amount'] != 0) {?>
                                    <tr>
                                        <th class="b1" width="80%" align="right"><?php echo display('due') ?> : </th>
                                        <td width="20%"><?php echo (($position == 0) ? "$currency {due_amount}" : "{due_amount} $currency") ?></td>
                                    </tr>
                                    <?php }?> -->
                                </table>

<!-- Order pdf end