Brought the bad debt write-off functionality up to date. I'm not entirely convinced that calling it a receipt is such a good idea, but bad debt is certainly a non-normal case, and we can work on this later if need be.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@486 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-04 23:25:31 +00:00
parent 6904320e4e
commit 5d934f756f
5 changed files with 149 additions and 199 deletions

View File

@@ -0,0 +1,89 @@
<?php /* -*- mode:PHP -*- */
echo '<div class="bad-debt input">' . "\n";
if (isset($lease)) {
$customer = $lease['Customer'];
$unit = $lease['Unit'];
}
if (isset($customer['Customer']))
$customer = $customer['Customer'];
if (isset($lease['Lease']))
$lease = $lease['Lease'];
// We're not actually using a grid to select the customer / lease
// but we could/should be, and the result would be selection-text
echo ('<DIV CLASS="bad-debt grid-selection-text">' .
'<TABLE>' . "\n");
echo ('<TR><TD style="padding-right: 1em;">' . $customer['name'] . '</TD>' .
' <TD>' . '(Customer #' . $customer['id'] . ')' . '</TD>' .
'</TR>' . "\n");
if (isset($lease))
echo ('<TR><TD style="padding-right: 1em;">' . 'Unit ' . $unit['name'] . '</TD>' .
' <TD>' . '(Lease #' . $lease['number'] . ')' . '</TD>' .
'</TR>' . "\n");
echo ('<TR><TD style="padding-right: 1em;">Remaining Balance:</TD>' .
' <TD>' . FormatHelper::currency($balance) . '</TD>' .
'</TR>' . "\n");
echo ('</TABLE>' .
'</DIV>' . "\n");
echo $form->create(null, array('id' => 'receipt-form',
'url' => array('controller' => 'transactions',
'action' => 'postWriteOff'))) . "\n";
echo $form->input("Customer.id",
array('type' => 'hidden',
'value' => $customer['id'])) . "\n";
if (isset($lease['id']))
echo $form->input("Lease.id",
array('type' => 'hidden',
'value' => $lease['id'])) . "\n";
echo $form->input("Entry.0.amount",
array('type' => 'hidden',
'value' => $balance)) . "\n";
echo $this->element('form_table',
array('class' => "item receipt transaction entry",
//'with_name_after' => ':',
'field_prefix' => 'Transaction',
'fields' => array
("stamp" => array('opts' => array('type' => 'text'),
'between' => '<A HREF="#" ONCLICK="datepickerNow(\'TransactionStamp\'); return false;">Now</A>',
),
"comment" => array('opts' => array('size' => 50),
),
))) . "\n";
echo $form->end('Write Off Remaining Balance');
?>
<script type="text/javascript"><!--
// Reset the form
function resetForm() {
datepickerNow('TransactionStamp');
}
$(document).ready(function(){
$("#TransactionStamp")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
resetForm();
});
--></script>
</div>