educode_sales 0.9.15 → 0.9.16
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6356a47918d891333b14e6db67f9e7fbf45ff008c04cb06ec89f7a5ea1dd34cf
|
4
|
+
data.tar.gz: 55aaca16b358087288298d0abbaf579340b4dd5dc2b53b39c4a6d1cb80b31c26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f8f2febaa9f93c3ce44766b4ddc45930db17c21c405ebe542f0e7c4ca862c6f3c7840c5b02b5e06efdea128411ef8ab40cb64105f3f32cde31aeafe35e9afea
|
7
|
+
data.tar.gz: 8556d4243ffc1208725c7ec4e7a59f83b11088d9b064b20d36ba238a05e90536ac885cc53c76dd8e1b9f79f3e5290fa00ff9b9c20bfcb0b4d104d6fa8adb496d
|
@@ -97,7 +97,7 @@ module EducodeSales
|
|
97
97
|
|
98
98
|
end
|
99
99
|
|
100
|
-
if params[:q].present? && params[:q][:name].present? &&
|
100
|
+
if params[:q].present? && params[:q][:name].present? && params[:q][:name] == "(销售态势-" + @year + "-已中标商机)"
|
101
101
|
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
102
102
|
if @year == '全部'
|
103
103
|
@businesses = @businesses.joins("
|
@@ -136,6 +136,21 @@ module EducodeSales
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
+
if params[:q].present? && params[:q][:name].present? && params[:q][:name] == "(销售态势-" + @year + "-应收款商机)"
|
140
|
+
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
141
|
+
if @year == '全部'
|
142
|
+
@businesses = @businesses.joins("
|
143
|
+
JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
|
144
|
+
").where("educode_sales_follow_ups.stage_id IN (?)", stage_ids)
|
145
|
+
else
|
146
|
+
@businesses = @businesses.joins("
|
147
|
+
JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
|
148
|
+
").where("educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-12-31", stage_ids)
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
|
139
154
|
if params[:q].present? && params[:q][:all].present?
|
140
155
|
@businesses = @businesses
|
141
156
|
end
|
@@ -249,7 +264,7 @@ module EducodeSales
|
|
249
264
|
(last_follow.actual_amount - educode_sales_businesses.return_money) as wait_return_money,
|
250
265
|
last_follow.total_amount
|
251
266
|
").joins("
|
252
|
-
LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id
|
267
|
+
LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id AND last_follow.deleted_at IS NULL
|
253
268
|
").page(params[:page]).per(params[:limit])
|
254
269
|
|
255
270
|
end
|
@@ -480,7 +495,7 @@ module EducodeSales
|
|
480
495
|
|
481
496
|
end
|
482
497
|
|
483
|
-
if params[:name].present? &&
|
498
|
+
if params[:name].present? && params[:name] == "(销售态势-" + @year + "-已中标商机)"
|
484
499
|
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
485
500
|
if @year == '全部'
|
486
501
|
@businesses = @businesses.joins("
|
@@ -494,6 +509,20 @@ module EducodeSales
|
|
494
509
|
|
495
510
|
end
|
496
511
|
|
512
|
+
if params[:name].present? && params[:name] == "(销售态势-" + @year + "-应收款商机)"
|
513
|
+
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
514
|
+
if @year == '全部'
|
515
|
+
@businesses = @businesses.joins("
|
516
|
+
JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
|
517
|
+
").where("educode_sales_follow_ups.stage_id IN (?)",stage_ids)
|
518
|
+
else
|
519
|
+
@businesses = @businesses.joins("
|
520
|
+
JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
|
521
|
+
").where("educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-12-31", stage_ids)
|
522
|
+
end
|
523
|
+
|
524
|
+
end
|
525
|
+
|
497
526
|
if params[:name].present? && params[:name] == "(销售态势-" + @year + "-已签单商机)"
|
498
527
|
s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
499
528
|
if @year == '全部'
|
@@ -615,7 +644,7 @@ module EducodeSales
|
|
615
644
|
last_follow.actual_amount,
|
616
645
|
(last_follow.actual_amount - educode_sales_businesses.return_money) as wait_return_money,
|
617
646
|
last_follow.total_amount").joins("
|
618
|
-
LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id
|
647
|
+
LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id AND last_follow.deleted_at IS NULL
|
619
648
|
")
|
620
649
|
end
|
621
650
|
end
|
@@ -21,9 +21,13 @@ module EducodeSales
|
|
21
21
|
s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
|
22
22
|
@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)
|
23
23
|
@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)
|
24
|
-
|
25
|
-
# @return_amount =
|
26
|
-
@
|
24
|
+
|
25
|
+
# @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
|
+
# # @return_amount = total_return[0]['return_money']&.round(2) || 0
|
27
|
+
# @receivable_amount = @goal_amount - @return_amount
|
28
|
+
|
29
|
+
@receivable_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).select("(SUM(educode_sales_follow_ups.actual_amount) - SUM(educode_sales_businesses.return_money)) AS num")
|
30
|
+
@receivable_amount = @receivable_amount.present? && @receivable_amount[0]['num'] ? @receivable_amount[0]['num'].round(2) : 0
|
27
31
|
|
28
32
|
a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id)
|
29
33
|
@a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).sum(:total_amount).round(2)
|
@@ -48,10 +52,13 @@ module EducodeSales
|
|
48
52
|
@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)
|
49
53
|
|
50
54
|
# 往年累计已中标合同
|
51
|
-
@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)
|
52
|
-
# 往年累计已回款
|
53
|
-
@former_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 <= ? ", year_over_time).sum(:amount).round(2)
|
54
|
-
@receivable_amount = @former_goal_amount - @former_return_amount
|
55
|
+
# @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)
|
56
|
+
# # 往年累计已回款
|
57
|
+
# @former_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 <= ? ", year_over_time).sum(:amount).round(2)
|
58
|
+
# @receivable_amount = @former_goal_amount - @former_return_amount
|
59
|
+
|
60
|
+
@receivable_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).select("(SUM(educode_sales_follow_ups.actual_amount) - SUM(educode_sales_businesses.return_money)) AS num")
|
61
|
+
@receivable_amount = @receivable_amount.present? && @receivable_amount[0]['num'] ? @receivable_amount[0]['num'].round(2) : 0
|
55
62
|
|
56
63
|
a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id)
|
57
64
|
@a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
|
@@ -176,7 +183,7 @@ module EducodeSales
|
|
176
183
|
|
177
184
|
goal_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y-%m") }.uniq
|
178
185
|
sale_names = ['已中标', '已签单', '已回款']
|
179
|
-
|
186
|
+
|
180
187
|
if params[:goal_count_range].present?
|
181
188
|
case params[:goal_count_range]
|
182
189
|
when "week"
|
@@ -572,7 +579,7 @@ module EducodeSales
|
|
572
579
|
if last_month != month.split("-")[0]
|
573
580
|
last_sum = 0
|
574
581
|
end
|
575
|
-
|
582
|
+
|
576
583
|
data_3_total_hash[month] = (data_3_hash[month] || 0) + last_sum
|
577
584
|
last_sum += data_3_hash[month] || 0
|
578
585
|
last_month = month.split("-")[0]
|
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.
|
4
|
+
version: 0.9.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-22 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
|
@@ -487,7 +486,7 @@ homepage: https://www.educoder.net
|
|
487
486
|
licenses:
|
488
487
|
- MIT
|
489
488
|
metadata: {}
|
490
|
-
post_install_message:
|
489
|
+
post_install_message:
|
491
490
|
rdoc_options: []
|
492
491
|
require_paths:
|
493
492
|
- lib
|
@@ -502,8 +501,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
502
501
|
- !ruby/object:Gem::Version
|
503
502
|
version: '0'
|
504
503
|
requirements: []
|
505
|
-
rubygems_version: 3.0.
|
506
|
-
signing_key:
|
504
|
+
rubygems_version: 3.0.0
|
505
|
+
signing_key:
|
507
506
|
specification_version: 4
|
508
507
|
summary: Summary of EducodeSales.
|
509
508
|
test_files: []
|
Binary file
|