Declare Move_down with variable
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
class ReceiptBillA5Pdf < Prawn::Document
|
class ReceiptBillA5Pdf < 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
|
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,survey)
|
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,survey)
|
||||||
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
|
||||||
@@ -15,6 +15,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
|
|
||||||
self.description_width = 500
|
self.description_width = 500
|
||||||
self.price_num_width = 100
|
self.price_num_width = 100
|
||||||
|
self.line_move = 10
|
||||||
# @item_width = self.page_width.to_i / 2
|
# @item_width = self.page_width.to_i / 2
|
||||||
# @qty_width = @item_width.to_i / 3
|
# @qty_width = @item_width.to_i / 3
|
||||||
# @double = @qty_width * 1.3
|
# @double = @qty_width * 1.3
|
||||||
@@ -91,20 +92,20 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def header (shop_details)
|
def header (shop_details)
|
||||||
move_down 10
|
move_down line_move
|
||||||
text "#{shop_details.name}", :size => self.header_font_size,:align => :center
|
text "#{shop_details.name}", :size => self.header_font_size,:align => :center
|
||||||
move_down 10
|
move_down line_move
|
||||||
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
||||||
# move_down self.item_height
|
# move_down self.item_height
|
||||||
move_down 10
|
move_down line_move
|
||||||
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
|
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
|
||||||
move_down 10
|
move_down line_move
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def cashier_info(sale_data, customer_name)
|
def cashier_info(sale_data, customer_name)
|
||||||
move_down 12
|
move_down line_move
|
||||||
# move_down 2
|
# move_down 2
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
@@ -113,7 +114,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
bounding_box([self.item_description_width, y_position], :width => self.item_description_width, :height => self.item_height) do
|
bounding_box([self.item_description_width, y_position], :width => self.item_description_width, :height => self.item_height) do
|
||||||
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 10
|
move_down line_move
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0, y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0, y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
@@ -122,7 +123,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
|
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 10
|
move_down line_move
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.page_width - 20, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.page_width - 20, :height => self.item_height) do
|
||||||
@@ -136,7 +137,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
# :size => self.item_font_size,:align => :right
|
# :size => self.item_font_size,:align => :right
|
||||||
# end
|
# end
|
||||||
|
|
||||||
move_down 10
|
move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -153,9 +154,9 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
item_label_total_front_width = (self.item_width+self.price_width) + 5
|
item_label_total_front_width = (self.item_width+self.price_width) + 5
|
||||||
item_label_total_end_width = self.total_width + 4
|
item_label_total_end_width = self.total_width + 4
|
||||||
end
|
end
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 10
|
move_down line_move
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
# @item_width.to_i + @half_qty.to_i
|
# @item_width.to_i + @half_qty.to_i
|
||||||
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
@@ -163,7 +164,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
text_box "Qty", :at =>[item_label_qty_front_width,y_position], :width => item_label_qty_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "Qty", :at =>[item_label_qty_front_width,y_position], :width => item_label_qty_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "Total", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "Total", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
}
|
}
|
||||||
move_down -5
|
move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
add_line_item_row(sale_items,precision,delimiter)
|
add_line_item_row(sale_items,precision,delimiter)
|
||||||
end
|
end
|
||||||
@@ -183,7 +184,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
item_total_end_width = self.total_width + 4
|
item_total_end_width = self.total_width + 4
|
||||||
end
|
end
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 10
|
move_down line_move
|
||||||
sub_total = 0.0
|
sub_total = 0.0
|
||||||
sale_items.each do |item|
|
sale_items.each do |item|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
@@ -214,25 +215,25 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
move_down line_move
|
||||||
}
|
}
|
||||||
move_down 10
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 10
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_total(sale_data,precision,delimiter)
|
def all_total(sale_data,precision,delimiter)
|
||||||
|
move_down line_move
|
||||||
item_name_width = self.item_width
|
item_name_width = self.item_width
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
if sale_data.discount_type == 'member_discount'
|
if sale_data.discount_type == 'member_discount'
|
||||||
@@ -250,7 +251,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
|
|
||||||
if sale_data.sale_taxes.length > 0
|
if sale_data.sale_taxes.length > 0
|
||||||
sale_data.sale_taxes.each do |st|
|
sale_data.sale_taxes.each do |st|
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
@@ -275,7 +276,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
if sale_data.rounding_adjustment != 0.0
|
if sale_data.rounding_adjustment != 0.0
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
@@ -286,16 +287,16 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 10
|
move_down line_move
|
||||||
bounding_box([0,y_position], :width =>self.description_width) do
|
bounding_box([0,y_position], :width =>self.description_width) do
|
||||||
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 10
|
move_down line_move
|
||||||
|
|
||||||
sale_payment(sale_data,precision,delimiter)
|
sale_payment(sale_data,precision,delimiter)
|
||||||
|
|
||||||
@@ -303,7 +304,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
|
|
||||||
def sale_payment(sale_data,precision,delimiter)
|
def sale_payment(sale_data,precision,delimiter)
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 10
|
# move_down 10
|
||||||
sale_payments = SalePayment.select("SUM(sale_payments.payment_amount) as payment_amount,sale_payments.payment_method").where('sale_id = ?', sale_data.sale_id).group("payment_method")
|
sale_payments = SalePayment.select("SUM(sale_payments.payment_amount) as payment_amount,sale_payments.payment_method").where('sale_id = ?', sale_data.sale_id).group("payment_method")
|
||||||
sale_payments.each do |payment|
|
sale_payments.each do |payment|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -320,18 +321,18 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 10
|
move_down line_move
|
||||||
end
|
end
|
||||||
if sale_data.amount_received > 0
|
if sale_data.amount_received > 0
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 10
|
move_down line_move
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "Change Amount", :size => self.item_font_size,:align => :left
|
text "Change Amount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 10
|
#move_down line_move
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -358,7 +359,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
|
|
||||||
rebate_balance = rebate_balance + res["deposit"]
|
rebate_balance = rebate_balance + res["deposit"]
|
||||||
|
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||||
@@ -371,7 +372,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
# Total Rebate Amount if birthday
|
# Total Rebate Amount if birthday
|
||||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
|
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
|
||||||
rebate_balance = rebate_balance + res["deposit"]
|
rebate_balance = rebate_balance + res["deposit"]
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||||
@@ -383,7 +384,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
#end Total rebate if birthday
|
#end Total rebate if birthday
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||||
@@ -393,7 +394,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
if current_balance != nil
|
if current_balance != nil
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "Old Balance", :size => self.item_font_size,:align => :left
|
text "Old Balance", :size => self.item_font_size,:align => :left
|
||||||
@@ -415,7 +416,7 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "Total Balance", :size => self.item_font_size,:align => :left
|
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||||
@@ -428,21 +429,22 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def customer(customer_name)
|
def customer(customer_name)
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
move_down line_move
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "Customer Name", :size => self.item_font_size,:align => :left
|
text "Customer Name", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
move_down line_move
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def discount_account(discount_price_by_accounts,precision,delimiter)
|
def discount_account(discount_price_by_accounts,precision,delimiter)
|
||||||
move_down 10
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
discount_price_by_accounts.each do |ipa|
|
discount_price_by_accounts.each do |ipa|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -452,13 +454,13 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
move_down line_move
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def items_account(item_price_by_accounts,precision,delimiter)
|
def items_account(item_price_by_accounts,precision,delimiter)
|
||||||
move_down 10
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 10
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
item_price_by_accounts.each do |ipa|
|
item_price_by_accounts.each do |ipa|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -468,27 +470,27 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
bounding_box([self.label_width,y_position], :width =>self.description_width) do
|
||||||
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
move_down line_move
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#individual payment per person
|
#individual payment per person
|
||||||
def individual_payment(sale_data, survey, precision, delimiter)
|
def individual_payment(sale_data, survey, precision, delimiter)
|
||||||
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
|
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
|
||||||
move_down 5
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width+50) do
|
bounding_box([0,y_position], :width =>self.label_width+50) do
|
||||||
text "Individual amount for #{survey.total_customer} persons", :size => self.item_font_size+1,:align => :left
|
text "Individual amount for #{survey.total_customer} persons", :size => self.item_font_size+1,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.label_width) do
|
bounding_box([0,y_position], :width =>self.label_width) do
|
||||||
move_down 15
|
move_down line_move
|
||||||
text "Total", :size => self.item_font_size,:align => :left
|
text "Total", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
move_down 15
|
move_down line_move
|
||||||
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -532,9 +534,9 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def footer(printed_status)
|
def footer(printed_status)
|
||||||
move_down 10
|
move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 10
|
move_down line_move
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0, y_position], :width =>self.item_description_width) do
|
bounding_box([0, y_position], :width =>self.item_description_width) do
|
||||||
@@ -544,15 +546,15 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :right
|
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 10
|
move_down line_move
|
||||||
end
|
end
|
||||||
|
|
||||||
#start card sale trans data
|
#start card sale trans data
|
||||||
def card_sale_data(card_data)
|
def card_sale_data(card_data)
|
||||||
if card_data != nil && !card_data.empty?
|
if card_data != nil && !card_data.empty?
|
||||||
move_down 5
|
move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down line_move
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
card_data.each do |data|
|
card_data.each do |data|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class ReceiptBillPdf < Prawn::Document
|
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
|
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,survey)
|
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,survey)
|
||||||
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
|
||||||
@@ -15,6 +15,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
self.description_width = 150
|
self.description_width = 150
|
||||||
self.price_num_width = 50
|
self.price_num_width = 50
|
||||||
|
self.line_move = 2
|
||||||
# @item_width = self.page_width.to_i / 2
|
# @item_width = self.page_width.to_i / 2
|
||||||
# @qty_width = @item_width.to_i / 3
|
# @qty_width = @item_width.to_i / 3
|
||||||
# @double = @qty_width * 1.3
|
# @double = @qty_width * 1.3
|
||||||
@@ -91,20 +92,19 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def header (shop_details)
|
def header (shop_details)
|
||||||
move_down 5
|
|
||||||
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
||||||
move_down 5
|
move_down line_move
|
||||||
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
||||||
# move_down self.item_height
|
# move_down self.item_height
|
||||||
move_down 5
|
move_down line_move
|
||||||
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
|
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
|
||||||
move_down 5
|
move_down line_move
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def cashier_info(sale_data, customer_name)
|
def cashier_info(sale_data, customer_name)
|
||||||
move_down 7
|
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, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
@@ -116,7 +116,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down line_move
|
||||||
|
|
||||||
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
|
||||||
@@ -125,7 +125,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
|
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down line_move
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
if sale_data.bookings[0].dining_facility_id.to_i > 0
|
if sale_data.bookings[0].dining_facility_id.to_i > 0
|
||||||
@@ -145,7 +145,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
# :size => self.item_font_size,:align => :right
|
# :size => self.item_font_size,:align => :right
|
||||||
# end
|
# end
|
||||||
|
|
||||||
move_down 5
|
move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -162,9 +162,9 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
item_label_total_front_width = (self.item_width+self.price_width) + 5
|
item_label_total_front_width = (self.item_width+self.price_width) + 5
|
||||||
item_label_total_end_width = self.total_width + 4
|
item_label_total_end_width = self.total_width + 4
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down line_move
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
# @item_width.to_i + @half_qty.to_i
|
# @item_width.to_i + @half_qty.to_i
|
||||||
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
@@ -172,7 +172,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text_box "Qty", :at =>[item_label_qty_front_width,y_position], :width => item_label_qty_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "Qty", :at =>[item_label_qty_front_width,y_position], :width => item_label_qty_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "Total", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "Total", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
}
|
}
|
||||||
move_down -5
|
# move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
add_line_item_row(sale_items,precision,delimiter)
|
add_line_item_row(sale_items,precision,delimiter)
|
||||||
end
|
end
|
||||||
@@ -192,7 +192,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
item_total_end_width = self.total_width + 4
|
item_total_end_width = self.total_width + 4
|
||||||
end
|
end
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down line_move
|
||||||
sub_total = 0.0
|
sub_total = 0.0
|
||||||
sale_items.each do |item|
|
sale_items.each do |item|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
@@ -223,25 +223,27 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
move_down line_move
|
||||||
}
|
}
|
||||||
move_down 5
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_total(sale_data,precision,delimiter)
|
def all_total(sale_data,precision,delimiter)
|
||||||
|
|
||||||
|
move_down line_move
|
||||||
item_name_width = self.item_width
|
item_name_width = self.item_width
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
if sale_data.discount_type == 'member_discount'
|
if sale_data.discount_type == 'member_discount'
|
||||||
@@ -259,7 +261,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
if sale_data.sale_taxes.length > 0
|
if sale_data.sale_taxes.length > 0
|
||||||
sale_data.sale_taxes.each do |st|
|
sale_data.sale_taxes.each do |st|
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
@@ -284,7 +286,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
if sale_data.rounding_adjustment != 0.0
|
if sale_data.rounding_adjustment != 0.0
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
@@ -295,16 +297,16 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down line_move
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width) do
|
bounding_box([0,y_position], :width =>self.item_description_width) do
|
||||||
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down line_move
|
||||||
|
|
||||||
sale_payment(sale_data,precision,delimiter)
|
sale_payment(sale_data,precision,delimiter)
|
||||||
|
|
||||||
@@ -312,7 +314,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
def sale_payment(sale_data,precision,delimiter)
|
def sale_payment(sale_data,precision,delimiter)
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
#move_down line_move
|
||||||
sale_payments = SalePayment.select("SUM(sale_payments.payment_amount) as payment_amount,sale_payments.payment_method").where('sale_id = ?', sale_data.sale_id).group("payment_method")
|
sale_payments = SalePayment.select("SUM(sale_payments.payment_amount) as payment_amount,sale_payments.payment_method").where('sale_id = ?', sale_data.sale_id).group("payment_method")
|
||||||
sale_payments.each do |payment|
|
sale_payments.each do |payment|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -329,18 +331,18 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down line_move
|
||||||
end
|
end
|
||||||
if sale_data.amount_received > 0
|
if sale_data.amount_received > 0
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down line_move
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Change Amount", :size => self.item_font_size,:align => :left
|
text "Change Amount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
# move_down line_move
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -367,7 +369,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
rebate_balance = rebate_balance + res["deposit"]
|
rebate_balance = rebate_balance + res["deposit"]
|
||||||
|
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||||
@@ -380,7 +382,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
# Total Rebate Amount if birthday
|
# Total Rebate Amount if birthday
|
||||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
|
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
|
||||||
rebate_balance = rebate_balance + res["deposit"]
|
rebate_balance = rebate_balance + res["deposit"]
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||||
@@ -392,7 +394,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
#end Total rebate if birthday
|
#end Total rebate if birthday
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||||
@@ -402,7 +404,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
if current_balance != nil
|
if current_balance != nil
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Old Balance", :size => self.item_font_size,:align => :left
|
text "Old Balance", :size => self.item_font_size,:align => :left
|
||||||
@@ -424,7 +426,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Total Balance", :size => self.item_font_size,:align => :left
|
text "Total Balance", :size => self.item_font_size,:align => :left
|
||||||
@@ -437,21 +439,23 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def customer(customer_name)
|
def customer(customer_name)
|
||||||
move_down 5
|
# move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
#move_down line_move
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Customer Name", :size => self.item_font_size,:align => :left
|
text "Customer Name", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
move_down line_move
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def discount_account(discount_price_by_accounts,precision,delimiter)
|
def discount_account(discount_price_by_accounts,precision,delimiter)
|
||||||
move_down 5
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
discount_price_by_accounts.each do |ipa|
|
discount_price_by_accounts.each do |ipa|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -461,13 +465,13 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
move_down line_move
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def items_account(item_price_by_accounts,precision,delimiter)
|
def items_account(item_price_by_accounts,precision,delimiter)
|
||||||
move_down 5
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
item_price_by_accounts.each do |ipa|
|
item_price_by_accounts.each do |ipa|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
@@ -476,16 +480,16 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
move_down line_move
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#individual payment per person
|
#individual payment per person
|
||||||
def individual_payment(sale_data, survey, precision, delimiter)
|
def individual_payment(sale_data, survey, precision, delimiter)
|
||||||
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
|
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
|
||||||
move_down 5
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.label_width+50) do
|
bounding_box([0,y_position], :width =>self.label_width+50) do
|
||||||
text "Individual amount for #{survey.total_customer} persons", :size => self.item_font_size+1,:align => :left
|
text "Individual amount for #{survey.total_customer} persons", :size => self.item_font_size+1,:align => :left
|
||||||
@@ -541,10 +545,11 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
def footer(printed_status)
|
def footer(printed_status)
|
||||||
move_down 5
|
move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down line_move
|
||||||
|
|
||||||
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0, y_position], :width =>self.label_width) do
|
bounding_box([0, y_position], :width =>self.label_width) do
|
||||||
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
||||||
@@ -553,15 +558,15 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :left
|
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down line_move
|
||||||
end
|
end
|
||||||
|
|
||||||
#start card sale trans data
|
#start card sale trans data
|
||||||
def card_sale_data(card_data)
|
def card_sale_data(card_data)
|
||||||
if card_data != nil && !card_data.empty?
|
if card_data != nil && !card_data.empty?
|
||||||
move_down 5
|
move_down line_move
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down line_move
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
card_data.each do |data|
|
card_data.each do |data|
|
||||||
|
|||||||
Reference in New Issue
Block a user