Fixes to invoice display

This commit is contained in:
Deon George 2014-01-08 15:48:42 +11:00
parent 3cbf48721b
commit ec88eb6926
3 changed files with 20 additions and 7 deletions

View File

@ -79,7 +79,19 @@ class Model_Charge extends ORM_OSB implements Invoicable {
} }
public function invoice_item($item_type) { public function invoice_item($item_type) {
return sprintf('%s %s',StaticList_ItemType::get($item_type),$this->display('date_charge')); switch ($item_type) {
case 5:
return sprintf('%s (%s x %s%s%s) %s',
StaticList_ItemType::get($item_type),
$this->quantity,
$this->display('amount'),
($this->description ? ' '.$this->description : ''),
($this->attributes ? ' ['.join('|',$this->attributes).']' : ''),
$this->display('date_charge'));
default:
return sprintf('%s %s',StaticList_ItemType::get($item_type),$this->display('date_charge')).($this->description ? ' ('.$this->description.')' : '');
}
} }
/** /**

View File

@ -100,7 +100,7 @@ class Export_Plugin_Quicken extends Export_Plugin {
$items[$c]['INVITEM'] = $edo->map_data['item']; $items[$c]['INVITEM'] = $edo->map_data['item'];
} else { } else {
throw HTTP_Exception::factory(501,'Missing product map data for :product (:id)',array(':product'=>$iio->product->title(),':id'=>$iio->product_id)); throw HTTP_Exception::factory(501,'Missing product map data for :product (:id)',array(':product'=>$iio->module()->title(),':id'=>$iio->module_ref));
} }
$items[$c]['MEMO'] = sprintf('%s (%s)',$iio->module()->title(),$iio->period()); $items[$c]['MEMO'] = sprintf('%s (%s)',$iio->module()->title(),$iio->period());
@ -133,13 +133,13 @@ class Export_Plugin_Quicken extends Export_Plugin {
$items[$c]['TAXAMOUNT'] = 0; $items[$c]['TAXAMOUNT'] = 0;
} }
// @todo This rounding should be a system config.
if ($iio->module() instanceof Model_Charge) { if ($iio->module() instanceof Model_Charge) {
$items[$c]['QNTY'] *= $iio->module()->quantity; $items[$c]['QNTY'] *= $iio->module()->quantity;
$items[$c]['PRICE'] = sprintf('%3.2f',round($iio->subtotal()-$iio->discount(),2)); $items[$c]['PRICE'] = sprintf('%3.2f',round($iio->module()->amount-$iio->discount(),2));
$items[$c]['AMOUNT'] = sprintf('%3.2f',round($iio->module()->amount-$iio->discount(),2)*-1); $items[$c]['AMOUNT'] = sprintf('%3.2f',round($iio->subtotal()-$iio->discount(),2)*-1);
} else { } else {
// @todo This rounding should be a system config.
$items[$c]['PRICE'] = sprintf('%3.2f',round($iio->subtotal()-$iio->discount(),2)); $items[$c]['PRICE'] = sprintf('%3.2f',round($iio->subtotal()-$iio->discount(),2));
$items[$c]['AMOUNT'] = sprintf('%3.2f',round($iio->subtotal()-$iio->discount(),2)*-1); $items[$c]['AMOUNT'] = sprintf('%3.2f',round($iio->subtotal()-$iio->discount(),2)*-1);
} }

View File

@ -56,9 +56,7 @@ class Model_Invoice_Item extends ORM_OSB {
switch ($this->item_type) { switch ($this->item_type) {
// Service Charges // Service Charges
case 0: case 0:
case 7:
return ((! $this->service_id OR $this->product_id OR $this->charge_id OR $this->product_name OR ! $this->recurring_schedule OR ! $this->date_start OR ! $this->date_stop) ? '+ ' : '').$ii.' '.$this->period(); return ((! $this->service_id OR $this->product_id OR $this->charge_id OR $this->product_name OR ! $this->recurring_schedule OR ! $this->date_start OR ! $this->date_stop) ? '+ ' : '').$ii.' '.$this->period();
case 1: case 1:
// @todo // @todo
return $this->product_name; return $this->product_name;
@ -70,6 +68,9 @@ class Model_Invoice_Item extends ORM_OSB {
case 6: case 6:
return ((! $this->service_id OR $this->product_id OR $this->charge_id OR $this->product_name OR $this->recurring_schedule OR ! $this->date_start OR ! $this->date_stop) ? '+ ' : '').$ii; return ((! $this->service_id OR $this->product_id OR $this->charge_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->charge_id OR $this->product_name OR ! $this->date_start OR ! $this->date_stop) ? '+ ' : '').$ii.' '.$this->period();
case 8: case 8:
return $this->product_name; return $this->product_name;