@@ -, +, @@ --- acqui/basket.pl | 25 ++++--------------- acqui/parcel.pl | 16 ++++++++---- .../prog/en/modules/acqui/neworderempty.tt | 5 +++- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 4 +- 4 files changed, 22 insertions(+), 28 deletions(-) --- a/acqui/basket.pl +++ a/acqui/basket.pl @@ -324,28 +324,15 @@ if ( $op eq 'delete_confirm' ) { push @books_loop, \%line; } -my $total_est_gste; + my $total_est_gste; my $total_est_gsti; my $gist_est; - if ($gist){ # if we have GST - if ( $bookseller->{'listincgst'} ) { # if prices already includes GST - $total_rrp_gsti = $total_rrp; # we know $total_rrp_gsti - $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); # and can reverse compute other values - $gist_rrp = $total_rrp_gsti - $total_rrp_gste; # - $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); - $total_est_gsti = $total_rrp_est; - } else { # if prices does not include GST - $total_rrp_gste = $total_rrp; # then we use the common way to compute other values - $gist_rrp = $total_rrp_gste * $gist; # - $total_rrp_gsti = $total_rrp_gste + $gist_rrp; # - $total_est_gste = $total_rrp_est; - $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); - } - $gist_est = $gist_rrp - ( $gist_rrp * $discount ); - } else { $total_rrp_gsti = $total_rrp; - $total_est_gsti = $total_rrp_est; -} + $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); + $gist_rrp = $total_rrp_gsti - $total_rrp_gste; + $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); + $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); + $gist_est = $total_est_gsti / (1+$gist) * ($gist); # could also be ($total_est_gsti - $total_est_gste ) my $contract = &GetContract($basket->{contractnumber}); my @orders = GetOrders($basketno); --- a/acqui/parcel.pl +++ a/acqui/parcel.pl @@ -77,7 +77,7 @@ my $bookseller=GetBookSellerFromId($booksellerid); my $invoice=$input->param('invoice') || ''; my $freight=$input->param('freight'); my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); -my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; +my $gstrate= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; my $datereceived = ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) : C4::Dates->new($input->param('datereceived'), 'iso') ; $datereceived = C4::Dates->new() unless $datereceived; @@ -167,12 +167,12 @@ my @loop_received = (); for (my $i = 0 ; $i < $countlines ; $i++) { #$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) - $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) + $total = ($parcelitems[$i]->{'ecost'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) $parcelitems[$i]->{'unitprice'} += 0; my %line; %line = %{ $parcelitems[$i] }; $line{invoice} = $invoice; - $line{gst} = $gst; + $line{gstrate} = $gstrate; $line{total} = sprintf($cfstr, $total); $line{booksellerid} = $booksellerid; push @loop_received, \%line; @@ -217,7 +217,9 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); $line{unitprice} = sprintf("%.2f",$line{unitprice}); $line{invoice} = $invoice; - $line{gst} = $gst; + $line{gstrate} = $gstrate; + $line{gst} = $parcelitems[$i]->{'gst'} * $gstrate; + $line{total} = sprintf($cfstr, $total); $line{total} = $total; $line{booksellerid} = $booksellerid; $ordergrandtotal += $line{ecost} * $line{quantity}; @@ -304,6 +306,8 @@ $template->param( name => $bookseller->{'name'}, booksellerid => $booksellerid, gst => $gst, + supplierid => $supplierid, + gstrate => $gstrate, freight => $freight, invoice => $invoice, countreceived => $countlines, @@ -315,8 +319,8 @@ $template->param( totalquantity => $totalquantity, tototal => sprintf($cfstr, $tototal), ordergrandtotal => sprintf($cfstr, $ordergrandtotal), - gst => $gst, - grandtot => sprintf($cfstr, $tototal + $gst), + gst => sprintf($cfstr, $tototal*$gstrate), + 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 totalPunitprice => sprintf("%.2f", $totalPunitprice), totalPquantity => $totalPquantity, totalPqtyrcvd => $totalPqtyrcvd, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -31,10 +31,13 @@ function Check(ff) { _alertString +="-------------------------------------------------------------------\n\n"; - if ( isNull(ff.title,1) && isNull(ff.entertitle,1) ){ +[% UNLESS( biblionumber ) %] +// this caused errors so I enclosed it within an UNLESS, if biblionumber then ff.entertitle doesnt exist so checking it will cause a type error + if( isNull(ff.entertitle,1) ){ ok=1; _alertString += "\n- " + _("Title cannot be empty"); } +[% END %] if(isNull(ff.budget_id,1)){ ok=1; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -348,8 +348,8 @@ The total at the bottom of the page should be within a few cents of the total for the invoice.

- Tax rate - [% gst %] + Tax + [% gst %] [% END %] --