158 lines
4.8 KiB
Plaintext
158 lines
4.8 KiB
Plaintext
.qi_header
|
|
%h1
|
|
Documents fournisseur
|
|
|
|
%span
|
|
=@p_fournisseur_doc.p_fournisseur_doc_type.name
|
|
%span
|
|
="##{@p_fournisseur_doc.id}"
|
|
|
|
|
|
-price_line_block = @p_fournisseur_doc.price_line_block
|
|
|
|
.qi_row
|
|
.qi_pannel.qi_plain.padding
|
|
%table.table.resume_table
|
|
%tr
|
|
%td Fournisseur
|
|
%td Date
|
|
%td Référence
|
|
|
|
%tr
|
|
%td= @p_fournisseur_doc.p_fournisseur.name
|
|
%td= l @p_fournisseur_doc.date, :format => :date if @p_fournisseur_doc.date
|
|
%td= @p_fournisseur_doc.ref
|
|
|
|
|
|
|
|
-show_prices = true if @p_fournisseur_doc.p_fournisseur_doc_type.name != "Demande de prix"
|
|
%table.table
|
|
%thead
|
|
%tr
|
|
%th Référence
|
|
|
|
%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
|
|
=price_line.title
|
|
|
|
%td.numeraire
|
|
=price_line.qte
|
|
|
|
%td.numeraire
|
|
=price_line.price_u_ht if show_prices
|
|
|
|
|
|
%td.numeraire
|
|
=price_line.tva_account_value.to_s+"%" if show_prices
|
|
|
|
|
|
|
|
|
|
%td.numeraire
|
|
=number_to_currency price_line.tot_amount_ht if show_prices
|
|
|
|
- if show_prices
|
|
%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 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
|
|
|
|
|
|
- if show_prices
|
|
%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]
|
|
|
|
- if show_prices
|
|
%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
|
|
|
|
|
|
.qi_row
|
|
.qi_pannel.qi_plain.padding
|
|
Générer à partir de ce document :
|
|
%br
|
|
-PFournisseurDocType.all.each do |pfdt|
|
|
=link_to "#{pfdt.name}", new_admin_p_fournisseur_doc_path(:p_fournisseur_doc_id => @p_fournisseur_doc.id, :p_fournisseur_doc_type_id => pfdt.id), :class => "btn btn-primary"
|
|
|
|
|
|
.qi_row
|
|
=link_to "Générer un mouvement de stock", new_admin_stock_block_path(:stockable_id => @p_fournisseur_doc.id, :stockable_type => @p_fournisseur_doc.class.to_s), :class => "btn btn-primary"
|
|
|
|
|
|
.qi_row
|
|
.qi_pannel.qi_plain.padding
|
|
=render :partial => "admin/stock_blocks/index", :locals => {:stock_blocks => @p_fournisseur_doc.stock_blocks}
|