merge with master

This commit is contained in:
Yan
2017-12-13 11:43:22 +06:30
9 changed files with 96 additions and 36 deletions

View File

@@ -65,12 +65,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
#Bill Receipt Print
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status)
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance)
#Use CUPS service
#Generate PDF
#Print
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status)
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance)
# print as print copies in printer setting
count = printer_settings.print_copies

View File

@@ -89,6 +89,25 @@ class SaleAudit < ApplicationRecord
sale_audit.save!
end
def self.paymal_search(sale_id)
paymal = SaleAudit.where("sale_id =? and action = 'PAYMAL'",sale_id)
remark = paymal[0].remark.split("}")
response = "["+remark[0]+'}]'
response = JSON.parse(response)
puts response
if response[0]["status"] == true
if response[0]["current_rebate_amount"].present?
amount = response[0]["current_rebate_amount"]
else
amount = response[0]["current_balance_amount"]
end
else
amount = nil
end
return amount
end
private
def generate_custom_id
self.sale_audit_id = SeedGenerator.generate_id(self.class.name, "SAI")

View File

@@ -327,7 +327,7 @@ class SalePayment < ApplicationRecord
response = rebat(sObj)
#record an payment in sale-audit
remark = "#{response} Redeem- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, "Cashier")
if !response.nil?