From a8574a5b8344b09fd74d8110788450bdbbc24aac Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 7 Jul 2003 14:11:16 +0000 Subject: [PATCH] fixing bug #526 : gst rate is now calculated through systempref gist entry. Before this fix : * was harcoded to 12,5% * some bugs in template parameters prevented the javascript to work. * some bugs prevented some calculations to be done properly. --- acqui/basket.pl | 5 +++-- acqui/newbiblio.pl | 6 +++--- .../default/en/acqui/newbiblio.tmpl | 17 ++++++++--------- .../intranet-tmpl/default/fr/acqui/basket.tmpl | 8 ++++---- .../default/fr/acqui/newbiblio.tmpl | 18 +++++++++--------- updater/updatedatabase | 16 ++++++++++++++++ 6 files changed, 43 insertions(+), 27 deletions(-) diff --git a/acqui/basket.pl b/acqui/basket.pl index 0c19a85c12..204813971d 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -68,8 +68,6 @@ for (my $i=0;$i<$count;$i++){ $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'}; $sub_total+=$line_total; - $gist=sprintf("%.2f",$sub_total*0.125); - $grand_total=$sub_total+$gist; my %line; if ($toggle==0){ $line{color}='#ffffcc'; @@ -92,6 +90,9 @@ for (my $i=0;$i<$count;$i++){ $line{biblionumber} = $results[$i]->{'biblionumber'}; push @books_loop, \%line; } +$gist=sprintf("%.2f",$sub_total*C4::Context->preference("gist")); +$grand_total=$sub_total+$gist; + $template->param(basket => $basket, authorisedby => $results[0]->{'authorisedby'}, entrydate => format_date($results[0]->{'entrydate'}), diff --git a/acqui/newbiblio.pl b/acqui/newbiblio.pl index c6a6d81ad1..cdb5c5f221 100755 --- a/acqui/newbiblio.pl +++ b/acqui/newbiblio.pl @@ -29,7 +29,6 @@ use C4::Biblio; use C4::Output; use C4::Search; use C4::Auth; -use C4::Biblio; use C4::Output; use C4::Interface::CGI::Output; use C4::Database; @@ -49,7 +48,6 @@ my $new; my $dbh = C4::Context->dbh; if ($ordnum eq ''){ $new='yes'; - warn "NEW : YES"; $ordnum=newordernum; if ($biblio) { $data=bibdata($biblio); @@ -153,10 +151,12 @@ $template->param( existing => $biblio, biblioitemnumber => $data->{'biblioitemnumber'}, itemtype => $data->{'itemtype'}, discount => $booksellers[0]->{'discount'}, - listingcst => $booksellers[0]->{'listincgst'}, + listincgst => $booksellers[0]->{'listincgst'}, listprice => $booksellers[0]->{'listprice'}, gstreg => $booksellers[0]->{'gstreg'}, name => $booksellers[0]->{'name'}, + currency => $booksellers[0]->{'listprice'}, + gstrate => C4::Context->preference("gist") , loop_currencies => \@loop_currency, orderexists => ($new eq 'yes')?0:1, title => $data->{'title'}, diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/newbiblio.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/newbiblio.tmpl index 2a784943a6..d8257f1b3f 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui/newbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/newbiblio.tmpl @@ -22,17 +22,16 @@ function update(f){ ecost=rrp*(100-discount)/100 GST=0; if (gst_on){ - rrp=rrp*1.125; - GST=ecost*0.125 + rrp=rrp*(1+); + GST=ecost*(); } total=(ecost+GST)*quantity - - f.rrp.value=display(rrp) - f.ecost.value=display(ecost) - f.GST.value=display(GST) - f.total.value=display(total) + f.rrp.value=rrp; + f.ecost.value=ecost; + f.GST.value=GST; + f.total.value=total; } @@ -61,8 +60,8 @@ win.document.write(""); "> "> "> -"> -"> +"> +"> " value=""> diff --git a/koha-tmpl/intranet-tmpl/default/fr/acqui/basket.tmpl b/koha-tmpl/intranet-tmpl/default/fr/acqui/basket.tmpl index 23269d10ff..9b962f98e3 100644 --- a/koha-tmpl/intranet-tmpl/default/fr/acqui/basket.tmpl +++ b/koha-tmpl/intranet-tmpl/default/fr/acqui/basket.tmpl @@ -10,8 +10,8 @@ Isbn Titre Auteur - ? frais - ? est + Px rempl + Px est Qté Total @@ -21,8 +21,8 @@ &id=&basket="> - "> - "> + + diff --git a/koha-tmpl/intranet-tmpl/default/fr/acqui/newbiblio.tmpl b/koha-tmpl/intranet-tmpl/default/fr/acqui/newbiblio.tmpl index d7f1553e28..ca633476db 100644 --- a/koha-tmpl/intranet-tmpl/default/fr/acqui/newbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/default/fr/acqui/newbiblio.tmpl @@ -22,17 +22,17 @@ function update(f){ ecost=rrp*(100-discount)/100 GST=0; if (gst_on){ - rrp=rrp*1.125; - GST=ecost*0.125 + rrp=rrp*(1+); + GST=ecost*; } total=(ecost+GST)*quantity - f.rrp.value=display(rrp) - f.ecost.value=display(ecost) - f.GST.value=display(GST) - f.total.value=display(total) + f.rrp.value=rrp; + f.ecost.value=ecost; + f.GST.value=GST; + f.total.value=total; } @@ -61,8 +61,8 @@ win.document.write(""); "> "> "> -"> -"> +"> +"> " value=""> @@ -136,7 +136,7 @@ win.document.write(""); " onchange='update(this.form)'> - Port budgété + Taxes diff --git a/updater/updatedatabase b/updater/updatedatabase index d1ddc3e6ea..1061d777a2 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -521,6 +521,15 @@ my %tabledata = ( explanation => 'the email adress where borrowers modifs are sent', type => 'free' }, + { + uniquefieldrequired => 'variable', + variable => 'gist', + forceupdate => { 'explanation' => 1, + 'type' => 1 }, + value => '0.125', + explanation => 'the gist rate. NOT in %, but in numeric form (0.12 for 12%)', + type => 'free' + }, ], ); @@ -857,6 +866,13 @@ $sth->finish; exit; # $Log$ +# Revision 1.53 2003/07/07 14:11:16 tipaul +# fixing bug #526 : gst rate is now calculated through systempref gist entry. +# Before this fix : +# * was harcoded to 12,5% +# * some bugs in template parameters prevented the javascript to work. +# * some bugs prevented some calculations to be done properly. +# # Revision 1.52 2003/06/23 15:54:32 tipaul # *** empty log message *** # -- 2.39.5