Nicolas Bally f20fe482c6 initial
2020-04-06 10:38:07 +02:00

197 lines
5.1 KiB
Plaintext

.qi_header
.right
=raw @p_fournisseur_order.state_html
= link_to i(:pencil), edit_admin_p_fournisseur_order_path(@p_fournisseur_order), :remote => false
%h1
Achats
%span
Fournisseurs
%span
=link_to @p_fournisseur_order.p_fournisseur.name, [:admin, @p_fournisseur_order.p_fournisseur]
%span
Détail de la commande
%span
="#"+@p_fournisseur_order.id.to_s
-price_line_block = @p_fournisseur_order.price_line_block
.qi_row
.qi_pannel.qi_plain.padding
%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
%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
%tr
%th
 
%th
%tr
%th
Net à payer
%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
.clear
.qi_row
-PFournisseurDocType.all.each do |pfdt|
=link_to "Générer #{pfdt.name}", new_admin_p_fournisseur_doc_path(:p_fournisseur_order_id => @p_fournisseur_order.id, :p_fournisseur_doc_type_id => pfdt.id), :class => "btn btn-primary"
.qi_row
.qi_pannel.qi_plain.padding
%table.table
%tr
%th ID
%th Date
%th Type
%th Fournisseur
%th Commande fournisseur
%th Ref
%th HT
%th TVA
%th TTC
%th
=render @p_fournisseur_order.p_fournisseur_docs
.qi_row
=link_to "Générer un mouvement de stock", new_admin_stock_block_path(:stockable_id => @p_fournisseur_order.id, :stockable_type => @p_fournisseur_order.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_order.stock_blocks}
%br
%br
%br