change split bill equal person flow

This commit is contained in:
phyusin
2018-02-21 18:24:04 +06:30
parent d991a9f0ee
commit e2903075b2
11 changed files with 52 additions and 149 deletions

View File

@@ -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,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)
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.margin = 0
@@ -80,8 +80,8 @@ class ReceiptBillPdf < Prawn::Document
end
#start for individual payment
if !survey.nil?
individual_payment(sale_data, survey, printer_settings.precision, delimiter)
if !sale_data.equal_persons.nil?
individual_payment(sale_data, printer_settings.precision, delimiter)
end
#end for individual payment
@@ -481,14 +481,14 @@ class ReceiptBillPdf < Prawn::Document
end
#individual payment per person
def individual_payment(sale_data, survey, precision, delimiter)
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
def individual_payment(sale_data, precision, delimiter)
per_person = sale_data.grand_total.to_f / sale_data.equal_persons.to_i
move_down 5
stroke_horizontal_rule
move_down 5
y_position = cursor
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 #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
end
bounding_box([0,y_position], :width =>self.label_width) do