educode_sales 1.10.10 → 1.10.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b14ccbfcb9a5061855ca86be07cacb97c60b4775dcfa2a5df9e43ffdef76d7a
4
- data.tar.gz: 586ddfdcefed79700eb15c20ccba6b73dbe6ecee3fd12f808d614d843959f536
3
+ metadata.gz: 527f28a2fd7c3c37f33e50c8e548738f4a1cc0f3c9abdea333a0923556931111
4
+ data.tar.gz: 0bd0f7f605e9824cf213efd5cc7545da1a6bf6c27497de5379c4245b94825e9a
5
5
  SHA512:
6
- metadata.gz: fd7f2559d5a6ea7a69482dc0d4cae776e338bcaa99a30b0c303248d5f69abccfbeaf051dc3cbfcfa5b608cf718b7cef989b211f6eef52d4f3b98433b267112fb
7
- data.tar.gz: 4c04378292d11f37b2e9c29061470fcec8920c4245bdf7b3c77839e309a20f22b7d6c4ae767a2cf4d4bc37b4d693379464edfbda526b562410a5befb3837a340
6
+ metadata.gz: d6d96d56c3dce18d9af2130eb82a3027aa9df79835053064eebbf0e8a7d6403da499433f241f2890c036a5b76a4aefb1f0724cc1bfb3deaf74245838f2784665
7
+ data.tar.gz: 0d1e0bb773080e9fd5b8ebed30623fc449b4b59bb57c04d76b0f7bef5d4382dfd4d88fe4b4a508f9dee739e5ffef92dcaf55ee1ca0fbeb74e046848b877406dd
@@ -32,6 +32,10 @@ module EducodeSales
32
32
  @money_plan_records = @money_plan_records.where("payer_name like ?", "%#{params[:q][:payer_name]}%")
33
33
  end
34
34
 
35
+ if params[:q].present? && params[:q][:school].present?
36
+ @money_plan_records = @money_plan_records.joins(business: [department: :school]).where("schools.name like ?", "%#{params[:q][:school]}%")
37
+ end
38
+
35
39
  if params[:q].present? && params[:q][:date_at].present?
36
40
  date = params[:q][:date_at].split(" - ")
37
41
  @money_plan_records = @money_plan_records.where("date_at BETWEEN ? AND ?", date[0], date[1])
@@ -78,6 +82,10 @@ module EducodeSales
78
82
  gon.money_plan_ids << d.money_plan_id.to_s
79
83
  gon.money_plan_claim_amount << [d.amount]
80
84
  end
85
+
86
+ gon.edit_record = can?(:update_record, EducodeSales::MoneyPlan)
87
+ gon.edit_record_self = can?(:update_record_self, EducodeSales::MoneyPlan)
88
+ gon.staff_id = @current_admin.id
81
89
  render layout: false
82
90
  end
83
91
 
@@ -127,6 +135,7 @@ module EducodeSales
127
135
  def confirm
128
136
  money_plan_record = MoneyPlanRecord.find(params[:id])
129
137
  money_plan_record.money_plan_claims.where.not(money_plan_id: params[:money_plan_ids]).delete_all
138
+ businesses = []
130
139
  (params[:num].to_i + 1).times do |i|
131
140
  claim = money_plan_record.money_plan_claims.find_or_initialize_by(money_plan_id: params[:money_plan_ids][i])
132
141
  claim.amount = params["amount[#{i}]"]
@@ -134,8 +143,9 @@ module EducodeSales
134
143
  claim.save
135
144
  business = claim.money_plan.business
136
145
  if business
146
+ businesses << business
137
147
  money_plan_record.update(business_id: business.id)
138
- business.update(return_money: claim.money_plan.money_plan_claims.sum(:amount))
148
+ # business.update(return_money: claim.money_plan.money_plan_claims.sum(:amount))
139
149
 
140
150
 
141
151
  # # 生成跟进信息
@@ -164,10 +174,12 @@ module EducodeSales
164
174
  # business.update(last_follow_up_id: follow_up.id)
165
175
  # end
166
176
  # end
167
-
168
-
169
177
  end
170
178
  end
179
+
180
+ businesses.uniq.each do |d|
181
+ d.update(return_money: d.money_plans.joins(:money_plan_claims).sum("educode_sales_money_plan_claims.amount") )
182
+ end
171
183
  render_success
172
184
  end
173
185
 
@@ -45,7 +45,7 @@ module EducodeSales
45
45
  @staff_manages = {}
46
46
  role = EducodeSales::Role.find_by(name: '生态经理')
47
47
  EducodeSales::Common.joins(market_areas: :staff).includes(market_areas: :staff).where(clazz: '区域').where("educode_sales_staffs.role_id = #{role.id}").each do |d|
