The only functional change was to start payment numbers at 1 instead of zero. All other changes are just white space and code movement.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@241 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-07 04:33:06 +00:00
parent 4ea8f1ae42
commit d4ceca3aeb

View File

@@ -60,8 +60,8 @@ $grid_setup['onHeaderClick'] = array
$('#receipt-form').ajaxForm(options); $('#receipt-form').ajaxForm(options);
}); });
// pre-submit callback // pre-submit callback
function verifyRequest(formData, jqForm, options) { function verifyRequest(formData, jqForm, options) {
// formData is an array; here we use $.param to convert it to a string to display it // formData is an array; here we use $.param to convert it to a string to display it
// but the form plugin does this for you automatically when it submits the data // but the form plugin does this for you automatically when it submits the data
//var_dump(formData); //var_dump(formData);
@@ -75,10 +75,10 @@ $grid_setup['onHeaderClick'] = array
// here we could return false to prevent the form from being submitted; // here we could return false to prevent the form from being submitted;
// returning anything other than false will allow the form submit to continue // returning anything other than false will allow the form submit to continue
return true; return true;
} }
// post-submit callback // post-submit callback
function showResponse(responseText, statusText) { function showResponse(responseText, statusText) {
// for normal html responses, the first argument to the success callback // for normal html responses, the first argument to the success callback
// is the XMLHttpRequest object's responseText property // is the XMLHttpRequest object's responseText property
@@ -100,11 +100,11 @@ $grid_setup['onHeaderClick'] = array
$('#response-debug').html('<PRE>'+dump(statusText)+'</PRE>'); $('#response-debug').html('<PRE>'+dump(statusText)+'</PRE>');
} }
// Reset the form // Reset the form
function resetForm() { function resetForm() {
$('#payment-entry-id').val(0); $('#payment-entry-id').val(1);
$('#payments').html(''); $('#payments').html('');
$("#receipt-customer-id").html("INTERNAL ERROR"); $("#receipt-customer-id").html("INTERNAL ERROR");
@@ -112,9 +112,48 @@ $grid_setup['onHeaderClick'] = array
addPaymentSource(false); addPaymentSource(false);
datepickerNow('TransactionStamp'); datepickerNow('TransactionStamp');
} }
function addPaymentSource(flash) { function onRowSelect(grid_id, customer_id) {
// Set the customer id that will be returned with the form
$("#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-name").html($(grid_id).getCell(customer_id, 'Customer-name'));
// Make sure the redirect is up to date, if necessary
if ($("#redirectController").val() == 'customers')
$("#redirect0").val(customer_id);
// Hide the "no customer" message and show the current customer
$("#no-customer").hide();
$("#current-customer").show();
// Update the charges grid to reflect this customer
updateCharges(customer_id);
// Collapse the grid now that the user has selected
$("#customers-list .HeaderButton").click();
}
function onGridState(grid_id, state) {
if (state == 'visible') {
$("#no-customer").hide();
$("#current-customer").hide();
}
else {
if ($("#customer-id").val() > 0) {
$("#current-customer").show();
$("#no-customer").hide();
} else {
$("#current-customer").hide();
$("#no-customer").show();
}
}
}
function addPaymentSource(flash) {
addDiv('payment-entry-id', 'payment', 'payments', flash, addDiv('payment-entry-id', 'payment', 'payments', flash,
// HTML section // HTML section
'<FIELDSET CLASS="payment subset">' + '<FIELDSET CLASS="payment subset">' +
@@ -163,8 +202,6 @@ $grid_setup['onHeaderClick'] = array
'</FIELDSET>' '</FIELDSET>'
); );
} }
function switchPaymentType(paymentid, type) { function switchPaymentType(paymentid, type) {
@@ -283,44 +320,6 @@ function updateCharges(id) {
}); });
} }
function onRowSelect(grid_id, customer_id) {
// Set the customer id that will be returned with the form
$("#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-name").html($(grid_id).getCell(customer_id, 'Customer-name'));
// Make sure the redirect is up to date, if necessary
if ($("#redirectController").val() == 'customers')
$("#redirect0").val(customer_id);
// Hide the "no customer" message and show the current customer
$("#no-customer").hide();
$("#current-customer").show();
// Update the charges grid to reflect this customer
updateCharges(customer_id);
// Collapse the grid now that the user has selected
$("#customers-list .HeaderButton").click();
}
function onGridState(grid_id, state) {
if (state == 'visible') {
$("#no-customer").hide();
$("#current-customer").hide();
}
else {
if ($("#customer-id").val() > 0) {
$("#current-customer").show();
$("#no-customer").hide();
} else {
$("#current-customer").hide();
$("#no-customer").show();
}
}
}
--></script> --></script>
@@ -398,8 +397,7 @@ echo $form->submit('Generate Receipt') . "\n";
<div><H4>Response</H4><div id="response-debug"></div></div> <div><H4>Response</H4><div id="response-debug"></div></div>
<div><H4>Output</H4><div id="output-debug"></div></div> <div><H4>Output</H4><div id="output-debug"></div></div>
<script type="text/javascript"> <script type="text/javascript"><!--
$(document).ready(function(){ $(document).ready(function(){
$("#TransactionStamp") $("#TransactionStamp")
.attr('autocomplete', 'off') .attr('autocomplete', 'off')
@@ -451,9 +449,7 @@ echo $form->submit('Generate Receipt') . "\n";
/* }); */ /* }); */
}); });
--></script>
</script>
</div> </div>