This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/views/public/p_orders/recap.html.haml
2021-08-23 10:26:02 +02:00

352 lines
12 KiB
Plaintext

.wrapper
-img_url = "/cacao.jpg"
%section.module-cover.text-center.with_ratio{"data-background" => "#{img_url}", "data-overlay" => "0.5", "data-ratio" => "0.3"}
.container.vertical_center
.row
.col-md-12
%h2
Récapitulatif & validation
=render :partial => "public/p_orders/menu"
.container{:style => "max-width:1200px;"}
.row
.col-md-12
-price_line_block = @p_customer_sheet.price_line_block
-if price_line_block.price_lines.count > 0
.price_line_block_recap
%p
Date de commande :
=l price_line_block.creation_date
-if price_line_block.wish_date
%p
Semaine de livraison souhaitée :
=l price_line_block.wish_date, :format => "%V"
(du
=l price_line_block.wish_date.beginning_of_week
au
=l price_line_block.wish_date.end_of_week
)
%br
Date saisie :
=l price_line_block.wish_date
-if price_line_block.nbr_ship
%p
Nombre de colis :
=price_line_block.nbr_ship
-if price_line_block.customer_ref?
%p
Référence commande personnalisée :
=price_line_block.customer_ref
-if @p_customer_sheet and price_line_block.p_customer and price_line_block.p_customer.p_customer_sheet_note?
%div
%strong Notes pour les demandes de commandes pour ce client :
=simple_format price_line_block.p_customer.p_customer_sheet_note
%br
-if price_line_block.p_devise_id != 1
%p
Taux de change appliqué :
1€ =
=(1.0/ price_line_block.devise_rate).round(5)
=price_line_block.devise_symbol
="(Provisoire)" if !price_line_block.local_amount_ttc?
%table.table.table-striped
%thead
%tr
%th Référence
%th Désignation
-if PriceLineBlock::PURCHASE_BLOCKS.include?(price_line_block.block_type)
%th
DLUO
%th
Lot
%th Qté
%th P.U. HT
%th Poids / U. [Kg]
%th Qté [Kg]
%th P.U. HT [Kg]
%th TVA
-if !price_line_block.remise_ecole_ok and price_line_block.sale?
%th
Remise
%br
Marché
%br
annuel
-if price_line_block.ca_remise_qte_ok
%th
Remise
%br
Qté livrée
%br
="/cde"
-if price_line_block.remise_pre_order_ok
%th
Remise
%br
commande
%br
anticipée
-if price_line_block.discount_comptant
%th
Remise
%br
comptant
-if price_line_block.remise_enrobage_ok
%th
Remise
%br
enrobage
-elsif price_line_block.sale?
%th
Remise
%br
école
-if !PriceLineBlock::PURCHASE_BLOCKS.include?(price_line_block.block_type)
%th
P.U. Net
%th
Montant HT
%tbody
-price_line_block.price_lines.each do |price_line|
%tr
%td
=price_line.ref
%td
=price_line.title
-if PriceLineBlock::PURCHASE_BLOCKS.include?(price_line_block.block_type)
%td
=l price_line.dluo if price_line.dluo
%td
= price_line.lot
%td.numeraire
=price_line.qte
%td.numeraire
=number_to_currency price_line.price_u_ht, :unit => price_line_block.devise_symbol
%td.numeraire
=price_line.weight_u
%td.numeraire
=price_line.weight_qte.to_f.round(3)
%td.numeraire
=number_to_currency price_line.ca_price_u_kg_ht, :unit => price_line_block.devise_symbol
-if price_line.bk_price_ht and current_admin.has_permission?("gestion-des-commandes") and !PriceLineBlock::PURCHASE_BLOCKS.include?(price_line_block.block_type)
.red
=ic(:lock)
Prix daté
%td.numeraire
=price_line.tva_account_value.to_s+"%"
-if !price_line_block.remise_ecole_ok and price_line_block.sale?
%td.numeraire
=price_line.discount_market_percent.to_s+"%"
%br
=number_to_currency price_line.ca_discount_market_ht, :unit => price_line_block.devise_symbol
-if price_line_block.ca_remise_qte_ok
%td.numeraire
=price_line.discount_qte_percent.to_s+"%"
%br
=number_to_currency price_line.ca_discount_qte_ht, :unit => price_line_block.devise_symbol
-if price_line_block.remise_pre_order_ok
%td.numeraire
=price_line.discount_delay_percent.to_s+"%"
%br
=number_to_currency price_line.ca_discount_delay_ht, :unit => price_line_block.devise_symbol
-if price_line_block.discount_comptant
%td.numeraire
=price_line.discount_comptant_percent.to_s+"%"
%br
=number_to_currency price_line.ca_discount_comptant_ht, :unit => price_line_block.devise_symbol
-if price_line_block.remise_enrobage_ok
%td.numeraire
=price_line.discount_enrobage_percent.to_s+"%"
%br
=number_to_currency price_line.ca_discount_enrobage_ht, :unit => price_line_block.devise_symbol
-elsif price_line_block.sale?
%td.numeraire
=price_line.discount_ecole_percent.to_s+"%"
%br
=number_to_currency price_line.ca_discount_ecole_ht, :unit => price_line_block.devise_symbol
-if !PriceLineBlock::PURCHASE_BLOCKS.include?(price_line_block.block_type)
%td.numeraire
=number_to_currency price_line.ca_price_u_kg_net_ht, :unit => price_line_block.devise_symbol
%td.numeraire
=number_to_currency price_line.tot_amount_ht, :unit => price_line_block.devise_symbol
%table.table{:style => "width:auto;float:right;"}
%tr
%th
Poids total :
%td.numeraire
="#{price_line_block.weight_tot}Kg"
-if !PriceLineBlock::PURCHASE_BLOCKS.include?(price_line_block.block_type)
%tr
%th Total remises U. HT :
%td.numeraire
=number_to_currency price_line_block.cumul_discount_ht, :unit => price_line_block.devise_symbol
%tr
%th
Total HT
%td.numeraire
=number_to_currency price_line_block.tot_lines_ht, :unit => price_line_block.devise_symbol
-if price_line_block.tot_discount_ht != 0.0
%tr
%th
Remise commerciale exceptionnelle (HT
="(#{price_line_block.ct_tot_discount_percent}%)"
%td.numeraire
=number_to_currency price_line_block.tot_discount_ht, :unit => price_line_block.devise_symbol
%tr
%th
Frais de port HT
="(TVA #{price_line_block.fdp_tva_rate}%)"
%td.numeraire
=number_to_currency price_line_block.tot_fdp_ht, :unit => price_line_block.devise_symbol
%tr
%th
Total HT Net
%td.numeraire
=number_to_currency price_line_block.tot_amount_ht, :unit => price_line_block.devise_symbol
%tr
%th
Total TVA
%td.numeraire
=number_to_currency price_line_block.tot_amount_tva, :unit => price_line_block.devise_symbol
%tr
%th
Total TTC
%td.numeraire
=number_to_currency price_line_block.tot_amount_ttc, :unit => price_line_block.devise_symbol
-if !PriceLineBlock::PURCHASE_BLOCKS.include?(price_line_block.block_type)
%tr
%th
 
%th
%tr
%th
Net à payer
%td.numeraire
=number_to_currency price_line_block.tot_amount_ttc, :unit => price_line_block.devise_symbol
%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], :unit => price_line_block.devise_symbol
%td
=number_to_currency value[:tva], :unit => price_line_block.devise_symbol
%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
.clear
%div{:style => "padding: 40px 0;"}
.text-right
=semantic_form_for [:public, @p_customer_sheet],:url => recap_save_public_p_orders_path(), :html => { :method => :post, :onchange =>""}, :remote => false do |form|
.right{:style => "text-align:right;"}
=form.hidden_field :p_payment_type_id
=link_to (qit('payment-order', 'Valider la commande')+" >"),"#", :onclick => "$(this).closest('form').submit();return false;", :class => "btn btn-primary"