First pass at entering charges for a lease. This works, but does not have the ability to add multiple charges, and does not mirror the payment method, which is ajax based.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@231 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -16,7 +16,9 @@ foreach ($fields AS $field => $config) {
|
||||
if (!isset($config['opts']))
|
||||
$config['opts'] = null;
|
||||
|
||||
if (isset($field_prefix) && !isset($config['no_prefix']))
|
||||
if (isset($config['prefix']) && !isset($config['no_prefix']))
|
||||
$field = $config['prefix'] . '.' . $field;
|
||||
elseif (isset($field_prefix) && !isset($config['no_prefix']))
|
||||
$field = $field_prefix . '.' . $field;
|
||||
|
||||
$config['opts']['label'] = false;
|
||||
|
||||
155
site/views/leases/assess.ctp
Normal file
155
site/views/leases/assess.ctp
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php /* -*- mode:PHP -*- */ ?>
|
||||
|
||||
<div class="assess input">
|
||||
<?php
|
||||
; // Editor alignment
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
$lease_grid_setup = array();
|
||||
|
||||
if (isset($lease['Lease']['id']))
|
||||
$lease_grid_setup['hiddengrid'] = true;
|
||||
|
||||
$lease_grid_setup['onSelectRow'] = array
|
||||
('--special' =>
|
||||
'function(ids) { if (ids != null) { onRowSelect("#"+$(this).attr("id"), ids); } }'
|
||||
);
|
||||
|
||||
$lease_grid_setup['onHeaderClick'] = array
|
||||
('--special' =>
|
||||
'function(gridstate) { onGridState("#"+$(this).attr("id"), gridstate); }'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
// Reset the form
|
||||
function resetForm() {
|
||||
$("#lease-entry-id").val(0);
|
||||
$("#lease-lease").html("INTERNAL ERROR");
|
||||
}
|
||||
|
||||
function onRowSelect(grid_id, lease_id) {
|
||||
// Set the item id that will be returned with the form
|
||||
$("#lease-id").val(lease_id);
|
||||
|
||||
// Get the item name from the grid
|
||||
$("#lease-lease").html('Lease '
|
||||
+ $(grid_id).getCell(lease_id, 'Lease-number')
|
||||
+ ' / Unit '
|
||||
+ $(grid_id).getCell(lease_id, 'Unit-name')
|
||||
);
|
||||
|
||||
// Hide the "no lease" message and show the current lease
|
||||
$("#no-lease").hide();
|
||||
$("#current-lease").show();
|
||||
|
||||
$("#leases-list .HeaderButton").click();
|
||||
}
|
||||
|
||||
function onGridState(grid_id, state) {
|
||||
if (state == 'visible') {
|
||||
$("#no-lease").hide();
|
||||
$("#current-lease").hide();
|
||||
}
|
||||
else {
|
||||
if ($("#lease-id").val() > 0) {
|
||||
$("#current-lease").show();
|
||||
$("#no-lease").hide();
|
||||
} else {
|
||||
$("#current-lease").hide();
|
||||
$("#no-lease").show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
--></script>
|
||||
|
||||
<?php
|
||||
; // align
|
||||
|
||||
echo $this->element('leases',
|
||||
array('grid_div_id' => 'leases-list',
|
||||
'grid_div_class' => 'text-below',
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#leases-list .HeaderButton\').click();'.
|
||||
' return false;">Select Lease</A>'),
|
||||
'grid_setup' => $lease_grid_setup,
|
||||
'nolinks' => true,
|
||||
'limit' => 10,
|
||||
));
|
||||
|
||||
echo ('<H2>' .
|
||||
'<SPAN id="current-lease">Lease: <SPAN id="lease-lease"></SPAN></SPAN>' .
|
||||
'<SPAN id="no-lease">Please select lease</SPAN>' .
|
||||
'</H2>' . "\n");
|
||||
|
||||
|
||||
echo $form->create(null, array('id' => 'assess-form',
|
||||
'url' => array('controller' => 'transactions',
|
||||
'action' => 'postInvoice')));
|
||||
|
||||
echo $form->input("Lease.id",
|
||||
array('id' => 'lease-id',
|
||||
'type' => 'hidden',
|
||||
'value' => 0));
|
||||
|
||||
echo $this->element('form_table',
|
||||
array('class' => "item assess entry",
|
||||
'field_prefix' => 'Transaction',
|
||||
'fields' => array
|
||||
("stamp" => array('opts' => array('id' => 'charge_date',
|
||||
'type' => 'text')),
|
||||
"through_date" => array('opts' => array('id' => 'through_date',
|
||||
'type' => 'text')),
|
||||
"charge_type" => array('prefix' => 'LedgerEntry.0',
|
||||
'opts' =>
|
||||
array('options' =>
|
||||
array('rent' => 'Rent',
|
||||
'late' => 'Late Charge'),
|
||||
'value' => $charge['type'])),
|
||||
"amount" => array('prefix' => 'LedgerEntry.0',
|
||||
'opts' =>
|
||||
array('value' => $charge['amount'])),
|
||||
"comment" => array('opts' => array('size' => 50)),
|
||||
)));
|
||||
|
||||
echo $form->end('Assess Charge');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
$(document).ready(function(){
|
||||
$("#charge_date").datepicker({ constrainInput: true,
|
||||
numberOfMonths: [1, 1],
|
||||
showCurrentAtPos: 0,
|
||||
dateFormat: 'mm/dd/yy' })
|
||||
.datepicker('setDate', '+0');
|
||||
|
||||
$("#through_date").datepicker({ constrainInput: true,
|
||||
numberOfMonths: [1, 1],
|
||||
showCurrentAtPos: 0,
|
||||
dateFormat: 'mm/dd/yy' })
|
||||
;
|
||||
|
||||
resetForm();
|
||||
|
||||
<?php if (isset($lease['Lease']['id'])): ?>
|
||||
$("#lease-id").val(<?php echo $lease['Lease']['id']; ?>);
|
||||
$("#lease-lease").html("<?php echo 'Lease #' . $lease['Lease']['number'] . ' / Unit ' . $lease['Unit']['name']; ?>");
|
||||
$("#current-lease").show();
|
||||
$("#no-lease").hide();
|
||||
<?php else: ?>
|
||||
$("#current-lease").hide();
|
||||
$("#no-lease").hide();
|
||||
<?php endif; ?>
|
||||
});
|
||||
--></script>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user