Esempio n. 1
0
     $at->AccountLedgerEntryList[] = $ale;
     // Credit Customer Account - or Revenue for Instant Revenue?
     // Old Query, Why from account by contact?
     // $x = $this->_d->fetchRow('SELECT * FROM account WHERE contact_id = ?',array($c->id));
     // if ($x->id) {
     //	 $a = new Account($x->id);
     if ($C['account_id']) {
         $a = new Account($C['account_id']);
     } else {
         $a = new Account($_ENV['account']['revenue_account_id']);
     }
     $ale = new AccountLedgerEntry();
     $ale['account_id'] = $a['id'];
     $ale['account_name'] = $a['full_name'];
     $ale['amount'] = abs($Invoice['bill_amount']);
     $ale['link_to'] = ImperiumBase::getObjectType($Invoice);
     $ale['link_id'] = $Invoice['id'];
     $at->AccountLedgerEntryList[] = $ale;
     // @deprecated
     // $this->_s->AccountTransaction = $at;
     // $this->_s->ReturnTo = sprintf('/invoice/view?i=%d', $Invoice['id']);
     $_SESSION['account-transaction'] = $at;
     $_SESSION['return-path'] = sprintf('/invoice/view?i=%d', $Invoice['id']);
     Radix::redirect('/account/transaction');
     break;
     // Save the Updated Invoice
 // Save the Updated Invoice
 case 'save':
     // Save Request
     foreach (array('contact_id', 'date', 'kind', 'status', 'bill_address_id', 'ship_address_id', 'note') as $x) {
         $Invoice[$x] = trim($_POST[$x]);