Class: EducodeSales::ProjectChartsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/educode_sales/project_charts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_admin, #authenticate_request, #current_user, #filter, #is_commissioner_above?, #paginate, #render_failure, #render_success, #subject_members, #subject_staffs, #subject_url

Methods included from ApplicationHelper

#add_businesses_score, #base_url, #collection_amount_score, #completion_rate, #current?, #disk_filename, #get_businesses_chart, #handled_data, #handled_time_data, #handled_time_data_accurate, #relative_path, #signed_amount_score, #storage_path, #url_to_avatar, #visits_score

Instance Method Details

#sales_analysisObject

销售额分析



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/educode_sales/project_charts_controller.rb', line 10

def sales_analysis
  respond_to do |format|
    format.html do
    end
    format.js do
      x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
      count_type = params[:count_type] || "actual_amount"
      stage_ids = Common.where(clazz: '商机阶段', name: ['已中标', '已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
      s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
      @goal_count_range = params[:goal_count_range] || "month"

      goal_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y-%m") }.uniq
      sale_names = ['已中标', '已签单', '已回款']
      @goal_count_data = month_sale_chart(goal_default_dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, ["#{Time.now.year}-01", "#{Time.now.year}-#{Time.now.month}"])
    end
  end
end

authorize_resource class: false



7
8
# File 'app/controllers/educode_sales/project_charts_controller.rb', line 7

def trends
end