p.checkin_items = checkin_items_init( { 'w' : p.w, 'node' : p.checkin_items_node, 'debug' : p.app } );
var checkins = [];
+
+ var backdate_tb = p.checkin_items_node.getElementsByAttribute('id','checkin_effective_date_textbox')[0];
+ backdate_tb.value = formatted_date( new Date(), '%Y-%m-%d');
+ backdate_tb.addEventListener(
+ 'change',
+ function () {
+ var flag = false;
+ var darray = backdate_tb.value.split('-');
+ var year = darray[0]; if ( (!year) || (year.length != 4) || (!parseInt(year)) ) flag = true;
+ var month = darray[1]; if ( (!month) || (month.length !=2) || (!parseInt(month)) ) flag = true;
+ var day = darray[2]; if ( (!day) || (day.length !=2) || (!parseInt(day)) ) flag = true;
+ if (flag) {
+ snd_bad();
+ backdate_tb.value = formatted_date( new Date(), '%Y-%m-%d');
+ }
+ },
+ false
+ );
+
var tb = p.checkin_items_node.getElementsByAttribute('id','checkin_barcode_entry_textbox')[0];
var submit_button = p.checkin_items_node.getElementsByAttribute('id','checkin_submit_barcode_button')[0];
p.attempt_checkin = function(barcode) {
try {
//if (! is_barcode_valid(barcode) ) throw('Invalid Barcode');
- var check = checkin_by_copy_barcode( barcode );
+ var check = checkin_by_copy_barcode( barcode, backdate_tb.value );
if (check) {
sdump('D_CHECKIN','check = ' + check + '\n' + pretty_print( js2JSON( check ) ) + '\n');
<label id="checkin_scan_barcode_label" value="&circ.checkin.scan_label;" accesskey="&circ.checkin.scan_label.accesskey;" control="checkin_barcode_entry_textbox"/>
<textbox id="checkin_barcode_entry_textbox"/>
<button id="checkin_submit_barcode_button" label="&circ.checkin.submit_label;" accesskey="&circ.checkin.submit_label.accesskey;"/>
+ <spacer flex="1"/>
+ <label value="Effective Date:" control="checkin_effective_date_textbox"/>
+ <textbox id="checkin_effective_date_textbox"/>
</hbox>
<hbox id="CheckinItems_insert2" />
}
}
-function checkin_by_copy_barcode(barcode, f) {
+function checkin_by_copy_barcode(barcode, backdate, f) {
sdump('D_CIRC_UTILS',arg_dump(arguments,{0:true}));
try {
+ if (backdate && (backdate == formatted_date(new Date(),'%Y-%m-%d')) ) backdate = null;
+
var check = user_request(
'open-ils.circ',
'open-ils.circ.checkin.barcode',
- [ mw.G.auth_ses[0], barcode ],
+ [ mw.G.auth_ses[0], barcode, null, backdate ],
f
)[0];
total_payment = total_applied;
p.control_box.bill_payment_amount.value = cents_as_dollars( total_applied );
}
+ p.control_box.bill_payment_applied.setAttribute('value', cents_as_dollars( total_applied ));
p.control_box.bill_payment_applied.value = cents_as_dollars( total_applied );
p.control_box.bill_credit_amount.value = '';
if (total_payment > total_applied ) {
function patron_bills_control_box_init( p ) {
p.control_box = {};
- p.control_box.node = p.node.nextSibling;
+ p.control_box.node = p.node.previousSibling;
+ p.control_box.node2 = p.node.nextSibling;
p.control_box.bill_total_owed = p.control_box.node.getElementsByAttribute('id','bill_total_owed')[0];
p.control_box.payment_type = p.control_box.node.getElementsByAttribute('id','payment_type_menulist')[0];
p.control_box.bill_payment_amount = p.control_box.node.getElementsByAttribute('id','bill_payment_amount_textbox')[0];
'fm_field_render' : 'xact_dates_box($$)'
},
{
- 'id' : 'notes', 'label' : getString('mbts_xact_type_label'), 'flex' : 1,
+ 'id' : 'notes', 'label' : getString('bills_information'), 'flex' : 1,
'primary' : false, 'hidden' : false, 'fm_class' : 'mbts',
- 'fm_field_render' : '.xact_type()'
+ 'fm_field_render' : '.last_billing_note()'
},
{
'id' : 'money', 'label' : getString('bills_money_label'), 'flex' : 0,
p.list_box = list_box_init( { 'w' : p.w, 'node' : p.node, 'cols' : p.patron_bills_cols, 'debug' : p.app } );
p.clear_patron_bills = function () {
p.current_payments = [];
+ p.control_box.bill_total_owed.setAttribute('value', 'Calculating...');
p.control_box.bill_total_owed.value = 'Calculating...';
+ p.control_box.bill_payment_amount.setAttribute('value', '');
p.control_box.bill_payment_amount.value = '';
+ p.control_box.bill_payment_applied.setAttribute('value', '0.00');
p.control_box.bill_payment_applied.value = '0.00';
+ p.control_box.bill_change_amount.setAttribute('value', '0.00');
p.control_box.bill_change_amount.value = '0.00';
+ p.control_box.bill_credit_amount.setAttribute('value', '0.00');
p.control_box.bill_credit_amount.value = '0.00';
+ p.control_box.bill_new_balance.setAttribute('value', 'Calculating...');
p.control_box.bill_new_balance.value = 'Calculating...';
p.list_box.clear_rows();
};
try {
var idx = patron_items[i].getAttribute('record_id');
var copy = p._patron.checkouts()[ idx ].copy;
- checkin_by_copy_barcode( copy.barcode() );
+ checkin_by_copy_barcode( copy.barcode(), null );
p.refresh();
} catch(E) {
alert(E);
try {
var idx = patron_checkout_items[i].getAttribute('record_id');
var copy = checkouts[ idx ].copy;
- var status = checkin_by_copy_barcode( copy.barcode() );
+ var status = checkin_by_copy_barcode( copy.barcode(), null );
if (status == null) { // change this to whatever it takes
keep_these.push( checkouts[ idx ] );
}
</groupbox>
<groupbox id="cssdgb4">
<caption id="cssdgb4c" label="&patron_navbar.bills;"/>
- <box id="PatronBills_insert1" flex="0" />
+ <box name="insert1" id="PatronBills_insert1" flex="0" />
<box id="PatronBills_main" flex="1" />
- <box id="PatronBills_insert2" flex="0" />
+ <box name="insert2" id="PatronBills_insert2" flex="0" />
</groupbox>
<box id="PatronEdit_main"><label value="edit" /></box>
<box id="PatronInfo_main"><label value="info" /></box>
<button id="checkout_done" label="&patron_display.checkout.done_label;" accesskey="&patron_display.checkout.done_label.accesskey;"/>
</hbox>
-<box id="PatronBills_insert1" orient="vertical">
+<box id="PatronBills_insert2" orient="vertical">
</box>
-<box id="PatronBills_insert2" orient="vertical">
- <label value=" "/>
+<box id="PatronBills_insert1" orient="vertical">
<hbox>
+ <groupbox>
+ <caption label="Summary"/>
+ <grid>
+ <columns><column /><column /></columns>
+ <rows>
+ <row>
+ <label value="Total Owed" />
+
+ <textbox id="bill_total_owed" value="" readonly="true" />
+ </row>
+ <row>
+ <label value="- Payment applied" />
+
+ <textbox id="bill_payment_applied_textbox" readonly="true"/>
+ </row>
+ <row>
+ <label value="= New Balance"
+ style="font-family: bold" />
+
+ <textbox id="bill_new_balance_textbox" readonly="true"/>
+ </row>
+ </rows>
+ </grid>
+ </groupbox>
<spacer flex="2"/>
- <grid style="border: solid thin black">
- <columns><column /><column /><column /></columns>
- <rows>
- <row>
- <label value="Total Owed"
- style="font-family: bold" />
-
- <textbox id="bill_total_owed" value=""
- style="font-family: bold" readonly="true" />
- </row>
- <row>
- <label id="pbi1_l2" value="Payment Type"
- accesskey="t" control="pbi1_ml"
- style="font-family: bold" />
- <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="Forward Balance" />
- <menuitem id="payment_type_menuitem4" label="Forgive" />
- </menupopup>
- </menulist>
- </row>
- <row>
- <label value="Payment received"
- accesskey="a" control="pbi1_tb1"
- style="font-family: bold" />
-
- <textbox id="bill_payment_amount_textbox" />
- </row>
- <row>
- <label value="- Payment applied"
- style="font-family: bold" />
-
- <textbox id="bill_payment_applied_textbox" readonly="true"/>
- </row>
- <row>
- <label value="= Change"
- control="bill_change_amount_textbox"
- style="font-family: bold" />
-
- <textbox id="bill_change_amount_textbox" />
-
- <button id="convert_change" label="Credit" accesskey="t"/>
- </row>
- <row><label value=" "/></row>
- <row>
-
- <label value="New Balance"
- style="font-family: bold" />
-
- <textbox id="bill_new_balance_textbox" readonly="true"/>
-
- </row>
- <row><label value=" "/></row>
- <row>
-
- <label value="Forward Credit"
- style="font-family: bold" />
-
- <textbox id="bill_credit_amount_textbox" readonly="true"/>
-
- </row>
- <row>
- <spacer/>
- <button id="bill_apply_payment" label="Go!" accesskey="G"/>
- </row>
- </rows>
- </grid>
- <spacer flex="1" />
+ <groupbox>
+ <caption label="Pay Bill"/>
+ <grid>
+ <columns><column /><column /></columns>
+ <rows>
+ <row>
+ <label value="Payment Type"
+ 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" />
+ </menupopup>
+ </menulist>
+ </row>
+ <row>
+ <label value="Payment received" style="font-weight: bold"
+ accesskey="a" control="bill_payment_amount_textbox" />
+
+ <textbox id="bill_payment_amount_textbox" style="border: solid thick black"/>
+ </row>
+ <row>
+ <label value="- Payment applied" />
+
+ <textbox id="bpato" observes="bill_payment_applied_textbox" />
+ </row>
+ <row>
+ <label value="= Change" control="bill_change_amount_textbox" />
+
+ <hbox>
+ <textbox id="bill_change_amount_textbox" />
+ </hbox>
+ </row>
+ <row>
+ <label value="or Patron Credit"
+ style="font-family: bold" />
+
+ <textbox id="bill_credit_amount_textbox" readonly="true"/>
+ </row>
+ </rows>
+ </grid>
+ </groupbox>
</hbox>
- <spacer flex="1" />
+ <hbox>
+ <spacer flex="2"/>
+ <button id="change_to_credit" label="Convert Change to Patron Credit"/>
+ <button id="bill_apply_payment" label="Go!" accesskey="G"/>
+ </hbox>
+ <label value=" "/>
</box>
<!-- Accelerator Keys (Accessor Keys are in DTD's) -->
mbts_total_paid_label=Total Paid
mbts_xact_finish_label=Finish
mbts_xact_start_label=Start
-mbts_xact_type_label=Notes
+bills_information=Information