Bug 8037: (follow-up) fix undefined variable warning during template processing
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / parcel.tt
index 250cc96..db6783b 100644 (file)
@@ -1,9 +1,11 @@
+[% USE currency = format('%.2f') -%]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( date ) %]
             Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% formatteddatereceived %][% ELSE %]Receive orders from [% name %][% END %]</title>
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'datatables.inc' %]
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
 [% INCLUDE 'greybox.inc' %]
 <script type="text/javascript">
 //<![CDATA[
@@ -15,7 +17,7 @@
         var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
             "bStateSave": true,
             "iCookieDuration": 60*60*24*1000, // 1000 days
-            "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
+            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
             "aoColumnDefs": [
                 { "aTargets": [ 3, 8, 9 ], "bSortable": false, "bSearchable": false },
             ],
                 null,
                 null,
             ],
+            'bAutoWidth': false,
             "sPaginationType": "four_button"
-        } ) );
+        } )
+        ).columnFilter({
+            sPlaceHolder: "head:after",
+            aoColumns: [
+                { type: "text" },
+                { type: "text" },
+                { type: "text" },
+                null,
+                { type: "text" },
+                { type: "text" },
+                { type: "text" },
+                { type: "text" },
+                null,
+                null
+            ]
+        });
       }
+
       if ( $("#receivedt").length ) {
         var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
             "bStateSave": true,
             "iCookieDuration": 60*60*24*1000, // 1000 days
-            "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
+            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
             "aoColumnDefs": [
-                { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false },
+                { "aTargets": [ 4, -1 ], "bSortable": false, "bSearchable": false },
             ],
             "aoColumns": [
                 { "sType": "num-html" },
                 { "sType": "num-html" },
                 { "sType": "html" },
+                { "sType": "html" },
+                null,
                 null,
                 null,
                 null,
 <p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p>
 </div>
 [% UNLESS (invoiceclosedate) %]
-<div id="acqui_receive_search">
+  <div id="acqui_receive_search">
     <h3>Pending orders</h3>
 
- [% IF ( loop_orders ) %]<table id="pendingt">
-    <thead>
-        <tr>
+    [% IF ( loop_orders ) %]
+      <table id="pendingt">
+        <thead>
+          <tr>
+            <th>Basket search</th>
+            <th>Order line search</th>
+            <th>Summary search</th>
+            <th>&nbsp;</th>
+            <th>Quantity search</th>
+            <th>Unit cost search</th>
+            <th>Order cost search</th>
+            <th>Fund search</th>
+            <th>&nbsp;</th>
+            <th>&nbsp;</th>
+          </tr>
+          <tr>
             <th>Basket</th>
             <th>Order line</th>
             <th>Summary</th>
             <th>Fund</th>
             <th>&nbsp;</th>
             <th>&nbsp;</th>
-        </tr>
-    </thead>
-    <tbody class="filterclass">
+          </tr>
+        </thead>
+        <tbody class="filterclass">
         [% FOREACH loop_order IN loop_orders %]
             <tr>
                 <td class="basketfilterclass">[% loop_order.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a>)</td>
                         [% END %]
                     </td>
                 </tr>
-            [% END %]
+        [% END %]
         </tbody>
-        </table>
-        [% ELSE %]There are no pending orders.[% END %]
-    </div>
+      </table>
+    [% ELSE %]There are no pending orders.[% END %]
+  </div>
 [% ELSE %]
     <p>
         Invoice is closed, so you can't receive orders anymore.
 
 
    [% IF ( loop_received ) %]
+       [% SET funds = {} %]
+       [% SET estimated_total = 0 %]
+
+       [% FOREACH loop_receive IN loop_received %]
+           [% IF (funds.${ loop_receive.budget.budget_name }.estimated == '') %]
+              [% SET funds.${ loop_receive.budget.budget_name }.estimated = 0 %]
+           [% END %]
+           [% IF (funds.${ loop_receive.budget.budget_name }.actual == '') %]
+              [% SET funds.${ loop_receive.budget.budget_name }.actual = 0 %]
+           [% END %]
+           [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
+           [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%]
+           [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
+       [% END %]
+
    <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
     <table id="receivedt">
         <thead>
            <tr>
-               <th>Basket</th>
-        <th>Order line</th>
-               <th>Summary</th>
-        <th>View record</th>
-               <th>Quantity</th>  
-               <th>Est cost</th>
-               <th>Actual cost</th>
-               <th>TOTAL</th>
+                <th>Basket</th>
+                <th>Order Line</th>
+                <th>Holds</th>
+                <th>Summary</th>
+                <th>View record</th>
+                <th>Quantity</th>
+                <th>Fund</th>
+                <th>Est cost</th>
+                <th>Actual cost</th>
+                <th>TOTAL</th>
         <th></th>
            </tr>
     </thead>
     <tfoot>
+        [% FOREACH key IN funds.keys.sort %]
+            <tr>
+                <td colspan="6" class="total">(Tax exc.)</td>
+                <td><i>Subtotal for</i> [% key %]</td>
+                <td>[% currency( funds.$key.estimated ) %]</td>
+                <td>[% currency( funds.$key.actual ) %]</td>
+                <td>&nbsp;</td>
+                <td>&nbsp;</td>
+            </tr>
+        [% END %]
         <tr>
-            <th colspan="7" class="total">Total tax exc.</th>
+            <th colspan="9" class="total">Total tax exc.</th>
             <th>[% total_gste %]</th>
             <th></th>
         </tr>
         [% FOREACH book_foot IN book_foot_loop %]
             <tr>
-                <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
+                <th colspan="9">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
                 <th>[% book_foot.value %]</th>
                 <th></th>
             </tr>
         [% END %]
         <tr>
-            <th colspan="7" class="total">Total tax inc.</th>
+            <th colspan="9" class="total">Total tax inc.</th>
             <th>[% total_gsti %]</th>
             <th></th>
         </tr>
             <tr>
                 <td>[% loop_receive.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a>)</td>
                 <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
+                <td>
+                  [% IF loop_receive.holds > 0 %]
+                    <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.holds %]</a></span>
+                  [% ELSE %]
+                    0
+                  [% END %]
+                </td>
                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
                 [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
                 [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
                 </td>
                 <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
                 <td>[% loop_receive.quantityreceived %]</td>
+                <td>[% loop_receive.budget.budget_name %]</td>
                 <td>[% loop_receive.ecost %]</td>
                 <td>[% loop_receive.unitprice %]</td>
                 <td>[% loop_receive.total %]</td>