update rebate double and old balance
This commit is contained in:
@@ -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, :description_width, :price_num_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, printed_status)
|
||||
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)
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.margin = 5
|
||||
@@ -55,7 +55,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
|
||||
if member_info != nil
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter)
|
||||
member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance)
|
||||
end
|
||||
|
||||
customer(customer_name)
|
||||
@@ -286,7 +286,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# show member information
|
||||
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter)
|
||||
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
if rebate_amount != nil
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
@@ -342,22 +342,15 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
|
||||
if redeem == 0
|
||||
old = total - rebate_balance
|
||||
else
|
||||
# if redeem_count == 0
|
||||
old = balance + redeem
|
||||
# end
|
||||
end
|
||||
|
||||
move_down 5
|
||||
if current_balance != nil
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
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
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(old, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
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
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -371,7 +364,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
total_balance = total_balance + res["balance"]
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
|
||||
Reference in New Issue
Block a user