educode_sales 0.8.6 → 0.9.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f598f6270d0f4b4c89a91f53fbbe0cbabfae9ebd812237c71d4a0b9e9e121638
4
- data.tar.gz: 2b3d7fa2b258f2128358d1ebecfbb97f88a7c0eefb3b5e1daf5677891afc0a92
3
+ metadata.gz: 6ec7b94dd1cfa92b3cc2803dae9f3b48ac530c772862959ececa2d575d7f305c
4
+ data.tar.gz: 766ea79f255bfa56c0f28febb04b8363da6628522a30577e9e57183959bea092
5
5
  SHA512:
6
- metadata.gz: 7671cd5fd92f1d5486b2d38ba893f42eb81ca4974d9a697493b008692e4b683a079a24fc7baabf791014e546cf7ee0a9ffe36836bf3620ee51fac116b6ec5d38
7
- data.tar.gz: 953e60619120b2c41bf880c92a6ea5f2e7389c833dbee0d38e3a791565c490ed3a81b1962985adc0e85e3a6c58c1a74249e69d7ec29a1ae01b02fc235e237792
6
+ metadata.gz: 4133a2b8147539c3e1d92e28a76bc08b1ec05de4c3a9e1f07d95cadab4d65c28af905b558c48254c7fc4a8bd2f70e9cc4714198f5867fe7e2614b946fac092e6
7
+ data.tar.gz: 2d868ca452990a02abeaa9a3c0e816baf1811eff439ce82a124f89458dce70c3e8ea2a05a682dd6e1fb54c155719593971f58f38cf0c210554cfcce4ded6f564
@@ -110,16 +110,11 @@ module EducodeSales
110
110
  end
111
111
  end
112
112
 
113
-
114
-
115
-
116
113
  # 导出数据
117
114
  def get_export_data
118
115
  p 'get_export_data'
119
116
  end
120
117
 
121
-
122
-
123
118
  # 考核完成情况
124
119
  def progress
125
120
  p 'progress'
@@ -128,11 +123,25 @@ module EducodeSales
128
123
 
129
124
 
130
125
  def progress_or_get_export_data
126
+ if @current_admin.is_admin?
127
+ @assessments = AssessmentsSetting.all
128
+ else
129
+ level = @current_admin.role.role_areas.find_by(clazz: '绩效考核').level
130
+ case level
131
+ when '自己'
132
+ @assessments = AssessmentsSetting.where(staff_id: @current_admin.id)
133
+ when '区域'
134
+ @staffs = EducodeSales::Staff.joins(:areas).where("educode_sales_commons.id in (?)", @current_admin.areas.pluck(:id)).distinct
135
+ @assessments = EducodeSales::AssessmentsSetting.where(staff_id: @staffs.select(:id))
136
+ else
137
+ @assessments = AssessmentsSetting.all
138
+ end
139
+ end
131
140
  # common = Common.find_by(clazz: 'staff_type', name: '销售')
132
141
  # @staff_ids = Staff.joins(:user).where(job_type: common.id).pluck(:id)
133
142
  @assessment_id = params[:q].present? && params[:q][:assessment_id].present? ? params[:q][:assessment_id]:'1'
134
143
  @assessment_year = params[:q].present? && params[:q][:assessment_year].present? ? params[:q][:assessment_year] : Time.now.year
135
- @assessments =AssessmentsSetting.where(assessment: @assessment_id)
144
+ @assessments =@assessments.where(assessment: @assessment_id)
136
145
  .where("assessment_year >= ? and assessment_year <= ?", "#{@assessment_year}-01-01 00:00:00".to_date, "#{@assessment_year}-12-31 23:59:00".to_date)
137
146
  .order("created_at desc")
138
147
  if @assessments.present?
@@ -50,6 +50,13 @@ module EducodeSales
50
50
  JOIN schools ON departments.school_id = schools.id
51
51
  ").where("province = ?", p)
52
52
  end
53
+
54
+ if params[:q].present? && params[:q][:description].present?
55
+ @follow_ups = @follow_ups.joins(:business).joins("JOIN educode_sales_businesses ON educode_sales_businesses.id = educode_sales_follow_ups.business_id
56
+ ").where("educode_sales_follow_ups.description LIKE ?" ,"%#{params[:q][:description]}%")
57
+
58
+ end
59
+
53
60
  if params[:sort].present? && params[:sort][:field]
54
61
  @follow_ups = @follow_ups.order("#{params[:sort][:field]} #{params[:sort][:order]}")
55
62
  else
@@ -4,59 +4,59 @@ json.data do
4
4
  # 目标任务
5
5
  json.name assessment.staff.user.real_name
6
6
  json.id assessment.id
7
- json.annual assessment.annual.to_f
8
- json.first_quarter assessment.first_quarter.to_f
9
- json.january assessment.january.to_f
10
- json.february assessment.february.to_f
11
- json.march assessment.march.to_f
12
- json.second_quarter assessment.second_quarter.to_f
13
- json.april assessment.april.to_f
14
- json.may assessment.may.to_f
15
- json.june assessment.june.to_f
16
- json.third_quarter assessment.third_quarter.to_f
17
- json.july assessment.july.to_f
18
- json.august assessment.august.to_f
19
- json.september assessment.september.to_f
20
- json.fourth_quarter assessment.fourth_quarter.to_f
21
- json.october assessment.october.to_f
22
- json.november assessment.november.to_f
23
- json.december assessment.december.to_f
7
+ json.annual assessment.annual.to_f.round(2)
8
+ json.first_quarter assessment.first_quarter.to_f.round(2)
9
+ json.january assessment.january.to_f.round(2)
10
+ json.february assessment.february.to_f.round(2)
11
+ json.march assessment.march.to_f.round(2)
12
+ json.second_quarter assessment.second_quarter.to_f.round(2)
13
+ json.april assessment.april.to_f.round(2)
14
+ json.may assessment.may.to_f.round(2)
15
+ json.june assessment.june.to_f.round(2)
16
+ json.third_quarter assessment.third_quarter.to_f.round(2)
17
+ json.july assessment.july.to_f.round(2)
18
+ json.august assessment.august.to_f.round(2)
19
+ json.september assessment.september.to_f.round(2)
20
+ json.fourth_quarter assessment.fourth_quarter.to_f.round(2)
21
+ json.october assessment.october.to_f.round(2)
22
+ json.november assessment.november.to_f.round(2)
23
+ json.december assessment.december.to_f.round(2)
24
24
  # 实际任务
25
- json.annual_progress assessment.annual_progress.to_f
26
- json.first_quarter_progress assessment.first_quarter_progress.to_f
27
- json.january_progress assessment.january_progress.to_f
28
- json.february_progress assessment.february_progress.to_f
29
- json.march_progress assessment.march_progress.to_f
30
- json.second_quarter_progress assessment.second_quarter_progress.to_f
31
- json.april_progress assessment.april_progress.to_f
32
- json.may_progress assessment.may_progress.to_f
33
- json.june_progress assessment.june_progress.to_f
34
- json.third_quarter_progress assessment.third_quarter_progress.to_f
35
- json.july_progress assessment.july_progress.to_f
36
- json.august_progress assessment.august_progress.to_f
37
- json.september_progress assessment.september_progress.to_f
38
- json.fourth_quarter_progress assessment.fourth_quarter_progress.to_f
39
- json.october_progress assessment.october_progress.to_f
40
- json.november_progress assessment.november_progress.to_f
41
- json.december_progress assessment.december_progress.to_f
25
+ json.annual_progress assessment.annual_progress.to_f.round(2)
26
+ json.first_quarter_progress assessment.first_quarter_progress.to_f.round(2)
27
+ json.january_progress assessment.january_progress.to_f.round(2)
28
+ json.february_progress assessment.february_progress.to_f.round(2)
29
+ json.march_progress assessment.march_progress.to_f.round(2)
30
+ json.second_quarter_progress assessment.second_quarter_progress.to_f.round(2)
31
+ json.april_progress assessment.april_progress.to_f.round(2)
32
+ json.may_progress assessment.may_progress.to_f.round(2)
33
+ json.june_progress assessment.june_progress.to_f.round(2)
34
+ json.third_quarter_progress assessment.third_quarter_progress.to_f.round(2)
35
+ json.july_progress assessment.july_progress.to_f.round(2)
36
+ json.august_progress assessment.august_progress.to_f.round(2)
37
+ json.september_progress assessment.september_progress.to_f.round(2)
38
+ json.fourth_quarter_progress assessment.fourth_quarter_progress.to_f.round(2)
39
+ json.october_progress assessment.october_progress.to_f.round(2)
40
+ json.november_progress assessment.november_progress.to_f.round(2)
41
+ json.december_progress assessment.december_progress.to_f.round(2)
42
42
  # 差值 dif
43
- json.annual_dif assessment.annual.to_f - assessment.annual_progress.to_f
44
- json.first_quarter_dif assessment.first_quarter.to_f - assessment.first_quarter_progress.to_f
45
- json.january_dif assessment.january.to_f - assessment.january_progress.to_f
46
- json.february_dif assessment.february.to_f - assessment.february_progress.to_f
47
- json.march_dif assessment.march.to_f - assessment.may_progress.to_f
48
- json.second_quarter_dif assessment.second_quarter.to_f - assessment.second_quarter_progress.to_f
49
- json.april_dif assessment.april.to_f - assessment.april_progress.to_f
50
- json.may_dif assessment.may.to_f - assessment.may_progress.to_f
51
- json.june_dif assessment.june.to_f - assessment.june_progress.to_f
52
- json.third_quarter_dif assessment.third_quarter.to_f - assessment.third_quarter_progress.to_f
53
- json.july_dif assessment.july.to_f - assessment.july_progress.to_f
54
- json.august_dif assessment.august.to_f - assessment.august_progress.to_f
55
- json.september_dif assessment.september.to_f - assessment.september_progress.to_f
56
- json.fourth_quarter_dif assessment.fourth_quarter.to_f - assessment.fourth_quarter_progress.to_f
57
- json.october_dif assessment.october.to_f - assessment.october_progress.to_f
58
- json.november_dif assessment.november.to_f - assessment.november_progress.to_f
59
- json.december_dif assessment.december.to_f - assessment.december_progress.to_f
43
+ json.annual_dif (assessment.annual.to_f - assessment.annual_progress.to_f).round(2)
44
+ json.first_quarter_dif (assessment.first_quarter.to_f - assessment.first_quarter_progress.to_f).round(2)
45
+ json.january_dif (assessment.january.to_f - assessment.january_progress.to_f).round(2)
46
+ json.february_dif (assessment.february.to_f - assessment.february_progress.to_f).round(2)
47
+ json.march_dif (assessment.march.to_f - assessment.may_progress.to_f).round(2)
48
+ json.second_quarter_dif (assessment.second_quarter.to_f - assessment.second_quarter_progress.to_f).round(2)
49
+ json.april_dif (assessment.april.to_f - assessment.april_progress.to_f).round(2)
50
+ json.may_dif (assessment.may.to_f - assessment.may_progress.to_f).round(2)
51
+ json.june_dif (assessment.june.to_f - assessment.june_progress.to_f).round(2)
52
+ json.third_quarter_dif (assessment.third_quarter.to_f - assessment.third_quarter_progress.to_f).round(2)
53
+ json.july_dif (assessment.july.to_f - assessment.july_progress.to_f).round(2)
54
+ json.august_dif (assessment.august.to_f - assessment.august_progress.to_f).round(2)
55
+ json.september_dif (assessment.september.to_f - assessment.september_progress.to_f).round(2)
56
+ json.fourth_quarter_dif (assessment.fourth_quarter.to_f - assessment.fourth_quarter_progress.to_f).round(2)
57
+ json.october_dif (assessment.october.to_f - assessment.october_progress.to_f).round(2)
58
+ json.november_dif (assessment.november.to_f - assessment.november_progress.to_f).round(2)
59
+ json.december_dif (assessment.december.to_f - assessment.december_progress.to_f).round(2)
60
60
  # 完成率completion_rate
61
61
  json.annual_rate completion_rate(assessment.annual, assessment.annual_progress)
62
62
  json.first_quarter_rate completion_rate(assessment.first_quarter, assessment.first_quarter_progress)
@@ -31,6 +31,12 @@
31
31
  <input type="text" class="layui-input" id="follows_date" name="follows_date" autocomplete="off" placeholder=" - ">
32
32
  </div>
33
33
  </div>
34
+ <div class="layui-inline">
35
+ <label class="layui-form-label">最新进展</label>
36
+ <div class="layui-input-inline">
37
+ <input type="text" name="description" autocomplete="off" class="layui-input">
38
+ </div>
39
+ </div>
34
40
 
35
41
  <div class="layui-inline">
36
42
  <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_follows_search">重置
@@ -195,7 +201,7 @@
195
201
  where: {q: search, sort: sort}
196
202
  }, 'data');
