]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Evergreen/staff_client/chrome/content/evergreen/circ/receipt_template_editor.xul
8a58ca607540bd9235ab0ce31b821ac4793f0db6
[working/Evergreen.git] / Evergreen / staff_client / chrome / content / evergreen / circ / receipt_template_editor.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: About -->
4
5 <!-- Stylesheets -->
6 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
7 <?xml-stylesheet href="chrome://evergreen/skin/evergreen.css" type="text/css"?>
8
9 <window id="itemsout_receipt_template_win" 
10         onload="try { my_init(); } catch(E) { alert(E); }"
11         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
12
13         <script>mw.sdump('D_TRACE','Loading itemsout_receipt_template.xul\n');</script>
14
15         <script>
16         <![CDATA[
17                 var test_patron = mw.JSON2js('/*--S au --*/[null,null,null,[/*--S aua --*/[null,null,null,"work","CITY","USA","Fulton","13","30043","GA","123 street road","#AR54","18","1"]/*--E aua --*/,/*--S aua --*/[null,null,null,"Vacation","PC Beach","USA","PC County","42","01010","FL","111 A Street","Unit #12A","18","1"]/*--E aua --*/],[/*--S ac --*/[null,null,null,"1","21099000006699","14","18"]/*--E ac --*/],[{"circ":/*--S aoc --*/[null,null,null,"212","2005-07-05 04:58:02-04","14 days","2wk_default","1 day","134","50.00","books","0.10","books","1","1",null,"11","18",null,"2005-07-19 10:38:25.211964-04"]/*--E aoc --*/,"copy":/*--S acp --*/[null,null,null,null,"31041005404709","11",null,"212",null,"1","1","2005-05-06 11:13:05.063398-04","1","0","0.00","2005-05-06 11:13:05.063398-04","1","2","1","11","2","1","1","0.00","0","1"]/*--E acp --*/,"record":/*--S mvr --*/[null,null,null,"Albrand, Martha.",[],null,"3",null,null,"",[],"1959","Random House",null,[],[],null,"PIN01000004 ","A  day in Monte Carlo",["text"]]/*--E mvr --*/},{"circ":/*--S aoc --*/[null,null,null,"12","2005-08-04 11:31:02-04","14 days","2wk_default","1 day","171","50.00","books","0.10","books","0","2",null,"2139800","18",null,"2005-07-21 17:11:44.203345-04"]/*--E aoc --*/,"copy":/*--S acp --*/[null,null,null,null,"33207000838641","1938753",null,"10",null,"1","1","2005-05-06 11:13:05.063398-04","1","0","0.00","2005-07-21 17:08:53.504341-04","1","2","1","2139800","2","1","1","10.00","0","1"]/*--E acp --*/,"record":/*--S mvr --*/[null,null,null,"Sproule, Anna.",[],null,"330278",null,null,"0531182150 (lib. bdg.)",[],"1988","Bookwright Press",null,["Know your pet"],[["Dogs"],["Dog breeds"]],"Discusses how to choose and care for a pet dog and provides information on various breeds.","PIN03092988 ","Dogs",["text"]]/*--E mvr --*/},{"circ":/*--S aoc --*/[null,null,null,"1","2005-08-05 14:36:02-04","14 days","2wk_default","1 day","173","50.00","books","0.10","books","0","2",null,"1329873","18",null,"2005-07-22 20:17:07.199888-04"]/*--E aoc --*/,"copy":/*--S acp --*/[null,null,null,null,"34520000676111","1187974",null,"182",null,"1","1","2005-05-06 11:13:05.063398-04","1","0","0.00","2005-05-06 11:13:05.063398-04","1","2","1","1329873","2","1","1","0.00","0","1"]/*--E acp --*/,"record":/*--S mvr --*/[null,null,null,"Margolis, Matthew.",[],null,"97448",null,"1st Vintage Books ed.","0394711742 (pbk.) :",[],"1982, c1979","Vintage Books",null,[],[["Dogs"]],null,"PIN02040633 ","The  dog in your life a complete guide to choosing, raising, feeding, training, and caring for your dog plus sections on show dogs, hunting dogs, coursing dogs, herd dogs, sled dogs, guard dogs, guide dogs, and a discussion of common canine illnesses",["text"]]/*--E mvr --*/}],[/*--S ahr --*/[null,null,null,"Copy found, waiting for capture",null,"3601016","email2@somewheres.info",null,null,"T",null,"45","800.555.0000","12","2005-07-24 15:47:42.091479-04","2005-07-21 16:35:16.026892-04","18","0","847314","18"]/*--E ahr --*/,/*--S ahr --*/[null,null,null,"Copy found, waiting for capture",null,"1386122","email2@somewheres.info",null,null,"T",null,"46","800.555.0000","12","2005-07-24 15:47:45.240195-04","2005-07-21 16:40:12.783469-04","18","0","152833","18"]/*--E ahr --*/,/*--S ahr --*/[null,null,null,"Available","2005-07-21 17:04:11.853992-04","548582","email2@somewheres.info",null,null,"T",null,"47","800.555.0000","12","2005-07-21 17:03:49.248665-04","2005-07-21 17:03:10.523049-04","18","0","23932","18"]/*--E ahr --*/],null,[/*--S actscecm --*/[null,null,null,"40","17","Yes","18"]/*--E actscecm --*/,/*--S actscecm --*/[null,null,null,"14","2","Yes","18"]/*--E actscecm --*/,/*--S actscecm --*/[null,null,null,"46","18","test2","18"]/*--E actscecm --*/,/*--S actscecm --*/[null,null,null,"42","16","","18"]/*--E actscecm --*/],null,"1",null,/*--S aua --*/[null,null,null,"Vacation","PC Beach","USA","PC County","42","01010","FL","111 A Street","Unit #12A","18","1"]/*--E aua --*/,/*--S ac --*/[null,null,null,"1","21099000006699","14","18"]/*--E ac --*/,"0","2005-05-13","0.00","800.555.0000","1900-01-02","email2@somewheres.info",null,"2008-05-13","Erickson","Bill","10","18","5","2","345","365","1122211188.708583190.17503114108",/*--S aua --*/[null,null,null,"work","CITY","USA","Fulton","13","30043","GA","123 street road","#AR54","18","1"]/*--E aua --*/,"0","1",null,null,null,"Councilperson","3",null,"1","Jr","0","18","erickson"]/*--E au --*/');
18
19                 function my_init() {
20                         document.getElementById('itemsout_header_tb').value = mw.G.itemsout_header;
21                         document.getElementById('itemsout_line_item_tb').value = mw.G.itemsout_line_item;
22                         document.getElementById('itemsout_footer_tb').value = mw.G.itemsout_footer;
23                         document.getElementById('checkout_header_tb').value = mw.G.checkout_header;
24                         document.getElementById('checkout_line_item_tb').value = mw.G.checkout_line_item;
25                         document.getElementById('checkout_footer_tb').value = mw.G.checkout_footer;
26                         document.getElementById('checkin_header_tb').value = mw.G.checkin_header;
27                         document.getElementById('checkin_line_item_tb').value = mw.G.checkin_line_item;
28                         document.getElementById('checkin_footer_tb').value = mw.G.checkin_footer;
29                         document.getElementById('holds_header_tb').value = mw.G.holds_header;
30                         document.getElementById('holds_line_item_tb').value = mw.G.holds_line_item;
31                         document.getElementById('holds_footer_tb').value = mw.G.holds_footer;
32                         test_itemsout(document.getElementById('sample_view'));
33                 }
34
35                 function test_itemsout(sample_view) {
36                         var params = { 
37                                 'au' : test_patron, 
38                                 'lib' : mw.G.user_ou,
39                                 'staff' : mw.G.user,
40                                 'header' : document.getElementById('itemsout_header_tb').value,
41                                 'line_item' : document.getElementById('itemsout_line_item_tb').value,
42                                 'footer' : document.getElementById('itemsout_footer_tb').value
43                         };
44                         mw.print_itemsout_receipt( params, sample_view );
45                 }
46
47                 function save_itemsout() {
48                         mw.G.itemsout_header = document.getElementById('itemsout_header_tb').value;
49                         mw.G.itemsout_line_item = document.getElementById('itemsout_line_item_tb').value;
50                         mw.G.itemsout_footer = document.getElementById('itemsout_footer_tb').value;
51                 }
52
53                 function test_checkout(sample_view) {
54                         var params = { 
55                                 'au' : test_patron, 
56                                 'lib' : mw.G.user_ou,
57                                 'staff' : mw.G.user,
58                                 'header' : document.getElementById('checkout_header_tb').value,
59                                 'line_item' : document.getElementById('checkout_line_item_tb').value,
60                                 'footer' : document.getElementById('checkout_footer_tb').value
61                         };
62                         mw.print_checkout_receipt( params, sample_view );
63                 }
64
65                 function save_checkout() {
66                         mw.G.checkout_header = document.getElementById('checkout_header_tb').value;
67                         mw.G.checkout_line_item = document.getElementById('checkout_line_item_tb').value;
68                         mw.G.checkout_footer = document.getElementById('checkout_footer_tb').value;
69                 }
70
71                 function test_checkin(sample_view) {
72                         var params = { 
73                                 'au' : test_patron, 
74                                 'lib' : mw.G.user_ou,
75                                 'staff' : mw.G.user,
76                                 'header' : document.getElementById('checkin_header_tb').value,
77                                 'line_item' : document.getElementById('checkin_line_item_tb').value,
78                                 'footer' : document.getElementById('checkin_footer_tb').value
79                         };
80                         mw.print_checkin_receipt( params, sample_view );
81                 }
82
83                 function save_checkin() {
84                         mw.G.checkin_header = document.getElementById('checkin_header_tb').value;
85                         mw.G.checkin_line_item = document.getElementById('checkin_line_item_tb').value;
86                         mw.G.checkin_footer = document.getElementById('checkin_footer_tb').value;
87                 }
88
89                 function test_holds(sample_view) {
90                         var params = { 
91                                 'au' : test_patron, 
92                                 'lib' : mw.G.user_ou,
93                                 'staff' : mw.G.user,
94                                 'header' : document.getElementById('holds_header_tb').value,
95                                 'line_item' : document.getElementById('holds_line_item_tb').value,
96                                 'footer' : document.getElementById('holds_footer_tb').value
97                         };
98                         mw.print_holds_receipt( params, sample_view );
99                 }
100
101                 function save_holds() {
102                         mw.G.holds_header = document.getElementById('holds_header_tb').value;
103                         mw.G.holds_line_item = document.getElementById('holds_line_item_tb').value;
104                         mw.G.holds_footer = document.getElementById('holds_footer_tb').value;
105                 }
106
107                 function switch_sample_view() {
108                         try {
109                                 var sv = document.getElementById('sample_view');
110                                 switch( document.getElementById('tps').selectedPanel.id ) {
111                                         case 'itemsout' : test_itemsout(sv); break;
112                                         case 'checkout' : test_checkout(sv); break;
113                                         case 'checkin' : test_checkin(sv); break;
114                                         case 'holds' : test_holds(sv); break;
115                                 }
116                         } catch(E) {
117                                 mw.sdump('D_ERROR',mw.js2JSON(E));
118                         }
119                 }
120
121         ]]>
122         </script>
123
124         <vbox flex="1" class="my_overflow">
125                 <groupbox orient="vertical" flex="1">
126                         <caption label="Receipt Template Editor"/>
127                         <hbox flex="1">
128                                 <groupbox orient="vertical" flex="1">
129                                         <caption label="HELP" />
130                                         <tabbox flex="1">
131                                                 <tabs>
132                                                         <tab label="Description"/>
133                                                         <tab label="Sample View"/>
134                                                 </tabs>
135                                                 <tabpanels flex="1">
136                                                         <tabpanel flex="1">
137                                                                 <hbox flex="1">
138                                                                         <iframe flex="1" src="data:text/html,&lt;html&gt;&lt;p&gt;Please note that this interface is for testing purposes, and that modifications you make here will not persist between different invocations of the staff client.  In future versions of the software, you will be able to save and share named templates.  Also note that the Sample View is not intended to be a print preview of the receipt.  You should print the test receipt to determine how your template will actually look.&lt;/p&gt;&lt;p&gt;The following macros get evaluated and substituted for each receipt printed: %LIBRARY% %PINES_CODE% %PATRON_LASTNAME% %PATRON_FIRSTNAME% %PATRON_MIDDLENAME% %PATRON_BARCODE% %TODAY% %OUT% %DUE% %DURATION% %COPY_BARCODE% %TITLE% %AUTHOR% %PUBLISHER% %PUBDATE% %NUMBER% %STAFF_LASTNAME% %STAFF_FIRSTNAME% %STAFF_MIDDLENAME% %STAFF BARCODE%&lt;/p&gt;&lt;p&gt;If there's a specific macro you would like to see, please let us know.  There will be variations on these for handling truncation and date formats.  You may also include HTML markup in your template, but how that renders will depend on your printer and print driver.  Please see the examples:&lt;/p&gt;&lt;/html&gt;" />;
139                                                                 </hbox>
140                                                         </tabpanel>
141                                                         <tabpanel flex="1">
142                                                                 <hbox flex="1">
143                                                                         <iframe flex="1" id="sample_view" />
144                                                                 </hbox>
145                                                         </tabpanel>
146                                                 </tabpanels>
147                                         </tabbox>
148                                 </groupbox>
149                                 <groupbox orient="vertical" flex="1">
150                                         <caption label="TEMPLATES" />
151                                 <tabbox flex="1">
152                                         <tabs>
153                                                 <tab label="Items Out"/>
154                                                 <tab label="Check Out"/>
155                                                 <tab label="Check In"/>
156                                                 <tab label="Holds"/>
157                                         </tabs>
158                                         <tabpanels id="tps" flex="1" onselect="switch_sample_view();">
159                                                 <tabpanel id="itemsout">
160                                                         <vbox flex="1">
161                                                                 <groupbox orient="vertical" flex="1">
162                                                                         <caption label="Header"/>
163                                                                         <textbox id="itemsout_header_tb" multiline="true" flex="1" onchange="test_itemsout(document.getElementById('sample_view'));"/>
164                                                                 </groupbox>
165                                                                 <groupbox orient="vertical" flex="1">
166                                                                         <caption label="Line Item"/>
167                                                                         <textbox id="itemsout_line_item_tb" multiline="true" flex="1" onchange="test_itemsout(document.getElementById('sample_view'));"/>
168                                                                 </groupbox>
169                                                                 <groupbox orient="vertical" flex="1">
170                                                                         <caption label="Footer"/>
171                                                                         <textbox id="itemsout_footer_tb" multiline="true" flex="1" onchange="test_itemsout(document.getElementById('sample_view'));"/>
172                                                                 </groupbox>
173                                                                 <hbox>
174                                                                         <spacer flex="1"/>
175                                                                         <button label="Update Sample View" accesskey="V" />
176                                                                         <button label="Test Print" accesskey="T" oncommand="test_itemsout();"/>
177                                                                         <button label="Save" accesskey="S" oncommand="save_itemsout();"/>
178                                                                 </hbox>
179                                                         </vbox>
180                                                 </tabpanel>
181                                                 <tabpanel id="checkout">
182                                                         <vbox flex="1">
183                                                                 <groupbox orient="vertical" flex="1">
184                                                                         <caption label="Header"/>
185                                                                         <textbox id="checkout_header_tb" multiline="true" flex="1" onchange="test_checkout(document.getElementById('sample_view'));"/>
186                                                                 </groupbox>
187                                                                 <groupbox orient="vertical" flex="1">
188                                                                         <caption label="Line Item"/>
189                                                                         <textbox id="checkout_line_item_tb" multiline="true" flex="1" onchange="test_checkout(document.getElementById('sample_view'));"/>
190                                                                 </groupbox>
191                                                                 <groupbox orient="vertical" flex="1">
192                                                                         <caption label="Footer"/>
193                                                                         <textbox id="checkout_footer_tb" multiline="true" flex="1" onchange="test_checkout(document.getElementById('sample_view'));"/>
194                                                                 </groupbox>
195                                                                 <hbox>
196                                                                         <spacer flex="1"/>
197                                                                         <button label="Update Sample View" accesskey="V" />
198                                                                         <button label="Test Print" accesskey="T" oncommand="test_checkout();"/>
199                                                                         <button label="Save" accesskey="S" oncommand="save_checkout();"/>
200                                                                 </hbox>
201                                                         </vbox>
202                                                 </tabpanel>
203                                                 <tabpanel id="checkin">
204                                                         <vbox flex="1">
205                                                                 <groupbox orient="vertical" flex="1">
206                                                                         <caption label="Header"/>
207                                                                         <textbox id="checkin_header_tb" multiline="true" flex="1" onchange="test_checkin(document.getElementById('sample_view'));"/>
208                                                                 </groupbox>
209                                                                 <groupbox orient="vertical" flex="1">
210                                                                         <caption label="Line Item"/>
211                                                                         <textbox id="checkin_line_item_tb" multiline="true" flex="1" onchange="test_checkin(document.getElementById('sample_view'));"/>
212                                                                 </groupbox>
213                                                                 <groupbox orient="vertical" flex="1">
214                                                                         <caption label="Footer"/>
215                                                                         <textbox id="checkin_footer_tb" multiline="true" flex="1" onchange="test_checkin(document.getElementById('sample_view'));"/>
216                                                                 </groupbox>
217                                                                 <hbox>
218                                                                         <spacer flex="1"/>
219                                                                         <button label="Update Sample View" accesskey="V" />
220                                                                         <button label="Test Print" accesskey="T" oncommand="test_checkin();"/>
221                                                                         <button label="Save" accesskey="S" oncommand="save_checkin();"/>
222                                                                 </hbox>
223                                                         </vbox>
224                                                 </tabpanel>
225                                                 <tabpanel id="holds">
226                                                         <vbox flex="1">
227                                                                 <groupbox orient="vertical" flex="1">
228                                                                         <caption label="Header"/>
229                                                                         <textbox id="holds_header_tb" multiline="true" flex="1" onchange="test_holds(document.getElementById('sample_view'));"/>
230                                                                 </groupbox>
231                                                                 <groupbox orient="vertical" flex="1">
232                                                                         <caption label="Line Item"/>
233                                                                         <textbox id="holds_line_item_tb" multiline="true" flex="1" onchange="test_holds(document.getElementById('sample_view'));"/>
234                                                                 </groupbox>
235                                                                 <groupbox orient="vertical" flex="1">
236                                                                         <caption label="Footer"/>
237                                                                         <textbox id="holds_footer_tb" multiline="true" flex="1" onchange="test_holds(document.getElementById('sample_view'));"/>
238                                                                 </groupbox>
239                                                                 <hbox>
240                                                                         <spacer flex="1"/>
241                                                                         <button label="Update Sample View" accesskey="V" />
242                                                                         <button label="Test Print" accesskey="T" oncommand="test_holds();"/>
243                                                                         <button label="Save" accesskey="S" oncommand="save_holds();"/>
244                                                                 </hbox>
245                                                         </vbox>
246                                                 </tabpanel>
247                                         </tabpanels>
248                                 </tabbox>
249                                 </groupbox>
250                         </hbox>
251                 </groupbox>
252         </vbox>
253
254 </window>
255