merge with aung myo

This commit is contained in:
Yan
2017-11-06 13:45:26 +06:30
6 changed files with 60 additions and 16 deletions

View File

@@ -46,6 +46,44 @@ class Origami::VoidController < BaseOrigamiController
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,sale.cashier_id, action_by,remark,"SALEVOID" )
# For Print
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
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)
#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")
#end print
# update complete order items in oqs
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|