fixed confiixed for print
This commit is contained in:
98
app/controllers/origami/bank_integration_controller.rb
Normal file
98
app/controllers/origami/bank_integration_controller.rb
Normal file
@@ -0,0 +1,98 @@
|
||||
class Origami::BankIntegrationController < ApplicationController #BaseOrigamiController
|
||||
|
||||
def settle_trans
|
||||
if(params[:type] == 'request')
|
||||
card_settle_trans = CardSettleTran.new()
|
||||
card_settle_trans.req_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_settle_trans.req_time = Time.now.utc
|
||||
card_settle_trans.req_cmd = params[:data][:cmd_type]
|
||||
card_settle_trans.req_type = params[:data][:payment_type]
|
||||
card_settle_trans.save()
|
||||
|
||||
card_settle_trans_id = card_settle_trans.id
|
||||
response = {status: 'success', card_settle_trans_id: card_settle_trans_id}
|
||||
else
|
||||
card_settle_trans = CardSettleTran.find(params[:card_settle_trans_id])
|
||||
card_settle_trans.res_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_settle_trans.res_time = Time.now.utc
|
||||
card_settle_trans.res_cmd = params[:data][:CMD]
|
||||
card_settle_trans.res_type = params[:data][:TYPE]
|
||||
card_settle_trans.status = params[:data][:STATUS]
|
||||
card_settle_trans.sale_cnt = params[:data][:SALECNT]
|
||||
card_settle_trans.sale_amt = params[:data][:SALEAMT].to_f
|
||||
card_settle_trans.void_cnt = params[:data][:VOIDCNT]
|
||||
card_settle_trans.void_amt = params[:data][:VOIDAMT].to_f
|
||||
card_settle_trans.refund_cnt = params[:data][:REFUNDCNT]
|
||||
card_settle_trans.refund_amt = params[:data][:REFUNDAMT].to_f
|
||||
card_settle_trans.print_text_part1_type = params[:data][:PRINTTEXTPART1TYPE]
|
||||
card_settle_trans.print_text_part1_value = params[:data][:PRINTTEXTPART1VALUE]
|
||||
card_settle_trans.print_text_part2_type = params[:data][:PRINTTEXTPART2TYPE]
|
||||
card_settle_trans.print_text_part2_value = params[:data][:PRINTTEXTPART2VALUE]
|
||||
card_settle_trans.print_text_part3_type = params[:data][:PRINTTEXTPART3TYPE]
|
||||
card_settle_trans.print_text_part3_value = params[:data][:PRINTTEXTPART3VALUE]
|
||||
card_settle_trans.print_text_part4_type = params[:data][:PRINTTEXTPART4TYPE]
|
||||
card_settle_trans.print_text_part4_value = params[:data][:PRINTTEXTPART4VALUE]
|
||||
card_settle_trans.save()
|
||||
response = {status: 'success'}
|
||||
end
|
||||
render json: response
|
||||
end
|
||||
|
||||
def sale_trans
|
||||
if(params[:type] == 'request')
|
||||
card_sale_trans = CardSaleTran.new()
|
||||
card_sale_trans.sale_id = params[:data][:sale_id]
|
||||
card_sale_trans.req_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_sale_trans.req_time = Time.now.utc
|
||||
card_sale_trans.req_amt = params[:data][:amt]
|
||||
card_sale_trans.req_inv_no = params[:data][:inv_no]
|
||||
card_sale_trans.req_cmd = params[:data][:cmd_type]
|
||||
card_sale_trans.req_type = params[:data][:payment_type]
|
||||
card_sale_trans.save()
|
||||
|
||||
card_sale_trans_id = card_sale_trans.id
|
||||
response = {status: 'success', card_sale_trans_id: card_sale_trans_id}
|
||||
else
|
||||
card_sale_trans = CardSaleTran.find(params[:card_sale_trans_id])
|
||||
card_sale_trans.res_date = params[:data][:DATE]
|
||||
card_sale_trans.res_time = params[:data][:TIME]
|
||||
card_sale_trans.res_amt = params[:data][:AMT].to_f / 100
|
||||
card_sale_trans.res_inv_no = params[:data][:ECRREF]
|
||||
card_sale_trans.res_cmd = params[:data][:CMD]
|
||||
card_sale_trans.res_type = params[:data][:TYPE]
|
||||
card_sale_trans.status = params[:data][:STATUS]
|
||||
card_sale_trans.resp = params[:data][:RESP]
|
||||
card_sale_trans.trace = params[:data][:TRACE]
|
||||
card_sale_trans.app_code = params[:data][:APPCODE]
|
||||
card_sale_trans.pan = params[:data][:PAN]
|
||||
card_sale_trans.exp_date = params[:data][:EXPDATE]
|
||||
card_sale_trans.tips = params[:data][:TIPS]
|
||||
card_sale_trans.entry_mode = params[:data][:ENTRYMODE]
|
||||
card_sale_trans.terminal_id = params[:data][:TERMINALID]
|
||||
card_sale_trans.merchant_id = params[:data][:MERCHANTID]
|
||||
card_sale_trans.card_holder = params[:data][:CARDHOLDERNAME]
|
||||
card_sale_trans.batch_no = params[:data][:BATCHNO]
|
||||
card_sale_trans.ref_no = params[:data][:REFNUM]
|
||||
card_sale_trans.app = params[:data][:APP]
|
||||
card_sale_trans.emv_app_id = params[:data][:AID]
|
||||
card_sale_trans.emv_cyptrogram = params[:data][:TC]
|
||||
card_sale_trans.curr_code = params[:data][:CURRCODE]
|
||||
card_sale_trans.fx_rate = params[:data][:FXRATE]
|
||||
card_sale_trans.foreign_amt = params[:data][:FOREIGNAMT]
|
||||
card_sale_trans.dcc_msg = params[:data][:DCCMSG]
|
||||
card_sale_trans.tender = params[:data][:TENDER]
|
||||
card_sale_trans.print_text_part1_type = params[:data][:PRINTTEXTPART1TYPE]
|
||||
card_sale_trans.print_text_part1_value = params[:data][:PRINTTEXTPART1VALUE]
|
||||
card_sale_trans.print_text_part2_type = params[:data][:PRINTTEXTPART2TYPE]
|
||||
card_sale_trans.print_text_part2_value = params[:data][:PRINTTEXTPART2VALUE]
|
||||
card_sale_trans.print_text_part3_type = params[:data][:PRINTTEXTPART3TYPE]
|
||||
card_sale_trans.print_text_part3_value = params[:data][:PRINTTEXTPART3VALUE]
|
||||
card_sale_trans.print_text_part4_type = params[:data][:PRINTTEXTPART4TYPE]
|
||||
card_sale_trans.print_text_part4_value = params[:data][:PRINTTEXTPART4VALUE]
|
||||
card_sale_trans.save()
|
||||
|
||||
response = {status: 'success'}
|
||||
end
|
||||
render json: response
|
||||
end
|
||||
end
|
||||
@@ -29,6 +29,13 @@ class Origami::JcbController < BaseOrigamiController
|
||||
@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
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@bank_integration = bank_integration[0][1]
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -28,6 +28,13 @@ class Origami::MasterController < BaseOrigamiController
|
||||
@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
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@bank_integration = bank_integration[0][1]
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -28,6 +28,13 @@ class Origami::MpuController < BaseOrigamiController
|
||||
@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
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@bank_integration = bank_integration[0][1]
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -22,29 +22,47 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
|
||||
# Print for First Bill to Customer
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# #shop detail
|
||||
# shop_details = Shop::ShopDetail
|
||||
# # customer= Customer.where('customer_id=' +.customer_id)
|
||||
# customer= Customer.find(sale_data.customer_id)
|
||||
# # get member information
|
||||
# rebate = MembershipSetting.find_by_rebate(1)
|
||||
# if customer.membership_id != nil && rebate
|
||||
# member_info = Customer.get_member_account(customer)
|
||||
# end
|
||||
# # get printer info
|
||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
unique_code = "ReceiptBillPdf"
|
||||
#shop detail
|
||||
shop_details = Shop::ShopDetail
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
customer = Customer.find(sale_data.customer_id)
|
||||
|
||||
# # find order id by sale id
|
||||
# # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
a = sale_data.grand_total % 25 # Modulus
|
||||
b = sale_data.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(sale_data.grand_total)
|
||||
rounding_adj = new_total-sale_data.grand_total
|
||||
sale_data.update_attributes(grand_total: new_total,old_grand_total: sale_data.grand_total,rounding_adjustment:rounding_adj)
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
# # Calculate price_by_accounts
|
||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale_items)
|
||||
# discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale_items)
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
# current_balance = SaleAudit.paymal_search(sale_id)
|
||||
current_balance = 0
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# find order id by sale id
|
||||
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||
|
||||
# Calculate price_by_accounts
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
|
||||
|
||||
# printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt")
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -91,22 +109,38 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# For Print
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# customer= Customer.find(saleObj.customer_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 Food and Beverage Total
|
||||
# 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)
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
|
||||
|
||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
|
||||
#for card sale data
|
||||
card_data = Array.new
|
||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
if !card_sale_trans_ref_no.nil?
|
||||
card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||
card_no = cash_sale_trans.pan.last(4)
|
||||
card_no = card_no.rjust(19,"**** **** **** ")
|
||||
card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
|
||||
end
|
||||
end
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
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, "Paid")
|
||||
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, "Paid",current_balance,card_data)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -122,6 +156,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@visacount= 0.0
|
||||
@jcbcount= 0.0
|
||||
@mastercount = 0.0
|
||||
@unionpaycount = 0.0
|
||||
@credit = 0.0
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
@balance = 0.00
|
||||
@@ -183,6 +218,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@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 == "creditnote"
|
||||
@credit += spay.payment_amount
|
||||
end
|
||||
@@ -208,26 +245,40 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# customer= Customer.find(saleObj.customer_id)
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
# #shop detail
|
||||
# shop_details = Shop::ShopDetail
|
||||
# # 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)
|
||||
#shop detail
|
||||
shop_details = Shop::ShopDetail
|
||||
# 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)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
|
||||
# # 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)
|
||||
#for card sale data
|
||||
card_data = Array.new
|
||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
if !card_sale_trans_ref_no.nil?
|
||||
card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||
card_no = cash_sale_trans.pan.last(4)
|
||||
card_no = card_no.rjust(19,"**** **** **** ")
|
||||
card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
|
||||
end
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# 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")
|
||||
# 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",current_balance,card_data)
|
||||
end
|
||||
|
||||
def foc
|
||||
@@ -278,6 +329,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# 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, "FOC")
|
||||
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, "FOC",nil,nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -45,6 +45,15 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
cashier_terminal.is_currently_login = 0
|
||||
cashier_terminal.save
|
||||
|
||||
#add shift_sale_id to card_settle_trans
|
||||
card_settle_trans = CardSettleTran.select('id').where(['shift_sale_id IS NULL and status IS NOT NULL'])
|
||||
|
||||
card_settle_trans.each do |data|
|
||||
card_sett_trans = CardSettleTran.find(data.id)
|
||||
card_sett_trans.shift_sale_id = @shift.id
|
||||
card_sett_trans.save()
|
||||
end
|
||||
|
||||
|
||||
# unique_code = "CloseCashierPdf"
|
||||
# shop_details = Shop.find(1)
|
||||
|
||||
61
app/controllers/origami/unionpay_controller.rb
Normal file
61
app/controllers/origami/unionpay_controller.rb
Normal file
@@ -0,0 +1,61 @@
|
||||
class Origami::UnionpayController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit unionpay_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@unionpaycount = 0
|
||||
others = 0
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
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
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "unionpay"
|
||||
@unionpaycount = @unionpaycount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
puts "unionpaycount"
|
||||
puts @unionpaycount
|
||||
@can_unionpay = total - @unionpaycount - 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
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@bank_integration = bank_integration[0][1]
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
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)
|
||||
end
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
#end rounding adjustment
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -27,6 +27,13 @@ class Origami::VisaController < BaseOrigamiController
|
||||
@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
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@bank_integration = bank_integration[0][1]
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -61,40 +61,41 @@ class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
# For Print
|
||||
|
||||
# member_info = nil
|
||||
# rebate_amount = nil
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
|
||||
# # 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
|
||||
# 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)
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# customer= Customer.find(sale.customer_id)
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(sale.customer_id)
|
||||
|
||||
# #shop detail
|
||||
# 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 Food and Beverage Total
|
||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
# discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
#shop detail
|
||||
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 Food and Beverage Total
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil)
|
||||
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID")
|
||||
|
||||
#end print
|
||||
|
||||
|
||||
Reference in New Issue
Block a user