Fixed the customer selection update for receipts, and added a mechanism to automatically update the oustanding charges grid after entering the receipt.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@496 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-06 18:08:21 +00:00
parent b900e49f54
commit a2aa612a5e
2 changed files with 28 additions and 11 deletions

View File

@@ -70,6 +70,8 @@ function showResponse(responseText, statusText) {
if (statusText == 'success') {
// get a clean slate
//resetForm();
// REVISIT <AP>: 20090806 Add to resetForm()
updateCharges($("#customer-id").val());
}
else {
alert('not successful??');
@@ -109,8 +111,6 @@ function onRowSelect(grid_id, customer_id) {
$(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
$(".customer-selection-invalid").hide();
@@ -227,7 +227,10 @@ function switchPaymentType(paymentid_base, paymentid, radioid) {
function updateChargesGrid(idlist) {
$('#charge-entries-jqGrid').setPostDataItem('idlist', serialize(idlist));
var dynamic_post = new Array();
dynamic_post['idlist'] = idlist;
$('#charge-entries-jqGrid').setPostDataItem('dynamic_post_replace', serialize(dynamic_post));
$('#charge-entries-jqGrid')
.setGridParam({ page: 1 })
.trigger("reloadGrid");
@@ -239,6 +242,8 @@ function updateCharges(id) {
url += '/'+id;
$('#charge-entries-jqGrid').clearGridData();
$("#receipt-balance").html("Calculating...");
$("#receipt-charges-caption").html("Please Wait...");
$.ajax({
type: "GET",
@@ -252,7 +257,13 @@ function updateCharges(id) {
$('#receipt-balance').html(fmtCurrency($('entries',xml).attr('balance')));
$("#receipt-charges-caption").html("Outstanding Charges");
updateChargesGrid(ids);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
/* alert('ERROR'); */
/* $('#debug').html('<P>request<BR>'+escape(XMLHttpRequest)); */
/* $('#debug').append('<P>status<BR>'+escape(textStatus)); */
/* $('#debug').append('<P>error<BR>'+escape(errorThrown)); */
}
});
}