Minor rework of template js.
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha &rsaquo; Acquisitions &rsaquo; Shopping Basket <!-- TMPL_VAR NAME="basketno" --> &rsaquo; <!-- TMPL_IF name="ordnum" -->Modify order details (line #<!-- TMPL_VAR NAME="ordnum" -->)<!-- TMPL_ELSE -->New order<!-- /TMPL_IF --></title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <script type="text/javascript">
5 //<![CDATA[
6 function update(f){
7 //collect values
8 quantity=f.quantity.value;
9 if (quantity ==0) {
10     alert("Quantity must be >0");
11 }
12  discount=f.discount.value;
13  currency=f.currency.value;
14 listprice=f.list_price.value;
15   listinc=parseInt(f.listinc.value);
16  applygst=parseInt(f.applygst.value);
17 //  rrp=f.rrp.value
18 //  ecost=f.ecost.value  //budgetted cost
19 //  GST=f.GST.value
20 //  total=f.total.value
21 //make useful constants out of the above
22 exchangerate=f.elements[currency].value;      //get exchange rate.  same as "discount" above?
23 gst_on=(!listinc && applygst);
24 //do real stuff
25 rrp=listprice*exchangerate;
26 ecost=rrp*(100-discount)/100;
27 GST=0;
28 if (gst_on){
29 <!-- TMPL_IF NAME="gstrate"-->
30     rrp=rrp*(1+<!-- TMPL_VAR NAME="gstrate" -->);
31     GST=ecost*(<!-- TMPL_VAR NAME="gstrate" -->);
32 <!-- TMPL_ELSE --> ; // TMPL_VAR NAME=gstrate not set.  leave rrp and GST alone.
33 <!-- /TMPL_IF -->
34 }
35
36 total=(ecost+GST)*quantity;
37
38   f.rrp.value=rrp;
39 f.ecost.value=ecost;
40 f.total.value=total;
41 <!-- TMPL_IF NAME="GST" -->  // FIXME: TMPL_VAR NAME="GST" never populated
42   f.GST.value=GST;
43 <!-- /TMPL_IF -->
44 return true;
45 }
46
47 function messenger(X,Y,etc){    // FIXME: unused?
48     win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
49     win.focus();
50     win.document.close();
51     win.document.write("<body>");
52     win.document.write(etc);
53     win.document.write("<form><input type=\"button\" onclick=\"self.close()\" value=\"Close\" \/><\/form>");
54     win.document.write("<\/body><\/html>");
55 }
56
57 function check(f) {
58 quantity=f.quantity.value
59 title=f.title.value
60 if (title == "") {
61     alert("Title can't be empty");
62     return false;
63 }
64 if (quantity ==0) {
65     alert("Quantity must be >0");
66     return false;
67 }
68     document.frusin.submit();
69 }
70 //]]>
71 </script>
72 </head>
73 <body>
74 <!-- TMPL_INCLUDE NAME="header.inc" -->
75 <!-- TMPL_INCLUDE NAME="acquisitions-search.inc" -->
76
77 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->">Shopping Basket <!-- TMPL_VAR NAME="basketno" --></a> &rsaquo; <!-- TMPL_IF name="ordnum" -->Modify order details (line #<!-- TMPL_VAR NAME="ordnum" -->)<!-- TMPL_ELSE -->New order<!-- /TMPL_IF --></div>
78
79 <div id="doc3" class="yui-t2">
80    
81    <div id="bd">
82         <div id="yui-main">
83         <div class="yui-b">
84         
85 <h1>
86     <!-- TMPL_IF name="ordnum" -->
87         Modify order details (line #<!-- TMPL_VAR NAME="ordnum" -->)
88     <!-- TMPL_ELSE -->
89         New order
90     <!-- /TMPL_IF -->
91         <!-- TMPL_IF name="suggestionid" -->(defined from suggestion #<!-- TMPL_VAR NAME="suggestionid" -->)<!-- /TMPL_IF -->
92 </h1>
93
94 <!-- TMPL_IF name="basketno" -->
95 <div id="basket-details">Basket Details
96   <ul>  <li>Basket number: <!-- TMPL_VAR NAME="basketno" --></li>
97     <li>Managed by: <!-- TMPL_VAR NAME="authorisedbyname" --></li>
98     <li>Open on: <!-- TMPL_VAR NAME="creationdate" --></li>
99     <li>For vendor ID: <!-- TMPL_VAR NAME="booksellerid" --></li>
100     <li>Invoice number: <!-- TMPL_VAR NAME="booksellerinvoicenumber" --></li>
101     <!-- TMPL_IF name="closedate" --><li>Closed on: <!-- TMPL_VAR name="closedate" --></li><!-- /TMPL_IF --></ul>
102 </div>
103 <!-- /TMPL_IF -->
104
105 <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" name="frusin">
106 <fieldset class="rows">
107         <legend>Catalog details</legend>
108         <!-- TMPL_UNLESS name="existing" -->
109                 <input type="hidden" name="existing" value="no" />
110         <!-- /TMPL_UNLESS -->
111         <input type="hidden" name="ordnum" value="<!-- TMPL_VAR NAME="ordnum" -->" />
112         <input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" />
113         <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR NAME="booksellerid" -->" />
114         <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
115         <input type="hidden" name="biblioitemnumber" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
116         <input type="hidden" name="oldtype" value="<!-- TMPL_VAR NAME="itemtype" -->" />
117         <input type="hidden" name="discount" value="<!-- TMPL_VAR NAME="discount" -->" />
118         <input type="hidden" name="listinc" value="<!-- TMPL_VAR NAME="listincgst" -->" />
119         <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />
120         <input type="hidden" name="applygst" value="<!-- TMPL_VAR NAME="gstreg" -->" />
121         <input type="hidden" name="suggestionid" value="<!-- TMPL_VAR NAME="suggestionid" -->" />
122         <!-- TMPL_LOOP NAME="loop_currencies" -->
123             <input type="hidden" name="<!-- TMPL_VAR NAME="currency" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
124         <!-- /TMPL_LOOP -->
125         <ol><li>
126             <!-- TMPL_IF name="biblionumber" -->
127                         <span class="label">Title</span>
128                 <input type="hidden" size="20" name="title" value="<!-- TMPL_VAR NAME="title" -->" /> <span class="title"><!-- TMPL_VAR NAME="title" escape="html" --></span>
129             <!-- TMPL_ELSE -->
130             <label for="entertitle" class="required">Title: </label>
131                 <input type="text" id="entertitle" size="20" name="title" value="<!-- TMPL_VAR NAME="title" -->" />
132             <!-- /TMPL_IF -->
133         </li>
134         <li>
135             <!-- TMPL_IF name="biblionumber" -->
136                         <span class="label">Author: </span>
137                 <input type="hidden" size="20" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" /><!-- TMPL_VAR NAME="author" -->
138             <!-- TMPL_ELSE -->
139             <label for="author">Author: </label>
140                 <input type="text" size="20" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" />
141             <!-- /TMPL_IF -->
142         </li>
143         <li>
144             <!-- TMPL_IF name="biblionumber" -->
145                         <span class="label">Publisher: </span>
146                 <input type="hidden" size="20" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" /><!-- TMPL_VAR NAME="publishercode" -->
147             <!-- TMPL_ELSE -->
148             <label for="publishercode"> Publisher: </label>
149                 <input type="text" size="20" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" />
150             <!-- /TMPL_IF -->
151         </li>
152         <li>
153             <!-- TMPL_IF name="biblionumber" -->
154                         <span class="label">Copyright date: </span>
155                 <input type="hidden" size="20" name="copyrightdate" id="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" /><!-- TMPL_VAR NAME="copyrightdate" -->
156             <!-- TMPL_ELSE -->
157             <label for="copyrightdate">Copyright date: </label>
158                 <input type="text" size="20" name="copyrightdate" id="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" />
159             <!-- /TMPL_IF -->
160         </li>
161         <li>
162             <!-- TMPL_IF name="biblionumber" -->
163                         <span class="label">Item type: </span>
164                 <input type="hidden" size="20" name="itemtype" id="itemtype" value="<!-- TMPL_VAR NAME="itemtype" -->" /><!-- TMPL_VAR NAME="itemtype_desc" -->
165                         <!-- TMPL_ELSE -->
166             <label for="format">Item type: </label>
167             <select name="format" id="format">
168             <!-- TMPL_LOOP name="itypeloop" -->
169                                 <option value="<!-- TMPL_VAR NAME="itemtype" -->"><!-- TMPL_VAR NAME="desc" --></option>
170             <!-- /TMPL_LOOP -->
171             </select>
172                          <!-- /TMPL_IF -->
173         </li>
174         <li>
175             <!-- TMPL_IF name="biblionumber" -->
176                         <span class="label">ISBN: </span>
177                 <input type="hidden" size="20" name="ISBN" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" /><!-- TMPL_VAR NAME="isbn" -->
178             <!-- TMPL_ELSE -->
179             <label for="ISBN">ISBN: </label>
180                 <input type="text" size="20" name="ISBN" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" />
181             <!-- /TMPL_IF -->
182         </li>
183         <li>
184             <!-- TMPL_IF name="biblionumber" -->
185                         <span class="label">Series: </span>
186                 <input type="hidden" size="20" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" /><span class="title"><!-- TMPL_VAR NAME="seriestitle" --></span>
187             <!-- TMPL_ELSE -->
188             <label for="series">Series: </label>
189                 <input type="text" size="20" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" />
190             <!-- /TMPL_IF -->
191         </li>
192         <li>
193             <label for="branch">Library: </label>
194             <select name="branch" id="branch">
195             <!-- TMPL_LOOP name="branchloop" -->
196                 <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
197                                 <!-- TMPL_ELSE -->
198                                 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
199                                 <!-- /TMPL_IF -->
200             <!-- /TMPL_LOOP -->
201             </select>
202         </li>
203                 </ol>
204     </fieldset>
205         <fieldset class="rows">
206         <legend>Accounting Details</legend>
207                 <ol>
208             <li>
209                 <!-- TMPL_IF name="close" -->
210                         <span class="label required">Quantity: </span>
211                     <input type="hidden" size="20" id="quantity" name="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" /><!-- TMPL_VAR NAME="quantity" -->
212                 <!-- TMPL_ELSE -->
213                 <label class="required" for="quantity">Quantity: </label>
214                     <input type="text" size="20" id="quantity" name="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" onchange="update(this.form);" />
215                 <!--/TMPL_IF-->
216             </li>
217             <li>
218                 <!-- TMPL_IF name="close" -->
219                         <span class="label">Fund: </span>
220                     <input type="hidden" size="20" name="bookfund" id="bookfund" value="<!-- TMPL_VAR NAME="bookfundid" -->" /><!-- TMPL_VAR NAME="bookfundname" -->
221                 <!-- TMPL_ELSE -->
222                 <label for="bookfund">Fund: </label>
223                     <!-- TMPL_VAR NAME="CGIbookfund" -->
224                 <!--/TMPL_IF-->
225             </li>
226             <li>
227                 <!-- TMPL_IF name="close" -->
228                         <span class="label">Vendor price: </span>
229                     <input type="hidden" size="20" name="list_price" id="list_price" value="<!-- TMPL_VAR NAME="listprice" -->" /><!-- TMPL_VAR NAME="listprice" -->
230                 <!-- TMPL_ELSE -->
231                 <label for="list_price">Vendor price: </label>
232                     <input type="text" size="20" name="list_price" id="list_price" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="update(this.form)" />
233                 <!--/TMPL_IF-->
234             </li>
235             <li>
236                 <!-- TMPL_IF name="close" -->
237                         <span class="label">Replacement cost: </span>
238                     <input type="hidden" size="20" name="rrp" id="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" /><!-- TMPL_VAR NAME="rrp" -->
239                 <!-- TMPL_ELSE -->
240                 <label for="rrp">Replacement cost : </label>
241                     <input type="text" size="20" name="rrp" id="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" />
242                 <!--/TMPL_IF-->
243             </li>
244             <li>
245                 <!-- TMPL_IF name="close" -->
246                         <label for="ecost">Budgeted cost: </label>
247                     <input type="text" size="20" name="ecost" id="ecost" value="<!-- TMPL_VAR NAME="ecost" -->" readonly="readonly"  />
248                 <!-- TMPL_ELSE -->
249                 <label for="ecost">Budgeted cost: </label>
250                     <input type="text" size="20" name="ecost" id="ecost" value="<!-- TMPL_VAR NAME="ecost" -->" />
251                 <!--/TMPL_IF-->
252             </li>
253             <!-- TMPL_IF NAME="GST"-->
254             <li>
255                                 <!-- TMPL_IF name="close" -->
256                         <label for="GST">Budgeted GST: </label>
257                 <input type="text" id="" size="20" name="GST" value="" id="GST" readonly="readonly" />
258                                 <!-- TMPL_ELSE -->
259                 <label for="GST">Budgeted GST: </label>
260                 <input type="text" size="20" name="GST" id="GST" value="" />
261                                 <!--/TMPL_IF-->
262             </li>
263             <!-- /TMPL_IF -->
264             <li>
265                 <!-- TMPL_IF name="close" -->
266                         <label for="total">Total: </label>
267                                 <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" readonly="readonly" />
268                                 <!-- TMPL_ELSE -->
269                 <label for="total">Total: </label>
270                 <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" />
271                                 <!--/TMPL_IF-->
272             </li>
273             <li>
274                                 <!-- TMPL_IF name="close" -->
275                         <label for="cost">Actual cost: </label>
276                 <input type="text" id="cost" size="20" name="cost" value="<!-- TMPL_VAR name="ecost"-->" readonly="readonly" />
277                                 <!-- TMPL_ELSE -->
278                 <label for="cost">Actual cost: </label>
279                 <input type="text" id="cost" size="20" name="cost" value="<!-- TMPL_VAR name="ecost"-->" />
280                                 <!--/TMPL_IF-->
281             </li>
282             <li>
283                 <label for="purchaseordernumber">Purchase order: </label>
284                 <input type="text" id="purchaseordernumber" size="20" name="purchaseordernumber"  value="<!-- TMPL_VAR name="purchaseordernumber" -->" /> 
285             </li>
286             <li>
287                 <label for="invoice">Invoice number: </label>
288                 <input type="text" id="invoice" size="20" name="invoice"  value="<!-- TMPL_VAR name="invoice" -->" /> (Fill when receiving)
289             </li>
290             <li>
291                 <label for="notes">Notes: </label>
292                 <textarea id="notes" cols="30" rows="3" name="notes"><!-- TMPL_VAR NAME="notes" --></textarea>
293             </li>
294             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
295                 <!-- TMPL_IF Name="CGIsort1" -->
296                     <!-- TMPL_VAR Name="CGIsort1" -->
297                 <!-- TMPL_ELSE -->
298                 <label for="sort1">Sort field 1: </label>
299                     <input type="text" id="sort1" size="20" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" />
300                 <!--/TMPL_IF -->
301             </li>
302             <li>
303                 <!-- TMPL_IF Name="CGIsort2" -->
304                     <!-- TMPL_VAR Name="CGIsort2" -->
305                 <!-- TMPL_ELSE -->
306                 <label for="sort2">Sort field 2: </label>
307                     <input type="text" id="sort2" size="20" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" />
308                 <!--/TMPL_IF -->
309             </li></ol>
310     </fieldset>
311     <fieldset class="action">
312         <input type="button" value="Save" onclick="check(this.form)" /> <!-- TMPL_IF name="suggestionid" --><a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->&basketno=<!-- TMPL_VAR NAME="basketno" -->">Cancel</a><!-- TMPL_ELSE --><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->">Cancel</a><!-- /TMPL_IF -->
313     </fieldset>
314 </form>
315 </div>
316 </div>
317 <div class="yui-b">
318 <!-- TMPL_INCLUDE NAME="acquisitions-menu.inc" -->
319 </div>
320 </div>
321 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->