Fixes for export
This commit is contained in:
parent
f1f28cd746
commit
5697e7985b
@ -93,9 +93,8 @@ class Export_Quicken extends Export {
|
|||||||
->find();
|
->find();
|
||||||
|
|
||||||
if ($eo->loaded()) {
|
if ($eo->loaded()) {
|
||||||
$map_data = unserialize($eo->map_data);
|
$qto->ACCNT = $eo->map_data['account'];
|
||||||
$qto->ACCNT = $map_data['account'];
|
$qto->INVITEM = $eo->map_data['item'];
|
||||||
$qto->INVITEM = $map_data['item'];
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Kohana_Exception('Missing product map data for :product (:id)',
|
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->ACCNT = 'Other Income';
|
||||||
$qto->INVITEM = 'Unknown';
|
$qto->INVITEM = 'Unknown';
|
||||||
$qto->MEMO = sprintf('%s (%s)',
|
$qto->MEMO = sprintf('%s (%s)',
|
||||||
$iio->product->product_translate->find()->name,$daterange);
|
$iio->product->product_translate->find()->name,$daterange);
|
||||||
}
|
}
|
||||||
|
|
||||||
$qto->CLEAR = 'N';
|
$qto->CLEAR = 'N';
|
||||||
@ -135,6 +134,29 @@ class Export_Quicken extends Export {
|
|||||||
$qio->addInvoiceItem($qto);
|
$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);
|
$qo->addInvoice($qio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,19 @@ class Model_Invoice extends ORMOSB {
|
|||||||
return $format ? Currency::display($result) : Currency::round($result);
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function credits() {
|
||||||
|
return array($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function credits_total($format=FALSE) {
|
||||||
|
$result = 0;
|
||||||
|
|
||||||
|
foreach ($this->credits() as $po)
|
||||||
|
$result += $po->credit_amt;
|
||||||
|
|
||||||
|
return $format ? Currency::display($result) : Currency::round($result);
|
||||||
|
}
|
||||||
|
|
||||||
public function discount($format=FALSE) {
|
public function discount($format=FALSE) {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
<td>Payments Received to Date</td>
|
<td>Payments Received to Date</td>
|
||||||
<td class="bold-right"><?php echo $io->payments_total(TRUE); ?></td>
|
<td class="bold-right"><?php echo $io->payments_total(TRUE); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Credits Applied to Date</td>
|
||||||
|
<td class="bold-right"><?php echo $io->credits_total(TRUE); ?></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Total Charges Due This Invoice</td>
|
<td>Total Charges Due This Invoice</td>
|
||||||
<td class="bold-right"><?php echo $io->due(TRUE); ?></td>
|
<td class="bold-right"><?php echo $io->due(TRUE); ?></td>
|
||||||
|
Reference in New Issue
Block a user