Made layout changes to invoices and receipts to use CSS instead of simple H2/H3 tags. Also, as a temporary measure, I make the lease/customer numbers hyperlink to the view page. At some point we'll figure out what should happen after entering a receipt or invoice, and this hack should go away.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@270 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-09 00:00:29 +00:00
parent c01c67161e
commit 849077bb9a
3 changed files with 122 additions and 75 deletions

View File

@@ -109,6 +109,8 @@ function resetForm() {
$("#receipt-customer-id").html("INTERNAL ERROR");
$("#receipt-customer-name").html("INTERNAL ERROR");
$("#receipt-balance").html("INTERNAL ERROR");
$("#receipt-charges-caption").html("Outstanding Charges");
addPaymentSource(false);
datepickerNow('TransactionStamp');
@@ -119,12 +121,23 @@ function onRowSelect(grid_id, customer_id) {
$("#customer-id").val(customer_id);
// Get the item names from the grid
$("#receipt-customer-id").html($(grid_id).getCell(customer_id, 'Customer-id'));
//$("#receipt-customer-id").html($(grid_id).getCell(customer_id, 'Customer-id'));
// REVISIT <AP>: 20090708
// This is not intended as a long term solution,
// but I need a way to enter data and then view
// the results. This link will help.
$("#receipt-customer-id").html('<A HREF="/pmgr/site/customers/view/' +
$(grid_id).getCell(customer_id, 'Customer-id').replace(/^#/,'') +
'">' +
$(grid_id).getCell(customer_id, 'Customer-id') +
'</A>');
$("#receipt-customer-name").html($(grid_id).getCell(customer_id, 'Customer-name'));
$("#receipt-balance").html("Calculating...");
$("#receipt-charges-caption").html("Please Wait...");
// Hide the "no customer" message and show the current customer
$("#no-customer").hide();
$("#current-customer").show();
$(".customer-selection-invalid").hide();
$(".customer-selection-valid").show();
// Update the charges grid to reflect this customer
updateCharges(customer_id);
@@ -135,16 +148,16 @@ function onRowSelect(grid_id, customer_id) {
function onGridState(grid_id, state) {
if (state == 'visible') {
$("#no-customer").hide();
$("#current-customer").hide();
$(".customer-selection-invalid").hide();
$(".customer-selection-valid").hide();
}
else {
if ($("#customer-id").val() > 0) {
$("#current-customer").show();
$("#no-customer").hide();
$(".customer-selection-valid").show();
$(".customer-selection-invalid").hide();
} else {
$("#current-customer").hide();
$("#no-customer").show();
$(".customer-selection-valid").hide();
$(".customer-selection-invalid").show();
}
}
}
@@ -280,15 +293,7 @@ function switchPaymentType(paymentid, type) {
}
function updateChargesCaption(customer_name, balance) {
$('#charge-entries-jqGrid').setCaption('Outstanding Charges for ' +
customer_name + ': ' +
fmtCurrency(balance));
}
function updateChargesGrid(idlist, balance) {
updateChargesCaption($("#payment_customer").html(), balance);
function updateChargesGrid(idlist) {
$('#charge-entries-jqGrid').setPostDataItem('idlist', serialize(idlist));
$('#charge-entries-jqGrid')
.setGridParam({ page: 1 })
@@ -300,18 +305,22 @@ function updateCharges(id) {
"action" => "unreconciled"))); ?>';
url += '/'+id;
$('#charge-entries-jqGrid').clearGridData();
$.ajax({
type: "GET",
url: url,
dataType: "xml",
success: function(xml) {
var ids = new Array();
$('#update-target ol').html('<A HREF="'+url+'">Data URL</A>');
//$('#update-target ol').html('<A HREF="'+url+'">Data URL</A>');
$('entry',xml).each(function(i){
ids.push($(this).attr('id'));
$('#update-target').append("Push: len=" + ids.length + '<BR>');
//$('#update-target').append("Push: len=" + ids.length + '<BR>');
});
updateChargesGrid(ids, $('entries',xml).attr('balance'));
$('#receipt-balance').html(fmtCurrency($('entries',xml).attr('balance')));
$("#receipt-charges-caption").html("Outstanding Charges");
updateChargesGrid(ids);
}
});
}
@@ -334,15 +343,26 @@ echo $this->element('customers', array
'limit' => 10,
)));
echo ('<H2>' .
'<SPAN id="current-customer" style="display:none">' .
echo ('<DIV CLASS="receipt grid-selection-text">' .
'<DIV CLASS="customer-selection-valid" style="display:none">' .
'Customer <SPAN id="receipt-customer-id"></SPAN>' .
': <SPAN id="receipt-customer-name"></SPAN>' .
'</SPAN>' .
'<SPAN id="no-customer" style="display:none">' .
/* '<DIV CLASS="supporting">' . */
/* '<TABLE>' . */
/* '<TR><TD CLASS="field">Balance:</TD><TD CLASS="value"><SPAN id="receipt-balance"></SPAN></TD></TR>' . */
/* '</TABLE>' . */
/* '</DIV>' . */
'</DIV>' . // END customer-selection-valid
'<DIV CLASS="customer-selection-invalid" style="display:none">' .
'Please select customer' .
'</SPAN>' .
'</H2>' . "\n");
'</DIV>' .
'</DIV>' . "\n");
echo $this->element('ledger_entries', array
(// Element configuration
@@ -353,11 +373,25 @@ echo $this->element('ledger_entries', array
'config' => array
(
'grid_div_id' => 'charge-entries',
'caption' => 'Outstanding Charges',
'grid_div_class' => 'text-below',
'caption' => '<SPAN id="receipt-charges-caption"></SPAN>',
'rows' => $charges['entry'],
),
));
echo('<DIV CLASS="receipt grid-selection-text">' .
'<DIV CLASS="customer-selection-valid" style="display:none">' .
//'<DIV CLASS="supporting">' .
'<TABLE>' .
'<TR><TD CLASS="field">Balance:</TD><TD CLASS="value"><SPAN id="receipt-balance"></SPAN></TD></TR>' .
'</TABLE>' .
//'</DIV>' .
'</DIV>' . // END customer-selection-valid
'</DIV>' .
"\n");
echo $form->create(null, array('id' => 'receipt-form',
'url' => array('controller' => 'transactions',
'action' => 'postReceipt')));
@@ -413,11 +447,14 @@ echo $form->submit('Generate Receipt') . "\n";
<?php if (isset($customer['id'])): ?>
$("#customer-id").val(<?php echo $customer['id']; ?>);
$("#receipt-customer-id").html("<?php echo '#'.$customer['id']; ?>");
//$("#receipt-customer-id").html("<?php echo '#'.$customer['id']; ?>");
$("#receipt-customer-id").html('<A HREF="/pmgr/site/customers/view/' +
"<?php echo $customer['id']; ?>" +
'">#' +
"<?php echo $customer['id']; ?>" +
'</A>');
$("#receipt-customer-name").html("<?php echo $customer['name']; ?>");
updateChargesCaption("<?php echo $customer['name']; ?>",
<?php echo $charges['balance']; ?>
);
$("#receipt-balance").html(fmtCurrency("<?php echo $charges['balance']; ?>"));
onGridState(null, 'hidden');
<?php else: ?>
onGridState(null, 'visible');

View File

@@ -115,7 +115,16 @@ function onRowSelect(grid_id, lease_id) {
$("#lease-id").val(lease_id);
// Get the item names from the grid
$("#invoice-lease").html($(grid_id).getCell(lease_id, 'Lease-number'));
//$("#invoice-lease").html($(grid_id).getCell(lease_id, 'Lease-number'));
// REVISIT <AP>: 20090708
// This is not intended as a long term solution,
// but I need a way to enter data and then view
// the results. This link will help.
$("#invoice-lease").html('<A HREF="/pmgr/site/leases/view/' +
$(grid_id).getCell(lease_id, 'Lease-id').replace(/^#/,'') +
'">' +
$(grid_id).getCell(lease_id, 'Lease-number') +
'</A>');
$("#invoice-unit").html($(grid_id).getCell(lease_id, 'Unit-name'));
$("#invoice-customer").html($(grid_id).getCell(lease_id, 'Customer-name'));
$("#invoice-rent").html($(grid_id).getCell(lease_id, 'Lease-rent'));
@@ -125,8 +134,8 @@ function onRowSelect(grid_id, lease_id) {
: '-');
// Hide the "no lease" message and show the current lease
$("#no-lease").hide();
$("#current-lease").show();
$(".lease-selection-invalid").hide();
$(".lease-selection-valid").show();
// Collapse the grid now that the user has selected
$("#leases-list .HeaderButton").click();
@@ -134,16 +143,16 @@ function onRowSelect(grid_id, lease_id) {
function onGridState(grid_id, state) {
if (state == 'visible') {
$("#no-lease").hide();
$("#current-lease").hide();
$(".lease-selection-invalid").hide();
$(".lease-selection-valid").hide();
}
else {
if ($("#lease-id").val() > 0) {
$("#current-lease").show();
$("#no-lease").hide();
$(".lease-selection-valid").show();
$(".lease-selection-invalid").hide();
} else {
$("#current-lease").hide();
$("#no-lease").show();
$(".lease-selection-valid").hide();
$(".lease-selection-invalid").show();
}
}
}
@@ -216,47 +225,28 @@ echo $this->element('leases', array
'limit' => 10,
)));
echo ('<SPAN id="current-lease" style="display:none">' .
'<DIV>' .
'<H2>' .
echo ('<DIV CLASS="invoice grid-selection-text">' .
'<DIV CLASS="lease-selection-valid" style="display:none">' .
'Lease <SPAN id="invoice-lease"></SPAN>' . ' / ' .
'Unit: <SPAN id="invoice-unit"></SPAN>' . ' / ' .
'Customer: <SPAN id="invoice-customer"></SPAN>' .
'</H2>' .
'</DIV>' .
'<DIV>' .
/* '<H3>' . */
/* 'Rent: <SPAN id="invoice-rent"></SPAN>' . */
/* '<BR>' . */
/* 'Late Fee: <SPAN id="invoice-late"></SPAN>' . */
/* '<BR>' . */
/* 'Deposit: <SPAN id="invoice-deposit"></SPAN>' . */
/* '</H3>' . */
/* '<H3>' . */
/* 'Rent: <SPAN id="invoice-rent"></SPAN>' . ' / ' . */
/* 'Late Fee: <SPAN id="invoice-late"></SPAN>' . ' / ' . */
/* 'Deposit: <SPAN id="invoice-deposit"></SPAN>' . */
/* '</H3>' . */
'<H3>' .
'<TABLE BORDER=0>' .
'<TR><TD style="width:5em;">Rent:</TD><TD><SPAN id="invoice-rent"></SPAN></TD></TR>' .
'<TR><TD>Late Fee:</TD><TD><SPAN id="invoice-late"></SPAN></TD></TR>' .
'<TR><TD>Deposit:</TD><TD><SPAN id="invoice-deposit"></SPAN></TD></TR>' .
'<DIV CLASS="supporting">' .
'<TABLE>' .
'<TR><TD CLASS="field">Rent:</TD><TD CLASS="value"><SPAN id="invoice-rent"></SPAN></TD></TR>' .
'<TR><TD CLASS="field">Late Fee:</TD><TD CLASS="value"><SPAN id="invoice-late"></SPAN></TD></TR>' .
'<TR><TD CLASS="field">Deposit:</TD><TD CLASS="value"><SPAN id="invoice-deposit"></SPAN></TD></TR>' .
'</TABLE>' .
'</H3>' .
'<BR />' .
'</DIV>' .
'</DIV>' .
'</SPAN>' .
'<SPAN id="no-lease" style="display:none">' .
'<H2>' .
'<DIV CLASS="lease-selection-invalid" style="display:none">' .
'Please select lease' .
'</H2>' .
'</SPAN>' .
"\n");
'</DIV>' .
'</DIV>' . "\n");
echo $form->create(null, array('id' => 'invoice-form',
'url' => array('controller' => 'transactions',
@@ -316,7 +306,12 @@ echo $form->submit('Generate Invoice') . "\n";
<?php if (isset($lease['Lease']['id'])): ?>
$("#lease-id").val(<?php echo $lease['Lease']['id']; ?>);
$("#invoice-lease").html("<?php echo '#'.$lease['Lease']['number']; ?>");
//$("#invoice-lease").html("<?php echo '#'.$lease['Lease']['number']; ?>");
$("#invoice-lease").html('<A HREF="/pmgr/site/leases/view/' +
"<?php echo $lease['Lease']['id']; ?>" +
'">#' +
"<?php echo $lease['Lease']['number']; ?>" +
'</A>');
$("#invoice-unit").html("<?php echo $lease['Unit']['name']; ?>");
$("#invoice-customer").html("<?php echo $lease['Customer']['name']; ?>");
$("#invoice-rent").html("<?php echo FormatHelper::currency($lease['Lease']['rent']); ?>");

View File

@@ -203,6 +203,21 @@ div.loading {
margin-left: 1.0em;
}
/************************************************************
************************************************************
* Grid Dynamic Selection Text
*/
.grid-selection-text { font-size: 150%;
margin-top: 0.4em;
margin-bottom: 1em; }
.grid-selection-text .supporting { font-size: 80%; }
.grid-selection-text .supporting table { border: none; }
.grid-selection-text .supporting table td.field { width : 5em; }
/************************************************************
************************************************************
* Forms