Added links everywhere for charge/payment/receipt. Also, minor tweaking to the views in a couple places.

git-svn-id: file:///svn-source/pmgr/branches/initial_20090526@64 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-01 08:39:33 +00:00
parent b6ec85205d
commit 24730fda1b
6 changed files with 51 additions and 24 deletions

View File

@@ -57,17 +57,20 @@ echo $this->element('table',
* Receipts * Receipts
*/ */
$headers = array('ID', 'Timestamp', 'Comment', 'Applied'); $headers = array('ID', 'Timestamp', 'Comment', 'Applied', 'Balance');
$rows = array(); $rows = array();
$running_total = 0; $running_total = $charge['Charge']['total'];
foreach($charge['Receipt'] AS $receipt) { foreach($charge['Receipt'] AS $receipt) {
$amount = $receipt['ChargesReceipt']['amount']; $amount = $receipt['ChargesReceipt']['amount'];
$running_total += $amount; $running_total -= $amount;
$rows[] = array('#'.$receipt['id'], $rows[] = array($html->link('#'.$receipt['id'],
array('controller' => 'receipts',
'action' => 'view',
$receipt['id'])),
datefmt($receipt['stamp']), datefmt($receipt['stamp']),
$receipt['comment'], $receipt['comment'],
currency($receipt['ChargesReceipt']['amount']), currency($receipt['ChargesReceipt']['amount']),
//currency($running_total) currency($running_total)
); );
} }

View File

@@ -157,7 +157,7 @@ echo $this->element('table',
* Ledger History * Ledger History
*/ */
foreach($contact['Lease'] AS $lease) { foreach($contact['Lease'] AS $lease) {
$headers = array('Date', /*'Through',*/ /*'Charge/Receipt'*/'ID', 'Type', 'Comment', 'Amount', 'Total'); $headers = array(/*'Charge/Receipt'*/'ID', 'Date', /*'Through',*/ 'Type', 'Comment', 'Amount', 'Total');
$rows = array(); $rows = array();
$row_class = array(); $row_class = array();
@@ -166,8 +166,11 @@ foreach($contact['Lease'] AS $lease) {
foreach($lease['Charge'] AS $charge) { foreach($lease['Charge'] AS $charge) {
$amount = $charge['total']; $amount = $charge['total'];
$running_total += $amount; $running_total += $amount;
$rows[] = array(datefmt($charge['charge_date']) .' - '. datefmt($charge['charge_to_date']), $rows[] = array($html->link('#'.$charge['id'],
'#'.$charge['id'], array('controller' => 'charges',
'action' => 'view',
$charge['id'])),
datefmt($charge['charge_date']) .' - '. datefmt($charge['charge_to_date']),
$charge['ChargeType']['name'], $charge['ChargeType']['name'],
$charge['comment'], $charge['comment'],
currency($amount), currency($amount),
@@ -177,9 +180,12 @@ foreach($contact['Lease'] AS $lease) {
foreach ($charge['Receipt'] AS $receipt) { foreach ($charge['Receipt'] AS $receipt) {
$amount = -1 * $receipt['ChargesReceipt']['amount']; $amount = -1 * $receipt['ChargesReceipt']['amount'];
$running_total += $amount; $running_total += $amount;
$rows[] = array(' -- ' . datefmt($receipt['stamp']), $rows[] = array($html->link('#'.$receipt['id'],
'#'.$receipt['id'], array('controller' => 'receipts',
'Payment/Receipt', 'action' => 'view',
$receipt['id'])),
' -- ' . datefmt($receipt['stamp']),
'Payment Applied',
$receipt['comment'], $receipt['comment'],
currency($amount), currency($amount),
currency($running_total)); currency($running_total));

View File

@@ -41,7 +41,10 @@ foreach ($payments as $payment) {
'action' => 'view', 'action' => 'view',
$payment['Payment']['id'])), $payment['Payment']['id'])),
$payment['PaymentType']['name'], $payment['PaymentType']['name'],
'#'.$payment['Receipt']['id'], $html->link('#'.$payment['Receipt']['id'],
array('controller' => 'receipts',
'action' => 'view',
$payment['Receipt']['id'])),
currency($payment['Payment']['amount']), currency($payment['Payment']['amount']),
$payment['Payment']['comment'], $payment['Payment']['comment'],
); );

View File

@@ -24,7 +24,10 @@ function datefmt($date) {
$rows = array(array('ID', $payment['Payment']['id']), $rows = array(array('ID', $payment['Payment']['id']),
array('Type', $payment['PaymentType']['name']), array('Type', $payment['PaymentType']['name']),
array('Receipt', '#'.$payment['Receipt']['id']), array('Receipt', $html->link('#'.$payment['Receipt']['id'],
array('controller' => 'receipts',
'action' => 'view',
$payment['Receipt']['id']))),
array('Amount', currency($payment['Payment']['amount'])), array('Amount', currency($payment['Payment']['amount'])),
array('Comment', $payment['Payment']['comment'])); array('Comment', $payment['Payment']['comment']));

View File

@@ -50,17 +50,20 @@ echo $this->element('table',
* Payments * Payments
*/ */
$headers = array('ID', 'Type', 'Comment', 'Amount', /*'Total'*/); $headers = array('ID', 'Type', 'Comment', 'Amount', 'Total');
$rows = array(); $rows = array();
$running_total = 0; $running_total = 0;
foreach($receipt['Payment'] AS $payment) { foreach($receipt['Payment'] AS $payment) {
$amount = $payment['amount']; $amount = $payment['amount'];
$running_total += $amount; $running_total += $amount;
$rows[] = array('#'.$payment['id'], $rows[] = array($html->link('#'.$payment['id'],
array('controller' => 'payments',
'action' => 'view',
$payment['id'])),
$payment['PaymentType']['name'], $payment['PaymentType']['name'],
$payment['comment'], $payment['comment'],
currency($payment['amount']), currency($payment['amount']),
//currency($running_total) currency($running_total)
); );
} }
@@ -76,14 +79,17 @@ echo $this->element('table',
* Charges * Charges
*/ */
$headers = array('Date', 'ID', /*'Due',*/ 'Type', 'Lease', 'Comment', 'Amount' /*, 'Tax', 'Subtotal'*/, 'Applied', /*'Total'*/); $headers = array('ID', 'Date', /*'Due',*/ 'Type', 'Lease', 'Comment', 'Amount' /*, 'Tax', 'Subtotal'*/, 'Applied', /*'Total'*/);
$rows = array(); $rows = array();
$running_total = 0; $running_total = 0;
foreach($receipt['Charge'] AS $charge) { foreach($receipt['Charge'] AS $charge) {
$amount = $charge['total']; $amount = $charge['total'];
$running_total += $amount; $running_total += $amount;
$rows[] = array(datefmt($charge['charge_date']) .' - '. datefmt($charge['charge_to_date']), $rows[] = array($html->link('#'.$charge['id'],
'#'.$charge['id'], array('controller' => 'charges',
'action' => 'view',
$charge['id'])),
datefmt($charge['charge_date']) .' - '. datefmt($charge['charge_to_date']),
//datefmt($charge['due_date']), //datefmt($charge['due_date']),
$charge['ChargeType']['name'], $charge['ChargeType']['name'],
'#'.$charge['Lease']['number'], '#'.$charge['Lease']['number'],

View File

@@ -76,7 +76,7 @@ echo $this->element('table',
* Ledger History * Ledger History
*/ */
foreach($unit['Lease'] AS $lease) { foreach($unit['Lease'] AS $lease) {
$headers = array('Date', /*'Through',*/ /*'Charge/Receipt'*/'ID', 'Type', 'Comment', 'Amount', 'Total'); $headers = array(/*'Charge/Receipt'*/'ID', 'Date', /*'Through',*/ 'Type', 'Comment', 'Amount', 'Total');
$rows = array(); $rows = array();
$running_total = 0; $running_total = 0;
@@ -84,8 +84,11 @@ foreach($unit['Lease'] AS $lease) {
foreach($lease['Charge'] AS $charge) { foreach($lease['Charge'] AS $charge) {
$amount = $charge['total']; $amount = $charge['total'];
$running_total += $amount; $running_total += $amount;
$rows[] = array(datefmt($charge['charge_date']) .' - '. datefmt($charge['charge_to_date']), $rows[] = array($html->link('#'.$charge['id'],
'#'.$charge['id'], array('controller' => 'charges',
'action' => 'view',
$charge['id'])),
datefmt($charge['charge_date']) .' - '. datefmt($charge['charge_to_date']),
$charge['ChargeType']['name'], $charge['ChargeType']['name'],
$charge['comment'], $charge['comment'],
currency($amount), currency($amount),
@@ -95,8 +98,11 @@ foreach($unit['Lease'] AS $lease) {
foreach ($charge['Receipt'] AS $receipt) { foreach ($charge['Receipt'] AS $receipt) {
$amount = -1 * $receipt['ChargesReceipt']['amount']; $amount = -1 * $receipt['ChargesReceipt']['amount'];
$running_total += $amount; $running_total += $amount;
$rows[] = array(' -- ' . datefmt($receipt['stamp']), $rows[] = array($html->link('#'.$receipt['id'],
'#'.$receipt['id'], array('controller' => 'receipts',
'action' => 'view',
$receipt['id'])),
' -- ' . datefmt($receipt['stamp']),
'Payment Applied', 'Payment Applied',
$receipt['comment'], $receipt['comment'],
currency($amount), currency($amount),