
    <?php     
    $sl_no = 1; 
    $query = $this->main_model->freight_info($freight_id);
    foreach($query as $row): 
    ?>

    <table width="100%">
        <tbody>
            <tr>
                <td colspan="2" align="center">
                    <strong style="font-size: 15px;"><u>FREIGHT INVOICE</u></strong>
                </td>                         
            </tr> 
            <tr>
                <td>&nbsp;</td>                        
                <td>&nbsp;</td>                    
            </tr>             
            <tr>
                <td width="50%">
                    <strong>INV NO./<?php echo $row['invoice_no']; ?></strong>
                </td>                        
                <td width="50%">
                    <strong>Date: <?php echo date('d.m.Y', strtotime($row['date'])); ?></strong>
                </td>                        
            </tr>
            <tr>
                <td>&nbsp;</td>                        
                <td>&nbsp;</td>                    
            </tr>            
            <tr>
                <td width="50%" style="vertical-align: top">
                    <strong> 
                        To,
                        <pre><?php echo $row['to']; ?></pre> 
                        <br /><br /><br />
                        ATTN: <span style="text-transform: uppercase;"><?php echo $row['ATTN']; ?></span> 
                    </strong>                            
                </td>                        
                <td width="50%">
                    <strong> 
                        SHIPPER: <?php echo $row['SHIPPER']; ?><br />
                        HBL: <?php echo $row['HBLNO']; ?><br />
                        <?php if(!empty($row['HAWABLNO'])): ?>HAWABL No.: <?php echo $row['HAWABLNO']; ?><br /><?php endif; ?>
                        MBL No.: <?php echo $row['MBLNO']; ?><br />
                        <?php if(!empty($row['MAWBLNO'])): ?>MAWBL No.: <?php echo $row['MAWBLNO']; ?><br /><?php endif; ?>
                        <?php echo $row['pol_pod_type']; ?>: <?php echo $row['pol_pod']; ?><br />
                        POD: <?php echo $row['SHPT_EX']; ?><br />
                        VOL: <?php echo $row['vol']; ?><br />
                        GROSS WEIGHT: <?php echo $row['QTY']; ?><br />
                        CNTR: <?php echo $row['CNTR']; ?><br />
                        COMMODITY: <?php echo $row['commodity']; ?><br />
                        L/C No.: <?php echo $row['LCNO']; ?><br />
                    </strong>                            
                </td> 
            </tr>
        </tbody>
    </table>             

    <br />           
    <table style="border-collapse: collapse;" width="100%">
        <thead><tr>
            <td align="center" style="padding: 0.25rem; border: 1px solid #ccc;"><strong>SL No.</strong></td> 
            <td align="center" style="padding: 0.25rem; border: 1px solid #ccc;"><strong>Description</strong></td> 
            <td align="center" style="padding: 0.25rem; border: 1px solid #ccc;"><strong>Freight Rate</strong></td> 
            <td align="center" style="padding: 0.25rem; border: 1px solid #ccc;"><strong>Exchange Rate</strong></td> 
            <td align="center" style="padding: 0.25rem; border: 1px solid #ccc;"><strong>Unit</strong></td> 
            <td align="center" style="padding: 0.25rem; border: 1px solid #ccc;"><strong>Amount (In BDT.)</strong></td> 
        </tr></thead>
        <tbody> 
            <?php 
            $amount = '';
            $query_fi = $this->main_model->freightinvoice_info($row['freight_id']);
            foreach($query_fi as $row_fi): 
            ?>
            <tr>
                <td align="center" style="padding: 0.25rem; border: 1px solid #ccc;"><?php if($row_fi['freight_invoice_id']): echo $sl_no; $sl_no++; endif; ?></td> 
                <td style="padding: 0.25rem; border: 1px solid #ccc;"><?php echo $row_fi['description']; ?></td>
                <td align="right" style="padding: 0.25rem; border: 1px solid #ccc;">$ <?php echo $row_fi['freight_rate']; ?></td>
                <td align="right" style="padding: 0.25rem; border: 1px solid #ccc;">$ <?php echo $row_fi['exchange_rate']; ?></td>
                <td align="right" style="padding: 0.25rem; border: 1px solid #ccc;"><?php echo $row_fi['unit']; ?></td>
                <td align="right" style="padding: 0.25rem; border: 1px solid #ccc;">&#2547; <?php echo $row_fi['amount']; $amount += $row_fi['amount']; ?></td>
            </tr>
            <?php endforeach; ?>
            <tr>
                <td colspan="6" align="right" style="padding: 0.25rem; border: 1px solid #ccc;"><strong>Total = &#2547; <?php echo number_format((float)$amount,'2','.',''); ?></strong></td> 
            </tr>                                
            <tr>
                <td colspan="6" align="center" style="padding: 0.25rem; border: 1px solid #ccc;">In Words: <?php echo $this->main_model->get_bd_amount_in_text($amount); ?></td> 
            </tr>                                
        </tbody>
    </table> 

    <br/><br /><br /><br /><br /><br />
    <table width="100%">
        <tbody>
            <tr>
                <td width="33.33%" align="center">
                    <u>______________________</u>
                </td>                        
                <td width="33.33%" align="center">
                    <u>______________________</u>
                </td>                        
                <td width="33.33%" align="center">
                    <u>______________________</u>
                </td>                        
            </tr>
            <tr>
                <td width="33.33%" align="center">
                    Prepared By
                </td>                        
                <td width="33.33%" align="center">
                    Checked By
                </td>                        
                <td width="33.33%" align="center">
                    Approved By
                </td>                        
            </tr>            
        </tbody>
    </table>            

    <br /><br /><br />
    <p class="text-center"><?php echo $this->main_model->company_address();?></p> 
                    
    <?php endforeach; ?>
