educode_sales 0.9.70 → 0.9.71

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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/businesses_controller.rb +16 -2
  3. data/app/controllers/educode_sales/customers_controller.rb +45 -13
  4. data/app/controllers/educode_sales/plans_controller.rb +69 -19
  5. data/app/controllers/educode_sales/teachers_controller.rb +7 -0
  6. data/app/models/educode_sales/customer_follow.rb +1 -0
  7. data/app/models/educode_sales/sale_plan.rb +2 -0
  8. data/app/views/educode_sales/businesses/index.html.erb +37 -12
  9. data/app/views/educode_sales/customers/list.html.erb +67 -23
  10. data/app/views/educode_sales/customers/list.json.jbuilder +22 -10
  11. data/app/views/educode_sales/customers/show_customer_follow.html.erb +175 -0
  12. data/app/views/educode_sales/customers/show_customer_follow.json.jbuilder +13 -0
  13. data/app/views/educode_sales/customers/show_majors.html.erb +146 -0
  14. data/app/views/educode_sales/plans/_yearPlan.html.erb +6 -3
  15. data/app/views/educode_sales/plans/business_infos.json.jbuilder +10 -4
  16. data/app/views/educode_sales/plans/edit_bussiness_info.html.erb +13 -8
  17. data/app/views/educode_sales/plans/edit_bussiness_info_extra.html.erb +16 -73
  18. data/app/views/educode_sales/plans/edit_year_plan.html.erb +64 -5
  19. data/app/views/educode_sales/plans/new_year.html.erb +51 -3
  20. data/app/views/educode_sales/plans/plan_business_infos.json.jbuilder +7 -0
  21. data/app/views/educode_sales/plans/years_plan.json.jbuilder +43 -3
  22. data/app/views/educode_sales/teachers/_index.html.erb +15 -5
  23. data/app/views/educode_sales/teachers/index.json.jbuilder +7 -0
  24. data/config/routes.rb +3 -0
  25. data/lib/educode_sales/version.rb +1 -1
  26. metadata +9 -7
  27. data/app/assets/images/educode_sales/indexlogo.png +0 -0
@@ -1,4 +1,31 @@
1
1
 
2
+ <div class="layui-form layuimini-form">
3
+ <div class="layui-form-item" style="padding: 25px">
4
+ <div class="layui-inline">
5
+ <label class="layui-form-label">目标类型</label>
6
+ <div class="layui-input-inline">
7
+ <%= select_tag "clazz", options_for_select(@clazz), {include_blank: true} %>
8
+ </div>
9
+ </div>
10
+ <div class="layui-inline">
11
+ <label class="layui-form-label">单位</label>
12
+ <div class="layui-input-inline" style="width: 400px">
13
+ <input type="text" class="layui-input" autocomplete="off" name="department">
14
+ </div>
15
+ </div>
16
+ <div class="layui-inline">
17
+ <label class="layui-form-label">年度</label>
18
+ <div class="layui-input-inline" style="width: 150px">
19
+ <input type="text" class="layui-input" id="year_search_plan_date" autocomplete="off" name="year_search">
20
+ </div>
21
+ </div>
22
+ <div class="layui-inline">
23
+ <div class="layui-input-inline">
24
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="search">搜索</button>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </div>
2
29
  <div>
3
30
  <table class="layui-hide" id="yearTable" lay-filter="yearTable"></table>
4
31
  </div>
@@ -26,9 +53,14 @@
26
53
  })
27
54
  })
28
55
 
