A new acquisition to handle multiple tax values, and marc creation of biblios and...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / acqui / neworderempty.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Shopping Basket For: <!-- TMPL_VAR name="bookselname" --><!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
2
3 <!-- TMPL_INCLUDE NAME="menus.inc" -->
4 <!-- TMPL_INCLUDE NAME="menu-acqui.inc" -->
5
6 <script language="javascript" type="text/javascript">
7
8 function update(f){
9   //collect values
10   quantity=f.quantity.value
11   if (quantity ==0) {
12         alert("Quantity must be >0");
13   }
14   discount=f.discount.value
15   listinc=parseInt(f.listinc.value)
16   currency=f.currency.value
17   applygst=parseInt(f.applygst.value)
18   listprice=f.list_price.value
19   //  rrp=f.rrp.value
20   //  ecost=f.ecost.value  //budgetted cost
21   //  GST=f.GST.value
22   //  total=f.total.value
23   //make useful constants out of the above
24   exchangerate=f.elements[currency].value      //get exchange rate
25   gst_on=(applygst);
26   //do real stuff
27    if (listinc){
28 listprice=listprice*100/(100+f.gstrate.value)
29 }
30   rrp=listprice*exchangerate;
31   ecost=rrp*(100-discount)/100
32   GST=0;
33   if (gst_on){
34  //   rrp=rrp*(1+f.gstrate.value/100);
35     GST=ecost*(f.gstrate.value)/100;
36   }
37
38   total=(ecost+GST)*quantity
39
40   f.rrp.value=rrp;
41   f.ecost.value=ecost;
42   f.unitprice.value=ecost+GST
43   f.GST.value=GST;
44   f.total.value=total;
45   return true;
46 }
47
48
49
50 function messenger(X,Y,etc){
51         win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
52         win.focus();
53         win.document.close();
54         win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size='2'><p><br>");
55         win.document.write(etc);
56         win.document.write("<center><form><input type=button onclick='self.close()' value='Close'></form></center>");
57         win.document.write("</font></body></html>");
58 }
59
60 function check(f) {
61   quantity=f.quantity.value;
62   title=f.title.value;
63  biblio=f.biblionumber.value;
64  invoice=f.purchaseordernumber.value;
65 suggestionid="<!--TMPL_VAR NAME="suggestionid"-->";
66   if (title == "") {
67         alert("Title can't be empty- Have you created the biblio?");
68         return false;
69   }
70  if (biblio == "" && suggestionid=="") {
71         alert("A biblio is not created- please create the biblio first?");
72         return false;
73   }
74   if (quantity ==0) {
75         alert("Quantity must be >0");
76         return false;
77   }
78
79         document.frusin.submit();
80 }
81 function AddBiblio() {
82      window.open("/cgi-bin/koha/cataloguing/addbiblio.pl?fromserials=1&popup=1&suggestionid=<!--TMPL_VAR NAME="suggestionid"-->","AddBiblio",'width=700,height=400,toolbar=no,scrollbars=yes,status=yes');
83
84 }
85 </script>
86 <h1>
87         <!-- TMPL_IF name="ordnum" -->
88                 Modify order details (line #<!-- TMPL_VAR NAME="ordnum" -->)
89         <!-- TMPL_ELSE -->
90                 New order
91         <!-- /TMPL_IF -->
92                 <!-- TMPL_IF name="suggestionid" -->(defined from suggestion #<!-- TMPL_VAR NAME="suggestionid" -->)<!-- /TMPL_IF -->
93 </h1>
94         <div id="acqui_basket_summary">
95                 <h2>Basket Details</h2>
96                 <table>
97                 <tr><th>Basket Number:</th><td><!-- TMPL_VAR NAME="basketno" --></td></tr>
98                 <tr><th>Managed By:</th><td><!-- TMPL_VAR NAME="authorisedbyname" --></td></tr>
99                 <tr><th>Open On:</th><td><!-- TMPL_VAR NAME="creationdate" --></td></tr>
100                 <tr><th>For:</th><td>Supplier Id <!-- TMPL_VAR NAME="booksellerid" --></td></tr>
101                 <tr><th>Invoice Number:</th><td><!-- TMPL_VAR NAME="booksellerinvoicenumber" --></td></tr>
102                 <tr><th>Purchase Order Number:</th><td><!-- TMPL_VAR NAME="purchaseordernumber" --></td></tr>
103                 <!-- TMPL_IF name="closedate" --><tr><th>Closed On:</th><td> <!-- TMPL_VAR name="closedate" --></td></tr><!-- /TMPL_IF -->
104                 </table>
105         </div>
106
107 <div id="acqui_newbiblio_edit_catalogue">
108         <h2>catalogue details</h2>
109         <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" name="frusin">
110         <!-- TMPL_UNLESS name="existing" -->
111                 <input type="hidden" name="existing" value="no" >
112         <!-- /TMPL_UNLESS -->
113         <input type="hidden" name="ordnum" value="<!-- TMPL_VAR NAME="ordnum" -->" />
114         <input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" />
115         <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR NAME="booksellerid" -->" />
116         <input type="hidden" name="biblionumber" id="biblionumber"  value="<!-- TMPL_VAR NAME="biblionumber" -->" />
117         <input type="hidden" name="oldtype" value="<!-- TMPL_VAR NAME="itemtype" -->" />
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         
126         <p> 
127                 <label><b>Title *</b></label>
128                 
129                         <input type="text" size="20" name="title" id="title" value="<!-- TMPL_VAR NAME="title" -->" READONLY/>Auto filled
130         </p>
131         <!-- TMPL_IF name="biblionumber" -->
132         <p>
133                 <label>Author</label>
134                         <input type="hidden" size="20" name="author" value="<!-- TMPL_VAR NAME="author" -->" /><!-- TMPL_VAR NAME="author" -->
135         </p>
136         <p>
137                 <label> Publisher</label>
138                         <input type="hidden" size="20" name="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" /><!-- TMPL_VAR NAME="publishercode" -->
139         </p>
140         <p>
141                 <label>Copyright Date</label>
142                         <input type="hidden" size="20" name="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" /><!-- TMPL_VAR NAME="copyrightdate" -->
143                 
144         </p>
145         <p>
146                 <label>Format</label>
147                 <!-- TMPL_VAR NAME="itemtype" -->
148         </p>
149         <p>
150                 <label>ISBN</label>
151                         <input type="hidden" size="20" name="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" /><!-- TMPL_VAR NAME="isbn" -->
152                 
153         </p>
154         <p>
155                 <label>Series</label>
156                         <input type="hidden" size="20" name="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" /><!-- TMPL_VAR NAME="seriestitle" -->
157         </p>
158         <!--TMPL_ELSE-->
159         <!--TMPL_UNLESS NAME="suggestionid"--><p><a href="#" onClick="AddBiblio()">First Create a Biblio for this order</a></p><!--/TMPL_UNLESS-->
160         <!--/TMPL_IF-->
161                 
162         <h2>Accounting details</h2>
163                 <p>
164                 <label>Branch</label>
165                 <select name="branch">
166                 <!-- TMPL_LOOP name="branchloop" -->
167                         <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
168                 <!-- /TMPL_LOOP -->
169                 </select>
170         </p>
171                 <p>
172                         <label>Quantity</label>
173                         
174                                 <input type="text" size="20" name="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" onchange="update(this.form);" <!-- TMPL_IF name="close" -->readonly<!--/TMPL_IF--/>
175                 
176                 </p>
177                 <p>
178                         <label>Bookfund</label>
179                         <!-- TMPL_IF name="close" -->
180                                 <input type="hidden" size="20" name="bookfundid" value="<!-- TMPL_VAR NAME="bookfundid" -->" /><!-- TMPL_VAR NAME="bookfundname" -->
181                         <!-- TMPL_ELSE -->
182                                 <!-- TMPL_VAR NAME="CGIbookfund" -->
183                         <!--/TMPL_IF-->
184                 </p>
185                 Note: All figures are in local currency, except the suppliers list price which is indicated.Currency conversion is done automatically
186                 <!-- TMPL_IF NAME="gstreg" -->
187                 <p>
188                  <label> Applicable Tax rate</label>
189                 <input type="text" size="20" name="gstrate" value="<!--TMPL_VAR NAME="gstrate"-->" onchange="update(this.form)" />%
190                 </p>
191                 <!--/TMPL_IF-->
192                 <p>
193                         <label>Suppliers List Price</label>
194         
195                                 <input type="text" size="20" name="list_price" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="update(this.form)" <!-- TMPL_IF name="close" -->readonly<!--/TMPL_IF-->/><!-- TMPL_VAR NAME="currency" -->
196                         
197                 </p>
198                 <p>
199                         <label>Replacement Cost </label>
200                                 <input type="text" size="20" name="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" <!-- TMPL_IF name="close" -->readonly<!--/TMPL_IF--> />
201                         
202                 </p>
203                 <p>
204                         <label>Discount Applied</label>
205                         <input type="text" size="20" name="discount" value="<!-- TMPL_VAR NAME="discount" -->" onchange="update(this.form)" <!-- TMPL_IF name="close" -->readonly <!--/TMPL_IF--> />%
206                 </p>
207                 <p>
208                         <label>Budgeted Cost</label>
209                         <input type="text" size="20" name="ecost" value="<!-- TMPL_VAR NAME="ecost" -->" <!-- TMPL_IF name="close" -->readonly <!--/TMPL_IF--> />
210                 </p>
211                 <!--TMPL_IF NAME="gstreg"-->
212                 <p>
213                         <label>Budgeted GST</label>
214                         <input type="text" size="20" name="GST" value="<!-- TMPL_VAR NAME="gst" -->" <!-- TMPL_IF name="close" -->readonly <!--/TMPL_IF--> />
215                 </p>
216                 <!--/TMPL_IF-->
217                 <p>
218                         <label><b>BUDGETED TOTAL</b></label>
219                         <input type="text" size="20" name="total" value="<!-- TMPL_VAR name="total"-->" <!-- TMPL_IF name="close" -->readonly <!--/TMPL_IF--> />
220                 </p>
221                 <p>
222                         <label>Unit Cost</label>
223                         <input type="text" size="20" name="unitprice" value="<!-- TMPL_VAR name="unitprice"-->" <!-- TMPL_IF name="close" -->readonly <!--/TMPL_IF--> /><!--TMPL_IF NAME="gstreg"-->includes any applicable tax less any discount<!--/TMPL_IF-->
224                 </p>
225                 <p>
226                         <label>Purchase Order No </label>
227                         <input type="text" size="20" name="purchaseordernumber"  value="<!-- TMPL_VAR name="purchaseordernumber" -->" <!-- TMPL_IF name="close" -->readonly <!--/TMPL_IF--> /> (using recommended!)
228                 </p>
229                 <p>
230                         <label>Notes</label>
231                         <input type="text" size="20" name="notes" value="<!-- TMPL_VAR NAME="notes" -->" />
232                 </p>
233                 <p>The 2 following fields are available for your own usage. They can be useful for stat purposes</p>
234                 <p>
235                         <label>Sort field 1</label>
236                         <!-- TMPL_IF Name="CGIsort1" -->
237                                 <!-- TMPL_VAR Name="CGIsort1" -->
238                         <!-- TMPL_ELSE -->
239                                 <input type="text" size="20" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" />
240                         <!--/TMPL_IF -->
241                 </p>
242                 <p>
243                         <label>Sort field 2</label>
244                         <!-- TMPL_IF Name="CGIsort2" -->
245                                 <!-- TMPL_VAR Name="CGIsort2" -->
246                         <!-- TMPL_ELSE -->
247                                 <input type="text" size="20" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" />
248                         <!--/TMPL_IF -->
249                 </p>
250                 <p>
251                         <input type="button" value="OK" onclick="check(this.form)" />
252                 </p>
253         </form>
254 <!-- TMPL_INCLUDE name="intranet-bottom.inc" -->