educode_sales 1.10.31 → 1.10.33

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: c50f4a81ef08d88a240f765076b16084ce5bba548f47b95b6d39fd925415194e
4
- data.tar.gz: 63383b652e3dde1d55bb984050643cb10f9f496d343bd2ee5713de1c5815823f
3
+ metadata.gz: 22b7976d2189b10d3280296023ca6d52fbb050307cf59d6b83c81547d5fee47e
4
+ data.tar.gz: 4c81b96887d55e9bc415d2a0f0359884cb196a1dc900d9fc56b837585f6f882b
5
5
  SHA512:
6
- metadata.gz: 37b0e90d7eb6706824767e754501cd3c41531ef6d5fbf506e0808d5fc7714a61f1b4fe6cf86328ca2dc5f116dc646031d74bf3b58ac52642f0ecc98f37414edc
7
- data.tar.gz: 61ff8dba4f84ce8ab9c91d4914edbacd0bfc666245b395e20356c4c493c060baf5cfa2e4fb574c9c19e3a2c8866da471d1bcd06a8eb24dc8ca2535e39acd4cd6
6
+ metadata.gz: 3697ec424b22d9ed64d8aa5d8e10665c719826651441a597376170287e0b9e54b565ec6ec0d5c545755a6899f5ea9ce5d530ab92daf36a92f843ffbd9d035f47
7
+ data.tar.gz: c8a57001d38e3ca5f824167565b668228de6e089be99b44bd07b92732a6971fb3aa296b2abd0f945311b01dfa019887faf7a0a1e60b1924a0560d84b7979c329
@@ -293,6 +293,20 @@ module EducodeSales
293
293
  JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
294
294
  ").where("educode_sales_follow_ups.invitation_at > ? AND educode_sales_follow_ups.invitation_at < ?", date[0] + '00:00:00', date[1] + '23:59:59')
295
295
  end
