saturday fixed

This commit is contained in:
Yan
2017-07-01 20:02:14 +06:30
parent 51a779cbee
commit e9b1845ed2
7 changed files with 33 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
class ReceiptBillPdf < Prawn::Document
include ActionView::Helpers::NumberHelper
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
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details)
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status)
self.page_width = 210
self.page_height = 7000
self.margin = 5
@@ -53,7 +53,7 @@ class ReceiptBillPdf < Prawn::Document
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
footer
footer(printed_status)
end
def header (shop_details)
@@ -82,14 +82,11 @@ class ReceiptBillPdf < Prawn::Document
move_down 5
y_position = cursor
bounding_box([0, y_position], :width =>self.item_width) do
text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
end
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.item_width, :height => self.item_height) do
text "Cashier: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :left
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
end
bounding_box([self.label_width,y_position], :width =>self.label_width, :height => self.item_height) do
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
end
move_down 5
@@ -182,7 +179,7 @@ class ReceiptBillPdf < Prawn::Document
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{ st.tax_name }", :size => self.item_font_size,:align => :left
text "#{ st.tax_name } ( #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
@@ -360,12 +357,18 @@ class ReceiptBillPdf < Prawn::Document
end
end
def footer
def footer(printed_status)
move_down 5
stroke_horizontal_rule
move_down 5
text "Thank You! See you Again", :left_margin => -10, :size => self.header_font_size,:align => :center
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
text "#{printed_status}", :size => self.header_font_size,:align => :left
end
bounding_box([self.label_width,y_position], :width =>self.label_width, :height => self.item_height) do
text "Thank You! See you Again", :left_margin => -10, :size => self.header_font_size,:align => :right
end
move_down 5
end