educode_sales 1.10.33 → 1.10.34

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: 22b7976d2189b10d3280296023ca6d52fbb050307cf59d6b83c81547d5fee47e
4
- data.tar.gz: 4c81b96887d55e9bc415d2a0f0359884cb196a1dc900d9fc56b837585f6f882b
3
+ metadata.gz: 52b8f7e5581a123fa5c31a62315e82bec3319527020fa03913bffcfd1042b06e
4
+ data.tar.gz: 11e3cfc12f2f4c596d89eb4688342272eaafea877c617b5402ecc577911fcb62
5
5
  SHA512:
6
- metadata.gz: 3697ec424b22d9ed64d8aa5d8e10665c719826651441a597376170287e0b9e54b565ec6ec0d5c545755a6899f5ea9ce5d530ab92daf36a92f843ffbd9d035f47
7
- data.tar.gz: c8a57001d38e3ca5f824167565b668228de6e089be99b44bd07b92732a6971fb3aa296b2abd0f945311b01dfa019887faf7a0a1e60b1924a0560d84b7979c329
6
+ metadata.gz: 954e4d382776f70d03b3e97fac74cc2d1bd28d1abb712ca5a438910290463608a90dc52404f400e729d80085c097f50c7fd0e92e188b8b8789ee427c3b861485
7
+ data.tar.gz: 908bc050383f64a1b199f6444094b5c72fe901f2a8b28ca6e8cb950ce7b6edeec2aac2c4d5fce52f26d32f76ca4345ee1114b154f33bf89efe11714e871b9f2c
@@ -133,7 +133,19 @@ module EducodeSales
133
133
  elsif params[:q][:clazz] == 'delete_list'
134
134
  @businesses = Business.unscoped.where(state_id: [1, 3])
135
135
  elsif params[:q][:clazz] == 'plan_year'
136
- @businesses = Business.joins(:last_follow_up).where("educode_sales_follow_ups.plan_a_date > :year OR educode_sales_follow_ups.plan_return_date > :year OR educode_sales_follow_ups.invitation_at > :year", year: Time.now.beginning_of_year)
136
+ if @current_admin.is_admin?
137
+ @businesses = Business
138
+ else
139
+ # 年度计划,按负责区域和专项客户类型查看对应的年度商机
140
+ school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
141
+ if @current_admin.staff_school_tags.present?
142
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
143
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
144
+ end
145
+ @businesses = Business.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) ", school_ids.uniq)
146
+ end
147
+
148
+ @businesses = @businesses.joins(:last_follow_up).where("educode_sales_follow_ups.plan_a_date > :year OR educode_sales_follow_ups.plan_return_date > :year OR educode_sales_follow_ups.invitation_at > :year", year: Time.now.beginning_of_year)
137
149
  end
138
150
  else
139
151
  if @current_admin.is_admin?
@@ -24,7 +24,13 @@ module EducodeSales
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
26
 
27
- @return_amount = EducodeSales::MoneyPlanRecord.joins(:money_plan_claims).sum(:amount).round(2)
27
+ @return_amount = EducodeSales::MoneyPlanRecord.from("(
28
+ SELECT distinct(educode_sales_money_plan_records.id), educode_sales_money_plan_records.amount
29
+ FROM educode_sales_money_plan_records
30
+ JOIN educode_sales_money_plan_claims ON educode_sales_money_plan_claims.money_plan_record_id = educode_sales_money_plan_records.id
31
+ GROUP BY educode_sales_money_plan_records.id
32
+ ) AS educode_sales_money_plan_records
33
+ ").sum("amount").round(2)
28
34
  # @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
35
  # # @return_amount = total_return[0]['return_money']&.round(2) || 0
30
36
  # @receivable_amount = @goal_amount - @return_amount
@@ -54,7 +60,13 @@ module EducodeSales
54
60
  @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)
55
61
  # @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)
56
62
 
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)
63
+ @return_amount = EducodeSales::MoneyPlanRecord.from("(
64
+ SELECT distinct(educode_sales_money_plan_records.id), educode_sales_money_plan_records.amount, date_at
65
+ FROM educode_sales_money_plan_records
66
+ JOIN educode_sales_money_plan_claims ON educode_sales_money_plan_claims.money_plan_record_id = educode_sales_money_plan_records.id
67
+ GROUP BY educode_sales_money_plan_records.id
68
+ ) AS educode_sales_money_plan_records
69
+ ").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)
58
70
  # 往年累计已中标合同
59
71
  # @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)
60
72
  # # 往年累计已回款
@@ -56,7 +56,7 @@
56
56
  </div>
57
57
  </div>
58
58
  <div class="layui-inline">
59
- <label class="layui-form-label">项目名称</label>
59
+ <label class="layui-form-label">商机名称</label>
60
60
  <div class="layui-input-inline">
61
61
  <input type="text" class="layui-input" id="name" name="name" placeholder=" - " autocomplete="off">
62
62
  </div>
@@ -167,7 +167,7 @@
167
167
  {
168
168
  field: 'name',
169
169
  width: 160,
170
- title: '项目名称',
170
+ title: '商机名称',
171
171
  hide: gon.filter.name
172
172
  },
173
173
  {
@@ -41,7 +41,7 @@
41
41
  </div>
42
42
  </div>
43
43
  <div class="layui-col-md6">
44
- <labeL class="layui-form-label">项目名称:</labeL>
44
+ <labeL class="layui-form-label">商机名称:</labeL>
45
45
  <div class="layui-input-block">
46
46
  <div id="business_id" style="width: 600px;"></div>
47
47
  </div>
@@ -41,7 +41,7 @@
41
41
  </div>
42
42
  </div>
43
43
  <div class="layui-col-md6">
44
- <labeL class="layui-form-label">项目名称:</labeL>
44
+ <labeL class="layui-form-label">商机名称:</labeL>
45
45
  <div class="layui-input-block">
46
46
  <div id="business_id" style="width: 600px;"></div>
47
47
  </div>
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '1.10.33'
2
+ VERSION = '1.10.34'
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.33
4
+ version: 1.10.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-13 00:00:00.000000000 Z
11
+ date: 2023-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails