<table>
    <tr>
        <td>
            <table style="font-size:9pt; text-align:left;border-collapse:collapse;border:1px solid #c8c8c8;padding: 5 5 5 5;">
                <tr>
                    <td style="background-color: #d8d8d8;">Supplier</td>
                </tr>
                <tr>
                    <td><p><?php if ($po->name != '') { echo $po->name; } if ($po->TAXID != '') { echo " - ".$po->TAXID;}
                            ?><?php if ($po->ADDRESS != '') echo '<br/>' . $po->ADDRESS; ?>
                            <?php if ($po->REGION != '') echo '<br/>' . $po->REGION; ?>
                            <?php if ($po->CITY != '') {
    if ($po->REGION != '') echo ', ';
    else echo '<br/>';
    echo $po->CITY;
} ?><?php if ($po->PHONE != '') echo '<br/>' . $po->PHONE; ?>
                            <?php if ($po->PHONE2 != '') {
    if ($po->PHONE != '') echo ', ';
    else echo '<br/>';
    echo $po->PHONE2;
} ?><?php if ($po->EMAIL != '') echo '<br/>' . $po->EMAIL; ?></p>
                    </td>
                </tr>
            </table>
        </td>
        <td>
            <table style="font-size: 9pt;">
                <tr>
                    <td style="text-align:right;width:70%;"><?php echo $reportlabel; ?> :</td>
                    <td style="width:2%;">&nbsp;</td>
                    <td>
                        <?php echo $po->REFERENCE; ?>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right;width:70%;">Reference :</td>
                    <td style="width:2%;">&nbsp;</td>
                    <td>
                        <?php echo $po->COMMENTS; ?>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right;width:70%;">Created on :</td>
                    <td style="width:2%;">&nbsp;</td>
                    <td>
                        <?php echo $this->formatslist->dateFormat(date('Y-m-d')); ?>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right;">Invoice Date :</td>
                    <td>&nbsp;</td>
                    <td>
                        <?php echo $this->formatslist->dateFormat($po->DELIVERYDATE); ?>
                    </td>
                </tr>
<!--                <tr>
                    <td style="text-align:right;">
                        <?php if ($po->REFERENCE != '') echo 'Reference :'; ?>
                    </td>
                    <td>&nbsp;</td>
                    <td>
                        <?php if ($po->REFERENCE != '') echo $po->REFERENCE; ?>
                    </td>
                </tr>-->
            </table>
        </td>
    </tr>
    <tr>
        <td colspan="2"></td>
    </tr>
    <tr>
        <td colspan="2">
            <table style="font-size: 9pt; text-align:left;border-collapse:collapse;border:1px solid #c8c8c8;padding: 5 5 5 5;">
                <tr style="background-color: #d8d8d8;">
                    <td style="width: 45%;">Item</td>
                    <td style="text-align:right;width: 10%;border-left: solid 1px #c8c8c8;">Quantity</td>
                    <td style="text-align:right;width: 15%;border-left: solid 1px #c8c8c8;">Unit Price</td>
<!--                    <td style="text-align:right;width: 15%;border-left: solid 1px #c8c8c8;">Discount</td>-->
                    <td style="text-align:right;width: 15%;border-left: solid 1px #c8c8c8;">Tax</td>
                    <td style="text-align:right;width: 15%;">Line Total</td>
                </tr>
                <?php $totallines = 0;
$nettotal = 0;
foreach ($polines as $value) {
    $totallines = $totallines + 1;
    echo '<tr><td>' . $totallines . '. ' . $value->NAME;
    echo '<div>' . $value->CODE . '</div>';
    if ($value->DESCRIPTION != '') echo '<div>' . nl2br($value->DESCRIPTION) . '</div>';
    echo '</td>';
    echo '<td style="text-align:center;border-left: solid 1px #c8c8c8;">' . $value->QUANTITY . '</td>                                <td style="text-align:right;border-left: solid 1px #c8c8c8;">' . $this->formatslist->formatCurrencywithHash($value->UNITPRICE) . '</td>'
//            . '<td style="text-align:right;border-left: solid 1px #c8c8c8;">' . $this->formatslist->formatCurrencywithHash($value->DISCOUNT). '</td>'
            . '<td style="text-align:right;border-left: solid 1px #c8c8c8;">' . $this->formatslist->formatCurrencywithHash($value->TAXAMOUNT) . '</td>'
            . '<td style="text-align:right;border-left: solid 1px #c8c8c8;">' . $this->formatslist->formatCurrencywithHash(($value->QUANTITY * $value->UNITPRICE) + $value->DISCOUNT+$value->TAXAMOUNT) . '</td></tr>';
    $nettotal = $nettotal + (($value->QUANTITY * $value->UNITPRICE) + $value->DISCOUNT+$value->TAXAMOUNT);
} 
echo '</table>';
echo '<table style="font-size: 9pt; text-align:left;border-collapse:collapse;border:1px solid #c8c8c8;padding: 5 5 5 5;width: 100%;">';

echo '<tr><td style="width: 75%;text-align:right;">Net Total</td><td style="width: 25%;border-left: solid 1px #c8c8c8;text-align:right;">' . $this->formatslist->formatCurrencywithHash($nettotal) . '</td></tr>';

echo '<tr><td style="width: 75%;text-align:right;">Tax Details</td><td style="border-left: solid 1px #c8c8c8;text-align:right;">' . $taxresultdata . '</td></tr>';

echo '<tr><td style="width: 75%;text-align:right;">Discount</td><td style="border-left: solid 1px #c8c8c8;text-align:right;">' . $this->formatslist->formatCurrencywithHash($po->DISCOUNT) . '</td></tr>';

echo '<tr><td style="width: 75%;text-align:right;">Freight</td><td style="border-left: solid 1px #c8c8c8;text-align:right;">' . $this->formatslist->formatCurrencywithHash($po->FREIGHTAMOUNT) . '</td></tr>';

echo '<tr><td style="width: 75%;text-align:right;">Adjustment</td><td style="border-left: solid 1px #c8c8c8;text-align:right;">' . $this->formatslist->formatCurrencywithHash($po->ADJUSTMENT) . '</td></tr>';

echo '<tr><td style="width: 75%;text-align:right;"><b>Grand Total</b></td><td style="border-left: solid 1px #c8c8c8;text-align:right;"><b>' . $this->formatslist->formatCurrencywithHash($po->TOTALAMOUNT) . '</b></td></tr>'; ?> </table>
        </td>
    </tr>
    <tr>
        <td colspan="2"></td>
    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td colspan="2" style="font-size:9pt;text-align: right;">Authorized By: <span style="color:#c8c8c8;">_______________________________________</span></td>
    </tr>
    <tr>
        <td colspan="2"></td>
    </tr>
    <tr>
        <td colspan="2">
            <table style="font-size:9pt; text-align:left;border-collapse:collapse;border:1px solid #c8c8c8;padding: 5 5 5 5;">
                <tr>
                    <td style="background-color: #d8d8d8;"> Terms & Conditions </td>
                </tr>
                <tr>
                    <td style="font-size:8pt;">
                        <p>
                            <?php //echo nl2br($po->TERMS); ?>
                        </p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>