menu item by id
This commit is contained in:
@@ -5,7 +5,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
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, kbz_pay_status, qr_code, 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,other_charges_amount,latest_order_no,card_balance_amount,transaction_ref)
|
||||
def initialize(printer_settings, kbz_pay_status, qr_code, sale_items, sale_data, customer_account, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no,card_balance_amount,transaction_ref)
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.header_font_size = printer_settings.header_font_size.to_i
|
||||
@@ -59,17 +59,19 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
stroke_horizontal_rule
|
||||
|
||||
cashier_info(sale_data, customer_name, latest_order_no)
|
||||
cashier_info(sale_data, customer_account, latest_order_no)
|
||||
line_items(sale_items,precision,delimiter)
|
||||
all_total(sale_data,precision,delimiter)
|
||||
|
||||
|
||||
if member_info != nil
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
member_info(member_info,customer_account,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
end
|
||||
if sale_data.orders[0].source =='app' || sale_data.orders[0].source =='food_court'
|
||||
customer(customer_account,'card')
|
||||
else
|
||||
customer(customer_account,nil)
|
||||
end
|
||||
|
||||
customer(customer_name)
|
||||
|
||||
#start card sale trans data
|
||||
if card_data != nil
|
||||
card_sale_data(card_data)
|
||||
@@ -124,7 +126,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
def cashier_info(sale_data, customer_name, latest_order_no)
|
||||
def cashier_info(sale_data, customer_account, latest_order_no)
|
||||
if latest_order_no.nil?
|
||||
move_down line_move
|
||||
text "Booking : #{ sale_data.bookings[0].booking_id }", :size => self.header_font_size+2,:align => :left
|
||||
@@ -504,7 +506,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# show member information
|
||||
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
def member_info(member_info,customer_account,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
if rebate_amount != nil
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
@@ -595,15 +597,21 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
end
|
||||
|
||||
def customer(customer_name)
|
||||
def customer(customer_account,type)
|
||||
# move_down line_move
|
||||
y_position = cursor
|
||||
#move_down line_move
|
||||
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
|
||||
if type=='card'
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Customer Acc", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
else
|
||||
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
|
||||
end
|
||||
end
|
||||
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_account }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
stroke_horizontal_rule
|
||||
|
||||
Reference in New Issue
Block a user