educode_sales 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/educode_sales/businesses_controller.rb +6 -1
- data/app/controllers/educode_sales/follow_ups_controller.rb +1 -1
- data/app/controllers/educode_sales/sale_trends_controller.rb +116 -116
- data/app/helpers/educode_sales/follow_up_helper.rb +7 -0
- data/app/models/educode_sales/money_plan.rb +3 -3
- data/app/views/educode_sales/businesses/edit_plan.html.erb +4 -4
- data/app/views/educode_sales/businesses/export_records.json.jbuilder +1 -2
- data/app/views/educode_sales/businesses/get_export_data.json.jbuilder +1 -1
- data/app/views/educode_sales/businesses/index.html.erb +107 -91
- data/app/views/educode_sales/businesses/index.json.jbuilder +2 -2
- data/app/views/educode_sales/businesses/show_follow.html.erb +5 -4
- data/app/views/educode_sales/customers/show_follow.html.erb +1 -1
- data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -1
- data/app/views/educode_sales/follow_ups/money_plans.json.jbuilder +2 -4
- data/app/views/educode_sales/money_plans/index.html.erb +1 -1
- data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +8 -3
- data/app/views/educode_sales/operation_plans/_monthly.html.erb +2 -2
- data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +2 -2
- data/app/views/educode_sales/operation_plans/_weekly.html.erb +2 -2
- data/app/views/educode_sales/plans/_monthPlan.html.erb +8 -3
- data/app/views/educode_sales/plans/_monthly.html.erb +2 -2
- data/app/views/educode_sales/plans/_weekPlan.html.erb +2 -2
- data/app/views/educode_sales/plans/_weekly.html.erb +2 -2
- data/app/views/educode_sales/sale_reports/audit.html.erb +2 -0
- data/app/views/educode_sales/sale_reports/edit.html.erb +2 -0
- data/app/views/educode_sales/sale_reports/show.html.erb +2 -0
- data/app/views/educode_sales/sales/index.html.erb +7 -7
- data/app/views/educode_sales/teachers/show_follow.html.erb +1 -1
- data/lib/educode_sales/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 745a9b47b47d917186df80e64b85698ecb980c6348773520b8dc03ca0b2cd985
|
4
|
+
data.tar.gz: c2e13cdd710e59bc828a7af7c28f944a65a11bc4419225c89fbbb20fb830e13a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b530302422fffd437080d469f59851436f3d3667e52c05da0804c5ccf9ab13038563809918a94d5842622ac478beaf4c4c7e77842ced01e8eb43bcd486eadf3
|
7
|
+
data.tar.gz: f2476d1ad5479026a211698f4e0f3c49f9e060da98bbf319c99a25181457e158fc8df186ac00b0221e310a67142f2cacf06b9fd55cb1e9ee207590501e50bb43
|
@@ -152,11 +152,16 @@ module EducodeSales
|
|
152
152
|
JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
|
153
153
|
").where("educode_sales_follow_ups.stage_id in (?)", params[:q][:business_step].split(",").map(&:to_i))
|
154
154
|
end
|
155
|
-
if
|
155
|
+
if params[:q].present? && params[:q][:place_id].present?
|
156
156
|
@businesses = @businesses.joins("
|
157
157
|
JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
|
158
158
|
").where("educode_sales_follow_ups.place_id = ?", params[:q][:place_id])
|
159
159
|
end
|
160
|
+
if params[:q].present? && params[:q][:business_year].present?
|
161
|
+
@businesses = @businesses.joins("
|
162
|
+
JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
|
163
|
+
").where("educode_sales_follow_ups.year = ?", params[:q][:business_year])
|
164
|
+
end
|
160
165
|
|
161
166
|
if params[:q].present? && params[:q][:area].present?
|
162
167
|
p = EducodeSales::Common.find(params[:q][:area]).name
|
@@ -95,7 +95,7 @@ module EducodeSales
|
|
95
95
|
business = follow_up.business
|
96
96
|
if follow_up.soft_destroy(@current_admin.id)
|
97
97
|
if follow_up.id == business.last_follow_up_id
|
98
|
-
business.update(last_follow_up: business.follow_ups.last, return_money: MoneyPlan.where(clazz: '
|
98
|
+
business.update(last_follow_up: business.follow_ups.last, return_money: MoneyPlan.where(clazz: '实际回款', follow_up_id: business.follow_ups.last&.id).sum(:amount))
|
99
99
|
end
|
100
100
|
render_success
|
101
101
|
else
|
@@ -8,14 +8,14 @@ module EducodeSales
|
|
8
8
|
# authorize! :trends, EducodeSales::SaleTrend
|
9
9
|
@year = params[:year] ? params[:year] : Time.now.year
|
10
10
|
@years = ['全部'] + (1..(Time.now.year - 2014)).reverse_each.map { |d| 2014 + d }
|
11
|
-
if(@year == '全部')
|
11
|
+
if (@year == '全部')
|
12
12
|
x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
|
13
13
|
o = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id
|
14
14
|
@business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).sum(:total_amount).round(2)
|
15
|
-
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
15
|
+
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标', '已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
|
16
16
|
@goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).sum(:total_amount).round(2)
|
17
17
|
@actual_goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).sum(:actual_amount).round(2)
|
18
|
-
s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
18
|
+
s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
|
19
19
|
@service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", s_stage_ids).sum(:total_amount).round(2)
|
20
20
|
@actual_service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", s_stage_ids).sum(:actual_amount).round(2)
|
21
21
|
@return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).sum(:amount).round(2)
|
@@ -29,62 +29,63 @@ module EducodeSales
|
|
29
29
|
x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
|
30
30
|
o = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id
|
31
31
|
@sale_trend = SaleTrend.find_or_create_by(year: @year)
|
32
|
-
@business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.year = ?"
|
33
|
-
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
32
|
+
@business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
|
33
|
+
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标', '已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
|
34
34
|
@goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).sum(:total_amount).round(2)
|
35
35
|
@actual_goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).sum(:actual_amount).round(2)
|
36
|
-
s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
36
|
+
s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
|
37
37
|
@service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", s_stage_ids).sum(:total_amount).round(2)
|
38
38
|
@actual_service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", s_stage_ids).sum(:actual_amount).round(2)
|
39
39
|
@return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", year_time, year_over_time).sum(:amount).round(2)
|
40
40
|
a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id)
|
41
|
-
@a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).where("educode_sales_follow_ups.year = ?"
|
41
|
+
@a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
|
42
42
|
b = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::BTYPE)&.name).pluck(:id)
|
43
|
-
@b_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", b).where("educode_sales_follow_ups.year = ?"
|
43
|
+
@b_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", b).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
|
44
44
|
end
|
45
45
|
|
46
46
|
count_type = params[:count_type] || "actual_amount"
|
47
47
|
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
48
48
|
names = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
|
49
49
|
x_business_ids = []
|
50
|
-
default_dates = (30.day.ago.to_date..Date.today).map { |d| d.strftime("%Y-%W")}.uniq #默认时间范围
|
50
|
+
default_dates = (30.day.ago.to_date..Date.today).map { |d| d.strftime("%Y-%W") }.uniq #默认时间范围
|
51
51
|
Business.all.each do |d|
|
52
52
|
if d.last_follow_up&.clazz&.id == x
|
53
53
|
x_business_ids << d.id
|
54
54
|
end
|
55
55
|
end
|
56
|
-
colors = ['#44D7B6','#4CACFF','#F7B500','#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#8B00FF', 'rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)'
|
56
|
+
colors = ['#44D7B6', '#4CACFF', '#F7B500', '#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#8B00FF', 'rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)', 'rgba(255, 0, 250, 1)']
|
57
57
|
@follow_count_range = params[:follow_count_range] || "week"
|
58
58
|
@goal_count_range = params[:goal_count_range] || "month"
|
59
59
|
# 商机跟进数图表
|
60
|
-
@follow_count_data = week_follow_count_chart(default_dates,names,x_business_ids,colors)
|
60
|
+
@follow_count_data = week_follow_count_chart(default_dates, names, x_business_ids, colors)
|
61
61
|
if params[:follow_count_range].present?
|
62
62
|
case params[:follow_count_range]
|
63
|
-
when "week"
|
63
|
+
when "week" #按周
|
64
64
|
if params[:date_week].present?
|
65
65
|
date = params[:date_week].split(" - ")
|
66
66
|
dates = (date[0].to_date..date[1].to_date).map { |d|
|
67
|
-
d.strftime("%Y-%W")}.uniq
|
68
|
-
@follow_count_data = week_follow_count_chart(dates,names,x_business_ids,colors)
|
67
|
+
d.strftime("%Y-%W") }.uniq
|
68
|
+
@follow_count_data = week_follow_count_chart(dates, names, x_business_ids, colors)
|
69
69
|
end
|
70
|
-
when "month"
|
70
|
+
when "month" #按月
|
71
71
|
if params[:date_month].present?
|
72
72
|
# (Date.new(2020,12,1)..Date.new(2021,12,1)).map { |d| d.strftime("%Y-%m")}.uniq
|
73
73
|
date = params[:date_month].split(" - ")
|
74
|
-
dates = ((date[0]+"-01").to_date..(date[1]+"-01").to_date).map { |d| d.strftime("%Y-%m")}.uniq
|
75
|
-
@follow_count_data = month_follow_count_chart(dates,names,x_business_ids,colors)
|
74
|
+
dates = ((date[0] + "-01").to_date..(date[1] + "-01").to_date).map { |d| d.strftime("%Y-%m") }.uniq
|
75
|
+
@follow_count_data = month_follow_count_chart(dates, names, x_business_ids, colors)
|
76
76
|
end
|
77
|
-
when "year"
|
77
|
+
when "year" #按年
|
78
78
|
if params[:date_year].present?
|
79
79
|
date = params[:date_year].split(" - ")
|
80
80
|
dates = (date[0]..date[1]).to_a
|
81
|
-
@follow_count_data = year_follow_count_chart(dates,names,x_business_ids,colors)
|
81
|
+
@follow_count_data = year_follow_count_chart(dates, names, x_business_ids, colors)
|
82
82
|
end
|
83
|
-
else
|
83
|
+
else
|
84
|
+
#按天
|
84
85
|
if params[:date].present?
|
85
86
|
date = params[:date].split(" - ")
|
86
87
|
dates = (date[0].to_date..date[1].to_date).to_a
|
87
|
-
@follow_count_data = day_follow_count_chart(dates,names,x_business_ids,colors)
|
88
|
+
@follow_count_data = day_follow_count_chart(dates, names, x_business_ids, colors)
|
88
89
|
end
|
89
90
|
end
|
90
91
|
end
|
@@ -92,12 +93,12 @@ module EducodeSales
|
|
92
93
|
#商机区域分布图表
|
93
94
|
provinces = EducodeSales::Common.where(clazz: 'area').pluck(:name)
|
94
95
|
if params[:business_count_type] == 'money' || params[:business_count_type].blank?
|
95
|
-
@business_data =
|
96
|
+
@business_data = {
|
96
97
|
labels: provinces,
|
97
|
-
datasets:[
|
98
|
+
datasets: [
|
98
99
|
{
|
99
100
|
label: "商机总额",
|
100
|
-
data: provinces.map{|province|
|
101
|
+
data: provinces.map { |province|
|
101
102
|
if params[:business_type].blank?
|
102
103
|
Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ?", x).sum(:total_amount).round(2)
|
103
104
|
else
|
@@ -111,12 +112,12 @@ module EducodeSales
|
|
111
112
|
]
|
112
113
|
}
|
113
114
|
else
|
114
|
-
@business_data =
|
115
|
+
@business_data = {
|
115
116
|
labels: provinces,
|
116
|
-
datasets:[
|
117
|
+
datasets: [
|
117
118
|
{
|
118
119
|
label: "商机数量",
|
119
|
-
data: provinces.map{|province|
|
120
|
+
data: provinces.map { |province|
|
120
121
|
if params[:business_type].blank?
|
121
122
|
Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ?", x).count
|
122
123
|
else
|
@@ -131,8 +132,6 @@ module EducodeSales
|
|
131
132
|
}
|
132
133
|
end
|
133
134
|
|
134
|
-
|
135
|
-
|
136
135
|
# 销售人员跟进分析
|
137
136
|
begin_time = Time.now.at_beginning_of_year.to_s
|
138
137
|
end_time = Time.now.at_end_of_year.to_s
|
@@ -166,18 +165,16 @@ module EducodeSales
|
|
166
165
|
end_time = date[1] + "23:59:59"
|
167
166
|
end
|
168
167
|
end
|
169
|
-
100.times{p begin_time}
|
170
|
-
100.times{p end_time}
|
171
168
|
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
172
|
-
staff_names = Staff.joins(:user).where(job_type: common.id).map { |d| d.user.real_name}
|
169
|
+
staff_names = Staff.joins(:user).where(job_type: common.id).map { |d| d.user.real_name }
|
173
170
|
staff_ids = Staff.joins(:user).where(job_type: common.id).pluck(:id)
|
174
171
|
if params[:customer_count_type] == 'money' || params[:customer_count_type].blank?
|
175
|
-
@customer_data =
|
172
|
+
@customer_data = {
|
176
173
|
labels: staff_names,
|
177
|
-
datasets:[
|
174
|
+
datasets: [
|
178
175
|
{
|
179
176
|
label: "跟进客户数",
|
180
|
-
data: staff_ids.map{|staff_id|
|
177
|
+
data: staff_ids.map { |staff_id|
|
181
178
|
(EducodeSales::CustomerFollow.where(staff_id: staff_id).where("created_at >= ? AND created_at <= ?", begin_time, end_time).pluck(:school_id) + EducodeSales::Business.where(id: EducodeSales::FollowUp.where(staff_id: staff_id).where("created_at >= ? AND created_at <= ?", begin_time, end_time).pluck(:business_id).uniq).pluck(:school_id)).uniq.size
|
182
179
|
},
|
183
180
|
backgroundColor: colors[0],
|
@@ -187,12 +184,12 @@ module EducodeSales
|
|
187
184
|
]
|
188
185
|
}
|
189
186
|
else
|
190
|
-
@customer_data =
|
187
|
+
@customer_data = {
|
191
188
|
labels: staff_names,
|
192
|
-
datasets:[
|
189
|
+
datasets: [
|
193
190
|
{
|
194
191
|
label: "跟进客户次数",
|
195
|
-
data: staff_ids.map{|staff_id|
|
192
|
+
data: staff_ids.map { |staff_id|
|
196
193
|
EducodeSales::CustomerFollow.where(staff_id: staff_id).where("created_at >= ? AND created_at <= ?", begin_time, end_time).size + EducodeSales::FollowUp.where(staff_id: staff_id).where("created_at >= ? AND created_at <= ?", begin_time, end_time).size
|
197
194
|
},
|
198
195
|
backgroundColor: colors[0],
|
@@ -203,26 +200,25 @@ module EducodeSales
|
|
203
200
|
}
|
204
201
|
end
|
205
202
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
sale_names = ['已中标','已签单','已回款']
|
211
|
-
@goal_count_data = month_sale_chart(goal_default_dates,sale_names,colors,x,stage_ids,s_stage_ids,count_type)
|
203
|
+
# 销售额分析
|
204
|
+
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
|
205
|
+
sale_names = ['已中标', '已签单', '已回款']
|
206
|
+
@goal_count_data = month_sale_chart(goal_default_dates, sale_names, colors, x, stage_ids, s_stage_ids, count_type)
|
212
207
|
if params[:goal_count_range].present?
|
213
208
|
case params[:goal_count_range]
|
214
209
|
when "week"
|
215
|
-
when "month"
|
210
|
+
when "month" #按月
|
216
211
|
if params[:goal_date_month].present?
|
217
212
|
date = params[:goal_date_month].split(" - ")
|
218
|
-
dates = ((date[0]+"-01").to_date..(date[1]+"-01").to_date).map { |d| d.strftime("%Y-%m")}.uniq
|
219
|
-
@goal_count_data =
|
213
|
+
dates = ((date[0] + "-01").to_date..(date[1] + "-01").to_date).map { |d| d.strftime("%Y-%m") }.uniq
|
214
|
+
@goal_count_data = month_sale_chart(dates, sale_names, colors, x, stage_ids, s_stage_ids, count_type)
|
220
215
|
end
|
221
|
-
|
216
|
+
else
|
217
|
+
#按年
|
222
218
|
if params[:goal_date_year].present?
|
223
219
|
date = params[:goal_date_year].split(" - ")
|
224
220
|
dates = (date[0]..date[1]).to_a
|
225
|
-
@goal_count_data = year_sale_chart(dates,sale_names,colors,x,stage_ids,s_stage_ids,count_type)
|
221
|
+
@goal_count_data = year_sale_chart(dates, sale_names, colors, x, stage_ids, s_stage_ids, count_type)
|
226
222
|
end
|
227
223
|
end
|
228
224
|
end
|
@@ -247,140 +243,144 @@ module EducodeSales
|
|
247
243
|
params.permit(:chance_money, :ballot_money, :sign_money, :returned_money)
|
248
244
|
end
|
249
245
|
|
250
|
-
def day_follow_count_chart(dates,names,x_business_ids,colors)
|
246
|
+
def day_follow_count_chart(dates, names, x_business_ids, colors)
|
251
247
|
{
|
252
248
|
labels: dates,
|
253
|
-
datasets:names.map.with_index do |name,i|
|
249
|
+
datasets: names.map.with_index do |name, i|
|
254
250
|
{
|
255
251
|
# hidden: i < 3 ? false : true,
|
256
252
|
label: name[0],
|
257
|
-
data: dates.map{ |d| @follow_up = FollowUp.where(staff_id: name[1], created_at: d.beginning_of_day..d.end_of_day).where.not(business: x_business_ids).count },
|
253
|
+
data: dates.map { |d| @follow_up = FollowUp.where(staff_id: name[1], created_at: d.beginning_of_day..d.end_of_day).where.not(business: x_business_ids).count },
|
258
254
|
backgroundColor: "#fff",
|
259
|
-
pointBorderColor: colors[i%15+1],
|
260
|
-
borderColor: colors[i%15+1],
|
261
|
-
pointBackgroundColor: colors[i%15+1],
|
255
|
+
pointBorderColor: colors[i % 15 + 1],
|
256
|
+
borderColor: colors[i % 15 + 1],
|
257
|
+
pointBackgroundColor: colors[i % 15 + 1],
|
262
258
|
borderWidth: 2
|
263
259
|
}
|
264
260
|
end
|
265
261
|
}
|
266
262
|
end
|
267
|
-
|
263
|
+
|
264
|
+
def week_follow_count_chart(dates, names, x_business_ids, colors)
|
268
265
|
{
|
269
|
-
labels: dates.map{ |date|
|
266
|
+
labels: dates.map { |date|
|
270
267
|
d = date.split("-")
|
271
268
|
year = d[0].to_i
|
272
269
|
week = d[1].to_i
|
273
270
|
if week == 0
|
274
271
|
0
|
275
272
|
else
|
276
|
-
month = Date.commercial(year,week).strftime("%m月%d日")
|
277
|
-
day = Date.commercial(year,week,7).strftime("%m月%d日")
|
273
|
+
month = Date.commercial(year, week).strftime("%m月%d日")
|
274
|
+
day = Date.commercial(year, week, 7).strftime("%m月%d日")
|
278
275
|
date.to_s + "(#{month}-#{day})"
|
279
276
|
end
|
280
277
|
} - [0],
|
281
|
-
datasets:names.map.with_index do |name,i|
|
278
|
+
datasets: names.map.with_index do |name, i|
|
282
279
|
{
|
283
280
|
# hidden: i < 3 ? false : true,
|
284
281
|
label: name[0],
|
285
|
-
data: dates.map{ |d|
|
282
|
+
data: dates.map { |d|
|
286
283
|
d = d.split("-")
|
287
284
|
year = d[0].to_i
|
288
285
|
week = d[1].to_i
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
286
|
+
if week == 0
|
287
|
+
@follow_up = 999999
|
288
|
+
else
|
289
|
+
@follow_up = FollowUp.where(staff_id: name[1]).where("created_at >= ? AND created_at <= ?", Date.commercial(year, week).strftime("%Y-%m-%d"), Date.commercial(year, week, 7).strftime("%Y-%m-%d")).where.not(business: x_business_ids).count
|
290
|
+
end
|
291
|
+
} - [999999],
|
295
292
|
backgroundColor: "#fff",
|
296
|
-
pointBorderColor: colors[i%15+1],
|
297
|
-
borderColor: colors[i%15+1],
|
298
|
-
pointBackgroundColor: colors[i%15+1],
|
293
|
+
pointBorderColor: colors[i % 15 + 1],
|
294
|
+
borderColor: colors[i % 15 + 1],
|
295
|
+
pointBackgroundColor: colors[i % 15 + 1],
|
299
296
|
borderWidth: 2
|
300
297
|
}
|
301
298
|
end
|
302
299
|
}
|
303
300
|
end
|
304
|
-
|
301
|
+
|
302
|
+
def month_follow_count_chart(dates, names, x_business_ids, colors)
|
305
303
|
{
|
306
304
|
labels: dates,
|
307
|
-
datasets:names.map.with_index do |name,i|
|
305
|
+
datasets: names.map.with_index do |name, i|
|
308
306
|
{
|
309
307
|
# hidden: i < 3 ? false : true,
|
310
308
|
label: name[0],
|
311
|
-
data: dates.map { |d| @follow_up = FollowUp.where(
|
309
|
+
data: dates.map { |d| @follow_up = FollowUp.where(staff_id: name[1]).where("created_at >= ? AND created_at <= ?", "#{d}-01", "#{d}-31").where.not(business: x_business_ids).count },
|
312
310
|
backgroundColor: "#fff",
|
313
|
-
pointBorderColor: colors[i%15+1],
|
314
|
-
borderColor: colors[i%15+1],
|
315
|
-
pointBackgroundColor: colors[i%15+1],
|
311
|
+
pointBorderColor: colors[i % 15 + 1],
|
312
|
+
borderColor: colors[i % 15 + 1],
|
313
|
+
pointBackgroundColor: colors[i % 15 + 1],
|
316
314
|
borderWidth: 2,
|
317
315
|
}
|
318
316
|
end
|
319
317
|
}
|
320
318
|
end
|
321
|
-
|
319
|
+
|
320
|
+
def year_follow_count_chart(dates, names, x_business_ids, colors)
|
322
321
|
{
|
323
322
|
labels: dates,
|
324
|
-
datasets:names.map.with_index do |name,i|
|
323
|
+
datasets: names.map.with_index do |name, i|
|
325
324
|
{
|
326
325
|
# hidden: i < 3 ? false : true,
|
327
326
|
label: name[0],
|
328
|
-
data: dates.map { |d| @follow_up = FollowUp.where(
|
327
|
+
data: dates.map { |d| @follow_up = FollowUp.where(staff_id: name[1]).where("created_at >= ? AND created_at <= ?", "#{d}-01-01", "#{d}-12-31").where.not(business: x_business_ids).count },
|
329
328
|
backgroundColor: "#fff",
|
330
|
-
pointBorderColor: colors[i%15+1],
|
331
|
-
borderColor: colors[i%15+1],
|
332
|
-
pointBackgroundColor: colors[i%15+1],
|
329
|
+
pointBorderColor: colors[i % 15 + 1],
|
330
|
+
borderColor: colors[i % 15 + 1],
|
331
|
+
pointBackgroundColor: colors[i % 15 + 1],
|
333
332
|
borderWidth: 2
|
334
333
|
}
|
335
334
|
end
|
336
335
|
}
|
337
336
|
end
|
338
337
|
|
339
|
-
def month_sale_chart(dates,names,colors,x,stage_ids,s_stage_ids,count_type)
|
338
|
+
def month_sale_chart(dates, names, colors, x, stage_ids, s_stage_ids, count_type)
|
340
339
|
{
|
341
340
|
labels: dates,
|
342
|
-
datasets: names.map.with_index do |name,i|
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
341
|
+
datasets: names.map.with_index do |name, i|
|
342
|
+
{
|
343
|
+
label: name,
|
344
|
+
data: dates.map { |d|
|
345
|
+
case i
|
346
|
+
when 0
|
347
|
+
Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{d}-01", "#{d}-31", stage_ids).sum(count_type).round(2)
|
348
|
+
when 1
|
349
|
+
Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{d}-01", "#{d}-31", s_stage_ids).sum(count_type).round(2)
|
350
|
+
else
|
351
|
+
Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", "#{d}-01", "#{d}-31").sum(:amount).round(2)
|
352
|
+
end
|
353
|
+
},
|
354
|
+
backgroundColor: colors[i],
|
355
|
+
borderColor: colors[i],
|
356
|
+
borderWidth: 1
|
357
|
+
}
|
358
358
|
end
|
359
359
|
}
|
360
360
|
end
|
361
361
|
|
362
|
-
def year_sale_chart(dates,names,colors,x,stage_ids,s_stage_ids,count_type)
|
362
|
+
def year_sale_chart(dates, names, colors, x, stage_ids, s_stage_ids, count_type)
|
363
363
|
{
|
364
364
|
labels: dates,
|
365
|
-
datasets:names.map.with_index do |name,i|
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
365
|
+
datasets: names.map.with_index do |name, i|
|
366
|
+
{
|
367
|
+
label: name,
|
368
|
+
data: dates.map { |d|
|
369
|
+
case i
|
370
|
+
when 0
|
371
|
+
Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{d}-01-01", "#{d}-12-31", stage_ids).sum(count_type).round(2)
|
372
|
+
when 1
|
373
|
+
Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{d}-01-01", "#{d}-12-31", s_stage_ids).sum(count_type).round(2)
|
374
|
+
else
|
375
|
+
Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", "#{d}-01-01", "#{d}-12-31").sum(:amount).round(2)
|
376
|
+
end },
|
377
|
+
backgroundColor: colors[i],
|
378
|
+
borderColor: colors[i],
|
379
|
+
borderWidth: 1
|
380
|
+
}
|
380
381
|
end
|
381
382
|
}
|
382
383
|
end
|
383
384
|
|
384
|
-
|
385
385
|
end
|
386
386
|
end
|
@@ -3,7 +3,7 @@ module EducodeSales
|
|
3
3
|
belongs_to :staff
|
4
4
|
belongs_to :follow_up, counter_cache: true
|
5
5
|
|
6
|
-
enum clazz: ['
|
6
|
+
enum clazz: ['计划回款', '实际回款']
|
7
7
|
|
8
8
|
after_save :update_return_money
|
9
9
|
after_destroy :update_return_money
|
@@ -13,9 +13,9 @@ module EducodeSales
|
|
13
13
|
|
14
14
|
def update_return_money
|
15
15
|
if follow_up.business.last_follow_up_id == self.follow_up_id
|
16
|
-
follow_up.business.update(return_money: MoneyPlan.where(clazz: '
|
16
|
+
follow_up.business.update(return_money: MoneyPlan.where(clazz: '实际回款', follow_up_id: self.follow_up_id).sum(:amount))
|
17
17
|
else
|
18
|
-
follow_up.update(return_money: follow_up.money_plans.where(clazz: '
|
18
|
+
follow_up.update(return_money: follow_up.money_plans.where(clazz: '实际回款').sum(:amount))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<div class="layui-input-inline" style="width: 300px;" id="professional_title_div">
|
25
25
|
<label class="layui-form-label required">状态</label>
|
26
26
|
<div class="layui-input-block">
|
27
|
-
<%= select_tag "clazz", options_for_select(['
|
27
|
+
<%= select_tag "clazz", options_for_select(['计划回款', '实际回款']), class: 'required' %>
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
</div>
|
@@ -43,7 +43,7 @@
|
|
43
43
|
<script type="text/html" id="return_money_select">
|
44
44
|
<div class="layui-input-block table-select">
|
45
45
|
<select name="clazz" lay-filter="return_money_select">
|
46
|
-
{{# layui.each(['
|
46
|
+
{{# layui.each(['计划回款', '实际回款'], function(i, data) { }}
|
47
47
|
{{# if (data == d.clazz) { }}
|
48
48
|
<option value="{{data}}" selected="{{d.clazz}}">{{data}}</option>
|
49
49
|
{{# } else { }}
|
@@ -90,8 +90,8 @@
|
|
90
90
|
layer.alert(res.msg)
|
91
91
|
} else {
|
92
92
|
// layer.close(parent.plan_index);
|
93
|
-
|
94
|
-
|
93
|
+
table.reload('sale_plan_follow_table');
|
94
|
+
table.reload('businesses_table');
|
95
95
|
table.reload('return_money_list');
|
96
96
|
}
|
97
97
|
})
|
@@ -18,7 +18,7 @@ json.data do
|
|
18
18
|
json.actual_amount d.last_follow_up&.actual_amount
|
19
19
|
json.return_money d.return_money
|
20
20
|
json.wait_return_money d.wait_return_money.to_i.round(2)
|
21
|
-
json.return_money_days d.last_follow_up&.reception_at.present? && d.last_follow_up.money_plans.where(clazz: '
|
21
|
+
json.return_money_days d.last_follow_up&.reception_at.present? && d.last_follow_up.money_plans.where(clazz: '实际回款').present? ? (d.last_follow_up.money_plans.where(clazz: '实际回款').order(created_at: :asc).first.date_at.to_s(:date).to_date - d.last_follow_up&.reception_at).to_i : ''
|
22
22
|
json.place d.last_follow_up&.place&.name
|
23
23
|
json.last_follow_person d.last_follow_up.present? ? d.last_follow_up.staff.user.real_name : EducodeSales::Staff.find(d.staff_id).user.real_name
|
24
24
|
json.source d.source
|
@@ -57,6 +57,12 @@
|
|
57
57
|
<%= select_tag "area", options_for_select(EducodeSales::Common.where(clazz: 'area').pluck(:name, :id)), { include_blank: true } %>
|
58
58
|
</div>
|
59
59
|
</div>
|
60
|
+
<div class="layui-inline show_item" style="display:none;">
|
61
|
+
<label class="layui-form-label">所属年度</label>
|
62
|
+
<div class="layui-input-inline">
|
63
|
+
<%= select_tag "business_year", options_for_select((2015..Time.now.year).to_a.reverse, params[:business_year]), { include_blank: true } %>
|
64
|
+
</div>
|
65
|
+
</div>
|
60
66
|
<div class="layui-inline show_item" style="display:none;">
|
61
67
|
<label class="layui-form-label">创建时间</label>
|
62
68
|
<div class="layui-input-inline">
|
@@ -89,7 +95,7 @@
|
|
89
95
|
<div class="layui-btn-container">
|
90
96
|
<span class="table-label">商机列表</span>
|
91
97
|
<% if can?(:export_business, EducodeSales::Business) %>
|
92
|
-
<button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm data-count-edit export_more-btn pull-right" style="color: #0000FF;" data-name="export" data-id="export">导出<i class="layui-icon layui-icon-down
|
98
|
+
<button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm data-count-edit export_more-btn pull-right" style="color: #0000FF;" data-name="export" data-id="export">导出<i class="layui-icon layui-icon-down layui-nav-more" style="font-size: 12px"></i></button>
|
93
99
|
<% end %>
|
94
100
|
<% if can? :create, EducodeSales::Business %>
|
95
101
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加商机</button>
|
@@ -142,35 +148,45 @@
|
|
142
148
|
<a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
|
143
149
|
</script>
|
144
150
|
<script type="text/html" id="school_name">
|
145
|
-
<a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school
|
151
|
+
<a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school
|
152
|
+
}}</a>
|
146
153
|
</script>
|
147
154
|
|
148
155
|
|
149
156
|
<script>
|
150
157
|
layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate', 'dropdown'], function () {
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
158
|
+
var $ = layui.jquery,
|
159
|
+
form = layui.form,
|
160
|
+
request = layui.request,
|
161
|
+
miniPage = layui.miniPage,
|
162
|
+
dropdown = layui.dropdown,
|
163
|
+
laydate = layui.laydate;
|
164
|
+
|
165
|
+
laydate.render({
|
166
|
+
elem: '#date',
|
167
|
+
range: true
|
168
|
+
});
|
169
|
+
laydate.render({
|
170
|
+
elem: '#invitation_at',
|
171
|
+
range: true
|
172
|
+
});
|
166
173
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
+
// function hn() {
|
175
|
+
// $("#search_bt").trigger("click");
|
176
|
+
// }
|
177
|
+
//
|
178
|
+
// $(document).ready(function () {
|
179
|
+
// window.onload = hn;
|
180
|
+
// });
|
181
|
+
|
182
|
+
var is_show =
|
183
|
+
<%=params[:name].present? || params[:clazz_id].present? || params[:place_id].present? || params[:school].present? %>
|
184
|
+
if (is_show) {
|
185
|
+
$('.follows_li').removeClass('layui-this');
|
186
|
+
$('.follows_div').removeClass('layui-show');
|
187
|
+
$('.businesses_list_li').addClass('layui-this');
|
188
|
+
$('.businesses_list_div').addClass('layui-show');
|
189
|
+
}
|
174
190
|
|
175
191
|
var business_type_list = xmSelect.render({
|
176
192
|
el: '#business_type',
|
@@ -224,62 +240,68 @@
|
|
224
240
|
})
|
225
241
|
}
|
226
242
|
})
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
243
|
+
index_place_list.setValue(gon.place)
|
244
|
+
|
245
|
+
|
246
|
+
var data = form.val("search_form");
|
247
|
+
data.business_type = <%=params[:clazz_id] %>
|
248
|
+
console.log(data);
|
249
|
+
|
250
|
+
table = layui.table;
|
251
|
+
var business_table = table.render({
|
252
|
+
elem: '#businesses_table',
|
253
|
+
url: '/missions/businesses',
|
254
|
+
where: {q: data},
|
255
|
+
defaultToolbar: ['filter'],
|
256
|
+
toolbar: '#bussinessBar',
|
257
|
+
title: '商机数据表',
|
258
|
+
totalRow: true,//开启合并行
|
259
|
+
cols: [
|
260
|
+
[
|
261
|
+
{
|
262
|
+
field: 'id',
|
263
|
+
width: 60,
|
264
|
+
title: '序号', type: 'numbers',
|
265
|
+
totalRowText: '合计',
|
266
|
+
fixed: "left"
|
267
|
+
},
|
268
|
+
{
|
269
|
+
field: 'name',
|
270
|
+
width: 170,
|
271
|
+
title: '商机名称',
|
272
|
+
templet: '<div><span title="{{d.name}}">{{d.name}}</span></div>',
|
273
|
+
fixed: 'left'
|
274
|
+
},
|
275
|
+
{
|
276
|
+
field: 'school',
|
277
|
+
width: 150,
|
278
|
+
title: '单位',
|
279
|
+
templet: '#school_name'
|
280
|
+
},
|
281
|
+
{
|
282
|
+
field: 'department',
|
283
|
+
width: 150,
|
284
|
+
title: '部门',
|
285
|
+
templet: '<div><span title="{{d.department}}">{{d.department}}</span></div>'
|
286
|
+
},
|
287
|
+
{
|
288
|
+
field: 'follow_ups_count',
|
289
|
+
title: '跟进',
|
290
|
+
width: 60,
|
291
|
+
templet: '#show_follow',
|
292
|
+
totalRow: true,
|
293
|
+
},
|
294
|
+
// {
|
295
|
+
// field: 'teachers_count',
|
296
|
+
// width: 100,
|
297
|
+
// title: '关键人',
|
298
|
+
// templet: '#show_keys'
|
299
|
+
// },
|
300
|
+
{
|
301
|
+
field: 'clazz',
|
302
|
+
width: 80,
|
303
|
+
title: '类型',
|
304
|
+
templet: '<div><span title="{{d.clazz}}">{{d.clazz}}</span></div>'
|
283
305
|
},
|
284
306
|
{
|
285
307
|
field: 'stage',
|
@@ -639,12 +661,6 @@
|
|
639
661
|
});
|
640
662
|
}
|
641
663
|
|
642
|
-
function hn(){
|
643
|
-
$("#search_bt").trigger("click");
|
644
|
-
}
|
645
|
-
$(document).ready(function(){
|
646
|
-
window.onload=hn;
|
647
|
-
});
|
648
664
|
|
649
665
|
|
650
666
|
var sort = {}, search = {};
|
@@ -699,11 +715,11 @@
|
|
699
715
|
return false;
|
700
716
|
});
|
701
717
|
form.on('submit(reset_business_search)', function (data) {
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
718
|
+
var field = data.field;
|
719
|
+
form.val('search_form', {
|
720
|
+
name: '', department: '', staff_id: '', business_type: '', business_step: '',
|
721
|
+
place_id: '', date: '', area: '', invitation_at: '', business_year: ''
|
722
|
+
})
|
707
723
|
business_type_list.setValue([])
|
708
724
|
business_step_list.setValue([])
|
709
725
|
index_place_list.setValue([])
|
@@ -21,8 +21,8 @@ json.data do
|
|
21
21
|
json.total_amount d.last_follow_up&.total_amount
|
22
22
|
json.actual_amount d.last_follow_up&.actual_amount
|
23
23
|
json.return_money d.return_money
|
24
|
-
json.wait_return_money d.wait_return_money.
|
25
|
-
json.return_money_days d.last_follow_up&.reception_at.present? && d.last_follow_up.money_plans.where(clazz: '
|
24
|
+
json.wait_return_money d.wait_return_money.to_f.round(2)
|
25
|
+
json.return_money_days d.last_follow_up&.reception_at.present? && d.last_follow_up.money_plans.where(clazz: '实际回款').present? ? (d.last_follow_up.money_plans.where(clazz: '实际回款').order(created_at: :asc).first.date_at.to_s(:date).to_date - d.last_follow_up&.reception_at).to_i : ''
|
26
26
|
json.place d.last_follow_up&.place&.name
|
27
27
|
json.last_follow_person d.last_follow_up.present? ? d.last_follow_up.staff.user.real_name : EducodeSales::Staff.find(d.staff_id).user.real_name
|
28
28
|
json.source d.source
|
@@ -75,7 +75,7 @@
|
|
75
75
|
<script type="text/html" id="edit_plan">
|
76
76
|
<a href="javascript:void(0);" lay-event="edit_plan" class="layui-table-link">{{ d.money_plans_count }}</a>
|
77
77
|
</script>
|
78
|
-
|
78
|
+
<!--计划回款计划列表-->
|
79
79
|
<script type="text/html" id="unfinish_table_tabar">
|
80
80
|
<div class="layui-btn-container">
|
81
81
|
<span class="table-label">跟进计划列表</span>
|
@@ -355,10 +355,11 @@
|
|
355
355
|
layer.full(keyindex);
|
356
356
|
});
|
357
357
|
} else if (obj.event === 'edit_plan') {
|
358
|
-
content = miniPage.getHrefContent('/missions/businesses/edit_plan');
|
359
|
-
openWH = miniPage.getOpenWidthHeight();
|
360
358
|
is_latest = obj.data.is_latest
|
361
359
|
flag = obj.data.flag
|
360
|
+
follow_up_id = obj.data.id
|
361
|
+
content = miniPage.getHrefContent('/missions/businesses/edit_plan');
|
362
|
+
openWH = miniPage.getOpenWidthHeight();
|
362
363
|
plan_index = layer.open({
|
363
364
|
title: '回款计划',
|
364
365
|
type: 1,
|
@@ -379,7 +380,7 @@
|
|
379
380
|
}
|
380
381
|
});
|
381
382
|
|
382
|
-
//
|
383
|
+
// 计划回款计划
|
383
384
|
table.render({
|
384
385
|
elem: '#unfinish_table',
|
385
386
|
url: '/missions/businesses/' + parent.business_id + "/unfinish_plans",
|
@@ -12,7 +12,7 @@ json.data do
|
|
12
12
|
json.business d.business.name
|
13
13
|
json.business_id d.business.id
|
14
14
|
teacher_ids = d.key_person.pluck(:teacher_id)
|
15
|
-
json.key_people
|
15
|
+
json.key_people key_people(teacher_ids)
|
16
16
|
|
17
17
|
end
|
18
18
|
end
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<div class="layui-inline">
|
23
23
|
<label class="layui-form-label">状态</label>
|
24
24
|
<div class="layui-input-inline">
|
25
|
-
<%= select_tag "clazz", options_for_select(['
|
25
|
+
<%= select_tag "clazz", options_for_select(['实际回款','计划回款']), { include_blank: true } %>
|
26
26
|
</div>
|
27
27
|
</div>
|
28
28
|
<div class="layui-inline">
|
@@ -89,12 +89,12 @@
|
|
89
89
|
field: 'id',
|
90
90
|
width: 60,
|
91
91
|
title:'序号',type: 'numbers',
|
92
|
-
totalRowText:
|
92
|
+
totalRowText:'合计',fixed: 'left'
|
93
93
|
},
|
94
94
|
{
|
95
95
|
field: 'staff',
|
96
96
|
width: 90,
|
97
|
-
title: '姓名'
|
97
|
+
title: '姓名',fixed: 'left'
|
98
98
|
},
|
99
99
|
{
|
100
100
|
field: 'teacher_name',
|
@@ -289,4 +289,9 @@
|
|
289
289
|
});
|
290
290
|
|
291
291
|
});
|
292
|
-
</script>
|
292
|
+
</script>
|
293
|
+
<style>
|
294
|
+
.layui-table-fixed .layui-table-body {
|
295
|
+
height: auto!important;
|
296
|
+
}
|
297
|
+
</style>
|
@@ -90,12 +90,12 @@
|
|
90
90
|
field: 'id',
|
91
91
|
width: 60,
|
92
92
|
title:'序号',type: 'numbers',
|
93
|
-
totalRowText:
|
93
|
+
totalRowText:'合计',fixed: 'left'
|
94
94
|
},
|
95
95
|
{
|
96
96
|
field: 'staff',
|
97
97
|
width: 80,
|
98
|
-
title: '姓名'
|
98
|
+
title: '姓名',fixed: 'left'
|
99
99
|
},
|
100
100
|
{
|
101
101
|
field: 'teacher_name',
|
@@ -88,12 +88,12 @@
|
|
88
88
|
field: 'id',
|
89
89
|
width: 60,
|
90
90
|
title:'序号',type: 'numbers',
|
91
|
-
totalRowText:
|
91
|
+
totalRowText:'合计',fixed: 'left'
|
92
92
|
},
|
93
93
|
{
|
94
94
|
field: 'staff',
|
95
95
|
width: 90,
|
96
|
-
title: '姓名'
|
96
|
+
title: '姓名',fixed: 'left'
|
97
97
|
},
|
98
98
|
{
|
99
99
|
field: 'business_name',
|
@@ -277,4 +277,9 @@
|
|
277
277
|
});
|
278
278
|
|
279
279
|
});
|
280
|
-
</script>
|
280
|
+
</script>
|
281
|
+
<style>
|
282
|
+
.layui-table-fixed .layui-table-body {
|
283
|
+
height: auto!important;
|
284
|
+
}
|
285
|
+
</style>
|
@@ -88,12 +88,12 @@
|
|
88
88
|
field: 'id',
|
89
89
|
width: 60,
|
90
90
|
title:'序号',type: 'numbers',
|
91
|
-
totalRowText: '合计'
|
91
|
+
totalRowText: '合计',fixed: 'left'
|
92
92
|
},
|
93
93
|
{
|
94
94
|
field: 'staff',
|
95
95
|
width: 90,
|
96
|
-
title: '姓名'
|
96
|
+
title: '姓名',fixed: 'left'
|
97
97
|
},
|
98
98
|
{
|
99
99
|
field: 'business_name',
|
@@ -151,6 +151,8 @@
|
|
151
151
|
table.on('tool(showWeeklyTable)', function (obj) {
|
152
152
|
var data = obj.data;
|
153
153
|
if (obj.event === 'show_follow') {
|
154
|
+
business_id = obj.data.business_id
|
155
|
+
business_name = data.business_name
|
154
156
|
id = data.business_id
|
155
157
|
content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + data.business_id);
|
156
158
|
openWH = miniPage.getOpenWidthHeight();
|
@@ -257,6 +257,8 @@
|
|
257
257
|
});
|
258
258
|
return false;
|
259
259
|
} else if (obj.event === 'show_follow') {
|
260
|
+
business_id = obj.data.business_id
|
261
|
+
business_name = data.business_name
|
260
262
|
id = data.business_id
|
261
263
|
content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + data.business_id);
|
262
264
|
openWH = miniPage.getOpenWidthHeight();
|
@@ -102,6 +102,8 @@
|
|
102
102
|
table.on('tool(showWeeklyTable)', function (obj) {
|
103
103
|
var data = obj.data;
|
104
104
|
if (obj.event === 'show_follow') {
|
105
|
+
business_id = obj.data.business_id
|
106
|
+
business_name = data.business_name
|
105
107
|
id = data.business_id
|
106
108
|
content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + data.business_id);
|
107
109
|
openWH = miniPage.getOpenWidthHeight();
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<span style="float: right;padding-right: 10px">年度</span>
|
8
8
|
</form>
|
9
9
|
<hr>
|
10
|
-
<table class="layui-hide" id="table" lay-filter="table"
|
10
|
+
<table class="layui-hide" id="table" lay-filter="table"></table>
|
11
11
|
</div>
|
12
12
|
<script type="text/html" id="toolbarDemo">
|
13
13
|
<div class="layui-btn-container">
|
@@ -16,32 +16,32 @@
|
|
16
16
|
</script>
|
17
17
|
<script type="text/html" id="business_a">
|
18
18
|
<div class="layui-text">
|
19
|
-
|
19
|
+
<a href="/missions/businesses?clazz_id={{d.a_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_a}}</a>
|
20
20
|
</div>
|
21
21
|
</script>
|
22
22
|
<script type="text/html" id="business_b">
|
23
23
|
<div class="layui-text">
|
24
|
-
<a href="/missions/businesses?clazz_id={{d.b_clazz_id}}&staff_id={{d.id}}">{{d.business_b}}</a>
|
24
|
+
<a href="/missions/businesses?clazz_id={{d.b_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_b}}</a>
|
25
25
|
</div>
|
26
26
|
</script>
|
27
27
|
<script type="text/html" id="business_c">
|
28
28
|
<div class="layui-text">
|
29
|
-
<a href="/missions/businesses?clazz_id={{d.c_clazz_id}}&staff_id={{d.id}}">{{d.business_c}}</a>
|
29
|
+
<a href="/missions/businesses?clazz_id={{d.c_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_c}}</a>
|
30
30
|
</div>
|
31
31
|
</script>
|
32
32
|
<script type="text/html" id="business_d">
|
33
33
|
<div class="layui-text">
|
34
|
-
<a href="/missions/businesses?clazz_id={{d.d_clazz_id}}&staff_id={{d.id}}">{{d.business_d}}</a>
|
34
|
+
<a href="/missions/businesses?clazz_id={{d.d_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_d}}</a>
|
35
35
|
</div>
|
36
36
|
</script>
|
37
37
|
<script type="text/html" id="business_e">
|
38
38
|
<div class="layui-text">
|
39
|
-
<a href="/missions/businesses?clazz_id={{d.e_clazz_id}}&staff_id={{d.id}}">{{d.business_e}}</a>
|
39
|
+
<a href="/missions/businesses?clazz_id={{d.e_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_e}}</a>
|
40
40
|
</div>
|
41
41
|
</script>
|
42
42
|
<script type="text/html" id="business_o">
|
43
43
|
<div class="layui-text">
|
44
|
-
<a href="/missions/businesses?clazz_id={{d.o_clazz_id}}&staff_id={{d.id}}">{{d.business_o}}</a>
|
44
|
+
<a href="/missions/businesses?clazz_id={{d.o_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_o}}</a>
|
45
45
|
</div>
|
46
46
|
</script>
|
47
47
|
<script type="text/html" id="school_count">
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: educode_sales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- app/helpers/educode_sales/activities_helper.rb
|
166
166
|
- app/helpers/educode_sales/application_helper.rb
|
167
167
|
- app/helpers/educode_sales/business_helper.rb
|
168
|
+
- app/helpers/educode_sales/follow_up_helper.rb
|
168
169
|
- app/helpers/educode_sales/home_helper.rb
|
169
170
|
- app/helpers/educode_sales/sessions_helper.rb
|
170
171
|
- app/helpers/educode_sales/teachers_helper.rb
|