WIP analyse

This commit is contained in:
Barnabé 2021-09-07 12:35:52 +02:00
parent 9d24db2178
commit 8e1cc4b0a1
3 changed files with 154 additions and 136 deletions

View File

@ -8,148 +8,160 @@
= @price_document.list_designaton = @price_document.list_designaton
=form_tag '/' =semantic_form_for [:admin, @price_document], :html => {:class => "qi_price_form"}, :remote => false do |form|
.qi_pannel.padding.new_table_container =form.semantic_fields_for :price_line_block do |f|
.table-slider - price_line_block = f.object
.inner .qi_pannel.padding.new_table_container
.table-slider
.inner
.table-area{:style => "overflow:auto;"} .table-area{:style => "overflow:auto;"}
.table-area-inner .table-area-inner
.freezeTable .freezeTable
%table.table.table-striped.table-hover.table-bordered.data_table %table.table.table-striped.table-hover.table-bordered.data_table
%thead.header %thead.header
%tr
-nb_resp = @price_document_responses.count
%th{colspan: 12}
Consultation
%th{colspan: nb_resp}
Fournisseurs
.btn.btn-light.ml-4#reset-radio
reset
%tr
%th
Qté à
%br
satisfaire
%th
Qté consultée
%th
Produit
%th
Référence
%th
Couleur
%th
Type
%br
chargeur
%th
Target hors
%br
Sorecop
%th
Px d'achat
%br
référence
%th
Marge
%br
théorique
%br
référence
%br
par zone
%th
Fours.
%br
de référence
%th
Date
%br
px référence
%th.limit
Spec
-@price_document_responses.each do |resp|
%th
=resp.p_fournisseur.name
%tbody
-price_lines = @price_document.price_line_block.price_lines
-consult_price_lines = @price_document.price_line_block.price_lines
-price_lines.each do |price_line|
%tr %tr
%td -nb_resp = @price_document_responses.count
=# ATTENTION ! On a plus accès direct aux commandes qui on engendré cette demande de prix. donc plus accès aux délais différent entre les différentes commades pour une ref donée %th{colspan: 12}
/ &#8721 Consultation
/ =price_line.qte.to_i %th{colspan: nb_resp}
/ %br Fournisseurs
- if price_line.cc_wish_date.present? && price_line.cc_wish_date < Date.today + 20.days .btn.btn-light.ml-4#reset-radio
%span.red reset
=ic(:fire)
=price_line.qte.to_i
- else
%span.darkblue
=ic(:hourglass)
=price_line.qte.to_i
%td.ref_tr
Qté en comm
%td
= price_line.p_product_ref.p_product.name
%td
=link_to [:admin, price_line.p_product_ref] do
= price_line.p_product_ref.ct_sub_name
= price_line.p_product_ref.p_product_color.name
%td %tr
= price_line.p_product_ref.p_product_color.color if price_line.p_product_ref and price_line.p_product_ref.p_product_color %th
%td Qté à
= price_line.p_product_power.name if price_line.p_product_power %br
%td satisfaire
/ Target hors Sorecop %th
%td Qté consultée
/ Px d'achat de référence %th
%td Produit
/ Marge théorique de référence par zone %th
%td Référence
/ Fournisseurs de référence %th
%td Couleur
/ Date du px de référence %th
%td.limit Type
/ spec %br
chargeur
%th
Target hors
%br
Sorecop
%th
Px d'achat
%br
référence
%th
Marge
%br
théorique
%br
référence
%br
par zone
%th
Fours.
%br
de référence
%th
Date
%br
px référence
%th.limit
Spec
- @price_document_responses.each do |resp| -@price_document_responses.each do |resp|
-line = resp.price_line_block.price_lines.where(p_product_ref: price_line.p_product_ref).first %th
-cell = [] -if resp.p_fournisseur
=resp.p_fournisseur.name
- if line.qte_available.to_i > 0
-if line.qte_available >= price_line.qte.to_i %tbody
- cell << "Qté dispo : #{line.qte_available.to_i}" -# price_lines = f.object.price_lines
-else
- cell << "#{ic(:warning, class: "orange")} Qté dispo : #{line.qte_available.to_i} (#{line.qte_available.to_i - price_line.qte.to_i})" -consult_price_lines = @price_document.price_line_block.price_lines
- cell << "PA: #{line.ct_u_price_ht} €" =f.semantic_fields_for :price_lines do |form|
- # mp = calcul de la marge prévisionelle TODO - price_line = form.object
- line.id.odd? ? mp = 0.17 : mp = 0.11 -#price_lines = @price_document.price_line_block.price_lines
- if mp.present? -#price_lines.each do |price_line|
-if mp > 0.15
- cell << "<span class=green>#{ic(:check)} MP: #{mp * 100} %</span>" %tr
%td
=# ATTENTION ! On a plus accès direct aux commandes qui on engendré cette demande de prix. donc plus accès aux délais différent entre les différentes commades pour une ref donée
/ &#8721
/ =price_line.qte.to_i
/ %br
- if price_line.cc_wish_date.present? && price_line.cc_wish_date < Date.today + 20.days
%span.red
=ic(:fire)
=price_line.qte.to_i
- else
%span.darkblue
=ic(:hourglass)
=price_line.qte.to_i
%td.ref_tr
Qté en comm
%td
= price_line.p_product_ref.p_product.name
%td
=link_to [:admin, price_line.p_product_ref] do
= price_line.p_product_ref.ct_sub_name
= price_line.p_product_ref.p_product_color.name
%td
= price_line.p_product_ref.p_product_color.color if price_line.p_product_ref and price_line.p_product_ref.p_product_color
%td
= price_line.p_product_power.name if price_line.p_product_power
%td
/ Target hors Sorecop
%td
/ Px d'achat de référence
%td
/ Marge théorique de référence par zone
%td
/ Fournisseurs de référence
%td
/ Date du px de référence
%td.limit
/ spec
=form.input :selected_price_line_id, collection: PriceLine.where(:price_line_ref_id => form.object.id).all, as: :radio, :member_label => :id
=debug form.object.id
- @price_document_responses.each do |resp|
-line = resp.price_line_block.price_lines.where(p_product_ref: price_line.p_product_ref).first
-cell = []
- if line.qte_available.to_i > 0
-if line.qte_available >= price_line.qte.to_i
- cell << "Qté dispo : #{line.qte_available.to_i}"
-else
- cell << "#{ic(:warning, class: "orange")} Qté dispo : #{line.qte_available.to_i} (#{line.qte_available.to_i - price_line.qte.to_i})"
- cell << "PA: #{line.ct_u_price_ht} €"
- # mp = calcul de la marge prévisionelle TODO
- line.id.odd? ? mp = 0.17 : mp = 0.11
- if mp.present?
-if mp > 0.15
- cell << "<span class=green>#{ic(:check)} MP: #{mp * 100} %</span>"
-else
- cell << "#{ic(:times, class: "red")} MP: #{mp * 100} %"
-else -else
- cell << "#{ic(:times, class: "red")} MP: #{mp * 100} %" - cell << "<span class=red>pas dispo</span>"
-else -if line.comment.present?
- cell << "<span class=red>pas dispo</span>" - display_comment = ""
-if line.comment.present? - if line.comment.length > 10
- display_comment = "" - display_comment = "#{line.comment[0..10]} (..)"
- if line.comment.length > 10 - else
- display_comment = "#{line.comment[0..10]} (..)" - display_comment = line.comment
- else - cell << "<span class='info'>#{ic('info-circle')} #{display_comment}<span class='info-text'>#{line.comment}</span></span>"
- display_comment = line.comment
- cell << "<span class='info'>#{ic('info-circle')} #{display_comment}<span class='info-text'>#{line.comment}</span></span>"
%td.p-0 %td.p-0
= radio_button_tag "ref_price_selected_#{price_line.p_product_ref.id}", line.id, false, class: "category-selector" = "reponse price_line ID : #{line.id}"
= label_tag "ref_price_selected_#{price_line.p_product_ref.id}_#{line.id}", sanitize(cell.join('<br>')), class: "p-2 m-auto" =#form.input :selected_price_offer, as: :radio
= radio_button_tag "ref_price_selected_#{price_line.p_product_ref.id}", line.id, false, class: "category-selector"
= label_tag "ref_price_selected_#{price_line.p_product_ref.id}_#{line.id}", sanitize(cell.join('<br>')), class: "p-2 m-auto"
=submit_tag 'valider la selection', class: "btn btn-primary" =submit_tag 'valider la selection', class: "btn btn-primary"

View File

@ -0,0 +1,5 @@
class AddSelectedPriceOfferToPriceLines < ActiveRecord::Migration[6.0]
def change
add_column :price_lines, :selected_price_line_id, :integer
end
end

View File

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_08_30_091804) do ActiveRecord::Schema.define(version: 2021_09_07_083709) do
create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "name" t.string "name"
@ -2544,6 +2544,7 @@ ActiveRecord::Schema.define(version: 2021_08_30_091804) do
t.boolean "eu" t.boolean "eu"
t.boolean "fullkit" t.boolean "fullkit"
t.boolean "lang_start" t.boolean "lang_start"
t.integer "selected_price_line_id"
end end
create_table "quote_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| create_table "quote_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|