diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index 30a610d0..1d23b782 100755 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -93,6 +93,12 @@ <% tax_profile_count = @tax_profiles.length %> <% sale_tax_count = result.sale_taxes.length %> <% tax_count = tax_profile_count - sale_tax_count %> + <% tax_flag = true %> + <% result.sale_taxes.each do |tax| + if tax.tax_name.downcase.include?("service") + tax_flag = false + end + end %> <%= result.receipt_no rescue '-' %> @@ -105,7 +111,7 @@ <%end%> --> <% if !result.sale_taxes.empty? %> <% num = 1 - if tax_count > 0 %> + if tax_flag && tax_count > 0 %> <% while num <= tax_count %> <%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %> @@ -118,6 +124,15 @@ <%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> <%end%> + <% num = 1 + if tax_flag==false && tax_count > 0 %> + <% while num <= tax_count %> + + <%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %> + + <% num += 1 + end %> + <% end %> <% else %> <% @tax_profiles.each do |tax| %> <%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> diff --git a/app/views/reports/receipt_no/index.xls.erb b/app/views/reports/receipt_no/index.xls.erb index ac955e73..b6ac51b0 100755 --- a/app/views/reports/receipt_no/index.xls.erb +++ b/app/views/reports/receipt_no/index.xls.erb @@ -62,6 +62,12 @@ <% tax_profile_count = @tax_profiles.length %> <% sale_tax_count = result.sale_taxes.length %> <% tax_count = tax_profile_count - sale_tax_count %> + <% tax_flag = true %> + <% result.sale_taxes.each do |tax| + if tax.tax_name.downcase.include?("service") + tax_flag = false + end + end %> <%= result.receipt_no rescue '-' %> @@ -73,7 +79,7 @@ <%end%> --> <% if !result.sale_taxes.empty? %> <% num = 1 - if tax_count > 0 %> + if tax_flag && tax_count > 0 %> <% while num <= tax_count %> 0 <% num += 1 @@ -84,6 +90,13 @@ <%= tax.tax_payable_amount rescue '-' %> <%end%> + <% num = 1 + if tax_flag==false && tax_count > 0 %> + <% while num <= tax_count %> + 0 + <% num += 1 + end %> + <% end %> <% else %> <% @tax_profiles.each do |tax| %> 0