diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index 7253bfe1..78b27e3f 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -202,10 +202,12 @@ class ReceiptBillA5Pdf < Prawn::Document y_position = cursor move_down line_move sub_total = 0.0 + total_qty = 0.0 sale_items.each do |item| # check for item not to show if item.price != 0 sub_total += item.price #(item.qty*item.unit_price) - comment for room charges + total_qty += item.qty qty = item.qty total_price = item.price #item.qty*item.unit_price - comment for room charges price = item.unit_price @@ -240,12 +242,15 @@ class ReceiptBillA5Pdf < Prawn::Document move_down line_move y_position = cursor - bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do + bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do text "Sub Total", :size => self.item_font_size,:align => :left end - bounding_box([self.description_width,y_position], :width =>self.label_width) do - text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right - end + bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do + text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center + end + bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do + text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right + end end def all_total(sale_data,precision,delimiter) diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 7ebe5997..fe42bbf3 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -196,10 +196,12 @@ class ReceiptBillPdf < Prawn::Document y_position = cursor move_down line_move sub_total = 0.0 + total_qty = 0.0 sale_items.each do |item| # check for item not to show if item.price != 0 sub_total += item.price #(item.qty*item.unit_price) - comment for room charges + total_qty += item.qty qty = item.qty total_price = item.price #item.qty*item.unit_price - comment for room charges price = item.unit_price @@ -235,12 +237,15 @@ class ReceiptBillPdf < Prawn::Document move_down line_move y_position = cursor - bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do text "Sub Total", :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(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right - end + bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do + text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center + end + bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do + text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right + end end def all_total(sale_data,precision,delimiter)