[Koha-patches] [PATCH] Acquisitions - ability to set currency in order screens - Bug 5466
savitra sirohi
savitra.sirohi at osslabs.biz
Thu Dec 2 16:14:57 CET 2010
Hi Chris, the bug for this patch is 5466.
Thanks.
On Wed, Dec 1, 2010 at 4:16 PM, <savitra.sirohi at osslabs.biz> wrote:
> From: Savitra Sirohi <savitra.sirohi at osslabs.biz>
>
> ---
> acqui/basket.pl | 9 +++++++--
> acqui/neworderempty.pl | 7 ++++---
> koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 7 +++++--
> .../prog/en/modules/acqui/neworderempty.tmpl | 19
> +++++++++++++++----
> 4 files changed, 31 insertions(+), 11 deletions(-)
>
> diff --git a/acqui/basket.pl b/acqui/basket.pl
> index 005fcb9..928d150 100755
> --- a/acqui/basket.pl
> +++ b/acqui/basket.pl
> @@ -217,8 +217,12 @@ 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;
> my $discount = $bookseller->{'discount'} / 100;
> my $total_rrp; # RRP Total, its value will be assigned to
> $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'}
> @@ -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,
> diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl
> index 61f0962..3883c46 100755
> --- a/acqui/neworderempty.pl
> +++ b/acqui/neworderempty.pl
> @@ -203,8 +203,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;
> }
>
> @@ -336,7 +337,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'},
> @@ -348,7 +349,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'},
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js
> b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js
> index 537aa26..705bc24 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js
> +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js
> @@ -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
> diff --git
> a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl
> b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl
> index e53c7da..a82029d 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl
> @@ -127,7 +127,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" -->" />
> @@ -135,7 +135,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" -->
> @@ -263,14 +263,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" -->
> --
> 1.5.4.5
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20101202/8b8bebf5/attachment-0001.htm>
More information about the Koha-patches
mailing list