Lines 238-248
if ( $op eq 'delete_confirm' ) {
Link Here
|
238 |
my $count = scalar @results; |
238 |
my $count = scalar @results; |
239 |
|
239 |
|
240 |
my $gist = $bookseller->{gstrate} || C4::Context->preference("gist") || 0; |
240 |
my $gist = $bookseller->{gstrate} || C4::Context->preference("gist") || 0; |
|
|
241 |
$gist = 0 if $gist == 0.0000; |
241 |
my $discount = $bookseller->{'discount'} / 100; |
242 |
my $discount = $bookseller->{'discount'} / 100; |
242 |
my $total_rrp; # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'} |
243 |
my $total_rrp; # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'} |
243 |
my $total_rrp_gsti; # RRP Total, GST included |
244 |
my $total_rrp_gsti; # RRP Total, GST included |
244 |
my $total_rrp_gste; # RRP Total, GST excluded |
245 |
my $total_rrp_gste; # RRP Total, GST excluded |
245 |
my $gist_rrp; |
246 |
my $gist_rrp; |
|
|
247 |
my $total_rrp_est; |
246 |
|
248 |
|
247 |
my $qty_total; |
249 |
my $qty_total; |
248 |
my @books_loop; |
250 |
my @books_loop; |
Lines 259-264
if ( $op eq 'delete_confirm' ) {
Link Here
|
259 |
|
261 |
|
260 |
$total_rrp += $qty * $results[$i]->{'rrp'}; |
262 |
$total_rrp += $qty * $results[$i]->{'rrp'}; |
261 |
my $line_total = $qty * $results[$i]->{'ecost'}; |
263 |
my $line_total = $qty * $results[$i]->{'ecost'}; |
|
|
264 |
$total_rrp_est += $qty * $results[$i]->{'ecost'}; |
262 |
|
265 |
|
263 |
# FIXME: what about the "actual cost" field? |
266 |
# FIXME: what about the "actual cost" field? |
264 |
$qty_total += $qty; |
267 |
$qty_total += $qty; |
Lines 288-308
if ( $op eq 'delete_confirm' ) {
Link Here
|
288 |
push @books_loop, \%line; |
291 |
push @books_loop, \%line; |
289 |
} |
292 |
} |
290 |
|
293 |
|
291 |
if ( $bookseller->{'listincgst'} ) { # if prices already includes GST |
294 |
my $total_est_gste; |
292 |
$total_rrp_gsti = $total_rrp; # we know $total_rrp_gsti |
295 |
my $total_est_gsti; |
293 |
$total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); # and can reverse compute other values |
296 |
my $gist_est; |
294 |
$gist_rrp = $total_rrp_gsti - $total_rrp_gste; # |
297 |
if ($gist){ # if we have GST |
295 |
} else { # if prices does not include GST |
298 |
if ( $bookseller->{'listincgst'} ) { # if prices already includes GST |
296 |
$total_rrp_gste = $total_rrp; # then we use the common way to compute other values |
299 |
$total_rrp_gsti = $total_rrp; # we know $total_rrp_gsti |
297 |
$gist_rrp = $total_rrp_gste * $gist; # |
300 |
$total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); # and can reverse compute other values |
298 |
$total_rrp_gsti = $total_rrp_gste + $gist_rrp; # |
301 |
$gist_rrp = $total_rrp_gsti - $total_rrp_gste; # |
299 |
} |
302 |
$total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); |
300 |
|
303 |
$total_est_gsti = $total_rrp_est; |
301 |
# These vars are estimated totals and GST, taking in account the booksellet discount |
304 |
} else { # if prices does not include GST |
302 |
my $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); |
305 |
$total_rrp_gste = $total_rrp; # then we use the common way to compute other values |
303 |
my $gist_est = $gist_rrp - ( $gist_rrp * $discount ); |
306 |
$gist_rrp = $total_rrp_gste * $gist; # |
304 |
my $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); |
307 |
$total_rrp_gsti = $total_rrp_gste + $gist_rrp; # |
305 |
|
308 |
$total_est_gste = $total_rrp_est; |
|
|
309 |
$total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); |
310 |
} |
311 |
$gist_est = $gist_rrp - ( $gist_rrp * $discount ); |
312 |
} else { |
313 |
$total_rrp_gsti = $total_rrp; |
314 |
$total_est_gsti = $total_rrp_est; |
315 |
} |
316 |
|
306 |
my $contract = &GetContract( $basket->{contractnumber} ); |
317 |
my $contract = &GetContract( $basket->{contractnumber} ); |
307 |
my @orders = GetOrders($basketno); |
318 |
my @orders = GetOrders($basketno); |
308 |
$template->param( |
319 |
$template->param( |
309 |
- |
|
|