Bug 8037: (follow-up) fix undefined variable warning during template processing
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / parcel.tt
index fef72dc..db6783b 100644 (file)
@@ -1,3 +1,4 @@
+[% 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>
             "iCookieDuration": 60*60*24*1000, // 1000 days
             "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,
 
 
    [% 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>