Added customer association to each tender
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@413 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -1171,6 +1171,10 @@ CREATE TABLE `pmgr_tenders` (
|
||||
-- The type of this legal tender
|
||||
`tender_type_id` INT(10) UNSIGNED DEFAULT NULL,
|
||||
|
||||
-- The customer that provided this tender
|
||||
-- REVISIT <AP>: 20090728 Do we allow anonymous payments?
|
||||
`customer_id` INT(10) UNSIGNED NOT NULL,
|
||||
|
||||
-- REVISIT <AP>: 20090605
|
||||
-- Check Number;
|
||||
-- Routing Number, Account Number;
|
||||
|
||||
@@ -1265,7 +1265,7 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
'comment' => "Physical Payment: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}",
|
||||
});
|
||||
|
||||
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'payment_id'}
|
||||
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'tender_id'}
|
||||
= $newdb{'tables'}{'tenders'}{'autoid'};
|
||||
|
||||
|
||||
@@ -1278,7 +1278,7 @@ foreach $row (@{query($sdbh, $query)}) {
|
||||
$newdb{'lookup'}{'_closing'}{'credit_entry_id'} =
|
||||
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'credit_entry_id'};
|
||||
$newdb{'lookup'}{'_closing'}{'tender_id'} =
|
||||
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'payment_id'};
|
||||
$newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'tender_id'};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1304,6 +1304,7 @@ foreach $row (@{query($sdbh, $query)})
|
||||
|
||||
$newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}
|
||||
= { 'receipt_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'receipt_id'},
|
||||
'tender_id' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'tender_id'},
|
||||
# 'effective_date' => $newdb{'lookup'}{'receipt'}{$row->{'ReceiptNum'}}{$row->{'PaymentType'}}{'effective_date'},
|
||||
# 'effective_date' => $effective_date;
|
||||
# 'through_date' => $through_date;
|
||||
@@ -1319,10 +1320,13 @@ foreach $row (@{query($sdbh, $query)})
|
||||
$row->{'ChargeID'} = undef
|
||||
if $row->{'entry_type'} eq 'CREDIT';
|
||||
|
||||
# Update the receipt customer_id, now that we have payment info
|
||||
# Update the receipt & tender customer_id, now that we have payment info
|
||||
$newdb{'tables'}{'transactions'}{'rows'}[
|
||||
$newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}{'receipt_id'}
|
||||
]{'customer_id'} = $newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}{'customer_id'};
|
||||
$newdb{'tables'}{'tenders'}{'rows'}[
|
||||
$newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}{'tender_id'}
|
||||
]{'customer_id'} = $newdb{'lookup'}{'payment'}{$row->{'PaymentID'}}{'customer_id'};
|
||||
|
||||
# Use the Memo as our comment, if it exists
|
||||
my $comment = $row->{'Memo'} || "Payment: $row->{'ReceiptNum'}; Type: $row->{'PaymentType'}";
|
||||
|
||||
@@ -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