update rounding adj

This commit is contained in:
Aung Myo
2017-07-01 18:19:41 +06:30
parent 40a2347c1b
commit 740f585a31
17 changed files with 230 additions and 15 deletions

View File

@@ -52,6 +52,7 @@ class Ability
can :show, :payment
can :create, :payment
can :reprint, :payment
can :rounding_adj, :payment
can :move_dining, :movetable
can :moving, :movetable
@@ -88,6 +89,7 @@ class Ability
can :show, :payment
can :create, :payment
can :reprint, :payment
can :rounding_adj, :payment
can :move_dining, :movetable
can :moving, :movetable

View File

@@ -80,6 +80,16 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end until count == 0
end
#Bill Receipt Print
def print_close_cashier(printer_settings,shift_sale,shop_details)
#Use CUPS service
#Generate PDF
#Print
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details)
pdf.render_file "tmp/print_close_cashier.pdf"
self.print("tmp/print_close_cashier.pdf")
end
#Queue No Print
def print_queue_no(printer_settings,queue)
#Use CUPS service

View File

@@ -92,7 +92,6 @@ class Sale < ApplicationRecord
link_order_sale(order.id)
end
self.save!
#compute sales summary
@@ -379,6 +378,7 @@ class Sale < ApplicationRecord
to_date = sale_date.end_of_day.utc - diff
total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
IFNULL(SUM(case when (sale_status='completed') then old_grand_total else 0 end),0) as old_grand_total,
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj")
@@ -386,6 +386,7 @@ class Sale < ApplicationRecord
total_sale.each do |sale|
grand_total = sale.grand_total
old_grand_total = sale.old_grand_total
total_discount = sale.total_discount
void_amount = sale.void_amount
total = {:sale_date => pay.sale_date,
@@ -399,6 +400,7 @@ class Sale < ApplicationRecord
:foc_amount => pay.foc_amount,
:total_discount => total_discount,
:grand_total => grand_total,
:old_grand_total => old_grand_total,
:void_amount => void_amount,
:rounding_adj => sale.rounding_adj}
daily_total.push(total)