Fixes for export

This commit is contained in:
Deon George
2012-08-01 22:34:59 +10:00
parent f1f28cd746
commit 5697e7985b
3 changed files with 43 additions and 4 deletions

View File

@@ -93,9 +93,8 @@ class Export_Quicken extends Export {
->find();
if ($eo->loaded()) {
$map_data = unserialize($eo->map_data);
$qto->ACCNT = $map_data['account'];
$qto->INVITEM = $map_data['item'];
$qto->ACCNT = $eo->map_data['account'];
$qto->INVITEM = $eo->map_data['item'];
} else {
throw new Kohana_Exception('Missing product map data for :product (:id)',
@@ -112,7 +111,7 @@ class Export_Quicken extends Export {
$qto->ACCNT = 'Other Income';
$qto->INVITEM = 'Unknown';
$qto->MEMO = sprintf('%s (%s)',
$iio->product->product_translate->find()->name,$daterange);
$iio->product->product_translate->find()->name,$daterange);
}
$qto->CLEAR = 'N';
@@ -135,6 +134,29 @@ class Export_Quicken extends Export {
$qio->addInvoiceItem($qto);
}
// Add credits as a other item
$qto = new Quicken_InvoiceItem;
$qto->ACCNT = 'Other Income';
$qto->INVITEM = 'Product:Unknown';
$qto->CLEAR = 'N';
$qto->QNTY = 1;
$qto->MEMO = 'Credit Item';
if ($pio->invoice->tax()) {
$qto->TAXABLE = 'Y';
# @todo, get this from OSB
$qto->TAXCODE = 'GST';
$qto->TAXRATE = sprintf('%3.2f%%','0.10');
$tax = round($pio->invoice->credit_amt/11,2);
$qto->TAXAMOUNT = sprintf('%3.2f',$tax);
} else {
$qto->TAXAMOUNT = 0;
}
$qto->PRICE = sprintf('%3.2f',round(($pio->invoice->credit_amt-$tax)*-1,2));
$qto->AMOUNT = sprintf('%3.2f',round(($pio->invoice->credit_amt-$tax),2));
$qio->addInvoiceItem($qto);
$qo->addInvoice($qio);
}
}