check bill

This commit is contained in:
Yan
2018-03-15 11:16:31 +06:30
parent 95eff6f733
commit 28c23bb50d

View File

@@ -2,6 +2,7 @@ class ReceiptBillPdf < Prawn::Document
include ActionView::Helpers::NumberHelper 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, :description_width, :price_num_width, :line_move 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, :description_width, :price_num_width, :line_move
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,current_balance,card_data) 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,current_balance,card_data)
self.page_width = printer_settings.page_width self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height self.page_height = printer_settings.page_height
@@ -22,7 +23,7 @@ class ReceiptBillPdf < Prawn::Document
# @double = @qty_width * 1.3 # @double = @qty_width * 1.3
# @half_qty = @qty_width / 2 # @half_qty = @qty_width / 2
#setting page margin and width #setting page margin and width
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin])
#precision checked #precision checked
if printer_settings.precision.to_i > 2 if printer_settings.precision.to_i > 2
@@ -106,6 +107,7 @@ class ReceiptBillPdf < Prawn::Document
def cashier_info(sale_data, customer_name) def cashier_info(sale_data, customer_name)
move_down line_move move_down line_move
# move_down 2 # move_down 2
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.description_width + self.price_num_width, :height => self.item_height) do bounding_box([0,y_position], :width =>self.description_width + self.price_num_width, :height => self.item_height) do
@@ -146,7 +148,6 @@ class ReceiptBillPdf < Prawn::Document
text "Date : #{ time }",:size => self.item_font_size,:align => :left text "Date : #{ time }",:size => self.item_font_size,:align => :left
end end
# bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do # bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do
# text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } # text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
# - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" , # - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" ,
@@ -250,7 +251,6 @@ class ReceiptBillPdf < Prawn::Document
end end
def all_total(sale_data,precision,delimiter) def all_total(sale_data,precision,delimiter)
move_down line_move move_down line_move
item_name_width = self.item_width item_name_width = self.item_width
y_position = cursor y_position = cursor
@@ -317,7 +317,6 @@ class ReceiptBillPdf < Prawn::Document
move_down line_move move_down line_move
sale_payment(sale_data,precision,delimiter) sale_payment(sale_data,precision,delimiter)
end end
def sale_payment(sale_data,precision,delimiter) def sale_payment(sale_data,precision,delimiter)
@@ -549,7 +548,6 @@ class ReceiptBillPdf < Prawn::Document
end end
end end
end end
def footer(printed_status) def footer(printed_status)