#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
#you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
package pdfformat::layout2pages;
use vars qw($VERSION @ISA @EXPORT);
-use Number::Format qw(format_price);
use MIME::Base64;
use strict;
use warnings;
use C4::Branch qw(GetBranchDetail);
+use Koha::Number::Price;
+
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
my ($pdf, $basketgroup, $baskets, $orders) = @_;
my $cur_format = C4::Context->preference("CurrencyFormat");
- my $num;
-
- if ( $cur_format eq 'FR' ) {
- $num = new Number::Format(
- 'decimal_fill' => '2',
- 'decimal_point' => ',',
- 'int_curr_symbol' => '',
- 'mon_thousands_sep' => ' ',
- 'thousands_sep' => ' ',
- 'mon_decimal_point' => ','
- );
- } else { # US by default..
- $num = new Number::Format(
- 'int_curr_symbol' => '',
- 'mon_thousands_sep' => ',',
- 'mon_decimal_point' => '.'
- );
- }
$pdf->mediabox($height/mm, $width/mm);
my $page = $pdf->page();
my $abaskets;
my $arrbasket;
- my @keys = ('Basket (N°)','Document','Qty','RRT GST Inc.','Discount','Discount price GST Exc.','GST', 'Total GST Inc.');
+ my @keys = ('Basket (No.)', 'Document', 'Qty', 'RRP tax inc.', 'Discount', 'GST', 'Total tax exc.', 'Total tax inc.');
for my $bkey (@keys) {
push(@$arrbasket, $bkey);
}
push(@$abaskets, $arrbasket);
-
+
+ my $titleinfo;
for my $basket (@$baskets){
for my $line (@{$orders->{$basket->{basketno}}}) {
$arrbasket = undef;
- push( @$arrbasket,
- $basket->{basketno},
- @$line[3]." / ".@$line[2].(@$line[0]?" ISBN : ".@$line[0]:'').(@$line[10]?" EN : ".@$line[10]:'').", ".@$line[1].(@$line[4]?' publié par '.@$line[4]:''),
- @$line[5],
- $num->format_price(@$line[6]),
- $num->format_price(@$line[8]).'%',
- $num->format_price(@$line[7]/(1+@$line[9]/100)),
- $num->format_price(@$line[9]).'%',
- $num->format_price($num->round(@$line[7])*@$line[5])
+ $titleinfo = "";
+ if ( C4::Context->preference("marcflavour") eq 'UNIMARC' ) {
+ $titleinfo = $line->{title} . " / " . $line->{author} .
+ ( $line->{isbn} ? " ISBN: " . $line->{isbn} : '' ) .
+ ( $line->{en} ? " EN: " . $line->{en} : '' ) .
+ ( $line->{itemtype} ? ", " . $line->{itemtype} : '' ) .
+ ( $line->{edition} ? ", " . $line->{edition} : '' ) .
+ ( $line->{publishercode} ? ' published by '. $line->{publishercode} : '') .
+ ( $line->{publicationyear} ? ', '. $line->{publicationyear} : '');
+ }
+ else { # MARC21, NORMARC
+ $titleinfo = $line->{title} . " " . $line->{author} .
+ ( $line->{isbn} ? " ISBN: " . $line->{isbn} : '' ) .
+ ( $line->{en} ? " EN: " . $line->{en} : '' ) .
+ ( $line->{itemtype} ? " " . $line->{itemtype} : '' ) .
+ ( $line->{edition} ? ", " . $line->{edition} : '' ) .
+ ( $line->{publishercode} ? ' published by '. $line->{publishercode} : '') .
+ ( $line->{copyrightdate} ? ' '. $line->{copyrightdate} : '');
+ }
+ push( @$arrbasket,
+ $basket->{basketno},
+ $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
+ $line->{quantity},
+ Koha::Number::Price->new( $line->{rrpgsti} )->format,
+ Koha::Number::Price->new( $line->{discount} )->format . '%',
+ Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
+ Koha::Number::Price->new( $line->{totalgste} )->format,
+ Koha::Number::Price->new( $line->{totalgsti} )->format,
);
push(@$abaskets, $arrbasket);
}
$text->text($bookseller->{address2});
$text->translate(100/mm, ($height-200)/mm);
$text->text($bookseller->{address3});
+ $text->translate(100/mm, ($height-205)/mm);
+ $text->text($bookseller->{accountnumber});
# print delivery infos
$text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );