A new acquisition to handle multiple tax values, and marc creation of biblios and...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / acqui / parcel.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Recieve <!-- 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 <script type="text/javascript">
6 function docalculate(){
7   //collect values
8 received=document.getElementsByName('received');
9  actual=document.getElementsByName('actual');
10  freight=document.getElementsByName('freight');
11 discounts=document.getElementsByName('discount');
12 gstrate=document.getElementsByName('gstrate');
13 totalreceived=0;
14 totalactual=0;
15 totalfreight=0;
16 totaldiscount=0;
17 totalgst=0;
18         for (var s=0; s<received.length; s++){
19                 receivedvalue =received.item(s).value;  
20                 totalreceived +=(receivedvalue*1);
21                 thisactual =actual.item(s).value*receivedvalue;
22                 totalactual +=thisactual;
23                 totalfreight +=freight.item(s).value*receivedvalue;
24                 thisdiscount =thisactual*discounts.item(s).value/100;
25                 totaldiscount +=thisdiscount;
26                 totalgst +=(thisactual - thisdiscount)*gstrate.item(s).value/100;
27         }
28  document.f.totalreceived.value=totalreceived*1;
29  document.f.totalactual.value=totalactual;
30  document.f.totalfreight.value=totalfreight*1;
31 document.f.actualdiscount.value=totaldiscount;
32 includesgst=parseInt(document.f.incgst.value);
33  if(includesgst>0){
34  document.f.actualgst.value="-inc.-";
35  }else{
36  document.f.actualgst.value=totalgst;
37 }
38 document.f.freightgst.value=totalfreight*document.f.freightgstrate.value/100;
39 disct=0;
40  if ( document.f.actualgst.value>0){
41 disct= document.f.actualgst.value;
42 }
43 document.f.actualtotal.value=totalactual + -totaldiscount +disct*1;
44 document.f.actualfreight.value=totalfreight+ document.f.freightgst.value*1;
45 document.f.invoicetotal.value=document.f.actualfreight.value*1 +document.f.actualtotal.value*1;
46 <!--TMPL_IF NAME="invcurrency"-->
47 document.f.localtotal.value=document.f.invoicetotal.value*<!--TMPL_VAR NAME="currencyrate"-->;
48 <!--/TMPL_IF-->
49   return true;
50 }
51 function updatetotal(){
52 document.f.actualtotal.value= document.f.totalactual.value - document.f.actualdiscount.value + document.f.actualgst.value*1;
53 document.f.invoicetotal.value=document.f.actualfreight.value*1+document.f.actualtotal.value*1;
54 <!--TMPL_IF NAME="invcurrency"-->
55 document.f.localtotal.value=document.f.invoicetotal.value*<!--TMPL_VAR NAME="currencyrate"-->;
56 <!--/TMPL_IF-->
57   return true;
58 }
59 function checkform(){
60 if (document.f.invoice.value==""){
61 alert ("You need a suppliers Invoice number!");
62 return false;
63 }
64 if ( document.f.totalreceived.value==0 || document.f.totalreceived.value==""){
65 alert ("no items entered as received !");
66 return false;
67 }
68 document.f.submit();
69 }
70 </script>
71     <h1>
72                  Orders being recieved from <!-- TMPL_VAR NAME="name" -->
73       
74     </h1>
75  <form action="finishreceive.pl" method="post" name="orderform" id="f">
76 <input type="hidden" name="supplierid" value="<!--TMPL_VAR NAME="supplierid"-->" />
77 <div >
78 <p>Received By: <!-- TMPL_VAR NAME="user" --></p>
79 <p>   Suppliers Invoice No: <input type="text" name="invoice" value="<!-- TMPL_VAR NAME="invoice" -->" />
80     
81     Date received:  <input type="text" name="datereceived" value="<!-- TMPL_VAR NAME="date" -->" /></p>
82 </div>
83 <div >
84     <h2>Recieve list</h2>
85    <input type="hidden" name="incgst" value="<!--TMPL_VAR NAME="incgst"-->" />
86   <input type="hidden" name="currencyrate" value="<!--TMPL_VAR NAME="currencyrate"-->" />
87     <table >
88         <tr>Rate of tax used for P&P:<input type="text" size="2" name="freightgstrate" value="<!--TMPL_VAR NAME="gstrate"-->" />%</td>
89         <tr> <th align="left">Basket/Order</th>
90              <th class="acquisition">ISBN</th>
91             <th class="acquisition">Title</th>
92             <th class="acquisition">Price</th>
93           <th class="acquisition">Actual <!--TMPL_VAR NAME="invcurrency"--></th>
94             <th class="acquisition">P&amp;P <!--TMPL_VAR NAME="invcurrency"--></th>
95             <th class="acquisition">Qty</th>
96          <th class="acquisition">Received</th>
97             
98         </tr>
99         <!-- TMPL_LOOP NAME="loop_orders" -->
100             <tr><input type="hidden" name="ordernumber" value="<!-- TMPL_VAR NAME="ordernumber" -->" />
101         <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
102         <input type="hidden" name="title" value="<!-- TMPL_VAR NAME="title" -->" />
103                 <td ><!-- TMPL_VAR NAME="basketno" -->/<!-- TMPL_VAR NAME="ordernumber" --></td>
104                 <td><!-- TMPL_VAR NAME="isbn" --></td>
105                 <td><!-- TMPL_VAR NAME="title" --></td>
106                 <td align="right"><!-- TMPL_VAR NAME="rrp" --></td>
107                 <td align="right"> <input type="text" size="2" name="actual" value="<!-- TMPL_VAR NAME="actualrrp" -->" onChange="docalculate();"/></td>
108           <td align="right"> <input type="text" size="2" name="freight" value="0.00" onChange="docalculate();"/></td>
109                 <td><!-- TMPL_VAR NAME="quantity" --></td>
110         <td> <input type="text" size="2" name="received" value="<!-- TMPL_VAR NAME="toreceive" -->" onChange="docalculate();"/></td>
111                 <input type="hidden" name="discount" value="<!--TMPL_VAR NAME="discount"-->" />
112         <input type="hidden" name="gstrate" value="<!--TMPL_VAR NAME="gst"-->" />
113             </tr>
114         <!-- /TMPL_LOOP -->
115         <tr>
116             <td ></td>
117             <td></td>
118             <th class="acquisition" align="right">SubTotals</th>
119             <td align="right"><b><!-- TMPL_VAR NAME="totalprice" --></b></td>
120         <td align="right"><b><input type="text" name="totalactual" size="2" value="<!-- TMPL_VAR NAME="totalactual" -->" /></b></td>
121             <td align="right"><b><input type="text" size="2" name="totalfreight" /></b></th>
122             <td ><b><!-- TMPL_VAR NAME="totalquantity" --></b></td>
123          <td ><b><input type="text" size="2" name="totalreceived" value="<!-- TMPL_VAR NAME="totaltoreceive" -->" READONLY /></b></td>
124           
125         </tr>
126          <!--TMPL_IF NAME="totaldiscount"-->    <tr>
127            <td >&nbsp;</td>
128             <td>&nbsp;</td>
129   <th class="acquisition" align="right">- Discount</th>
130             <td align="right"><b><!-- TMPL_VAR NAME="totaldiscount" --></b></td>
131         <td align="right"><b><input type="text" name="actualdiscount" size="2" value="<!-- TMPL_VAR NAME="actualdiscount" -->" onChange="updatetotal();"/></b></td>
132         </tr><!--/TMPL_IF-->
133      <!--TMPL_IF NAME="gstreg"-->    <tr>
134            <td >&nbsp;</td>
135             <td>&nbsp;</td>
136   <th class="acquisition" align="right">Tax</th>
137             <td align="right"><b><!-- TMPL_VAR NAME="totalgst" --></b></td>
138         <td align="right"><b><input type="text" name="actualgst" size="2" value="<!-- TMPL_VAR NAME="actualgst" -->"/></b></td>
139         <td align="right"><b><input type="text" name="freightgst" size="2"  /></td></b>
140         </tr><!--/TMPL_IF-->
141         <tr>
142          <td >&nbsp;</td>
143             <td>&nbsp;</td>
144             <th class="acquisition" align="right">Totals</th>
145             <td align="right"><b><!-- TMPL_VAR NAME="total" --></b></td>
146         <td align="right"><b><input type="text" name="actualtotal" size="2" value="<!-- TMPL_VAR NAME="actualtotal" -->"   onChange="updatetotal();"/></b></td>
147         <td align="right"><b><input type="text" name="actualfreight" size="2"  onChange="updatetotal();"/></b></td>
148         </tr>
149         <tr>
150         <td >&nbsp;</td>
151         <td >&nbsp;</td>
152             <th class="acquisition" align="right" colspan="5">Invoice Total <!--TMPL_VAR NAME="invcurrency"--></th>         
153         <td ><b><input type="text" name="invoicetotal" size="4"  /></b></td>
154         </tr>
155         <!--TMPL_IF NAME="invcurrency"-->
156         <tr>
157         <td >&nbsp;</td>
158         <td >&nbsp;</td>
159             <th class="acquisition" align="right" colspan="5">Invoice Total </th>         
160         <td ><b><input type="text" name="localtotal" size="4"  /></b></td>
161         </tr>
162         <!--/TMPL_IF-->
163     </table>
164 Note: P&P is per item. If you have a total freight fill the Total P&P only.!
165         <p><input type="button" value="Receive" onClick="checkform();" /></p>
166     </form>
167 </div>
168 <script>
169 updatetotal();
170 </script>
171 <!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
172