Revamping invoice PDF rendering and standardisation work
This commit is contained in:
parent
a560c5f4fa
commit
24bb4a701b
@ -34,17 +34,20 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
|
|||||||
|
|
||||||
protected $_save_message = TRUE;
|
protected $_save_message = TRUE;
|
||||||
|
|
||||||
// Required abstract functions
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
|
public function attributes($variable=NULL) {
|
||||||
|
return array(
|
||||||
|
'Service Address'=>$this->service_address ? $this->display('service_address') : 'UNKNOWN',
|
||||||
|
'Contract Until'=>$this->contract_date_end(TRUE),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function expire() {
|
public function expire() {
|
||||||
// We'll leave it to the Service record to determine when this service expires
|
// We'll leave it to the Service record to determine when this service expires
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function name($variable=NULL) {
|
|
||||||
return $this->service_number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function password() {
|
public function password() {
|
||||||
return $this->service_password;
|
return $this->service_password;
|
||||||
}
|
}
|
||||||
@ -53,7 +56,7 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
|
|||||||
return $this->service_username;
|
return $this->service_username;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local functions
|
/** LOCAL METHODS **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we override the plan that the customers gets (from what the supplier provides).
|
* If we override the plan that the customers gets (from what the supplier provides).
|
||||||
@ -200,6 +203,14 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
|
|||||||
return $this->ipaddress ? $this->ipaddress : _('Dynamic');
|
return $this->ipaddress ? $this->ipaddress : _('Dynamic');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function name($variable=NULL) {
|
||||||
|
return $this->service_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function namesub($variable=NULL) {
|
||||||
|
return $this->display('service_address');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we override the plan that the customers gets (from what the supplier provides).
|
* If we override the plan that the customers gets (from what the supplier provides).
|
||||||
* @todo This needs to get the plan that was invoiced, not the current plan..
|
* @todo This needs to get the plan that was invoiced, not the current plan..
|
||||||
@ -453,25 +464,5 @@ class Model_Service_Plugin_Adsl extends Model_Service_Plugin {
|
|||||||
|
|
||||||
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);
|
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get specific service details for use in other modules
|
|
||||||
* For Example: Invoice
|
|
||||||
*
|
|
||||||
* @todo Make the rendered items configurable
|
|
||||||
* @todo Change this method name, now that it is public
|
|
||||||
*/
|
|
||||||
public function _details($type) {
|
|
||||||
switch ($type) {
|
|
||||||
case 'invoice_detail_items':
|
|
||||||
return array(
|
|
||||||
_('Service Address')=>$this->service_address ? $this->display('service_address') : '>NotSet<',
|
|
||||||
_('Contract Until')=>$this->contract_date_end(TRUE),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return parent::$_details($type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
<!-- //@todo To translate -->
|
|
||||||
<table class="box-full">
|
|
||||||
<tr>
|
|
||||||
<td style="width: 60%;">Contract Term</td>
|
|
||||||
<td class="head" colspan="2"><?php echo $record->display('contract_term'); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<!-- @todo This should get tax settings from the session -->
|
|
||||||
<td>Minimum Cost</td>
|
|
||||||
<td class="head" colspan="2"><?php echo Currency::display(Tax::add($record->contract_term*$price_base+$price_setup)); ?> <span style="font-size: 80%; font-weight:normal;"><?php printf('(%s * %s + %s)',$record->contract_term,Tax::add($price_base),Tax::add($price_setup)); ?></span></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
@ -120,19 +120,6 @@ class Model_Charge extends ORM_OSB implements Invoicable {
|
|||||||
return $this->invoice_item(5);
|
return $this->invoice_item(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Render some details for specific calls, eg: invoice
|
|
||||||
*/
|
|
||||||
public function details($type) {
|
|
||||||
switch ($type) {
|
|
||||||
case 'invoice_detail_items':
|
|
||||||
return array('Other Charge'=>sprintf('%s (%s@%s)',$this->description,$this->quantity,Currency::display($this->amount)));
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function total($format=FALSE) {
|
public function total($format=FALSE) {
|
||||||
$result = $this->quantity * $this->amount;
|
$result = $this->quantity * $this->amount;
|
||||||
|
|
||||||
|
@ -18,6 +18,14 @@ class Model_Checkout extends ORM_OSB {
|
|||||||
protected $_sorting = array('name'=>'ASC');
|
protected $_sorting = array('name'=>'ASC');
|
||||||
protected $_form = array('id'=>'id','value'=>'name');
|
protected $_form = array('id'=>'id','value'=>'name');
|
||||||
|
|
||||||
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
|
public function name($variable=NULL) {
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** LOCAL METHODS **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calcuale the fee for this checkout method
|
* Calcuale the fee for this checkout method
|
||||||
*
|
*
|
||||||
|
@ -22,9 +22,6 @@ class DOMAIN {
|
|||||||
public function product_view($data) {
|
public function product_view($data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function contract_view($data,$price_base,$price_setup) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect information for the cart
|
* Collect information for the cart
|
||||||
*/
|
*/
|
||||||
|
@ -35,16 +35,14 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin {
|
|||||||
|
|
||||||
protected $_save_message = TRUE;
|
protected $_save_message = TRUE;
|
||||||
|
|
||||||
// Required abstract functions
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
|
public function attributes($variable=NULL) {}
|
||||||
|
|
||||||
public function expire() {
|
public function expire() {
|
||||||
return $this->domain_expire;
|
return $this->domain_expire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function name($variable=NULL) {
|
|
||||||
return sprintf('%s.%s',$this->display('domain_name'),$this->tld->display('name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function password() {
|
public function password() {
|
||||||
return $this->registrar_password;
|
return $this->registrar_password;
|
||||||
}
|
}
|
||||||
@ -53,7 +51,7 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin {
|
|||||||
return $this->registrar_username;
|
return $this->registrar_username;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local functions
|
/** LOCAL METHODS **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This provides us with a manage button to jump to the registrar
|
* This provides us with a manage button to jump to the registrar
|
||||||
@ -70,6 +68,10 @@ class Model_Service_Plugin_Domain extends Model_Service_Plugin {
|
|||||||
return $this->host->manage_button('host');
|
return $this->host->manage_button('host');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function name($variable=NULL) {
|
||||||
|
return sprintf('%s.%s',$this->display('domain_name'),$this->tld->display('name'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for services matching a term
|
* Search for services matching a term
|
||||||
* @todo This search doesnt pick up the TLD of domain names
|
* @todo This search doesnt pick up the TLD of domain names
|
||||||
|
@ -37,7 +37,7 @@ class Model_Email_Template extends ORM_OSB {
|
|||||||
parent::save();
|
parent::save();
|
||||||
|
|
||||||
// Save our Translated Message
|
// Save our Translated Message
|
||||||
if ($x = array_diff_key($_POST,$this->_object) AND Arr::get($_POST,'language_id']) AND is_array(Arr::get($_POST,'translate'))) {
|
if ($x = array_diff_key($_POST,$this->_object) AND Arr::get($_POST,'language_id') AND is_array(Arr::get($_POST,'translate'))) {
|
||||||
$to = $this->translate->where('language_id','=',Arr::get($_POST,'language_id'))->find();
|
$to = $this->translate->where('language_id','=',Arr::get($_POST,'language_id'))->find();
|
||||||
|
|
||||||
// For a new entry, we need to set the product_id
|
// For a new entry, we need to set the product_id
|
||||||
|
@ -37,16 +37,14 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
|
|||||||
|
|
||||||
protected $_save_message = TRUE;
|
protected $_save_message = TRUE;
|
||||||
|
|
||||||
// Required abstract functions
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
|
public function attributes($variable=NULL) {}
|
||||||
|
|
||||||
public function expire() {
|
public function expire() {
|
||||||
return $this->host_expire;
|
return $this->host_expire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function name($variable=NULL) {
|
|
||||||
return sprintf('%s.%s',$this->display('domain_name'),$this->tld->display('name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function password() {
|
public function password() {
|
||||||
return $this->host_password;
|
return $this->host_password;
|
||||||
}
|
}
|
||||||
@ -55,7 +53,7 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
|
|||||||
return $this->host_username;
|
return $this->host_username;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local functions
|
/** LOCAL METHODS **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This provides us with a manage button to jump to the hosting server
|
* This provides us with a manage button to jump to the hosting server
|
||||||
@ -72,6 +70,10 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
|
|||||||
return ($this->username() AND $this->password() AND $a=$this->host->plugin()) ? $a->manage_button($this,$t) : '';
|
return ($this->username() AND $this->password() AND $a=$this->host->plugin()) ? $a->manage_button($this,$t) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function name($variable=NULL) {
|
||||||
|
return sprintf('%s.%s',$this->display('domain_name'),$this->tld->display('name'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for services matching a term
|
* Search for services matching a term
|
||||||
*/
|
*/
|
||||||
|
@ -113,7 +113,7 @@ class Invoice {
|
|||||||
elseif ($this->_io->billing_status == 1)
|
elseif ($this->_io->billing_status == 1)
|
||||||
$pdfo->drawInvoicePaidNotice();
|
$pdfo->drawInvoicePaidNotice();
|
||||||
|
|
||||||
if ($this->_io->account->invoices_due_total())
|
if ($this->_io->account->invoices_due_total() > $this->_io->due())
|
||||||
$pdfo->drawSummaryInvoicesDue();
|
$pdfo->drawSummaryInvoicesDue();
|
||||||
|
|
||||||
$pdfo->drawSummaryLineItems();
|
$pdfo->drawSummaryLineItems();
|
||||||
@ -134,8 +134,6 @@ class Invoice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function render($type,$section,$args=array()) {
|
public function render($type,$section,$args=array()) {
|
||||||
$this->_io->pre_render();
|
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'email':
|
case 'email':
|
||||||
switch ($section) {
|
switch ($section) {
|
||||||
|
@ -50,8 +50,8 @@ abstract class Invoice_TCPDF extends TCPDF {
|
|||||||
$this->SetCreator('Open Source Billing');
|
$this->SetCreator('Open Source Billing');
|
||||||
$this->SetAuthor($this->co->name());
|
$this->SetAuthor($this->co->name());
|
||||||
$this->SetTitle(sprintf('%s Invoice',$this->co->name()));
|
$this->SetTitle(sprintf('%s Invoice',$this->co->name()));
|
||||||
$this->SetSubject(sprintf('Invoice #%06s',$this->io->id()));
|
$this->SetSubject(sprintf('Invoice #%06s',$this->io->refnum(TRUE)));
|
||||||
$this->SetKeywords($this->io->id());
|
$this->SetKeywords($this->io->refnum(TRUE));
|
||||||
$this->SetAutoPageBreak(TRUE,25);
|
$this->SetAutoPageBreak(TRUE,25);
|
||||||
$this->SetHeaderMargin(1);
|
$this->SetHeaderMargin(1);
|
||||||
$this->SetFooterMargin(10);
|
$this->SetFooterMargin(10);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @copyright (c) 2009-2013 Open Source Billing
|
* @copyright (c) 2009-2013 Open Source Billing
|
||||||
* @license http://dev.osbill.net/license.html
|
* @license http://dev.osbill.net/license.html
|
||||||
*/
|
*/
|
||||||
class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
class Invoice_Tcpdf_Default extends Invoice_Tcpdf {
|
||||||
// Current line being printed
|
// Current line being printed
|
||||||
public $sum_y = 0;
|
public $sum_y = 0;
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
|||||||
$this->SetFont('helvetica','',10);
|
$this->SetFont('helvetica','',10);
|
||||||
$this->SetXY($x,$y); $this->Cell(0,0,_('Invoice Number'));
|
$this->SetXY($x,$y); $this->Cell(0,0,_('Invoice Number'));
|
||||||
$this->SetFont('helvetica','B',11);
|
$this->SetFont('helvetica','B',11);
|
||||||
$this->SetXY($x,$y); $this->Cell(0,0,$this->io->id(),0,0,'R');
|
$this->SetXY($x,$y); $this->Cell(0,0,$this->io->refnum(TRUE),0,0,'R');
|
||||||
|
|
||||||
// Company Address
|
// Company Address
|
||||||
// $y = 216;
|
// $y = 216;
|
||||||
@ -142,7 +142,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
|||||||
$this->SetFont('helvetica','B',11);
|
$this->SetFont('helvetica','B',11);
|
||||||
$this->SetXY($x,$y); $this->Cell(0,0,'TAX INVOICE');
|
$this->SetXY($x,$y); $this->Cell(0,0,'TAX INVOICE');
|
||||||
$this->SetFont('helvetica','B',11);
|
$this->SetFont('helvetica','B',11);
|
||||||
$this->SetXY($x,$y); $this->Cell(0,0,$this->io->id(),0,0,'R');
|
$this->SetXY($x,$y); $this->Cell(0,0,$this->io->refnum(TRUE),0,0,'R');
|
||||||
|
|
||||||
// Invoice number at top of page.
|
// Invoice number at top of page.
|
||||||
$y += 7;
|
$y += 7;
|
||||||
@ -261,7 +261,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
|||||||
* Draw previous invoices due
|
* Draw previous invoices due
|
||||||
*/
|
*/
|
||||||
public function drawSummaryInvoicesDue() {
|
public function drawSummaryInvoicesDue() {
|
||||||
$x = 125; $y = $this->sum_y ? $this->sum_y : 50;
|
$x = 125; $y = $this->sum_y ? $this->sum_y : 55;
|
||||||
|
|
||||||
$items = $this->io->account->invoices_due($this->io->date_orig);
|
$items = $this->io->account->invoices_due($this->io->date_orig);
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
|||||||
foreach ($items as $line) {
|
foreach ($items as $line) {
|
||||||
if (++$i < $this->itemsPreviousMax) {
|
if (++$i < $this->itemsPreviousMax) {
|
||||||
$this->SetXY($x,$y);
|
$this->SetXY($x,$y);
|
||||||
$this->Cell(0,0,sprintf('%s %s',$line->display('date_orig'),$line->id()));
|
$this->Cell(0,0,sprintf('%s %s',$line->display('date_orig'),$line->refnum(TRUE)));
|
||||||
$this->Cell(0,0,$line->due(TRUE),0,0,'R'); $y += 5;
|
$this->Cell(0,0,$line->due(TRUE),0,0,'R'); $y += 5;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -442,26 +442,20 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
|||||||
public function drawDetailLineItems() {
|
public function drawDetailLineItems() {
|
||||||
$this->i = 0;
|
$this->i = 0;
|
||||||
|
|
||||||
foreach ($this->io->items_periods() as $rs) {
|
foreach ($this->io->items_render() as $key => $items) {
|
||||||
$sids=array();
|
switch ($key) {
|
||||||
|
case 's':
|
||||||
foreach ($this->io->items_periods($rs) as $iio) {
|
$this->drawLineItems($items);
|
||||||
if (in_array($iio->service_id,$sids))
|
break;
|
||||||
continue;
|
|
||||||
|
|
||||||
array_push($sids,$iio->service_id);
|
|
||||||
|
|
||||||
$this->drawLineItem($iio);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws Invoice Detail Item
|
* Draws Invoice Detail Items
|
||||||
*
|
|
||||||
* @todo need to make sure that this pages well, when there are many items (with many sub details).
|
|
||||||
*/
|
*/
|
||||||
private function drawLineItem($ito) {
|
private function drawLineItems(array $items) {
|
||||||
|
$track['rs'] = $track = array();
|
||||||
$x = 10;
|
$x = 10;
|
||||||
if ($this->i == 0 || $this->i%$this->max_lines_page == 0) {
|
if ($this->i == 0 || $this->i%$this->max_lines_page == 0) {
|
||||||
$this->y = 5;
|
$this->y = 5;
|
||||||
@ -470,7 +464,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
|||||||
$this->SetFont('helvetica','B',12);
|
$this->SetFont('helvetica','B',12);
|
||||||
$this->SetXY($x,$this->y); $this->Cell(0,0,_('Itemised Charges'));
|
$this->SetXY($x,$this->y); $this->Cell(0,0,_('Itemised Charges'));
|
||||||
$this->Cell(0,0,_('Page #').$this->PageNo(),0,0,'R');
|
$this->Cell(0,0,_('Page #').$this->PageNo(),0,0,'R');
|
||||||
$this->SetXY($x,$this->y); $this->Cell(0,0,_('Invoice #').$this->io->id(),0,0,'C');
|
$this->SetXY($x,$this->y); $this->Cell(0,0,_('Invoice #').$this->io->refnum(TRUE),0,0,'C');
|
||||||
|
|
||||||
// Draw table headers
|
// Draw table headers
|
||||||
$this->y += 10;
|
$this->y += 10;
|
||||||
@ -489,68 +483,68 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
|
|||||||
$this->SetY($this->y);
|
$this->SetY($this->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->SetFont('helvetica','',8);
|
$last = '';
|
||||||
$this->SetX($x);
|
foreach ($items as $iio) {
|
||||||
$this->Cell(0,0,$ito->title());
|
// So we dont render the same recurring schedule over again
|
||||||
$this->SetFont('helvetica','',7);
|
if (! is_null($iio->recurring_schedule) AND ! in_array($iio->recurring_schedule,$track['rs'])) {
|
||||||
|
array_push($track['rs'],$iio->recurring_schedule);
|
||||||
|
// echo $iio->display('recurring_schedule');
|
||||||
|
}
|
||||||
|
|
||||||
if ($z=$this->io->service_items($ito)) {
|
// If we are rendering a new service, reset the product id tracking
|
||||||
foreach ($z as $eiio) {
|
if ($iio->service_id != $last) {
|
||||||
$this->y += 3;
|
if ($last) {
|
||||||
|
$this->y += 6;
|
||||||
|
$this->SetY($this->y);
|
||||||
|
}
|
||||||
|
|
||||||
|
$last = $iio->service_id;
|
||||||
|
$track['p'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// So we dont render the same product title over again
|
||||||
|
if (! in_array($iio->product_id,$track['p'])) {
|
||||||
|
array_push($track['p'],$iio->product_id);
|
||||||
|
|
||||||
|
$this->SetFont('helvetica','',8);
|
||||||
|
$this->SetX($x);
|
||||||
|
$this->Cell(0,0,sprintf('%s: %s',$iio->service->refnum(TRUE),$iio->name($iio->invoice->account->language)));
|
||||||
|
$this->SetFont('helvetica','',7);
|
||||||
|
|
||||||
|
$this->y += 1;
|
||||||
|
if ($iio->service->attributes()) {
|
||||||
|
foreach ($iio->service->attributes() as $k=>$v) {
|
||||||
|
$this->SetFont('helvetica','I',6);
|
||||||
|
$this->y += 3;
|
||||||
|
$this->SetXY($x+10,$this->y); $this->Cell(0,0,$k);
|
||||||
|
$this->SetFont('helvetica','',6);
|
||||||
|
$this->SetXY($x+40,$this->y); $this->Cell(0,0,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->y += 2;
|
||||||
$this->SetY($this->y);
|
$this->SetY($this->y);
|
||||||
$this->SetX($x+10);
|
$this->i++;
|
||||||
$this->Cell(10,0,$eiio->invoice_line());
|
}
|
||||||
|
|
||||||
if ($eiio->price_base) {
|
$this->y += 3;
|
||||||
$this->SetX($x+160);
|
$this->SetY($this->y);
|
||||||
$this->Cell(10,0,Currency::display($eiio->price_base),0,0,'R');
|
$this->SetX($x+10);
|
||||||
}
|
$this->Cell(10,0,sprintf('%s: (%s)',$iio->namesub($iio->invoice->account->language),$iio->refnum()));
|
||||||
|
|
||||||
if ($eiio->quantity) {
|
|
||||||
$this->SetX($x+130);
|
|
||||||
$this->Cell(10,0,$eiio->quantity,0,0,'R');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ($iio->quantity) {
|
||||||
$this->SetX($x+130);
|
$this->SetX($x+130);
|
||||||
$this->Cell(0,0,$eiio->total(TRUE),0,0,'R');
|
$this->Cell(10,0,sprintf('%3.2f',$iio->quantity),0,0,'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($iio->price_base) {
|
||||||
|
$this->SetX($x+160);
|
||||||
|
$this->Cell(10,0,Currency::display($iio->price_base),0,0,'R');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->SetX($x+130);
|
||||||
|
$this->Cell(0,0,$iio->total(TRUE),0,0,'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($z=$this->io->service_items_extra($ito)) {
|
|
||||||
foreach ($z as $eiio) {
|
|
||||||
$this->y += 3;
|
|
||||||
$this->SetY($this->y);
|
|
||||||
$this->SetX($x+10);
|
|
||||||
$this->Cell(10,0,$eiio->invoice_line());
|
|
||||||
|
|
||||||
if ($eiio->price_base) {
|
|
||||||
$this->SetX($x+160);
|
|
||||||
$this->Cell(10,0,Currency::display($eiio->price_base),0,0,'R');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($eiio->quantity) {
|
|
||||||
$this->SetX($x+130);
|
|
||||||
$this->Cell(10,0,$eiio->quantity,0,0,'R');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->SetX($x+130);
|
|
||||||
$this->Cell(0,0,$eiio->total(TRUE),0,0,'R');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->y += 2;
|
|
||||||
if ($ito->invoice_detail_items())
|
|
||||||
foreach ($ito->invoice_detail_items() as $k=>$v) {
|
|
||||||
$this->SetFont('helvetica','I',6);
|
|
||||||
$this->y += 3;
|
|
||||||
$this->SetXY($x+10,$this->y); $this->Cell(0,0,$k);
|
|
||||||
$this->SetFont('helvetica','',6);
|
|
||||||
$this->SetXY($x+40,$this->y); $this->Cell(0,0,$v);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->y += 5;
|
|
||||||
$this->SetY($this->y);
|
|
||||||
$this->i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -53,6 +53,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
private $_render = array();
|
private $_render = array();
|
||||||
|
|
||||||
/** REQUIRED ABSTRACT METHODS **/
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the Invoice Reference Number
|
* Display the Invoice Reference Number
|
||||||
*/
|
*/
|
||||||
@ -116,29 +117,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
->where('module_data','=',$this);
|
->where('module_data','=',$this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the Invoice Number
|
|
||||||
*/
|
|
||||||
public function id() {
|
|
||||||
return sprintf('%06s',$this->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the recurring schedules that are on an invoice
|
|
||||||
*
|
|
||||||
* @param $period Return an Array of items for that period
|
|
||||||
*/
|
|
||||||
public function items_periods($period=FALSE) {
|
|
||||||
if (is_null($period))
|
|
||||||
return isset($this->_render['OTHER']) ? $this->_render['OTHER'] : array();
|
|
||||||
|
|
||||||
elseif ($period)
|
|
||||||
return isset($this->_render['SCHED'][$period]) ? $this->_render['SCHED'][$period] : array();
|
|
||||||
|
|
||||||
else
|
|
||||||
return array_keys($this->_render['SCHED']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of items to render, in appropriate order
|
* Return an array of items to render, in appropriate order
|
||||||
*/
|
*/
|
||||||
@ -184,10 +162,19 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get service items that dont have a recurring schedule
|
||||||
|
foreach ($this->_sub_items as $iio)
|
||||||
|
if (! $iio->void AND ! in_array($iio->id,$track) AND $iio->service_id) {
|
||||||
|
// Ensure we dont process this item again
|
||||||
|
array_push($track,$iio->id);
|
||||||
|
|
||||||
|
array_push($result['s'],$iio);
|
||||||
|
}
|
||||||
|
|
||||||
// Next get the items we havent already got
|
// Next get the items we havent already got
|
||||||
$result['other'] = array();
|
$result['other'] = array();
|
||||||
foreach ($this->_sub_items as $iio)
|
foreach ($this->_sub_items as $iio)
|
||||||
if (! in_array($iio->id,$track))
|
if (! $iio->void AND ! in_array($iio->id,$track))
|
||||||
array_push($result['other'],$iio);
|
array_push($result['other'],$iio);
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
@ -226,29 +213,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the item titles that are on an invoice
|
|
||||||
*
|
|
||||||
* @param $title Return an Array of items for that title
|
|
||||||
*/
|
|
||||||
public function items_titles($title=NULL,$period=NULL) {
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
foreach ($this->subitems() as $ito) {
|
|
||||||
if ($ito->service_id) {
|
|
||||||
if (is_null($title) AND ! in_array($ito->title(),$result) AND (is_null($period) OR ($period == $ito->recurring_schedule)))
|
|
||||||
array_push($result,$ito->title());
|
|
||||||
elseif (($ito->title() == $title AND (is_null($period) OR ($period == $ito->recurring_schedule))) OR is_null($ito->recurring_schedule))
|
|
||||||
array_push($result,$ito);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throw HTTP_Exception::factory(501,'Not handled non-services');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function payments() {
|
public function payments() {
|
||||||
return $this->payment_item->find_all();
|
return $this->payment_item->find_all();
|
||||||
}
|
}
|
||||||
@ -262,37 +226,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
return $format ? Currency::display($result) : $result;
|
return $format ? Currency::display($result) : $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function takes care of all the invoice items so that they are rendered only once
|
|
||||||
*
|
|
||||||
* We organise items by
|
|
||||||
* + recurring_schedule for service items item_type=0
|
|
||||||
* + recurring_schedule for service items for item_type!=0 (that have an item_type=0 previously selected)
|
|
||||||
* + Other Items
|
|
||||||
*/
|
|
||||||
public function pre_render() {
|
|
||||||
$this->_render = array();
|
|
||||||
$this->_render['SCHED'] = array();
|
|
||||||
$processed = array();
|
|
||||||
|
|
||||||
foreach ($this->subitems() as $iio) {
|
|
||||||
if ($iio->id AND in_array($iio->id,$processed))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ($iio->recurring_schedule) {
|
|
||||||
$this->_render['SCHED'][$iio->recurring_schedule][] = $iio;
|
|
||||||
|
|
||||||
} elseif (Object::in_array('service_id',$iio->service_id,$this->_render['SCHED'],TRUE)) {
|
|
||||||
// Do nothing
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$this->_render['OTHER'][] = $iio;
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($processed,$iio->id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a particular recurring schedule, get al lthe services
|
* For a particular recurring schedule, get al lthe services
|
||||||
*/
|
*/
|
||||||
@ -418,72 +351,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the service items on an invoice relating to an invoice_item
|
|
||||||
* IE: item_type == 0
|
|
||||||
*/
|
|
||||||
public function service_items(Model_Invoice_Item $o) {
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
// At the moment, we only return items pertaining to a service
|
|
||||||
if (! $o->service_id)
|
|
||||||
return $result;
|
|
||||||
|
|
||||||
foreach ($this->subitems() as $iio)
|
|
||||||
if ($iio->item_type == 0 AND $iio->service_id == $o->service_id)
|
|
||||||
array_push($result,$iio);
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the extra items on an invoice relating to an invoice_item
|
|
||||||
* IE: item_type != 0
|
|
||||||
*/
|
|
||||||
public function service_items_extra(Model_Invoice_Item $o) {
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
foreach ($this->subitems() as $iio)
|
|
||||||
if ($iio->item_type != 0 AND (! $o->service_id OR ($iio->service_id == $o->service_id)))
|
|
||||||
array_push($result,$iio);
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the total of all items relating to a service
|
|
||||||
*/
|
|
||||||
public function service_items_tax(Model_Invoice_Item $o,$format=FALSE) {
|
|
||||||
$result = 0;
|
|
||||||
|
|
||||||
// At the moment, we only return extra items pertaining to a service
|
|
||||||
if (! $o->service_id)
|
|
||||||
return $result;
|
|
||||||
|
|
||||||
foreach ($this->subitems() as $iio)
|
|
||||||
if ($iio->service_id == $o->service_id)
|
|
||||||
$result += $iio->tax();
|
|
||||||
|
|
||||||
return $format ? Currency::display($result) : $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the total of all items relating to a service
|
|
||||||
*/
|
|
||||||
public function service_items_total(Model_Invoice_Item $o,$format=FALSE) {
|
|
||||||
$result = 0;
|
|
||||||
|
|
||||||
// At the moment, we only return extra items pertaining to a service
|
|
||||||
if (! $o->service_id)
|
|
||||||
return $result;
|
|
||||||
|
|
||||||
foreach ($this->subitems() as $iio)
|
|
||||||
if ($iio->service_id == $o->service_id)
|
|
||||||
$result += $iio->total();
|
|
||||||
|
|
||||||
return $format ? Currency::display($result) : $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a particular service, get all the products
|
* For a particular service, get all the products
|
||||||
*/
|
*/
|
||||||
|
@ -51,10 +51,10 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
0=>'Product/Service', // * Line Charge Topic on Invoice.
|
0=>'Product/Service', // * Line Charge Topic on Invoice.
|
||||||
1=>'Hardware', // *
|
1=>'Hardware', // *
|
||||||
2=>'Service Relocation Fee', // * Must have corresponding SERVICE_ID
|
2=>'Service Relocation Fee', // * Must have corresponding SERVICE_ID
|
||||||
3=>'Service Change Fee', // * Must have corresponding SERVICE_ID
|
3=>'Service Change', // * Must have corresponding SERVICE_ID
|
||||||
4=>'Service Connection Fee', // * Must have corresponding SERVICE_ID
|
4=>'Service Connection', // * Must have corresponding SERVICE_ID
|
||||||
5=>'Excess Usage', // * Excess Service Item, of item 0, must have corresponding SERVICE_ID
|
5=>'Excess Usage', // * Excess Service Item, of item 0, must have corresponding SERVICE_ID
|
||||||
6=>'Service Cancellation Fee', // * Must have corresponding SERVICE_ID
|
6=>'Service Cancellation', // * Must have corresponding SERVICE_ID
|
||||||
7=>'Extra Product/Service Charge', // * Service Billing in advance, Must have corresponding SERVICE_ID
|
7=>'Extra Product/Service Charge', // * Service Billing in advance, Must have corresponding SERVICE_ID
|
||||||
8=>'Product Addition', // * Additional Product Customisation, Must have corresponding SERVICE_ID
|
8=>'Product Addition', // * Additional Product Customisation, Must have corresponding SERVICE_ID
|
||||||
120=>'Credit/Debit Transfer', // * SERVICE_ID is NULL, MODULE_ID is NULL, MODULE_REF is NULL : INVOICE_ID is NOT NULL
|
120=>'Credit/Debit Transfer', // * SERVICE_ID is NULL, MODULE_ID is NULL, MODULE_REF is NULL : INVOICE_ID is NOT NULL
|
||||||
@ -72,10 +72,13 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
|
|
||||||
switch ($this->item_type) {
|
switch ($this->item_type) {
|
||||||
case 0:
|
case 0:
|
||||||
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
return sprintf('%s: %s',$this->product->name($variable),$this->service->namesub($variable));
|
return sprintf('%s: %s',$this->product->name($variable),$this->service->namesub($variable));
|
||||||
|
case 124:
|
||||||
|
return StaticList_ItemType::get($this->item_type);
|
||||||
default:
|
default:
|
||||||
return sprintf('Unknown [%s-%s]',$this->item_type,$this->id);
|
return sprintf('Unknown [%s-%s]',$this->item_type,$this->id);
|
||||||
}
|
}
|
||||||
@ -88,8 +91,12 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
switch ($this->item_type) {
|
switch ($this->item_type) {
|
||||||
case 0:
|
case 0:
|
||||||
return sprintf('%s: %s',StaticList_ItemType::get($this->item_type),$this->period());
|
return sprintf('%s: %s',StaticList_ItemType::get($this->item_type),$this->period());
|
||||||
|
case 2:
|
||||||
|
return sprintf('%s: %s',StaticList_ItemType::get($this->item_type),$this->_module() ? $this->_module()->display('date_charge') : $this->period());
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
|
case 6:
|
||||||
|
return sprintf('%s: %s',StaticList_ItemType::get($this->item_type),($this->_module()->attributes ? $this->_module()->namesub($variable) : $this->_module()->display('date_charge')));
|
||||||
case 5:
|
case 5:
|
||||||
return $this->_module()->namesub($variable);
|
return $this->_module()->namesub($variable);
|
||||||
default:
|
default:
|
||||||
@ -109,7 +116,7 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
/**
|
/**
|
||||||
* Module assocated with the invoice item
|
* Module assocated with the invoice item
|
||||||
*/
|
*/
|
||||||
public function _module() {
|
private function _module() {
|
||||||
if (! $this->module_id OR ! $this->module_ref)
|
if (! $this->module_id OR ! $this->module_ref)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -164,10 +171,18 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
switch ($this->item_type) {
|
switch ($this->item_type) {
|
||||||
case 0:
|
case 0:
|
||||||
// @todo Validate if module_id = charge and module_ref corresponds with the line item
|
// @todo Validate if module_id = charge and module_ref corresponds with the line item
|
||||||
if (! $this->service_id OR ! $this->product_id OR ($this->module_id AND $this->module_id != 30 AND ! is_null($this>module_id)) OR $this->product_name OR is_null($this->recurring_schedule))
|
if (! $this->service_id OR ! $this->product_id OR ($this->module_id AND $this->module_id != 30 AND ! is_null($this>module_ref)) OR $this->product_name OR is_null($this->recurring_schedule))
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (! $this->product_id OR $this->module_id OR $this->module_ref OR $this->product_name OR ! is_null($this->recurring_schedule))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
// These items come from the charge module, so we should have a charge module_id and ref
|
// These items come from the charge module, so we should have a charge module_id and ref
|
||||||
|
case 2:
|
||||||
|
if (! $this->service_id OR ! $this->product_id OR ($this->module_id AND $this->module_id != 30 AND ! is_null($this>module_ref)) OR $this->product_name OR ! is_null($this->recurring_schedule))
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
if (! $this->service_id OR ! $this->product_id OR ! $this->module_id OR ! $this->module_ref OR $this->product_name OR ! is_null($this->recurring_schedule))
|
if (! $this->service_id OR ! $this->product_id OR ! $this->module_id OR ! $this->module_ref OR $this->product_name OR ! is_null($this->recurring_schedule))
|
||||||
@ -178,65 +193,23 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
if (! $this->service_id OR ! $this->product_id OR ! $this->module_id OR ! $this->module_ref OR $this->product_name OR ! is_null($this->recurring_schedule))
|
if (! $this->service_id OR ! $this->product_id OR ! $this->module_id OR ! $this->module_ref OR $this->product_name OR ! is_null($this->recurring_schedule))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
case 124:
|
||||||
|
if ($this->service_id OR $this->product_id OR $this->module_id OR $this->module_ref OR $this->product_name OR ! is_null($this->recurring_schedule))
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get here, assume it is valid
|
// If we get here, assume it is valid
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The line that will be printed on an invoice
|
|
||||||
*
|
|
||||||
* @todo This method includes some database format validation routines, which can be removed when the database
|
|
||||||
* is completly transformed.
|
|
||||||
*/
|
|
||||||
public function invoice_line() {
|
|
||||||
$ii = NULL;
|
|
||||||
|
|
||||||
// Our module is responsible for rending the invoice line
|
|
||||||
$ii = ($this->module_id AND method_exists($this->module(),'invoice_item')) ? $this->module()->invoice_item($this->item_type) : StaticList_ItemType::get($this->item_type);
|
|
||||||
|
|
||||||
switch ($this->item_type) {
|
|
||||||
// Service Charges
|
|
||||||
case 0:
|
|
||||||
return ((! $this->service_id OR $this->product_id OR $this->product_name OR ! $this->recurring_schedule OR ! $this->date_start OR ! $this->date_stop) ? '+ ' : '').$ii.' '.$this->period();
|
|
||||||
case 1:
|
|
||||||
// @todo
|
|
||||||
return $this->product_name;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
return ((! $this->service_id OR $this->product_id OR $this->product_name OR $this->recurring_schedule OR ! $this->date_start OR ! $this->date_stop) ? '+ ' : '').$ii;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
return ((! $this->service_id OR $this->product_id OR $this->product_name OR ! $this->date_start OR ! $this->date_stop) ? '+ ' : '').$ii.' '.$this->period();
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
return $this->product_name;
|
|
||||||
|
|
||||||
case 124:
|
|
||||||
case 125:
|
|
||||||
case 126:
|
|
||||||
case 127:
|
|
||||||
// @todo
|
|
||||||
return $ii;
|
|
||||||
|
|
||||||
// @todo DB records to fix.
|
|
||||||
default:
|
|
||||||
throw HTTP_Exception::factory(501,'Unable to render invoice item :id',array(':id'=>$this->id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an instance of the Model of this charge
|
* Return an instance of the Model of this charge
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function module() {
|
public function module() {
|
||||||
return $this->_module();
|
return $this->_module();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the period that a transaction applies
|
// Display the period that a transaction applies
|
||||||
public function period() {
|
public function period() {
|
||||||
return ($this->date_start == $this->date_stop) ? Site::Date($this->date_start) : sprintf('%s -> %s',Site::Date($this->date_start),Site::Date($this->date_stop));
|
return ($this->date_start == $this->date_stop) ? Site::Date($this->date_start) : sprintf('%s -> %s',Site::Date($this->date_start),Site::Date($this->date_stop));
|
||||||
@ -322,23 +295,5 @@ class Model_Invoice_Item extends ORM_OSB {
|
|||||||
|
|
||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display a transaction number
|
|
||||||
public function trannum() {
|
|
||||||
return sprintf('%03s-%06s',$this->item_type,$this->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function invoice_detail_items() {
|
|
||||||
switch ($this->item_type) {
|
|
||||||
case 0:
|
|
||||||
return $this->service->details('invoice_detail_items');
|
|
||||||
case 4:
|
|
||||||
return array('Charge'=>_('Service Connection Fee'));
|
|
||||||
case 5:
|
|
||||||
return $this->charge->details('invoice_detail_items');
|
|
||||||
default:
|
|
||||||
return array('Item'=>$this->item_type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<div class="col-md-5 col-md-offset-1">
|
<div class="col-md-5 col-md-offset-1">
|
||||||
<div class="dl-horizontal pull-right">
|
<div class="dl-horizontal pull-right">
|
||||||
<dt>Tax Invoice</dt>
|
<dt>Tax Invoice</dt>
|
||||||
<dd><?php echo $o->id(); ?></dd>
|
<dd><?php echo $o->refnum(TRUE); ?></dd>
|
||||||
|
|
||||||
<dt>Issue Date</dt>
|
<dt>Issue Date</dt>
|
||||||
<dd><?php echo $o->display('date_orig'); ?></dd>
|
<dd><?php echo $o->display('date_orig'); ?></dd>
|
||||||
@ -29,14 +29,8 @@
|
|||||||
<dt>Current Charges</dt>
|
<dt>Current Charges</dt>
|
||||||
<dd><?php echo $o->total_charges(TRUE); ?></dd>
|
<dd><?php echo $o->total_charges(TRUE); ?></dd>
|
||||||
|
|
||||||
<dt>Payments Received</dt>
|
|
||||||
<dd><?php echo $o->payments_total(TRUE); ?></dd>
|
|
||||||
|
|
||||||
<dt>Credits Applied</dt>
|
<dt>Credits Applied</dt>
|
||||||
<dd><?php echo $o->total_credits(TRUE); ?></dd>
|
<dd><?php echo $o->total_credits(TRUE); ?></dd>
|
||||||
|
|
||||||
<dt>Still Due</dt>
|
|
||||||
<dd><?php echo $o->due(TRUE); ?></dd>
|
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- /span -->
|
</div> <!-- /span -->
|
||||||
</div>
|
</div>
|
||||||
@ -95,6 +89,16 @@
|
|||||||
<dd><?php echo $o->total(TRUE); ?></dd>
|
<dd><?php echo $o->total(TRUE); ?></dd>
|
||||||
<!-- END Invoice Total -->
|
<!-- END Invoice Total -->
|
||||||
|
|
||||||
|
<?php if ($o->payments_total()) : ?>
|
||||||
|
<?php foreach ($o->payment_item->find_all() as $pio) : ?>
|
||||||
|
<dt><?php echo $pio->payment->checkout->name($o->account->language); ?></dt>
|
||||||
|
<dd><?php echo $pio->display('alloc_amt'); ?> (<?php echo $pio->payment->display('date_payment'); ?>)</dd>
|
||||||
|
<?php endforeach ?>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<dt>Still Due</dt>
|
||||||
|
<dd><?php echo $o->due(TRUE); ?></dd>
|
||||||
|
|
||||||
<!-- Account Total Due -->
|
<!-- Account Total Due -->
|
||||||
<dt>Account Due:</dt>
|
<dt>Account Due:</dt>
|
||||||
<dd><?php echo $o->account->invoices_due_total(NULL,TRUE); ?></dd>
|
<dd><?php echo $o->account->invoices_due_total(NULL,TRUE); ?></dd>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $io->account->name(); ?></td>
|
<td><?php echo $io->account->name(); ?></td>
|
||||||
<td><?php echo $io->display('due_date'); ?></td>
|
<td><?php echo $io->display('due_date'); ?></td>
|
||||||
<td><?php echo $io->id(); ?></td>
|
<td><?php echo $io->refnum(TRUE); ?></td>
|
||||||
<td><?php echo $io->due(TRUE); ?></td>
|
<td><?php echo $io->due(TRUE); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
@ -15,7 +15,7 @@ if (! $o->status)
|
|||||||
$output .= '<div id="cancelled">Invoice CANCELLED.</div>';
|
$output .= '<div id="cancelled">Invoice CANCELLED.</div>';
|
||||||
|
|
||||||
echo Block::factory()
|
echo Block::factory()
|
||||||
->title(sprintf('%s: %s - %s',_('Invoice'),$o->refnum(),$o->account->name()))
|
->title(sprintf('Invoice %s: %s',$o->refnum(),$o->account->name()))
|
||||||
->title_icon('fa fa-edit')
|
->title_icon('fa fa-edit')
|
||||||
->body($output);
|
->body($output);
|
||||||
?>
|
?>
|
||||||
|
@ -21,7 +21,7 @@ foreach ($o->items_render() as $key => $items) :
|
|||||||
$track['p'] = array();
|
$track['p'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
// So we dont render the same recurring schedule over again
|
// So we dont render the same product title over again
|
||||||
if (! in_array($iio->product_id,$track['p'])) :
|
if (! in_array($iio->product_id,$track['p'])) :
|
||||||
array_push($track['p'],$iio->product_id);
|
array_push($track['p'],$iio->product_id);
|
||||||
?>
|
?>
|
||||||
|
@ -22,7 +22,7 @@ class Controller_Admin_Payment extends Controller_Payment {
|
|||||||
Block::factory()
|
Block::factory()
|
||||||
->type('form-horizontal')
|
->type('form-horizontal')
|
||||||
->title('Add/View Payment')
|
->title('Add/View Payment')
|
||||||
->title_icon('icon-wrench')
|
->title_icon($this->icon)
|
||||||
->body($this->add_edit());
|
->body($this->add_edit());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,10 +56,10 @@ class Controller_Admin_Payment extends Controller_Payment {
|
|||||||
$invoices = array();
|
$invoices = array();
|
||||||
|
|
||||||
// Get our invoices paid by this payment ID
|
// Get our invoices paid by this payment ID
|
||||||
$po = ORM::factory('Payment',$this->request->query('pid'));
|
$po = ORM::factory('Payment',$this->request->post('pid'));
|
||||||
|
|
||||||
// Get all our other outstanding invoices
|
// Get all our other outstanding invoices
|
||||||
foreach (ORM::factory('Account',$this->request->query('key'))->invoices_due() as $io) {
|
foreach (ORM::factory('Account',$this->request->post('key'))->invoices_due() as $io) {
|
||||||
$pio = $po->payment_item;
|
$pio = $po->payment_item;
|
||||||
$pio->invoice_id = $io->id;
|
$pio->invoice_id = $io->id;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class Controller_Admin_Payment extends Controller_Payment {
|
|||||||
public function action_ajaxlist() {
|
public function action_ajaxlist() {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
if ($this->request->query('term'))
|
if ($this->request->query('term')) {
|
||||||
$result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($this->request->query('term'),'id','id',array('ACC %s: %s'=>array('id','name()'))));
|
$result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($this->request->query('term'),'id','id',array('ACC %s: %s'=>array('id','name()'))));
|
||||||
$result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($this->request->query('term'),'id','account_id',array('INV %s: %s'=>array('id','account->name()'))));
|
$result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($this->request->query('term'),'id','account_id',array('INV %s: %s'=>array('id','account->name()'))));
|
||||||
}
|
}
|
||||||
@ -88,13 +88,15 @@ class Controller_Admin_Payment extends Controller_Payment {
|
|||||||
Block::factory()
|
Block::factory()
|
||||||
->type('form-horizontal')
|
->type('form-horizontal')
|
||||||
->title(sprintf('%s: %s',_('View Payments Received'),$id))
|
->title(sprintf('%s: %s',_('View Payments Received'),$id))
|
||||||
->title_icon('icon-wrench')
|
->title_icon($this->icon)
|
||||||
->body($this->add_edit($id,$output));
|
->body($this->add_edit($id,$output));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_edit($id=NULL,$output='') {
|
private function add_edit($id=NULL,$output='') {
|
||||||
$po = ORM::factory('Payment',$id);
|
$po = ORM::factory('Payment',$id);
|
||||||
|
|
||||||
|
$this->meta->title = 'Payment: '.$po->refnum(TRUE);
|
||||||
|
|
||||||
if ($this->request->post()) {
|
if ($this->request->post()) {
|
||||||
$po->values($this->request->post());
|
$po->values($this->request->post());
|
||||||
|
|
||||||
|
@ -44,6 +44,10 @@ class Model_Payment extends ORM_OSB {
|
|||||||
'payment_item'=>FALSE,
|
'payment_item'=>FALSE,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
|
/** LOCAL METHODS **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an item to an payment
|
* Add an item to an payment
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<div class="col-md-11">
|
<div class="col-md-12">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Payment Details</legend>
|
<legend>Payment Details</legend>
|
||||||
|
|
||||||
<label for="date_payment_label">Date Paid</label>
|
<label for="date_payment_label">Date Paid</label>
|
||||||
<div class="input-group col-md-3">
|
<div class="input-group col-md-2">
|
||||||
<input type="text" id="date_payment_label" value="<?php echo $o->display('date_payment') ?>" xisabled="disabled" class="form-control" placeholder="Date Paid">
|
<input type="text" id="date_payment_label" value="<?php echo date('d-m-Y',$o->date_payment); ?>" class="form-control" placeholder="Date Paid">
|
||||||
<span class="input-group-addon" id="basic-addon1"><i class="fa fa-calendar"></i></span>
|
<span class="input-group-addon" id="basic-addon1"><i class="fa fa-calendar"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<?php echo Form::hidden('date_payment',$o->date_payment); ?>
|
<?php echo Form::hidden('date_payment',$o->date_payment); ?>
|
||||||
@ -17,13 +17,15 @@
|
|||||||
<?php echo Form::input('notes',$o->notes,array('label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?>
|
<?php echo Form::input('notes',$o->notes,array('label'=>'Notes','placeholder'=>'Any notes about this payment?')); ?>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-11">
|
<fieldset class="col-md-8">
|
||||||
<div class="col-md-8" id="items"></div>
|
<legend>Invoice Details</legend>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
<div id="items"></div>
|
||||||
<button type="submit" class="btn btn-primary">Save changes</button>
|
</fieldset>
|
||||||
<button type="button" class="btn">Cancel</button>
|
|
||||||
</div>
|
<div class="row col-md-12">
|
||||||
</div> <!-- /col-md-11 -->
|
<button type="submit" class="btn btn-primary">Save changes</button>
|
||||||
|
<button type="button" class="btn">Cancel</button>
|
||||||
|
</div>
|
||||||
|
@ -14,19 +14,19 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php $c=0;foreach ($o->subitems('ALLOC') as $pio) : ?>
|
<?php $c=0;foreach ($o->subitems('ALLOC') as $pio) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$pio->invoice_id),$pio->invoice->id()); ?></td>
|
<td><?php echo HTML::anchor(URL::link('user','invoice/view/'.$pio->invoice_id),$pio->invoice->refnum(TRUE)); ?></td>
|
||||||
<td><?php echo $pio->invoice->display('date_orig'); ?></td>
|
<td><?php echo $pio->invoice->display('date_orig'); ?></td>
|
||||||
<td><?php echo $pio->invoice->display('due_date'); ?></td>
|
<td><?php echo $pio->invoice->display('due_date'); ?></td>
|
||||||
<td class="text-right"><?php echo $pio->invoice->total(TRUE); ?></td>
|
<td class="text-right"><?php echo $pio->invoice->total(TRUE); ?></td>
|
||||||
<td class="text-right"><?php echo $pio->invoice->payments_total(TRUE); ?></td>
|
<td class="text-right"><?php echo $pio->invoice->payments_total(TRUE); ?></td>
|
||||||
<td class="text-right"><?php echo $pio->invoice->due(TRUE); ?></td>
|
<td class="text-right"><?php echo $pio->invoice->due(TRUE); ?></td>
|
||||||
<td class="text-right"><?php echo Form::input('payment_item['.$pio->invoice_id.']',$pio->display('alloc_amt'),array('class'=>'span1','nocg'=>TRUE,'tabindex'=>++$c)); ?></td>
|
<td class="text-right"><?php echo Form::input('payment_item['.$pio->invoice_id.']',$pio->display('alloc_amt'),array('nocg'=>TRUE,'class'=>'text-right','tabindex'=>++$c)); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-right" colspan="6">Unapplied</td>
|
<td class="text-right" colspan="6">Unapplied</td>
|
||||||
<td class="text-right"><?php echo Form::input('invoice_item[excess]',$o->balance(TRUE),array('class'=>'span1','nocg'=>TRUE,'disabled'=>'disabled')); ?></td>
|
<td class="text-right"><?php echo Form::input('invoice_item[excess]',$o->balance(TRUE),array('nocg'=>TRUE,'class'=>'text-right','disabled'=>'disabled')); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -10,5 +10,6 @@
|
|||||||
* @license http://dev.osbill.net/license.html
|
* @license http://dev.osbill.net/license.html
|
||||||
*/
|
*/
|
||||||
class Controller_Service extends Controller_TemplateDefault {
|
class Controller_Service extends Controller_TemplateDefault {
|
||||||
|
protected $icon = 'fa fa-barcode'; //fa-plug for plugins
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -59,7 +59,7 @@ class Controller_User_Service extends Controller_Service {
|
|||||||
->set('o',$so);
|
->set('o',$so);
|
||||||
|
|
||||||
Block::factory()
|
Block::factory()
|
||||||
->title(sprintf('%s: %s',$so->id(),$so->name()))
|
->title(sprintf('%s: %s',$so->refnum(TRUE),$so->name()))
|
||||||
->title_icon('fa fa-server')
|
->title_icon('fa fa-server')
|
||||||
->body($output);
|
->body($output);
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,15 @@ class Model_Service extends ORM_OSB {
|
|||||||
return $this->_plugin;
|
return $this->_plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attributes of the service
|
||||||
|
*
|
||||||
|
* @return an array of attributes
|
||||||
|
*/
|
||||||
|
public function attributes($variable=NULL) {
|
||||||
|
return ($this->_plugin()) ? $this->_plugin()->attributes() : array();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the additional charges associated with this service
|
* Get the additional charges associated with this service
|
||||||
*/
|
*/
|
||||||
@ -178,13 +187,6 @@ class Model_Service extends ORM_OSB {
|
|||||||
return time()+$days*86400 > $this->expire();
|
return time()+$days*86400 > $this->expire();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the service number
|
|
||||||
*/
|
|
||||||
public function id() {
|
|
||||||
return sprintf('%05s',$this->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List invoices for this service
|
* List invoices for this service
|
||||||
*/
|
*/
|
||||||
@ -291,10 +293,6 @@ class Model_Service extends ORM_OSB {
|
|||||||
return $this->price(TRUE)*$multiple;
|
return $this->price(TRUE)*$multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function service_change() {
|
|
||||||
return $this->service_change->where_active()->where_open()->and_where('complete','!=',1)->or_where('complete','IS',null)->where_close()->find();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the service charge
|
* Return the service charge
|
||||||
*/
|
*/
|
||||||
@ -313,19 +311,8 @@ class Model_Service extends ORM_OSB {
|
|||||||
return $format ? Currency::display($p) : $p;
|
return $format ? Currency::display($p) : $p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function service_change() {
|
||||||
* Render some details for specific calls, eg: invoice
|
return $this->service_change->where_active()->where_open()->and_where('complete','!=',1)->or_where('complete','IS',null)->where_close()->find();
|
||||||
*/
|
|
||||||
public function details($type) {
|
|
||||||
$plugin = $this->plugin();
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case 'invoice_detail_items':
|
|
||||||
return is_null($plugin) ? array() : $plugin->_details($type);
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function service_view() {
|
public function service_view() {
|
||||||
@ -368,7 +355,6 @@ class Model_Service extends ORM_OSB {
|
|||||||
public function list_byplugin($plugin) {
|
public function list_byplugin($plugin) {
|
||||||
return $this
|
return $this
|
||||||
->join('product')
|
->join('product')
|
||||||
->on($this->table_name().'.site_id','=','product.site_id') // @todo This should be automatic
|
|
||||||
->on($this->table_name().'.product_id','=','product.id')
|
->on($this->table_name().'.product_id','=','product.id')
|
||||||
->where('prod_plugin_file','=',$plugin)
|
->where('prod_plugin_file','=',$plugin)
|
||||||
->and_where('service.status','=',TRUE)
|
->and_where('service.status','=',TRUE)
|
||||||
@ -417,12 +403,5 @@ class Model_Service extends ORM_OSB {
|
|||||||
->where('date_next_invoice','<',time()+(ORM::factory('Invoice')->config('GEN_DAYS')+$days)*86400)
|
->where('date_next_invoice','<',time()+(ORM::factory('Invoice')->config('GEN_DAYS')+$days)*86400)
|
||||||
->find_all();
|
->find_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* List services that need to be provisioned
|
|
||||||
*/
|
|
||||||
public function list_provision() {
|
|
||||||
return $this->_where_active()->where('queue','=','PROVISION');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -17,22 +17,26 @@ abstract class Model_Service_Plugin extends ORM_OSB {
|
|||||||
'service'=>array(),
|
'service'=>array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service attributes
|
||||||
|
*/
|
||||||
|
abstract public function attributes($variable=NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When does our service expire
|
* When does our service expire
|
||||||
*/
|
*/
|
||||||
abstract public function expire();
|
abstract public function expire();
|
||||||
|
|
||||||
/**
|
|
||||||
* Our service name as defined in the DB
|
|
||||||
*/
|
|
||||||
abstract public function name();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table attributes that provide username/password values
|
* The table attributes that provide username/password values
|
||||||
*/
|
*/
|
||||||
abstract public function password();
|
abstract public function password();
|
||||||
abstract public function username();
|
abstract public function username();
|
||||||
|
|
||||||
|
/** LOCAL METHODS **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide the button that launches the management of this service, generally from a 3rd party
|
* Provide the button that launches the management of this service, generally from a 3rd party
|
||||||
*/
|
*/
|
||||||
@ -93,30 +97,5 @@ $(document).ready(function() {
|
|||||||
return View::factory(sprintf('service/user/plugin/%s/view',$this->plugin()))
|
return View::factory(sprintf('service/user/plugin/%s/view',$this->plugin()))
|
||||||
->set('o',$this);
|
->set('o',$this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show our service name as defined in the DB with product suffix.
|
|
||||||
*/
|
|
||||||
public function service_name() {
|
|
||||||
return sprintf('%s - %s',$this->service->product->title(),$this->name());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get specific service details for use in other modules
|
|
||||||
* For Example: Invoice
|
|
||||||
*
|
|
||||||
* @todo Make the rendered items configurable
|
|
||||||
* @todo Change this method name, now that it is public
|
|
||||||
*/
|
|
||||||
public function _details($type) {
|
|
||||||
switch ($type) {
|
|
||||||
// Nothing to add for invoices
|
|
||||||
case 'invoice_detail_items':
|
|
||||||
return array();
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -33,21 +33,33 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
|||||||
|
|
||||||
protected $_save_message = TRUE;
|
protected $_save_message = TRUE;
|
||||||
|
|
||||||
// Required abstract functions
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
|
public function attributes($variable=NULL) {
|
||||||
|
return array(
|
||||||
|
'SSL DN'=>$this->namesub($variable),
|
||||||
|
'Valid From'=>$this->ca->valid_from(TRUE),
|
||||||
|
'Valid To'=>$this->ca->valid_to(TRUE),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function expire($format=FALSE) {
|
public function expire($format=FALSE) {
|
||||||
return $this->_so->get_valid_to($format);
|
return (! $this->_so) ? ($format ? 'Not Issued' : 0) : $this->_so->get_valid_to($format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function name($variable=NULL) {
|
public function name($variable=NULL) {
|
||||||
return ($this->cert AND $this->ca->loaded()) ? sprintf('%s:%s',$this->ca->subject(),$this->display('cert')) : $this->display('csr');
|
return ($this->cert AND $this->ca->loaded()) ? sprintf('%s:%s',$this->ca->subject(),$this->display('cert')) : $this->display('csr');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function namesub($variable=NULL) {
|
||||||
|
return $this->ca->dn();
|
||||||
|
}
|
||||||
|
|
||||||
public function password() {} // Not used
|
public function password() {} // Not used
|
||||||
|
|
||||||
public function username() {} // Not used
|
public function username() {} // Not used
|
||||||
|
|
||||||
// Local functions
|
/** LOCAL METHODS **/
|
||||||
|
|
||||||
private $_so = NULL;
|
private $_so = NULL;
|
||||||
|
|
||||||
@ -204,23 +216,5 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get specific service details for use in other modules
|
|
||||||
* For Example: Invoice
|
|
||||||
*
|
|
||||||
* @todo Make the rendered items configurable
|
|
||||||
* @todo Change this method name, now that it is public
|
|
||||||
*/
|
|
||||||
// @todo This needs to be validated for this model
|
|
||||||
public function _details($type) {
|
|
||||||
switch ($type) {
|
|
||||||
case 'invoice_detail_items':
|
|
||||||
return array();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return parent::$_details($type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<?php if ($o instanceof Model_Invoice) : ?>
|
<?php if ($o instanceof Model_Invoice) : ?>
|
||||||
<td><?php echo $o->display('date_orig'); ?></td>
|
<td><?php echo $o->display('date_orig'); ?></td>
|
||||||
<td><?php echo 'Invoice '.HTML::anchor(URL::link('user','invoice/view/'.$o->id),$o->id()); ?></td>
|
<td><?php echo 'Invoice '.HTML::anchor(URL::link('user','invoice/view/'.$o->id),$o->refnum(TRUE)); ?></td>
|
||||||
<?php elseif ($o instanceof Model_Payment) : ?>
|
<?php elseif ($o instanceof Model_Payment) : ?>
|
||||||
<?php $adjust = -$o->total(); ?>
|
<?php $adjust = -$o->total(); ?>
|
||||||
<td><?php echo $o->display('date_payment'); ?></td>
|
<td><?php echo $o->display('date_payment'); ?></td>
|
||||||
|
Reference in New Issue
Block a user