Export fixes and updates from live
This commit is contained in:
parent
c473bf6e7d
commit
317cc331ae
@ -12,7 +12,6 @@
|
|||||||
abstract class Minion_Task extends Kohana_Minion_Task {
|
abstract class Minion_Task extends Kohana_Minion_Task {
|
||||||
protected $_sysoptions = array(
|
protected $_sysoptions = array(
|
||||||
'site'=>NULL,
|
'site'=>NULL,
|
||||||
'verbose'=>FALSE,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,7 @@ return array
|
|||||||
'ajax'=>FALSE, // AJAX actions can only be run by ajax calls if set to FALSE
|
'ajax'=>FALSE, // AJAX actions can only be run by ajax calls if set to FALSE
|
||||||
'etag'=>FALSE, // Force generating ETAGS
|
'etag'=>FALSE, // Force generating ETAGS
|
||||||
'checkout_notify'=>FALSE, // Test mode to test a particular checkout_notify item
|
'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
|
'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_list_overdue'=>array('deon@leenooks.net'=>'Deon George'),
|
||||||
'task_invoice_remind_overdue_1'=>array('deon@leenooks.net'=>'Deon George'),
|
'task_invoice_remind_overdue_1'=>array('deon@leenooks.net'=>'Deon George'),
|
||||||
|
@ -83,7 +83,7 @@ class Export_Plugin_Quicken extends Export_Plugin {
|
|||||||
$c = 0;
|
$c = 0;
|
||||||
|
|
||||||
// Add the items to the invoice
|
// 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
|
// Skip any zero amount items not relating to a service
|
||||||
if ($iio->total() == 0 and ! $iio->service_id)
|
if ($iio->total() == 0 and ! $iio->service_id)
|
||||||
continue;
|
continue;
|
||||||
@ -141,16 +141,26 @@ class Export_Plugin_Quicken extends Export_Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add credits as a other item
|
// Add credits as a other item
|
||||||
if ($io->total_credits()) {
|
foreach ($io->items('CREDIT') as $iio) {
|
||||||
$items[$c]['ACCNT'] = 'Other Income';
|
$items[$c]['ACCNT'] = 'Other Income';
|
||||||
$items[$c]['INVITEM'] = 'Product:Unknown';
|
$items[$c]['INVITEM'] = 'Product:Unknown';
|
||||||
$items[$c]['CLEAR'] = 'N';
|
$items[$c]['CLEAR'] = 'N';
|
||||||
$items[$c]['QNTY'] = 1;
|
$items[$c]['QNTY'] = 1;
|
||||||
$items[$c]['MEMO'] = 'Credit Item';
|
$items[$c]['MEMO'] = 'Credit Item';
|
||||||
$items[$c]['TAXAMOUNT'] = 0;
|
|
||||||
|
|
||||||
$items[$c]['PRICE'] = sprintf('%3.2f',round(($io->total_credits()-$io->tax())*-1,2));
|
foreach ($iio->tax_items() as $tid => $amount) {
|
||||||
$items[$c]['AMOUNT'] = sprintf('%3.2f',round(($io->total_credits()-$io->tax()),2));
|
$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);
|
return $this->output(Arr::merge($defaults,$invoice),$items);
|
||||||
|
@ -231,16 +231,20 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
|||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
foreach ($this->_sub_items as $ito) {
|
foreach ($this->_sub_items as $ito) {
|
||||||
|
// Ignore voided items
|
||||||
|
if ($ito->void)
|
||||||
|
continue;
|
||||||
|
|
||||||
$return = FALSE;
|
$return = FALSE;
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'CHARGE':
|
case 'CHARGE':
|
||||||
if ($ito->quantity > 0)
|
if ($ito->product_id OR $ito->quantity > 0)
|
||||||
$return = TRUE;
|
$return = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'CREDIT':
|
case 'CREDIT':
|
||||||
if ($ito->quantity < 0)
|
if (! $ito->product_id AND $ito->quantity < 0)
|
||||||
$return = TRUE;
|
$return = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ class Task_Task_Run extends Minion_Task {
|
|||||||
protected $_options = array(
|
protected $_options = array(
|
||||||
'id'=>NULL,
|
'id'=>NULL,
|
||||||
'force'=>FALSE,
|
'force'=>FALSE,
|
||||||
|
'verbose'=>FALSE,
|
||||||
);
|
);
|
||||||
|
|
||||||
protected function _execute(array $params) {
|
protected function _execute(array $params) {
|
||||||
|
Reference in New Issue
Block a user