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
|
$tenders = $this->Tender->find
|
||||||
('all',
|
('all',
|
||||||
array('contain' => array
|
array('contain' => array
|
||||||
('LedgerEntry',
|
('Customer',
|
||||||
|
'LedgerEntry',
|
||||||
),
|
),
|
||||||
|
|
||||||
'conditions' => array(array('Tender.deposit_transaction_id' => null),
|
'conditions' => array(array('Tender.deposit_transaction_id' => null),
|
||||||
@@ -141,8 +142,7 @@ class TendersController extends AppController {
|
|||||||
);
|
);
|
||||||
$deposit['types'][$type_id]['entries'][] =
|
$deposit['types'][$type_id]['entries'][] =
|
||||||
array('name' => $tender['Tender']['name'],
|
array('name' => $tender['Tender']['name'],
|
||||||
//'customer' => $tender['Customer']['name'],
|
'customer' => $tender['Customer']['name'],
|
||||||
'customer' => 'Not Yet',
|
|
||||||
'amount' => $tender['LedgerEntry']['amount']);
|
'amount' => $tender['LedgerEntry']['amount']);
|
||||||
$deposit['types'][$type_id]['total'] += $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
|
// Get the Tender and related fields
|
||||||
$tender = $this->Tender->find
|
$tender = $this->Tender->find
|
||||||
('first', array
|
('first', array
|
||||||
('contain' => array('TenderType'),
|
('contain' => array('TenderType', 'Customer', 'LedgerEntry' => array('Transaction')),
|
||||||
));
|
));
|
||||||
|
|
||||||
// REVISIT <AP>: 20090713
|
// REVISIT <AP>: 20090713
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class Tender extends AppModel {
|
|||||||
|
|
||||||
var $belongsTo = array(
|
var $belongsTo = array(
|
||||||
'TenderType',
|
'TenderType',
|
||||||
|
'Customer',
|
||||||
'LedgerEntry',
|
'LedgerEntry',
|
||||||
'DepositTransaction' => array(
|
'DepositTransaction' => array(
|
||||||
'className' => 'Transaction',
|
'className' => 'Transaction',
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ class Transaction extends AppModel {
|
|||||||
foreach ($data['Entry'] AS $e_index => &$entry) {
|
foreach ($data['Entry'] AS $e_index => &$entry) {
|
||||||
extract($entry);
|
extract($entry);
|
||||||
$le1['transaction_id'] = $le2['transaction_id'] = $ret['transaction_id'];
|
$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);
|
$result = $this->LedgerEntry->DoubleEntry->addDoubleEntry($le1, $le2, $le1_tender);
|
||||||
$ret['entries'][$e_index]['DoubleEntry'] = $result;
|
$ret['entries'][$e_index]['DoubleEntry'] = $result;
|
||||||
if ($result['error']) {
|
if ($result['error']) {
|
||||||
@@ -376,7 +377,7 @@ class Transaction extends AppModel {
|
|||||||
!$ret['error']) {
|
!$ret['error']) {
|
||||||
$result = $this->StatementEntry->assignCredits
|
$result = $this->StatementEntry->assignCredits
|
||||||
(array('link' => array('Customer'),
|
(array('link' => array('Customer'),
|
||||||
'conditions' => array('Customer.id' => $customer_id)),
|
'conditions' => array('Customer.id' => $transaction['customer_id'])),
|
||||||
($transaction['type'] == 'RECEIPT'
|
($transaction['type'] == 'RECEIPT'
|
||||||
? $ret['transaction_id']
|
? $ret['transaction_id']
|
||||||
: null));
|
: null));
|
||||||
|
|||||||
@@ -9,12 +9,21 @@ echo '<div class="tender view">' . "\n";
|
|||||||
* Tender Detail Main Section
|
* Tender Detail Main Section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$ttype = $tender['TenderType'];
|
$ttype = $tender['TenderType'];
|
||||||
$tender = $tender['Tender'];
|
$customer = $tender['Customer'];
|
||||||
|
$entry = $tender['LedgerEntry'];
|
||||||
|
$transaction = $entry['Transaction'];
|
||||||
|
$tender = $tender['Tender'];
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$rows[] = array('ID', $tender['id']);
|
$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', $ttype['name']);
|
||||||
/* $rows[] = array('Type', $html->link($ttype['name'], */
|
/* $rows[] = array('Type', $html->link($ttype['name'], */
|
||||||
/* array('controller' => 'tender_types', */
|
/* array('controller' => 'tender_types', */
|
||||||
@@ -25,15 +34,18 @@ for ($i=1; $i<=4; ++$i)
|
|||||||
if (!empty($ttype["data{$i}_name"]))
|
if (!empty($ttype["data{$i}_name"]))
|
||||||
$rows[] = array($ttype["data{$i}_name"], $tender["data{$i}"]);
|
$rows[] = array($ttype["data{$i}_name"], $tender["data{$i}"]);
|
||||||
|
|
||||||
$rows[] = array('Deposit', $html->link('#'.$tender['deposit_transaction_id'],
|
if (!empty($tender['deposit_transaction_id']))
|
||||||
array('controller' => 'transactions',
|
$rows[] = array('Deposit', $html->link('#'.$tender['deposit_transaction_id'],
|
||||||
'action' => 'view',
|
array('controller' => 'transactions',
|
||||||
$tender['deposit_transaction_id'])));
|
'action' => 'view',
|
||||||
|
$tender['deposit_transaction_id'])));
|
||||||
|
|
||||||
if (!empty($tender['nsf_transaction_id']))
|
if (!empty($tender['nsf_transaction_id']))
|
||||||
$rows[] = array('NSF', $html->link('#'.$tender['nsf_transaction_id'],
|
$rows[] = array('NSF', $html->link('#'.$tender['nsf_transaction_id'],
|
||||||
array('controller' => 'transactions',
|
array('controller' => 'transactions',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$tender['nsf_transaction_id'])));
|
$tender['nsf_transaction_id'])));
|
||||||
|
|
||||||
$rows[] = array('Comment', $tender['comment']);
|
$rows[] = array('Comment', $tender['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
|
|||||||
Reference in New Issue
Block a user