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