From 1558e8c1654759124538e8bb40f3ba007a7d9bca Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Wed, 4 Oct 2023 17:36:05 +0000 Subject: [PATCH] Bug 34985: Add a quantity field to the manual invoice form This patch add a Quantity field and a Cost field to the manual invoice form this will allow to automatically multiply the amount when it has a default amount. Test plan: 1) Apply the patch 2) Create multiple charge types some with default amount and some without default amount 1-1) Go to Administraion -> Debit types 1-2) Click on New Debit types 1-3) Fill the form check the "Can be manually invoiced?" field 1-5) Click on save 3) Create a manual invoice 2-1) Find a patrons 2-2) Click on Accounting tab 2-3) Click on Create manual invoice tab 2-4) Select a type with default amount set ->Cost field and Quantity field should be added to the form 2-5) Edit the Cost field or Quantity field ->The amount will be automatically calculate 2-6) Select a type with no default amount set ->Cost field and Quantity field should not be added to the form Signed-off-by: Kristi Krueger Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/members/maninvoice.tt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt index 8113199b46..c278c7596b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt @@ -94,6 +94,8 @@
  • +
  • +
  • Example: 5.00
  • @@ -141,11 +143,29 @@ [% UNLESS amount.defined %] $("#maninvoice #desc").val($("#maninvoice #type option:selected").text()); $("#maninvoice #amount").val(type_fees[$("#maninvoice #type option:selected").val()]); + $("#maninvoice #cost").val(type_fees[$("#maninvoice #type option:selected").val()]); + if(!type_fees[$("#maninvoice #type option:selected").val()]){ + $("#maninvoice li.additional_field").hide(); + } [% END %] $("#maninvoice #type").change(function(){ $("#maninvoice #desc").val($(this).find("option:selected").text()); $("#maninvoice #amount").val(type_fees[$(this).val()]); + $("#maninvoice #cost").val(type_fees[$(this).val()]); + $("#maninvoice #quantity").val('1'); + if(type_fees[$(this).val()]){ + $("#maninvoice li.additional_field").show(); + } + else{ + $("#maninvoice li.additional_field").hide(); + } }); + $("#maninvoice #quantity").blur(function(){ + $("#maninvoice #amount").val(($("#maninvoice #cost").val() * $(this).val()).toFixed(2)); + }) + $("#maninvoice #cost").blur(function(){ + $("#maninvoice #amount").val(($("#maninvoice #quantity").val() * $(this).val()).toFixed(2)); + }) }); [% END %] -- 2.39.5