From 1b41d776ca3e3c174e182219625a006db64d94fa Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Fri, 9 Sep 2011 15:46:52 +1200 Subject: [PATCH] bug_6504: Reintroduced freight costs when receiving orders --- C4/Acquisition.pm | 1 + acqui/addorder.pl | 3 +++ acqui/neworderempty.pl | 1 + acqui/parcel.pl | 16 +++++----------- .../prog/en/modules/acqui/neworderempty.tt | 6 ++++++ .../prog/en/modules/acqui/orderreceive.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/parcels.tt | 3 +-- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index f682256..4227830 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1264,6 +1264,7 @@ sub GetParcel { aqorders.listprice, aqorders.rrp, aqorders.ecost, + aqorders.freight, biblio.title FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno diff --git a/acqui/addorder.pl b/acqui/addorder.pl index e321d2c..a20c79c 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -103,6 +103,8 @@ budget_id used to pay this order. =item C +=item C + =item C =item C @@ -174,6 +176,7 @@ $orderinfo->{'uncertainprice'} ||= 0; #my $gst = $input->param('GST'); #my $budget = $input->param('budget'); #my $cost = $input->param('cost'); +#my $freight = $input->param('freight'); #my $sub = $input->param('sub'); #my $purchaseorder = $input->param('purchaseordernumber'); #my $invoice = $input->param('invoice'); diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index e99eeb0..2c528b7 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -380,6 +380,7 @@ $template->param( quantityrec => $data->{'quantity'}, rrp => $data->{'rrp'}, listprice => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice), + freight => sprintf("%.2f", $data->{'freight'}||0), total => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ), ecost => $data->{'ecost'}, notes => $data->{'notes'}, diff --git a/acqui/parcel.pl b/acqui/parcel.pl index ec5071b..ae937fd 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -216,19 +216,14 @@ for (my $i = 0 ; $i < $countlines ; $i++) { $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.. - if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) { - warn "FREIGHT CHARGE MISMATCH!!"; - } - $totalfreight = $parcelitems[$i]->{'freight'}; + $totalfreight += $parcelitems[$i]->{'freight'}; $totalquantity += $parcelitems[$i]->{'quantityreceived'}; $tototal += $total; } my $pendingorders = GetPendingOrders($supplierid); my $countpendings = scalar @$pendingorders; +my $freight_per_order = $freight && $countpendings ? $freight/$countpendings : 0; # pending orders totals my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd); @@ -247,6 +242,7 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $line{ecost} = sprintf("%.2f",$line{ecost}); $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); $line{unitprice} = sprintf("%.2f",$line{unitprice}); + $line{freight} = sprintf("%.2f",$freight_per_order); $line{invoice} = $invoice; $line{gst} = $gst; $line{total} = $total; @@ -254,7 +250,6 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $ordergrandtotal += $line{ecost} * $line{quantity}; push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); } -$freight = $totalfreight unless $freight; my $count = $countpendings; @@ -289,8 +284,7 @@ if ($count>$resultsperpage){ ); } -#$totalfreight=$freight; -$tototal = $tototal + $freight; +$tototal = $tototal + $totalfreight; $template->param( invoice => $invoice, @@ -307,7 +301,7 @@ $template->param( countpending => $countpendings, loop_orders => \@loop_orders, totalprice => sprintf($cfstr, $totalprice), - totalfreight => $totalfreight, + totalfreight => sprintf($cfstr, $totalfreight), totalquantity => $totalquantity, tototal => sprintf($cfstr, $tototal), ordergrandtotal => sprintf($cfstr, $ordergrandtotal), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 39e9ca2..73fbb58 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -422,6 +422,12 @@ $(document).ready(function() [% END %] + [% IF ( quantityrec ) %] +
  • + + +
  • + [% END %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 746155f..0e20e39 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -82,7 +82,6 @@ -
    @@ -127,6 +126,7 @@ [% ELSE %] [% END %]
  • +
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt index a7d704d..53d44d7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt @@ -96,11 +96,10 @@ [% END %] - +
  • Show Calendar -- 1.6.5