Bug 5466 - Acquisitions - ability to set currency in order screens

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Savitra Sirohi 2011-03-18 17:11:01 +01:00 committed by Chris Cormack
parent 6ba6b2e148
commit 589aac1540
4 changed files with 30 additions and 10 deletions

View file

@ -217,6 +217,10 @@ if ( $op eq 'delete_confirm' ) {
"loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
$basket->{creationdate}, $basket->{authorisedby};
#to get active currency
my $cur = GetCurrency();
my @results = GetOrders( $basketno );
my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
@ -310,7 +314,8 @@ if ( $op eq 'delete_confirm' ) {
gist_rrp => sprintf( "%.2f", $gist_rrp ),
total_rrp_gsti => sprintf( "%.2f", $total_rrp_gsti ),
total_est_gsti => sprintf( "%.2f", $total_est_gsti ),
currency => $bookseller->{'listprice'},
# currency => $bookseller->{'listprice'},
currency => $cur->{'currency'},
qty_total => $qty_total,
GST => $gist,
basketgroups => $basketgroups,

View file

@ -209,8 +209,9 @@ my $count = scalar @rates;
my @loop_currency = ();
for ( my $i = 0 ; $i < $count ; $i++ ) {
my %line;
$line{currency} = $rates[$i]->{'currency'};
$line{currcode} = $rates[$i]->{'currency'};
$line{rate} = $rates[$i]->{'rate'};
$line{selected} = 1 if ($line{currcode} eq $data->{currency});
push @loop_currency, \%line;
}
@ -342,7 +343,7 @@ $template->param(
name => $bookseller->{'name'},
cur_active_sym => $cur->{'symbol'},
cur_active => $cur->{'currency'},
currency => $bookseller->{'listprice'} || $cur->{'currency'}, # eg: 'EUR'
# currency => $bookseller->{'listprice'} || $cur->{'currency'}, # eg: 'EUR'
loop_currencies => \@loop_currency,
orderexists => ( $new eq 'yes' ) ? 0 : 1,
title => $data->{'title'},
@ -354,7 +355,7 @@ $template->param(
quantity => $data->{'quantity'},
quantityrec => $data->{'quantity'},
rrp => $data->{'rrp'},
listprice => sprintf("%.2f", $data->{'listprice'}||$listprice),
listprice => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice),
total => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ),
ecost => $data->{'ecost'},
notes => $data->{'notes'},

View file

@ -645,11 +645,14 @@ function calcNeworderTotal(){
var quantity = new Number(f.quantity.value);
var discount = new Number(f.discount.value);
var listinc = new Number (f.listinc.value);
var currency = f.currency.value;
//var currency = f.currency.value;
var applygst = new Number (f.applygst.value);
var listprice = new Number(f.listprice.value);
var invoiceingst = new Number (f.invoiceincgst.value);
var exchangerate = new Number(f.elements[currency].value); //get exchange rate
// var exchangerate = new Number(f.elements[currency].value); //get exchange rate
var currcode = new String(document.getElementById('currency').value);
var exchangerate = new Number(document.getElementById(currcode).value);
var gst_on=(!listinc && invoiceingst);
//do real stuff

View file

@ -143,7 +143,7 @@ ff.submit();
<input type="hidden" name="biblioitemnumber" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
<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="currency" -->" />
<!-- <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />-->
<input type="hidden" name="applygst" value="<!-- TMPL_VAR NAME="gstreg" -->" />
<input type="hidden" name="invoiceincgst" value="<!-- TMPL_VAR NAME="invoiceincgst" -->" />
<input type="hidden" name="gstrate" value="<!-- TMPL_VAR NAME="gstrate" -->" />
@ -151,7 +151,7 @@ ff.submit();
<input type="hidden" name="import_batch_id" value="<!-- TMPL_VAR name="import_batch_id" -->" />
<!-- TMPL_LOOP NAME="loop_currencies" -->
<input type="hidden" name="<!-- TMPL_VAR NAME="currency" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
<input type="hidden" id="<!-- TMPL_VAR NAME="currcode" -->" name="<!-- TMPL_VAR NAME="currcode" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
<!-- /TMPL_LOOP -->
<ol><li>
<!-- TMPL_IF name="biblionumber" -->
@ -279,14 +279,25 @@ ff.submit();
</select>
<!--/TMPL_IF-->
</li>
<li>
<!-- TMPL_IF name="close" -->
<span class="label">Currency: </span>
<input type="hidden" size="10" name="currency" id="currency" value="<!-- TMPL_VAR NAME="currency" -->" /><!-- TMPL_VAR NAME="currency" -->
<!-- TMPL_ELSE -->
<label for="currency">Currency:</label>
<select name="currency" id="currency" onchange="calcNeworderTotal();">
<!-- TMPL_LOOP name="loop_currencies" -->
<!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="currcode" -->" selected="selected"><!-- TMPL_VAR name="currcode" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="currcode" -->"><!-- TMPL_VAR name="currcode" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP -->
</select>
<!-- /TMPL_IF-->
</li>
<li>
<!-- TMPL_IF name="close" -->
<span class="label">Vendor price: </span>
<input type="hidden" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" /><!-- TMPL_VAR NAME="listprice" -->
<!-- TMPL_ELSE -->
<label for="listprice">Vendor price: </label>
<input type="text" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="calcNeworderTotal()" /> (entered as <!-- TMPL_VAR NAME="currency" -->)
<input type="text" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="calcNeworderTotal()" />
<!--/TMPL_IF-->
</li>
<!-- TMPL_UNLESS NAME="close" -->