# 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., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# 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 can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub.
package pdfformat::layout2pages;
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);
-
+
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])
+ push( @$arrbasket,
+ $basket->{basketno},
+ $line->{title} . " / " . $line->{author} . ( $line->{isbn} ? " ISBN : " . $line->{isbn} : '' ) . ( $line->{en} ? " EN : " . $line->{en} : '' ) . ", " . $line->{itemtype} . ( $line->{publishercode} ? ' published by '. $line->{publishercode} : ""),
+ $line->{quantity},
+ $num->format_price($line->{rrpgsti}),
+ $num->format_price($line->{discount}).'%',
+ $num->format_price($line->{gstrate} * 100).'%',
+ $num->format_price($line->{totalgste}),
+ $num->format_price($line->{totalgsti}),
);
push(@$abaskets, $arrbasket);
}
# get branch details
my $billingdetails = GetBranchDetail( $basketgroup->{billingplace} );
my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
+ my $freedeliveryplace = $basketgroup->{freedeliveryplace};
# get the subject
my $subject;
# print delivery infos
$text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
$text->translate(50/mm, ($height-237)/mm);
- $text->text($deliverydetails->{branchaddress1});
- $text->translate(50/mm, ($height-242)/mm);
- $text->text($deliverydetails->{branchaddress2});
- $text->translate(50/mm, ($height-247)/mm);
- $text->text($deliverydetails->{branchaddress3});
- $text->translate(50/mm, ($height-252)/mm);
- $text->text(join(' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry}));
+ if ($freedeliveryplace) {
+ my $start = 242;
+ my @fdp = split('\n', $freedeliveryplace);
+ foreach (@fdp) {
+ $text->text($_);
+ $text->translate( 50 / mm, ( $height - $start ) / mm );
+ $start += 5;
+ }
+ } else {
+ $text->text( $deliverydetails->{branchaddress1} );
+ $text->translate( 50 / mm, ( $height - 242 ) / mm );
+ $text->text( $deliverydetails->{branchaddress2} );
+ $text->translate( 50 / mm, ( $height - 247 ) / mm );
+ $text->text( $deliverydetails->{branchaddress3} );
+ $text->translate( 50 / mm, ( $height - 252 ) / mm );
+ $text->text( join( ' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry} ) );
+ }
$text->translate(50/mm, ($height-262)/mm);
$text->text($basketgroup->{deliverycomment});
}
sub printpdf {
my ($basketgroup, $bookseller, $baskets, $orders, $GST) = @_;
# open the default PDF that will be used for base (1st page already filled)
- my $template = C4::Context->preference("OrderPdfTemplate");
- $template = decode_base64($template);
- my $pdf = PDF::API2->openScalar($template);
+ my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('template') . '/pdf/layout2pages.pdf';
+ my $pdf = PDF::API2->open($pdf_template);
$pdf->pageLabel( 0, {
-style => 'roman',
} ); # start with roman numbering