diff --git a/app/controllers/admin/p_payments_controller.rb b/app/controllers/admin/p_payments_controller.rb index 31ac52c..e5366ea 100644 --- a/app/controllers/admin/p_payments_controller.rb +++ b/app/controllers/admin/p_payments_controller.rb @@ -108,12 +108,13 @@ class Admin::PPaymentsController < ApplicationController @p_payments = @p_payments.where("affected = ?", params[:affected].to_i) end - if params[:remise].to_s != "" - @p_payments = @p_payments.where("remise = ?", params[:remise].to_i) - if params[:remise].to_s == "0" - @p_payments = @p_payments.where(:imported => false) - end - end + # PROBLEME AVEC POSTGRES. Attend un booléen mais le where envoi 1/0 + # if params[:remise].to_s != "" + # @p_payments = @p_payments.where("remise = ?", params[:remise].to_i) + # if params[:remise].to_s == "0" + # @p_payments = @p_payments.where(:imported => false) + # end + # end if params[:p_customer_id].to_s != "" @p_payments = @p_payments.where(:p_customer_id => params[:p_customer_id]) diff --git a/app/views/admin/dashboards/commercial.html.haml b/app/views/admin/dashboards/commercial.html.haml index 047efd4..36a15bd 100644 --- a/app/views/admin/dashboards/commercial.html.haml +++ b/app/views/admin/dashboards/commercial.html.haml @@ -293,7 +293,7 @@ .check_box_search_index .check_box_search_index_inner.clientsCheck - -st = StatLine.group(:p_customer_id).order(:p_customer_name) + -st = StatLine.select(:p_customer_id, :p_customer_name).group(:p_customer_id, :p_customer_name).order('stat_lines.p_customer_name') -if current_admin.p_commercial -st = st.where(:p_customer_id => current_admin.p_commercial.p_customers.ids) -st.all.each do |pdt| @@ -675,6 +675,8 @@ %span.text-success %i.mdi.mdi-arrow-bottom-right =number_to_currency(((@periode_tot_weight.to_f != 0.0 ? @periode_avg_price_per_kg = @ca_produits_degrade / @periode_tot_weight : 0.0)), :precision => 2) + / DEBUG POUR AFFICHER LA PAGE SANS DATA + - @periode_avg_price_per_kg = 1 ="/ Kg" ca moyen / kilo @@ -748,10 +750,10 @@ -@tot_clients_inactifs = (@tot_customs - @periode_lines.group(:p_customer_id).map{|p| p.p_customer_id}.uniq) -@all_customers_rows = @all_customers_rows.where(id: params[:p_customer_ids]) -else - -@tot_clients_inactifs = (@all_customers_rows.ids - (@periode_lines.group(:p_customer_id).map{|a| a.p_customer_id}).reject { |e| e.to_s.empty? }.uniq ) + -@tot_clients_inactifs = (@all_customers_rows.ids - (@periode_lines.select(:p_customer_id).group(:p_customer_id).map{|a| a.p_customer_id}).reject { |e| e.to_s.empty? }.uniq ) - -@periode_nbr_clients_actifs = (@periode_lines.group(:p_customer_id).map{|a| a.p_customer_id}).reject { |e| e.to_s.empty? }.uniq.length + -@periode_nbr_clients_actifs = (@periode_lines.select(:p_customer_id).group(:p_customer_id).map{|a| a.p_customer_id}).reject { |e| e.to_s.empty? }.uniq.length / -@clients_inactifs = [] / -@periode_nbr_clients_inactifs = params[:p_customer_ids].each do |a| / -@clients_inactifs << PCustomer.where(id: a, enabled: false) @@ -759,7 +761,7 @@ / -@tot_clients_inactifs = (@clients_inactifs.length - @periode_nbr_clients_actifs) %div{:style => "font-size:0.7em;float:right"} - =link_to admin_p_customers_path(:p_customer_ids => (@all_customers_rows.ids - (@periode_lines.group(:p_customer_id).map{|a| a.p_customer_id}).uniq )), :method => :patch do + =link_to admin_p_customers_path(:p_customer_ids => (@all_customers_rows.ids - (@periode_lines.select(:p_customer_id).group(:p_customer_id).map{|a| a.p_customer_id}).uniq )), :method => :patch do =@tot_clients_inactifs.length inactifs @@ -810,7 +812,8 @@ %span.text-success %i.mdi.mdi-arrow-bottom-right =number_to_currency((@periode_avg_ca_per_customer = @ca_produits_degrade / @periode_nbr_clients_actifs.to_f), :precision => 0) - + / DEBUG POUR AFFICHER LA PAGE SANS DATA + -@periode_avg_ca_per_customer = 1 ca moyen / clients .mb-0