Moved the creation actions into the CONTROLLER menu. Minor cleanup of deposit_slip. Minor tweaking to views.

git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@803 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-28 16:32:21 +00:00
parent a3b376544c
commit a79adbce2d
4 changed files with 15 additions and 22 deletions

View File

@@ -25,7 +25,7 @@ class CustomersController extends AppController {
$this->addSideMenuLink('New Customer',
array('controller' => 'customers', 'action' => 'add'), null,
'ACTION', $this->new_area);
'CONTROLLER', $this->new_area);
}

View File

@@ -50,7 +50,7 @@ class TransactionsController extends AppController {
function deposit() {
$this->addSideMenuLink('New Deposit',
array('controller' => 'tenders', 'action' => 'deposit'), null,
'ACTION', $this->new_area);
'CONTROLLER', $this->new_area);
$this->gridView('Deposits');
}
@@ -440,15 +440,12 @@ class TransactionsController extends AppController {
*/
function deposit_slip($id) {
// Build a container for the deposit slip data
$deposit = array('types' => array());
// Find the deposit transaction
$this->Transaction->id = $id;
$deposit +=
$this->Transaction->find('first', array('contain' => false));
$deposit = $this->Transaction->find('first', array('contain' => false));
// Get a summary of all forms of tender in the deposit
$result = $this->Transaction->find
$tenders = $this->Transaction->find
('all',
array('link' => array('DepositTender' =>
array('fields' => array(),
@@ -463,16 +460,17 @@ class TransactionsController extends AppController {
'group' => 'TenderType.id',
));
if (empty($result)) {
die();
// Verify the deposit exists, and that something was actually deposited
if (empty($deposit) || empty($tenders)) {
$this->Session->setFlash(__('Invalid Deposit.', true));
$this->redirect(array('action'=>'deposit'));
}
// Add the summary to our deposit slip data container
foreach ($result AS $type) {
$deposit['types'][$type['TenderType']['id']] =
$type['TenderType'] + $type[0];
$deposit['types'] = array();
foreach ($tenders AS $tender) {
$deposit['types'][$tender['TenderType']['id']] =
$tender['TenderType'] + $tender[0];
}
$deposit_total = 0;

View File

@@ -36,7 +36,7 @@ for ($i=1; $i<=4; ++$i)
if (!empty($tender['deposit_transaction_id']))
$rows[] = array('Deposit', $html->link('#'.$tender['deposit_transaction_id'],
array('controller' => 'transactions',
'action' => 'view',
'action' => 'deposit_slip',
$tender['deposit_transaction_id'])));
if (!empty($tender['nsf_transaction_id']))

View File

@@ -27,18 +27,13 @@ $rows[] = array('Account', ($account['link']
'action' => 'view',
$account['id']))
: $account['name']));
$rows[] = array('Ledger', ($account['link']
? $html->link('#' . $ledger['sequence'],
array('controller' => 'ledgers',
'action' => 'view',
$ledger['id']))
: '#' . $ledger['sequence']));
if (!empty($nsf_tender['id']))
$rows[] = array('NSF Tender', $html->link($nsf_tender['name'],
array('controller' => 'tenders',
'action' => 'view',
$nsf_tender['id'])));
$rows[] = array('Comment', $transaction['comment']);
echo $this->element('table',