Added customer association to each tender
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@413 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -121,7 +121,8 @@ class TendersController extends AppController {
|
||||
$tenders = $this->Tender->find
|
||||
('all',
|
||||
array('contain' => array
|
||||
('LedgerEntry',
|
||||
('Customer',
|
||||
'LedgerEntry',
|
||||
),
|
||||
|
||||
'conditions' => array(array('Tender.deposit_transaction_id' => null),
|
||||
@@ -141,8 +142,7 @@ class TendersController extends AppController {
|
||||
);
|
||||
$deposit['types'][$type_id]['entries'][] =
|
||||
array('name' => $tender['Tender']['name'],
|
||||
//'customer' => $tender['Customer']['name'],
|
||||
'customer' => 'Not Yet',
|
||||
'customer' => $tender['Customer']['name'],
|
||||
'amount' => $tender['LedgerEntry']['amount']);
|
||||
$deposit['types'][$type_id]['total'] += $tender['LedgerEntry']['amount'];
|
||||
}
|
||||
@@ -208,7 +208,7 @@ class TendersController extends AppController {
|
||||
// Get the Tender and related fields
|
||||
$tender = $this->Tender->find
|
||||
('first', array
|
||||
('contain' => array('TenderType'),
|
||||
('contain' => array('TenderType', 'Customer', 'LedgerEntry' => array('Transaction')),
|
||||
));
|
||||
|
||||
// REVISIT <AP>: 20090713
|
||||
|
||||
@@ -3,6 +3,7 @@ class Tender extends AppModel {
|
||||
|
||||
var $belongsTo = array(
|
||||
'TenderType',
|
||||
'Customer',
|
||||
'LedgerEntry',
|
||||
'DepositTransaction' => array(
|
||||
'className' => 'Transaction',
|
||||
|
||||
@@ -353,6 +353,7 @@ class Transaction extends AppModel {
|
||||
foreach ($data['Entry'] AS $e_index => &$entry) {
|
||||
extract($entry);
|
||||
$le1['transaction_id'] = $le2['transaction_id'] = $ret['transaction_id'];
|
||||
$le1_tender['customer_id'] = $transaction['customer_id'];
|
||||
$result = $this->LedgerEntry->DoubleEntry->addDoubleEntry($le1, $le2, $le1_tender);
|
||||
$ret['entries'][$e_index]['DoubleEntry'] = $result;
|
||||
if ($result['error']) {
|
||||
@@ -376,7 +377,7 @@ class Transaction extends AppModel {
|
||||
!$ret['error']) {
|
||||
$result = $this->StatementEntry->assignCredits
|
||||
(array('link' => array('Customer'),
|
||||
'conditions' => array('Customer.id' => $customer_id)),
|
||||
'conditions' => array('Customer.id' => $transaction['customer_id'])),
|
||||
($transaction['type'] == 'RECEIPT'
|
||||
? $ret['transaction_id']
|
||||
: null));
|
||||
|
||||
@@ -9,12 +9,21 @@ echo '<div class="tender view">' . "\n";
|
||||
* Tender Detail Main Section
|
||||
*/
|
||||
|
||||
$ttype = $tender['TenderType'];
|
||||
$tender = $tender['Tender'];
|
||||
$ttype = $tender['TenderType'];
|
||||
$customer = $tender['Customer'];
|
||||
$entry = $tender['LedgerEntry'];
|
||||
$transaction = $entry['Transaction'];
|
||||
$tender = $tender['Tender'];
|
||||
|
||||
$rows = array();
|
||||
$rows[] = array('ID', $tender['id']);
|
||||
$rows[] = array('Name', $tender['name']);
|
||||
$rows[] = array('Received', FormatHelper::date($transaction['stamp']));
|
||||
$rows[] = array('Customer', $html->link($customer['name'],
|
||||
array('controller' => 'customers',
|
||||
'action' => 'view',
|
||||
$customer['id'])));
|
||||
$rows[] = array('Amount', FormatHelper::currency($entry['amount']));
|
||||
$rows[] = array('Item', $tender['name']);
|
||||
$rows[] = array('Type', $ttype['name']);
|
||||
/* $rows[] = array('Type', $html->link($ttype['name'], */
|
||||
/* array('controller' => 'tender_types', */
|
||||
@@ -25,15 +34,18 @@ for ($i=1; $i<=4; ++$i)
|
||||
if (!empty($ttype["data{$i}_name"]))
|
||||
$rows[] = array($ttype["data{$i}_name"], $tender["data{$i}"]);
|
||||
|
||||
$rows[] = array('Deposit', $html->link('#'.$tender['deposit_transaction_id'],
|
||||
array('controller' => 'transactions',
|
||||
'action' => 'view',
|
||||
$tender['deposit_transaction_id'])));
|
||||
if (!empty($tender['deposit_transaction_id']))
|
||||
$rows[] = array('Deposit', $html->link('#'.$tender['deposit_transaction_id'],
|
||||
array('controller' => 'transactions',
|
||||
'action' => 'view',
|
||||
$tender['deposit_transaction_id'])));
|
||||
|
||||
if (!empty($tender['nsf_transaction_id']))
|
||||
$rows[] = array('NSF', $html->link('#'.$tender['nsf_transaction_id'],
|
||||
array('controller' => 'transactions',
|
||||
'action' => 'view',
|
||||
$tender['nsf_transaction_id'])));
|
||||
|
||||
$rows[] = array('Comment', $tender['comment']);
|
||||
|
||||
echo $this->element('table',
|
||||
|
||||
Reference in New Issue
Block a user