197
203
  form.val('search_form', {
198
- name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area
204
+ name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area , description: data.field.description
199
205
  })
200
206
  return false;
201
207
  });
@@ -207,6 +213,7 @@
207
213
  follows_date: "",
208
214
  name: "",
209
215
  department: "",
216
+ description: "",
210
217
  staff_id: ""
211
218
  })
212
219
  return false;
@@ -14,9 +14,15 @@ json.data do
14
14
  json.reception_at d.last_follow_up&.reception_at.to_s
15
15
  json.bidded_date d.last_follow_up&.bidded_date.to_s
16
16
  json.signed_date d.last_follow_up&.signed_date.to_s
17
- json.total_amount d.last_follow_up&.total_amount
17
+ json.total_amount d.last_follow_up&.total_amount.to_f.round(2)
18
18
  json.service_end_time d.last_follow_up&.service_start_time.to_s + "-" + d.last_follow_up&.service_end_time.to_s
19
- json.actual_amount d.last_follow_up&.actual_amount
19
+ EducodeSales::FollowUp::BUSINESS_DEPLOYMENT[1..-1].each do |m|
20
+ if d.last_follow_up&.o_business_deployment == m[1]
21
+ json.o_business_deployment m[0]
22
+ break
23
+ end
24
+ end
25
+ json.actual_amount d.last_follow_up&.actual_amount.to_f.round(2)
20
26
  json.return_money d.return_money
