Bugfix stats
This commit is contained in:
parent
1a63ef9f44
commit
3c0b028157
@ -56,7 +56,8 @@ class Admin::PStatsController < ApplicationController
|
|||||||
@m_odr_primes = MOdrPrime.where("m_odr_primes.created_at >= ? and m_odr_primes.created_at < ?",@start.beginning_of_year, @stop).where(:state => ["Virement envoyé"])
|
@m_odr_primes = MOdrPrime.where("m_odr_primes.created_at >= ? and m_odr_primes.created_at < ?",@start.beginning_of_year, @stop).where(:state => ["Virement envoyé"])
|
||||||
@m_odr_primes = @m_odr_primes.joins(:p_customer)
|
@m_odr_primes = @m_odr_primes.joins(:p_customer)
|
||||||
@m_odr_primes = @m_odr_primes.where("m_odr_primes.created_at >= ?", @start)
|
@m_odr_primes = @m_odr_primes.where("m_odr_primes.created_at >= ?", @start)
|
||||||
@m_odr_primes = sort_by_sorting(@m_odr_primes, "m_odr_primes.created_at DESC")
|
@m_odr_primes = sort_by_sorting(@m_odr_primes, "m_odr_primes.cc_virement_date DESC")
|
||||||
|
@all_m_odr_primes = @m_odr_primes
|
||||||
@m_odr_primes = @m_odr_primes.page(page).per(per_page)
|
@m_odr_primes = @m_odr_primes.page(page).per(per_page)
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,11 +55,22 @@ class MOdrPrime < ApplicationRecord
|
|||||||
|
|
||||||
:date_roulage => {:name => "Date de roulage", :reorder => true, :sort_name => "m_odr_file_roulages.date"},
|
:date_roulage => {:name => "Date de roulage", :reorder => true, :sort_name => "m_odr_file_roulages.date"},
|
||||||
:state => {:name => "Statut", :reorder => true},
|
:state => {:name => "Statut", :reorder => true},
|
||||||
:date_virement => {:name => "Date de virement"},
|
#:date_virement => {:name => "Date de virement"},
|
||||||
|
:cc_virement_date => {:name => "Date de virement", :reorder => true},
|
||||||
|
|
||||||
:actions => {:name => "Actions", :reorder => true},
|
:actions => {:name => "Actions", :reorder => true},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
acts_as_caching :fields => [:virement_date]
|
||||||
|
|
||||||
|
def ca_virement_date
|
||||||
|
virement = self.m_odr_virements.where(:refused => 0, :sended => 1).order('id DESC').first
|
||||||
|
if virement and virement.m_odr_remise
|
||||||
|
virement.m_odr_remise.created_at
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,19 +93,19 @@
|
|||||||
%th
|
%th
|
||||||
Primes
|
Primes
|
||||||
%td
|
%td
|
||||||
=@m_odr_primes.count
|
=@all_m_odr_primes.count
|
||||||
%td
|
%td
|
||||||
=number_to_currency @m_odr_primes.sum(:amount)
|
=number_to_currency @all_m_odr_primes.sum(:amount)
|
||||||
|
|
||||||
%td
|
%td
|
||||||
= @m_odr_primes.sum(:nbr_pneus)
|
= @all_m_odr_primes.sum(:nbr_pneus)
|
||||||
|
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=link_to "Export CSV", params.permit!.merge({:format => :csv})
|
=link_to "Export Excel", params.permit!.merge({:format => :csv})
|
||||||
|
|
||||||
=#debug MailHist.qi_ordered_table_name
|
=#debug MailHist.qi_ordered_table_name
|
||||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_primes}
|
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_primes}
|
||||||
|
10
db/migrate/20210701095917_add_ccv_to_m_odr_primes.rb
Normal file
10
db/migrate/20210701095917_add_ccv_to_m_odr_primes.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class AddCcvToMOdrPrimes < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :m_odr_primes, :cc_virement_date, :date
|
||||||
|
add_column :m_odr_primes, :ac_virement_date, :date
|
||||||
|
|
||||||
|
MOdrPrime.all.each do |mop|
|
||||||
|
mop.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -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_02_09_153303) do
|
ActiveRecord::Schema.define(version: 2021_07_01_095917) 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"
|
||||||
@ -834,6 +834,8 @@ ActiveRecord::Schema.define(version: 2021_02_09_153303) do
|
|||||||
t.decimal "amount", precision: 14, scale: 2
|
t.decimal "amount", precision: 14, scale: 2
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.date "cc_virement_date"
|
||||||
|
t.date "ac_virement_date"
|
||||||
t.index ["m_odr_file_roulage_id"], name: "index_m_odr_primes_on_m_odr_file_roulage_id"
|
t.index ["m_odr_file_roulage_id"], name: "index_m_odr_primes_on_m_odr_file_roulage_id"
|
||||||
t.index ["p_customer_id"], name: "index_m_odr_primes_on_p_customer_id"
|
t.index ["p_customer_id"], name: "index_m_odr_primes_on_p_customer_id"
|
||||||
end
|
end
|
||||||
@ -1743,6 +1745,10 @@ ActiveRecord::Schema.define(version: 2021_02_09_153303) do
|
|||||||
t.string "ac_particular_name"
|
t.string "ac_particular_name"
|
||||||
t.string "cc_particular_firstname"
|
t.string "cc_particular_firstname"
|
||||||
t.string "ac_particular_firstname"
|
t.string "ac_particular_firstname"
|
||||||
|
t.integer "link_token_count"
|
||||||
|
t.boolean "unlimited", default: false
|
||||||
|
t.string "import_name"
|
||||||
|
t.datetime "import_date"
|
||||||
t.index ["market_discount_id"], name: "index_p_customers_on_market_discount_id"
|
t.index ["market_discount_id"], name: "index_p_customers_on_market_discount_id"
|
||||||
t.index ["p_customer_cat_id"], name: "index_p_customers_on_p_customer_cat_id"
|
t.index ["p_customer_cat_id"], name: "index_p_customers_on_p_customer_cat_id"
|
||||||
t.index ["particular_id"], name: "index_p_customers_on_particular_id"
|
t.index ["particular_id"], name: "index_p_customers_on_particular_id"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user