analyse reponse
This commit is contained in:
parent
25a2c24b1a
commit
470ae0edf6
@ -598,5 +598,10 @@ class Admin::PriceDocumentsController < ApplicationController
|
|||||||
def match_p_fournisseur
|
def match_p_fournisseur
|
||||||
@price_document = PriceDocument.find(params[:id])
|
@price_document = PriceDocument.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def analyse_reponses
|
||||||
|
@price_document = PriceDocument.find(params[:id])
|
||||||
|
@price_document_responses = PriceDocument.where(:doc_ref_id => @price_document.id )
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,7 @@ class PriceLine < ApplicationRecord
|
|||||||
belongs_to :price_line_block
|
belongs_to :price_line_block
|
||||||
belongs_to :p_product
|
belongs_to :p_product
|
||||||
belongs_to :p_product_ref
|
belongs_to :p_product_ref
|
||||||
|
belongs_to :p_product_power
|
||||||
default_scope { order('position ASC') }
|
default_scope { order('position ASC') }
|
||||||
|
|
||||||
validates :p_product_ref_id, :presence => true, :if => :p_product_ref_needed?
|
validates :p_product_ref_id, :presence => true, :if => :p_product_ref_needed?
|
||||||
|
@ -27,7 +27,7 @@ class PriceLineBlock < ApplicationRecord
|
|||||||
SALE_BLOCKS = ["Demande de commande", "Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"]
|
SALE_BLOCKS = ["Demande de commande", "Bon de commande", "Devis", "Bon de livraison", "Facture", "Avoir"]
|
||||||
|
|
||||||
belongs_to :p_fournisseur
|
belongs_to :p_fournisseur
|
||||||
|
accepts_nested_attributes_for :p_fournisseur
|
||||||
|
|
||||||
def to_no_archive
|
def to_no_archive
|
||||||
if self.imported
|
if self.imported
|
||||||
|
175
app/views/admin/price_documents/analyse_reponses.html.haml
Normal file
175
app/views/admin/price_documents/analyse_reponses.html.haml
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
.qi_header
|
||||||
|
%h1
|
||||||
|
Achats
|
||||||
|
%span
|
||||||
|
Analyse des réponces à la consiltation n°
|
||||||
|
= link_to @price_document.d_number, admin_price_document_path(@price_document)
|
||||||
|
\-
|
||||||
|
= @price_document.list_designaton
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_pannel.padding.new_table_container
|
||||||
|
.table-slider
|
||||||
|
.inner
|
||||||
|
|
||||||
|
.table-area{:style => "overflow:auto;"}
|
||||||
|
.table-area-inner
|
||||||
|
.freezeTable
|
||||||
|
%table.table.table-striped.table-hover.table-bordered.data_table
|
||||||
|
%thead.header
|
||||||
|
%tr
|
||||||
|
-nb_resp = @price_document_responses.count
|
||||||
|
%th{colspan: 12}
|
||||||
|
Consultation
|
||||||
|
%th{colspan: nb_resp}
|
||||||
|
Fournisseurs
|
||||||
|
|
||||||
|
%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
|
||||||
|
%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
|
||||||
|
∑
|
||||||
|
=price_line.qte.to_i
|
||||||
|
%br
|
||||||
|
- if price_line.cc_wish_date.present? && price_line.cc_wish_date < Date.today + 10.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
|
||||||
|
%td
|
||||||
|
= price_line.p_product_power.name
|
||||||
|
%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
|
||||||
|
/ spec
|
||||||
|
- @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
|
||||||
|
-cell << line.id.odd?
|
||||||
|
- 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
|
||||||
|
- cell << "<span class=red>pas dispo</span>"
|
||||||
|
-if line.comment.present?
|
||||||
|
- cell << "<span class=darkgrey>#{ic('info-circle')} #{line.comment}</span>"
|
||||||
|
%td
|
||||||
|
=sanitize(cell.join('<br>'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:scss
|
||||||
|
.limit {
|
||||||
|
border-right:3px solid green !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
.green {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
.orange {
|
||||||
|
color: orange;
|
||||||
|
}
|
||||||
|
.darkgrey {
|
||||||
|
color: #darkgrey;
|
||||||
|
}
|
||||||
|
.darkblue {
|
||||||
|
color: darkblue;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-input {
|
||||||
|
max-width: 100px;
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
.qi_header
|
.qi_header
|
||||||
.right
|
.right
|
||||||
|
-if @price_document.price_document_type_id == 1
|
||||||
|
=link_to ic("bar-chart")+" analyse des réponses", analyse_reponses_admin_price_document_path(@price_document), class: "btn btn-primary"
|
||||||
|
|
||||||
-if @price_document.price_document_type_id == 6 and !@price_document.stock_ok
|
-if @price_document.price_document_type_id == 6 and !@price_document.stock_ok
|
||||||
= link_to i(:pencil), edit_admin_price_document_path(:id => @price_document.id, :public_edit => true) if !@price_document.stock_ok
|
= link_to i(:pencil), edit_admin_price_document_path(:id => @price_document.id, :public_edit => true) if !@price_document.stock_ok
|
||||||
|
|
||||||
@ -50,7 +52,7 @@
|
|||||||
%td
|
%td
|
||||||
Avancement (%)
|
Avancement (%)
|
||||||
%td
|
%td
|
||||||
=@price_document.avancement
|
=@price_document.avancement.to_s + " %"
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
Désignation
|
Désignation
|
||||||
|
@ -616,6 +616,7 @@ Rails.application.routes.draw do
|
|||||||
get :consult_edit
|
get :consult_edit
|
||||||
put :consult_update
|
put :consult_update
|
||||||
get :match_p_fournisseur
|
get :match_p_fournisseur
|
||||||
|
get :analyse_reponses
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
get :search_to_affect
|
get :search_to_affect
|
||||||
|
Reference in New Issue
Block a user