educode_sales 0.9.7 → 0.9.9

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: aa0d6ecd7b1640ebee8c24dfedb2fa8aea54ebae05121178a5d7276a5e89bdcc
4
- data.tar.gz: e187d271d9f14998d6c7dbcdc82bf12f82e8f2b53b0f5fe98262f63fffa8c8c3
3
+ metadata.gz: 4d8bedbdcc700c3e37997808523860f75848a078352a86063239219a19992301
4
+ data.tar.gz: 0dd303bd7b2fc3ce8f24c3ec4300e31ef4aeec4f9a3a84f1d3b17854dcbbb20b
5
5
  SHA512:
6
- metadata.gz: 2dfd27a654570f6f321fc71cf68ed3993d3be0f24a075b3a038d4ba83473a7a5b6f957d06e6d9fc3ad6ed8bb2e06269886f98853e8421c99f1c167511cf6064c
7
- data.tar.gz: 8c589a6c2c1dee705f74167849a1ea69a4fa784193ab2b7063481d74b3114d0bb13e6cfec9b9d43c180d4a9642c4f7d6a873ee97c98db8e0f3c8c4c60e8e544a
6
+ metadata.gz: 9ef8a07852f16502421892cb9f7103e2ff428d85f2f1be25cedf1dfef984ba8953af1acddb9526b78b3d9336e4bc305124f1a0f7633173556b114eed3af89ca5
7
+ data.tar.gz: 384480cc86552819dbce83f34f4c24a28501e167c16e66625343e26c3611502a15408c3d135a0f379bdbd5197e9e48e3ad232410146429d23320058a64182a38
@@ -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]}")
@@ -100,6 +100,8 @@ module EducodeSales
100
100
 
101
101
  end
102
102
  @business.update(last_follow_up_id: follow_up.id)
103
+ # 增加o商机编号
104
+ add_business_number
103
105
  render_success
104
106
  else
105
107
  render_failure follow_up
@@ -135,6 +137,9 @@ module EducodeSales
135
137
  follow_up.assign_follow_ups = assign_follow_ups
136
138
  follow_up.profit_amount = follow_up.actual_amount - (follow_up.divide_amount.to_i) * 0.01 if follow_up.actual_amount
137
139
  if follow_up.save
140
+ # 增加o类商机
141
+ @business = follow_up.business
142
+ add_business_number
138
143
  render_success
139
144
  else
140
145
  render_failure follow_up
@@ -235,6 +240,15 @@ module EducodeSales
235
240
  @business = Business.find(params[:business_id])
236
241
  end
237
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
+
238
252
  def follow_up_params
239
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)
240
254
  end
@@ -21,8 +21,8 @@ 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
- # @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)
25
- @return_amount = total_return[0]['return_money']&.round(2) || 0
24
+ @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)
25
+ # @return_amount = total_return[0]['return_money']&.round(2) || 0
26
26
  @receivable_amount = @goal_amount - @return_amount
27
27
 
28
28
  a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id)
@@ -45,8 +45,8 @@ module EducodeSales
45
45
  s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
46
46
  @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(:total_amount).round(2)
47
47
  @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)
48
- # @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
- @return_amount = total_return[0]['return_money']&.round(2) || 0
48
+ @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
+ # @return_amount = total_return[0]['return_money']&.round(2) || 0
50
50
  @receivable_amount = @goal_amount - @return_amount
51
51
 
52
52
  a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id)
@@ -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,
@@ -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
@@ -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">
@@ -0,0 +1,6 @@
1
+ class AddColumnNumberToEducodeSalesBusinesses < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :educode_sales_businesses, :number, :string, comment: "只有o类商机才有编号 "
4
+
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.7'
2
+ VERSION = '0.9.9'
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.7
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-21 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
@@ -473,6 +473,7 @@ files:
473
473
  - db/migrate/20220523023609_update_assessment_month_column_to_assessment_settings.rb
474
474
  - db/migrate/20220523101628_update_column_to_follow_ups.rb
475
475
  - db/migrate/20220827130438_create_educode_sales_login_histories.rb
476
+ - db/migrate/20220920080302_add_column_number_to_educode_sales_businesses.rb
476
477
  - db/migrate/20220921131116_add_change_clazz_to_follow_up.rb
477
478
  - lib/educode_sales.rb
478
479
  - lib/educode_sales/engine.rb