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