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:
@@ -109,6 +109,8 @@ function resetForm() {
|
|||||||
|
|
||||||
$("#receipt-customer-id").html("INTERNAL ERROR");
|
$("#receipt-customer-id").html("INTERNAL ERROR");
|
||||||
$("#receipt-customer-name").html("INTERNAL ERROR");
|
$("#receipt-customer-name").html("INTERNAL ERROR");
|
||||||
|
$("#receipt-balance").html("INTERNAL ERROR");
|
||||||
|
$("#receipt-charges-caption").html("Outstanding Charges");
|
||||||
|
|
||||||
addPaymentSource(false);
|
addPaymentSource(false);
|
||||||
datepickerNow('TransactionStamp');
|
datepickerNow('TransactionStamp');
|
||||||
@@ -119,12 +121,23 @@ function onRowSelect(grid_id, customer_id) {
|
|||||||
$("#customer-id").val(customer_id);
|
$("#customer-id").val(customer_id);
|
||||||
|
|
||||||
// Get the item names from the grid
|
// 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-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
|
// Hide the "no customer" message and show the current customer
|
||||||
$("#no-customer").hide();
|
$(".customer-selection-invalid").hide();
|
||||||
$("#current-customer").show();
|
$(".customer-selection-valid").show();
|
||||||
|
|
||||||
// Update the charges grid to reflect this customer
|
// Update the charges grid to reflect this customer
|
||||||
updateCharges(customer_id);
|
updateCharges(customer_id);
|
||||||
@@ -135,16 +148,16 @@ function onRowSelect(grid_id, customer_id) {
|
|||||||
|
|
||||||
function onGridState(grid_id, state) {
|
function onGridState(grid_id, state) {
|
||||||
if (state == 'visible') {
|
if (state == 'visible') {
|
||||||
$("#no-customer").hide();
|
$(".customer-selection-invalid").hide();
|
||||||
$("#current-customer").hide();
|
$(".customer-selection-valid").hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($("#customer-id").val() > 0) {
|
if ($("#customer-id").val() > 0) {
|
||||||
$("#current-customer").show();
|
$(".customer-selection-valid").show();
|
||||||
$("#no-customer").hide();
|
$(".customer-selection-invalid").hide();
|
||||||
} else {
|
} else {
|
||||||
$("#current-customer").hide();
|
$(".customer-selection-valid").hide();
|
||||||
$("#no-customer").show();
|
$(".customer-selection-invalid").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,15 +293,7 @@ function switchPaymentType(paymentid, type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateChargesCaption(customer_name, balance) {
|
function updateChargesGrid(idlist) {
|
||||||
$('#charge-entries-jqGrid').setCaption('Outstanding Charges for ' +
|
|
||||||
customer_name + ': ' +
|
|
||||||
fmtCurrency(balance));
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateChargesGrid(idlist, balance) {
|
|
||||||
updateChargesCaption($("#payment_customer").html(), balance);
|
|
||||||
|
|
||||||
$('#charge-entries-jqGrid').setPostDataItem('idlist', serialize(idlist));
|
$('#charge-entries-jqGrid').setPostDataItem('idlist', serialize(idlist));
|
||||||
$('#charge-entries-jqGrid')
|
$('#charge-entries-jqGrid')
|
||||||
.setGridParam({ page: 1 })
|
.setGridParam({ page: 1 })
|
||||||
@@ -300,18 +305,22 @@ function updateCharges(id) {
|
|||||||
"action" => "unreconciled"))); ?>';
|
"action" => "unreconciled"))); ?>';
|
||||||
url += '/'+id;
|
url += '/'+id;
|
||||||
|
|
||||||
|
$('#charge-entries-jqGrid').clearGridData();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "xml",
|
dataType: "xml",
|
||||||
success: function(xml) {
|
success: function(xml) {
|
||||||
var ids = new Array();
|
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){
|
$('entry',xml).each(function(i){
|
||||||
ids.push($(this).attr('id'));
|
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,
|
'limit' => 10,
|
||||||
)));
|
)));
|
||||||
|
|
||||||
echo ('<H2>' .
|
echo ('<DIV CLASS="receipt grid-selection-text">' .
|
||||||
'<SPAN id="current-customer" style="display:none">' .
|
|
||||||
|
'<DIV CLASS="customer-selection-valid" style="display:none">' .
|
||||||
'Customer <SPAN id="receipt-customer-id"></SPAN>' .
|
'Customer <SPAN id="receipt-customer-id"></SPAN>' .
|
||||||
': <SPAN id="receipt-customer-name"></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' .
|
'Please select customer' .
|
||||||
'</SPAN>' .
|
'</DIV>' .
|
||||||
'</H2>' . "\n");
|
|
||||||
|
'</DIV>' . "\n");
|
||||||
|
|
||||||
|
|
||||||
echo $this->element('ledger_entries', array
|
echo $this->element('ledger_entries', array
|
||||||
(// Element configuration
|
(// Element configuration
|
||||||
@@ -353,11 +373,25 @@ echo $this->element('ledger_entries', array
|
|||||||
'config' => array
|
'config' => array
|
||||||
(
|
(
|
||||||
'grid_div_id' => 'charge-entries',
|
'grid_div_id' => 'charge-entries',
|
||||||
'caption' => 'Outstanding Charges',
|
'grid_div_class' => 'text-below',
|
||||||
|
'caption' => '<SPAN id="receipt-charges-caption"></SPAN>',
|
||||||
'rows' => $charges['entry'],
|
'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',
|
echo $form->create(null, array('id' => 'receipt-form',
|
||||||
'url' => array('controller' => 'transactions',
|
'url' => array('controller' => 'transactions',
|
||||||
'action' => 'postReceipt')));
|
'action' => 'postReceipt')));
|
||||||
@@ -413,11 +447,14 @@ echo $form->submit('Generate Receipt') . "\n";
|
|||||||
|
|
||||||
<?php if (isset($customer['id'])): ?>
|
<?php if (isset($customer['id'])): ?>
|
||||||
$("#customer-id").val(<?php echo $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']; ?>");
|
$("#receipt-customer-name").html("<?php echo $customer['name']; ?>");
|
||||||
updateChargesCaption("<?php echo $customer['name']; ?>",
|
$("#receipt-balance").html(fmtCurrency("<?php echo $charges['balance']; ?>"));
|
||||||
<?php echo $charges['balance']; ?>
|
|
||||||
);
|
|
||||||
onGridState(null, 'hidden');
|
onGridState(null, 'hidden');
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
onGridState(null, 'visible');
|
onGridState(null, 'visible');
|
||||||
|
|||||||
@@ -115,7 +115,16 @@ function onRowSelect(grid_id, lease_id) {
|
|||||||
$("#lease-id").val(lease_id);
|
$("#lease-id").val(lease_id);
|
||||||
|
|
||||||
// Get the item names from the grid
|
// 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-unit").html($(grid_id).getCell(lease_id, 'Unit-name'));
|
||||||
$("#invoice-customer").html($(grid_id).getCell(lease_id, 'Customer-name'));
|
$("#invoice-customer").html($(grid_id).getCell(lease_id, 'Customer-name'));
|
||||||
$("#invoice-rent").html($(grid_id).getCell(lease_id, 'Lease-rent'));
|
$("#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
|
// Hide the "no lease" message and show the current lease
|
||||||
$("#no-lease").hide();
|
$(".lease-selection-invalid").hide();
|
||||||
$("#current-lease").show();
|
$(".lease-selection-valid").show();
|
||||||
|
|
||||||
// Collapse the grid now that the user has selected
|
// Collapse the grid now that the user has selected
|
||||||
$("#leases-list .HeaderButton").click();
|
$("#leases-list .HeaderButton").click();
|
||||||
@@ -134,16 +143,16 @@ function onRowSelect(grid_id, lease_id) {
|
|||||||
|
|
||||||
function onGridState(grid_id, state) {
|
function onGridState(grid_id, state) {
|
||||||
if (state == 'visible') {
|
if (state == 'visible') {
|
||||||
$("#no-lease").hide();
|
$(".lease-selection-invalid").hide();
|
||||||
$("#current-lease").hide();
|
$(".lease-selection-valid").hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($("#lease-id").val() > 0) {
|
if ($("#lease-id").val() > 0) {
|
||||||
$("#current-lease").show();
|
$(".lease-selection-valid").show();
|
||||||
$("#no-lease").hide();
|
$(".lease-selection-invalid").hide();
|
||||||
} else {
|
} else {
|
||||||
$("#current-lease").hide();
|
$(".lease-selection-valid").hide();
|
||||||
$("#no-lease").show();
|
$(".lease-selection-invalid").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,47 +225,28 @@ echo $this->element('leases', array
|
|||||||
'limit' => 10,
|
'limit' => 10,
|
||||||
)));
|
)));
|
||||||
|
|
||||||
echo ('<SPAN id="current-lease" style="display:none">' .
|
echo ('<DIV CLASS="invoice grid-selection-text">' .
|
||||||
'<DIV>' .
|
|
||||||
'<H2>' .
|
'<DIV CLASS="lease-selection-valid" style="display:none">' .
|
||||||
'Lease <SPAN id="invoice-lease"></SPAN>' . ' / ' .
|
'Lease <SPAN id="invoice-lease"></SPAN>' . ' / ' .
|
||||||
'Unit: <SPAN id="invoice-unit"></SPAN>' . ' / ' .
|
'Unit: <SPAN id="invoice-unit"></SPAN>' . ' / ' .
|
||||||
'Customer: <SPAN id="invoice-customer"></SPAN>' .
|
'Customer: <SPAN id="invoice-customer"></SPAN>' .
|
||||||
'</H2>' .
|
|
||||||
'</DIV>' .
|
|
||||||
'<DIV>' .
|
|
||||||
|
|
||||||
/* '<H3>' . */
|
'<DIV CLASS="supporting">' .
|
||||||
/* 'Rent: <SPAN id="invoice-rent"></SPAN>' . */
|
'<TABLE>' .
|
||||||
/* '<BR>' . */
|
'<TR><TD CLASS="field">Rent:</TD><TD CLASS="value"><SPAN id="invoice-rent"></SPAN></TD></TR>' .
|
||||||
/* 'Late Fee: <SPAN id="invoice-late"></SPAN>' . */
|
'<TR><TD CLASS="field">Late Fee:</TD><TD CLASS="value"><SPAN id="invoice-late"></SPAN></TD></TR>' .
|
||||||
/* '<BR>' . */
|
'<TR><TD CLASS="field">Deposit:</TD><TD CLASS="value"><SPAN id="invoice-deposit"></SPAN></TD></TR>' .
|
||||||
/* '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>' .
|
|
||||||
'</TABLE>' .
|
'</TABLE>' .
|
||||||
'</H3>' .
|
'</DIV>' .
|
||||||
'<BR />' .
|
|
||||||
|
|
||||||
'</DIV>' .
|
'</DIV>' .
|
||||||
'</SPAN>' .
|
|
||||||
'<SPAN id="no-lease" style="display:none">' .
|
'<DIV CLASS="lease-selection-invalid" style="display:none">' .
|
||||||
'<H2>' .
|
|
||||||
'Please select lease' .
|
'Please select lease' .
|
||||||
'</H2>' .
|
'</DIV>' .
|
||||||
'</SPAN>' .
|
|
||||||
"\n");
|
'</DIV>' . "\n");
|
||||||
|
|
||||||
echo $form->create(null, array('id' => 'invoice-form',
|
echo $form->create(null, array('id' => 'invoice-form',
|
||||||
'url' => array('controller' => 'transactions',
|
'url' => array('controller' => 'transactions',
|
||||||
@@ -316,7 +306,12 @@ echo $form->submit('Generate Invoice') . "\n";
|
|||||||
|
|
||||||
<?php if (isset($lease['Lease']['id'])): ?>
|
<?php if (isset($lease['Lease']['id'])): ?>
|
||||||
$("#lease-id").val(<?php echo $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-unit").html("<?php echo $lease['Unit']['name']; ?>");
|
||||||
$("#invoice-customer").html("<?php echo $lease['Customer']['name']; ?>");
|
$("#invoice-customer").html("<?php echo $lease['Customer']['name']; ?>");
|
||||||
$("#invoice-rent").html("<?php echo FormatHelper::currency($lease['Lease']['rent']); ?>");
|
$("#invoice-rent").html("<?php echo FormatHelper::currency($lease['Lease']['rent']); ?>");
|
||||||
|
|||||||
@@ -203,6 +203,21 @@ div.loading {
|
|||||||
margin-left: 1.0em;
|
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
|
* Forms
|
||||||
|
|||||||
Reference in New Issue
Block a user