check for payment methods
This commit is contained in:
@@ -4,7 +4,7 @@ class Origami::OthersPaymentsController < BaseOrigamiController
|
|||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
@payment_method_setting = PaymentMethodSetting.all
|
@payment_method_setting = PaymentMethodSetting.all
|
||||||
|
|
||||||
@rebate = MembershipSetting.find_by_rebate(1)
|
@rebate = MembershipSetting.find_by_rebate(1)
|
||||||
|
|
||||||
# @sale_id = params[:sale_id]
|
# @sale_id = params[:sale_id]
|
||||||
# sale_data = Sale.find_by_sale_id(@sale_id)
|
# sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
|||||||
@@ -164,28 +164,40 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
member_info = nil
|
member_info = nil
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
# For Cashier by Zone
|
||||||
customer= Customer.find(saleObj.customer_id)
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
|
if bookings.count > 1
|
||||||
|
# for Multiple Booking
|
||||||
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
|
else
|
||||||
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
|
end
|
||||||
|
|
||||||
#shop detail
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
shop_details = Shop.find(1)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
# get member information
|
|
||||||
rebate = MembershipSetting.find_by_rebate(1)
|
|
||||||
if customer.membership_id != nil && rebate
|
|
||||||
member_info = Customer.get_member_account(customer)
|
|
||||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
|
||||||
end
|
|
||||||
# get printer info
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
|
||||||
|
|
||||||
# Calculate price_by_accounts
|
unique_code = "ReceiptBillPdf"
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
#shop detail
|
||||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print")
|
shop_details = Shop.find(1)
|
||||||
|
# get member information
|
||||||
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
|
if customer.membership_id != nil && rebate
|
||||||
|
member_info = Customer.get_member_account(customer)
|
||||||
|
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||||
|
end
|
||||||
|
# get printer info
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# Calculate price_by_accounts
|
||||||
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print")
|
||||||
end
|
end
|
||||||
|
|
||||||
def foc
|
def foc
|
||||||
@@ -200,6 +212,18 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash, "foc")
|
sale_payment.process_payment(saleObj, @user, cash, "foc")
|
||||||
|
|
||||||
|
# For Cashier by Zone
|
||||||
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
|
if bookings.count > 1
|
||||||
|
# for Multiple Booking
|
||||||
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
|
else
|
||||||
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
@@ -213,7 +237,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class PaymentMethodSetting < ApplicationRecord
|
class PaymentMethodSetting < ApplicationRecord
|
||||||
# validations
|
# validations
|
||||||
validates_presence_of :payment_method, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id
|
validates_presence_of :payment_method #, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user