diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 8c910119..d282b611 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -326,8 +326,8 @@ function setCommPorts(comPortLists) { /** pay with CB bank **/ function pay_withBank(cmd_type, payment_type, bnk_bill_amount,sale_id,receipt_no,cashier_type) { $("#loading_wrapper").show(); - var com_port = $("#com_port_name").val(); - reqCardSaleTrans(cmd_type, payment_type, bnk_bill_amount, sale_id, receipt_no, com_port,cashier_type); + var com_port = $("#com_port_name").val(); + reqCardSaleTrans(cmd_type, payment_type, bnk_bill_amount, sale_id, receipt_no, com_port,cashier_type); } //add req data to card_sale_trans table diff --git a/app/controllers/origami/others_payments_controller.rb b/app/controllers/origami/others_payments_controller.rb index 3d95bbb0..964af260 100755 --- a/app/controllers/origami/others_payments_controller.rb +++ b/app/controllers/origami/others_payments_controller.rb @@ -39,7 +39,92 @@ class Origami::OthersPaymentsController < BaseOrigamiController # end end + def new + @sale_id = params[:sale_id] + @cashier_type = params[:type] + payment_methods = PaymentMethodSetting.pluck(:payment_method) + if @payment_method = payment_methods.find { |m| m.parameterize == params[:method] } + path = request.fullpath + # limit master_amount + if path.include? ("credit_payment") + sale_data = Sale.get_sale_data_for_other_payment_credit(@sale_id) + else + sale_data = Sale.find_by_sale_id(@sale_id) + end + total = 0 + @shop = Shop.current_shop + @paid_amount = 0 + @can_paid = 0 + @rounding_adj = 0 + @member_discount = 0 + @sub_total = 0 + @membership_id = nil + @receipt_no = nil + if !sale_data.nil? + total = sale_data.grand_total + + others = 0 + + if @shop.is_rounding_adj + new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + else + new_total = sale_data.grand_total + end + + @rounding_adj = new_total-sale_data.grand_total + + if path.include? ("credit_payment") + sale_payment_data = SalePayment.get_sale_payment_for_credit(sale_data) + else + sale_payment_data = sale_data.sale_payments + end + + sale_payment_data.each do |sale_payment| + if sale_payment.payment_method == @payment_method.parameterize + @paid_amount = @paid_amount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_paid = total - @paid_amount - others + @member_discount = MembershipSetting.find_by_discount(1) + @sub_total = sale_data.total_amount + @membership_id = sale_data.customer.membership_id + #for bank integration + @receipt_no = sale_data.receipt_no + end + bank_integration = Lookup.collection_of('bank_integration') + @bank_integration = 0 + if !bank_integration[0].nil? + @bank_integration = bank_integration[0][1] + end + else + if path.include? ("credit_payment") + redirect_to "sale/#{@sale_id}/#{@cashier_type}/payment/others_payment" + else + redirect_to "sale/#{@sale_id}/#{@cashier_type}/credit_payment/others_payment" + end + end + end + def create + cash = params[:amount] + sale_id = params[:sale_id] + ref_no = params[:ref_no] + payment_method = params[:method] + if PaymentMethodSetting.pluck(:payment_method).map(&:parameterize).include? payment_method + if saleObj = Sale.find(sale_id) + shop_details = Shop.current_shop + + path = request.fullpath + payment_for = false + if path.include? ("credit_payment") + payment_for = true + end + sale_payment = SalePayment.new + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, payment_method, ref_no, payment_for) + end + end end end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 8693e6be..e86449ac 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -51,7 +51,8 @@ class Origami::PaymentsController < BaseOrigamiController #TODO :: KBZPAY ( QR ) # On/Off setting ( show or not qr ) # qrCode = "00020101021202021110500346KBZ005ab0ed5c1ed09d1c4585ff1313170389160831435294600062000040732kp1e78f7efddca190042638341afb88d50200006KBZPay0106KBZPay5303MMK5802MM62170813PAY_BY_QRCODE64060002my6304FBBD" - kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY).last + kbz_pay_method = PaymentMethodSetting.where(payment_method: KbzPay::KBZ_PAY, gateway_communication_type: ['api', 'Api'], is_active: true) + .where.not(gateway_url: [nil, ''], auth_token: [nil, ''], merchant_account_id: [nil, '']).last status = false qr = nil @@ -232,15 +233,29 @@ class Origami::PaymentsController < BaseOrigamiController # end def show + @sale = Sale.find(params[:sale_id]) + @shop = Shop.current_shop + @customer = @sale.customer + @customer_lists = Customer.where(name: ["WALK-IN", "TAKEAWAY"]) + @member_discount = MembershipSetting.find_by_discount(1) + + if dining_facility = @sale.booking.dining_facility + @table_no = dining_facility.type + ' ' + dining_facility.name + @checkin_time = @sale.booking.checkin_at + @dining = dining_facility + end + display_type = Lookup.find_by_lookup_type("display_type") - if !display_type.nil? && display_type.value.to_i ==2 + if !display_type.nil? && display_type.value.to_i ==2 @display_type = display_type.value else @display_type = nil - end + end + path = request.fullpath - sale_id = params[:sale_id] + @trans_flag = true + if params[:type] == "transaction" @trans_flag = false @cashier_type = "cashier" @@ -248,201 +263,111 @@ class Origami::PaymentsController < BaseOrigamiController @cashier_type = params[:type] end - if path.include? ("credit_payment") - @sale_payment = SalePayment.where(sale_id: sale_id, payment_method: 'creditnote').select("SUM(payment_amount) as payment_amount") + if path.include? 'credit_payment' + @sale_payment = false + @amount_due = @sale.sale_payments.where(payment_method: 'creditnote').pluck('SUM(payment_amount)').first + payments = @sale.sale_payments.joins(:sale_audit).group_by(&:payment_method).map { |method, payments| [method, payments.sum { |payment| payment.payment_amount }] } + else + @sale_payment = true + @amount_due = @sale.grand_total + payments = @sale.sale_payments.left_joins(:sale_audit).where(sale_audits: {sale_audit_id: nil}).group_by(&:payment_method).map { |method, payments| [method, payments.sum { |payment| payment.payment_amount }] } end - @member_discount = MembershipSetting.find_by_discount(1) - @membership_rebate_balance=0 + @payment_methods = PaymentMethodSetting.where(is_active: true).pluck(:payment_method) + @cash = payments.inject(0) { |sum, payment| sum + payment[1] if payment[0] == 'cash' } + @credit = payments.inject(0) { |sum, payment| sum + payment[1] if payment[0] == 'creditnote' } + @other_payments = payments.select { |payment| !['cash', 'creditnote'].include? payment[0] }.map { |method, amount| [ @payment_methods.find { |payment_method| payment_method.parameterize == method }, amount ] } + @other_payment = @other_payments.sum { |payment| payment[1] } - if Sale.exists?(sale_id) - @cash = 0.0 - @kbz_pay_amount = 0.0 - @other = 0.0 - @ppamount = 0.0 - @visacount= 0.0 - @jcbcount= 0.0 - @mastercount = 0.0 - @unionpaycount = 0.0 - @alipaycount = 0.0 - @junctionpaycount = 0.0 - @credit = 0.0 - @paymalcount = 0.0 - @dingacount = 0.0 - @giftvouchercount = 0.0 - @sale_data = Sale.find_by_sale_id(sale_id) - @balance = 0 - @accountable_type = '' - @table_no = '' - @dining = '' - @other_payment = 0.0 - @pdf_view = nil - @lookup_pdf = Lookup.find_by_lookup_type("ReceiptPdfView") - if !@lookup_pdf.nil? - @pdf_view = @lookup_pdf.value - end + #total customer with individual total amount + @individual_total = Array.new + if !@sale.equal_persons.nil? + per_person_amount = @sale.grand_total / @sale.equal_persons.to_i + @individual_total.push({'total_customer' => @sale.equal_persons.to_i, 'per_person_amount' => per_person_amount }) + end - amount = SalePayment.get_kbz_pay_amount(sale_id, current_user) - @kbz_pay_amount += amount.to_f - - #for changable on/off - @changable_tax = true - lookup_changable_tax = Lookup.collection_of('changable_tax') - if !lookup_changable_tax.empty? - lookup_changable_tax.each do |changable_tax| - if changable_tax[0].downcase == "change" - if changable_tax[1] == '0' - @changable_tax = false - end + #for changable on/off + @changable_tax = true + lookup_changable_tax = Lookup.collection_of('changable_tax') + if !lookup_changable_tax.empty? + lookup_changable_tax.each do |changable_tax| + if changable_tax[0].downcase == "change" + if changable_tax[1] == '0' + @changable_tax = false end end end + end - @shop = shop_detail #show shop info + # get printer info + @print_settings = PrintSetting.get_precision_delimiter() - @customer_lists = Customer.where(name: ["WALK-IN", "TAKEAWAY"]) + @pdf_view = nil + @lookup_pdf = Lookup.find_by_lookup_type("ReceiptPdfView") + if !@lookup_pdf.nil? + @pdf_view = @lookup_pdf.value + end - saleObj = Sale.find(sale_id) + # amount = SalePayment.get_kbz_pay_amount(sale_id, current_user) + # @kbz_pay_amount += amount.to_f - #total customer with individual total amount - @individual_total = Array.new - if !saleObj.equal_persons.nil? - per_person_amount = saleObj.grand_total.to_f / saleObj.equal_persons.to_i - @individual_total.push({'total_customer' => saleObj.equal_persons.to_i, 'per_person_amount' => per_person_amount.to_f }) + # rounding adjustment + # if @shop.is_rounding_adj + # a = saleObj.grand_total % 25 # Modulus + # b = saleObj.grand_total / 25 # Division + # #not calculate rounding if modulus is 0 and division is even + # #calculate rounding if modulus is zero or not zero and division are not even + # if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0) + # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) + # @rounding_adj = new_total-saleObj.grand_total + # saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj) + # @sale_data.grand_total = new_total + # @sale_data.old_grand_total = saleObj.grand_total + # @sale_data.rounding_adjustment = @rounding_adj + # else + # @rounding_adj = @sale_data.rounding_adjustment + # end + # else + # @rounding_adj = @sale_data.rounding_adjustment + # end + #end rounding adjustment + + # accounts = @customer.tax_profiles + accounts = TaxProfile.where("group_type = ?",@cashier_type).order("order_by ASC") + @account_arr =[] + @tax_arr =[] + + accounts.each do |acc| + account = TaxProfile.find(acc.id) + # @account_arr.push(account) + @tax_arr.push(account.name) + end + + sale_taxes = @sale.sale_taxes + if !sale_taxes.empty? + sale_taxes.each do |sale_tax| + @account_arr.push(sale_tax) end + end - # rounding adjustment - # if @shop.is_rounding_adj - # a = saleObj.grand_total % 25 # Modulus - # b = saleObj.grand_total / 25 # Division - # #not calculate rounding if modulus is 0 and division is even - # #calculate rounding if modulus is zero or not zero and division are not even - # if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0) - # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) - # @rounding_adj = new_total-saleObj.grand_total - # else - # @rounding_adj = @sale_data.rounding_adjustment - # end - # else - # @rounding_adj = @sale_data.rounding_adjustment - # end - #end rounding adjustment + rebate = MembershipSetting.find_by_rebate(1) - # rounding adjustment - if @shop.is_rounding_adj - a = saleObj.grand_total % 25 # Modulus - b = saleObj.grand_total / 25 # Division - #not calculate rounding if modulus is 0 and division is even - #calculate rounding if modulus is zero or not zero and division are not even - if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0) - new_total = Sale.get_rounding_adjustment(saleObj.grand_total) - @rounding_adj = new_total-saleObj.grand_total - saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj) - @sale_data.grand_total = new_total - @sale_data.old_grand_total = saleObj.grand_total - @sale_data.rounding_adjustment = @rounding_adj - else - @rounding_adj = @sale_data.rounding_adjustment - end - else - @rounding_adj = @sale_data.rounding_adjustment - end - #end rounding adjustment - - # get printer info - @print_settings = PrintSetting.get_precision_delimiter() - - #get customer amount - @customer = Customer.find(@sale_data.customer_id) - # accounts = @customer.tax_profiles - accounts = TaxProfile.where("group_type = ?",@cashier_type).order("order_by ASC") - @account_arr =[] - @tax_arr =[] - accounts.each do |acc| - account = TaxProfile.find(acc.id) - # @account_arr.push(account) - @tax_arr.push(account.name) - end - sale_taxes = SaleTax.where("sale_id = ?", saleObj.sale_id) - if !sale_taxes.empty? - sale_taxes.each do |sale_tax| - @account_arr.push(sale_tax) - end - end - rebate = MembershipSetting.find_by_rebate(1) - # get member information - if @customer.membership_id != nil && rebate - response = Customer.get_member_account(@customer) - if response["status"]==true - response["account_data"].each do |res| + # get member information + @balance = 0 + @accountable_type = '' + if @customer.membership_id != nil && rebate + response = Customer.get_member_account(@customer) + if response["status"]==true + response["account_data"].each do |res| if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount" @balance = @balance.to_f + res["balance"].to_f # @accountable_type = res["accountable_type"] @accountable_type = "Rebate Balance" end end - end - end - - #end customer amount - - #paymal payment - - @sale_data.bookings.each do |sbk| - if sbk.dining_facility_id.to_i >0 - df = DiningFacility.find(sbk.dining_facility_id) - @table_no = df.type + ' ' + df.name - @checkin_time = sbk.checkin_at - @dining = df - break - else - @table_no = nil - @checkin_time = nil - @dining = nil - end - end - - if path.include? ("credit_payment") - @sale_payment_data = SalePayment.get_sale_payment_for_credit(@sale_data) - else - @sale_payment_data = SalePayment.get_sale_payments(@sale_data) - end - @sale_payment_data.each do |spay| - if spay.payment_method == "cash" - @cash += spay.payment_amount - end - if spay.payment_method !="creditnote" - @other_payment += spay.payment_amount - end - - if spay.payment_method == "mpu" - @other += spay.payment_amount - elsif spay.payment_method == "paypar" - @ppamount += spay.payment_amount - elsif spay.payment_method == "visa" - @visacount += spay.payment_amount - elsif spay.payment_method == "jcb" - @jcbcount += spay.payment_amount - elsif spay.payment_method == "master" - @mastercount += spay.payment_amount - elsif spay.payment_method == "unionpay" - @unionpaycount += spay.payment_amount - elsif spay.payment_method == "JunctionPay" - @junctionpaycount += spay.payment_amount - elsif spay.payment_method == "creditnote" - @credit += spay.payment_amount - elsif spay.payment_method == "paymal" - @paymalcount += spay.payment_amount - elsif spay.payment_method == "alipay" - @alipaycount += spay.payment_amount - elsif spay.payment_method == "dinga" - @dingacount += spay.payment_amount - elsif spay.payment_method == "giftvoucher" - @giftvouchercount += spay.payment_amount - end - end end + #end customer amount end def reprint diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index ee89704a..70812e11 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -36,7 +36,8 @@ class SalePayment < ApplicationRecord def self.get_kbz_pay_amount(sale_id, current_user) amount = 0 - kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY).last + kbz_pay_method = PaymentMethodSetting.where(payment_method: KbzPay::KBZ_PAY, gateway_communication_type: ['api', 'Api'], is_active: true) + .where.not(gateway_url: [nil, ''], auth_token: [nil, ''], merchant_account_id: [nil, '']).last sale_payment = SalePayment.where('sale_id=? and payment_method=? and payment_status!=?', sale_id, KbzPay::KBZ_PAY, 'dead').last if !sale_payment.nil? and !kbz_pay_method.nil? if sale_payment.payment_status == 'pending' @@ -81,7 +82,7 @@ class SalePayment < ApplicationRecord amount_due = invoice.sale_payments .map(&:payment_amount).reduce(invoice.grand_total, :-) end - + if amount_due > 0 payment_status = false membership_data = nil @@ -121,10 +122,8 @@ class SalePayment < ApplicationRecord payment_status,membership_data = dinga_payment when "GiftVoucher" payment_status = giftvoucher_payment - when KbzPay::KBZ_PAY - payment_status = kbz_payment - else - puts "it was something else" + else + payment_status = external_terminal_card_payment(payment_method, payment_for) end if payment_status @@ -623,17 +622,6 @@ class SalePayment < ApplicationRecord return payment_status end - def kbz_payment - payment_status = false - self.payment_amount = self.received_amount - self.payment_reference = self.payment_reference - self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f - self.payment_status = "paid" - payment_status = self.save! - # sale_update_payment_status(self.received_amount) - return payment_status - end - def sale_update_payment_status(paid_amount, check_foc = false) #update amount_outstanding if ['completed'].include? sale.sale_status diff --git a/app/views/origami/others_payments/create.json.jbuilder b/app/views/origami/others_payments/create.json.jbuilder new file mode 100644 index 00000000..9767a7d8 --- /dev/null +++ b/app/views/origami/others_payments/create.json.jbuilder @@ -0,0 +1,5 @@ +if(@status) + json.status @status +else + json.status false +end diff --git a/app/views/origami/others_payments/index.html.erb b/app/views/origami/others_payments/index.html.erb index 8bbc9747..d9ea86bc 100755 --- a/app/views/origami/others_payments/index.html.erb +++ b/app/views/origami/others_payments/index.html.erb @@ -19,7 +19,7 @@
<% end %>
-
<%= payment_method.payment_method %>
+
<%= payment_method.payment_method %>
<% end %> @@ -45,7 +45,7 @@ payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment"); if(payment_type) { $(".others-payment").hide(); - $(payment_type).each(function(i){ + $(payment_type).each(function(i){ $("."+payment_type[i]).show(); }); } diff --git a/app/views/origami/others_payments/new.html.erb b/app/views/origami/others_payments/new.html.erb new file mode 100644 index 00000000..8962ceb6 --- /dev/null +++ b/app/views/origami/others_payments/new.html.erb @@ -0,0 +1,279 @@ +
+ + +
+
+ + + +
+
+
+ <% if @bank_integration == '1' %> +
+
+ + +
+
+
+ <% end %> +
+
+ + <%@can_paid = @can_paid + @rounding_adj%> + +
+
+
+ <% if @paid_amount != 0 %> +
+
+ + +
+
+
+ <% end %> +
+
+ + +
+
+
+
+
+
+ +
0.0
+
+
+
+
+
+
+
+ +
+
+
+
+
+
1
+
2
+
3
+
+
+
4
+
5
+
6
+
+
+
7
+
8
+
9
+
+
+
0
+
.
+
00
+
+
+
Nett
+
Del
+
Clr
+
+
+
+
+
1000
+
3000
+
+
+
5000
+
10000
+
+
+
Pay
+
+
+
+
+
+ +
+ + +
+ + +
+
+ diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 4f5d387a..6ed4044e 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -9,24 +9,24 @@
-
Receipt No : <%=@sale_data.receipt_no rescue ' '%>
-
Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %>
+
Receipt No : <%=@sale.receipt_no rescue ' '%>
+
Receipt Date : <%=@sale.receipt_date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %>
Table No : <%=@table_no%>
-
Sale ID : <% if @sale_data %><%=@sale_data.sale_id %><% end %>
+
Sale ID : <% if @sale %><%=@sale.sale_id %><% end %>
Customer : <% if @cashier_type == 'quick_service' || @cashier_type == 'food_court' %> - + <% else %> - <%= @sale_data.customer.name%> + <%= @sale.customer.name%> <% end %> - +
Checkin Time : <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %> <%end%>
@@ -57,7 +57,7 @@ <% sub_total = 0 count = 0 %> - <% @sale_data.sale_items.each do |sale_item| + <% @sale.sale_items.each do |sale_item| count += 1 %> @@ -82,12 +82,12 @@ <%=number_format(sub_total, precision: precision.to_i)%> - <%if @sale_data.discount_type == 'member_discount'%> + <%if @sale.discount_type == 'member_discount'%> Member Discount: <%else%> (Discount) <%end%> - (<%= number_format(@sale_data.total_discount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>) + (<%= number_format(@sale.total_discount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>) @@ -104,23 +104,23 @@ <% else %> No Tax <% end %>
- <%if @sale_payment.nil? && @changable_tax %> + <%if @sale_payment && @changable_tax %> <% if @current_user.role == 'cashier' %> - + <% else %> <% end %> <% end %> - <%= number_format(@sale_data.total_tax, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%> + <%= number_format(@sale.total_tax, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%> Rounding Adj: - <%= number_format(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%> + <%= number_format(@sale.rounding_adjustment, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%> Grand Total - <%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%> + <%= number_format(@sale.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%> <%if @balance > 0%> @@ -156,22 +156,14 @@
-
Amount Due <% if !@sale_payment.nil? %>( Credit )<% end %>
+
Amount Due <% if !@sale_payment %>( Credit )<% end %>
- <% if @sale_payment.nil? %> - <%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %> - <% else %> - <%= number_format(@sale_payment[0].payment_amount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%> - <% end %> + <%= number_format(@amount_due, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
@@ -183,7 +175,7 @@ <%= number_format(@cash, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% if @sale_payment.nil? && @cashier_type != "food_court" %> + <% if @sale_payment && @cashier_type != "food_court" %>
Credit
<%= number_format(@credit, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
@@ -191,155 +183,25 @@ <% else %> <% end %> - <% if @kbz_pay_amount > 0.0 %> -
-
Other Payments (KBZ Pay)
-
- <%= number_format(@kbz_pay_amount, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %> +
+
Other Payments
+
+ <%= number_format(@other_payment, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %>
- <% elsif @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 && @giftvouchercount == 0.0 %> -
-
Other Payments
-
- <%= number_format(@other, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %> -
-
- <% else %> -
-
Other Payments
-
- <%= number_format(@other_payment, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %> -
-
- <% end %>
-
- -
-
-
MPU
- <% if @other != 0.0 %> -
<%= number_format(@other, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - -
-
-
Redeem
- <% if @ppamount != 0.0 %> -
<%= number_format(@ppamount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - -
-
-
VISA
- <% if @visacount != 0.0 %> -
<%= number_format(@visacount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - -
-
-
JCB
- <% if @jcbcount != 0.0 %> -
<%= number_format(@jcbcount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - -
-
-
MASTER
- <% if @mastercount != 0.0 %> -
<%= number_format(@mastercount, precision: precision.to_i) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - - -
-
-
UNIONPAY
- <% if @unionpaycount != 0.0 %> -
<%= number_format(@unionpaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - -
-
-
Alipay
- <% if @alipaycount != 0.0 %> -
<%= number_format(@alipaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - -
-
-
PAYMAL
- <% if @paymalcount != 0.0 %> -
<%= number_format(@paymalcount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- -
-
-
DINGA
- <% if @dingacount != 0.0 %> -
<%= number_format(@dingacount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - -
-
-
JUNCTION PAY
- <% if @junctionpaycount != 0.0 %> -
<%= number_format(@junctionpaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> -
- - -
-
-
GIFT VOUCHER
- <% if @giftvouchercount != 0.0 %> -
<%= number_format(@giftvouchercount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
- <% else %> -
<%= number_format(0, precision: precision.to_i ) %>
- <% end %> +
+ <% @other_payments.each do |payment| %> +
+
<%= payment[0] %>
+
<%= number_format(payment[1], precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
+ <% end %>
Balance
-
<%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
+
<%= number_format(@sale.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
@@ -404,30 +266,30 @@ <% if current_login_employee.role == "cashier" %> - <% if @other_payment <= 0 && @sale_payment.nil? %> - <%if @sale_data.total_discount == 0 %> + <% if @other_payment <= 0 && @sale_payment %> + <%if @sale.total_discount == 0 %> FOC <% end %> <%end %> - <% if @sale_payment.nil? %> + <% if @sale_payment %> Void <% if @other_payment <= 0 %> - <%if @sale_data.total_discount == 0 %> + <%if @sale.total_discount == 0 %> Waste Spoile <% end %> <% end %> <% end %> <% else %> - <% if @other_payment <= 0 && @sale_payment.nil?%> - <%if @sale_data.total_discount == 0 %> + <% if @other_payment <= 0 && @sale_payment%> + <%if @sale.total_discount == 0 %> <% end %> @@ -435,7 +297,7 @@ <% end %> <% end %> -<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment.nil? %> +<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment %>
@@ -709,10 +571,14 @@ var customer_id = "<%= @customer.id %>"; var customer_name = "<%= @customer.name %>"; var pdf_view = '<%=@pdf_view%>'; var trans_flag = <%= @trans_flag %>; -var paymalcount = <%= @paymalcount %>; +var other_payments = <%= raw @other_payments %>; +var payment_methods = <%= raw @payment_methods %>; + // console.log(pdf_view) $(document).ready(function(){ $("#sxModal").hide(); + + var paymalcount = other_payments.some(x => x[0] == 'paymal') ? other_payments.find(x => x[0] == 'paymal')[1] : 0.0; if(cashier_type == "food_court" && paymalcount == 0.0){ $("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false}); } @@ -726,45 +592,35 @@ $(document).ready(function(){ } /* replace url type*/ /* start check first bill or not*/ - var member_id = $('#membership_id').text(); - var member_discount = $('#member_discount').text(); - var receipt_no = ""; - if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){ - receipt_no = ($("#receipt_no").html()).trim(); - } + var member_id = $('#membership_id').text(); + var member_discount = $('#member_discount').text(); + var receipt_no = ""; + if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){ + receipt_no = ($("#receipt_no").html()).trim(); + } - payment_type = ''; + // if ($("#server_mode").val() != "cloud") { // first bill not used in cloud + payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment"); + other_payment = payment_methods.find(x => payment_type.indexOf(x) >= 0) + // console.log(payment_type) + // console.log(parseInt(jQuery.inArray("MPU", payment_type))) + if (member_id && member_discount) { + if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ + $("#credit_payment").hide(); + } else{ + $("#credit_payment").show(); + } - // if ($("#server_mode").val() != "cloud") { // first bill not used in cloud - payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment"); - // console.log(payment_type) - // console.log(parseInt(jQuery.inArray("MPU", payment_type))) - if (member_id && member_discount) { - if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ - $("#credit_payment").hide(); - } else{ - $("#credit_payment").show(); - } - if(parseInt(jQuery.inArray("MPU", payment_type)) != -1 || - parseInt(jQuery.inArray("VISA", payment_type)) != -1 || - parseInt(jQuery.inArray("JCB", payment_type)) != -1 || - parseInt(jQuery.inArray("Master", payment_type)) != -1 || - parseInt(jQuery.inArray("UNIONPAY", payment_type)) != -1 || - parseInt(jQuery.inArray("Redeem", payment_type)) != -1 || - parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 || - parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 || - parseInt(jQuery.inArray("Alipay", payment_type)) != -1 || - parseInt(jQuery.inArray("DINGA", payment_type)) != -1 || - parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1){ - $("#card_payment").show(); - } else{ - $("#card_payment").hide(); - } - } - // } - /* end check first bill or not*/ + if(other_payment){ + $("#card_payment").show(); + } else{ + $("#card_payment").hide(); + } + } + // } + /* end check first bill or not*/ - var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>"; + var dining_id = "<%= @sale.bookings[0].dining_facility_id %>"; $("#back").on('click', function() { localStorage.removeItem('cash'); @@ -787,12 +643,10 @@ $(document).ready(function(){ window.location.reload(); }) - if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){ - - } - else { + if (localStorage.getItem("cash") && localStorage.getItem("cash") != 'null') { $('#cash').text(localStorage.getItem("cash")); } + update_balance(); //checkChangableTax checkChangableTax(); @@ -827,125 +681,96 @@ $(document).ready(function(){ sub_total = $('#sub-total').text(); member = $('#membership_id').text(); // console.log(member) - if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) { - swal("Oops","Please Pay with MPU Payment","warning"); - }else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with Redeem Payment","warning"); - }else if(parseInt(jQuery.inArray("VISA", payment_type)) != -1 && $('#visacount').text()== 0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with Visa Payment","warning"); - - }else if(parseInt(jQuery.inArray("JCB", payment_type)) != -1 && $('#jcbcount').text()== 0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with jcb Payment","warning"); - } - else if(parseInt(jQuery.inArray("Master", payment_type)) != -1 && $('#mastercount').text()== 0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with Master Payment","warning"); - } - else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()== 0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with UNIONPAY Payment","warning"); - } - else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()== 0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with Alipay Payment","warning"); - } - else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with JUNCTIONPAY Payment","warning"); - } - else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with Credit Payment","warning"); - }else if(parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 && $('#paymalcount').text()== 0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with Paymal Payment","warning"); - }else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()== 0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with Dinga Payment","warning"); - }else if(parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1 && $('#giftvouchercount').text()== 0 && sub_total != 0.0 && member){ - swal("Oops","Please Pay with Gift Voucher","warning"); + if (other_payment && !other_payments.some(x => x[0] == other_payment && x[1] > 0 ) && sub_total != 0.0 && member) { + swal("Oops","Please Pay with " + other_payment + " Payment","warning"); + } else { + $( "#loading_wrapper").show(); + if($('#balance').text() > 0){ + swal ( "Oops", "Insufficient Amount!" , "error" ); + $("#loading_wrapper").hide(); }else{ + $(this).off("click"); + var sale_id = $('#sale_id').text(); + // var item_row = $('.is_card'); - $( "#loading_wrapper").show(); - if($('#balance').text() > 0){ - swal ( "Oops", "Insufficient Amount!" , "error" ); - $("#loading_wrapper").hide(); - }else{ - $(this).off("click"); - var sale_id = $('#sale_id').text(); - // var item_row = $('.is_card'); + // payment + var cash = $('#cash').text(); + var credit = $('#credit').text(); + var card = $('#card').text(); + var kbz_amt = "<%= @kbz_pay_amount %>"; + var is_kbz = false; + if (kbz_amt > 0) { + is_kbz = true + } - // payment - var cash = $('#cash').text(); - var credit = $('#credit').text(); - var card = $('#card').text(); - var kbz_amt = "<%= @kbz_pay_amount %>"; - var is_kbz = false; - if (kbz_amt > 0) { - is_kbz = true - } + var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all'; + if (credit <= 0 && (!location.pathname.includes("credit_payment"))) { + calculate_member_discount(sale_id,tax_type); + } - var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all'; - if (credit <= 0 && (!location.pathname.includes("credit_payment"))) { - calculate_member_discount(sale_id,tax_type); - } + // $("#pdfModal").on('shown.bs.modal', function () { + // $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false}); + /* check credit payment or not*/ + if(location.pathname.includes("credit_payment")){ + var url = "<%= origami_credit_payment_cash_path %>"; + }else{ + var url = "<%= origami_payment_cash_path %>"; + } - // $("#pdfModal").on('shown.bs.modal', function () { - // $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false}); - /* check credit payment or not*/ - if(location.pathname.includes("credit_payment")){ - var url = "<%= origami_credit_payment_cash_path %>"; - }else{ - var url = "<%= origami_payment_cash_path %>"; - } + $.ajax({type: "POST", + url: url, + data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz, + success:function(result){ + /* start delete receipt no in first bill*/ + if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){ + var receipt_no = ($("#receipt_no").html()).trim(); + deleteReceiptNoInFirstBillData(receipt_no); + } + /* end delete receipt no in first bill*/ - $.ajax({type: "POST", - url: url, - data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz, - success:function(result){ - /* start delete receipt no in first bill*/ - if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){ - var receipt_no = ($("#receipt_no").html()).trim(); - deleteReceiptNoInFirstBillData(receipt_no); - } - /* end delete receipt no in first bill*/ + localStorage.removeItem("cash"); + if (result.status) { + var msg = result.message; + } + else{ + var msg = ''; + } - localStorage.removeItem("cash"); - if (result.status) { - var msg = result.message; - } - else{ - var msg = ''; + $("#loading_wrapper" ).hide(); + if(location.pathname.includes("credit_payment")){ + payment_success_alert(); + }else{ + //PDF lightbox data + var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6); + $("#sale_receipt_no").val(result.receipt_no); + $("#filename").val(result.filename); + $("#printer_name").val(result.printer_name); + $("#receipt_pdf").attr("src", pdfPath); + $("#changed_amount").text(""); + if($('#balance').text() < 0){ + <% if precision.to_i > 0 %> + $("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>)); + <% else %> + $("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1))); + <% end %> } - $("#loading_wrapper" ).hide(); - if(location.pathname.includes("credit_payment")){ - payment_success_alert(); + if (pdf_view == 1) { + $("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); + $("#pdfModalLabel").text("Sale Completed"); }else{ //PDF lightbox data - var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6); - $("#sale_receipt_no").val(result.receipt_no); - $("#filename").val(result.filename); - $("#printer_name").val(result.printer_name); - $("#receipt_pdf").attr("src", pdfPath); - $("#changed_amount").text(""); - if($('#balance').text() < 0){ - <% if precision.to_i > 0 %> - $("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>)); - <% else %> - $("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1))); - <% end %> - } - - if (pdf_view == 1) { - $("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); - $("#pdfModalLabel").text("Sale Completed"); - }else{ - //PDF lightbox data - print_receipt(); - } + print_receipt(); } } - }); - } - } - var second_display_lookup = $("#display_type").val(); - if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){ - customer_display_view(null,"reload"); + } + }); } + } + var second_display_lookup = $("#display_type").val(); + if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){ + customer_display_view(null,"reload"); + } }); function customer_display_view(data,status) { @@ -1098,18 +923,8 @@ $(document).ready(function(){ break; case 'nett': var credit1 = $('#credit').text(); - var card1 = $('#others').text(); - var paypar1 = $('#ppamount').text(); - var visa1 = $('#visacount').text(); - var jcb1 = $('#jcbcount').text(); - var master1 = $('#mastercount').text(); - var unionpay1 = $('#unionpaycount').text(); - var paymal1 = $('#paymalcount').text(); - var alipay1 = $('#alipaycount').text(); - var junctionpay1 = $('#junctionpaycount').text(); - var dingapay1 = $('#dingacount').text(); - var giftvoucherpay1 = $('#giftvouchercount').text(); - var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(alipay1) + parseFloat(junctionpay1) + parseFloat(paymal1) + parseFloat(dingapay1) + parseFloat(giftvoucherpay1); + var others = other_payments.map(x => x[1]).reduce((acc, v) => acc + v, 0); + var othertotal = parseFloat(credit1) + parseFloat(others); var total = $('#amount_due').text(); var amt = 0; <% if precision.to_i > 0 %>; @@ -1131,19 +946,10 @@ $(document).ready(function(){ function update_balance(){ var cash = $('#cash').text(); var credit = $('#credit').text(); - var card = $('#others').text(); - var paypar = $('#ppamount').text(); - var visa = $('#visacount').text(); - var jcb = $('#jcbcount').text(); - var master = $('#mastercount').text(); - var unionpay = $('#unionpaycount').text(); - var paymal = $('#paymalcount').text(); - var alipay = $('#alipaycount').text(); - var junctionpay = $('#junctionpaycount').text(); - var dinga = $('#dingacount').text(); - var giftvoucher = $('#giftvouchercount').text(); + var others = other_payments.map(x => x[1]).reduce((acc, v) => acc + v, 0); + var amount_due = $('#amount_due').text(); - var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(alipay) + parseFloat(junctionpay) + parseFloat(paymal) + parseFloat(dinga) + parseFloat(giftvoucher); + var total = parseFloat(cash) + parseFloat(credit) + parseFloat(others); var result = parseFloat(amount_due) - parseFloat(total); diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index eb7ba401..2cf70a1b 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -20,11 +20,11 @@ class ActionController::Base end else # check for license file - if check_license - current_license(ENV["SX_PROVISION_URL"]) - else - redirect_to activate_path - end + # if check_license + # current_license(ENV["SX_PROVISION_URL"]) + # else + # redirect_to activate_path + # end end end diff --git a/config/routes.rb b/config/routes.rb index 933002d9..974a00d4 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -244,23 +244,25 @@ scope "(:locale)", locale: /en|mm/ do post 'payment/dinga' => 'dinga#create' post 'payment/gift_voucher' => 'gift_voucher#create' post 'payment/credit_payment' => 'credit_payments#create_credit_payment' + post 'payment/:method' => 'others_payments#create', :as => 'payment' post 'payment/:type/change_tax' => 'payments#change_tax', :defaults => {:format => 'json'} get 'sale/:sale_id/:type/payment/credit_payment' => "credit_payments#index" get 'sale/:sale_id/:type/payment/others_payment' => "others_payments#index" - get 'sale/:sale_id/:type/payment/others_payment/MPU' => "mpu#index" - get 'sale/:sale_id/:type/payment/others_payment/VISA' => "visa#index" - get 'sale/:sale_id/:type/payment/others_payment/Master' => "master#index" - get 'sale/:sale_id/:type/payment/others_payment/JCB' => "jcb#index" - get 'sale/:sale_id/:type/payment/others_payment/PAYMAL' => "paymal#index" - get 'sale/:sale_id/:type/payment/others_payment/UNIONPAY' => "unionpay#index" - get 'sale/:sale_id/:type/payment/others_payment/Redeem' => "redeem_payments#index" - get 'sale/:sale_id/:type/payment/others_payment/Voucher' => "voucher#index" - get 'sale/:sale_id/:type/payment/others_payment/JunctionPay' => "junction_pay#index" - get 'sale/:sale_id/:type/payment/others_payment/Alipay' => "alipay#index" - get 'sale/:sale_id/:type/payment/others_payment/DINGA' => "dinga#index" - get 'sale/:sale_id/:type/payment/others_payment/GiftVoucher' => "gift_voucher#index" + get 'sale/:sale_id/:type/payment/others_payment/mpu' => "mpu#index" + get 'sale/:sale_id/:type/payment/others_payment/visa' => "visa#index" + get 'sale/:sale_id/:type/payment/others_payment/master' => "master#index" + get 'sale/:sale_id/:type/payment/others_payment/jcb' => "jcb#index" + get 'sale/:sale_id/:type/payment/others_payment/paymal' => "paymal#index" + get 'sale/:sale_id/:type/payment/others_payment/unionpay' => "unionpay#index" + get 'sale/:sale_id/:type/payment/others_payment/redeem' => "redeem_payments#index" + get 'sale/:sale_id/:type/payment/others_payment/voucher' => "voucher#index" + get 'sale/:sale_id/:type/payment/others_payment/junctionpay' => "junction_pay#index" + get 'sale/:sale_id/:type/payment/others_payment/alipay' => "alipay#index" + get 'sale/:sale_id/:type/payment/others_payment/dinga' => "dinga#index" + get 'sale/:sale_id/:type/payment/others_payment/giftvoucher' => "gift_voucher#index" + get 'sale/:sale_id/:type/payment/others_payment/:method' => 'others_payments#new' #---------Void --------------# post 'sale/:sale_id/:type/void' => 'void#overall_void' @@ -351,20 +353,22 @@ scope "(:locale)", locale: /en|mm/ do # post 'credit_payment/junctionpay' => 'junction_pay#create' # post 'credit_payment/dinga' => 'dinga#create' # post 'credit_payment/gift_voucher' => 'gift_voucher#create' + post 'credit_payment/:method' => 'others_payments#create', :as => 'credit_payment' get 'sale/:sale_id/:type/credit_payment/others_payment' => "others_payments#index" - get 'sale/:sale_id/:type/credit_payment/others_payment/MPU' => "mpu#index" - get 'sale/:sale_id/:type/credit_payment/others_payment/VISA' => "visa#index" - get 'sale/:sale_id/:type/credit_payment/others_payment/Master' => "master#index" - get 'sale/:sale_id/:type/credit_payment/others_payment/JCB' => "jcb#index" - # get 'sale/:sale_id/:type/credit_payment/others_payment/PAYMAL' => "paymal#index" - get 'sale/:sale_id/:type/credit_payment/others_payment/UNIONPAY' => "unionpay#index" - # get 'sale/:sale_id/:type/credit_payment/others_payment/Redeem' => "redeem_payments#index" - # get 'sale/:sale_id/:type/credit_payment/others_payment/Voucher' => "voucher#index" - # get 'sale/:sale_id/:type/credit_payment/others_payment/JunctionPay' => "junction_pay#index" - get 'sale/:sale_id/:type/credit_payment/others_payment/Alipay' => "alipay#index" - # get 'sale/:sale_id/:type/credit_payment/others_payment/DINGA' => "dinga#index" - # get 'sale/:sale_id/:type/credit_payment/others_payment/GiftVoucher' => "gift_voucher#index" + get 'sale/:sale_id/:type/credit_payment/others_payment/mpu' => "mpu#index" + get 'sale/:sale_id/:type/credit_payment/others_payment/visa' => "visa#index" + get 'sale/:sale_id/:type/credit_payment/others_payment/master' => "master#index" + get 'sale/:sale_id/:type/credit_payment/others_payment/jcb' => "jcb#index" + # get 'sale/:sale_id/:type/credit_payment/others_payment/paymal' => "paymal#index" + get 'sale/:sale_id/:type/credit_payment/others_payment/unionpay' => "unionpay#index" + # get 'sale/:sale_id/:type/credit_payment/others_payment/redeem' => "redeem_payments#index" + # get 'sale/:sale_id/:type/credit_payment/others_payment/voucher' => "voucher#index" + # get 'sale/:sale_id/:type/credit_payment/others_payment/junctionpay' => "junction_pay#index" + get 'sale/:sale_id/:type/credit_payment/others_payment/alipay' => "alipay#index" + # get 'sale/:sale_id/:type/credit_payment/others_payment/dinga' => "dinga#index" + # get 'sale/:sale_id/:type/credit_payment/others_payment/giftvoucher' => "gift_voucher#index" + get 'sale/:sale_id/:type/credit_payment/others_payment/:method' => 'others_payments#new' #------------- Start Reservation -------------------# resources :reservation