From 849077bb9aec4574953bbd94aa7472302e2d7dac Mon Sep 17 00:00:00 2001 From: abijah Date: Thu, 9 Jul 2009 00:00:29 +0000 Subject: [PATCH] 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 --- views/customers/receipt.ctp | 101 ++++++++++++++++++++++++------------ views/leases/invoice.ctp | 81 ++++++++++++++--------------- webroot/css/layout.css | 15 ++++++ 3 files changed, 122 insertions(+), 75 deletions(-) diff --git a/views/customers/receipt.ctp b/views/customers/receipt.ctp index 111d48b..52e8619 100644 --- a/views/customers/receipt.ctp +++ b/views/customers/receipt.ctp @@ -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 : 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('' + + $(grid_id).getCell(customer_id, 'Customer-id') + + ''); $("#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('Data URL'); + //$('#update-target ol').html('Data URL'); $('entry',xml).each(function(i){ ids.push($(this).attr('id')); - $('#update-target').append("Push: len=" + ids.length + '
'); + //$('#update-target').append("Push: len=" + ids.length + '
'); }); - 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 ('

' . - '

' . "\n"); + '' . + + '' . "\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' => '', 'rows' => $charges['entry'], ), )); +echo('
' . + '' . // END customer-selection-valid + '
' . + "\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"; $("#customer-id").val(); - $("#receipt-customer-id").html(""); + //$("#receipt-customer-id").html(""); + $("#receipt-customer-id").html('" + + '">#' + + "" + + ''); $("#receipt-customer-name").html(""); - updateChargesCaption("", - - ); + $("#receipt-balance").html(fmtCurrency("")); onGridState(null, 'hidden'); onGridState(null, 'visible'); diff --git a/views/leases/invoice.ctp b/views/leases/invoice.ctp index ad17174..76359f4 100644 --- a/views/leases/invoice.ctp +++ b/views/leases/invoice.ctp @@ -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 : 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('' + + $(grid_id).getCell(lease_id, 'Lease-number') + + ''); $("#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 ('' . - '' . - "\n"); + '' . + + '' . "\n"); echo $form->create(null, array('id' => 'invoice-form', 'url' => array('controller' => 'transactions', @@ -316,7 +306,12 @@ echo $form->submit('Generate Invoice') . "\n"; $("#lease-id").val(); - $("#invoice-lease").html(""); + //$("#invoice-lease").html(""); + $("#invoice-lease").html('" + + '">#' + + "" + + ''); $("#invoice-unit").html(""); $("#invoice-customer").html(""); $("#invoice-rent").html(""); diff --git a/webroot/css/layout.css b/webroot/css/layout.css index 23f5fa2..66d861a 100644 --- a/webroot/css/layout.css +++ b/webroot/css/layout.css @@ -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