Lines 149-156
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
Link Here
|
149 |
my $datereceived = C4::Dates->new(); |
149 |
my $datereceived = C4::Dates->new(); |
150 |
|
150 |
|
151 |
my $cfstr = "%.2f"; # currency format string -- could get this from currency table. |
151 |
my $cfstr = "%.2f"; # currency format string -- could get this from currency table. |
152 |
my @parcelitems = @{ $invoice->{orders} }; |
152 |
my @orders = @{ $invoice->{orders} }; |
153 |
my $countlines = scalar @parcelitems; |
153 |
my $countlines = scalar @orders; |
154 |
my $totalprice = 0; |
154 |
my $totalprice = 0; |
155 |
my $totalquantity = 0; |
155 |
my $totalquantity = 0; |
156 |
my $total; |
156 |
my $total; |
Lines 161-181
my $total_quantity = 0;
Link Here
|
161 |
my $total_gste = 0; |
161 |
my $total_gste = 0; |
162 |
my $total_gsti = 0; |
162 |
my $total_gsti = 0; |
163 |
|
163 |
|
164 |
for my $item ( @parcelitems ) { |
164 |
for my $order ( @orders ) { |
165 |
$item->{unitprice} = get_value_with_gst_params( $item->{unitprice}, $item->{gstrate}, $bookseller ); |
165 |
$order->{unitprice} = get_value_with_gst_params( $order->{unitprice}, $order->{gstrate}, $bookseller ); |
166 |
$total = ( $item->{'unitprice'} ) * $item->{'quantityreceived'}; |
166 |
$total = ( $order->{unitprice} ) * $order->{quantityreceived}; |
167 |
$item->{'unitprice'} += 0; |
167 |
$order->{'unitprice'} += 0; |
168 |
my %line = %{ $item }; |
168 |
my %line = %{ $order }; |
169 |
my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller ); |
169 |
my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller ); |
170 |
$line{ecost} = sprintf( "%.2f", $ecost ); |
170 |
$line{ecost} = sprintf( "%.2f", $ecost ); |
171 |
$line{invoice} = $invoice->{invoicenumber}; |
171 |
$line{invoice} = $invoice->{invoicenumber}; |
172 |
$line{total} = sprintf($cfstr, $total); |
172 |
$line{total} = sprintf($cfstr, $total); |
173 |
$line{booksellerid} = $invoice->{booksellerid}; |
173 |
$line{booksellerid} = $invoice->{booksellerid}; |
174 |
my ($count) = &GetReservesFromBiblionumber($line{biblionumber},undef,$item->{itemnumber}); |
174 |
$line{holds} = 0; |
175 |
$line{holds} = $count; |
175 |
my @itemnumbers = GetItemnumbersFromOrder( $order->{ordernumber} ); |
|
|
176 |
for my $itemnumber ( @itemnumbers ) { |
177 |
my ( $count ) = &GetReservesFromBiblionumber($line{biblionumber}, undef, $itemnumber); |
178 |
$line{holds} += $count; |
179 |
} |
176 |
$line{budget} = GetBudgetByOrderNumber( $line{ordernumber} ); |
180 |
$line{budget} = GetBudgetByOrderNumber( $line{ordernumber} ); |
177 |
$totalprice += $item->{'unitprice'}; |
181 |
$totalprice += $order->{unitprice}; |
178 |
$line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} ); |
182 |
$line{unitprice} = sprintf( $cfstr, $order->{unitprice} ); |
179 |
my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller ); |
183 |
my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller ); |
180 |
my $gst = get_gst( $line{total}, $line{gstrate}, $bookseller ); |
184 |
my $gst = get_gst( $line{total}, $line{gstrate}, $bookseller ); |
181 |
$foot{$line{gstrate}}{gstrate} = $line{gstrate}; |
185 |
$foot{$line{gstrate}}{gstrate} = $line{gstrate}; |
Lines 191-197
for my $item ( @parcelitems ) {
Link Here
|
191 |
|
195 |
|
192 |
if ( $line{parent_ordernumber} != $line{ordernumber} ) { |
196 |
if ( $line{parent_ordernumber} != $line{ordernumber} ) { |
193 |
if ( grep { $_->{ordernumber} == $line{parent_ordernumber} } |
197 |
if ( grep { $_->{ordernumber} == $line{parent_ordernumber} } |
194 |
@parcelitems |
198 |
@orders |
195 |
) |
199 |
) |
196 |
{ |
200 |
{ |
197 |
$line{cannot_cancel} = 1; |
201 |
$line{cannot_cancel} = 1; |
Lines 202-208
for my $item ( @parcelitems ) {
Link Here
|
202 |
$line{budget_name} = $budget->{'budget_name'}; |
206 |
$line{budget_name} = $budget->{'budget_name'}; |
203 |
|
207 |
|
204 |
push @loop_received, \%line; |
208 |
push @loop_received, \%line; |
205 |
$totalquantity += $item->{'quantityreceived'}; |
209 |
$totalquantity += $order->{quantityreceived}; |
206 |
|
210 |
|
207 |
} |
211 |
} |
208 |
push @book_foot_loop, map { $_ } values %foot; |
212 |
push @book_foot_loop, map { $_ } values %foot; |