21
27
  json.wait_return_money d.wait_return_money.to_i.round(2)
22
28
  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 : ''
@@ -27,5 +33,6 @@ json.data do
27
33
  json.current_staff_id @current_admin.id
28
34
  json.staff_id d.staff_id
29
35
  json.latest_time d.last_follow_up.present? ? d.last_follow_up.created_at.to_s : ''
36
+ json.year d.last_follow_up&.year.to_s
30
37
  end
31
38
  end
@@ -25,8 +25,8 @@ json.data do
25
25
  end
26
26
  end
27
27
  json.year d.last_follow_up&.year.to_s
28
- json.total_amount d.last_follow_up&.total_amount
29
- json.actual_amount d.last_follow_up&.actual_amount
28
+ json.total_amount d.last_follow_up&.total_amount.to_f.round(2)
29
+ json.actual_amount d.last_follow_up&.actual_amount.to_f.round(2)
30
30
  json.return_money d.return_money
31
31
  json.wait_return_money d.wait_return_money.to_f.round(2)
32
32
  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 : ''
@@ -78,7 +78,7 @@
78
78
  <div class="layui-inline deployment_type layui-hide">
79
79
  <label class="layui-form-label required">部署类型</label>
80
80
  <div class="layui-input-inline">
81
- <%= select_tag "o_business_deployment", options_for_select(@deployment_type, @last_follow_up&.o_business_deployment), class: 'required' %>
81
+ <%= select_tag "o_business_deployment", options_for_select(@deployment_type, @last_follow_up&.o_business_deployment), class: 'required' %>
82
82
  </div>
