cmc-sales/app/views/elements/line_items_table.ctp
2013-05-30 23:34:10 +10:00

125 lines
3.7 KiB
PHP
Executable file

<table border="1" cellpadding="2" cellspacing="0" >
<thead>
<tr bgcolor="#f2f2f2" nobr="true">
<th width="<?=$colWidths['item'];?>" align="center">ITEM<br />NO.</th>
<th width="<?=$colWidths['qty'];?>" align="center">QTY</th>
<th width="<?=$colWidths['desc'];?>" align="center">DESCRIPTION</th>
<th width="<?=$colWidths['unit'];?>" align="center">UNIT<br>PRICE</th>
<th width="<?=$colWidths['total'];?>" align="center">TOTAL<br>PRICE</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th align="center"><?=$currencyCode?></th>
<th align="center"><?=$currencyCode?></th>
</tr>
</thead>
<tbody>
<?
$hasOptions = false;
foreach($document['LineItem'] as $li):?>
<tr>
<td width="<?=$colWidths['item'];?>" align="center" valign="top">
<? if($li['option'] == 1) {
echo 'Option<br>';
$hasOptions = true;
}
?>
<?=$li['item_number'];?>
</td>
<td width="<?=$colWidths['qty'];?>" align="center" valign="top"><?=$decimal->formatDecimal($li['quantity']);?></td>
<td width="<?=$colWidths['desc'];?>"><?=$li['title'];?><br>
<?=$li['description'];?>
</td>
<td width="<?=$colWidths['unit'];?>" align="center" valign="top">
<?
if($li['has_text_prices']):
echo $li['unit_price_string'];
?>
<?
else:
?>
<?=$number->currency($li['gross_unit_price'], $currencyCode);?>
<? if($li['discount_percent']):?>
<br>less<br><?=$li['discount_percent']?>%<br>
discount<br>
(-<?=$number->currency($li['discount_amount_unit'], $currencyCode);?>)<br>
=<br>
<?=$number->currency($li['net_unit_price'], $currencyCode);?>
<?endif;?>
<?endif;?>
</td>
<td width="<?=$colWidths['total'];?>" align="center" valign="top">
<?
if($li['has_text_prices']):
echo $li['gross_price_string'];
?>
<?
else:
?>
<?=$number->currency($li['gross_price'], $currencyCode);?>
<? if($li['discount_percent']):?>
<br>less<br><?=$li['discount_percent']?>%<br>
discount*<br>
(-<?=$number->currency($li['discount_amount_total'], $currencyCode);?>)<br>
=<br>
<?=$number->currency($li['net_price'], $currencyCode);?>
<?endif;?>
<?endif;?>
</td>
</tr>
<?endforeach;?>
</tbody>
<tfoot nobr="true">
<tr nobr="true">
<td width="<?=$colWidths['item'];?>"></td>
<td width="<?=$colWidths['qty'];?>"></td>
<td width="<?=$colWidths['desc'];?>"><?=$totalsDescText['subtotal']?></td>
<td width="<?=$colWidths['unit'];?>"></td>
<td width="<?=$colWidths['total'];?>" align="center">
<?
if(!$hasOptions) {
echo $number->currency($totals['subtotal'], $currencyCode);
}
else {
echo $currencySymbol.'TBA';
}
?></td>
</tr>
<tr nobr="true">
<td width="<?=$colWidths['item'];?>"></td>
<td width="<?=$colWidths['qty'];?>"></td>
<td width="<?=$colWidths['desc'];?>"><?=$totalsDescText['gst'];?></td>
<td width="<?=$colWidths['unit'];?>"></td>
<td width="<?=$colWidths['total'];?>" align="center">
<?
if(!$hasOptions) {
echo $number->currency($totals['gst'], $currencyCode);
}
else {
echo $currencySymbol.'TBA';
}
?>
</td>
</tr>
<tr nobr="true">
<td width="<?=$colWidths['item'];?>"></td>
<td width="<?=$colWidths['qty'];?>"></td>
<td width="<?=$colWidths['desc'];?>"><?=$totalsDescText['total'];?></td>
<td width="<?=$colWidths['unit'];?>" align="center"><?=$currencyCode?></td>
<td width="<?=$colWidths['total'];?>" align="center">
<?
if(!$hasOptions) {
echo $number->currency($totals['total'], $currencyCode);
}
else {
echo $currencySymbol.'TBA';
}
?></td>
</tr>
</tfoot>
</table>