]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/patron/bill_wizard.xul
should be the last re/un-naming
[Evergreen.git] / Open-ILS / xul / staff_client / server / patron / bill_wizard.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Patron Display -->
4
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
6 <!-- STYLESHEETS -->
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"?>
11
12 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
13 <!-- LOCALIZATION -->
14 <!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
15
16 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
17 <!-- OVERLAYS -->
18 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
19
20 <window id="patron_bill" title="Bill Patron Wizard"
21         orient="vertical" style="overflow: auto"
22         onload="patron_bill_init()"
23         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
24
25         <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
26         <!-- BEHAVIOR -->
27         <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
28         <scripts id="openils_util_scripts"/>
29
30         <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
31
32         <script>
33         <![CDATA[
34
35                 function patron_bill_init() {
36                         try {
37                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
38                                 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
39                                 JSAN.errorLevel = "die"; // none, warn, or die
40                                 JSAN.addRepository('/xul/server/');
41                                 JSAN.use('util.error'); g.error = new util.error();
42                                 g.error.sdump('D_TRACE','my_init() for patron_display.xul');
43                                 g.OpenILS = {}; JSAN.use('OpenILS.data'); g.OpenILS.data = new OpenILS.data();
44                                 g.OpenILS.data.init({'via':'stash'});
45
46                                 g.cgi = new CGI();
47                                 g.session = g.cgi.param('session');
48                                 g.patron_id = g.cgi.param('patron_id');
49
50                                 JSAN.use('patron.util'); 
51                                 g.au_obj = patron.util.retrieve_au_via_id( g.session, g.patron_id );
52                                 
53                                 document.getElementById('patron_name').setAttribute('value',
54                                         g.au_obj.family_name() + ', ' + g.au_obj.first_given_name() + ' : ' + g.au_obj.card().barcode() );
55                                 document.getElementById('billing_location').setAttribute('value',
56                                         g.OpenILS.data.hash.aou[ g.OpenILS.data.list.au[0].home_ou() ].name() );
57
58                                 document.getElementById('bill_amount').focus();
59
60                         } catch(E) {
61                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
62                                         "system administrator or software developer the following:\n" 
63                                         + 'patron/bill_wizard.xul\n' + E + '\n';
64                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
65                                 alert(err_msg);
66                         }
67
68                 }
69
70                 function patron_bill_finish() {
71                         try {
72                                 var grocery = new mg();
73                                         grocery.isnew('1');
74                                         grocery.billing_location( g.OpenILS.data.list.au[0].home_ou() );
75                                         grocery.usr( g.au_obj.id() );
76                                         grocery.note( document.getElementById('bill_note').value );
77                                 JSAN.use('util.network'); var net = new util.network();
78                                 var mg_id = net.request(
79                                         api.FM_MG_CREATE.app,
80                                         api.FM_MG_CREATE.method,
81                                         [ g.session, grocery ]
82                                 );
83                                 if (mg_id) {
84                                         var billing = new mb();
85                                                 billing.isnew('1');
86                                                 billing.note( document.getElementById('bill_note').value );
87                                                 billing.xact( mg_id );
88                                                 billing.amount( document.getElementById('bill_amount').value );
89                                                 billing.billing_type( document.getElementById('billing_type').value );
90                                         var mb_id = net.request(
91                                                 api.FM_MB_CREATE.app,
92                                                 api.FM_MB_CREATE.method,
93                                                 [ g.session, billing ]
94                                         );
95                                         if (mb_id) {
96                                         } else {
97                                                 throw('mb_id = ' + mb_id);
98                                         }
99                                 } else {
100                                         throw('mg_id = ' + mg_id);
101                                 }
102                         } catch(E) {
103                                 g.error.sdump('D_ERROR',js2JSON(E));
104                                 alert(js2JSON(E));
105                         }
106                 }
107
108         ]]>
109         </script>
110
111
112         <groupbox>
113                 <caption label="Bill Patron"/>
114                 <label id="patron_name"/>
115                 <grid>
116                         <columns> <column flex="0" /> <column flex="0" /> </columns>
117                         <rows id="page1_rows">
118                                 <row><label value="Location"/><textbox id="billing_location" disabled="true" /></row>
119                                 <row><label value="Transaction Type"/>
120                                         <menulist id="xact_type">
121                                                 <menupopup>
122                                                         <menuitem label="Grocery" value="grocery" selected="true"/>
123                                                 </menupopup>
124                                         </menulist>
125                                 </row>
126                                 <row><label value="Billing Type"/>
127                                         <menulist id="billing_type">
128                                                 <menupopup>
129                                                         <menuitem value="Miscellaneous" label="Miscellaneous" />
130                                                         <menuitem value="Overdue materials" label="Overdue materials" />
131                                                         <menuitem value="Fee for placing a hold" label="Fee for placing a hold" />
132                                                         <menuitem value="Fee for checking out a book" label="Fee for checking out a book" />
133                                                         <menuitem value="Fee for library card" label="Fee for library card" />
134                                                         <menuitem value="Miscellaneous charges" label="Miscellaneous charges" />
135                                                         <menuitem value="Lost materials" label="Lost materials" />
136                                                         <menuitem value="Damaged material" label="Damaged material" />
137                                                         <menuitem value="Overdue Reserves charge" label="Overdue Reserves charge" />
138                                                         <menuitem value="Recall overdue" label="Recall overdue" />
139                                                         <menuitem value="Fee for processing lost library materials" label="Fee for processing lost library materials" />
140                                                         <menuitem value="Fee for sending patron bills to collection agency" label="Fee for sending patron bills to collection agency" />
141                                                         <menuitem value="Fee for interlibrary loan" label="Fee for interlibrary loan" />
142                                                         <menuitem value="Fee for copies" label="Fee for copies" />
143                                                         <menuitem value="Money advanced to pay for telephone use" label="Money advanced to pay for telephone use" />
144                                                         <menuitem value="Deposit fee" label="Deposit fee" />
145                                                         <menuitem value="Fee for disk" label="Fee for disk" />
146                                                         <menuitem value="Fee for faxing" label="Fee for faxing" />
147                                                         <menuitem value="Fee for laminating" label="Fee for laminating" />
148                                                         <menuitem value="Fee for room cleaning" label="Fee for room cleaning" />
149                                                         <menuitem value="Deposit returned; fee refund" label="Deposit returned; fee refund" />
150                                                         <menuitem value="Sale items" label="Sale items" />
151                                                         <menuitem value="Fee for lost card" label="Fee for lost card" />
152                                                         <menuitem value="Long overdue items" label="Long overdue items" />
153                                                         <menuitem value="Lost/Replacement Cassette" label="Lost/Replacement Cassette" />
154                                                         <menuitem value="Returned Check" label="Returned Check" />
155                                                 </menupopup>
156                                         </menulist>
157                                 </row>
158                                 <row><label value="Amount"/><textbox id="bill_amount" /></row>
159                                 <row><label value="Note"/><textbox id="bill_note" multiline="true" rows="5" /></row>
160                         </rows>
161                 </grid>
162                 <hbox>
163                         <spacer flex="1"/>
164                         <button label="Cancel" oncommand="window.close()" accesskey="C"/>
165                         <button label="Submit this Bill" oncommand="patron_bill_finish(); window.close();" accesskey="S"/>
166                 </hbox>
167         </groupbox>
168
169 </window>
170
171