296
+
297
+ if params[:q].present? && params[:q][:plan_return_date].present?
298
+ date = params[:q][:plan_return_date].split(" - ")
299
+ @businesses = @businesses.joins("
300
+ JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
301
+ ").where("educode_sales_follow_ups.plan_return_date > ? AND educode_sales_follow_ups.plan_return_date < ?", date[0] + '00:00:00', date[1] + '23:59:59')
302
+ end
303
+
304
+ if params[:q].present? && params[:q][:plan_a_date].present?
305
+ date = params[:q][:plan_a_date].split(" - ")
306
+ @businesses = @businesses.joins("
307
+ JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
308
+ ").where("educode_sales_follow_ups.plan_a_date > ? AND educode_sales_follow_ups.plan_a_date < ?", date[0] + '00:00:00', date[1] + '23:59:59')
309
+ end
296
310
 
297
311
  # 根据编号获取商机
298
312
  if params[:q].present? && params[:q][:number].present?
@@ -55,6 +55,10 @@ module EducodeSales
55
55
  date = params[:q][:follows_date].split(" - ")
56
56
  @follow_ups = @follow_ups.where("educode_sales_follow_ups.created_at > ? AND educode_sales_follow_ups.created_at < ?", date[0], date[1] + '23:59:59')
57
57
  end
58
+ if params[:q].present? && params[:q][:property].present?
59
+ # 客户类型
60
+ @follow_ups = @follow_ups.joins(business: [department: [school: :school_tags]]).where("school_tags.id = ?", params[:q][:property])
61
+ end
58
62
  if params[:q].present? && params[:q][:staff_id].present?
59
63
  @follow_ups = @follow_ups.where(staff_id: params[:q][:staff_id])
60
64
  end
@@ -57,6 +57,11 @@ module EducodeSales
57
57
 
58
58
  end
59
59
 
60
+ if params[:q].present? && params[:q][:property].present?
61
+ # 客户类型
62
+ @money_plan_records = @money_plan_records.joins(business: [department: [school: :school_tags]]).where("school_tags.id = ?", params[:q][:property])
63
+ end
64
+
60
65
  if params[:q].present? && params[:q][:staff_manages].present?
61
66
  # 销售经理
62
67
  @money_plan_records = @money_plan_records.joins(:business).joins("
@@ -161,34 +166,6 @@ module EducodeSales
161
166
  businesses << business
162
167
  money_plan_record.update(business_id: business.id)
163
168
  # business.update(return_money: claim.money_plan.money_plan_claims.sum(:amount))
164
-
165
-
166
- # # 生成跟进信息
167
- # last_follow_up = business.last_follow_up
168
- # if last_follow_up.present?
169
- # follow_up = last_follow_up.dup
170
-
171
- # follow_up.description = "认领了回款记录"
172
-
173
- # follow_up.staff = @current_admin
174
-
175
- # last_follow_up.assign_follow_ups.each do |d|
176
- # follow_up.assign_follow_ups.build(staff_id: d.staff_id)
177
- # end
178
-
179
- # if follow_up.save!
180
- # last_follow_up.key_person.each do |d|
181
- # key_person = d.dup
182
- # key_person.follow_up_id = follow_up.id
183
- # key_person.save
184
- # end
185
- # last_follow_up.money_plans.each do |d|
186
- # d.follow_up_id = follow_up.id
187
- # d.save
188
- # end
189
- # business.update(last_follow_up_id: follow_up.id)
190
- # end
191
- # end
192
169
  end
193
170
  end
194
171
  businesses.uniq.each do |d|
@@ -198,6 +175,40 @@ module EducodeSales
198
175
  staff_manage_ids = d&.last_follow_up&.assign_follow_ups.present? ? d.last_follow_up.assign_follow_ups.pluck(:staff_id) : [d.staff_id]
199
176
  common_id = EducodeSales::Common.find_by(clazz: '计划类型', name: '回款计划')&.id
200
177
  EducodeSales::SalePlan.where(month: Time.now.beginning_of_month, business: d, staff_id: staff_manage_ids, common_id: common_id).update_all(finish_rate: 100)
178
+
179
+
180
+ # 生成跟进信息
181
+ last_follow_up = d.last_follow_up
182
+ if last_follow_up.present?
183
+ follow_up = last_follow_up.dup
184
+ follow_up.description = "认领了回款记录"
185
+ follow_up.staff = @current_admin
186
+
187
+ last_follow_up.assign_follow_ups.each do |d|
188
+ follow_up.assign_follow_ups.build(staff_id: d.staff_id)
189
+ end
190
+
191
+ if follow_up.save!
192
+ last_follow_up.key_person.each do |d|
193
+ key_person = d.dup
194
+ key_person.follow_up_id = follow_up.id
195
+ key_person.save
196
+ end
197
+
198
+ last_follow_up.money_plans.each do |d|
199
+ money = d.dup
200
+ money.staff = @current_admin
201
+ money.follow_up_id = follow_up.id
202
+ money.save
203
+ end
204
+
205
+ # 合同里签到日期全同步到最新跟进
206
+ last_follow_up.contract_date_lists.update_all(follow_up_id: follow_up.id)
207
+
208
+ follow_up.follow_up_trends.create(clazz: '跟进信息', content: "认领了回款记录", staff_id: @current_admin.id)
209
+ d.update(last_follow_up_id: follow_up.id)
210
+ end
211
+ end
201
212
  end
202
213
  render_success
203
214
  end
@@ -205,7 +216,7 @@ module EducodeSales
205
216
  private
206
217
 
207
218
  def money_plan_record_params
208
- params.permit(:amount, :payer_name, :date_at)
219
+ params.permit(:amount, :payer_name, :date_at, :business_id)
209
220
  end
210
221
  end
211
222
  end
@@ -23,7 +23,9 @@ module EducodeSales
23
23
  @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)
24
24
  @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)
25
25
 
26
- @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)
26
+
27
+ @return_amount = EducodeSales::MoneyPlanRecord.joins(:money_plan_claims).sum(:amount).round(2)
28
+ # @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)
27
29
  # # @return_amount = total_return[0]['return_money']&.round(2) || 0
28
30
  # @receivable_amount = @goal_amount - @return_amount
29
31
 
