Lines 224-234
if ( $op eq 'delete_confirm' ) {
Link Here
|
224 |
my @results = GetOrders( $basketno ); |
224 |
my @results = GetOrders( $basketno ); |
225 |
|
225 |
|
226 |
my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; |
226 |
my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; |
|
|
227 |
$gist = 0 if $gist == 0.0000; |
227 |
my $discount = $bookseller->{'discount'} / 100; |
228 |
my $discount = $bookseller->{'discount'} / 100; |
228 |
my $total_rrp; # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'} |
229 |
my $total_rrp; # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'} |
229 |
my $total_rrp_gsti; # RRP Total, GST included |
230 |
my $total_rrp_gsti; # RRP Total, GST included |
230 |
my $total_rrp_gste; # RRP Total, GST excluded |
231 |
my $total_rrp_gste; # RRP Total, GST excluded |
231 |
my $gist_rrp; |
232 |
my $gist_rrp; |
|
|
233 |
my $total_rrp_est; |
232 |
|
234 |
|
233 |
my $qty_total; |
235 |
my $qty_total; |
234 |
my @books_loop; |
236 |
my @books_loop; |
Lines 250-255
if ( $op eq 'delete_confirm' ) {
Link Here
|
250 |
|
252 |
|
251 |
$total_rrp += $qty * $order->{'rrp'}; |
253 |
$total_rrp += $qty * $order->{'rrp'}; |
252 |
my $line_total = $qty * $order->{'ecost'}; |
254 |
my $line_total = $qty * $order->{'ecost'}; |
|
|
255 |
$total_rrp_est += $qty * $order->{'ecost'}; |
253 |
# FIXME: what about the "actual cost" field? |
256 |
# FIXME: what about the "actual cost" field? |
254 |
$qty_total += $qty; |
257 |
$qty_total += $qty; |
255 |
my %line = %{ $order }; |
258 |
my %line = %{ $order }; |
Lines 275-293
if ( $op eq 'delete_confirm' ) {
Link Here
|
275 |
push @books_loop, \%line; |
278 |
push @books_loop, \%line; |
276 |
} |
279 |
} |
277 |
|
280 |
|
278 |
if ($bookseller->{'listincgst'}) { # if prices already includes GST |
281 |
my $total_est_gste; |
279 |
$total_rrp_gsti = $total_rrp; # we know $total_rrp_gsti |
282 |
my $total_est_gsti; |
280 |
$total_rrp_gste = $total_rrp_gsti / ($gist + 1); # and can reverse compute other values |
283 |
my $gist_est; |
281 |
$gist_rrp = $total_rrp_gsti - $total_rrp_gste; # |
284 |
if ($gist){ # if we have GST |
282 |
} else { # if prices does not include GST |
285 |
if ( $bookseller->{'listincgst'} ) { # if prices already includes GST |
283 |
$total_rrp_gste = $total_rrp; # then we use the common way to compute other values |
286 |
$total_rrp_gsti = $total_rrp; # we know $total_rrp_gsti |
284 |
$gist_rrp = $total_rrp_gste * $gist; # |
287 |
$total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); # and can reverse compute other values |
285 |
$total_rrp_gsti = $total_rrp_gste + $gist_rrp; # |
288 |
$gist_rrp = $total_rrp_gsti - $total_rrp_gste; # |
286 |
} |
289 |
$total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); |
287 |
# These vars are estimated totals and GST, taking in account the booksellet discount |
290 |
$total_est_gsti = $total_rrp_est; |
288 |
my $total_est_gsti = $total_rrp_gsti - ($total_rrp_gsti * $discount); |
291 |
} else { # if prices does not include GST |
289 |
my $gist_est = $gist_rrp - ($gist_rrp * $discount); |
292 |
$total_rrp_gste = $total_rrp; # then we use the common way to compute other values |
290 |
my $total_est_gste = $total_rrp_gste - ($total_rrp_gste * $discount); |
293 |
$gist_rrp = $total_rrp_gste * $gist; # |
|
|
294 |
$total_rrp_gsti = $total_rrp_gste + $gist_rrp; # |
295 |
$total_est_gste = $total_rrp_est; |
296 |
$total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); |
297 |
} |
298 |
$gist_est = $gist_rrp - ( $gist_rrp * $discount ); |
299 |
} else { |
300 |
$total_rrp_gsti = $total_rrp; |
301 |
$total_est_gsti = $total_rrp_est; |
302 |
} |
291 |
|
303 |
|
292 |
my $contract = &GetContract($basket->{contractnumber}); |
304 |
my $contract = &GetContract($basket->{contractnumber}); |
293 |
my @orders = GetOrders($basketno); |
305 |
my @orders = GetOrders($basketno); |
294 |
- |
|
|