total other amount added to SaleItemsPdf

This commit is contained in:
Zoey
2019-06-03 16:47:49 +06:30
parent fe0ae102f9
commit 4b73920e18
7 changed files with 95 additions and 36 deletions

View File

@@ -57,7 +57,7 @@ class CloseCashierPdf < Prawn::Document
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter,total_waste,total_spoile,total_other_charges,total_credit_payments)
if !sale_items.nil? or !sale_items.blank?
sale_items_detail(sale_items, acc_cate_count, menu_cate_count, total_by_acc)
sale_items_detail(sale_items, acc_cate_count, menu_cate_count, total_by_acc, total_other_charges)
end
end
@@ -504,7 +504,7 @@ class CloseCashierPdf < Prawn::Document
end
def sale_items_detail(sale_items, acc_cate_count, menu_cate_count, total_by_acc)
def sale_items_detail(sale_items, acc_cate_count, menu_cate_count, total_by_acc, total_other_charges)
self.item_width = 73
self.price_width = 60
item_label_qty_front_width = (self.item_width+self.price_width) + 2
@@ -521,6 +521,7 @@ class CloseCashierPdf < Prawn::Document
total_amount = 0
total_qty = 0
sub_total = 0
flag = false
arr = Array.new
@@ -529,12 +530,15 @@ class CloseCashierPdf < Prawn::Document
if !arr.include?(item['menu_category_id'])
unless total_qty == 0 and sub_total == 0
if flag == true
move_down 5
stroke_horizontal_rule
total_details('Sub Total', total_qty, sub_total)
end
total_qty = 0
sub_total = 0
flag = true
move_down 10
@@ -571,7 +575,7 @@ class CloseCashierPdf < Prawn::Document
text_box "#{item['grand_total'].to_i}", :at =>[item_label_total_front_width,y_position], :width => item_label_total_end_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
}
if item['total_item'].to_i > 0
if item['total_item'].to_i > 0 or item['status_type'] == 'foc' or item['status_type'] == 'void'
total_qty += item['total_item'].to_i
total_items += item['total_item'].to_i
end
@@ -581,11 +585,17 @@ class CloseCashierPdf < Prawn::Document
arr.push(item['menu_category_id'])
end
# stroke_horizontal_rule
move_down 5
stroke_horizontal_rule
total_details('Sub Total', total_qty, sub_total)
move_down 5
move_down 5
stroke_horizontal_rule
total_details('Total Amount', total_items, total_amount)
move_down 10
# other_charges = get_other_charges(total_other_charges)
total_details('Total Other Amount', nil, total_other_charges)
move_down 20
end
end
@@ -597,8 +607,7 @@ class CloseCashierPdf < Prawn::Document
item_label_total_front_width = (self.item_width+self.price_width) + 2
item_label_total_end_width = 64
move_down 5
stroke_horizontal_rule
y_position = cursor
pad_top(15) {
text_box "#{col_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix