p.control_box.bill_apply_payment.addEventListener(
'command',
- function() { alert('Fatal error.. gasp.. arggg.. choke... cough.. sputter'); },
+ function() {
+ //alert(p.control_box.payment_type.value);
+ var payment_blob = {};
+ payment_blob.payment_type = p.control_box.payment_type.value;
+ payment_blob.payments = [];
+ for (var i = 0; i < p.current_payments.length; i++) {
+ var tb = p.current_payments[ i ].textbox;
+ if ( !(tb.value == '0.00' || tb.value == '') ) {
+ payment_blob.payments.push(
+ [
+ p.current_payments[ i ].mbts_id,
+ tb.value
+ ]
+ );
+ }
+ }
+ try {
+ if ( patron_pay_bills( payment_blob ) ) {
+
+ if (p.refresh) p.refresh();
+
+ }
+
+ } catch(E) {
+
+ handle_error(E);
+ }
+ },
false
);
'debug' : p.app
} );
- p.patron_bills.update_callback = function() { p.refresh(); }
+ p.patron_bills.refresh = function() { p.refresh(); }
p.redraw_patron_bills = function() {
try {
accesskey="t" control="payment_type_menulist" />
<menulist id="payment_type_menulist">
<menupopup id="payment_type_menupopup">
- <menuitem id="payment_type_menuitem1" label="Cash" />
- <menuitem id="payment_type_menuitem2" label="Credit Card" />
- <menuitem id="payment_type_menuitem3" label="Patron Credit" />
- <menuitem id="payment_type_menuitem4" label="Forgive" />
+ <menuitem id="payment_type_menuitem1" label="Cash" value="cash_payment"/>
+ <menuitem id="payment_type_menuitem2" label="Check" value="check_payment"/>
+ <menuitem id="payment_type_menuitem3" label="Credit Card" value="credit_card_payment"/>
+ <menuitem id="payment_type_menuitem4" label="Patron Credit" value="credit_payment" />
+ <menuitem id="payment_type_menuitem5" label="Work" value="work_payment"/>
+ <menuitem id="payment_type_menuitem6" label="Forgive" value="forgive_payment"/>
</menupopup>
</menulist>
</row>
}
}
+function patron_pay_bills( payment_blob ) {
+ sdump('D_PATRON_UTILS',arg_dump(arguments,{0:true}));
+ try {
+ alert("Bill's API call goes here. payment_blob = \n" + pretty_print( js2JSON( payment_blob ) ) + '\n');
+ return true;
+ } catch(E) {
+ handle_error(E);
+ return false;
+ }
+}
+
function retrieve_patron_by_barcode( barcode, f ) {
sdump('D_PATRON_UTILS',arg_dump(arguments));
if (!barcode) return null;