equal split and order split in order tab'
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,current_balance,card_data)
|
||||
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_height = printer_settings.page_height
|
||||
self.margin = 0
|
||||
@@ -79,6 +79,12 @@ class ReceiptBillPdf < Prawn::Document
|
||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||
end
|
||||
|
||||
#start for individual payment
|
||||
if !survey.nil?
|
||||
individual_payment(sale_data, survey, printer_settings.precision, delimiter)
|
||||
end
|
||||
#end for individual payment
|
||||
|
||||
sign(sale_data)
|
||||
|
||||
footer(printed_status)
|
||||
@@ -465,6 +471,22 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
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
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width) do
|
||||
text "Individual amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
def sign(sale_data)
|
||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||
if payment.payment_method == "creditnote"
|
||||
|
||||
Reference in New Issue
Block a user