suite
This commit is contained in:
parent
09df957879
commit
97367e819c
@ -1,3 +1,5 @@
|
|||||||
class MOdrBrand < ApplicationRecord
|
class MOdrBrand < ApplicationRecord
|
||||||
belongs_to :m_odr
|
belongs_to :m_odr
|
||||||
|
|
||||||
|
has_many :m_odr_products
|
||||||
end
|
end
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
.qi_row
|
.qi_row
|
||||||
.qi_pannel.qi_plain.padding
|
.qi_pannel.qi_plain.padding
|
||||||
|
|
||||||
|
%div{:style => "overflow:auto;"}
|
||||||
-@m_odr_reps = @m_odr.m_odr_reps
|
-@m_odr_reps = @m_odr.m_odr_reps
|
||||||
|
|
||||||
%table.table.table-striped.table-hover.table-bordered
|
%table.table.table-striped.table-hover.table-bordered
|
||||||
@ -21,7 +21,7 @@
|
|||||||
%th
|
%th
|
||||||
%th{:rowspan => 2} Nombre de participation
|
%th{:rowspan => 2} Nombre de participation
|
||||||
-@m_odr_reps.group(:state).each do |state|
|
-@m_odr_reps.group(:state).each do |state|
|
||||||
%th{:style => "font-weight:normal", :colspan => 3}
|
%th{:style => "font-weight:normal", :colspan => 5+(@m_odr.m_odr_brands.count*2)+(@m_odr.m_odr_products.count*2)}
|
||||||
Etat :
|
Etat :
|
||||||
=state_helper state.state
|
=state_helper state.state
|
||||||
|
|
||||||
@ -31,6 +31,32 @@
|
|||||||
-@m_odr_reps.group(:state).each do |state|
|
-@m_odr_reps.group(:state).each do |state|
|
||||||
%th Nbr participation
|
%th Nbr participation
|
||||||
%th Nbr pneus
|
%th Nbr pneus
|
||||||
|
|
||||||
|
-@m_odr_reps.group(:qte).order(:qte).each do |qte|
|
||||||
|
%th
|
||||||
|
Nbr part. avec
|
||||||
|
=qte.qte
|
||||||
|
pneus
|
||||||
|
|
||||||
|
-@m_odr.m_odr_brands.each do |m_odr_brand|
|
||||||
|
%th
|
||||||
|
=m_odr_brand.name
|
||||||
|
Nbr part.
|
||||||
|
%th
|
||||||
|
=m_odr_brand.name
|
||||||
|
Nbr pneus
|
||||||
|
|
||||||
|
|
||||||
|
-m_odr_brand.m_odr_products.each do |m_odr_product|
|
||||||
|
%th
|
||||||
|
=m_odr_product.name
|
||||||
|
Nbr part.
|
||||||
|
%th
|
||||||
|
=m_odr_product.name
|
||||||
|
Nbr pneus
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%th Total remises
|
%th Total remises
|
||||||
-m_odr_reps = @m_odr_reps
|
-m_odr_reps = @m_odr_reps
|
||||||
%tr
|
%tr
|
||||||
@ -41,9 +67,26 @@
|
|||||||
=m_odr_reps.where(:state => state.state).count
|
=m_odr_reps.where(:state => state.state).count
|
||||||
%td
|
%td
|
||||||
=m_odr_reps.where(:state => state.state).sum(:qte)
|
=m_odr_reps.where(:state => state.state).sum(:qte)
|
||||||
|
|
||||||
|
-@m_odr_reps.group(:qte).order(:qte).each do |qte|
|
||||||
|
%th
|
||||||
|
=m_odr_reps.where(:state => state.state, :qte => qte.qte).count
|
||||||
|
|
||||||
|
|
||||||
|
-@m_odr.m_odr_brands.each do |m_odr_brand|
|
||||||
|
%td=m_odr_reps.where(:state => state.state, :m_odr_product_id => m_odr_brand.m_odr_products.ids).count
|
||||||
|
%td=m_odr_reps.where(:state => state.state, :m_odr_product_id => m_odr_brand.m_odr_products.ids).sum(:qte)
|
||||||
|
|
||||||
|
-m_odr_brand.m_odr_products.each do |m_odr_product|
|
||||||
|
%td=m_odr_reps.where(:state => state.state, :m_odr_product_id => m_odr_product.id).count
|
||||||
|
%td=m_odr_reps.where(:state => state.state, :m_odr_product_id => m_odr_product.id).sum(:qte)
|
||||||
|
|
||||||
%td.numeraire{:style => ("color:red;" if total = m_odr_reps.where(:state => state.state).sum(:cc_remise) and total == 0.0)}
|
%td.numeraire{:style => ("color:red;" if total = m_odr_reps.where(:state => state.state).sum(:cc_remise) and total == 0.0)}
|
||||||
=number_to_currency total
|
=number_to_currency total
|
||||||
|
|
||||||
|
-nbr_participations_for_places = []
|
||||||
|
-nbr_pneus_for_places = []
|
||||||
|
|
||||||
-@m_odr_reps.group(:m_odr_place_id).joins(:m_odr_place).order("m_odr_places.name").each do |place|
|
-@m_odr_reps.group(:m_odr_place_id).joins(:m_odr_place).order("m_odr_places.name").each do |place|
|
||||||
-m_odr_reps = @m_odr_reps.where(:m_odr_place_id => place.m_odr_place_id)
|
-m_odr_reps = @m_odr_reps.where(:m_odr_place_id => place.m_odr_place_id)
|
||||||
|
|
||||||
@ -52,8 +95,32 @@
|
|||||||
%td=m_odr_reps.count
|
%td=m_odr_reps.count
|
||||||
-@m_odr_reps.group(:state).each do |state|
|
-@m_odr_reps.group(:state).each do |state|
|
||||||
%td
|
%td
|
||||||
=m_odr_reps.where(:state => state.state).count
|
=p = m_odr_reps.where(:state => state.state).count
|
||||||
|
-nbr_participations_for_places << p if p > 0
|
||||||
%td
|
%td
|
||||||
=m_odr_reps.where(:state => state.state).sum(:qte)
|
=q = m_odr_reps.where(:state => state.state).sum(:qte)
|
||||||
|
-nbr_pneus_for_places << q if p > 0
|
||||||
|
-@m_odr_reps.group(:qte).order(:qte).each do |qte|
|
||||||
|
%th
|
||||||
|
=m_odr_reps.where(:state => state.state, :qte => qte.qte).count
|
||||||
|
|
||||||
|
-@m_odr.m_odr_brands.each do |m_odr_brand|
|
||||||
|
%td=m_odr_reps.where(:state => state.state, :m_odr_product_id => m_odr_brand.m_odr_products.ids).count
|
||||||
|
%td=m_odr_reps.where(:state => state.state, :m_odr_product_id => m_odr_brand.m_odr_products.ids).sum(:qte)
|
||||||
|
|
||||||
|
-m_odr_brand.m_odr_products.each do |m_odr_product|
|
||||||
|
%td=m_odr_reps.where(:state => state.state, :m_odr_product_id => m_odr_product.id).count
|
||||||
|
%td=m_odr_reps.where(:state => state.state, :m_odr_product_id => m_odr_product.id).sum(:qte)
|
||||||
|
|
||||||
%td.numeraire{:style => ("color:red;" if total = m_odr_reps.where(:state => state.state).sum(:cc_remise) and total == 0.0)}
|
%td.numeraire{:style => ("color:red;" if total = m_odr_reps.where(:state => state.state).sum(:cc_remise) and total == 0.0)}
|
||||||
=number_to_currency total
|
=number_to_currency total
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%p
|
||||||
|
Moyenne participation / point de vente avec participation :
|
||||||
|
=(nbr_participations_for_places.inject{ |sum, el| sum + el }.to_f / nbr_participations_for_places.size).round(2)
|
||||||
|
%p
|
||||||
|
Moyenne nbr pneus / point de vente avec participation :
|
||||||
|
=(nbr_pneus_for_places.inject{ |sum, el| sum + el }.to_f / nbr_pneus_for_places.size).round(2)
|
Loading…
x
Reference in New Issue
Block a user