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.
This commit is contained in:
tipaul 2003-07-07 14:11:16 +00:00
parent 68d49adece
commit a8574a5b83
6 changed files with 43 additions and 27 deletions

View file

@ -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'}),

View file

@ -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'},

View file

@ -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+<TMPL_VAR name="gstrate">);
GST=ecost*(<TMPL_VAR name="gstrate">);
}
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("</font></body></html>");
<input type=hidden name=oldtype value="<TMPL_VAR name="itemtype">">
<input type=hidden name=discount value="<TMPL_VAR name="discount">">
<input type=hidden name=listinc value="<TMPL_VAR name="listincgst">">
<input type=hidden name=currency value="<TMPL_VAR name="listprice">">
<input type=hidden name=applygst value="<TMPL_VAR name"gstreg">">
<input type=hidden name=currency value="<TMPL_VAR name="currency">">
<input type=hidden name=applygst value="<TMPL_VAR name="gstreg">">
<TMPL_LOOP name="loop_currencies">
<input type=hidden name="<TMPL_VAR name="currency">" value="<TMPL_VAR name="rate">">
</TMPL_LOOP>

View file

@ -10,8 +10,8 @@
<td width="10%"><b>Isbn</b></td>
<td width="30%"><b>Titre</b></td>
<td width="20%"><b>Auteur</b></td>
<td width="6%"><b>? frais</b></td>
<td width="8%"><b>? est</b></td>
<td width="6%"><b>Px rempl</b></td>
<td width="8%"><b>Px est</b></td>
<td width="8%"><b>Qté</b></td>
<td width="8%"><b>Total</b></td>
</tr>
@ -21,8 +21,8 @@
<td><TMPL_VAR name="isbn"></td>
<td><a href="newbiblio.pl?ordnum=<TMPL_VAR name="ordernumber">&id=<TMPL_VAR name="booksellerid">&basket=<TMPL_VAR name="basket">"><TMPL_VAR name="title"></a></td>
<td><TMPL_VAR name="author"></td>
<td><TMPL_VAR name="rrp">"></td>
<td><TMPL_VAR name="ecost">"></td>
<td><TMPL_VAR name="rrp"></td>
<td><TMPL_VAR name="ecost"></td>
<td><TMPL_VAR name="quantity"></td>
<td><TMPL_VAR name="line_total"></td>
</tr>

View file

@ -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+<TMPL_VAR name="gstrate">);
GST=ecost*<TMPL_VAR name="gstrate">;
}
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("</font></body></html>");
<input type=hidden name=oldtype value="<TMPL_VAR name="itemtype">">
<input type=hidden name=discount value="<TMPL_VAR name="discount">">
<input type=hidden name=listinc value="<TMPL_VAR name="listincgst">">
<input type=hidden name=currency value="<TMPL_VAR name="listprice">">
<input type=hidden name=applygst value="<TMPL_VAR name"gstreg">">
<input type=hidden name=currency value="<TMPL_VAR name="currency">">
<input type=hidden name=applygst value="<TMPL_VAR name="gstreg">">
<TMPL_LOOP name="loop_currencies">
<input type=hidden name="<TMPL_VAR name="currency">" value="<TMPL_VAR name="rate">">
</TMPL_LOOP>
@ -136,7 +136,7 @@ win.document.write("</font></body></html>");
<td><input type=text size=20 name=ecost value="<TMPL_VAR name="ecost">" onchange='update(this.form)'></td>
</tr>
<TR VALIGN=TOP>
<TD>Port budgété</td>
<TD>Taxes</td>
<td><input type=text size=20 name=GST value="" onchange='update(this.form)'></td>
</tr>
<TR VALIGN=TOP>

View file

@ -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 ***
#