diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 1044bc6f..b45b6402 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -457,9 +457,10 @@ $(function() { var items = $('.selected-set'); if (items.length >= min_qty) { - + if ($('#server_mode').val() != "cloud") { item = get_set_item(items); customer_display_view(item,"set_add"); + } var option = [] attribute_arr = [] @@ -786,8 +787,10 @@ $(function() { $('.add_to_order').attr('data-options',JSON.stringify(option_arr)); $('.add_to_order').attr('data-opt',JSON.stringify(option_arr)); var item_data = $(this); - item = get_item(item_data,"add_to_order"); - customer_display_view(item,"add"); + if ($('#server_mode').val() != "cloud") { + item = get_item(item_data,"add_to_order"); + customer_display_view(item,"add"); + } show_item_detail(item_data,"add_to_order"); calculate_sub_total(); @@ -796,8 +799,10 @@ $(function() { // click plus icon for add $(document).on('click', '.add_icon', function(event){ var item_data = $(this); - item = get_item(item_data,"add_icon"); - customer_display_view(item,"add"); + if ($('#server_mode').val() != "cloud") { + item = get_item(item_data,"add_icon"); + customer_display_view(item,"add"); + } show_item_detail(item_data,"add_icon"); calculate_sub_total(); }); //End Add Icon Click @@ -922,7 +927,9 @@ console.log(d_option) window.location.href = "/origami/room/" + table_id } } - customer_display_view(null,"reload"); + if ($('#server_mode').val() != "cloud") { + customer_display_view(null,"reload"); + } } }); // }else{ diff --git a/app/controllers/origami/dinga_controller.rb b/app/controllers/origami/dinga_controller.rb index 586403f9..87caddfa 100644 --- a/app/controllers/origami/dinga_controller.rb +++ b/app/controllers/origami/dinga_controller.rb @@ -86,11 +86,12 @@ def create # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no) - if status == true + status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no) + + if status == true && @membership_data["status"] == true @out = true, "Success!" else - @out =false, "Please try again payment!" + @out =false, @membership_data["message"] end end end diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb index 1321cf87..e9d3cb6c 100644 --- a/app/controllers/origami/paymal_controller.rb +++ b/app/controllers/origami/paymal_controller.rb @@ -88,11 +88,11 @@ def create # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no) - if status == true + status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no) + if status == true && @membership_data["status"] == true @out = true, "Success!" else - @out =false, "Please try again payment!" + @out =false, @membership_data["message"] end end end diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index cff7887c..a86fb9b2 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -20,7 +20,7 @@ authorize_resource :class => false payment_type = params[:payment_type] @sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type) @sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type) - @tax_profiles = TaxProfile.order('order_by asc') + @tax_profiles = TaxProfile.order('order_by asc').limit(2) @from = from @to = to # get printer info diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 3dba0a9b..5f372581 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -23,6 +23,7 @@ class SalePayment < ApplicationRecord if (amount_due >= 0) payment_status = false + membership_data = nil #route to payment type case payment_method when "cash" @@ -52,11 +53,11 @@ class SalePayment < ApplicationRecord when "foc" payment_status = foc_payment when "paymal" - payment_status = paymal_payment + payment_status,membership_data = paymal_payment when "JunctionPay" payment_status = junction_pay_payment when "dinga" - payment_status = dinga_payment + payment_status,membership_data = dinga_payment else puts "it was something else" end @@ -73,7 +74,7 @@ class SalePayment < ApplicationRecord end end - return true, self.save + return true, self.save,membership_data else #record an payment in sale-audit # remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]" @@ -430,7 +431,7 @@ class SalePayment < ApplicationRecord sale_update_payment_status(0) end - return payment_status + return payment_status,membership_data end def junction_pay_payment @@ -480,7 +481,7 @@ class SalePayment < ApplicationRecord sale_update_payment_status(0) end - return payment_status + return payment_status,membership_data end diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 235e958a..4b9a94c2 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -490,11 +490,13 @@ <% end %> - + " id="server_mode"> + +