2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Patron Display -->
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
7 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
8 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
9 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
10 <?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
12 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
14 <!DOCTYPE window PUBLIC "" ""[
15 <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
18 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
20 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
22 <window id="patron_bill" title="Bill Patron Wizard"
23 orient="vertical" style="overflow: auto"
24 onload="patron_bill_init()" width="700" height="550"
25 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
27 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
29 <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
30 <scripts id="openils_util_scripts"/>
32 <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
37 function $(id) { return document.getElementById(id); }
39 function retrieve_mbts() {
40 g.network.simple_request('FM_MBTS_RETRIEVE',[g.session,g.mbts_id],
43 g.mbts = req.getResultObject();
44 $('mbts_id').value = g.mbts.id();
45 $('mbts_xact_type').value = g.mbts.xact_type();
46 $('mbts_xact_start').value = g.mbts.xact_start().toString().substr(0,19);
47 $('mbts_xact_finish').value = g.mbts.xact_finish() ? g.mbts.xact_finish().toString().substr(0,19) : '';
48 $('mbts_total_owed').value = g.mbts.total_owed() ? util.money.sanitize( g.mbts.total_owed() ) : '';
49 $('mbts_total_paid').value = g.mbts.total_paid() ? util.money.sanitize( g.mbts.total_paid() ) : '';
50 $('mbts_balance_owed').value = g.mbts.balance_owed() ? util.money.sanitize( g.mbts.balance_owed() ) : '';
51 $('xact_type').value = g.mbts.xact_type(); $('xact_type').disabled = true;
53 g.error.sdump('D_ERROR',E);
59 function retrieve_circ() {
60 JSAN.use('util.widgets');
61 g.network.simple_request('FM_CIRC_RETRIEVE_VIA_ID', [ g.session, g.mbts_id ],
63 var r_circ = req.getResultObject();
64 if (instanceOf(r_circ,circ)) {
66 $('title_label').hidden = false;
67 $('checked_out_label').hidden = false;
68 $('due_label').hidden = false;
69 $('checked_in_label').hidden = false;
70 $('checked_out').value = r_circ.xact_start() ? r_circ.xact_start().toString().substr(0,10) : '';
71 $('checked_in').value = r_circ.checkin_time() ? r_circ.checkin_time().toString().substr(0,10) : '';
72 $('due').value = r_circ.due_date() ? r_circ.due_date().toString().substr(0,10) : '';
74 g.network.simple_request(
75 'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY',
76 [ r_circ.target_copy() ],
78 var r_mvr = rreq.getResultObject();
79 if (instanceOf(r_mvr,mvr)) {
80 util.widgets.remove_children('title');
81 $('title').appendChild( document.createTextNode( r_mvr.title() ) );
83 obj.network.simple_request(
85 [ r_circ.target_copy() ],
87 var r_acp = rrreq.getResultObject();
88 if (instanceOf(r_acp,acp)) {
89 util.widgets.remove_children('title');
90 $('title').appendChild( document.createTextNode( r_acp.dummy_title() ) );
104 function patron_bill_init() {
106 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
107 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
108 JSAN.errorLevel = "die"; // none, warn, or die
109 JSAN.addRepository('/xul/server/');
110 JSAN.use('util.error'); g.error = new util.error();
111 g.error.sdump('D_TRACE','my_init() for patron_display.xul');
112 g.OpenILS = {}; JSAN.use('OpenILS.data'); g.OpenILS.data = new OpenILS.data();
113 g.OpenILS.data.init({'via':'stash'});
114 JSAN.use('util.network'); g.network = new util.network();
115 JSAN.use('util.date');
116 JSAN.use('util.money');
119 g.session = g.cgi.param('session');
120 g.patron_id = g.cgi.param('patron_id');
122 JSAN.use('patron.util');
123 g.au_obj = patron.util.retrieve_fleshed_au_via_id( g.session, g.patron_id );
125 $('patron_name').setAttribute('value', g.au_obj.family_name() + ', ' + g.au_obj.first_given_name() + ' : ' + g.au_obj.card().barcode() );
126 $('billing_location').setAttribute('value', g.OpenILS.data.hash.aou[ g.OpenILS.data.list.au[0].ws_ou() ].name() );
128 $('bill_amount').focus();
130 if (g.cgi.param('xact_id')) {
131 g.mbts_id = g.cgi.param('xact_id');
132 $('summary').hidden = false;
138 var err_msg = "!! This software has encountered an error. Please tell your friendly " +
139 "system administrator or software developer the following:\n"
140 + 'patron/bill_wizard.xul\n' + E + '\n';
141 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
147 function patron_bill_finish() {
149 var xact_id = g.cgi.param('xact_id');
151 var grocery = new mg();
153 grocery.billing_location( g.OpenILS.data.list.au[0].ws_ou() );
154 grocery.usr( g.au_obj.id() );
155 grocery.note( $('bill_note').value );
156 xact_id = g.network.request(
157 api.FM_MG_CREATE.app,
158 api.FM_MG_CREATE.method,
159 [ g.session, grocery ]
163 var billing = new mb();
165 billing.note( $('bill_note').value );
166 billing.xact( xact_id );
167 billing.amount( $('bill_amount').value );
168 billing.billing_type( $('billing_type').value );
169 var mb_id = g.network.request(
170 api.FM_MB_CREATE.app,
171 api.FM_MB_CREATE.method,
172 [ g.session, billing ]
176 throw('mb_id = ' + mb_id);
179 throw('xact_id = ' + xact_id);
182 g.error.sdump('D_ERROR',js2JSON(E));
191 <groupbox orient="vertical" flex="1" hidden="true" id="summary">
192 <caption label="Summary" />
204 <label class="header" value="Bill #"/>
205 <label id="mbts_id" />
206 <label class="header" value="Total Billed"/>
207 <label id="mbts_total_owed" />
208 <label class="header" id="title_label" value="Title" hidden="true"/>
209 <description id="title"/>
212 <label class="header" value="Type"/>
213 <label id="mbts_xact_type"/>
214 <label class="header" value="Total Paid"/>
215 <label id="mbts_total_paid" />
216 <label class="header" id="checked_out_label" value="Checked Out" hidden="true"/>
217 <label id="checked_out"/>
220 <label class="header" value="Start"/>
221 <label id="mbts_xact_start"/>
222 <label class="header" value="Balance Owed"/>
223 <label id="mbts_balance_owed" />
224 <label class="header" id="due_label" value="Due Date" hidden="true"/>
228 <label class="header" value="Finish"/>
229 <label id="mbts_xact_finish"/>
232 <label class="header" id="checked_in_label" value="Checked In" hidden="true"/>
233 <label id="checked_in"/>
240 <caption label="Bill Patron"/>
241 <label id="patron_name" class="patronNameLarge"/>
243 <columns> <column flex="0" /> <column flex="0" /> </columns>
244 <rows id="page1_rows">
245 <row><label value="Location"/><textbox id="billing_location" disabled="true" /></row>
246 <row><label value="Transaction Type"/>
247 <menulist id="xact_type">
249 <menuitem label="Grocery" value="grocery" selected="true"/>
250 <menuitem label="Circulation" value="circulation" disabled="true"/>
254 <row><label value="Billing Type"/>
255 <menulist id="billing_type">
257 <menuitem value="Miscellaneous" label="Miscellaneous" />
258 <menuitem value="Overdue materials" label="Overdue materials" />
259 <menuitem value="Fee for placing a hold" label="Fee for placing a hold" />
260 <menuitem value="Fee for checking out a book" label="Fee for checking out a book" />
261 <menuitem value="Fee for library card" label="Fee for library card" />
262 <menuitem value="Miscellaneous charges" label="Miscellaneous charges" />
263 <menuitem value="Lost materials" label="Lost materials" />
264 <menuitem value="Damaged material" label="Damaged material" />
265 <menuitem value="Overdue Reserves charge" label="Overdue Reserves charge" />
266 <menuitem value="Recall overdue" label="Recall overdue" />
267 <menuitem value="Fee for processing lost library materials" label="Fee for processing lost library materials" />
268 <menuitem value="Fee for sending patron bills to collection agency" label="Fee for sending patron bills to collection agency" />
269 <menuitem value="Fee for interlibrary loan" label="Fee for interlibrary loan" />
270 <menuitem value="Fee for copies" label="Fee for copies" />
271 <menuitem value="Money advanced to pay for telephone use" label="Money advanced to pay for telephone use" />
272 <menuitem value="Deposit fee" label="Deposit fee" />
273 <menuitem value="Fee for disk" label="Fee for disk" />
274 <menuitem value="Fee for faxing" label="Fee for faxing" />
275 <menuitem value="Fee for laminating" label="Fee for laminating" />
276 <menuitem value="Fee for room cleaning" label="Fee for room cleaning" />
277 <menuitem value="Deposit returned; fee refund" label="Deposit returned; fee refund" />
278 <menuitem value="Sale items" label="Sale items" />
279 <menuitem value="Fee for lost card" label="Fee for lost card" />
280 <menuitem value="Long overdue items" label="Long overdue items" />
281 <menuitem value="Lost/Replacement Cassette" label="Lost/Replacement Cassette" />
282 <menuitem value="Returned Check" label="Returned Check" />
286 <row><label value="Amount"/><textbox id="bill_amount" /></row>
287 <row><label value="Note"/><textbox id="bill_note" multiline="true" rows="5" /></row>
293 <button label="Cancel" oncommand="window.close()" accesskey="C"/>
294 <button label="Submit this Bill" oncommand="patron_bill_finish(); window.close();" accesskey="S"/>