separate foodcourt module

This commit is contained in:
Myat Zin Wai Maw
2019-12-02 16:10:51 +06:30
parent 09e7650452
commit cac6994ccb
113 changed files with 14365 additions and 193 deletions

View File

@@ -2,7 +2,7 @@ class ReceiptBillA5Pdf < 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, :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,other_charges_amount,latest_order_no,card_balance_amount)
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,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
@@ -73,11 +73,12 @@ class ReceiptBillA5Pdf < Prawn::Document
end
#end card sale trans data
#start card blanace amount
if !card_balance_amount.nil?
if !card_balance_amount.nil? && card_balance_amount >0
card_balance_data(card_balance_amount)
card_transaction_ref(transaction_ref)
end
#end card blanace amount
if discount_price_by_accounts.length > 0 && shop_details.show_account_info
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
end
@@ -100,7 +101,7 @@ class ReceiptBillA5Pdf < Prawn::Document
if shop_details.note && !shop_details.note.nil?
shop_note(printed_status)
end
footer(printed_status)
end
@@ -130,7 +131,7 @@ class ReceiptBillA5Pdf < Prawn::Document
text "OrderNo : #{ latest_order_no }", :size => self.header_font_size+2,:align => :left
end
move_down line_move
# move_down 2
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
@@ -154,7 +155,7 @@ class ReceiptBillA5Pdf < Prawn::Document
bounding_box([self.item_description_width, y_position], :width =>self.item_description_width, :height => self.item_height) do
text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
end
end
bounding_box([self.item_description_width - 2,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
end
@@ -172,7 +173,7 @@ class ReceiptBillA5Pdf < Prawn::Document
# 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') })" ,
# :size => self.item_font_size,:align => :right
# end
@@ -209,7 +210,7 @@ class ReceiptBillA5Pdf < Prawn::Document
end
def add_line_item_row(sale_items,precision,delimiter)
if precision.to_i > 0
item_name_width = (self.item_width+self.price_width)
item_qty_front_width = (self.item_width+self.price_width) + 5
@@ -229,17 +230,17 @@ class ReceiptBillA5Pdf < Prawn::Document
sub_total = 0.0
total_qty = 0.0
sale_items.each do |item|
# check for item not to show
# check for item not to show
show_price = Lookup.find_by_lookup_type("show_price")
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
if item.status != 'Discount' && item.qty > 0
if !show_price.nil? && show_price.value.to_i > 0 && item.price == 0
total_qty += item.qty
total_qty += item.qty
else
if item.price != 0
total_qty += item.qty
total_qty += item.qty
end
end
end
@@ -272,7 +273,7 @@ class ReceiptBillA5Pdf < Prawn::Document
# 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 item_row(item,precision,delimiter,product_name,price,qty ,total_price)
@@ -297,10 +298,10 @@ class ReceiptBillA5Pdf < Prawn::Document
bounding_box([0,y_position], :width =>self.item_width) do
text "#{product_name}", :size => self.item_font_size,:align => :left
end
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{number_with_precision(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(total_price, :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
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{number_with_precision(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(total_price, :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
if show_alt_name
if !(item.product_alt_name).empty?
@@ -370,7 +371,7 @@ class ReceiptBillA5Pdf < Prawn::Document
end
bounding_box([self.description_width,y_position], :width =>self.label_width) do
text "#{sale_data.rounding_adjustment}", :size => self.item_font_size,:align => :right
end
end
end
move_down line_move
@@ -383,12 +384,12 @@ class ReceiptBillA5Pdf < Prawn::Document
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
end
move_down line_move
sale_payment(sale_data,precision,delimiter)
end
def sale_payment(sale_data,precision,delimiter)
def sale_payment(sale_data,precision,delimiter)
stroke_horizontal_rule
# move_down 10
sql = "SELECT SUM(payment_amount)
@@ -419,13 +420,13 @@ class ReceiptBillA5Pdf < Prawn::Document
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
end
end
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
end
move_down line_move
end
if sale_data.amount_received > 0
if sale_data.amount_received > 0
y_position = cursor
move_down line_move
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
@@ -435,12 +436,12 @@ class ReceiptBillA5Pdf < Prawn::Document
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
#move_down line_move
end
end
end
# show member information
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
if rebate_amount != nil
if rebate_amount != nil
if rebate_amount["status"] == true
stroke_horizontal_rule
total = 0
@@ -469,8 +470,8 @@ class ReceiptBillA5Pdf < Prawn::Document
bounding_box([self.description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
end
end
# Total Rebate Amount if birthday
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
rebate_balance = rebate_balance + res["deposit"]
@@ -482,7 +483,7 @@ class ReceiptBillA5Pdf < Prawn::Document
bounding_box([self.description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
end
end
#end Total rebate if birthday
end
@@ -505,7 +506,7 @@ class ReceiptBillA5Pdf < Prawn::Document
text "#{number_with_precision(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
end
end
end
@@ -515,7 +516,7 @@ class ReceiptBillA5Pdf < Prawn::Document
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
total_balance = total_balance + res["balance"]
end
end
move_down line_move
@@ -527,7 +528,7 @@ class ReceiptBillA5Pdf < Prawn::Document
text "#{number_with_precision(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
end
end
def customer(customer_name)
@@ -555,7 +556,7 @@ class ReceiptBillA5Pdf < Prawn::Document
end
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
end
end
move_down line_move
end
end
@@ -571,7 +572,7 @@ class ReceiptBillA5Pdf < Prawn::Document
end
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
end
end
move_down line_move
end
end
@@ -584,7 +585,7 @@ class ReceiptBillA5Pdf < Prawn::Document
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
text "#{number_with_precision(other_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
move_down line_move
move_down line_move
end
#individual payment per person
@@ -623,17 +624,17 @@ class ReceiptBillA5Pdf < Prawn::Document
JOIN sale_audits sa
ON SUBSTRING_INDEX(sa.remark,'||',1)=sale_payment_id
where sa.sale_id='#{sale_data.sale_id}')) = 0
THEN payment_method!='creditnote' ELSE 1 END) AND sale_id = ?", sale_data.sale_id).each do |payment|
THEN payment_method!='creditnote' ELSE 1 END) AND sale_id = ?", sale_data.sale_id).each do |payment|
if payment.payment_method == "creditnote"
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
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
@@ -650,8 +651,8 @@ class ReceiptBillA5Pdf < Prawn::Document
move_down 70
stroke_horizontal_rule
end
if sale_data.payment_status == "foc"
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
@@ -661,10 +662,10 @@ class ReceiptBillA5Pdf < Prawn::Document
move_down 73
text "Approved By" , :size => self.item_font_size,:align => :center
end
end
end
end
end
end
def shop_note(shop)
@@ -674,8 +675,8 @@ class ReceiptBillA5Pdf < Prawn::Document
move_down line_move
y_position = cursor
text "#{shop.note}", :size => self.item_font_size,:align => :left
text "#{shop.note}", :size => self.item_font_size,:align => :left
move_down line_move
end
@@ -688,10 +689,10 @@ class ReceiptBillA5Pdf < Prawn::Document
y_position = cursor
bounding_box([0, y_position], :width =>self.item_description_width) do
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
end
end
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :right
end
end
move_down line_move
end
@@ -721,7 +722,6 @@ class ReceiptBillA5Pdf < Prawn::Document
#start card balance data
def card_balance_data(card_balance_amount)
if card_balance_amount > 0
move_down line_move
stroke_horizontal_rule
move_down line_move
@@ -729,11 +729,24 @@ class ReceiptBillA5Pdf < Prawn::Document
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width) do
text "Card Balance: ",:style => :bold, :size => header_font_size,:align => :left
end
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{card_balance_amount}" , :size => self.item_font_size,:align => :right
end
end
end
#start card transaction_ref
def card_transaction_ref(transaction_ref)
move_down line_move
stroke_horizontal_rule
move_down line_move
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width) do
text "Transaction ref: ",:style => :bold, :size => header_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{transaction_ref}" , :size => self.item_font_size,:align => :right
end
end
#check ReceiptBillAltName included
@@ -753,4 +766,4 @@ class ReceiptBillA5Pdf < Prawn::Document
end
return status
end
end
end

View File

@@ -78,13 +78,13 @@ class ReceiptBillOrderPdf < Prawn::Document
def cashier_info(sale_data, customer_name, latest_order_no,order_reservation)
move_down line_move
# move_down 2
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width , :height => self.item_height) do
text "Order Date " , :size => self.item_font_size, :align => :left
end
end
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
text "#{order_reservation.created_at.strftime('%d-%m-%Y %H:%M %p')}", :size => self.item_font_size,:align => :right
end
@@ -92,7 +92,7 @@ class ReceiptBillOrderPdf < Prawn::Document
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width , :height => self.item_height) do
text "Requested Date Time " , :size => self.item_font_size, :align => :left
end
end
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
text "#{order_reservation.requested_time.strftime('%d-%m-%Y %H:%M %p')}", :size => self.item_font_size,:align => :right
end
@@ -100,7 +100,7 @@ class ReceiptBillOrderPdf < Prawn::Document
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width , :height => self.item_height) do
text "Payment Type" , :size => self.item_font_size, :align => :left
end
end
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
text "#{order_reservation.payment_type}", :size => self.item_font_size,:align => :right
end
@@ -108,7 +108,7 @@ class ReceiptBillOrderPdf < Prawn::Document
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width , :height => self.item_height) do
text "#{customer_name} " , :size => self.item_font_size, :align => :left
end
end
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
text "Online Order", :size => self.item_font_size,:align => :right
end
@@ -167,14 +167,14 @@ class ReceiptBillOrderPdf < Prawn::Document
total_qty = 0.0
show_price = Lookup.find_by_lookup_type("show_price")
sale_items.each do |item|
# check for item not to show
# check for item not to show
if item.status != 'Discount' && item.qty > 0
if !show_price.nil? && show_price.value.to_i > 0 && item.price == 0
total_qty += item.qty
total_qty += item.qty
else
if item.price != 0
total_qty += item.qty
total_qty += item.qty
end
end
end
@@ -191,7 +191,7 @@ class ReceiptBillOrderPdf < Prawn::Document
qty = item.qty
total_price = item.price #item.qty*item.unit_price - comment for room charges
price = item.unit_price
# end
if !show_price.nil? && show_price.value.to_i>0
item_row(item,precision,delimiter,product_name,price,qty ,total_price)
@@ -220,24 +220,24 @@ class ReceiptBillOrderPdf < Prawn::Document
bounding_box([self.description_width - 48,y_position], :width =>self.label_width, :height => self.item_height) do
text "#{number_with_precision(order_reservation.delivery_fee, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
end
end
if order_reservation.total_tax > 0
y_position = cursor
bounding_box([0, y_position], :width =>self.item_description_width , :height => self.item_height) do
text "Tax " , :size => self.item_font_size, :align => :left
end
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width, :height => self.item_height) do
text "#{number_with_precision(order_reservation.total_tax, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
end
end
end
y_position = cursor
bounding_box([0, y_position], :width =>self.item_description_width , :height => self.item_height) do
text "Convenience Charges " , :size => self.item_font_size, :align => :left
end
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width, :height => self.item_height) do
text "#{number_with_precision(order_reservation.convenience_charge, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
@@ -250,8 +250,8 @@ class ReceiptBillOrderPdf < Prawn::Document
bounding_box([self.item_description_width,y_position], :width =>self.label_width, :height => self.item_height) do
text "#{number_with_precision(order_reservation.discount_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
end
end
end
end
#Change items rows
@@ -277,10 +277,10 @@ class ReceiptBillOrderPdf < Prawn::Document
bounding_box([0,y_position], :width =>self.item_width) do
text "#{product_name}", :size => self.item_font_size,:align => :left
end
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{number_with_precision(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(total_price, :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
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
text_box "#{number_with_precision(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(total_price, :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
if show_alt_name
if !(item.product_alt_name).empty?
@@ -310,10 +310,10 @@ class ReceiptBillOrderPdf < Prawn::Document
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(order_reservation.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
end
end
move_down line_move
# sale_payment(sale_data,precision,delimiter)
# sale_payment(sale_data,precision,delimiter)
end
#Change Footer
@@ -326,10 +326,10 @@ class ReceiptBillOrderPdf < Prawn::Document
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width) do
text "#{printed_status}",:style => :bold, :size => header_font_size - 1,:align => :left
end
end
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size - 1,:align => :left
end
end
move_down line_move
end
@@ -351,4 +351,4 @@ class ReceiptBillOrderPdf < Prawn::Document
end
return status
end
end
end

View File

@@ -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)
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)
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
@@ -76,8 +76,9 @@ class ReceiptBillPdf < Prawn::Document
end
#end card sale trans data
#start card blanace amount
if !card_balance_amount.nil?
if !card_balance_amount.nil? && card_balance_amount >0
card_balance_data(card_balance_amount)
card_transaction_ref(transaction_ref)
end
#end card blanace amount
@@ -797,7 +798,6 @@ class ReceiptBillPdf < Prawn::Document
#start card balance data
def card_balance_data(card_balance_amount)
if card_balance_amount > 0
move_down line_move
stroke_horizontal_rule
move_down line_move
@@ -809,6 +809,19 @@ class ReceiptBillPdf < Prawn::Document
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{card_balance_amount}" , :size => self.item_font_size,:align => :right
end
end
#start card transaction_ref
def card_transaction_ref(transaction_ref)
move_down line_move
stroke_horizontal_rule
move_down line_move
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width) do
text "Transaction ref: ",:style => :bold, :size => header_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{transaction_ref}" , :size => self.item_font_size,:align => :right
end
end

