Work on invoice printing - to clean up

This commit is contained in:
Deon George
2011-05-02 22:28:17 +10:00
parent 2f7a10804e
commit 8013aadc4c
16 changed files with 1045 additions and 73 deletions

View File

@@ -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