Work on invoice printing - to clean up
This commit is contained in:
@@ -53,43 +53,6 @@ class Model_Service extends ORMOSB {
|
||||
return $this->product->product_translate->find()->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find invoices associated with this service
|
||||
*/
|
||||
public function invoices() {
|
||||
$return = array();
|
||||
|
||||
foreach ($this->invoice->distinct('id')->find_all() as $invoice) {
|
||||
$return[$invoice->id]['due'] = $invoice->due();
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find invoices currently outstanding associated with this service
|
||||
*/
|
||||
public function invoices_due() {
|
||||
$return = array();
|
||||
|
||||
foreach ($this->invoices() as $id => $invoice)
|
||||
if ($invoice['due'])
|
||||
array_push($return,$invoice);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the total of invoices due for this service
|
||||
*/
|
||||
public function invoices_due_total() {
|
||||
$total = 0;
|
||||
foreach ($this->invoices_due() as $invoice)
|
||||
$total += $invoice['due'];
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
// @todo To implement
|
||||
/**
|
||||
* Calculate the tax for this item
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="border: 0px;"><?php printf('%s %s',$service->account->accnum(),$service->account->name()); ?></td>
|
||||
<td style="border: 0px; text-align: right;"><?php printf('(%s: %s)',_('Invoices Due'),Currency::display($service->invoices_due_total())); ?></td>
|
||||
<td style="border: 0px; text-align: right;"><?php printf('(%s: %s)',_('Invoices Due'),Currency::display($service->account->invoices_due_total())); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
@@ -4,6 +4,6 @@
|
||||
<td><?php printf('%s (%s)',$service->name(),$service->id); ?></td>
|
||||
<td><?php echo $service->display('recur_schedule'); ?></td>
|
||||
<td><?php echo $service->display('price'); ?></td>
|
||||
<td><?php echo $service->invoices_due_total(); ?></td>
|
||||
<td><?php echo $service->account->invoices_due_total(); ?></td>
|
||||
<td><?php echo $service->display('date_next_invoice'); ?></td>
|
||||
</tr>
|
||||
|
@@ -26,7 +26,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Current Invoices Due</td>
|
||||
<td class="head"><?php echo Currency::display($service->invoices_due_total()); ?></td>
|
||||
<td class="head"><?php echo Currency::display($service->account->invoices_due_total()); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user