educode_sales 1.10.12 → 1.10.13

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: 527f28a2fd7c3c37f33e50c8e548738f4a1cc0f3c9abdea333a0923556931111
4
- data.tar.gz: 0bd0f7f605e9824cf213efd5cc7545da1a6bf6c27497de5379c4245b94825e9a
3
+ metadata.gz: e1f2900e20d8d02f6f0fbaa6a05a857523a48ddbc6bf5109490b3a03c867dbc0
4
+ data.tar.gz: 7315b80cdbb66086120ca83a0e3727c3c7b75ec926c842001f7516379423a560
5
5
  SHA512:
6
- metadata.gz: d6d96d56c3dce18d9af2130eb82a3027aa9df79835053064eebbf0e8a7d6403da499433f241f2890c036a5b76a4aefb1f0724cc1bfb3deaf74245838f2784665
7
- data.tar.gz: 0d1e0bb773080e9fd5b8ebed30623fc449b4b59bb57c04d76b0f7bef5d4382dfd4d88fe4b4a508f9dee739e5ffef92dcaf55ee1ca0fbeb74e046848b877406dd
6
+ metadata.gz: 3f3cb902472a53c44add57b45c082f7f42ba04e18e07d84f8a903a04f3395fc24ed759bd90d315ebb2e73055399f61648bcf23620232badc46f131ac4782cafa
7
+ data.tar.gz: 91b19a1cbfa4770b4e78e9347a47ed0b14412b00d3c1f66663b560b714133ba6aa5faedf16e38cb3e520562041185081f90c35b8cc5751bfeb8595d3384633d0
@@ -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
@@ -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.13'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460