@@ -50,8 +52,9 @@ module EducodeSales
50
52
  s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
51
53
  @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)
52
54
  @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)
53
- @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)
55
+ # @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)
54
56
 
57
+ @return_amount = EducodeSales::MoneyPlanRecord.joins(:money_plan_claims).where("educode_sales_money_plan_records.date_at >= ? AND educode_sales_money_plan_records.date_at <= ? ", year_time, year_over_time).sum(:amount).round(2)
55
58
  # 往年累计已中标合同
56
59
  # @former_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.stage_id IN (?)", "#{@year}-12-31", stage_ids).sum(:actual_amount).round(2)
57
60
  # # 往年累计已回款
@@ -13,6 +13,12 @@
13
13
  <input type="text" name="department" class="layui-input">
14
14
  </div>
15
15
  </div>
16
+ <div class="layui-inline">
17
+ <label class="layui-form-label">客户类型</label>
18
+ <div class="layui-input-inline">
19
+ <%= select_tag "property", options_for_select(SchoolTag.where(for_missions: true).pluck(:name, :id)), { include_blank: true } %>
20
+ </div>
21
+ </div>
16
22
  <div class="layui-inline">
17
23
  <label class="layui-form-label">销售人员</label>
18
24
  <div class="layui-input-inline">
@@ -121,6 +127,11 @@
121
127
  title: '单位',
122
128
  templet:'#school'
123
129
  },
130
+ {
131
+ field: 'property',
132
+ width: 150,
133
+ title: '客户类型',
134
+ },
124
135
  {
125
136
  field: 'clazz',
126
137
  width: 80,
@@ -80,11 +80,12 @@
80
80
  </div>
81
81
  </div>
82
82
  <div class="layui-inline show_item" style="<%= params[:name] || params[:type] ? '' : 'display:none;' %>">
83
- <label class="layui-form-label">计划投标时间</label>
83
+ <label class="layui-form-label" style="width: 120px;">计划投标时间</label>
84
84
  <div class="layui-input-inline">
85
85
  <input type="text" class="layui-input" id="invitation_at" name="invitation_at" placeholder=" - " autocomplete="off">
86
86
  </div>
87
87
  </div>
88
+
88
89
  <div class="layui-inline show_item" style="<%= params[:name] || params[:type] ? '' : 'display:none;' %>">
89
90
  <label class="layui-form-label">中标时间</label>
90
91
  <div class="layui-input-inline">
@@ -129,6 +130,18 @@
129
130
  <%= select_tag "property", options_for_select(SchoolTag.where(for_missions: true).pluck(:name, :id)), { include_blank: true } %>
130
131
  </div>
131
132
  </div>
133
+ <div class="layui-inline show_item" style="<%= params[:name] || params[:type] ? '' : 'display:none;' %>">
134
+ <label class="layui-form-label" style="width: 120px;">计划A类时间</label>
135
+ <div class="layui-input-inline">
136
+ <input type="text" class="layui-input" id="plan_a_date" name="plan_a_date" placeholder=" - " autocomplete="off">
137
+ </div>
138
+ </div>
139
+ <div class="layui-inline show_item" style="<%= params[:name] || params[:type] ? '' : 'display:none;' %>">
140
+ <label class="layui-form-label" style="width: 120px;">计划回款时间</label>
141
+ <div class="layui-input-inline">
142
+ <input type="text" class="layui-input" id="plan_return_date" name="plan_return_date" placeholder=" - " autocomplete="off">
143
+ </div>
144
+ </div>
132
145
  <div class="layui-inline">
133
146
  <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
134
147
  </button>
@@ -265,7 +278,17 @@
265
278
  range: true,
266
279
  value: gon.bidded_date
267
280
  });
268
-
281
+
282
+ laydate.render({
283
+ elem: '#plan_a_date',
284
+ range: true,
285
+ });
286
+
287
+ laydate.render({
288
+ elem: '#plan_return_date',
289
+ range: true,
290
+ });
291
+
269
292
 
270
293
  form.on('select(source_id_select)', function(data){
271
294
  setSourceWay(data.value);
@@ -535,6 +558,7 @@
535
558
  width: 150,
536
559
  title: '计划A类金额',
537
560
  sort: true,
561
+ totalRow: true,
538
562
  hide: gon.filter.plan_a_money
539
563
  },
540
564
  {
@@ -549,6 +573,7 @@
549
573
  width: 150,
550
574
  title: '计划投标金额',
551
575
  sort: true,
576
+ totalRow: true,
552
577
  hide: gon.filter.invitation_money
553
578
  },
554
579
  {
@@ -563,6 +588,7 @@
563
588
  width: 135,
564
589
  title: '计划回款金额',
565
590
  sort: true,
591
+ totalRow: true,
566
592
  hide: gon.filter.plan_return_money
567
593
  },
568
594
  {
@@ -1119,8 +1145,9 @@
1119
1145
  form.on('submit(reset_business_search)', function (data) {
1120
1146
  var field = data.field;
1121
1147
  form.val('search_form', {
1122
- name: '', department: '', staff_id: '', business_type: '', business_step: '',
1123
- place_id: '', date: '', area: '', invitation_at: '', business_year: '', number: ''
1148
+ name: '', department: '', staff_id: '', business_type: '', business_step: '', bidded_date: '', source_way: '',
1149
+ place_id: '', date: '', area: '', invitation_at: '', business_year: '', number: '', property: '', level_id: '', source_name: '',
1150
+ invitation_money: '', plan_a_date: '', plan_a_money: '', plan_return_date: '', plan_return_money: ''
1124
1151
  })
1125
1152
  business_type_list.setValue([])
1126
1153
  business_step_list.setValue([])
@@ -17,6 +17,11 @@ json.data do
17
17
  json.tel d.key_person.pluck(:tel).select { |d| d.present? }.join("、")
18
18
  json.key_people d.key_person.map { |d| d.name }.join("、")# key_people(teacher_ids)
19
19
 
20
+ if d.business.department&.school
21
+ json.property d.business.department.school.school_tags.where(for_missions: true).pluck(:name).join("、")
22
+ else
23
+ json.property ''
24
+ end
20
25
  end
21
26
  end
22
27
 
@@ -26,6 +26,12 @@
26
26
  <input type="text" name="school" class="layui-input">
27
27
  </div>
28
28
  </div>
29
+ <div class="layui-inline">
30
+ <label class="layui-form-label">客户类型</label>
31
+ <div class="layui-input-inline">
32
+ <%= select_tag "property", options_for_select(SchoolTag.where(for_missions: true).pluck(:name, :id)), { include_blank: true } %>
33
+ </div>
34
+ </div>
29
35
  <div class="layui-inline">
30
36
  <label class="layui-form-label required">匹配状态</label>
31
37
  <div class="layui-input-inline">
@@ -140,6 +146,11 @@
140
146
  width: 220,
141
147
  title: '对应客户名称',
142
148
  },
149
+ {
150
+ field: 'property',
151
+ width: 150,
152
+ title: '客户类型',
153
+ },
143
154
  {
144
155
  field: 'state',
145
156
  width: 120,
@@ -205,7 +216,12 @@
205
216
  clazz: "",
206
217
  professional_title: "",
207
218
  school: "",
208
- business: ""
219
+ business: "",
220
+ property: "",
221
+ date_at: "",
222
+ amount: "",
223
+ payer_name: "",
224
+ state: ""
209
225
  });
210
226
  staff_manages_list.setValue([]);
211
227
  return false;
@@ -3,7 +3,13 @@
3
3
  <div class="layui-form-item">
4
4
  <label class="layui-form-label" style="width: 80px !important;">合同名称:</label>
5
5
  <div class="layui-input-inline" style="line-height: 38px;">
6
- <%= @money_plan_record.business&.name %>
6
+ <% if @money_plan_record.business %>
7
+ <%= @money_plan_record.business&.name %>
8
+ <% else %>
9
+ <div id="business" style="width:600px;"></div>
10
+ <% end %>
11
+
12
+
7
13
  </div>
8
14
  </div>
9
15
  <div class="layui-form-item">
@@ -41,13 +47,44 @@
41
47
  table = layui.table,
42
48
  laydate = layui.laydate,
43
49
  request = layui.request,
50
+ selectInput = layui.selectInput,
44
51
  $ = layui.$;
45
52
  form.render();
46
53
  laydate.render({
47
54
  elem: '#date_at',
48
55
  });
56
+
57
+ if ($("#business").length > 0) {
58
+ var business_id = "";
59
+ var business_select = selectInput.render({
60
+ elem: '#business',
61
+ name: 'bussiness_name', // 渲染的input的name值
62
+ layFilter: 'test', //同layui form参数lay-filter
63
+ layVerType: 'tips', // 同layui form参数lay-verType
64
+ layReqText: '请填写文本', //同layui form参数lay-ReqText
65
+ hasSelectIcon: false,
66
+ placeholder: '请输入合同名称', // 渲染的inputplaceholder值
67
+ remoteSearch: true, // 是否启用远程搜索 默认是false,和远程搜索回调保存同步
68
+ remoteMethod: function(value, cb) { // 远程搜索的回调函数
69
+ if (!value) {
70
+ business_id = "";
71
+ return cb([]);
72
+ }
73
+ request.get('missions/search_contracts?q=' + value, {}, function(res) {
74
+ if (res.data.length == 0) {
75
+ business_select.emptyValue();
76
+ return cb([])
77
+ }
78
+ return cb(res)
79
+ })
80
+ }
81
+ });
82
+ }
49
83
 
50
84
  form.on('submit(saveBtn)', function(data) {
85
+ if ($("#business").length > 0) {
86
+ data.field.business_id = business_select.getValue()
87
+ }
51
88
  request.put("missions/money_plan_records/" + parent.id, data.field, function(res) {
52
89
  layer.close(parent.sindex)
53
90
  parent.table.reload('money_plan_record_table')
@@ -21,6 +21,11 @@ json.data do
21
21
  else
22
22
  json.state '待认领'
23
23
  end
24
+ if d.business&.department&.school
25
+ json.property d.business.department.school.school_tags.where(for_missions: true).pluck(:name).join("、")
26
+ else
27
+ json.property ''
28
+ end
24
29
  end
25
30
  end
26
31
 
@@ -20,7 +20,7 @@ json.data do
20
20
  json.signed_date d.business&.last_follow_up&.signed_date
21
21
  json.actual_amount d.business&.last_follow_up&.actual_amount
22
22
  json.rate d.business&.last_follow_up&.actual_amount ? (d.amount / d.business.last_follow_up.actual_amount * 100.0).round(2) : ''
23
- json.staff_manages d.business&.last_follow_up&.assign_follow_ups.present? ? (d.business.last_follow_up.assign_follow_ups.map{ |d| d.staff.user.real_name}.join("、")) : d.business.staff&.user&.real_name
23
+ json.staff_manages d.business&.last_follow_up&.assign_follow_ups.present? ? (d.business.last_follow_up.assign_follow_ups.map{ |d| d.staff&.user&.real_name}.join("、")) : d.business.staff&.user&.real_name
24
24
  if d['claim_num'] > 0
25
25
  if d['return_money'].to_f >= d.amount
26
26
  json.state '已回款'
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '1.10.31'
2
+ VERSION = '1.10.33'
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: 1.10.31
4
+ version: 1.10.33
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-07-11 00:00:00.000000000 Z
11
+ date: 2023-07-13 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
@@ -758,7 +757,7 @@ homepage: https://www.educoder.net
758
757
  licenses:
759
758
  - MIT
760
759
  metadata: {}
761
- post_install_message:
760
+ post_install_message:
762
761
  rdoc_options: []
763
762
  require_paths:
764
763
  - lib
@@ -773,8 +772,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
773
772
  - !ruby/object:Gem::Version
774
773
  version: '0'
775
774
  requirements: []
776
- rubygems_version: 3.0.9
777
- signing_key:
775
+ rubygems_version: 3.0.0
776
+ signing_key:
778
777
  specification_version: 4
779
778
  summary: Summary of EducodeSales.
780
779
  test_files: []