From c9a35c10898695a575d854b561da21d6eaf8e289 Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Tue, 1 Jan 2008 14:52:30 -0600 Subject: [PATCH] cleanup parcel.pl and tmpl Signed-off-by: Joshua Ferraro --- acqui/parcel.pl | 18 ++++-- .../prog/en/modules/acqui/parcel.tmpl | 57 ++++++++++--------- 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/acqui/parcel.pl b/acqui/parcel.pl index f26ef08035..4e624ee090 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -83,9 +83,9 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {acquisition => 1}, debug => 1, }); +my $cfstr = "%.2f"; # currency format string -- could get this from currency table. my @parcelitems=GetParcel($supplierid,$invoice,$datereceived->output('iso')); my $countlines = scalar @parcelitems; - my $totalprice=0; my $totalfreight=0; my $totalquantity=0; @@ -108,10 +108,11 @@ for (my $i=0;$i<$countlines;$i++){ %line = %{$parcelitems[$i]}; $line{invoice} = $invoice; $line{gst} = $gst; - $line{total} = $total; + $line{total} = sprintf($cfstr,$total); $line{supplierid} = $supplierid; push @loop_received, \%line; $totalprice+=$parcelitems[$i]->{'unitprice'}; + $line{unitprice} = sprintf($cfstr,$parcelitems[$i]->{'unitprice'}); #double FIXME - totalfreight is redefined later. # FIXME - each order in a parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget.. @@ -129,7 +130,7 @@ my $pendingorders = GetPendingOrders($supplierid); my $countpendings = scalar @$pendingorders; # pending orders totals -my ($totalPunitprice,$totalPquantity,$totalPecost); +my ($totalPunitprice,$totalPquantity,$totalPecost, $totalPqtyrcvd); my @loop_orders = (); for (my $i=0;$i<$countpendings;$i++){ @@ -142,8 +143,12 @@ for (my $i=0;$i<$countpendings;$i++){ $toggle=0; } %line = %{$pendingorders->[$i]}; + $line{quantity}+=0; + $line{quantityreceived}+=0; + $line{unitprice}+=0; $totalPunitprice += $line{unitprice}; $totalPquantity +=$line{quantity}; + $totalPqtyrcvd +=$line{quantityreceived}; $totalPecost += $line{ecost}; $line{ecost} = sprintf("%.2f",$line{ecost}); $line{unitprice} = sprintf("%.2f",$line{unitprice}); @@ -169,14 +174,15 @@ $template->param(invoice => $invoice, loop_received => \@loop_received, countpending => $countpendings, loop_orders => \@loop_orders, - totalprice => $totalprice, + totalprice => sprintf($cfstr,$totalprice), totalfreight => $totalfreight, totalquantity => $totalquantity, - tototal => $tototal, + tototal => sprintf($cfstr,$tototal), gst => $gst, - grandtot => $tototal+$gst, + grandtot => sprintf($cfstr,$tototal+$gst), totalPunitprice => sprintf("%.2f",$totalPunitprice), totalPquantity => $totalPquantity, + totalPqtyrcvd => $totalPqtyrcvd, totalPecost => sprintf("%.2f",$totalPecost), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl index 9dda33eece..f54e7bddc3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl @@ -1,6 +1,6 @@ Koha › Acquisitions › <!-- TMPL_IF name="date" --> - Receipt Summary for <!-- TMPL_VAR NAME="name" --> <!--TMPL_IF Name="invoice"-->Parcel <!-- TMPL_VAR NAME="invoice" --><!--/TMPL_IF --> on <!-- TMPL_VAR NAME="date" --><!-- TMPL_ELSE -->Orders not yet Received for <!-- TMPL_VAR NAME="name" --><!-- /TMPL_IF --> + Receipt Summary for Invoice on Receive Orders from @@ -9,9 +9,9 @@
@@ -21,10 +21,10 @@

- - Receipt Summary for Parcel on + + Receipt Summary for [ ] on - Orders not yet Received for + Orders not yet Received from

@@ -41,7 +41,6 @@ Basket/Order Summary View Record - Qty ordered Est cost Actual cost TOTAL @@ -56,20 +55,26 @@
Publisher : " title="MARC" rel="gb_page_center[600,500]">View MARC - -   - SUBTOTALS +   + SUBTOTAL +   - - + + + + +

+ Freight + + @@ -82,9 +87,10 @@ -   - TOTAL - +   + TOTAL +   + @@ -103,10 +109,10 @@ BASKET Summary View Record - Order qty + Qty received / ordered Order cost - Already Received Received cost +   @@ -119,23 +125,18 @@
Publisher : " title="MARC" rel="gb_page_center[600,500]">MARC | " title="MARC" rel="gb_page_center[600,500]">Card - + / - - &biblionumber=&daterecieved=&invoice=&gst=&freight=&supplierid=">More - - &biblionumber=&daterecieved=&invoice=&gst=&freight=&supplierid=">Receive - - + &biblionumber=&daterecieved=&invoice=&gst=&freight=&supplierid=">Receive - - TOTAL - +   + TOTAL + / - +  
-- 2.39.5