update fixed conflict
This commit is contained in:
@@ -42,6 +42,8 @@ class Ability
|
||||
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
@@ -65,6 +67,8 @@ class Ability
|
||||
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
|
||||
@@ -34,13 +34,13 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
order_items.each do|odi|
|
||||
order.each do|odi|
|
||||
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
||||
# For Item Options
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
# check for item not to show
|
||||
if odi.price != 0 || odi.price != 10
|
||||
if odi.price != 0
|
||||
pdf = OrderItemPdf.new(odi, print_status, options, oqs.use_alternate_name)
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
|
||||
@@ -71,8 +71,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Print
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||
|
||||
pdf.render_file "tmp/receipt_bill.pdf"
|
||||
self.print("tmp/receipt_bill.pdf")
|
||||
# print as print copies in printer setting
|
||||
count = printer_settings.print_copies
|
||||
begin
|
||||
pdf.render_file "tmp/receipt_bill.pdf"
|
||||
self.print("tmp/receipt_bill.pdf")
|
||||
count -= 1
|
||||
end until count == 0
|
||||
end
|
||||
|
||||
#Queue No Print
|
||||
|
||||
@@ -25,7 +25,7 @@ class Sale < ApplicationRecord
|
||||
SALE_STATUS_OUTSTANDING = "outstanding"
|
||||
SALE_STATUS_COMPLETED = "completed"
|
||||
|
||||
def generate_invoice_from_booking(booking_id, requested_by)
|
||||
def generate_invoice_from_booking(booking_id, requested_by, cashier)
|
||||
booking = Booking.find(booking_id)
|
||||
status = false
|
||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||
@@ -35,9 +35,9 @@ class Sale < ApplicationRecord
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
if booking.sale_id
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier)
|
||||
else
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by)
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier)
|
||||
end
|
||||
booking.sale_id = sale_id
|
||||
end
|
||||
@@ -47,7 +47,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def generate_invoice_from_order (order_id, sale_id, booking, requested_by)
|
||||
def generate_invoice_from_order (order_id, sale_id, booking, requested_by, cashier = nil)
|
||||
taxable = true
|
||||
#if sale_id is exsit and validate
|
||||
#add order to that invoice
|
||||
@@ -66,12 +66,19 @@ class Sale < ApplicationRecord
|
||||
#Default Tax - Values
|
||||
self.tax_type = "exclusive"
|
||||
|
||||
# set cashier by current login
|
||||
self.cashier_id = requested_by.id
|
||||
self.cashier_name = requested_by.name
|
||||
# set cashier
|
||||
if cashier != nil
|
||||
self.cashier_id = cashier[0].id
|
||||
self.cashier_name = cashier[0].name
|
||||
else
|
||||
self.cashier_id = requested_by.id
|
||||
self.cashier_name = requested_by.name
|
||||
end
|
||||
|
||||
# set waiter
|
||||
self.requested_by = requested_by.name
|
||||
|
||||
self.requested_at = DateTime.now.utc
|
||||
self.requested_at = DateTime.now.utc.getlocal
|
||||
|
||||
Rails.logger.debug "Order -> #{order.id} | order_status -> #{order.status}"
|
||||
if order
|
||||
|
||||
Reference in New Issue
Block a user