acquisition, parcel recieve : Changing column order & title and adding totals
authorPaul POULAIN <paul@koha-fr.org>
Wed, 26 Sep 2007 10:26:36 +0000 (12:26 +0200)
committerChris Cormack <crc@liblime.com>
Wed, 26 Sep 2007 10:29:53 +0000 (05:29 -0500)
Signed-off-by: Chris Cormack <crc@liblime.com>
acqui/parcel.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl

index 1d0ee1f..cbc0b5e 100755 (executable)
@@ -119,6 +119,9 @@ for (my $i=0;$i<$countlines;$i++){
 my $pendingorders = GetPendingOrders($supplierid);
 my $countpendings = scalar @$pendingorders;
 
+# pending orders totals
+my ($totalPunitprice,$totalPquantity,$totalPecost);
+
 my @loop_orders = ();
 for (my $i=0;$i<$countpendings;$i++){
     my %line;
@@ -130,6 +133,9 @@ for (my $i=0;$i<$countpendings;$i++){
             $toggle=0;
     }
     %line = %{$pendingorders->[$i]};
+    $totalPunitprice += $line{unitprice};
+    $totalPquantity +=$line{quantity};
+    $totalPecost += $line{ecost};
     $line{ecost} = sprintf("%.2f",$line{ecost});
     $line{unitprice} = sprintf("%.2f",$line{unitprice});
     $line{invoice} = $invoice;
@@ -143,25 +149,25 @@ $totalfreight=$freight;
 $tototal=$tototal+$freight;
 
 $template->param(invoice => $invoice,
-                                               datereceived => $datereceived,
-                                               formatteddatereceived => format_date($datereceived),
-                        name => $booksellers[0]->{'name'},
-                        supplierid => $supplierid,
-                        gst => $gst,
-                        freight => $freight,
-                        invoice => $invoice,
-                        countreceived => $countlines,
-                        loop_received => \@loop_received,
-                        countpending => $countpendings,
-                        loop_orders => \@loop_orders,
-                        totalprice => $totalprice,
-                        totalfreight => $totalfreight,
-                        totalquantity => $totalquantity,
-                        tototal => $tototal,
-                        gst => $gst,
-                        grandtot => $tototal+$gst,
-                        intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-        intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-        IntranetNav => C4::Context->preference("IntranetNav"),
-                        );
+                datereceived => $datereceived,
+                formatteddatereceived => format_date($datereceived),
+                name => $booksellers[0]->{'name'},
+                supplierid => $supplierid,
+                gst => $gst,
+                freight => $freight,
+                invoice => $invoice,
+                countreceived => $countlines,
+                loop_received => \@loop_received,
+                countpending => $countpendings,
+                loop_orders => \@loop_orders,
+                totalprice => $totalprice,
+                totalfreight => $totalfreight,
+                totalquantity => $totalquantity,
+                tototal => $tototal,
+                gst => $gst,
+                grandtot => $tototal+$gst,
+                totalPunitprice => sprintf("%.2f",$totalPunitprice),
+                totalPquantity => $totalPquantity,
+                totalPecost => sprintf("%.2f",$totalPecost),
+                );
 output_html_with_http_headers $input, $cookie, $template->output;
index 63eddaf..a2af92e 100644 (file)
         <tr>
             <th>BASKET</th>
             <th>Summary</th>
-            <th>Est. Cost</th>
-            <th>P&amp;P</th>
-            <th>QTY Ordered</th>
-            <th>QTY</th>
-            <th>TOTAL</th>
+            <th>Order qty</th>
+            <th>Order cost</th>
+            <th>Recieved qty</th>
+            <th>Recieved cost</th>
         </tr>
         <!-- TMPL_LOOP NAME="loop_orders" -->
             <tr>
                 <!-- TMPL_IF NAME="author" --><br />author :<!-- TMPL_VAR NAME="author" --><!--/TMPL_IF-->
                 <!-- TMPL_IF NAME="publishercode" --><br />Publisher :<!-- TMPL_VAR NAME="publishercode" --><!--/TMPL_IF-->
                 </td>
-                <td><!-- TMPL_VAR NAME="unitprice" --></td>
-                <td></td>
                 <td><!-- TMPL_VAR NAME="quantity" --></td>
-                <td><!-- TMPL_VAR NAME="quantityreceived" --></td>
                 <td><!-- TMPL_VAR NAME="ecost" --></td>
+                <td><!-- TMPL_VAR NAME="quantityreceived" --></td>
+                <td><!-- TMPL_IF EXPR="unitprice ne '0.00'" --><!-- TMPL_VAR NAME="unitprice" --><!-- /TMPL_IF --></td>
             </tr>
         <!-- /TMPL_LOOP -->
+            <tr>
+                <th colspan="2">TOTAL</th>
+                <th><!-- TMPL_VAR NAME="totalPquantity" --></th>
+                <th><!-- TMPL_VAR NAME="totalPecost" --></th>
+                <th><!-- TMPL_VAR NAME="quantityreceived" --></th>
+                <th><!-- TMPL_VAR NAME="totalPunitprice" --></th>
+            </tr>
      </table>
 </div>
 </div>