Fixes to OSB to work with KH 3.3

This commit is contained in:
Deon George
2012-11-10 10:13:57 +11:00
parent ea36639638
commit 6db02ae77d
238 changed files with 813 additions and 938 deletions

View File

@@ -0,0 +1,70 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Quicken exporting capabilities.
*
* @package OSB
* @subpackage Export
* @category Classes/Quicken
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Quicken extends OSBExport {
protected $defaults = array();
protected function keys() {
return array_merge(array_keys($this->defaults),parent::keys());
}
protected function vals() {
return array_merge(array_values($this->defaults),parent::vals());
}
public function addInvoice(Quicken_Invoice $item) {
array_push($this->_items,$item);
}
public function export() {
$export = '';
foreach ($this->_items as $inv) {
# Invoices
$export .= "!TRNS\t";
$export .= implode("\t",$inv->keys())."\n";
$export .= "TRNS\t";
$export .= implode("\t",$inv->vals())."\n";
# Invoice Items
$spl = 0;
foreach ($inv->_items as $invitem) {
if (! $spl) {
$export .= "!SPL\tSPLID\t";
$export .= implode("\t",$invitem->keys())."\n";
}
$export .= sprintf("SPL\t%s\t%s",$spl++,implode("\t",$invitem->vals()))."\n";
}
$export .= "ENDTRNS\n";
# Payments
foreach ($inv->_payments as $payitem) {
if (! $payitem->AMOUNT)
continue;
$export .= "!TRNS\t";
$export .= implode("\t",$payitem->keys())."\n";
$export .= "TRNS\t";
$export .= implode("\t",$payitem->vals())."\n";
$export .= sprintf("!SPL\t%s\t%s\t%s\t%s\t%s\t",'SPLID','TRANSTYPE','CLEAR','ACCNT','AMOUNT')."\n";
$export .= sprintf("SPL\t%s\t%s\t%s\t%s\t%s\t",0,'PAYMENT','N','Accounts Receivable',$payitem->AMOUNT)."\n";
$export .= "ENDTRNS\n";
}
}
return $export;
}
}
?>