View File

@@ -3,7 +3,7 @@ class ReceiptBillStarPdf < Prawn::Document
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :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, status, qr , 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)
def initialize(printer_settings, status, qr , 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)
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
@@ -75,8 +75,9 @@ class ReceiptBillStarPdf < Prawn::Document
end
#end card sale trans data
#start card blanace amount
if !card_balance_amount.nil?
if !card_balance_amount.nil? && card_balance_amount >0
card_balance_data(card_balance_amount)
card_transaction_ref(transaction_ref)
end
#end card blanace amount
@@ -722,19 +723,32 @@ class ReceiptBillStarPdf < Prawn::Document
#start card balance data
def card_balance_data(card_balance_amount)
if card_balance_amount > 0
move_down line_move
stroke_horizontal_rule
move_down line_move
move_down line_move
stroke_horizontal_rule
move_down line_move
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width) do
text "Card Balance: ",:style => :bold, :size => header_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{card_balance_amount}" , :size => self.item_font_size,:align => :right
end
end
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width) do
text "Card Balance: ",:style => :bold, :size => header_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{card_balance_amount}" , :size => self.item_font_size,:align => :right
end
end
#start card balance data
def card_transaction_ref(transaction_ref)
move_down line_move
stroke_horizontal_rule
move_down line_move
y_position = cursor
bounding_box([0, y_position], :width =>self.label_width) do
text "Transaction ref: ",:style => :bold, :size => header_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{transaction_ref}" , :size => self.item_font_size,:align => :right
end
end
#check ReceiptBillAltName included