48
- @staff_manages[d.name] = d.market_areas.map { |d| d.staff&.user&.real_name }.uniq.compact
48
+ @staff_manages[d.name] = d.market_areas.map { |d| d.staff&.name }.uniq.compact
49
49
  end if role
50
50
 
51
51
  if @current_admin.is_admin?
@@ -29,13 +29,13 @@ module EducodeSales
29
29
  common = Common.find_by(clazz: 'staff_type', name: '运营')
30
30
  role = EducodeSales::Role.find_by(name: '生态经理')
31
31
  if role
32
- @staff_manage = Staff.includes(:user).where(role_id: role.id).map { |d| [d.user.real_name, d.id]}
32
+ @staff_manage = Staff.where(role_id: role.id).map { |d| [d.name, d.id]}
33
33
  else
34
34
  @staff_manage = Staff.none
35
35
  end
36
36
 
37
- @follow_upers = Staff.includes(:user).map { |d| [d.user.real_name, d.id]}
38
- @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
37
+ @follow_upers = Staff.all.map { |d| [d.name, d.id]}
38
+ @staffs = Staff.where(job_type: common.id).map { |d| [d.name, d.id]}
39
39
  @more = can?(:create, EducodeSales::OperationPlan) || can?(:update, EducodeSales::Teacher) || can?(:destroy, EducodeSales::Teacher)
40
40
  gon.menus = []
41
41
  if can?(:create, EducodeSales::OperationPlan)
@@ -69,7 +69,7 @@ module EducodeSales
69
69
  @sales_manages = {}
70
70
  role = EducodeSales::Role.find_by(name: '生态经理')
71
71
  EducodeSales::Common.joins(market_areas: :staff).includes(market_areas: :staff).where(clazz: '区域').where("educode_sales_staffs.role_id = #{role.id}").each do |d|
72
- @staff_manages[d.name] = d.market_areas.map { |d| d.staff&.user&.real_name }.uniq.compact
72
+ @staff_manages[d.name] = d.market_areas.map { |d| d.staff&.name }.uniq.compact
73
73
  end if role
74
74
 
75
75
  sales_common = EducodeSales::Common.find_by(clazz: 'staff_type', name: '销售')
@@ -10,7 +10,8 @@ module EducodeSales
10
10
  private
11
11
 
12
12
  def update_return_money
13
- self.money_plan.business.update(return_money: self.money_plan.money_plan_claims.sum(:amount))
13
+ amount = self.money_plan.business.money_plans.joins(:money_plan_claims).sum("educode_sales_money_plan_claims.amount")
14
+ self.money_plan.business.update(return_money: amount)
14
15
  end
15
16
  end
16
17
  end
@@ -20,6 +20,12 @@
20
20
  <input type="text" name="date_at" class="layui-input" id="date">
21
21
  </div>
22
22
  </div>
23
+ <div class="layui-inline">
24
+ <label class="layui-form-label">客户名称</label>
25
+ <div class="layui-input-inline">
26
+ <input type="text" name="school" class="layui-input">
27
+ </div>
28
+ </div>
23
29
  <div class="layui-inline">
24
30
  <label class="layui-form-label required">匹配状态</label>
25
31
  <div class="layui-input-inline">
@@ -27,7 +27,7 @@ json.data do
27
27
 
28
28
  assign_staff_manages = []
29
29
  d.assign_staffs.each do |assign|
30
- assign_staff_manages << assign.staff&.user&.real_name
30
+ assign_staff_manages << assign.staff&.name
31
31
  end
32
32
  json.staff_manage @staff_manages[d.department&.school&.province].present? ? (@staff_manages[d.department&.school&.province] + assign_staff_manages).uniq.join(",") : assign_staff_manages
33
33
  json.sales_manage @sales_manages[d.department&.school&.province]&.join(",")
@@ -40,7 +40,7 @@ json.data do
40
40
 
41
41
  json.majors d.department&.department_majors&.pluck(:name).present? ? d.department&.department_majors&.pluck(:name).join(",") : ""
42
42
 
43
- json.follow_person d.follow_up&.staff&.user&.real_name || ''
43
+ json.follow_person d.follow_up&.staff&.name || ''
44
44
  json.created_on d.user.present? ? d.user.created_on.to_s(:date) : ''
45
45
  json.last_login_on (d.user.present? && d.user.last_login_on.present?) ? d.user.last_login_on.to_s(:date) : ''
46
46
  json.teacher_used d.teacher_used
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '1.10.10'
2
+ VERSION = '1.10.12'
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.10
4
+ version: 1.10.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-17 00:00:00.000000000 Z
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -759,7 +759,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
759
759
  - !ruby/object:Gem::Version
760
760
  version: '0'
761
761
  requirements: []
762
- rubygems_version: 3.0.9
762
+ rubygems_version: 3.0.0
763
763
  signing_key:
764
764
  specification_version: 4
765
765
  summary: Summary of EducodeSales.