예제 #1
0
     Radix::redirect($ret);
     break;
 case 'save':
 case 'save-copy':
     $id = intval($_GET['id']);
     $_SESSION['account-transaction'] = null;
     $_SESSION['account-transaction-list'] = array();
     // Delete
     // if ($req->getPost('c') == 'Delete') {
     // 	$aje = new AccountJournalEntry($id);
     // 	$aje->delete();
     // 	$this->_s->info = 'Journal Entry #' . $id . ' deleted';
     // 	$this->redirect('/account/ledger');
     // }
     // $this->_d->beginTransaction();
     $aje = new AccountJournalEntry($id);
     $aje['auth_user_id'] = $_SESSION['uid'];
     $aje['date'] = $_POST['date'];
     $aje['note'] = $_POST['note'];
     $aje['kind'] = $_POST['kind'];
     $aje->save();
     $_SESSION['account-transaction'] = $aje;
     // $this->_s->AccountJournalEntry->date = $this->_request->getPost('date');
     // Was throwing and __PHP_INcomplete_Class error ?
     // $_SESSION['account']['date'] = $_POST['date'];
     // And Make the Wizard
     // $awj = AccountWizardJournal::makeFromAccountJournal($aje);
     if ($id) {
         Session::flash('info', 'Account Journal Entry #' . $id . ' updated');
     } else {
         Session::flash('info', 'Account Journal Entry #' . $aje['id'] . ' created');
예제 #2
0
 // Save the Uploaded Transactions
 session_write_close();
 header('Content-Type: application/json');
 $_ENV['upload_account_id'] = $_SESSION['reconcile_upload_id'];
 // Radix::dump($_POST);
 if (!empty($_POST['id'])) {
     header('HTTP/1.1 400 Bad Request', true, 400);
     die(json_encode(array('status' => 'failure', 'detail' => 'ID Exists')));
 }
 // Skip Entries Missing Date (or the last of the count)
 if (empty($_POST['date'])) {
     header('HTTP/1.1 400 Bad Request', true, 400);
     die(json_encode(array('status' => 'failure', 'detail' => 'Invalid Date')));
 }
 // Journal Entry
 $je = new AccountJournalEntry();
 $je['auth_user_id'] = $_SESSION['uid'];
 $je['date'] = $_POST['date'];
 // $req->getPost('date');
 $je['note'] = $_POST['note'];
 // $req->getPost('note');
 $je['kind'] = 'N';
 // $req->getPost('kind');
 $je->save();
 // Debit Side
 $dr = new AccountLedgerEntry();
 $dr['auth_user_id'] = $_SESSION['uid'];
 $dr['account_journal_id'] = $je['id'];
 // Credit Side
 $cr = new AccountLedgerEntry();
 $cr['auth_user_id'] = $_SESSION['uid'];