This commit is contained in:
@@ -125,7 +125,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
|
|||||||
end
|
end
|
||||||
find_close_cashier_print = Lookup.collection_of('close_cashier_print')
|
find_close_cashier_print = Lookup.collection_of('close_cashier_print')
|
||||||
if find_close_cashier_print[0][1].to_i > 0
|
if find_close_cashier_print[0][1].to_i > 0
|
||||||
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
|
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments,"foocourt")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|||||||
# self.print(filename, cashier_terminal.printer_name)
|
# self.print(filename, cashier_terminal.printer_name)
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def print_close_cashier(printer_settings,cashier_terminal,shift_sale, sale_items, total_other_charges_info,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
def print_close_cashier(printer_settings,cashier_terminal,shift_sale, sale_items, total_other_charges_info,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,foodcourt=nil)
|
||||||
|
|
||||||
if !sale_items.blank? or !sale_items.nil?
|
if !sale_items.blank? or !sale_items.nil?
|
||||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||||
@@ -59,16 +59,16 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
|||||||
cashier = shift_sale.employee.name
|
cashier = shift_sale.employee.name
|
||||||
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
|
||||||
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
|
||||||
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, total_other_charges_info, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, total_other_charges_info, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,foodcourt)
|
||||||
close_cashier_pdf = Lookup.collection_of("print_settings") #print_settings with name:CloseCashierPdf
|
close_cashier_pdf = Lookup.collection_of("print_settings") #print_settings with name:CloseCashierPdf
|
||||||
|
|
||||||
if !close_cashier_pdf.empty?
|
if !close_cashier_pdf.empty?
|
||||||
close_cashier_pdf.each do |close_cashier|
|
close_cashier_pdf.each do |close_cashier|
|
||||||
if close_cashier[0] == 'CloseCashierCustomisePdf'
|
if close_cashier[0] == 'CloseCashierCustomisePdf'
|
||||||
if close_cashier[1] == '1'
|
if close_cashier[1] == '1'
|
||||||
pdf = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
pdf = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,foodcourt)
|
||||||
else
|
else
|
||||||
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, total_other_charges_info, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
pdf = CloseCashierPdf.new(printer_settings,shift_sale, sale_items, total_other_charges_info, @account_cate_count, @menu_cate_count, @totalByAccount, shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,foodcourt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
|||||||
include NumberFormattable
|
include NumberFormattable
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||||
|
|
||||||
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,foodcourt)
|
||||||
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||||
self.page_height = printer_settings.page_height
|
self.page_height = printer_settings.page_height
|
||||||
self.header_font_size = printer_settings.header_font_size.to_i
|
self.header_font_size = printer_settings.header_font_size.to_i
|
||||||
@@ -43,7 +43,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
|||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,foodcourt)
|
||||||
end
|
end
|
||||||
|
|
||||||
def header (shop_details)
|
def header (shop_details)
|
||||||
@@ -59,7 +59,7 @@ class CloseCashierCustomisePdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,foodcourt)
|
||||||
move_down 7
|
move_down 7
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
@@ -127,23 +127,23 @@ class CloseCashierCustomisePdf < Prawn::Document
|
|||||||
text "#{number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
text "#{number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
|
||||||
end
|
end
|
||||||
|
if foodcourt.nil?
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Cash In :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{number_format(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Cash In :", :size => self.item_font_size, :align => :right
|
text "Cash Out :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{number_format(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
|
||||||
text "#{number_format(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
|
||||||
end
|
|
||||||
|
|
||||||
y_position = cursor
|
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
|
||||||
text "Cash Out :", :size => self.item_font_size, :align => :right
|
|
||||||
end
|
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
|
||||||
text "#{number_format(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
|
||||||
end
|
|
||||||
|
|
||||||
move_down -5
|
move_down -5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 7
|
move_down 7
|
||||||
@@ -210,20 +210,22 @@ class CloseCashierCustomisePdf < Prawn::Document
|
|||||||
move_down 7
|
move_down 7
|
||||||
|
|
||||||
@total_foc = 0
|
@total_foc = 0
|
||||||
y_position = cursor
|
if foodcourt.nil?
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
y_position = cursor
|
||||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
end
|
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
end
|
||||||
text "#{ number_format(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
end
|
text "#{ number_format(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
text "#{number_format(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
text "#{number_format(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
end
|
end
|
||||||
#start other payment details
|
#start other payment details
|
||||||
if shift_sale.other_sales > 0
|
if shift_sale.other_sales > 0
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
include NumberFormattable
|
include NumberFormattable
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||||
|
|
||||||
def initialize(printer_settings, shift_sale, sale_items, total_other_charges_info, acc_cate_count, menu_cate_count, total_by_acc, shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments)
|
def initialize(printer_settings, shift_sale, sale_items, total_other_charges_info, acc_cate_count, menu_cate_count, total_by_acc, shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,foodcourt)
|
||||||
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||||
self.page_height = printer_settings.page_height
|
self.page_height = printer_settings.page_height
|
||||||
self.header_font_size = printer_settings.header_font_size.to_i
|
self.header_font_size = printer_settings.header_font_size.to_i
|
||||||
@@ -43,7 +43,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
|
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments,foodcourt)
|
||||||
|
|
||||||
if !sale_items.nil? or !sale_items.blank?
|
if !sale_items.nil? or !sale_items.blank?
|
||||||
sale_items_detail(sale_items, acc_cate_count, menu_cate_count, total_by_acc, total_other_charges_info)
|
sale_items_detail(sale_items, acc_cate_count, menu_cate_count, total_by_acc, total_other_charges_info)
|
||||||
@@ -63,7 +63,7 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
|
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments,foodcourt)
|
||||||
move_down 7
|
move_down 7
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
@@ -131,44 +131,45 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
text "#{number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
text "#{number_format(shift_sale.closing_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
|
||||||
end
|
end
|
||||||
|
if foodcourt.nil?
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
|
text "Cash In:", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{number_format(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Cash In:", :size => self.item_font_size, :align => :right
|
text "Cash Out:", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{number_format(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
|
||||||
text "#{number_format(shift_sale.cash_in, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
|
||||||
end
|
|
||||||
|
|
||||||
y_position = cursor
|
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
|
||||||
text "Cash Out:", :size => self.item_font_size, :align => :right
|
|
||||||
end
|
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
|
||||||
text "#{number_format(shift_sale.cash_out, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
|
||||||
end
|
|
||||||
|
|
||||||
move_down -5
|
move_down -5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 7
|
move_down 7
|
||||||
|
|
||||||
@total_foc = 0
|
@total_foc = 0
|
||||||
y_position = cursor
|
if foodcourt.nil?
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
y_position = cursor
|
||||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
end
|
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
end
|
||||||
text "#{ number_format(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
end
|
text "#{ number_format(shift_sale.cash_sales, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||||
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
text "Credit Payment :", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||||
|
text "#{number_format(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
||||||
|
end
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
|
||||||
text "#{number_format(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right
|
|
||||||
end
|
|
||||||
|
|
||||||
#start other payment details
|
#start other payment details
|
||||||
if shift_sale.other_sales > 0
|
if shift_sale.other_sales > 0
|
||||||
other_payment.each do |other|
|
other_payment.each do |other|
|
||||||
|
|||||||
Reference in New Issue
Block a user