Lines 77-83
my $bookseller=GetBookSellerFromId($booksellerid);
Link Here
|
77 |
my $invoice=$input->param('invoice') || ''; |
77 |
my $invoice=$input->param('invoice') || ''; |
78 |
my $freight=$input->param('freight'); |
78 |
my $freight=$input->param('freight'); |
79 |
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); |
79 |
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); |
80 |
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; |
80 |
my $gstrate= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; |
81 |
my $datereceived = ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) |
81 |
my $datereceived = ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) |
82 |
: C4::Dates->new($input->param('datereceived'), 'iso') ; |
82 |
: C4::Dates->new($input->param('datereceived'), 'iso') ; |
83 |
$datereceived = C4::Dates->new() unless $datereceived; |
83 |
$datereceived = C4::Dates->new() unless $datereceived; |
Lines 167-178
my @loop_received = ();
Link Here
|
167 |
for (my $i = 0 ; $i < $countlines ; $i++) { |
167 |
for (my $i = 0 ; $i < $countlines ; $i++) { |
168 |
|
168 |
|
169 |
#$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) |
169 |
#$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) |
170 |
$total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) |
170 |
$total = ($parcelitems[$i]->{'ecost'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) |
171 |
$parcelitems[$i]->{'unitprice'} += 0; |
171 |
$parcelitems[$i]->{'unitprice'} += 0; |
172 |
my %line; |
172 |
my %line; |
173 |
%line = %{ $parcelitems[$i] }; |
173 |
%line = %{ $parcelitems[$i] }; |
174 |
$line{invoice} = $invoice; |
174 |
$line{invoice} = $invoice; |
175 |
$line{gst} = $gst; |
175 |
$line{gstrate} = $gstrate; |
176 |
$line{total} = sprintf($cfstr, $total); |
176 |
$line{total} = sprintf($cfstr, $total); |
177 |
$line{booksellerid} = $booksellerid; |
177 |
$line{booksellerid} = $booksellerid; |
178 |
push @loop_received, \%line; |
178 |
push @loop_received, \%line; |
Lines 217-223
for (my $i = 0 ; $i < $countpendings ; $i++) {
Link Here
|
217 |
$line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); |
217 |
$line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); |
218 |
$line{unitprice} = sprintf("%.2f",$line{unitprice}); |
218 |
$line{unitprice} = sprintf("%.2f",$line{unitprice}); |
219 |
$line{invoice} = $invoice; |
219 |
$line{invoice} = $invoice; |
220 |
$line{gst} = $gst; |
220 |
$line{gstrate} = $gstrate; |
|
|
221 |
$line{gst} = $parcelitems[$i]->{'gst'} * $gstrate; |
222 |
$line{total} = sprintf($cfstr, $total); |
221 |
$line{total} = $total; |
223 |
$line{total} = $total; |
222 |
$line{booksellerid} = $booksellerid; |
224 |
$line{booksellerid} = $booksellerid; |
223 |
$ordergrandtotal += $line{ecost} * $line{quantity}; |
225 |
$ordergrandtotal += $line{ecost} * $line{quantity}; |
Lines 304-309
$template->param(
Link Here
|
304 |
name => $bookseller->{'name'}, |
306 |
name => $bookseller->{'name'}, |
305 |
booksellerid => $booksellerid, |
307 |
booksellerid => $booksellerid, |
306 |
gst => $gst, |
308 |
gst => $gst, |
|
|
309 |
supplierid => $supplierid, |
310 |
gstrate => $gstrate, |
307 |
freight => $freight, |
311 |
freight => $freight, |
308 |
invoice => $invoice, |
312 |
invoice => $invoice, |
309 |
countreceived => $countlines, |
313 |
countreceived => $countlines, |
Lines 315-322
$template->param(
Link Here
|
315 |
totalquantity => $totalquantity, |
319 |
totalquantity => $totalquantity, |
316 |
tototal => sprintf($cfstr, $tototal), |
320 |
tototal => sprintf($cfstr, $tototal), |
317 |
ordergrandtotal => sprintf($cfstr, $ordergrandtotal), |
321 |
ordergrandtotal => sprintf($cfstr, $ordergrandtotal), |
318 |
gst => $gst, |
322 |
gst => sprintf($cfstr, $tototal*$gstrate), |
319 |
grandtot => sprintf($cfstr, $tototal + $gst), |
323 |
grandtot => sprintf($cfstr, $tototal*(1+$gstrate)), # FIXME assumes budgeted cost is gst exclusive (currently correct), will need to be fixed once a pref exists for gst incl/excl gst |
320 |
totalPunitprice => sprintf("%.2f", $totalPunitprice), |
324 |
totalPunitprice => sprintf("%.2f", $totalPunitprice), |
321 |
totalPquantity => $totalPquantity, |
325 |
totalPquantity => $totalPquantity, |
322 |
totalPqtyrcvd => $totalPqtyrcvd, |
326 |
totalPqtyrcvd => $totalPqtyrcvd, |