To add the condition for CloseCashierCustmisePdf

This commit is contained in:
San Wai Lwin
2018-02-26 18:29:58 +06:30
parent 7d8442fd09
commit 72b5701ec9
4 changed files with 12 additions and 14 deletions

View File

@@ -66,7 +66,7 @@ class Origami::ShiftsController < BaseOrigamiController
unique_code = "CloseCashierPdf" unique_code = "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'
unique_code="CloseCashierCustomisePdf" unique_code="CloseCashierCustomisePdf"

View File

@@ -43,7 +43,7 @@ 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 = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges) pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
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?
@@ -52,7 +52,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
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) pdf = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
else else
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges) pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
end end
end end
end end

View File

@@ -455,12 +455,13 @@ class CloseCashierCustomisePdf < Prawn::Document
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_with_precision(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right text "-#{ number_with_precision(@overall, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
end end
move_down -5
stroke_horizontal_rule
move_down 7
end end
#end total over all discount #end total over all discount
move_down -5
stroke_horizontal_rule
move_down 7
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

View File

@@ -234,14 +234,12 @@ class CloseCashierPdf < Prawn::Document
text "Rounding Adjustments :", :size => self.item_font_size, :align => :right text "Rounding Adjustments :", :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_with_precision(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right text "#{ number_with_precision(shift_sale.total_rounding, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
text "#{ number_with_precision(shift_sale.total_dinein, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
end 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 "Gross Sale :", :style => :bold, :size => self.header_font_size - 1, :align => :right text "Total :", :style => :bold, :size => self.header_font_size - 1, :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_with_precision(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right text "#{ number_with_precision(shift_sale.grand_total, :precision => precision.to_i, :delimiter => delimiter)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
@@ -394,7 +392,6 @@ class CloseCashierPdf < Prawn::Document
move_down 5 move_down 5
stroke_horizontal_rule stroke_horizontal_rule
move_down 5 move_down 5
move_down 5 move_down 5
end end
end end