This commit is contained in:
Nicolas Bally 2019-01-27 17:45:20 +01:00
parent 00f8af0808
commit 03864e04d3

View File

@ -359,14 +359,16 @@ class PSheetLine < ActiveRecord::Base
end end
def self.total_with_labels(sheet_lines, sheet_line_container=nil) def self.total_with_labels(sheet_lines, sheet_line_container=nil)
total = 0.0 total = 0.0
total_ttc = 0.0 total_ttc = 0.0
r = {} r = {}
tva = 0.0
sheet_lines.each do |sheet_line| sheet_lines.each do |sheet_line|
tva = sheet_line.tva
total += sheet_line.price_tot total += sheet_line.price_tot
total_ttc += sheet_line.price_tot_ttc total_ttc += sheet_line.price_tot_ttc
@ -380,7 +382,7 @@ class PSheetLine < ActiveRecord::Base
total = total +fdp.to_f total = total +fdp.to_f
total_ttc = total_ttc + (fdp.to_f*1.2) total_ttc = total_ttc + (fdp.to_f*(1+tva))
r[:total] = {:label =>"Total HT",:value => total} r[:total] = {:label =>"Total HT",:value => total}
r[:tva] = {:label =>"TVA",:value => total_ttc - total} r[:tva] = {:label =>"TVA",:value => total_ttc - total}
r[:total_ttc] = {:label =>"Total TTC",:value => total_ttc} r[:total_ttc] = {:label =>"Total TTC",:value => total_ttc}
@ -393,6 +395,7 @@ class PSheetLine < ActiveRecord::Base
def self.frais_de_port(p_sheet_lines) def self.frais_de_port(p_sheet_lines)
if p_sheet_lines[0] and ((p_sheet_lines[0].p_customer_sheet and p_sheet_lines[0].p_customer_sheet.fdp_force_price) or (p_sheet_lines[0].p_document and p_sheet_lines[0].p_document.fdp_force_price)) if p_sheet_lines[0] and ((p_sheet_lines[0].p_customer_sheet and p_sheet_lines[0].p_customer_sheet.fdp_force_price) or (p_sheet_lines[0].p_document and p_sheet_lines[0].p_document.fdp_force_price))