Export fixes and updates from live

This commit is contained in:
Deon George 2013-10-09 23:26:59 +11:00
parent c473bf6e7d
commit 317cc331ae
5 changed files with 23 additions and 9 deletions

View File

@ -12,7 +12,6 @@
abstract class Minion_Task extends Kohana_Minion_Task {
protected $_sysoptions = array(
'site'=>NULL,
'verbose'=>FALSE,
);
/**

View File

@ -15,7 +15,7 @@ return array
'ajax'=>FALSE, // AJAX actions can only be run by ajax calls if set to FALSE
'etag'=>FALSE, // Force generating ETAGS
'checkout_notify'=>FALSE, // Test mode to test a particular checkout_notify item
'disabled_noaccess_redirect'=>TRUE, // Disable redirect when noaccess
'disabled_noaccess_redirect'=>FALSE, // Disable redirect when noaccess
'email_admin_only'=> array( // Override emails and send them to an admin instead
'task_invoice_list_overdue'=>array('deon@leenooks.net'=>'Deon George'),
'task_invoice_remind_overdue_1'=>array('deon@leenooks.net'=>'Deon George'),

View File

@ -83,7 +83,7 @@ class Export_Plugin_Quicken extends Export_Plugin {
$c = 0;
// Add the items to the invoice
foreach ($io->invoice_item->find_all() as $iio) {
foreach ($io->items('CHARGE') as $iio) {
// Skip any zero amount items not relating to a service
if ($iio->total() == 0 and ! $iio->service_id)
continue;
@ -141,16 +141,26 @@ class Export_Plugin_Quicken extends Export_Plugin {
}
// Add credits as a other item
if ($io->total_credits()) {
foreach ($io->items('CREDIT') as $iio) {
$items[$c]['ACCNT'] = 'Other Income';
$items[$c]['INVITEM'] = 'Product:Unknown';
$items[$c]['CLEAR'] = 'N';
$items[$c]['QNTY'] = 1;
$items[$c]['MEMO'] = 'Credit Item';
$items[$c]['TAXAMOUNT'] = 0;
$items[$c]['PRICE'] = sprintf('%3.2f',round(($io->total_credits()-$io->tax())*-1,2));
$items[$c]['AMOUNT'] = sprintf('%3.2f',round(($io->total_credits()-$io->tax()),2));
foreach ($iio->tax_items() as $tid => $amount) {
$to = ORM::factory('Tax',$tid);
$items[$c]['TAXABLE'] = 'Y';
$items[$c]['TAXCODE'] = $to->description;
$items[$c]['TAXRATE'] = sprintf('%3.2f%%',$to->rate);
$items[$c]['TAXAMOUNT'] = sprintf('%3.2f',$amount*-1);
}
$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);
$c++;
}
return $this->output(Arr::merge($defaults,$invoice),$items);

View File

@ -231,16 +231,20 @@ class Model_Invoice extends ORM_OSB implements Cartable {
$result = array();
foreach ($this->_sub_items as $ito) {
// Ignore voided items
if ($ito->void)
continue;
$return = FALSE;
switch ($type) {
case 'CHARGE':
if ($ito->quantity > 0)
if ($ito->product_id OR $ito->quantity > 0)
$return = TRUE;
break;
case 'CREDIT':
if ($ito->quantity < 0)
if (! $ito->product_id AND $ito->quantity < 0)
$return = TRUE;
break;

View File

@ -13,6 +13,7 @@ class Task_Task_Run extends Minion_Task {
protected $_options = array(
'id'=>NULL,
'force'=>FALSE,
'verbose'=>FALSE,
);
protected function _execute(array $params) {