educode_sales 0.9.28 → 0.9.30

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: dae94f7427cfade72ce95b294b3fd759d975b369282d929a11aebd884168a2ca
4
- data.tar.gz: ff21e034b9dc3cc0a8f6e956d62ea3f604f87644b004715fee5044626f175775
3
+ metadata.gz: 51800df7e8c3e444188f0353c66757741c5a99e710426b47da2e9593c65f819f
4
+ data.tar.gz: 89735f6378821ee46fc806198a24559015440a0047ee6fc4ca27f8d364b69755
5
5
  SHA512:
6
- metadata.gz: d7e1ea6e2c957bd4811b77dae36106f8e43fb5cbcc4463297922bb419bd937745520bd02914ebb9aed342441793bf61b8bdf88a52e7599ae9101e42d1a10ca7e
7
- data.tar.gz: c31ad80e5afda10b9b74a26fb8e1f6966e9823b44599c84bc46ce2215cf78377b3d29da900bd43088316ea689053cbae9da4da57d31b5e77f17506619234fa22
6
+ metadata.gz: 6f967ae4f53c7819b02f3f006a9309434b41b5d22474504464b6e22f3a5469c810a24e221e82468b642240dd81e320b019cd45f0a018e9d94fda99fa646245c5
7
+ data.tar.gz: 65c325fc5d46fcfdb7ec964881ab0fb832857d428a10241fced792709871c9092ce907c5f74cc23581e2f8776a972a7f3f32d17343a2d377a4b2597610d4f65c
@@ -264,11 +264,11 @@ module EducodeSales
264
264
  (last_follow.total_amount - last_follow.actual_amount) as divide_money,
265
265
  (last_follow.actual_amount - educode_sales_businesses.return_money) as wait_return_money,
266
266
  last_follow.total_amount,
267
- total_follow_ups.follow_ups_count
267
+ total_follow_ups.follow_ups_counts
268
268
  ").joins("
269
269
  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
