Bug 9506: FIX gst list values for each basket
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 21 Mar 2013 13:13:22 +0000 (14:13 +0100)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sat, 23 Mar 2013 04:28:57 +0000 (00:28 -0400)
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Problems raised by QA for the basket list page in the 3 pages
layout (pdfformat::layout3pages) fixed.

GST column on the summary page now gives a list of all used
GST rates for each individual basket.

All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
acqui/pdfformat/layout3pages.pm

index 38ca298..b5f5ce3 100644 (file)
@@ -25,6 +25,7 @@ package pdfformat::layout3pages;
 use vars qw($VERSION @ISA @EXPORT);
 use Number::Format qw(format_price);
 use MIME::Base64;
+use List::MoreUtils qw/uniq/;
 use strict;
 use warnings;
 use utf8;
@@ -223,10 +224,10 @@ sub printbaskets {
         push(@$arrbasket, $bkey);
     }
     my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
-    my @gst;
     # calculate each basket total
     push(@$abaskets, $arrbasket);
     for my $basket (@$hbaskets) {
+        my @gst;
         $arrbasket = undef;
         my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
         my $ords = $orders->{$basket->{basketno}};
@@ -238,9 +239,9 @@ sub printbaskets {
             $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
             $totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
             $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
-            push @gst, $ord->{gstrate} * 100
-                unless grep {$ord->{gstrate} * 100 == $_ ? $_ : ()} @gst;
+            push @gst, $ord->{gstrate};
         }
+        @gst = uniq map { $_ * 100 } @gst;
         $totalgsti = $num->round($totalgsti);
         $totalgste = $num->round($totalgste);
         $grandtotalrrpgste += $totalrrpgste;