Local fixes to invoice display and retrieve traffic data
This commit is contained in:
@@ -416,7 +416,7 @@ class Invoice_TCPDF_Default extends Invoice_TCPDF {
|
||||
$this->SetX($x+8);
|
||||
$this->Cell(0,0,'Payments Received');
|
||||
$this->SetX($x+135);
|
||||
$this->Cell(0,0,Currency::display($this->io->payments()),0,0,'R');
|
||||
$this->Cell(0,0,$this->io->payments_total(TRUE),0,0,'R');
|
||||
}
|
||||
|
||||
if ($this->io->credit_amt) {
|
||||
|
@@ -21,6 +21,7 @@ class Model_Invoice extends ORMOSB {
|
||||
'invoice_item_tax'=>array(),
|
||||
'service'=>array('through'=>'invoice_item'),
|
||||
'payment'=>array('through'=>'payment_item'),
|
||||
'payment_item'=>array('far_key'=>'id'),
|
||||
);
|
||||
|
||||
protected $_sorting = array(
|
||||
@@ -132,14 +133,14 @@ class Model_Invoice extends ORMOSB {
|
||||
}
|
||||
|
||||
public function payments() {
|
||||
return ($this->loaded() AND ! $this->_changed) ? $this->payments->find_all() : NULL;
|
||||
return ($this->loaded() AND ! $this->_changed) ? $this->payment_item->find_all() : NULL;
|
||||
}
|
||||
|
||||
public function payments_total($format=FALSE) {
|
||||
$result = 0;
|
||||
|
||||
foreach ($this->payments() as $po)
|
||||
$result += $po->total_amt;
|
||||
$result += $po->alloc_amt;
|
||||
|
||||
return $format ? Currency::display($result) : $result;
|
||||
}
|
||||
|
@@ -47,18 +47,26 @@
|
||||
<td class="head" colspan="4">Charges Detail:</td>
|
||||
</tr>
|
||||
<?php foreach ($invoice->sorted_service_items('recur_schedule') as $cat => $catitems) { ?>
|
||||
<?php if ($cat) { ?>
|
||||
<tr>
|
||||
<td><div id="toggle_<?php echo $cat; ?>"><?php echo HTML::image($mediapath->uri(array('file'=>'img/toggle-closed.png')),array('alt'=>'+')); ?></div><script type="text/javascript">$("#toggle_<?php echo $cat; ?>").click(function() {$('#detail_toggle_<?php echo $cat; ?>').toggle();});</script></td>
|
||||
<td><?php echo StaticList_RecurSchedule::display($cat); ?></td>
|
||||
<td><?php printf('%s Services',count($catitems['items'])); ?></td>
|
||||
<td class="bold-right"><?php echo Currency::display($catitems['total']); ?></td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="3">Other Items</td>
|
||||
<td class="bold-right"><?php echo Currency::display($catitems['total']); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td colspan="2">
|
||||
<div id="detail_toggle_<?php echo $cat; ?>">
|
||||
<table class="box-full" border="0">
|
||||
<?php foreach ($catitems['items'] as $item) {?>
|
||||
<?php if ($catitems['items']) { ?>
|
||||
<?php foreach ($catitems['items'] as $item) { ?>
|
||||
<!-- Product Information -->
|
||||
<tr class="head">
|
||||
<td><?php echo HTML::anchor('/user/service/view/'.$item->service->id,$item->service->id()); ?></td>
|
||||
@@ -83,7 +91,7 @@
|
||||
$m = StaticList_Module::record('module','name','id',$subitem->module_id);
|
||||
// @todo Need to remove the explicit test for 'charge' and be more dynamic
|
||||
$mi = ORM::factory($m,$m == 'charge' ? $subitem->charge_id : $subitem->id);
|
||||
$display = $mi->invoice_display();
|
||||
$display = $mi->details('invoice');
|
||||
} else {
|
||||
$display = 'Other';
|
||||
}
|
||||
@@ -104,6 +112,28 @@
|
||||
<td class="right"><?php echo Currency::display($invoice->items_service_tax($item->service_id));?></td>
|
||||
</tr>
|
||||
<!-- Product End Sub Items Tax -->
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<!-- Product Sub Items -->
|
||||
<?php
|
||||
foreach ($invoice->items_sub(NULL) as $subitem) {
|
||||
if (! is_null($subitem->module_id)) {
|
||||
$m = StaticList_Module::record('module','name','id',$subitem->module_id);
|
||||
// @todo Need to remove the explicit test for 'charge' and be more dynamic
|
||||
$mi = ORM::factory($m,$m == 'charge' ? $subitem->charge_id : $subitem->id);
|
||||
$display = $mi->details('invoice');
|
||||
} else {
|
||||
$display = 'Other';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><?php echo $subitem->trannum(); ?></td>
|
||||
<td><?php echo $display; ?></td>
|
||||
<td class="right"><?php echo Currency::display($subitem->subtotal());?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<!-- Product End Sub Items -->
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user