From fed46148ba24de023d9677792a54107e4e1ba934 Mon Sep 17 00:00:00 2001 From: Shinoy M Date: Mon, 2 Jul 2012 18:18:31 +0530 Subject: [PATCH] Bug 8343 - Editable discount rate and miscellaneous charges during ordering Add new fields like -Discount percentage- and -Miscellaneous cost- in the order page.Default discount rate will be shown in the Discount percentage field and it is editable.You can enter Miscellaneous charges in the Miscellaneous cost field and it is calculated per quantity. --- acqui/neworderempty.pl | 2 +- koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 10 +++++++- .../prog/en/modules/acqui/neworderempty.tt | 21 ++++++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index a461a1b..bf904c5 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -359,7 +359,7 @@ $template->param( authorisedbyname => $borrower->{'firstname'} . " " . $borrower->{'surname'}, biblioitemnumber => $data->{'biblioitemnumber'}, discount_2dp => sprintf( "%.2f", $bookseller->{'discount'}) , # for display - discount => $bookseller->{'discount'}, + discount => defined($data->{'discount'}) ? $data->{'discount'} : $bookseller->{'discount'}, listincgst => $bookseller->{'listincgst'}, invoiceincgst => $bookseller->{'invoiceincgst'}, name => $bookseller->{'name'}, diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js index 2efeba0..ac76914 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js @@ -645,6 +645,7 @@ function calcNeworderTotal(){ var quantity = new Number(f.quantity.value); var discount = new Number(f.discount.value); var listinc = new Number (f.listinc.value); + var miscellaneous = new Number (f.miscellaneous.value); //var currency = f.currency.value; var applygst = new Number (f.applygst.value); var listprice = new Number(f.listprice.value); @@ -657,9 +658,9 @@ function calcNeworderTotal(){ //do real stuff var rrp = new Number(listprice*exchangerate); - var ecost = rrp; + var ecost = rrp + miscellaneous; if (100-discount != 100) { //Prevent rounding issues if no discount - ecost = new Number(Math.floor(rrp * (100 - discount ))/100); + ecost = new Number((Math.floor(rrp * (100 - discount ))/100)+miscellaneous); } var GST = new Number(0); if (gst_on) { @@ -682,6 +683,11 @@ function calcNeworderTotal(){ if (f.GST) { f.GST.value=GST; } + +// In case the discount changed, we should update the message + var discount_2dp = discount.toFixed(2); + $('#discount_value').html(discount_2dp); + return true; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 566318f..f6366c1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -222,7 +222,6 @@ $(document).ready(function() - @@ -464,13 +463,31 @@ $(document).ready(function()
  • [% IF ( close ) %] + Discount percentage: + + [% ELSE %] + + + [% END %] +
  • +
  • + [% IF ( close ) %] + Miscellaneous cost: + + [% ELSE %] + + + [% END %] +
  • +
  • + [% IF ( close ) %] [% ELSE %] [% END %] - [% IF ( discount_2dp ) %] (adjusted for [% discount_2dp %]% discount) [% END %] + [% IF ( discount_2dp ) %] (adjusted for [% discount_2dp %]% discount) [% END %]
  • [% IF ( GST ) %] -- 1.6.4.2