83
83
  </div>
84
84
 
@@ -87,7 +87,7 @@
87
87
  <label class="layui-form-label">总额(万)</label>
88
88
  <div class="layui-input-inline">
89
89
  <input name="total_amount" type="number" class="layui-input" autocomplete="off"
90
- value="<%= @last_follow_up&.total_amount %>">
90
+ value="<%= @last_follow_up&.total_amount.to_f.round(2) %>">
91
91
  </div>
92
92
  客户采购支出的费用。总额的生命历程:1.在最初阶段,是商机的预算总额;2.在挂网阶段,是项目的挂网预算总额;3.在中标阶段,是项目的中标总额。
93
93
  </div>
@@ -96,7 +96,7 @@
96
96
  <label class="layui-form-label">合同额(万)</label>
97
97
  <div class="layui-input-inline">
98
98
  <input name="actual_amount" type="number" class="layui-input" autocomplete="off" placeholder="本单位的签单金额"
99
- value="<%= @last_follow_up&.actual_amount %>">
99
+ value="<%= @last_follow_up&.actual_amount.to_f.round(2) %>">
100
100
  </div>
101
101
  客户签给头歌的费用。合同额的生命历程:1.在中标之前,合同额都是0;2.在中标之后,实际与头歌签合同的金额。
102
102
  </div>
@@ -111,7 +111,7 @@
111
111
  <div class="layui-inline">
112
112
  <label class="layui-form-label">渠道分成(万)</label>
113
113
  <div class="layui-input-inline">
114
- <input name="divide_amount" class="layui-input" value="<%= @last_follow_up&.divide_amount%>">
114
+ <input name="divide_amount" class="layui-input" value="<%= @last_follow_up&.divide_amount.to_f.round(2) %>">
115
115
  </div>
116
116
  总额里,渠道拿到的部分。
117
117
  </div>
@@ -17,9 +17,9 @@ json.data do
17
17
  end
18
18
  end
19
19
  end
20
- json.total_amount d.total_amount
21
- json.actual_amount d.actual_amount
22
- json.divide_amount d.divide_amount ? d.divide_amount : ""
20
+ json.total_amount d.total_amount.to_f.round(2)
21
+ json.actual_amount d.actual_amount.to_f.round(2)
22
+ json.divide_amount (d.divide_amount ? d.divide_amount : "").to_f.round(2)
23
23
  json.staff d.staff.user.real_name
24
24
  json.place d.place&.name
25
25
  json.money_plans_count d.money_plans_count
@@ -75,13 +75,13 @@
75
75
  <div class="layui-inline">
76
76
  <label class="layui-form-label">总额:</label>
77
77
  <div class="layui-input-inline">
78
- <%= @follow_up.total_amount %>万
78
+ <%= @follow_up.total_amount.to_f.round(2) %>万
79
79
  </div>
80
80
  </div>
81
81
  <div class="layui-inline">
82
82
  <label class="layui-form-label">合同额:</label>
83
83
  <div class="layui-input-inline">
84
- <%= @follow_up.actual_amount %>万
84
+ <%= @follow_up.actual_amount.to_f.round(2) %>万
85
85
  </div>
86
86
  </div>
87
87
  <br>
@@ -94,7 +94,7 @@
94
94
  <div class="layui-inline">
95
95
  <label class="layui-form-label">渠道分成:</label>
96
96
  <div class="layui-input-inline">
97
- <%= @follow_up.divide_amount %>万
97
+ <%= @follow_up.divide_amount.to_f.round(2) %>万
98
98
  </div>
99
99
  </div>
100
100
  <div class="layui-form-item">
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.8.6'
2
+ VERSION = '0.9.1'
3
3
  end
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.8.6
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-27 00:00:00.000000000 Z
11
+ date: 2022-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails