educode_sales 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/businesses_controller.rb +1 -1
  3. data/app/controllers/educode_sales/invoices_controller.rb +219 -0
  4. data/app/controllers/educode_sales/money_plan_records_controller.rb +13 -0
  5. data/app/controllers/educode_sales/sale_trends_controller.rb +2 -2
  6. data/app/models/educode_sales/business.rb +4 -0
  7. data/app/models/educode_sales/invoice.rb +5 -0
  8. data/app/models/educode_sales/invoice_apply.rb +12 -0
  9. data/app/models/educode_sales/invoice_detail.rb +10 -0
  10. data/app/models/educode_sales/staff.rb +2 -0
  11. data/app/views/educode_sales/contracts/_list.html.erb +1 -1
  12. data/app/views/educode_sales/invoices/_apply_records.html.erb +276 -0
  13. data/app/views/educode_sales/invoices/apply.html.erb +443 -0
  14. data/app/views/educode_sales/invoices/apply_records.js.erb +1 -0
  15. data/app/views/educode_sales/invoices/apply_records.json.jbuilder +20 -0
  16. data/app/views/educode_sales/invoices/details.json.jbuilder +17 -0
  17. data/app/views/educode_sales/invoices/list.json.jbuilder +14 -0
  18. data/app/views/educode_sales/invoices/new.html.erb +177 -0
  19. data/app/views/educode_sales/invoices/sales_details.html.erb +88 -0
  20. data/app/views/educode_sales/invoices/sales_details.json.jbuilder +14 -0
  21. data/app/views/educode_sales/money_plan_records/_index.html.erb +35 -8
  22. data/app/views/educode_sales/money_plans/_index.html.erb +138 -169
  23. data/app/views/educode_sales/money_plans/list.html.erb +2 -1
  24. data/app/views/layouts/educode_sales/application.html.erb +245 -236
  25. data/config/routes.rb +16 -0
  26. data/db/migrate/20230531144834_create_educode_sales_invoice_applies.rb +25 -0
  27. data/db/migrate/20230601011835_create_educode_sales_invoices.rb +14 -0
  28. data/db/migrate/20230601011943_create_educode_sales_invoice_details.rb +20 -0
  29. data/lib/educode_sales/version.rb +1 -1
  30. metadata +19 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea14dcf8c116d91d0a273c02cd36f2d064cc48fe93cfd6024de598db56b0b21b
4
- data.tar.gz: 0f796a9a5a15726bf97ccd161b0144d8be7d5b6d10b11f3763047ad4253dbb67
3
+ metadata.gz: b46afaa19173f871423665f95aafafb3443518ad51810efb33b76d6d00d4c162
4
+ data.tar.gz: 43aa8f04c71a2ab4d9dc0cdcbc75f2171ab3f27b30c3732d0ffaacf6d1cf4503
5
5
  SHA512:
6
- metadata.gz: ddefae214a2fb34bd44c7d9e7a0166ec5fa353b604643d617cba26687c3e806d0617d96b0ae892e366561005e7e133ea8649618eebe44c14f2521804829dc9b7
7
- data.tar.gz: 835634d2f2f94ed809a372f299da738d9e45f67ddf9461e5fa5e76a7d0eb0fda73a491f838ffeedb5c1a771ec21c813591cb5d6262d11761728c6daf5599aded
6
+ metadata.gz: e2eeb2350a2fe54a6f4e01cfc40369538ba69dea82e74a5f95543e188b313975f5a7021cdc7da84d27a83993bda4161fc184a07f53eed4ae9f608c8f89b8bbd3
7
+ data.tar.gz: 0604716ff8a63448d01c579f4321e3e7699429f35b9dfec7d0f5c291dec9aca57e4abb5b8ffc16d4b9f2a5931f3c01d63f1f0dcba5362459eb8cd1da444f1997
@@ -384,7 +384,7 @@ module EducodeSales
384
384
  end
385
385
 
386
386
  def daily_paper
387
- @followups = EducodeSales::FollowUp.where(staff_id: @current_admin.id).where("updated_at > ?", Time.now.beginning_of_day).order("updated_at")
387
+ @followups = EducodeSales::FollowUp.where(staff_id: @current_admin.id).where("created_at > ?", Time.now.beginning_of_day).order("created_at")
388
388
  ab = EducodeSales::Common.where(extras: [EducodeSales::Common::ATYPE, EducodeSales::Common::BTYPE]).pluck(:id)
389
389
  business = EducodeSales::FollowUp.joins("
390
390
  JOIN educode_sales_businesses ON educode_sales_businesses.id = educode_sales_follow_ups.business_id
@@ -0,0 +1,219 @@
1
+ require_dependency "educode_sales/application_controller"
2
+
3
+ module EducodeSales
4
+ class InvoicesController < ApplicationController
5
+
6
+ def index
7
+ end
8
+
9
+ def apply
10
+ render layout: false
11
+ end
12
+
13
+ def create_apply
14
+ business = Business.find(params[:business_id])
15
+ count = EducodeSales::InvoiceApply.where("created_at > ?", Time.now.beginning_of_day).size + 1
16
+ invoice_apply = InvoiceApply.find_or_initialize_by(business_id: business.id) do |d|
17
+ d.number = Time.now.strftime("%y%m%d").gsub("-", "") + rand(10..99).to_s + ("%04d" % count)
18
+ d.state = '审核中'
19
+ end
20
+ invoice_apply.staff = @current_admin
21
+ invoice_apply.assign_attributes(apply_params)
22
+ ActiveRecord::Base.transaction do
23
+ invoice_apply.save!
24
+ params[:details].each do |d|
25
+ detail = invoice_apply.invoice_details.new({
26
+ sale_detail_id: d['id'],
27
+ specification: d['specification'],
28
+ business_id: business.id,
29
+ unit: d['unit'],
30
+ category: d['category'],
31
+ state: '待开票',
32
+ name: d['name'],
33
+ num: d['num'],
34
+ price: d['price'],
35
+ amount: d['amount']})
36
+ detail.save!
37
+ end
38
+ end
39
+ render_success
40
+ end
41
+
42
+ def details
43
+ business = Business.find(params[:id])
44
+ invoice_apply = business.invoice_apply
45
+ if invoice_apply
46
+ if params[:state].present?
47
+ @data = invoice_apply.invoice_details.where(state: params[:state])
48
+ else
49
+ @data = invoice_apply.invoice_details
50
+ end
51
+ else
52
+ @data = InvoiceDetail.none
53
+ end
54
+ @data = @data.page(params[:page]).per(params[:limit])
55
+ end
56
+
57
+ def sales_details
58
+ respond_to do |format|
59
+ format.html do
60
+ render layout: false
61
+ end
62
+ format.json do
63
+ business = Business.find(params[:id])
64
+ @data = business.sales_details.page(params[:page]).per(params[:limit])
65
+ end
66
+ end
67
+ end
68
+
69
+ def invoice_amount
70
+ business = Business.find(params[:id])
71
+ render json: {
72
+ actual_amount: business&.last_follow_up&.actual_amount,
73
+ invoice_pass: business&.invoice_details&.sum(:amount),
74
+ invoice_category: business&.invoice_apply&.category || '',
75
+ is_tax_rebate: business&.invoice_apply&.is_tax_rebate.to_s,
76
+ ticket_at: business&.invoice_apply&.ticket_at || '',
77
+ name: business&.invoice_apply&.name || '',
78
+ taxpaper_number: business&.invoice_apply&.taxpaper_number || '',
79
+ address: business&.invoice_apply&.address || '',
80
+ phone: business&.invoice_apply&.phone || '',
81
+ bank: business&.invoice_apply&.bank || '',
82
+ bank_number: business&.invoice_apply&.bank_number || '',
83
+ }
84
+ end
85
+
86
+
87
+ def apply_records
88
+ respond_to do |format|
89
+ format.html do
90
+ end
91
+ format.js do
92
+ @staffs = Staff.joins(:invoice_applys).includes(:user).distinct.map { |d| [d.user.real_name, d.id]}
93
+ end
94
+ format.json do
95
+ @data = InvoiceApply
96
+
97
+ unless @current_admin.is_admin?
98
+ @data = @data.left_joins(business: [last_follow_up: :assign_follow_ups]).where("educode_sales_assign_follow_ups.staff_id = :staff OR educode_sales_invoice_applies.staff_id = :staff", staff: @current_admin.id)
99
+ end
100
+
101
+ if params[:q].present? && params[:q][:payer_name].present?
102
+ @data = @data.where("payer_name like ?", "%#{params[:q][:payer_name]}%")
103
+ end
104
+
105
+ if params[:q].present? && params[:q][:business].present?
106
+ @data = @data.joins(:business).where("educode_sales_businesses.name like ?", "%#{params[:q][:business]}%")
107
+ end
108
+
109
+ if params[:q].present? && params[:q][:number].present?
110
+ @data = @data.where("educode_sales_invoice_applies.number like ?", "%#{params[:q][:number]}%")
111
+ end
112
+
113
+ if params[:q].present? && params[:q][:amount].present?
114
+ @data = @data.where("educode_sales_invoice_applies.amount = ?", params[:q][:amount])
115
+ end
116
+
117
+ if params[:q].present? && params[:q][:staff_id].present?
118
+ @data = @data.where("educode_sales_invoice_applies.staff_id = ?", params[:q][:staff_id])
119
+ end
120
+
121
+ if params[:q].present? && params[:q][:created_at].present?
122
+ date = params[:q][:created_at].split(" - ")
123
+ @data = @data.where("educode_sales_invoice_applies.created_at > ? AND educode_sales_invoice_applies.created_at < ?", date[0] + " 00:00:00", date[1] + " 23:59:59")
124
+ end
125
+
126
+ if params[:q].present? && params[:q][:date_at].present?
127
+ date = params[:q][:date_at].split(" - ")
128
+ @data = @data.joins(:invoices).where("educode_sales_invoices.date_at > ? AND educode_sales_invoices.date_at < ?", date[0] + " 00:00:00", date[1] + " 23:59:59")
129
+ end
130
+
131
+ if params[:q].present? && params[:q][:school].present?
132
+ @data = @data.joins(business: :school).where("schools.name like ?", "%#{params[:q][:school]}%")
133
+ end
134
+
135
+ if params[:q].present? && params[:q][:invoice_number].present?
136
+ @data = @data.joins(:invoices).where("educode_sales_invoices.number like ?", "%#{params[:q][:invoice_number]}%")
137
+ end
138
+
139
+ if params[:q].present? && params[:q][:date_at].present?
140
+ date = params[:q][:date_at].split(" - ")
141
+ @data = @data.where("date_at BETWEEN ? AND ?", date[0], date[1])
142
+ end
143
+ if params[:q].present? && params[:q][:state].present?
144
+ if params[:q][:state] == '已认领'
145
+ @data = @data.having("claim_num > 0")
146
+ elsif params[:q][:state] == '待认领'
147
+ @data = @data.having("claim_num = 0 AND business_id IS NOT NULL")
148
+ elsif params[:q][:state] == '无对应合同'
149
+ @data = @data.having("claim_num = 0 AND business_id IS NULL")
150
+ end
151
+
152
+ end
153
+ if params[:q].present? && params[:q][:amount].present?
154
+ @data = @data.where(amount: params[:q][:amount])
155
+ end
156
+
157
+ if params[:sort].present? && params[:sort][:field]
158
+ @data = @data.order("#{params[:sort][:field]} #{params[:sort][:order]}")
159
+ else
160
+ @data = @data.order(created_at: :desc)
161
+ end
162
+ @data = @data.page(params[:page]).per(params[:limit])
163
+ end
164
+ end
165
+ end
166
+
167
+ def list
168
+ invoice_apply = InvoiceApply.find(params[:id])
169
+ @data = invoice_apply.invoices
170
+ @data = @data.order(created_at: :desc).page(params[:page]).per(params[:limit])
171
+ end
172
+
173
+ def new
174
+ render layout: false
175
+ end
176
+
177
+ def create
178
+ invoice_apply = InvoiceApply.find(params[:invoice_apply_id])
179
+ invoice = invoice_apply.invoices.new(invoice_params)
180
+ if invoice.save
181
+ render_success
182
+ else
183
+ render_failure invoice
184
+ end
185
+ end
186
+
187
+ def update
188
+ invoice = Invoice.find(params[:id])
189
+ if invoice.update(invoice_params)
190
+ render_success
191
+ else
192
+ render_failure invoice
193
+ end
194
+ end
195
+
196
+ def destroy
197
+ invoice = Invoice.find(params[:id])
198
+ if invoice.destroy
199
+ render_success
200
+ else
201
+ render_failure invoice
202
+ end
203
+ end
204
+
205
+
206
+ private
207
+ def apply_params
208
+ params.permit(:category, :is_tax_rebate, :ticket_at, :name, :taxpaper_number, :address, :phone, :bank, :bank_number)
209
+ end
210
+
211
+ def detail_params
212
+ params.permit(:category, :specification, :unit, :num, :price, :amount)
213
+ end
214
+
215
+ def invoice_params
216
+ params.permit(:number, :no_tax_amount, :taxt_amount, :amount, :date_at)
217
+ end
218
+ end
219
+ end
@@ -87,6 +87,19 @@ module EducodeSales
87
87
  end
88
88
  end
89
89
 
90
+ def upload
91
+ xlsx = Roo::Spreadsheet.open(params[:file])
92
+ ods = xlsx.sheet(0)
93
+ rows = ods.last_row - 1
94
+ rows.times do |r| #行数
95
+ next unless ods.row(r+2)[0]
96
+ business_id = Business.find_by(number: ods.row(r+2)[3].to_s.strip)&.id
97
+ EducodeSales::MoneyPlanRecord.create(payer_name: ods.row(r+2)[0].to_s.strip, amount: ods.row(r+2)[1].to_s.strip, date_at: ods.row(r+2)[2].to_s.strip, business_id: business_id, staff_id: @current_admin.id) if business_id
98
+ end
99
+
100
+ render json: { succcess: true}
101
+ end
102
+
90
103
  def confirm
91
104
  money_plan_record = MoneyPlanRecord.find(params[:id])
92
105
  money_plan_record.money_plan_claims.where.not(money_plan_id: params[:money_plan_ids]).delete_all
@@ -235,9 +235,9 @@ module EducodeSales
235
235
  if params[:business_count_type] == 'money' || params[:business_count_type].blank?
236
236
  data = provinces.map { |province|
237
237
  if params[:business_type].blank?
238
- Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).sum(:total_amount).round(2)
238
+ Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).sum(:budget_amount).round(2)
239
239
  else
240
- Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id in (?)", params[:business_type].split(",")).sum(:total_amount).round(2)
240
+ Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id in (?)", params[:business_type].split(",")).sum(:budget_amount).round(2)
241
241
  end
242
242
  }
243
243
  if params[:sort_by].present?
@@ -20,6 +20,10 @@ module EducodeSales
20
20
  has_many :business_histories, dependent: :destroy
21
21
  has_many :money_plans
22
22
 
23
+ has_one :invoice_apply
24
+ has_many :invoice_details
25
+ has_many :sales_details
26
+
23
27
  belongs_to :school
24
28
 
25
29
  belongs_to :sourcable, :polymorphic => true, optional: true
@@ -0,0 +1,5 @@
1
+ module EducodeSales
2
+ class Invoice < ApplicationRecord
3
+ belongs_to :invoice_apply, counter_cache: true
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ module EducodeSales
2
+ class InvoiceApply < ApplicationRecord
3
+ belongs_to :business
4
+ belongs_to :staff
5
+ belongs_to :take_ticket, class_name: 'Staff', optional: true
6
+ has_many :invoice_details
7
+ has_many :invoices
8
+
9
+ enum category: ['纸质专用发票', '纸质普通发票', '电子普通发票']
10
+ enum state: ['审核中', '已开票']
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module EducodeSales
2
+ class InvoiceDetail < ApplicationRecord
3
+ belongs_to :invoice_apply, optional: true
4
+ belongs_to :sale_detail, class_name: 'SalesDetail'
5
+ belongs_to :business
6
+
7
+ enum category: ['软件', '技术服务', '硬件', '装修服务', '咨询服务', '会议服务']
8
+ enum state: ['待开票', '已开票']
9
+ end
10
+ end
@@ -27,6 +27,8 @@ module EducodeSales
27
27
 
28
28
  has_many :business_infos, dependent: :destroy
29
29
 
30
+ has_many :invoice_applys, dependent: :destroy
31
+
30
32
  has_many :market_areas, dependent: :destroy
31
33
  has_many :areas, through: :market_areas
32
34
  validates :user_id, uniqueness: { message: '已存在' }
@@ -475,7 +475,7 @@
475
475
  sort.field = obj.field;
476
476
  sort.order = obj.type;
477
477
  table.reload('contact_table', {
478
- url: '/missions/businesses',
478
+ url: '/missions/contracts',
479
479
  initSort: obj,
480
480
  where: {
481
481
  sort: sort,
@@ -0,0 +1,276 @@
1
+ <div style="margin: 10px 10px 10px 10px" id="invoice_apply">
2
+ <form class="layui-form layui-form-pane" lay-filter="submit_apply">
3
+ <div class="layui-form-item">
4
+ <div class="layui-inline">
5
+ <label class="layui-form-label">开票申请号</label>
6
+ <div class="layui-input-inline">
7
+ <input type="text" name="number" class="layui-input">
8
+ </div>
9
+ </div>
10
+ <div class="layui-inline">
11
+ <label class="layui-form-label">合同名称</label>
12
+ <div class="layui-input-inline">
13
+ <input type="text" name="business" class="layui-input">
14
+ </div>
15
+ </div>
16
+ <div class="layui-inline">
17
+ <label class="layui-form-label">客户名称</label>
18
+ <div class="layui-input-inline">
19
+ <input type="text" name="school" class="layui-input">
20
+ </div>
21
+ </div>
22
+ <div class="layui-inline">
23
+ <label class="layui-form-label">发票号码</label>
24
+ <div class="layui-input-inline">
25
+ <input type="text" name="invoice_number" class="layui-input">
26
+ </div>
27
+ </div>
28
+ <div class="layui-inline">
29
+ <label class="layui-form-label">开票金额</label>
30
+ <div class="layui-input-inline">
31
+ <input type="text" name="amount" class="layui-input">
32
+ </div>
33
+ </div>
34
+ <div class="layui-inline">
35
+ <label class="layui-form-label required">申请人</label>
36
+ <div class="layui-input-inline">
37
+ <%= select_tag "staff_id", options_for_select(@staffs), { 'lay-filter': 'state', include_blank: true, "lay-search": "" } %>
38
+ </div>
39
+ </div>
40
+ <div class="layui-inline">
41
+ <label class="layui-form-label">申请日期</label>
42
+ <div class="layui-input-inline">
43
+ <input type="text" name="created_at" class="layui-input" id="date">
44
+ </div>
45
+ </div>
46
+ <div class="layui-inline">
47
+ <label class="layui-form-label">开票日期</label>
48
+ <div class="layui-input-inline">
49
+ <input type="text" name="date_at" class="layui-input" id="passed_at">
50
+ </div>
51
+ </div>
52
+ <div class="layui-inline">
53
+ <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search_record">重置</button>
54
+ <button type="submit" class="layui-btn layui-btn-primary" id="search_bt" lay-submit lay-filter="submit_apply">搜 索</button>
55
+ </div>
56
+ </div>
57
+ </form>
58
+ </div>
59
+ <script type="text/html" id="apply_tool">
60
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" style="margin-left: 20px;" lay-event="apply_invoice">开票申请</button>
61
+ </script>
62
+
63
+ <table class="layui-hide" id="apply_invoice_table" lay-filter="apply_invoice_table"></table>
64
+
65
+ <script type="text/html" id="invoice_num">
66
+ <a href="javascript:void(0);" lay-event="invoices_count" class="layui-table-link">{{ d.invoices_count }}</a>
67
+ </script>
68
+ <script type="text/html" id="apply_toolbar">
69
+ <!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="audit">审核</a> -->
70
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="invoice">提交发票信息</a>
71
+ </script>
72
+
73
+ <script>
74
+ layui.use(['form', 'table', 'miniPage', 'element', 'request'], function() {
75
+ var $ = layui.jquery,
76
+ form = layui.form,
77
+ request = layui.request,
78
+ miniPage = layui.miniPage;
79
+ laydate = layui.laydate;
80
+ table = layui.table;
81
+ laydate.render({
82
+ elem: '#date',
83
+ range: true
84
+ });
85
+ laydate.render({
86
+ elem: '#passed_at',
87
+ range: true
88
+ });
89
+ form.render();
90
+ table.render({
91
+ elem: '#apply_invoice_table',
92
+ url: '/missions/invoices/apply_records',
93
+ toolbar: '#apply_tool',
94
+ defaultToolbar: ['filter'],
95
+ initSort: {
96
+ field: 'created_at',
97
+ type: 'desc' //排序方式 asc: 升序、desc: 降序、null: 默认排序
98
+ },
99
+ cols: [
100
+ [{
101
+ field: 'id',
102
+ width: 80,
103
+ title: '序号',
104
+ type: 'numbers',
105
+ }, {
106
+ field: 'number',
107
+ width: 180,
108
+ title: '开票申请号'
109
+ }, {
110
+ field: 'business_number',
111
+ width: 150,
112
+ title: '合同编号'
113
+ }, {
114
+ field: 'business_name',
115
+ width: 180,
116
+ title: '合同名称'
117
+ }, {
118
+ field: 'school',
119
+ width: 180,
120
+ title: '客户名称'
121
+ }, {
122
+ field: 'staff',
123
+ width: 120,
124
+ title: '申请人',
125
+ }, {
126
+ field: 'created_at',
127
+ width: 220,
128
+ title: '申请日期',
129
+ }, {
130
+ field: 'amount',
131
+ width: 120,
132
+ title: '开票金额',
133
+ }, {
134
+ field: 'state',
135
+ width: 120,
136
+ title: '开票状态',
137
+ }, {
138
+ field: 'invoices_count',
139
+ width: 120,
140
+ title: '发票信息',
141
+ templet: "#invoice_num"
142
+ }, {
143
+ field: 'take_ticket',
144
+ width: 120,
145
+ title: '领票人',
146
+ }, {
147
+ field: 'delivery',
148
+ width: 120,
149
+ title: '送达方式',
150
+ }, {
151
+ title: '操作',
152
+ minWidth: 200,
153
+ toolbar: '#apply_toolbar',
154
+ align: "center",
155
+ fixed: 'right'
156
+ }]
157
+ ],
158
+ limit: 20,
159
+ limits: [10, 15, 20, 30, 40, 50, 60, 70, 80, 90],
160
+ page: true
161
+ });
162
+ var sort = {},
163
+ search = {};
164
+ table.on('sort(apply_invoice_table)', function(obj) {
165
+ sort.field = obj.field;
166
+ sort.order = obj.type;
167
+ table.reload('apply_invoice_table', {
168
+ initSort: obj,
169
+ where: {
170
+ sort: sort,
171
+ q: search
172
+ }
173
+ });
174
+ })
175
+ // 监听搜索操作
176
+ form.on('submit(submit_apply)', function(data) {
177
+ search = data.field
178
+ table.reload('apply_invoice_table', {
179
+ page: {
180
+ curr: 1
181
+ },
182
+ where: {
183
+ q: search,
184
+ sort: sort
185
+ }
186
+ }, 'data');
187
+ return false;
188
+ });
189
+ form.on('submit(reset_business_search_record)', function(data) {
190
+ var field = data.field;
191
+ form.val('submit_apply', {
192
+ area: "",
193
+ date: "",
194
+ staff_id: "",
195
+ clazz: "",
196
+ professional_title: "",
197
+ school: "",
198
+ business: ""
199
+ });
200
+ return false;
201
+ });
202
+ table.on('toolbar(apply_invoice_table)', function(obj) {
203
+ if (obj.event == 'apply_invoice') {
204
+ var content = miniPage.getHrefContent('/missions/invoices/apply')
205
+ var openWH = miniPage.getOpenWidthHeight();
206
+ business_id = "";
207
+ sindex = layer.open({
208
+ title: '开票申请',
209
+ type: 1,
210
+ shade: 0.2,
211
+ maxmin: true,
212
+ shadeClose: true,
213
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
214
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
215
+ content: content
216
+ });
217
+ $(window).on("resize", function() {
218
+ layer.full(sindex);
219
+ });
220
+ }
221
+ })
222
+ table.on('tool(apply_invoice_table)', function(obj) {
223
+ var data = obj.data;
224
+ id = data.id;
225
+ state = data.state;
226
+ if (obj.event === 'confirm') { // 监听添加操作
227
+ var content = miniPage.getHrefContent('/missions/money_plan_records/confirm_plan?id=' + id)
228
+ var openWH = miniPage.getOpenWidthHeight();
229
+ sindex = layer.open({
230
+ title: '认领回款',
231
+ type: 1,
232
+ shade: 0.2,
233
+ maxmin: true,
234
+ shadeClose: true,
235
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
236
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
237
+ content: content
238
+ });
239
+ $(window).on("resize", function() {
240
+ layer.full(sindex);
241
+ });
242
+ } else if (obj.event === 'invoices_count' || obj.event == 'invoice') {
243
+ invoice_apply_id = id;
244
+ var content = miniPage.getHrefContent('/missions/invoices/new')
245
+ var openWH = miniPage.getOpenWidthHeight();
246
+ sindex = layer.open({
247
+ title: '添加发票',
248
+ type: 1,
249
+ shade: 0.2,
250
+ maxmin: true,
251
+ shadeClose: true,
252
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
253
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
254
+ content: content
255
+ });
256
+ $(window).on("resize", function() {
257
+ layer.full(sindex);
258
+ });
259
+ }
260
+ });
261
+ });
262
+ </script>
263
+ <style>
264
+ .layui-table-tool-temp {
265
+ padding-right: 30px;
266
+ !important;
267
+ }
268
+
269
+ .layui-table-fixed .layui-table-body {
270
+ height: auto !important;
271
+ }
272
+
273
+ .layui-table-fixed.layui-hide {
274
+ display: block !important;
275
+ }
276
+ </style>