Merge remote branch 'kc/new/bug_5949' into kcmaster
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tmpl
index cdf2e30..0eacf19 100644 (file)
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<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>
+<title>Koha &rsaquo; Acquisitions &rsaquo; Basket <!-- TMPL_VAR NAME="basketno" --> &rsaquo; <!-- TMPL_IF name="ordernumber" -->Modify order details (line #<!-- TMPL_VAR NAME="ordernumber" -->)<!-- TMPL_ELSE -->New order<!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+
+<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
+<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/additem.js"></script>
 <script type="text/javascript">
 //<![CDATA[
-function update(f){
-//collect values
-quantity=f.quantity.value
-if (quantity ==0) {
-    alert("Quantity must be >0");
-}
-discount=f.discount.value
-listinc=parseInt(f.listinc.value)
-currency=f.currency.value
-applygst=parseInt(f.applygst.value)
-listprice=f.list_price.value
-//  rrp=f.rrp.value
-//  ecost=f.ecost.value  //budgetted cost
-//  GST=f.GST.value
-//  total=f.total.value
-//make useful constants out of the above
-exchangerate=f.elements[currency].value      //get exchange rate
-gst_on=(!listinc && applygst);
-//do real stuff
-rrp=listprice*exchangerate;
-ecost=rrp*(100-discount)/100
-GST=0;
-if (gst_on){
-    rrp=rrp*(1+<!-- TMPL_VAR NAME="gstrate" -->);
-    GST=ecost*(<!-- TMPL_VAR NAME="gstrate" -->);
-}
+actTotal = "";
 
-total=(ecost+GST)*quantity
+function Check(ff) {
+    var ok=0;
+    var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
 
-f.rrp.value=rrp;
-f.ecost.value=ecost;
-f.total.value=total;
-<!-- TMPL_IF NAME="GST"-->
-f.GST.value=GST;
-<!-- /TMPL_IF -->
-return true;
-}
+    _alertString +="-------------------------------------------------------------------\n\n";
 
-function messenger(X,Y,etc){   // FIXME: unused?
-    win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
-    win.focus();
-    win.document.close();
-    win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size='2'><p><br />");
-    win.document.write(etc);
-    win.document.write("<center><form><input type=button onclick='self.close()' value='Close'></form></center>");
-    win.document.write("</font></body></html>");
-}
+    if ( isNull(ff.title,1)  &&  isNull(ff.entertitle,1)   ){
+        ok=1;
+                    _alertString += "\n- " + _("Title cannot be empty");
+    }
+    
+    if(isNull(ff.budget_id,1)){
+               ok=1;
+                                       _alertString += "\n- "+ _("You must select a budget");
+    }
 
-function check(f) {
-quantity=f.quantity.value
-title=f.title.value
-if (title == "") {
-    alert("Title can't be empty");
-    return false;
-}
-if (quantity ==0) {
-    alert("Quantity must be >0");
+    if (!(isNum(ff.quantity,0))){
+        ok=1;
+                    _alertString += "\n- " + _("Quantity must be greater than '0'");
+    }
+
+    if (!(isNum(ff.listprice,0))){
+        ok=1;
+                    _alertString += "\n- " + _("Vendor price must be a number");
+    }
+
+    if (!(isNum(ff.total,0))){
+        ok=1;
+                    _alertString += "\n- " + _("Total must be a number");
+    }
+
+    if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
+        ok=1;
+        _alertString += "\n- " + _("Order total (") + ff.total.value +
+            _(") exceeds budget available (") + actTotal+")";
+    }
+
+    if ( ff.field_value ) {
+        var empty_item_mandatory = 0;
+        for (i = 0; i < ff.field_value.length; i++) {
+            //alert("i = " + i + " => " + ff.kohafield[i] );
+            if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
+                empty_item_mandatory++;
+            }
+        }
+        if (empty_item_mandatory > 0) {
+            ok = 1;
+            _alertString +=
+                "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
+        }
+    }
+
+if (ok) {
+        alert(_alertString);
     return false;
+    }
+
+ff.submit();
+
 }
-    document.frusin.submit();
-}
+
+$(document).ready(function() 
+    {
+        //We apply the fonction only for modify option
+        <!--TMPL_IF NAME="quantityrec"-->
+        $('#quantity').blur(function() 
+        {
+            // if user decreases the quantity
+            if($(this).val() < <!-- TMPL_VAR name="quantityrec" -->) 
+            {
+                alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
+                return true;
+            } 
+            else 
+            {
+                // if user increases the quantity
+                alert(_("You can't add a new item, please create a new order line"));
+                // and we replace the original value
+                $(this).val(<!-- TMPL_VAR name="quantityrec" -->)
+                return false;
+            }
+        });
+        <!-- /TMPL_IF -->
+        
+        $('#showallbudgets').click(function() {
+            if ( $('#budget_id .b_inactive').is(":visible") )
+            {
+            $('#budget_id .b_inactive').hide();
+            }
+            else {
+            $('#budget_id .b_inactive').show();
+            }
+        });
+    });
 //]]>
 </script>
 </head>
 <body>
+
 <!-- TMPL_INCLUDE NAME="header.inc" -->
 <!-- TMPL_INCLUDE NAME="acquisitions-search.inc" -->
 
-<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>
+<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" -->">Basket <!-- TMPL_VAR NAME="basketno" --></a> &rsaquo; <!-- TMPL_IF name="ordernumber" -->Modify order details (line #<!-- TMPL_VAR NAME="ordernumber" -->)<!-- TMPL_ELSE -->New order<!-- /TMPL_IF --></div>
 
 <div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-       <div id="yui-main">
-       <div class="yui-b">
-       
-<h1>
-    <!-- TMPL_IF name="ordnum" -->
-        Modify order details (line #<!-- TMPL_VAR NAME="ordnum" -->)
+
+<div id="bd">
+    <div id="yui-main">
+    <div class="yui-b">
+
+<h2>
+    <!-- TMPL_IF name="ordernumber" -->
+        Modify order line
     <!-- TMPL_ELSE -->
         New order
     <!-- /TMPL_IF -->
         <!-- TMPL_IF name="suggestionid" -->(defined from suggestion #<!-- TMPL_VAR NAME="suggestionid" -->)<!-- /TMPL_IF -->
-</h1>
+</h2>
 
 <!-- TMPL_IF name="basketno" -->
-<div id="basket-details">Basket Details
-  <ul>  <li>Basket number: <!-- TMPL_VAR NAME="basketno" --></li>
-    <li>Managed by: <!-- TMPL_VAR NAME="authorisedbyname" --></li>
-    <li>Open on: <!-- TMPL_VAR NAME="creationdate" --></li>
-    <li>For vendor ID: <!-- TMPL_VAR NAME="booksellerid" --></li>
-    <li>Invoice number: <!-- TMPL_VAR NAME="booksellerinvoicenumber" --></li>
-    <!-- TMPL_IF name="closedate" --><li>Closed on: <!-- TMPL_VAR name="closedate" --></li><!-- /TMPL_IF --></ul>
-</div>
+    <div id="acqui_basket_summary"  class="yui-g">
+       <fieldset class="rows">
+        <legend>Basket details</legend>
+               <ol>
+        <!-- TMPL_IF NAME="basketnote" --><li><span class="label">Internal note:</span> <!-- TMPL_VAR NAME="basketnote" --></li><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="basketbooksellernote" --><li><span class="label">Vendor note:</span> <!-- TMPL_VAR NAME="basketbooksellernote" --></li><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="basketcontractno" -->
+            <li><span class="label">Contract number: </span><!-- TMPL_VAR NAME="basketcontractno" --></li>
+            <li><span class="label">Contract name:</span> <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></li>
+        <!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="authorisedbyname" --><li><span class="label">Managed by:</span>  <!-- TMPL_VAR NAME="authorisedbyname" --></li><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="creationdate" --><li><span class="label">Open on:</span>  <!-- TMPL_VAR NAME="creationdate" --></li><!-- /TMPL_IF -->
+        <!-- TMPL_IF name="closedate" -->
+        <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
+        <li><span class="label">Closed on:</span>  <!-- TMPL_VAR name="closedate" --></li>
+        <!-- TMPL_IF name="basketgroups" -->
+            <li>Basketgroup: <select id="basketgroupid" name="basketgroupid">
+                <!-- TMPL_LOOP name="basketgroups" -->
+                    <!-- TMPL_IF name="default" -->
+                    <option value="<!-- TMPL_VAR name="id" -->" selected="selected"><!-- TMPL_VAR name="name" --></option>
+                    <!-- TMPL_ELSE -->
+                    <option value="<!-- TMPL_VAR name="id" -->"><!-- TMPL_VAR name="name" --></option>
+                    <!-- /TMPL_IF -->
+                <!-- /TMPL_LOOP -->
+                </select>
+                <input type="hidden" id="basketno" value="<!-- TMPL_VAR name="basketno" -->" name="basketno" />
+                <input type="hidden" value="mod_basket" name="op" />
+                <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR name="booksellerid" -->" />
+            </li>
+               <fieldset class="action"><input type="submit" value="Change basketgroup" /></fieldset>
+        </form>
+        <!-- /TMPL_IF -->
+        <!-- /TMPL_IF -->
+                       </ol>
+</fieldset>
+    </div>
 <!-- /TMPL_IF -->
 
-<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" name="frusin">
+<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
+
 <fieldset class="rows">
-        <legend>Catalog details</legend>
+        <legend>
+            Catalog details
+            <!-- TMPL_IF name="biblionumber" -->
+                <span><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!--TMPL_VAR NAME= "biblionumber"-->"> Edit record</a></span>
+            <!-- /TMPL_IF -->
+        </legend>
         <!-- TMPL_UNLESS name="existing" -->
-               <input type="hidden" name="existing" value="no" />
+        <input type="hidden" name="existing" value="no" />
         <!-- /TMPL_UNLESS -->
-        <input type="hidden" name="ordnum" value="<!-- TMPL_VAR NAME="ordnum" -->" />
+        <input type="hidden" name="ordernumber" value="<!-- TMPL_VAR NAME="ordernumber" -->" />
         <input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" />
         <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR NAME="booksellerid" -->" />
         <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
         <input type="hidden" name="biblioitemnumber" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
-        <input type="hidden" name="oldtype" value="<!-- TMPL_VAR NAME="itemtype" -->" />
         <input type="hidden" name="discount" value="<!-- TMPL_VAR NAME="discount" -->" />
         <input type="hidden" name="listinc" value="<!-- TMPL_VAR NAME="listincgst" -->" />
-        <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />
+<!--        <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />-->
         <input type="hidden" name="applygst" value="<!-- TMPL_VAR NAME="gstreg" -->" />
+        <input type="hidden" name="invoiceincgst" value="<!-- TMPL_VAR NAME="invoiceincgst" -->" />
+        <input type="hidden" name="gstrate" value="<!-- TMPL_VAR NAME="gstrate" -->" />
         <input type="hidden" name="suggestionid" value="<!-- TMPL_VAR NAME="suggestionid" -->" />
+        <input type="hidden" name="import_batch_id" value="<!-- TMPL_VAR name="import_batch_id" -->" />
+
         <!-- TMPL_LOOP NAME="loop_currencies" -->
-            <input type="hidden" name="<!-- TMPL_VAR NAME="currency" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
+            <input type="hidden" id="<!-- TMPL_VAR NAME="currcode" -->"  name="<!-- TMPL_VAR NAME="currcode" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
         <!-- /TMPL_LOOP -->
         <ol><li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Title</span>
-                <input type="hidden" size="20" name="title" value="<!-- TMPL_VAR NAME="title" -->" /> <span class="title"><!-- TMPL_VAR NAME="title" escape="html" --></span>
+            <span class="label">Title</span>
+                <input type="hidden" size="50" name="title" value="<!-- TMPL_VAR NAME="title" ESCAPE="HTML" -->" /> <span class="title"><!-- TMPL_VAR NAME="title" ESCAPE="html" --></span>
             <!-- TMPL_ELSE -->
             <label for="entertitle" class="required">Title: </label>
-                <input type="text" id="entertitle" size="20" name="title" value="<!-- TMPL_VAR NAME="title" -->" />
+                <input type="text" id="entertitle" size="50" name="title" value="<!-- TMPL_VAR NAME="title" ESCAPE="html" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Author: </span>
-                <input type="hidden" size="20" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" /><!-- TMPL_VAR NAME="author" -->
+            <span class="label">Author: </span>
+                <input type="hidden" size="50" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" /><!-- TMPL_VAR NAME="author" -->
             <!-- TMPL_ELSE -->
             <label for="author">Author: </label>
-                <input type="text" size="20" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" />
+                <input type="text" size="50" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Publisher: </span>
-                <input type="hidden" size="20" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" /><!-- TMPL_VAR NAME="publishercode" -->
+            <span class="label">Publisher: </span>
+                <input type="hidden" size="50" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" /><!-- TMPL_VAR NAME="publishercode" -->
             <!-- TMPL_ELSE -->
             <label for="publishercode"> Publisher: </label>
-                <input type="text" size="20" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" />
+                <input type="text" size="50" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Copyright date: </span>
-                <input type="hidden" size="20" name="copyrightdate" id="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" /><!-- TMPL_VAR NAME="copyrightdate" -->
+            <span class="label">Publication year: </span>
+                <input type="hidden" size="10" name="publicationyear" id="publicationyear" value="<!-- TMPL_VAR NAME="publicationyear" -->" /><!-- TMPL_VAR NAME="publicationyear" -->
             <!-- TMPL_ELSE -->
-            <label for="copyrightdate">Copyright date: </label>
-                <input type="text" size="20" name="copyrightdate" id="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" />
+            <label for="publicationyear">Publication year: </label>
+                <input type="text" size="10" name="publicationyear" id="publicationyear" value="<!-- TMPL_VAR NAME="publicationyear" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Item type: </span>
-                <input type="hidden" size="20" name="itemtype" id="itemtype" value="<!-- TMPL_VAR NAME="itemtype" -->" /><!-- TMPL_VAR NAME="itemtype_desc" -->
-                       <!-- TMPL_ELSE -->
-            <label for="format">Item type: </label>
-            <select name="format" id="format">
-            <!-- TMPL_LOOP name="itypeloop" -->
-                               <option value="<!-- TMPL_VAR NAME="itemtype" -->"><!-- TMPL_VAR NAME="desc" --></option>
-            <!-- /TMPL_LOOP -->
-            </select>
-                        <!-- /TMPL_IF -->
-        </li>
-        <li>
-            <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">ISBN: </span>
-                <input type="hidden" size="20" name="ISBN" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" /><!-- TMPL_VAR NAME="isbn" -->
+            <span class="label">ISBN: </span>
+                <input type="hidden" size="50" name="isbn" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" /><!-- TMPL_VAR NAME="isbn" -->
             <!-- TMPL_ELSE -->
             <label for="ISBN">ISBN: </label>
-                <input type="text" size="20" name="ISBN" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" />
+                <input type="text" size="50" name="isbn" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Series: </span>
-                <input type="hidden" size="20" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" /><span class="title"><!-- TMPL_VAR NAME="seriestitle" --></span>
+            <span class="label">Series: </span>
+                <input type="hidden" size="50" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" /><!-- TMPL_VAR NAME="seriestitle" -->
             <!-- TMPL_ELSE -->
             <label for="series">Series: </label>
-                <input type="text" size="20" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" />
+                <input type="text" size="50" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" />
             <!-- /TMPL_IF -->
         </li>
-        <li>
-            <label for="branch">Library: </label>
-            <select name="branch" id="branch">
-            <!-- TMPL_LOOP name="branchloop" -->
-                <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
-                               <!-- TMPL_ELSE -->
-                               <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
-                               <!-- /TMPL_IF -->
-            <!-- /TMPL_LOOP -->
-            </select>
-        </li>
-               </ol>
+        </ol>
     </fieldset>
-       <fieldset class="rows">
+    <!-- TMPL_IF name="items" -->
+    <fieldset class="rows">
+        <legend>Item</legend>
+        <!-- TMPL_IF name="NoACQframework" -->
+            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
+        <!-- /TMPL_IF -->
+
+        <!-- TMPL_LOOP NAME="items" -->
+        <div id="outeritemblock">
+        <div id="itemblock">
+            <ol><!-- TMPL_LOOP NAME="iteminformation" --><li>
+                <div class="subfield_line" style="<!-- TMPL_VAR NAME='hidden' -->;" id="subfield<!-- TMPL_VAR NAME='serialid' --><!-- TMPL_VAR NAME='countitems' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->">
+
+                    <label><!-- TMPL_VAR NAME="subfield" --> - <!-- TMPL_IF name="mandatory" --><b><!-- /TMPL_IF --><!-- TMPL_VAR NAME="marc_lib" --><!-- TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF --></label>
+                    <!-- TMPL_VAR NAME="marc_value" -->
+                    <input type="hidden" name="itemid" value="1" />
+                    <input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
+                    <input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->" />
+                    <input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" />
+                    <input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->" />
+                    <!-- TMPL_IF NAME="ITEM_SUBFIELDS_ARE_NOT_REPEATABLE" -->
+                        <span class="buttonPlus" onclick="CloneSubfield('subfield<!-- TMPL_VAR NAME='serialid' --><!-- TMPL_VAR NAME='countitems' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->')">+</span>
+                    <!-- /TMPL_IF -->
+
+                </div></li>
+            <!-- /TMPL_LOOP-->
+            </ol>
+            <a style="cursor: pointer; color: grey; font-size: 180%;" onclick="cloneItemBlock('itemblock<!-- TMPL_VAR name="itemBlockIndex" -->')">+</a>
+            <a style="display:none; cursor: pointer; color: grey; font-size: 180%;" onclick="deleteItemBlock('itemblock<!-- TMPL_VAR name="itemBlockIndex" -->')">-</a>
+        </div><!-- /iteminformation -->
+        </div>
+
+        <!--/TMPL_LOOP--> <!-- /items -->
+    </fieldset>
+    <!-- /TMPL_IF --> <!-- items -->
+    <fieldset class="rows">
         <legend>Accounting Details</legend>
-               <ol>
+        <ol>
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <span class="label required">Quantity: </span>
-                    <input type="hidden" size="20" id="quantity" name="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" /><!-- TMPL_VAR NAME="quantity" -->
+            <span class="label required">Quantity: </span>
+                    <input type="hidden" size="20" name="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" /><!-- TMPL_VAR NAME="quantity" -->
                 <!-- TMPL_ELSE -->
                 <label class="required" for="quantity">Quantity: </label>
-                    <input type="text" size="20" id="quantity" name="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" onchange="update(this.form);" />
+                    <!-- TMPL_IF name="items" -->
+                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" onchange="calcNeworderTotal();" />
+                    <!-- TMPL_ELSE -->
+                        <input type="text" size="20" id="quantity" name="quantity" value="<!-- TMPL_VAR name="quantityrec" -->" onchange="calcNeworderTotal();" />
+                    <!-- /TMPL_IF -->
                 <!--/TMPL_IF-->
+                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
+                <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
             </li>
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <span class="label">Fund: </span>
-                    <input type="hidden" size="20" name="bookfund" id="bookfund" value="<!-- TMPL_VAR NAME="bookfundid" -->" /><!-- TMPL_VAR NAME="bookfundname" -->
+            <span class="label">Fund: </span>
+                    <input type="hidden" size="20" name="budget_id" id="budget_id" value="<!-- TMPL_VAR NAME="budget_id" -->" /><!-- TMPL_VAR NAME="Budget_name" -->
                 <!-- TMPL_ELSE -->
-                <label for="bookfund">Fund: </label>
-                    <!-- TMPL_VAR NAME="CGIbookfund" -->
+                <label for="budget_id">Fund: </label>
+                <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
+                <!-- TMPL_LOOP NAME="budget_loop" -->
+                    <!-- TMPL_IF NAME="b_sel" -->
+                        <option value="<!-- TMPL_VAR NAME='b_id' -->" selected="selected"><!-- TMPL_VAR NAME="b_txt" --></option>
+                    <!-- TMPL_ELSE -->
+                        <!-- TMPL_IF NAME="b_active" --><option value="<!-- TMPL_VAR NAME='b_id' -->"><!-- TMPL_VAR NAME="b_txt" --></option>
+                        <!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME='b_id' -->" class="b_inactive" style="display : none;"><!-- TMPL_VAR NAME="b_txt" --></option>    
+                        <!-- /TMPL_IF -->
+                    <!-- /TMPL_IF -->
+                <!-- /TMPL_LOOP -->
+                </select>
+                <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
+                <input type="checkbox" id="showallbudgets" />
                 <!--/TMPL_IF-->
             </li>
+               <li>
+                <!-- TMPL_IF name="close" -->
+                       <span class="label">Currency: </span>
+                       <input type="hidden" size="10" name="currency" id="currency" value="<!-- TMPL_VAR NAME="currency" -->" /><!-- TMPL_VAR NAME="currency" -->
+                <!-- TMPL_ELSE -->
+                       <label for="currency">Currency:</label>
+                       <select name="currency" id="currency" onchange="calcNeworderTotal();">
+                       <!-- TMPL_LOOP name="loop_currencies" -->
+                       <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="currcode" -->" selected="selected"><!-- TMPL_VAR name="currcode" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="currcode" -->"><!-- TMPL_VAR name="currcode" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP -->
+                       </select>
+               <!-- /TMPL_IF-->
+                </li>
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <span class="label">Vendor price: </span>
-                    <input type="hidden" size="20" name="list_price" id="list_price" value="<!-- TMPL_VAR NAME="listprice" -->" /><!-- TMPL_VAR NAME="listprice" -->
+            <span class="label">Vendor price: </span>
+                    <input type="hidden" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" /><!-- TMPL_VAR NAME="listprice" -->
                 <!-- TMPL_ELSE -->
-                <label for="list_price">Vendor price: </label>
-                    <input type="text" size="20" name="list_price" id="list_price" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="update(this.form)" />
+                <label for="listprice">Vendor price: </label>
+                    <input type="text" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="calcNeworderTotal()" />
                 <!--/TMPL_IF-->
             </li>
+            <!-- TMPL_UNLESS NAME="close" -->
             <li>
+                    <label for="uncertainprice">Uncertain price: </label>
+                    <!--TMPL_IF NAME="uncertainprice" -->
+                    <input type="checkbox" name="uncertainprice"  id="uncertainprice" value="1" checked="checked" />
+                    <!-- TMPL_ELSE -->
+                    <input type="checkbox" name="uncertainprice" id="uncertainprice" value="1" />
+                <!--/TMPL_IF-->
+            </li>
+            <!-- /TMPL_UNLESS -->
+                       <li>
                 <!-- TMPL_IF name="close" -->
-                       <span class="label">Replacement cost: </span>
+            <span class="label">Replacement cost: </span>
                     <input type="hidden" size="20" name="rrp" id="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" /><!-- TMPL_VAR NAME="rrp" -->
                 <!-- TMPL_ELSE -->
-                <label for="rrp">Replacement cost : </label>
-                    <input type="text" size="20" name="rrp" id="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" />
+                <label for="rrp">Replacement cost: </label>
+                    <input type="text" size="20" name="rrp" id="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" /> (adjusted for <!-- TMPL_VAR NAME="cur_active" -->)
                 <!--/TMPL_IF-->
             </li>
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <label for="ecost">Budgeted cost: </label>
+            <label for="ecost">Budgeted cost: </label>
                     <input type="text" size="20" name="ecost" id="ecost" value="<!-- TMPL_VAR NAME="ecost" -->" readonly="readonly"  />
                 <!-- TMPL_ELSE -->
                 <label for="ecost">Budgeted cost: </label>
                     <input type="text" size="20" name="ecost" id="ecost" value="<!-- TMPL_VAR NAME="ecost" -->" />
                 <!--/TMPL_IF-->
+                <!-- TMPL_IF name="discount_2dp" -->  (adjusted for <!-- TMPL_VAR name="discount_2dp" -->% discount)  <!--/TMPL_IF-->
+
             </li>
             <!-- TMPL_IF NAME="GST"-->
             <li>
-                               <!-- TMPL_IF name="close" -->
-                       <label for="GST">Budgeted GST: </label>
-                <input type="text" id="" size="20" name="GST" value="" id="GST" readonly="readonly" />
-                               <!-- TMPL_ELSE -->
+                <!-- TMPL_IF name="close" -->
+            <label for="GST">Budgeted GST: </label>
+                <input type="text" id="" size="20" name="gst" value="" id="GST" readonly="readonly" />
+                <!-- TMPL_ELSE -->
                 <label for="GST">Budgeted GST: </label>
-                <input type="text" size="20" name="GST" id="GST" value="" />
-                               <!--/TMPL_IF-->
+                <input type="text" size="20" name="gst" id="GST" value="" />
+                <!--/TMPL_IF-->
             </li>
             <!-- /TMPL_IF -->
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <label for="total">Total: </label>
-                               <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" readonly="readonly" />
-                               <!-- TMPL_ELSE -->
+            <label for="total">Total: </label>
+                <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" readonly="readonly" />
+                <!-- TMPL_ELSE -->
                 <label for="total">Total: </label>
-                <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" />
-                               <!--/TMPL_IF-->
+                <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" /> (budgeted cost * quantity)
+                <!--/TMPL_IF-->
             </li>
             <li>
-                               <!-- TMPL_IF name="close" -->
-                       <label for="cost">Actual cost: </label>
+                <!-- TMPL_IF name="close" -->
+            <label for="cost">Actual cost: </label>
                 <input type="text" id="cost" size="20" name="cost" value="<!-- TMPL_VAR name="ecost"-->" readonly="readonly" />
-                               <!-- TMPL_ELSE -->
+                <!-- TMPL_ELSE -->
                 <label for="cost">Actual cost: </label>
                 <input type="text" id="cost" size="20" name="cost" value="<!-- TMPL_VAR name="ecost"-->" />
-                               <!--/TMPL_IF-->
-            </li>
-            <li>
-                <label for="purchaseordernumber">Purchase order: </label>
-                <input type="text" id="purchaseordernumber" size="20" name="purchaseordernumber"  value="<!-- TMPL_VAR name="purchaseordernumber" -->" /> 
-            </li>
-            <li>
-                <label for="invoice">Invoice number: </label>
-                <input type="text" id="invoice" size="20" name="invoice"  value="<!-- TMPL_VAR name="invoice" -->" /> (Fill when receiving)
+                <!--/TMPL_IF-->
             </li>
             <li>
                 <label for="notes">Notes: </label>
-                <textarea id="notes" cols="30" rows="3" name="notes"><!-- TMPL_VAR NAME="notes" --></textarea>
+                <textarea id="notes" cols="30" rows="3" name="notes" ><!-- TMPL_VAR name="notes"--></textarea>
             </li>
             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
+                <label for="sort1">Statistic 1: </label>
+
                 <!-- TMPL_IF Name="CGIsort1" -->
                     <!-- TMPL_VAR Name="CGIsort1" -->
                 <!-- TMPL_ELSE -->
-                <label for="sort1">Sort field 1: </label>
+
                     <input type="text" id="sort1" size="20" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" />
                 <!--/TMPL_IF -->
             </li>
             <li>
+                <label for="sort2">Statistic 2: </label>
+
                 <!-- TMPL_IF Name="CGIsort2" -->
                     <!-- TMPL_VAR Name="CGIsort2" -->
                 <!-- TMPL_ELSE -->
-                <label for="sort2">Sort field 2: </label>
                     <input type="text" id="sort2" size="20" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" />
                 <!--/TMPL_IF -->
-            </li></ol>
+            </li>
+</ol>
     </fieldset>
     <fieldset class="action">
-        <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 -->
+        <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" -->&amp;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 -->
     </fieldset>
 </form>
 </div>