shop code

This commit is contained in:
Myat Zin Wai Maw
2019-11-22 18:24:02 +06:30
parent 5a3f328789
commit d1ab2c194d
106 changed files with 834 additions and 895 deletions

View File

@@ -55,7 +55,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
# FOr Sale Audit
action_by = current_user.name
if access_code != "null" && current_user.role == "cashier"
action_by = Employee.find_by_emp_id(access_code).name
action_by = Employee.find_by_emp_id_and_shop_code(access_code,@shop.shop_code).name
end
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,remark )
@@ -88,10 +88,8 @@ class Origami::WasteSpoileController < BaseOrigamiController
# unique_code = "ReceiptBillPdf"
customer= Customer.find(sale.customer_id)
#shop detail
shop_details = current_shop
# get member information
rebate = MembershipSetting.find_by_rebate(1)
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code)
if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,sale.receipt_no)
@@ -99,7 +97,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
current_balance = 0
end
printer = PrintSetting.all
printer = PrintSetting.where("shop_code='#{@shop.shop_code}'")
unique_code="ReceiptBillPdf"
if !printer.empty?
@@ -115,13 +113,13 @@ class Origami::WasteSpoileController < BaseOrigamiController
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_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)
other_amount = SaleItem.calculate_other_charges(sale.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount,nil,nil,nil)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, remark,current_balance,nil,other_amount,nil,nil,nil)
result = {
:filepath => filename,
:printer_model => print_settings.brand_name,