From bbfa6450d6a50f4b36e8a83b0daf5d70c61fe780 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 1 Dec 2017 17:39:10 +0630 Subject: [PATCH 1/3] update rounding adj for foc --- app/views/origami/payments/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 796015d6..3ce0ce1e 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -470,7 +470,7 @@ $('#foc').click(function() { //$( "#loading_wrapper" ).show(); // payment - var cash = $('#amount_due').text(); + var cash = $('#amount_due').text() + $('#rounding_adj').text(); var sub_total = $('#sub-total').text(); var sale_id = $('#sale_id').text(); var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total }; From e30d468880b0027e66da00507e31caa14b71c192 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 1 Dec 2017 17:51:30 +0630 Subject: [PATCH 2/3] update sale payment report --- app/models/sale.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/sale.rb b/app/models/sale.rb index 05ae992e..306c37ad 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -850,13 +850,14 @@ def self.get_payment_method_by_shift(shift_sale_range,shift,from,to,payment_type .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") .order('s.receipt_no DESC') - payments_total = SalePayment.select("sales.amount_changed as total_change_amount,CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date, + payments_total = SalePayment.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date, SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount, SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount, SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount, SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount, SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount, SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount, + SUM(case when (sale_payments.payment_method='cash') then sales.amount_changed else 0 end) as total_change_amount, SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount") .joins("join sales on sales.sale_id = sale_payments.sale_id") From 83ed7abbdeea84d4a4f3a712453ccc7f83bfd30e Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 1 Dec 2017 18:51:09 +0630 Subject: [PATCH 3/3] update rounding adj for foc --- app/views/origami/payments/show.html.erb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 3ce0ce1e..6e938777 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -121,7 +121,11 @@
Amount Due
-
<%= @sale_data.grand_total + @rounding_adj rescue 0%>
+
+ + + <%= @sale_data.grand_total + @rounding_adj rescue 0%> +
@@ -470,7 +474,7 @@ $('#foc').click(function() { //$( "#loading_wrapper" ).show(); // payment - var cash = $('#amount_due').text() + $('#rounding_adj').text(); + var cash = $('#grand_total').text(); var sub_total = $('#sub-total').text(); var sale_id = $('#sale_id').text(); var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };