educode_sales 0.9.6 → 0.9.8

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: 2452ba0a38c51eeb2288c262c3749009e8a73482fa5bb3762cf3d8cac604f7fd
4
- data.tar.gz: c0d98a9cb2d391b3a5c4600bf317c5d47aeb0fc14d8ca95ef12a049f228a67c3
3
+ metadata.gz: ff567b174c17bc652954bfeb48e7782de31affa2fd4995a1565bfc970b1654af
4
+ data.tar.gz: 8e3cb25e06155a626a838c6f96605be47e8f8f0d7bd65351210c9fae24d2a0fa
5
5
  SHA512:
6
- metadata.gz: 523896d3267cec4e5bf9681e8d15b02af20dcdfa1fba104a8f698fffac80f0f553627480f0e8a71df4052a46b8402e92d34b0daac34005cfb347a25395b9546d
7
- data.tar.gz: f80418f62799d2ccb0c8ed839cb3c5e1aa0cb0e941f666eef5b2e596ff273ec02b5c6a0fda81154631d588bde03aabc0d6cf3a0ca10f7eac2f35f43b91e75a7d
6
+ metadata.gz: c8e37e4e9cd7ffa20ab9294d8f929dcc11a7c1ef0c385cb801bef72edf8f7b849664d3c0fa09725e7bc4c2abdd19d704a79ad6cd06d27cca389fa79551720bb9
7
+ data.tar.gz: a7ac56a8babcb87de9fef65ffcca053be0925608b345505f00e5ed26960714e8c24405af3ff2e5fe56851ed12bda269b07b348b403b92a5a2bd1da4bae6438f1
@@ -278,4 +278,20 @@ td .layui-table-cell .layui-form-select {
278
278
  .layui-form textarea:-ms-input-placeholder {
279
279
  /* Internet Explorer 10+ */
280
280
  color: #ccc;
281
+ }
282
+
283
+ .changed-true {
284
+ position: relative;
285
+ display: inline-block;
286
+ padding-left: 7px;
287
+ }
288
+ .changed-true::before {
289
+ content: " ";
290
+ width: 6px;
291
+ left: 0px;
292
+ position: absolute;
293
+ top: 10px;
294
+ height: 6px;
295
+ border-radius: 6px;
296
+ background-color: red;
281
297
  }
@@ -208,6 +208,11 @@ module EducodeSales
208
208
  ").where("educode_sales_follow_ups.invitation_at > ? AND educode_sales_follow_ups.invitation_at < ?", date[0] + '00:00:00', date[1] + '23:59:59')
209
209
  end
210
210
 
211
+ # 根据编号获取商机
212
+ if params[:q].present? && params[:q][:number].present?
213
+ @businesses = @businesses.where("number like :data", data: "%#{params[:q][:number].strip}%")
214
+ end
215
+
211
216
  if params[:sort].present? && params[:sort][:field]
212
217
  if params[:sort][:field] = "service_end_time"
213
218
  @businesses = @businesses.order("service_time_long #{params[:sort][:order]}")
@@ -82,21 +82,26 @@ module EducodeSales
82
82
  end
83
83
 
84
84
  follow_up.profit_amount = follow_up.actual_amount - (follow_up.divide_amount.to_i) if follow_up.actual_amount
85
+ last_follow_up = @business.last_follow_up
86
+ follow_up.clazz_changed = last_follow_up.clazz_id != follow_up.clazz_id if last_follow_up.present?
85
87
  if follow_up.save
86
- if @business.last_follow_up.present?
87
- @business.last_follow_up.key_person.each do |d|
88
+ if last_follow_up.present?
89
+ last_follow_up.key_person.each do |d|
88
90
  key_person = d.dup
89
91
  key_person.follow_up_id = follow_up.id
90
92
  key_person.save
91
93
  end
92
- @business.last_follow_up.money_plans.each do |d|
94
+ last_follow_up.money_plans.each do |d|
93
95
  money = d.dup
94
96
  money.staff = @current_admin
95
97
  money.follow_up_id = follow_up.id
96
98
  money.save
97
99
  end
100
+
98
101
  end
99
102
  @business.update(last_follow_up_id: follow_up.id)
103
+ # 增加o商机编号
104
+ add_business_number
100
105
  render_success
101
106
  else
102
107
  render_failure follow_up
@@ -132,6 +137,9 @@ module EducodeSales
132
137
  follow_up.assign_follow_ups = assign_follow_ups
133
138
  follow_up.profit_amount = follow_up.actual_amount - (follow_up.divide_amount.to_i) * 0.01 if follow_up.actual_amount
134
139
  if follow_up.save
140
+ # 增加o类商机
141
+ @business = follow_up.business
142
+ add_business_number
135
143
  render_success
136
144
  else
137
145
  render_failure follow_up
@@ -232,6 +240,15 @@ module EducodeSales
232
240
  @business = Business.find(params[:business_id])
233
241
  end
234
242
 
243
+ # o类商机增加编号
244
+ def add_business_number
245
+ if (@business.number.blank?) && params[:clazz_id] == '74'
246
+ totual_count = EducodeSales::Business.unscoped.where("number like :data",data: "#{Time.now.year}%").count
247
+ current_number = Time.now.year*1000 + totual_count + 1
248
+ @business.update(number: current_number.to_s)
249
+ end
250
+ end
251
+
235
252
  def follow_up_params
236
253
  params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_amount, :description, :advise, :place_id, :bidded_date, :signed_date, :year, :o_business_deployment)
