.qi_header %h1 Documents %span Détail %span =@price_document.d_number .qi_row .qi_pannel.qi_plain.padding -if false =debug @price_document -price_line_block = @price_document.price_line_block %table.table %thead %tr %th Référence %th Catégorie %th Compte comptable %th Produit %th Désignation %th Qté %th P.U. HT %th TVA %th Montant HT %tbody -price_line_block.price_lines.each do |price_line| %tr %td =price_line.ref %td -if p_product_cat = price_line.p_product_cat =p_product_cat.code =p_product_cat.name %td =price_line.sale_account %td =link_to price_line.p_product_ref.p_product.name, edit_admin_p_product_path(price_line.p_product_ref.p_product) if price_line.p_product_ref and price_line.p_product_ref.p_product %td =price_line.title %td.numeraire =price_line.qte %td.numeraire =number_to_currency price_line.price_u_ht %td.numeraire =price_line.tva_account_value.to_s+"%" %td.numeraire =number_to_currency price_line.tot_amount_ht %table.table{:style => "width:auto;float:right;"} %tr %th Total HT %td.numeraire =number_to_currency price_line_block.tot_lines_ht %tr %th Total HT Net %td.numeraire =number_to_currency price_line_block.tot_amount_ht %tr %th Total TVA %td.numeraire =number_to_currency price_line_block.tot_amount_tva %tr %th Total TTC %td.numeraire =number_to_currency price_line_block.tot_amount_ttc %table.table{:style => "width:auto;"} %tr %th Taux %br TVA %th Montant HT Net %th Montant TVA -tva_rates = {} -price_line_block.price_lines.each do |pl| -tva_rates[pl.tva_account_value.to_s] = tva_rates[pl.tva_account_value.to_s] || {:montant => 0.0, :tva => 0.0} -tva_rates[pl.tva_account_value.to_s][:montant] += pl.tot_amount_ht.to_f - (pl.tot_amount_ht.to_f * ((price_line_block.ct_tot_discount_percent and price_line_block.ct_tot_discount_percent != 0.0) ? (price_line_block.ct_tot_discount_percent.to_f/100) : 0.0)) -tva_rates[pl.tva_account_value.to_s][:tva] += pl.tot_amount_tva.to_f - (pl.tot_amount_tva.to_f * ((price_line_block.ct_tot_discount_percent and price_line_block.ct_tot_discount_percent != 0.0) ? (price_line_block.ct_tot_discount_percent.to_f/100) : 0.0.to_f)) -tva_rates[price_line_block.fdp_tva_rate.to_s] = tva_rates[price_line_block.fdp_tva_rate.to_s] || {:montant => 0.0, :tva => 0.0} -tva_rates[price_line_block.fdp_tva_rate.to_s][:montant] += price_line_block.tot_fdp_ht -tva_rates[price_line_block.fdp_tva_rate.to_s][:tva] += price_line_block.tot_fdp_tva -tva_rates.each do |key, value| %tr %td ="#{key}%" %td =number_to_currency value[:montant] %td =number_to_currency value[:tva] %table.table{:style => "width:auto;"} %tr %th Échéance %th Mode de paiement %th Montant net %tr %td =price_line_block.payment_delais.to_i jours %td =price_line_block.p_payment_type.name if price_line_block.p_payment_type %td =number_to_currency price_line_block.tot_amount_ttc