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@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-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');
|
||||
|
||||
Reference in New Issue
Block a user