237
254
  end
@@ -1,6 +1,8 @@
1
1
  module EducodeSales
2
2
  class Business < ApplicationRecord
3
3
 
4
+ validates_uniqueness_of :number ,allow_nil: true
5
+
4
6
  belongs_to :staff
5
7
  belongs_to :department
6
8
  belongs_to :last_follow_up, class_name: 'FollowUp', optional: true # 允许last_follow_up_id字段中的数为nil
@@ -1,6 +1,7 @@
1
1
  json.data do
2
2
  json.array! @businesses do |d|
3
3
  json.id d.id
4
+ json.number d.number
4
5
  json.name d.name
5
6
  json.department d.department.name
6
7
  json.school d.department.school.name
@@ -75,6 +75,12 @@
75
75
  <input type="text" class="layui-input" id="invitation_at" name="invitation_at" placeholder=" - " autocomplete="off">
76
76
  </div>
77
77
  </div>
78
+ <div class="layui-inline show_item" style="display:none;">
79
+ <label class="layui-form-label">编号</label>
80
+ <div class="layui-input-inline">
81
+ <input type="text" class="layui-input" id="number" name="number" placeholder=" - " autocomplete="off">
82
+ </div>
83
+ </div>
78
84
  <div class="layui-inline">
79
85
  <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
80
86
  </button>
@@ -266,6 +272,13 @@
266
272
  totalRowText: '合计',
267
273
  fixed: "left"
268
274
  },
275
+ {
276
+ field: 'number',
277
+ width: 120,
278
+ title: '编号',
279
+ fixed: 'left',
280
+ hide: gon.filter.number
281
+ },
269
282
  {
270
283
  field: 'name',
271
284
  width: 170,
@@ -306,7 +319,7 @@
306
319
  field: 'clazz',
307
320
  width: 80,
308
321
  title: '类型',
309
- templet: '<div><span title="{{d.clazz}}">{{d.clazz}}</span></div>',
322
+ templet: "<div><span title='{{d.clazz}}' class='changed-{{d.clazz_changed}}'>{{d.clazz}}</span></div>",
310
323
  hide: gon.filter.clazz
311
324
  },
