educode_sales 1.10.12 → 1.10.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 527f28a2fd7c3c37f33e50c8e548738f4a1cc0f3c9abdea333a0923556931111
4
- data.tar.gz: 0bd0f7f605e9824cf213efd5cc7545da1a6bf6c27497de5379c4245b94825e9a
3
+ metadata.gz: b595ce61a977409f8c8fbc7147c1fa6712d50f9a3ee9196c3a558311866ae2ab
4
+ data.tar.gz: 3f942636105c5cd52c67f2d52f3da562fa7789f1377f66e0c0bf50a2484db1af
5
5
  SHA512:
6
- metadata.gz: d6d96d56c3dce18d9af2130eb82a3027aa9df79835053064eebbf0e8a7d6403da499433f241f2890c036a5b76a4aefb1f0724cc1bfb3deaf74245838f2784665
7
- data.tar.gz: 0d1e0bb773080e9fd5b8ebed30623fc449b4b59bb57c04d76b0f7bef5d4382dfd4d88fe4b4a508f9dee739e5ffef92dcaf55ee1ca0fbeb74e046848b877406dd
6
+ metadata.gz: fb5eb5e79b46a3b1286233ff1b283dad90e6c7f666c90e155fa1485f7ae44beeb031395d7199c109ac68cf04160bd674dcf913b6f37cce2ed345c5091b65ff27
7
+ data.tar.gz: 0aac91efda64a27e6b994255cb271d925f2bb70540ed72cfa14d7d5c20403f8056748e70d09658b3505da0c181d54dcd7011b0404e3d87f08ca5fb745d01933b
@@ -234,6 +234,7 @@ module EducodeSales
234
234
  @last_follow_up = @business.last_follow_up
235
235
  @deployment_type = EducodeSales::FollowUp::BUSINESS_DEPLOYMENT
236
236
  @signed_clazz = EducodeSales::FollowUp.signed_clazzs.keys
237
+ @stages = Common.where(clazz: 'business_step', name: ['已中标', '已签单', '已验收', '回款中', '服务中', '已结束']).order("position").pluck(:name, :id)
237
238
 
238
239
  signed_department = @last_follow_up.signed_department
239
240
  if signed_department
@@ -327,6 +328,7 @@ module EducodeSales
327
328
  def add_follow_ups
328
329
  @business = Business.find(params[:business_id])
329
330
  last_follow_up = @business.last_follow_up
331
+
330
332
  data = []
331
333
  6.times do |i|
332
334
  data[i] = []
@@ -527,7 +529,7 @@ module EducodeSales
527
529
 
528
530
  private
529
531
  def follow_up_params
530
- params.permit(:o_business_deployment, :plan_signed_date, :actual_amount, :bidded_days, :signed_date, :signed_department_id, :service_years, :service_start_time, :service_end_time, :funding_source, :signed_clazz)
532
+ params.permit(:o_business_deployment, :plan_signed_date, :actual_amount, :bidded_days, :signed_date, :signed_department_id, :service_years, :service_start_time, :service_end_time, :funding_source, :signed_clazz, :stage_id)
531
533
  end
532
534
 
533
535
  def product_up_params
@@ -122,7 +122,7 @@ module EducodeSales
122
122
  # @data = MoneyPlan.joins(business: [:school, :last_follow_up])
123
123
  @data = MoneyPlan.joins("JOIN educode_sales_businesses ON educode_sales_businesses.last_follow_up_id = educode_sales_money_plans.follow_up_id JOIN schools ON schools.id = educode_sales_businesses.school_id")
124
124
  if params[:q].present?
125
- @data = @data.where("educode_sales_businesses.name like :q OR educode_sales_businesses.number like :q OR schools.name like :q ", q: "%#{params[:q]}%").limit(20)
125
+ @data = @data.where.not(business_id: nil).where("educode_sales_businesses.name like :q OR educode_sales_businesses.number like :q OR schools.name like :q ", q: "%#{params[:q]}%").limit(20)
126
126
  end
127
127
  end
128
128
 
@@ -11,7 +11,7 @@ module EducodeSales
11
11
  end
12
12
  format.json do
13
13
  last_follow_up_ids = Business.all.pluck(:last_follow_up_id)
14
- @money_plans = MoneyPlan.where(follow_up_id: last_follow_up_ids).joins(:business).left_joins(:money_plan_claims).group("educode_sales_money_plans.id").select("educode_sales_money_plans.*, COUNT(educode_sales_money_plan_claims.id) AS claim_num")
14
+ @money_plans = MoneyPlan.where(follow_up_id: last_follow_up_ids).joins(:business).left_joins(:money_plan_claims).group("educode_sales_money_plans.id").select("educode_sales_money_plans.*, SUM(educode_sales_money_plan_claims.amount) AS return_money, COUNT(educode_sales_money_plan_claims.id) AS claim_num")
15
15
  if @current_admin.is_admin?
16
16
  else
17
17
  level = @current_admin.role.role_areas.find_by(clazz: '回款管理').level
@@ -12,7 +12,7 @@ module EducodeSales
12
12
 
13
13
  enum signed_clazz: ['直签', '代签', '总集', '渠道']
14
14
 
15
- enum funding_source: ['贷款资金', '财政资金', '自由资金']
15
+ enum funding_source: ['贷款资金', '财政资金', '自有资金']
16
16
 
17
17
  include ::Deletable
18
18
  belongs_to :business, counter_cache: true # counter_cache(自动计算 business对应follow_up表中对应的个数)
@@ -32,7 +32,7 @@
32
32
  <div class="layui-inline">
33
33
  <label class="layui-form-label">项目阶段:</label>
34
34
  <div class="layui-input-inline" style="line-height: 38px;">
35
- <%= @last_follow_up&.stage&.name%>
35
+ <%= select_tag "stage_id", options_for_select(@stages, @last_follow_up&.stage_id), { 'lay-filter': 'stage_id', class: 'required' } %>
36
36
  </div>
37
37
  </div>
38
38
  <div class="layui-inline">
@@ -102,6 +102,14 @@
102
102
  width: 120,
103
103
  sort: true,
104
104
  title: '金额',
105
+ }, {
106
+ field: 'return_money',
107
+ width: 120,
108
+ title: '已回款',
109
+ }, {
110
+ field: 'residue_money',
111
+ width: 120,
112
+ title: '未回款',
105
113
  }, {
106
114
  field: 'rate',
107
115
  width: 100,
@@ -22,13 +22,20 @@ json.data do
22
22
  json.rate d.business&.last_follow_up&.actual_amount ? (d.amount / d.business.last_follow_up.actual_amount * 100.0).round(2) : ''
23
23
  json.staff_manages d.business&.last_follow_up&.assign_follow_ups.present? ? (d.business.last_follow_up.assign_follow_ups.map{ |d| d.staff.user.real_name}.join("、")) : d.business.staff&.user&.real_name
24
24
  if d['claim_num'] > 0
25
- json.state '已回款'
25
+ if d['return_money'].to_f >= d.amount
26
+ json.state '已回款'
27
+ else
28
+ json.state '部分回款'
29
+ end
26
30
  elsif d['claim_num'] == 0 && d.date_at > Time.now
27
31
  json.state '正常'
28
32
  else
29
33
  json.state '已逾期'
30
34
  end
31
35
  json.claim_num d['claim_num']
36
+
37
+ json.return_money d['return_money'] || 0
38
+ json.residue_money (d.amount - d['return_money'].to_f) > 0 ? d.amount - d['return_money'].to_f : 0
32
39
  if d['claim_num'] > 0
33
40
  json.accounts_state ''
34
41
  else
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '1.10.12'
2
+ VERSION = '1.10.14'
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.12
4
+ version: 1.10.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2023-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails