From 590b67abdf3c5f43cd7e5456e50d2b423cb537cd Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 25 May 2018 14:46:40 +0630 Subject: [PATCH] show incl exec in receipt bill --- app/models/sale.rb | 3 ++- app/pdf/receipt_bill_a5_pdf.rb | 6 +++++- app/pdf/receipt_bill_pdf.rb | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/models/sale.rb b/app/models/sale.rb index b7547c23..aa489c7d 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -421,6 +421,7 @@ class Sale < ApplicationRecord end total_tax_amount = 0 + tax_incl_exec = "execulsive" #tax_profile - list by order_by tax_profiles = TaxProfile.all.order("order_by asc") customer = Customer.find(sale.customer_id) @@ -483,7 +484,7 @@ class Sale < ApplicationRecord end end end - + sale.tax_type = sale.total_tax = total_tax_amount end diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index 55b09668..550195ed 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -303,12 +303,16 @@ class ReceiptBillA5Pdf < Prawn::Document end if sale_data.sale_taxes.length > 0 + incl_tax = "" + if sale_data.tax_type == "inculsive" + incl_tax = "Incl." + end sale_data.sale_taxes.each do |st| move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do - text "#{ st.tax_name } ( #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left + text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left end bounding_box([self.description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 5f3cdc09..ac79297c 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -290,12 +290,17 @@ class ReceiptBillPdf < Prawn::Document end if sale_data.sale_taxes.length > 0 + incl_tax = "" + if sale_data.tax_type == "inculsive" + incl_tax = "Incl." + end + sale_data.sale_taxes.each do |st| move_down line_move y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do - text "#{ st.tax_name } ( #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left + text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :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(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right