56
+ laydate.render({
57
+ elem: '#year_search_plan_date',
58
+ type: 'year'
59
+ });
60
+
29
61
  table.render({
30
62
  elem: '#yearTable',
31
- url: '/missions/plans/plan_business_infos?year=' + parent.year,
63
+ url: '/missions/plans/plan_business_infos?year=' + parent.year + "&q[clazz]=" + parent.clazz + "&staff_id=" + parent.staff_id,
32
64
  height: 400,
33
65
  defaultToolbar: ['filter'],
34
66
  initSort: {
@@ -49,6 +81,21 @@
49
81
  width: 160,
50
82
  title: '商机名称',
51
83
  },
84
+ {
85
+ field: 'year',
86
+ width: 100,
87
+ title: '年度',
88
+ },
89
+ {
90
+ field: 'business_clazz',
91
+ width: 160,
92
+ title: '商机类别',
93
+ },
94
+ {
95
+ field: 'property',
96
+ width: 200,
97
+ title: '客户类型',
98
+ },
52
99
  {
53
100
  field: 'school',
54
101
  width: 150,
@@ -102,7 +149,7 @@
102
149
  {
103
150
  field: 'bidded_amount',
104
151
  width: 170,
105
- title: '中标额',
152
+ title: '计划金额',
106
153
  },
107
154
  {
108
155
  field: 'plan_sign_on',
@@ -152,7 +199,7 @@
152
199
  {
153
200
  field: 'prepayment_amount',
154
201
  width: 170,
155
- title: '预收款',
202
+ title: '计划预收款',
156
203
  },
157
204
  {
158
205
  field: 'check_fee_plan_on',
@@ -167,7 +214,7 @@
167
214
  {
168
215
  field: 'check_fee',
169
216
  width: 170,
170
- title: '验收款',
217
+ title: '计划验收款',
171
218
  },
172
219
  {
173
220
  field: 'qa_plan_on',
@@ -182,7 +229,7 @@
182
229
  {
183
230
  field: 'qa_amount',
184
231
  width: 170,
185
- title: '质保金',
232
+ title: '计划质保金',
186
233
  },
187
234
  {
188
235
  field: 'account_receivable',
@@ -203,6 +250,18 @@
203
250
  page: true,
204
251
  });
205
252
 
253
+ form.on('submit(search)', function (data) {
254
+ search = data.field
255
+ table.reload('yearTable', {
256
+ page: {
257
+ curr: 1
258
+ },
259
+ where: {q: search}
260
+ }, 'data');
261
+
262
+ return false;
263
+ });
264
+
206
265
  table.on('tool(yearTable)', function (obj) {
207
266
  var data = obj.data;
208
267
  id = data.id;
@@ -9,7 +9,7 @@
9
9
  <div class="layui-inline">
10
10
  <label class="layui-form-label required">选择商机</label>
11
11
  <div class="layui-input-inline" style="width: 400px">
12
- <%= select_tag "business_id", options_for_select(@businesses), {"lay-verify": "required", include_blank: true} %>
12
+ <%= select_tag "business_id", options_for_select(@businesses, @business&.id), {"lay-verify": "required", include_blank: true, "lay-search": "" } %>
13
13
  </div>
14
14
  </div>
15
15
  <div class="layui-inline">
@@ -37,13 +37,44 @@
37
37
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
38
38
  <a class="layui-btn layui-btn-danger layui-btn-xs data-count-delete" lay-event="delete">删除</a>
39
39
  </script>
40
+
41
+ <script type="text/html" id="plan_bid_on">
42
+ {{# if (['回款目标' ,'签单目标', '商机目标'].includes(d.clazz)) { }}
43
+ <div style="color: red;text-align: center;">--</div>
44
+ {{# } else { }}
45
+ {{ d.plan_bid_on }}</a>
46
+ {{# } }}
47
+ </script>
48
+ <script type="text/html" id="plan_sign_on">
49
+ {{# if (['回款目标' ,'中标目标', '商机目标'].includes(d.clazz)) { }}
50
+ <div style="color: red;text-align: center;">--</div>
51
+ {{# } else { }}
52
+ {{ d.plan_sign_on }}</a>
53
+ {{# } }}
54
+ </script>
55
+ <script type="text/html" id="prepayment_plan_on">
56
+ {{# if (['签单目标' ,'中标目标', '商机目标'].includes(d.clazz)) { }}
57
+ <div style="color: red;text-align: center;">--</div>
58
+ {{# } else { }}
59
+ {{ d.prepayment_plan_on }}</a>
60
+ {{# } }}
61
+ </script>
62
+ <script type="text/html" id="prepayment_amount">
63
+ {{# if (['签单目标' ,'中标目标', '商机目标'].includes(d.clazz)) { }}
64
+ <div style="color: red;text-align: center;">--</div>
65
+ {{# } else { }}
66
+ {{ d.prepayment_amount }}</a>
67
+ {{# } }}
68
+ </script>
69
+
40
70
  <script>
41
- layui.use(['form', 'table', 'laytpl', 'request', 'laydate'], function () {
71
+ layui.use(['form', 'table', 'laytpl', 'request', 'laydate', 'selectInput'], function () {
42
72
  var form = layui.form,
43
73
  layer = layui.layer,
44
74
  table = layui.table,
45
75
  request = layui.request,
46
76
  laydate = layui.laydate,
77
+ selectInput = layui.selectInput,
47
78
  $ = layui.$;
48
79
  laydate.render({
49
80
  elem: '#new_year_field',
@@ -51,6 +82,7 @@
51
82
  });
52
83
  form.render();
53
84
 
85
+
54
86
  var parentIndex = layer.index;
55
87
 
56
88
  form.on('submit(add_year_plan)', function (data) {
@@ -68,7 +100,9 @@
68
100
  });
69
101
  form.on('submit(add_y_plan)', function (data) {
70
102
  request.authPost("missions/plans/create_sales_plan", {}, function (res) {
71
- table.reload('yearPlanTable');
103
+ <% unless @business %>
104
+ table.reload('yearPlanTable');
105
+ <% end %>
72
106
  layer.close(parent.yindex);
73
107
  })
74
108
  })
@@ -96,6 +130,16 @@
96
130
  width: 160,
97
131
  title: '商机名称',
98
132
  },
133
+ {
134
+ field: 'business_clazz',
135
+ width: 160,
136
+ title: '商机类别',
137
+ },
138
+ {
139
+ field: 'property',
140
+ width: 200,
141
+ title: '客户类型',
142
+ },
99
143
  {
100
144
  field: 'school',
101
145
  width: 150,
@@ -140,21 +184,25 @@
140
184
  field: 'plan_bid_on',
141
185
  width: 170,
142
186
  title: '计划投标时间',
187
+ templet: "#plan_bid_on"
143
188
  },
144
189
  {
145
190
  field: 'plan_sign_on',
146
191
  width: 170,
147
192
  title: '计划签单时间',
193
+ templet: "#plan_sign_on"
148
194
  },
149
195
  {
150
196
  field: 'prepayment_plan_on',
151
197
  width: 170,
152
198
  title: '计划回款时间',
199
+ templet: "#prepayment_plan_on"
153
200
  },
154
201
  {
155
202
  field: 'prepayment_amount',
156
203
  width: 170,
157
204
  title: '计划回款额',
205
+ templet: "#prepayment_amount"
158
206
  },
159
207
  {
160
208
  title: '操作',
@@ -35,6 +35,13 @@ json.data do
35
35
  json.account_receivable_clazz d.account_receivable_clazz
36
36
  json.invoice_amount d.invoice_amount
37
37
 
38
+ json.business_clazz d.business.clazz&.name || ""
39
+ if d.business&.department&.school
40
+ json.property d.business.department.school.school_tags.where(for_missions: true).pluck(:name).join("、")
41
+ else
42
+ json.property ''
43
+ end
44
+
38
45
  end
39
46
  end
40
47
 
@@ -2,14 +2,54 @@ json.data do
2
2
  json.array! @sale_plans do |d|
3
3
  json.id d.id
4
4
  json.staff d.staff.user.real_name
5
+ json.staff_id d.staff_id
5
6
  json.clazz EducodeSales::SalePlan::CLAZZ_NAME.invert[d.clazz]
6
7
  json.year d.year
8
+ json.clazz_id d.clazz
7
9
  json.target_money d['annual'] || 0
8
- json.plan_money d['budget_amounts']&.round(2) || 0
10
+ # json.plan_money d['budget_amounts']&.round(2) || 0
9
11
  json.minimum_money d['annual'].present? ? (d['annual'].to_f * 0.8).round(2) : 0
10
- json.finish_money 0
11
- json.finish_rate 0
12
+
13
+ # if d.clazz == 1
14
+ # # 签单计划的预算额
15
+ # json.finish_money d.business_infos.where.not(plan_sign_on: nil).sum(:budget_amount)
16
+ # elsif d.clazz == 18
17
+ # # 中标目标
18
+ # json.finish_money d.business_infos.where.not(plan_bid_on: nil).sum(:budget_amount)
19
+ # elsif d.clazz == 2
20
+ # # 回款目标
21
+ # json.finish_money d.business_infos.where.not(plan_bid_on: nil).sum(:budget_amount)
22
+ # elsif d.clazz == 7
23
+ # # 商机目标
24
+ # json.finish_money d.business_infos.sum(:budget_amount)
25
+ # end
26
+ if d.clazz == 1
27
+ # 签单计划的预算额
28
+ json.plan_money d['clazz_1'] || 0
29
+ json.finish_money d['finish_sign']
30
+ json.finish_rate (d['finish_sign'] * 100 / (d['clazz_1'] || 0).to_f).round(2)
31
+ elsif d.clazz == 18
32
+ # 中标目标
33
+ json.plan_money d['clazz_18'] || 0
34
+ json.finish_money d['finish_bid']
35
+ json.finish_rate (d['finish_bid'] * 100 / (d['clazz_18'] || 0).to_f).round(2)
36
+ elsif d.clazz == 2
37
+ # 回款目标
38
+ json.plan_money d['clazz_2'] || 0
39
+ json.finish_money d['finish_return_money']
40
+ json.finish_rate (d['finish_return_money'] * 100 / (d['clazz_2'] || 0).to_f).round(2)
41
+ elsif d.clazz == 7
42
+ # 商机目标
43
+ json.plan_money d['clazz_7'] || 0
44
+ json.finish_money d['clazz_7'] || 0
45
+ json.finish_rate 100
46
+ end
47
+
12
48
  json.updated_at d.updated_at.to_s
49
+ json.clazz_1 d['clazz_1']
50
+ json.clazz_2 d['clazz_2']
51
+ json.clazz_7 d['clazz_7']
52
+ json.clazz_18 d['clazz_18']
13
53
  end
14
54
  end
15
55
 
@@ -196,11 +196,6 @@
196
196
  templet:'<div><span title="{{d.school}}">{{d.school}}</span></div>'
197
197
 
198
198
  },
199
- {
200
- field: 'area',
201
- width: 80,
202
- title: '区域',
203
- },
204
199
  {
205
200
  field: 'department',
206
201
  width: 130,
@@ -212,6 +207,16 @@
212
207
  width: 160,
213
208
  title: '专业',
214
209
  },
210
+ {
211
+ field: 'area',
212
+ width: 80,
213
+ title: '区域',
214
+ },
215
+ {
216
+ field: 'business_count',
217
+ width: 120,
218
+ title: '单位商机数',
219
+ },
215
220
  {
216
221
  field: 'professional_title',
217
222
  title: '职称',
@@ -248,6 +253,11 @@
248
253
  totalRow:true,
249
254
  templet: "#follow"
250
255
  },
256
+ {
257
+ field: 'sales_manage',
258
+ width: 160,
259
+ title: '销售经理',
260
+ },
251
261
  {
252
262
  field: 'staff_manage',
253
263
  width: 160,
@@ -26,6 +26,13 @@ json.data do
26
26
  json.latest_time (d['latest_time'] ? DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d['latest_time'].strftime("%Y-%m-%d")) : DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d.created_at.strftime("%Y-%m-%d"))).to_i
27
27
 
28
28
  json.staff_manage @staff_manages[d.department&.school&.province]&.join(",")
29
+ json.sales_manage @sales_manages[d.department&.school&.province]&.join(",")
30
+
31
+ if d.department_id
32
+ json.business_count EducodeSales::Business.where(department_id: d.department_id).size
33
+ else
34
+ json.business_count 0
35
+ end
29
36
 
30
37
  json.majors d.department&.department_majors&.pluck(:name).present? ? d.department&.department_majors&.pluck(:name).join(",") : ""
31
38
 
data/config/routes.rb CHANGED
@@ -45,6 +45,8 @@ EducodeSales::Engine.routes.draw do
45
45
  get :majors
46
46
  get :new_major
47
47
  get :list
48
+ get :show_majors
49
+ get :show_customer_follow
48
50
  end
49
51
 
50
52
  member do
@@ -182,6 +184,7 @@ EducodeSales::Engine.routes.draw do
182
184
  get :plan_business_infos
183
185
  get :edit_bussiness_info_extra
184
186
  post :update_business_info_extra
187
+ get :staff_businesses
185
188
  end
186
189
  member do
187
190
  delete :delete_business_info
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.70'
2
+ VERSION = '0.9.71'
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.9.70
4
+ version: 0.9.71
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-14 00:00:00.000000000 Z
11
+ date: 2023-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -105,7 +105,6 @@ files:
105
105
  - app/assets/images/educode_sales/icon-login.png
106
106
  - app/assets/images/educode_sales/icon.png
107
107
  - app/assets/images/educode_sales/indexLogo.png
108
- - app/assets/images/educode_sales/indexlogo.png
109
108
  - app/assets/images/educode_sales/loading-0.gif
110
109
  - app/assets/images/educode_sales/loading-1.gif
111
110
  - app/assets/images/educode_sales/loading-2.gif
@@ -311,10 +310,13 @@ files:
311
310
  - app/views/educode_sales/customers/new_department.html.erb
312
311
  - app/views/educode_sales/customers/new_follow_record.html.erb
313
312
  - app/views/educode_sales/customers/new_major.html.erb
313
+ - app/views/educode_sales/customers/show_customer_follow.html.erb
314
+ - app/views/educode_sales/customers/show_customer_follow.json.jbuilder
314
315
  - app/views/educode_sales/customers/show_department.json.jbuilder
315
316
  - app/views/educode_sales/customers/show_follow.html.erb
316
317
  - app/views/educode_sales/customers/show_follow.json.jbuilder
317
318
  - app/views/educode_sales/customers/show_follow_record.html.erb
319
+ - app/views/educode_sales/customers/show_majors.html.erb
318
320
  - app/views/educode_sales/follow_ups/index.json.jbuilder
319
321
  - app/views/educode_sales/follow_ups/money_plans.json.jbuilder
320
322
  - app/views/educode_sales/follow_ups/teachers.json.jbuilder
@@ -621,7 +623,7 @@ homepage: https://www.educoder.net
621
623
  licenses:
622
624
  - MIT
623
625
  metadata: {}
624
- post_install_message:
626
+ post_install_message:
625
627
  rdoc_options: []
626
628
  require_paths:
627
629
  - lib
@@ -636,8 +638,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
636
638
  - !ruby/object:Gem::Version
637
639
  version: '0'
638
640
  requirements: []
639
- rubygems_version: 3.0.9
640
- signing_key:
641
+ rubygems_version: 3.0.0
642
+ signing_key:
641
643
  specification_version: 4
642
644
  summary: Summary of EducodeSales.
643
645
  test_files: []