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@496 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -423,8 +423,8 @@ class CustomersController extends AppController {
|
||||
$this->layout = null;
|
||||
$this->autoLayout = false;
|
||||
$this->autoRender = false;
|
||||
//Configure::write('debug', '0');
|
||||
//header("Content-type: text/xml;charset=utf-8");
|
||||
Configure::write('debug', '0');
|
||||
header("Content-type: text/xml;charset=utf-8");
|
||||
|
||||
App::import('Helper', 'Xml');
|
||||
$xml = new XmlHelper();
|
||||
@@ -432,16 +432,22 @@ class CustomersController extends AppController {
|
||||
// Find the unreconciled entries, then manipulate the structure
|
||||
// slightly to accomodate the format necessary for XML Helper.
|
||||
$unreconciled = $this->Customer->unreconciledCharges($id);
|
||||
|
||||
foreach ($unreconciled['entries'] AS &$entry)
|
||||
$entry = array_intersect_key($entry['StatementEntry'],
|
||||
array('id'=>1));
|
||||
|
||||
$unreconciled = array('entries' =>
|
||||
array_intersect_key($unreconciled['debit'],
|
||||
array('entry'=>1, 'balance'=>1)));
|
||||
array('entry' => $unreconciled['entries'],
|
||||
'balance' => $unreconciled['summary']['balance']));
|
||||
|
||||
// XML Helper will dump an empty tag if the array is empty
|
||||
if (!count($unreconciled['entries']['entry']))
|
||||
if (empty($unreconciled['entries']['entry']))
|
||||
unset($unreconciled['entries']['entry']);
|
||||
|
||||
//pr($unreconciled);
|
||||
//$reconciled = $cust->reconcileNewStatementEntry($cust_id, 'credit', $amount);
|
||||
/* pr(compact('unreconciled')); */
|
||||
/* echo htmlspecialchars($xml->serialize($unreconciled)); */
|
||||
/* $this->render('/fake'); */
|
||||
|
||||
$opts = array();
|
||||
//$opts['format'] = 'tags';
|
||||
|
||||
@@ -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)); */
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user