Fixed Options now show TBA

This commit is contained in:
Karl Cordes 2011-06-23 17:03:24 +10:00
parent 1d9034a132
commit c8c9215179
3 changed files with 71 additions and 14 deletions

View file

@ -202,7 +202,7 @@ class DocumentsController extends AppController {
$this->set('docTypeFullName',strtoupper($docTypeFullName));
$this->set('currency',$currency);
$this->set('currencyCode', $currency['Currency']['iso4217']);
$this->set('currencySymbol', $currency['Currency']['symbol']);
$gst = $enquiry['Enquiry']['gst'];

View file

@ -16,11 +16,15 @@
</tr>
</thead>
<tbody>
<?foreach($document['LineItem'] as $li):?>
<?
$hasOptions = false;
foreach($document['LineItem'] as $li):?>
<tr nobr="true">
<td width="<?=$colWidths['item'];?>" align="center" valign="top">
<? if($li['option'] == 1) {
echo 'Option';
$hasOptions = true;
}
?>
<?=$li['item_number'];?>
@ -57,7 +61,15 @@
<td width="<?=$colWidths['qty'];?>"></td>
<td width="<?=$colWidths['desc'];?>"><?=$totalsDescText['subtotal']?></td>
<td width="<?=$colWidths['unit'];?>"></td>
<td width="<?=$colWidths['total'];?>" align="center"><?=$number->currency($totals['subtotal'], $currencyCode);?></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>
@ -65,12 +77,19 @@
<td width="<?=$colWidths['desc'];?>"><?=$totalsDescText['gst'];?></td>
<td width="<?=$colWidths['unit'];?>"></td>
<td width="<?=$colWidths['total'];?>" align="center"><?
if(!$hasOptions) {
if($gst ==1) {
echo $number->currency($totals['gst'], $currencyCode);
}
else {
echo 'N/A';
}?>
}
}
else {
echo $currencySymbol.'TBA';
}
?>
</td>
</tr>
<tr nobr="true">
@ -78,7 +97,15 @@
<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"><?=$number->currency($totals['total'], $currencyCode);?></td>
<td width="<?=$colWidths['total'];?>" align="center">
<?
if(!$hasOptions) {
echo $number->currency($totals['total'], $currencyCode);
}
else {
echo $currencySymbol.'TBA';
}
?></td>
</tr>
</tbody>
</tbody>
</table>

View file

@ -27,11 +27,16 @@
</tr>
</thead>
<tbody>
<?foreach($document['LineItem'] as $li):?>
<?
$hasOptions = false;
foreach($document['LineItem'] as $li):?>
<tr class="lineItem">
<td>
<? if($li['option'] == 1) {
echo 'Option<br>';
$hasOptions = true;
}
?>
<?=$li['item_number'];?></td>
@ -73,7 +78,16 @@
<td></td>
<td class="leftAlign">SUB-TOTAL (Excluding GST)</td>
<td></td>
<td><?=$number->currency($totals['subtotal'], $currencyCode);?></td>
<td><?
if(!$hasOptions) {
echo $number->currency($totals['subtotal'], $currencyCode);
}
else {
echo $currencySymbol.'TBA';
}
?>
</td>
<td></td>
</tr>
<tr>
@ -81,7 +95,16 @@
<td></td>
<td class="leftAlign">GST (10%)</td>
<td></td>
<td><?=$number->currency($totals['gst'], $currencyCode);?></td>
<td>
<?
if(!$hasOptions) {
echo $number->currency($totals['gst'], $currencyCode);
}
else {
echo $currencySymbol.'TBA';
}
?>
</td>
<td></td>
</tr>
<tr>
@ -89,7 +112,14 @@
<td></td>
<td class="leftAlign">TOTAL PAYABLE (INCLUDING GST)</td>
<td></td>
<td><?=$number->currency($totals['total'], $currencyCode);?></td>
<td><?
if(!$hasOptions) {
echo $number->currency($totals['total'], $currencyCode);
}
else {
echo $currencySymbol.'TBA';
}
?></td>
<td></td>
</tr>
</tfoot>