Edit in A5pdf

This commit is contained in:
San Wai Lwin
2018-05-21 11:08:08 +06:30
parent 98b043c170
commit 85625b7090
2 changed files with 20 additions and 17 deletions

View File

@@ -3,6 +3,6 @@ class PrintSetting < ApplicationRecord
validates_presence_of :name, :unique_code, :printer_name, :api_settings, :page_width, :page_height, :print_copies, :header_font_size, :item_font_size
def self.get_precision_delimiter
PrintSetting.find_by_unique_code("ReceiptBillPdf")
PrintSetting.find_by_unique_code("CloseCashierPdf")
end
end

View File

@@ -247,12 +247,8 @@ class ReceiptBillA5Pdf < Prawn::Document
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
text "Sub Total", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
end
bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
end
def all_total(sale_data,precision,delimiter)
@@ -537,22 +533,29 @@ class ReceiptBillA5Pdf < Prawn::Document
break;
end
end
if sale_data.payment_status == "foc"
if sale_data.payment_status == "foc" || sale_data.payment_status == "waste" || sale_data.payment_status == "spoile"
y_position = cursor
stroke_horizontal_rule
bounding_box([self.label_width,y_position], :width =>self.description_width) do
move_down 70
stroke_horizontal_rule
end
move_down 70
stroke_horizontal_rule
end
bounding_box([self.label_width,y_position], :width =>self.description_width) do
move_down 73
text "Acknowledged By" , :size => self.item_font_size,:align => :center
end
end
if sale_data.payment_status == "foc"
bounding_box([self.label_width,y_position], :width =>self.description_width) do
move_down 73
text "Acknowledged By" , :size => self.item_font_size,:align => :center
end
elsif sale_data.payment_status == "waste" || sale_data.payment_status == "spoile"
bounding_box([self.label_width,y_position], :width =>self.description_width) do
move_down 73
text "Approved By" , :size => self.item_font_size,:align => :center
end
end
end
end