312
325
  {
@@ -849,7 +862,7 @@
849
862
  var field = data.field;
850
863
  form.val('search_form', {
851
864
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
852
- place_id: '', date: '', area: '', invitation_at: '', business_year: ''
865
+ place_id: '', date: '', area: '', invitation_at: '', business_year: '', number: ''
853
866
  })
854
867
  business_type_list.setValue([])
855
868
  business_step_list.setValue([])
@@ -3,6 +3,7 @@ follow_count = 0
3
3
  json.data do
4
4
  json.array! @businesses do |d|
5
5
  json.id d.id
6
+ json.number d.number
6
7
  json.name d.name
7
8
  json.department d.department.name
8
9
  json.school d.department.school.name
@@ -12,6 +13,7 @@ json.data do
12
13
  follow_count += follow_ups_count
13
14
  json.follow_up_id d.last_follow_up_id
14
15
  json.clazz d.last_follow_up&.clazz&.name || ""
16
+ json.clazz_changed d.last_follow_up&.clazz_changed || false
15
17
  json.stage d.last_follow_up&.stage&.name
16
18
  json.invitation_at d.last_follow_up&.invitation_at.to_s
17
19
  json.reception_at d.last_follow_up&.reception_at.to_s
@@ -7,6 +7,14 @@
7
7
  <%= @follow_up.business.department&.school&.name %>
8
8
  </div>
9
9
  </div>
10
+ <%if @follow_up.business.number.present?%>
11
+ <div class="layui-inline">
12
+ <label class="layui-form-label">编号:</label>
13
+ <div class="layui-input-inline">
14
+ <%= @follow_up.business.number %>
15
+ </div>
16
+ </div>
17
+ <%end %>
10
18
  <div class="layui-inline">
11
19
  <label class="layui-form-label">部门:</label>
12
20
  <div class="layui-input-inline">
@@ -29,8 +29,8 @@
29
29
  </div>
30
30
  </form>
31
31
  </div>
32
- <canvas id="myChart2" width="960" height="400"></canvas>
33
-
32
+ <canvas id="myChart2" width="960" height="250"></canvas>
33
+ <canvas id="myChart2_1" width="960" height="250" style="margin-top: 30px;"></canvas>
34
34
  </div>
35
35
  </div>
36
36
  <script>
@@ -49,13 +49,13 @@
49
49
  animation: {
50
50
  duration: 1,
51
51
  onComplete: function () {
52
- var chartInstance = this.chart,
53
- ctx = chartInstance.ctx;
52
+ var chartInstance = this.chart, ctx = chartInstance.ctx;
54
53
  ctx.font = Chart.helpers.fontString(Chart.defaults.global.defaultFontSize, Chart.defaults.global.defaultFontStyle, Chart.defaults.global.defaultFontFamily);
55
54
  ctx.textAlign = 'center';
56
55
  ctx.textBaseline = 'bottom';
57
56
 
58
57
  this.data.datasets.forEach(function (dataset, i) {
58
+ ctx.fillStyle = "#444";
59
59
  var meta = chartInstance.controller.getDatasetMeta(i);
60
60
  meta.data.forEach(function (bar, index) {
61
61
  var data = dataset.data[index];
@@ -66,6 +66,20 @@
66
66
  }
67
67
  };
68
68
 
69
+ var res_data = <%=raw @goal_count_data.to_json %>;
70
+ var datasets = [];
71
+ var color = ['#44D7B6', '#4CACFF', '#F7B500', '#FF0000', '#FF7F00' ];
72
+ res_data.datasets.forEach(function(d, i) {
73
+ datasets.push({
74
+ label: d.label,
75
+ type: 'line',
76
+ data: d.data,borderColor: color[i],
77
+ pointRadius: 1,
78
+ fill: false,
79
+ lineTension: 0
80
+ })
81
+ })
82
+
69
83
  laydate.render({
70
84
  type: 'year',
71
85
  elem: '#goal_date_year',
@@ -104,6 +118,15 @@
104
118
  data: <%=raw @goal_count_data.to_json %>,
105
119
  options: opt
106
120
  });
121
+ var ctx3 = document.getElementById('myChart2_1');
122
+ var myChart3 = new Chart(ctx3, {
123
+ type: 'line',
124
+ data: {
125
+ labels: res_data.labels,
126
+ datasets: datasets
127
+ },
128
+ options: opt
129
+ });
107
130
  form.render();
108
131
  form.on("submit(search_sales)", function(data) {
109
132
  var layer_index = layer.load(0, {shade: [0.1, '#fff']});
@@ -191,7 +191,7 @@
191
191
  <h5>应收款<a href="/missions/businesses?name=(销售态势-<%=@year %>-应收款商机)" style="color: #0000FF;float: right">查看商机</a></h5>
192
192
  </div>
193
193
  <div class="panel-content y-t-10">
194
- <h1 class="no-margins"><%= @receivable_amount %>万</h1>
194
+ <h1 class="no-margins"><%= @receivable_amount.round(2) %>万</h1>
195
195
  </div>
196
196
  </div>
197
197
  </div>
@@ -0,0 +1,5 @@
1
+ class AddChangeClazzToFollowUp < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :educode_sales_follow_ups, :clazz_changed, :boolean, default: false
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.6'
2
+ VERSION = '0.9.8'
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.6
4
+ version: 0.9.8
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-09-09 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -105,6 +105,7 @@ 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
108
109
  - app/assets/images/educode_sales/loading-0.gif
109
110
  - app/assets/images/educode_sales/loading-1.gif
110
111
  - app/assets/images/educode_sales/loading-2.gif
@@ -473,6 +474,7 @@ files:
473
474
  - db/migrate/20220523023609_update_assessment_month_column_to_assessment_settings.rb
474
475
  - db/migrate/20220523101628_update_column_to_follow_ups.rb
475
476
  - db/migrate/20220827130438_create_educode_sales_login_histories.rb
477
+ - db/migrate/20220921131116_add_change_clazz_to_follow_up.rb
476
478
  - lib/educode_sales.rb
477
479
  - lib/educode_sales/engine.rb
478
480
  - lib/educode_sales/version.rb
@@ -481,7 +483,7 @@ homepage: https://www.educoder.net
481
483
  licenses:
482
484
  - MIT
483
485
  metadata: {}
484
- post_install_message:
486
+ post_install_message:
485
487
  rdoc_options: []
486
488
  require_paths:
487
489
  - lib
@@ -496,8 +498,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
496
498
  - !ruby/object:Gem::Version
497
499
  version: '0'
498
500
  requirements: []
499
- rubygems_version: 3.0.0
500
- signing_key:
501
+ rubygems_version: 3.0.9
502
+ signing_key:
501
503
  specification_version: 4
502
504
  summary: Summary of EducodeSales.
503
505
  test_files: []