function exportQB($clause = ''){ $codes = $this->retrieveSet($clause); if($codes === FALSE){ return FALSE; } $exporter = new QBExporter(); foreach($codes as $code){ if(!empty($code->code)){ $out_code = array(); $out_code['NAME'] = $code->code; $out_code['DESC'] = $code->description; $out_code['COST'] = $code->cost; $out_code['PRICE'] = $code->price; $out_code['TAXABLE'] = $code->taxable; $out_code['ACCNT'] = $code->getIncomeAccountName(); $out_code['COGSACCNT'] = $code->getExpenseAccountName(); if($exporter->addItem('Item', $out_code) === FALSE){ $this->error = "SI_ItemCode::export(): Error adding code {$code->name}: ".$exporter->getLastError(); return FALSE; } } } return $exporter->get_string(); }
function exportQB($clause = ''){ $invoices = $this->retrieveSet($clause); if($invoices === FALSE){ return FALSE; } $app_config = SI_Config::getAppConfig(); $rec_account = new SI_Account(); $rec_account->get($app_config['account_rec']); $exporter = new QBExporter(); foreach($invoices as $invoice){ $company =& $invoice->getCompany(); if(count($invoice->_lines) > 0 && $company != FALSE){ $invoice_data = array(); $invoice_data['NAME'] = $company->name; $invoice_data['TRNSID'] = $invoice->id; $invoice_data['DOCNUM'] = $invoice->id; $invoice_data['DATE'] = date("n/j/Y", $invoice->timestamp); $invoice_data['TRNSTYPE'] = 'INVOICE'; $invoice_data['TAXABLE'] = ($invoice->getTaxAmount() > 0.00); $invoice_data['TAX_CHARGED'] = ($invoice->getTaxAmount() > 0.00); $invoice_data['ACCNT'] = $rec_account->name; $invoice_data['AMOUNT'] = $invoice->getTotal(); $invoice_data['LINES'] = array(); $invoice_data['TIMESTAMP'] = $invoice->updated_ts; foreach($invoice->_lines as $line){ $item_code =& $line->getItemCode(); $amount = $line->getTotal() * -1; $invoice_data['LINES'][] = array( 'TRNSTYPE' => 'INVOICE', 'DATE' => $invoice_data['DATE'], 'QNTY' => (float)'-'.$line->quantity, 'MEMO' => '"'.$line->description.'"', 'AMOUNT' => $amount, 'PRICE' => (float)$line->unit_price, 'INVITEM' => $item_code->code, 'ACCNT' => $item_code->getIncomeAccountName() ); } if($exporter->addItem('Invoice', $invoice_data) === FALSE){ $this->error = "SI_Company::export(): Error adding customer {$customer->name}: ".$exporter->getLastError(); return FALSE; } } } return $exporter->get_string(); }
function exportQB($clause = ''){ $payments = $this->retrieveSet($clause); if($payments === FALSE){ return FALSE; } $app_config = SI_Config::getAppConfig(); $rec_account = new SI_Account(); $rec_account->get($app_config['account_rec']); $payment_account = new SI_Account(); $payment_account->get($app_config['account_payment']); $exporter = new QBExporter(); foreach($payments as $payment){ $company =& $payment->getCompany(); if($company != FALSE){ $payment_data = array(); $payment_data['NAME'] = $company->name; $payment_data['TRNSID'] = $payment->id; $payment_data['ACCNT'] = $payment_account->name; $payment_data['DOCNUM'] = $payment->id; $payment_data['DATE'] = date("n/j/Y", $payment->timestamp); $payment_data['TRNSTYPE'] = 'PAYMENT'; $payment_data['AMOUNT'] = $payment->amount; $payment_data['LINES'] = array(); $payment_data['LINES'][] = array( 'TRNSTYPE' => 'PAYMENT', 'DATE' => $payment_data['DATE'], 'DOCNUM' => $payment_data['DOCNUM'], 'NAME' => $payment_data['NAME'], 'AMOUNT' => ($payment->amount * -1), 'ACCNT' => $rec_account->name ); if($exporter->addItem('Payment', $payment_data) === FALSE){ $this->error = "SI_Payment::export(): Error adding payment {$payment->id}: ".$exporter->getLastError(); return FALSE; } } } return $exporter->get_string(); }
function exportQB($clause = ''){ $accounts = $this->retrieveSet($clause); if($accounts === FALSE){ return FALSE; } $exporter = new QBExporter(); foreach($accounts as $account){ if(!empty($account->name)){ $out_account = array(); $out_account['NAME'] = $account->name; $out_account['DESC'] = $account->description; $out_account['ACCNTTYPE'] = $account->type; if($exporter->addItem('Account', $out_account) === FALSE){ $this->error = "SI_ItemCode::export(): Error adding code {$code->name}: ".$exporter->getLastError(); return FALSE; } } } return $exporter->get_string(); }