Maybe it's good that I'm starting to think all libraries are object libraries instead...
[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 <wizard id="patron_bill" title="Bill Patron Wizard"
20         orient="vertical" style="overflow: auto"
21         onload="patron_bill_init()" width="800" height="600"
22         onwizardfinish="patron_bill_finish()"
23         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
24
25         <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
26         <!-- BEHAVIOR -->
27         <script type="text/javascript">var myPackageDir = 'evergreen'; 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.list.au[0].home_ou().name() );
57
58                         } catch(E) {
59                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
60                                         "system administrator or software developer the following:\n" 
61                                         + 'patron/bill_wizard.xul\n' + E + '\n';
62                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
63                                 alert(err_msg);
64                         }
65
66                 }
67
68                 function patron_bill_finish() {
69                         try {
70                                 var grocery = new mg();
71                                         grocery.isnew('1');
72                                         grocery.billing_location( g.OpenILS.data.list.au[0].home_ou().id() );
73                                         grocery.usr( g.au_obj.id() );
74                                         grocery.note( document.getElementById('bill_note').value );
75                                 JSAN.use('util.network'); var net = new util.network();
76                                 var mg_id = net.request(
77                                         api.fm_mg_create.app,
78                                         api.fm_mg_create.method,
79                                         [ g.session, grocery ]
80                                 )[0];
81                                 if (mg_id) {
82                                         var billing = new mb();
83                                                 billing.isnew('1');
84                                                 billing.note( document.getElementById('bill_note').value );
85                                                 billing.xact( mg_id );
86                                                 billing.amount( document.getElementById('bill_amount').value );
87                                                 billing.billing_type( document.getElementById('billing_type').value );
88                                         var mb_id = net.request(
89                                                 api.fm_mb_create.app,
90                                                 api.fm_mb_create.method,
91                                                 [ g.session, billing ]
92                                         )[0];
93                                         if (mb_id) {
94                                         } else {
95                                                 throw('mb_id = ' + mb_id);
96                                         }
97                                 } else {
98                                         throw('mg_id = ' + mg_id);
99                                 }
100                         } catch(E) {
101                                 g.error.sdump('D_ERROR',E);
102                                 alert(E);
103                         }
104                 }
105
106         ]]>
107         </script>
108
109
110         <wizardpage id="page1" description="Billing Patron" onpageadvanced="">
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         </wizardpage>
160
161 </wizard>
162
163