270
270
  LEFT JOIN (
271
- SELECT COUNT(*) AS follow_ups_count, educode_sales_follow_ups.business_id
271
+ SELECT COUNT(*) AS follow_ups_counts, educode_sales_follow_ups.business_id
272
272
  FROM educode_sales_follow_ups
273
273
  WHERE educode_sales_follow_ups.deleted_at IS NULL
274
274
  GROUP BY educode_sales_follow_ups.business_id
@@ -117,7 +117,8 @@ module EducodeSales
117
117
  when "week" #按周
118
118
  if params[:date_week].present?
119
119
  date = params[:date_week].split(" - ")
120
- dates = (date[0].to_date..date[1].to_date).map { |d| d.strftime("%Y-%W") }.uniq
120
+ # 年初第一天周数是0会导致周数重复计算
121
+ dates = (date[0].to_date..date[1].to_date).map { |d| d.strftime("%Y-%W") }.uniq.select { |d| d.split("-")[1] != '00' }
121
122
  @follow_count_data = business_followup_charts(dates, names, x_business_ids, SaleTrend::COLORS, date, "%Y%u") do |dates|
122
123
  dates.map { |date|
123
124
  d = date.split("-")
@@ -190,6 +191,9 @@ module EducodeSales
190
191
  when "month" #按月
191
192
  if params[:goal_date_month].present?
192
193
  date = params[:goal_date_month].split(" - ")
194
+ date[0] = (date[0] + "-01").to_date.to_s
195
+ date[1] = (date[1] + "-01").to_date.end_of_month.to_s
196
+
193
197
  dates = ((date[0] + "-01").to_date..(date[1] + "-01").to_date).map { |d| d.strftime("%Y-%m") }.uniq
194
198
  @goal_count_data = month_sale_chart(dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, date)
195
199
  else
@@ -414,11 +418,9 @@ module EducodeSales
414
418
 
415
419
 
416
420
  def month_sale_chart(dates, names, colors, x, stage_ids, s_stage_ids, count_type, range)
417
- begin_at = range[0].split("-")
418
- end_at = range[1].split("-")
421
+ begin_at = range[0]
422
+ end_at = range[1]
419
423
 
420
- begin_at = DateTime.new begin_at[0].to_i, begin_at[1].to_i
421
- end_at = DateTime.new end_at[0].to_i, end_at[1].to_i
422
424
  data_1 = EducodeSales::Business.joins(:last_follow_up).
423
425
  where("educode_sales_follow_ups.clazz_id != ?", x).
424
426
  where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).
@@ -531,8 +533,8 @@ module EducodeSales
531
533
  def year_sale_chart(dates, names, colors, x, stage_ids, s_stage_ids, count_type, range)
532
534
  begin_at = range[0].split("-")
533
535
  end_at = range[1].split("-")
534
- begin_at = DateTime.new(begin_at[0].to_i).beginning_of_year
535
- end_at = DateTime.new(end_at[0].to_i).end_of_year
536
+ begin_at = DateTime.new(begin_at[0].to_i).beginning_of_year.to_date.to_s
537
+ end_at = DateTime.new(end_at[0].to_i).end_of_year.to_date.to_s
536
538
 
537
539
  data_1 = EducodeSales::Business.joins(:last_follow_up).
538
540
  where("educode_sales_follow_ups.clazz_id != ?", x).
@@ -29,7 +29,7 @@ module EducodeSales
29
29
 
30
30
  def self.include_types(type)
31
31
  {
32
- '1' => %w[a_class b_class c_class d_class e_class o_class],
32
+ '1' => %w[a_class b_class c_class d_class e_class],
33
33
  'a' => ['a_class'],
34
34
  'b' => ['b_class'],
35
35
  }[type]
@@ -80,7 +80,7 @@
80
80
  <div class="layui-inline">
81
81
  <label class="layui-form-label">中标额(万)</label>
82
82
  <div class="layui-input-inline">
83
- <input name="total_amount" type="number" class="layui-input" value="<%= @follow_up.total_amount %>">
83
+ <input name="total_amount" type="number" class="layui-input" value="<%= @follow_up.total_amount.to_f.round(6) %>">
84
84
  </div>
85
85
  客户采购支出的费用。中标额的生命历程:1.在最初阶段,是商机的预算总额;2.在挂网阶段,是项目的挂网预算总额;3.在中标阶段,是项目的中标总额。
86
86
  </div>
@@ -88,7 +88,7 @@
88
88
  <div class="layui-inline">
89
89
  <label class="layui-form-label">合同额(万)</label>
90
90
  <div class="layui-input-inline">
91
- <input name="actual_amount" type="number" class="layui-input" placeholder="本单位的签单金额" value="<%= @follow_up.actual_amount %>">
91
+ <input name="actual_amount" type="number" class="layui-input" placeholder="本单位的签单金额" value="<%= @follow_up.actual_amount.to_f.round(6) %>">
92
92
  </div>
93
93
  客户签给头歌的费用。合同额的生命历程:1.在中标之前,合同额都是0;2.在中标之后,实际与头歌签合同的金额。
94
94
  </div>
@@ -103,7 +103,7 @@
103
103
  <div class="layui-inline">
104
104
  <label class="layui-form-label">渠道分成(万)</label>
105
105
  <div class="layui-input-inline">
106
- <input name="divide_amount" class="layui-input" value="<%= @follow_up.divide_amount%>">
106
+ <input name="divide_amount" class="layui-input" value="<%= @follow_up.divide_amount.to_f.round(6) %>">
107
107
  </div>
108
108
  中标额里,渠道拿到的部分。
109
109
  </div>
@@ -111,7 +111,7 @@
111
111
  <div class="layui-inline">
112
112
  <label class="layui-form-label">预算金额(万)</label>
113
113
  <div class="layui-input-inline">
114
- <input name="budget_amount" class="layui-input" value="<%= @last_follow_up&.budget_amount.to_f.round(2) %>">
114
+ <input name="budget_amount" class="layui-input" value="<%= @last_follow_up&.budget_amount.to_f.round(6) %>">
115
115
  </div>
116
116
  </div>
117
117
  <div class="layui-form-item">
@@ -8,7 +8,7 @@ json.data do
8
8
  json.department d.department.name
9
9
  json.school d.department.school.name
10
10
  json.school_id d.department.school.id
11
- follow_ups_count = d['follow_ups_count'] || 0
11
+ follow_ups_count = d['follow_ups_counts'] || 0
12
12
  json.follow_ups_count follow_ups_count
13
13
  follow_count += follow_ups_count
14
14
  json.follow_up_id d.last_follow_up_id
@@ -23,8 +23,8 @@ json.data do
23
23
  json.service_end_time d.last_follow_up&.service_start_time.to_s + "-" + d.last_follow_up&.service_end_time.to_s
24
24
 
25
25
  json.divide_rate d.divide_rate
26
- json.divide_money d.divide_amount
27
- json.budget_amount d.budget_amount #d.follow_ups.where(stage_id: @budget_stage_ids).order("created_at desc").first&.total_amount&.round(2) || 0
26
+ json.divide_money d.divide_amount.to_f.round(2)
27
+ json.budget_amount d.budget_amount.to_f.round(2) #d.follow_ups.where(stage_id: @budget_stage_ids).order("created_at desc").first&.total_amount&.round(2) || 0
28
28
  json.area d.department.school.province
29
29
  school_property = d.department.school.school_property
30
30
  property = []
@@ -87,7 +87,7 @@
87
87
  <label class="layui-form-label">中标额(万)</label>
88
88
  <div class="layui-input-inline">
89
89
  <input name="total_amount" type="number" class="layui-input" autocomplete="off"
90
- value="<%= @last_follow_up&.total_amount.to_f.round(2) %>">
90
+ value="<%= @last_follow_up&.total_amount.to_f.round(6) %>">
91
91
  </div>
92
92
  客户采购支出的费用。中标额的生命历程:1.在最初阶段,是商机的预算总额;2.在挂网阶段,是项目的挂网预算总额;3.在中标阶段,是项目的中标总额。
93
93
  </div>
@@ -96,7 +96,7 @@
96
96
  <label class="layui-form-label">合同额(万)</label>
97
97
  <div class="layui-input-inline">
98
98
  <input name="actual_amount" type="number" class="layui-input" autocomplete="off" placeholder="本单位的签单金额"
99
- value="<%= @last_follow_up&.actual_amount.to_f.round(2) %>">
99
+ value="<%= @last_follow_up&.actual_amount.to_f.round(6) %>">
100
100
  </div>
101
101
  客户签给头歌的费用。合同额的生命历程:1.在中标之前,合同额都是0;2.在中标之后,实际与头歌签合同的金额。
102
102
  </div>
@@ -111,7 +111,7 @@
111
111
  <div class="layui-inline">
112
112
  <label class="layui-form-label">渠道分成(万)</label>
113
113
  <div class="layui-input-inline">
114
- <input name="divide_amount" class="layui-input" value="<%= @last_follow_up&.divide_amount.to_f.round(2) %>">
114
+ <input name="divide_amount" class="layui-input" value="<%= @last_follow_up&.divide_amount.to_f.round(6) %>">
115
115
  </div>
116
116
  中标额里,渠道拿到的部分。
117
117
  </div>
@@ -119,7 +119,7 @@
119
119
  <div class="layui-inline">
120
120
  <label class="layui-form-label">预算金额(万)</label>
121
121
  <div class="layui-input-inline">
122
- <input name="budget_amount" class="layui-input" value="<%= @last_follow_up&.budget_amount.to_f.round(2) %>">
122
+ <input name="budget_amount" class="layui-input" value="<%= @last_follow_up&.budget_amount.to_f.round(6) %>">
123
123
  </div>
124
124
  </div>
125
125
  <div class="layui-form-item">
@@ -83,13 +83,13 @@
83
83
  <div class="layui-inline">
84
84
  <label class="layui-form-label">中标额:</label>
85
85
  <div class="layui-input-inline">
86
- <%= @follow_up.total_amount.to_f.round(2) %>万
86
+ <%= @follow_up.total_amount.to_f.round(6) %>万
87
87
  </div>
88
88
  </div>
89
89
  <div class="layui-inline">
90
90
  <label class="layui-form-label">合同额:</label>
91
91
  <div class="layui-input-inline">
92
- <%= @follow_up.actual_amount.to_f.round(2) %>万
92
+ <%= @follow_up.actual_amount.to_f.round(6) %>万
93
93
  </div>
94
94
  </div>
95
95
  <br>
@@ -99,12 +99,19 @@
99
99
  <%= @follow_up.place&.name %>
100
100
  </div>
101
101
  </div>
102
- <!-- <div class="layui-inline">
102
+ <div class="layui-inline">
103
103
  <label class="layui-form-label">渠道分成:</label>
104
104
  <div class="layui-input-inline">
105
- <%= @follow_up.divide_amount.to_f.round(2) %>万
105
+ <%= @follow_up.divide_amount.to_f.round(6) %>万
106
+ </div>
107
+ </div>
108
+ <br/>
109
+ <div class="layui-inline">
110
+ <label class="layui-form-label">预算金额:</label>
111
+ <div class="layui-input-inline">
112
+ <%= @follow_up.budget_amount.to_f.round(6) %>万
106
113
  </div>
107
- </div> -->
114
+ </div>
108
115
  <div class="layui-inline">
109
116
  <label class="layui-form-label">分成比例:</label>
110
117
  <div class="layui-input-inline">
@@ -1,6 +1,7 @@
1
1
  json.data do
2
2
  json.array! @money_plans do |d|
3
- json.(d, :id, :amount, :clazz)
3
+ json.(d, :id, :clazz)
4
+ json.amount d.amount.to_f.round(6)
4
5
  json.date_at d.date_at.present? ? d.date_at.to_s(:date) : ''
5
6
  end
6
7
  end
@@ -54,11 +54,11 @@
54
54
  function renderTable(chart_data) {
55
55
  var labels = [];
56
56
  fields = [
57
- {field: 'col0', title: '姓名', width:100}
57
+ {field: 'col0', title: '姓名', width:100, totalRowText: '合计:'}
58
58
  ];
59
59
  chart_data.labels.forEach(function(d, i) {
60
60
  labels.push(d);
61
- fields.push({title: d.split("(").join("<br/>").replace(")", ""), field: 'col' + (i + 1), width:160, align: 'center'})
61
+ fields.push({title: d.split("(").join("<br/>").replace(")", ""), field: 'col' + (i + 1), width:180, align: 'center', sort: true, totalRow: '{{ parseInt(d.TOTAL_NUMS) }}'})
62
62
  })
63
63
  var table_data = [];
64
64
  chart_data.datasets.forEach(function(d, i) {
@@ -78,6 +78,7 @@
78
78
  url: '',
79
79
  limit: 1000,
80
80
  page: false,
81
+ totalRow: true,
81
82
  data: table_data,
82
83
  cols: [fields]
83
84
  });
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.28'
2
+ VERSION = '0.9.30'
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.28
4
+ version: 0.9.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails