diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 8b269d92..9f7de6dd 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -139,6 +139,13 @@ select.form-control { background-color:#795548; } +.others-color{ + background-color:#E1BEE7; + height: 30px !important; + line-height: 30px !important; +} + + .cashier_number:hover{ background:#A9F5F2; } diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index b4b29303..e712ed9d 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -264,8 +264,6 @@ class SalePayment < ApplicationRecord end def sale_update_payment_status(paid_amount) - puts paid_amount - puts "parid Masssssssssssssssssssssssssssssssssssssssss" #update amount_outstanding self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f self.sale.save! @@ -316,8 +314,6 @@ class SalePayment < ApplicationRecord self.sale.rebate_status = nil end end - puts "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr" - puts response.to_json end self.sale.save! @@ -375,7 +371,8 @@ class SalePayment < ApplicationRecord paypar.each do |pp| if pp.payment_method == "paypar" payparcost = payparcost + pp.payment_amount - elsif pp.payment_method == "creditnote" + end + if pp.payment_method == "creditnote" credit = 1 end end @@ -410,7 +407,9 @@ class SalePayment < ApplicationRecord rescue SocketError response = { "status": false, "message": "Can't connect server"} end - + puts response.to_json + puts payparcost + puts overall_dis redeem_amount = payparcost + overall_dis total_percentage = 0 @@ -431,15 +430,19 @@ class SalePayment < ApplicationRecord data = {:type => a[:type], :amount => a[:amount]} type_arr.each do |si| if si[:type] == a[:type] - amount = (redeem_amount / total_percentage)*si[:percentage] - actual = a[:amount] - amount - data[:amount] = actual + if credit == 1 + data[:amount] = 0 + else + amount = (redeem_amount / total_percentage)*si[:percentage] + actual = a[:amount] - amount + data[:amount] = actual + end + end - end rebate_arr.push(data) end - + total_amount = rebate_prices - payparcost - overall_dis if credit == 1 @@ -485,6 +488,7 @@ class SalePayment < ApplicationRecord response = { "status": "no_member", "message": "Not membership"} end + end diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 846487be..a911acf4 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -148,7 +148,7 @@
<% if @other != 0.0 %> -
+
MPU
<%= @other %>
@@ -162,7 +162,7 @@ <% end %> <% if @ppamount != 0.0 %> -
+
Redeem
<%= @ppamount %>
@@ -176,7 +176,7 @@ <% end %> <% if @visacount != 0.0 %> -
+
Visa
<%= @visacount %>
@@ -190,7 +190,7 @@ <% end %> <% if @jcbcount != 0.0 %> -
+
JCB
<%= @jcbcount %>
@@ -204,7 +204,7 @@ <% end %> <% if @mastercount != 0.0 %> -
+
Master
<%= @mastercount %>
diff --git a/app/views/origami/redeem_payments/index.html.erb b/app/views/origami/redeem_payments/index.html.erb index 50347dd1..23b6dc29 100755 --- a/app/views/origami/redeem_payments/index.html.erb +++ b/app/views/origami/redeem_payments/index.html.erb @@ -174,9 +174,10 @@ data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id}, success: function(result){ if(result.status == true){ + console.log(result) swal({ title: "Information!", - text: result.status, + text: result.message, }, function () { window.location.href = '/origami/sale/'+ sale_id + "/payment" }); diff --git a/app/views/reports/saleitem/_shift_sale_report_filter.html.erb b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb index b6dfe98f..c913b592 100755 --- a/app/views/reports/saleitem/_shift_sale_report_filter.html.erb +++ b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb @@ -3,7 +3,7 @@ <% if period_type != false %>
- +