Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvsuo-pc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhilin
lvsuo-pc
Commits
b0498a1a
Commit
b0498a1a
authored
Nov 29, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
cdbcb356
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
385 additions
and
192 deletions
+385
-192
app/Admin/Controllers/CovenantReceivePaymentController.php
+2
-2
app/Admin/Controllers/LawyerCollectController.php
+75
-27
app/Admin/Controllers/LawyerCostController.php
+11
-36
app/Admin/Controllers/LawyerCostListController.php
+7
-0
app/Admin/Controllers/LawyerCovenantIncomeController.php
+12
-52
app/Admin/Controllers/LawyerIncomeController.php
+10
-9
app/Admin/Controllers/ViewCovenantInvoicedController.php
+25
-12
app/Admin/Controllers/ViewCovenantReceivedController.php
+58
-15
app/Admin/Repositories/LawyerCollect.php
+39
-20
app/Models/CovenantReceivePayment.php
+6
-6
app/Models/LawyerCost.php
+140
-13
No files found.
app/Admin/Controllers/CovenantReceivePaymentController.php
View file @
b0498a1a
...
...
@@ -31,11 +31,11 @@ protected function grid()
// 添加一行表头数据
$grid
->
header
(
function
()
use
(
$invoicedMoney
,
$receivedMoney
,
$receiptNoinvoice
,
$invoiceNoreceipt
)
{
return
'<div class="row" style="text-align:center;">'
.
'<div class="col-md-7">合计</div>'
.
'<div class="col-md-7"
>合计</div>'
.
'<div class="col-md-1">'
.
$invoicedMoney
.
'</div>'
.
'<div class="col-md-1">'
.
$receivedMoney
.
'</div>'
.
'<div class="col-md-1">'
.
$receiptNoinvoice
.
'</div>'
.
'<div class="col-md-
1
">'
.
$invoiceNoreceipt
.
'</div>'
.
'<div class="col-md-
2
">'
.
$invoiceNoreceipt
.
'</div>'
.
'</div>'
;
});
//$grid->column('id')->sortable();
...
...
app/Admin/Controllers/LawyerCollectController.php
View file @
b0498a1a
...
...
@@ -6,12 +6,14 @@
use
App\Models\Covenant
as
ModelsCovenant
;
use
App\Models\CovenantReceivePayment
as
ModelsCovenantReceivePayment
;
use
App\Models\Lawyer
as
ModelLawyer
;
use
App\Models\LawyerCost
as
ModelLawyerCost
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
App\Admin\Actions\CovenantReceive
;
use
App\Admin\Actions\CovenantInvoice
;
use
Dcat\Admin\Admin
;
class
LawyerCollectController
extends
AdminController
{
...
...
@@ -25,62 +27,96 @@ protected function grid()
return
Grid
::
make
(
new
LawyerCollect
(),
function
(
Grid
$grid
)
{
$number
=
$grid
->
model
()
->
filter
()
->
input
(
'number'
)
??
''
;
//律师编号
$year
=
$grid
->
model
()
->
filter
()
->
input
(
'year'
)
??
date
(
"Y"
);
//律师编号
$received_at
=
$invoiced_at
=
[];
$received_at
[
'start'
]
=
$_GET
[
'received_at'
][
'start'
]
??
''
;
$received_at
[
'end'
]
=
$_GET
[
'received_at'
][
'end'
]
??
''
;
$invoiced_at
[
'start'
]
=
$_GET
[
'invoiced_at'
][
'start'
]
??
''
;
$invoiced_at
[
'end'
]
=
$_GET
[
'invoiced_at'
][
'end'
]
??
''
;
$lawyer_id
=
0
;
$lawyObj
=
ModelLawyer
::
where
(
'number'
,
$number
)
->
first
();
if
(
$lawyObj
)
{
$lawyer_id
=
$lawyObj
->
number
;
}
//创收已收款
$received_amount
=
ModelsCovenantReceivePayment
::
getReceivedMoneyByNumber
(
$number
,
$received_at
,
$invoiced_at
);
$received_amount
=
ModelsCovenantReceivePayment
::
getReceivedMoneyByNumber
(
$number
,
$
year
,
$
received_at
,
$invoiced_at
);
//已开票
$invoiced_money
=
ModelsCovenantReceivePayment
::
getInvoicedMoneyByNumber
(
$number
,
$received_at
,
$invoiced_at
);
$invoiced_money
=
ModelsCovenantReceivePayment
::
getInvoicedMoneyByNumber
(
$number
,
$
year
,
$
received_at
,
$invoiced_at
);
//收款未开票
$received_noinvoiced
=
(
$received_amount
-
$invoiced_money
)
>
0
?
$received_amount
-
$invoiced_money
:
0
;
//开票未收款
$invoiced_noreceived
=
(
$invoiced_money
-
$received_amount
)
>
0
?
$invoiced_money
-
$received_amount
:
0
;
//提成金额
$commissionAmount
=
ModelsCovenantReceivePayment
::
getCommissionAmount
(
$number
,
$received_at
);
$commissionAmount
=
ModelsCovenantReceivePayment
::
getCommissionAmount
(
$number
,
$year
,
$received_at
);
//成本合计
$costTotal
=
ModelLawyerCost
::
getTotalCost
(
$lawyer_id
,
$year
);
//基本工资
$basicSalary
=
Model
sCovenantReceivePayment
::
getTotalBasicSalary
(
$number
,
$received_at
);
$basicSalary
=
Model
LawyerCost
::
getBasiSalary
(
$lawyer_id
,
$year
);
//专项附加
$special_additional
=
Model
sCovenantReceivePayment
::
getTotalSpecialAdditional
(
$number
,
$received_at
);
$special_additional
=
Model
LawyerCost
::
getSpecialAdditional
(
$lawyer_id
,
$year
);
//社保
$social
=
Model
sCovenantReceivePayment
::
getTotalSocial
(
$number
,
$received_at
);
$social
=
Model
LawyerCost
::
getSocial
(
$lawyer_id
,
$year
);
//公积金
$accumulation_fund
=
ModelsCovenantReceivePayment
::
getTotalAccumulationFund
(
$number
,
$received_at
);
$accumulation_fund
=
ModelLawyerCost
::
getAccumulationFund
(
$lawyer_id
,
$year
);
//贴票金额
$posting_tickets
=
ModelLawyerCost
::
getAllPostingTicketsMoney
(
$lawyer_id
,
$year
);
//预支款
$advance_fee
=
ModelLawyerCost
::
getAdvanceFee
(
$lawyer_id
,
$year
);
//可结算提成
$payable_amount
=
ModelLawyerCost
::
getAllPayableAmount
(
$lawyer_id
,
$year
);
// 添加一行表头数据
$grid
->
header
(
function
()
use
(
$received_amount
,
$
received_noinvoiced
,
$commissionAmount
,
$invoiced_noreceived
,
$basicSalary
,
$special_additional
,
$social
,
$accumulation_fund
)
{
return
'<div class="table-responsive table-wrapper complex-container table-middle mt-1 table-collapse "
>'
.
'
<table class="table custom-data-table data-table" id="grid-table">
$grid
->
header
(
function
()
use
(
$received_amount
,
$
commissionAmount
,
$received_noinvoiced
,
$invoiced_noreceived
,
$costTotal
,
$basicSalary
,
$special_additional
,
$social
,
$accumulation_fund
,
$posting_tickets
,
$advance_fee
,
$payable_amount
)
{
return
'<div class="table-responsive table-wrapper complex-container table-middle mt-1 table-collapse "
>
<table class="table custom-data-table data-table" id="grid-table">
<thead>
<tr>
<th width="160" style="text-align:center;" colspan="2">合计</th>
<th width="90" style="">'
.
$received_amount
.
'</th>
<th style="">'
.
$commissionAmount
.
'</th>
<th style="">'
.
$received_noinvoiced
.
'</th>
<th style="">'
.
$invoiced_noreceived
.
'</th>
<th style="">成本合计</th>
<th style="">'
.
$basicSalary
.
'</th>
<th style="">'
.
$special_additional
.
'</th>
<th style="">'
.
$social
.
'</th>
<th style="">'
.
$accumulation_fund
.
'</th>
<th style="">10000</th>
<th style="">30000</th>
<th style="">48899</th>
<th width="90"> </th>
<th width="90"> 合计 </th>
<th width="90"> </th>
<th width="90" style="text-align:center;">'
.
$received_amount
.
'</th>
<th width="80" style="text-align:center;">'
.
$commissionAmount
.
'</th>
<th width="90" style="text-align:center;">'
.
$received_noinvoiced
.
'</th>
<th width="90" style="text-align:center;">'
.
$invoiced_noreceived
.
'</th>
<th width="90" style="text-align:center;">'
.
$costTotal
.
'</th>
<th width="90" style="text-align:center;">'
.
$basicSalary
.
'</th>
<th width="90" style="text-align:center;">'
.
$special_additional
.
'</th>
<th width="90" style="text-align:center;">'
.
$social
.
'</th>
<th width="90" style="text-align:center;">'
.
$accumulation_fund
.
'</th>
<th width="90" style="text-align:center;">'
.
$posting_tickets
.
'</th>
<th width="90" style="text-align:center;">'
.
$advance_fee
.
'</th>
<th width="90" style="text-align:center;">'
.
$payable_amount
.
'</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
'
.
'
</div>'
;
</table>
</div>'
;
});
// $grid->header(function () {
// return '<div class="row" style="text-align:center;">' .
// '<div class="col-md-3" >合计</div>' .
// '<div class="col-md-1">1</div>' .
// '<div class="col-md-1">2</div>' .
// '<div class="col-md-1">3</div>' .
// '<div class="col-md-1">4</div>' .
// '<div class="col-md-1">5</div>' .
// '<div class="col-md-1">6</div>' .
// '<div class="col-md-1">7</div>' .
// '<div class="col-md-1">8</div>' .
// '<div class="col-md-1">9</div>' .
// '<div class="col-md-1">10</div>' .
// '<div class="col-md-1">11</div>' .
// '</div>';
// });
//$grid->column('id')->sortable();
$grid
->
column
(
'lnumber'
,
'律师编号'
)
->
width
(
90
);
$grid
->
column
(
'lname'
,
'律师名称'
)
->
width
(
90
);
$grid
->
column
(
'commission_ratio'
,
'提成比例(%)'
)
->
width
(
10
0
);
$grid
->
column
(
'commission_ratio'
,
'提成比例(%)'
)
->
width
(
9
0
);
$grid
->
column
(
'receipt_money'
,
'创收已收款'
)
->
width
(
90
);
$grid
->
column
(
'commission_amount'
,
'提成金额'
)
->
width
(
9
0
);
$grid
->
column
(
'commission_amount'
,
'提成金额'
)
->
width
(
8
0
);
$grid
->
column
(
'receipt_noinvoice'
,
'已收款未开票'
)
->
width
(
90
);
$grid
->
column
(
'invoice_noreceipt'
,
'已开票未收款'
)
->
width
(
90
);
$grid
->
column
(
'cost'
,
'成本合计'
)
->
width
(
90
);
...
...
@@ -105,9 +141,21 @@ protected function grid()
$filter
->
panel
();
$filter
->
like
(
'number'
,
'律师编号'
)
->
width
(
3
);
$filter
->
like
(
'name'
,
'律师姓名'
)
->
width
(
3
);
$filter
->
equal
(
'year'
,
'年份'
)
->
width
(
3
)
->
default
(
date
(
'Y'
));
$filter
->
between
(
'received_at'
,
'收款日期'
)
->
month
()
->
width
(
4
);
$filter
->
between
(
'invoiced_at'
,
'开票日期'
)
->
month
()
->
width
(
4
);
});
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
//编辑
if
(
!
Admin
::
user
()
->
can
(
'lawyer_cost_list_edit'
))
{
$actions
->
disableEdit
();
}
//删除
if
(
!
Admin
::
user
()
->
can
(
'lawyer_cost_list_edit-delete'
))
{
$actions
->
disableDelete
();
}
});
});
}
}
app/Admin/Controllers/LawyerCostController.php
View file @
b0498a1a
...
...
@@ -10,6 +10,7 @@
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Illuminate\Support\Facades\DB
;
use
Dcat\Admin\Admin
;
class
LawyerCostController
extends
AdminController
{
...
...
@@ -61,6 +62,9 @@ protected function grid()
return
self
::
getPersonalIncomeTax
(
$this
->
number
,
$year
);
});
if
(
!
Admin
::
user
()
->
can
(
'lawyer_cost_add'
))
{
$grid
->
disableCreateButton
();
}
$grid
->
disableViewButton
();
$grid
->
disableEditButton
();
$grid
->
disableDeleteButton
();
...
...
@@ -76,44 +80,15 @@ protected function grid()
});
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
//$actions->append(new UserBuyCode($actions->row->id));
//成本汇总
$actions
->
append
(
'<a href="/lycost-collect?no='
.
$this
->
number
.
'" alt="成本汇总" target="_blank">成本汇总</a>'
);
// 成本明细
$actions
->
append
(
'<a href="/lycost-list?no='
.
$this
->
number
.
'" alt="成本明细" target="_blank">成本明细</a>'
);
// 或者使用 RowAction 来添加按钮
//$actions->append(RowAction::make('自定义按钮')->route('custom.route'));
});
});
}
protected
function
grid2
()
{
return
Grid
::
make
(
new
ModelLawyerCost
(),
function
(
Grid
$grid
)
{
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'year'
);
$grid
->
column
(
'month'
);
$grid
->
column
(
'number'
);
$grid
->
column
(
'lname'
);
$grid
->
column
(
'basic_salary'
);
$grid
->
column
(
'social_person_fee'
);
$grid
->
column
(
'social_company_fee'
);
$grid
->
column
(
'accumulation_fund_person_fee'
);
$grid
->
column
(
'accumulation_fund_company_fee'
);
$grid
->
column
(
'annual_inspection_fee'
);
$grid
->
column
(
'annuity'
);
$grid
->
column
(
'office_rental_fee'
);
$grid
->
column
(
'noticket_cost'
);
$grid
->
column
(
'posting_tickets_fee'
);
$grid
->
column
(
'assistant_fee'
);
$grid
->
column
(
'special_additional'
);
$grid
->
column
(
'advance_fee'
);
$grid
->
column
(
'personal_income_tax'
);
$grid
->
column
(
'created_at'
);
$grid
->
column
(
'updated_at'
)
->
sortable
();
if
(
Admin
::
user
()
->
can
(
'lycost-collect'
))
{
$actions
->
append
(
'<a href="/lycost-collect?no='
.
$this
->
number
.
'" alt="成本汇总" target="_blank">成本汇总</a>'
);
}
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
// 成本明细
if
(
Admin
::
user
()
->
can
(
'lycost-list'
))
{
$actions
->
append
(
'<a href="/lycost-list?no='
.
$this
->
number
.
'" alt="成本明细" target="_blank">成本明细</a>'
);
}
});
});
}
...
...
app/Admin/Controllers/LawyerCostListController.php
View file @
b0498a1a
...
...
@@ -10,6 +10,7 @@
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Illuminate\Support\Facades\DB
;
use
Dcat\Admin\Admin
;
class
LawyerCostListController
extends
AdminController
{
...
...
@@ -62,6 +63,12 @@ protected function grid()
$grid
->
disableViewButton
();
$grid
->
disableCreateButton
();
$grid
->
disableRowSelector
();
if
(
!
Admin
::
user
()
->
can
(
'lawyer_cost_list_edit'
))
{
$grid
->
disableEditButton
();
}
if
(
!
Admin
::
user
()
->
can
(
'lawyer_cost_list_delete'
))
{
$grid
->
disableEditButton
();
}
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// 更改为 panel 布局
...
...
app/Admin/Controllers/LawyerCovenantIncomeController.php
View file @
b0498a1a
...
...
@@ -11,6 +11,7 @@
use
Dcat\Admin\Http\Controllers\AdminController
;
use
App\Admin\Actions\CovenantReceive
;
use
App\Admin\Actions\CovenantInvoice
;
use
Dcat\Admin\Admin
;
class
LawyerCovenantIncomeController
extends
AdminController
{
...
...
@@ -71,63 +72,22 @@ protected function grid()
});
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
use
(
$lawyerID
)
{
//添加收款
$actions
->
append
(
new
CovenantReceive
(
$actions
->
row
->
id
));
if
(
Admin
::
user
()
->
can
(
'receive-payment'
))
{
$actions
->
append
(
new
CovenantReceive
(
$actions
->
row
->
id
));
}
//添加开票
$actions
->
append
(
new
CovenantInvoice
(
$actions
->
row
->
id
));
if
(
Admin
::
user
()
->
can
(
'invoiced-payment'
))
{
$actions
->
append
(
new
CovenantInvoice
(
$actions
->
row
->
id
));
}
//查看收款
$cid
=
$actions
->
row
->
cid
;
$actions
->
append
(
'<a href="/view-covenant-received?cid='
.
$cid
.
'" alt="查看收款" target="_blank">查看收款</a>'
);
if
(
Admin
::
user
()
->
can
(
'view-received'
))
{
$actions
->
append
(
'<a href="/view-covenant-received?cid='
.
$cid
.
'" alt="查看收款" target="_blank">查看收款</a>'
);
}
//查看开票
$actions
->
append
(
'<a href="/view-covenant-invoiced?cid='
.
$cid
.
'" alt="查看开票" target="_blank">查看开票</a>'
);
});
});
}
protected
function
grid2
()
{
return
Grid
::
make
(
ModelsCovenant
::
with
([
'principal'
,
'lawyer'
]),
function
(
Grid
$grid
)
{
$lawyerID
=
$grid
->
model
()
->
filter
()
->
input
(
'no'
)
??
''
;
//律师ID
if
(
$lawyerID
)
{
$grid
->
model
()
->
where
(
'lawyer_id'
,
$lawyerID
);
}
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'number'
,
'合同编号'
);
$grid
->
column
(
'cname'
,
'合同名称'
);
$grid
->
column
(
'ctype'
,
'合同类型'
)
->
display
(
function
(
$val
)
{
return
Covenant
::
CTYPE
[
$val
];
});
//$grid->column('sign_at');
$grid
->
column
(
'principal.name'
,
'委托人'
);
$grid
->
column
(
'field1'
,
'开票金额'
);
$grid
->
column
(
'field2'
,
'已收款'
);
$grid
->
column
(
'field3'
,
'已收款未开票'
);
$grid
->
column
(
'field4'
,
'已开票未收款'
);
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid
->
disableViewButton
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// 更改为 panel 布局
$filter
->
panel
();
$filter
->
like
(
'number'
,
'合同编号'
)
->
width
(
3
);
$filter
->
like
(
'cname'
,
'合同名称'
)
->
width
(
3
);
$filter
->
like
(
'principal.name'
,
'委托人'
)
->
width
(
3
);
$filter
->
equal
(
'payment_method'
)
->
select
(
Covenant
::
PAYMENT_METHOD
)
->
width
(
3
);
$filter
->
between
(
'sign_at'
,
'签约日期'
)
->
date
()
->
width
(
4
);
});
//文字信息
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$grid
,
$lawyerID
)
{
$fullname
=
$number
=
''
;
if
(
$lawyerID
)
{
$obj
=
ModelLawyer
::
find
(
$lawyerID
);
$fullname
=
$obj
->
name
;
$number
=
$obj
->
number
;
if
(
Admin
::
user
()
->
can
(
'view-invoiced'
))
{
$actions
->
append
(
'<a href="/view-covenant-invoiced?cid='
.
$cid
.
'" alt="查看开票" target="_blank">查看开票</a>'
);
}
$card_info
=
" 律师编号:
{
$number
}
律师姓名:
{
$fullname
}
"
;
$tools
->
append
(
$card_info
);
});
});
}
...
...
app/Admin/Controllers/LawyerIncomeController.php
View file @
b0498a1a
...
...
@@ -9,6 +9,7 @@
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Admin
;
class
LawyerIncomeController
extends
AdminController
{
...
...
@@ -59,8 +60,15 @@ protected function grid()
$grid
->
column
(
'field4'
,
'已开票未收款'
)
->
display
(
function
(
$val
)
{
$id
=
$this
->
id
;
$year
=
date
(
'Y'
);
$linkstr
=
'<a href="/lawyer-covenant-income?no='
.
$id
.
'" target="_blank">创收收款表</a> '
;
$linkstr
.=
'<a href="/receive_payment?no='
.
$id
.
'&year='
.
$year
.
'" target="_blank">已收款/已开票汇总</a><br/>'
;
$linkstr
=
''
;
//创收收款表
if
(
Admin
::
user
()
->
can
(
'lawyer-covenant-income'
))
{
$linkstr
.=
'<a href="/lawyer-covenant-income?no='
.
$id
.
'" target="_blank">创收收款表</a> '
;
}
//已收款/已开票汇总
if
(
Admin
::
user
()
->
can
(
'received-invoiced'
))
{
$linkstr
.=
'<a href="/receive_payment?no='
.
$id
.
'&year='
.
$year
.
'" target="_blank">已收款/已开票汇总</a><br/>'
;
}
return
$linkstr
;
});
...
...
@@ -78,13 +86,6 @@ protected function grid()
$filter
->
like
(
'year'
,
'年份'
)
->
width
(
3
)
->
default
(
date
(
"Y"
))
->
ignore
();
//$filter->date('sign_at')->format('YYYY-MM-DD');
});
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
//成本汇总
$actions
->
append
(
'<a href="/lycost-collect?no='
.
$this
->
number
.
'" alt="成本汇总" target="_blank">成本汇总</a>'
);
// 成本明细
$actions
->
append
(
'<a href="/lycost-list?no='
.
$this
->
number
.
'" alt="成本明细" target="_blank">成本明细</a>'
);
});
});
}
...
...
app/Admin/Controllers/ViewCovenantInvoicedController.php
View file @
b0498a1a
...
...
@@ -13,6 +13,7 @@
use
Illuminate\Support\Facades\DB
;
use
Dcat\Admin\Widgets\Modal
;
use
App\Admin\Forms\CovenantInvoiceForm
;
use
Dcat\Admin\Admin
;
class
ViewCovenantInvoicedController
extends
AdminController
{
...
...
@@ -27,18 +28,19 @@ protected function grid()
return
Grid
::
make
(
new
ModelsCovenantReceivePayment
(),
function
(
Grid
$grid
)
{
$cid
=
$grid
->
model
()
->
filter
()
->
input
(
'cid'
)
??
0
;
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$cid
)
{
$tools
->
append
(
Modal
::
make
()
// 大号弹窗
->
lg
()
// 弹窗标题
->
title
(
'新增'
)
// 按钮
->
button
(
'<button class="btn btn-primary"><i class="feather icon-plus"></i> 新增</button>'
)
// 弹窗内容
->
body
(
CovenantInvoiceForm
::
make
()
->
payload
([
'id'
=>
$cid
])));
});
if
(
Admin
::
user
()
->
can
(
'view-invoiced-add'
))
{
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$cid
)
{
$tools
->
append
(
Modal
::
make
()
// 大号弹窗
->
lg
()
// 弹窗标题
->
title
(
'新增'
)
// 按钮
->
button
(
'<button class="btn btn-primary"><i class="feather icon-plus"></i> 新增</button>'
)
// 弹窗内容
->
body
(
CovenantInvoiceForm
::
make
()
->
payload
([
'id'
=>
$cid
])));
});
}
$grid
->
model
()
->
where
(
'rtype'
,
2
)
->
orderBy
(
"id"
,
"desc"
);
//$grid->column('id')->sortable();
$grid
->
column
(
'invoiced_at'
,
'开票时间'
);
...
...
@@ -60,6 +62,17 @@ protected function grid()
$tools
->
append
(
$card_info
);
});
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
//编辑
if
(
!
Admin
::
user
()
->
can
(
'view-invoiced-edit'
))
{
$actions
->
disableEdit
();
}
//删除
if
(
!
Admin
::
user
()
->
can
(
'view-invoiced-delete'
))
{
$actions
->
disableDelete
();
}
});
});
}
...
...
app/Admin/Controllers/ViewCovenantReceivedController.php
View file @
b0498a1a
...
...
@@ -14,6 +14,8 @@
use
Dcat\Admin\Layout\Content
;
use
Dcat\Admin\Widgets\Modal
;
use
App\Admin\Forms\CovenantReceiveForm
;
use
App\Models\Lawyer
as
ModelsLawyer
;
use
Dcat\Admin\Admin
;
class
ViewCovenantReceivedController
extends
AdminController
{
...
...
@@ -28,18 +30,22 @@ protected function grid()
return
Grid
::
make
(
new
ModelsCovenantReceivePayment
(),
function
(
Grid
$grid
)
{
$cid
=
$grid
->
model
()
->
filter
()
->
input
(
'cid'
)
??
0
;
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$cid
)
{
$tools
->
append
(
Modal
::
make
()
// 大号弹窗
->
lg
()
// 弹窗标题
->
title
(
'新增'
)
// 按钮
->
button
(
'<button class="btn btn-primary"><i class="feather icon-plus"></i> 新增</button>'
)
// 弹窗内容
->
body
(
CovenantReceiveForm
::
make
()
->
payload
([
'id'
=>
$cid
])));
if
(
Admin
::
user
()
->
can
(
'view-received-add'
))
{
$tools
->
append
(
Modal
::
make
()
// 大号弹窗
->
lg
()
// 弹窗标题
->
title
(
'新增'
)
// 按钮
->
button
(
'<button class="btn btn-primary"><i class="feather icon-plus"></i> 新增</button>'
)
// 弹窗内容
->
body
(
CovenantReceiveForm
::
make
()
->
payload
([
'id'
=>
$cid
])));
}
});
$grid
->
model
()
->
where
(
'rtype'
,
1
)
->
orderBy
(
"id"
,
"desc"
);
//$grid->column('id')->sortable();
$grid
->
column
(
'received_type'
,
'收款账户'
)
->
display
(
function
(
$val
)
{
...
...
@@ -56,16 +62,41 @@ protected function grid()
//文字信息
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$grid
,
$cid
)
{
$principal
=
$number
=
''
;
$principal
=
$cnumber
=
$lnumber
=
$lname
=
''
;
$invoiced_money
=
$received_money
=
$received_noinvoiced
=
$invoiced_noreceived
=
0
;
if
(
$cid
)
{
$obj
=
ModelsCovenant
::
find
(
$cid
);
$principal
=
$obj
->
principal
;
$number
=
$obj
->
number
;
$cobj
=
ModelsCovenant
::
find
(
$cid
);
$principal
=
$cobj
->
principal
;
$cnumber
=
$cobj
->
number
;
$lobj
=
ModelsLawyer
::
find
(
$cobj
->
lawyer_id
);
$lnumber
=
$lobj
->
number
;
$lname
=
$lobj
->
name
;
//开票金额
$invoiced_money
=
self
::
getInvoicedByCid
(
$cid
);
//已收款
$received_money
=
self
::
getReceivedByCid
(
$cid
);
//已收款未开票
$received_noinvoiced
=
(
$received_money
-
$invoiced_money
)
>
0
?
$received_money
-
$invoiced_money
:
0
;
//已开票未收款
$invoiced_noreceived
=
(
$invoiced_money
-
$received_money
)
>
0
?
$invoiced_money
-
$received_money
:
0
;
}
$card_info
=
" 合同编号:
{
$number
}
委托人:
{
$principal
}
"
;
$card_info
=
" 合同编号:
{
$cnumber
}
委托人:
{
$principal
}
"
;
$card_info
.=
" 律师编号:
{
$lnumber
}
律师姓名:
{
$lname
}
"
;
$card_info
.=
" 开票金额:
{
$invoiced_money
}
已收款:
{
$received_money
}
"
;
$card_info
.=
" 已收款未开票:
{
$received_noinvoiced
}
已开票未收款:
{
$invoiced_noreceived
}
"
;
$tools
->
append
(
$card_info
);
});
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
//编辑
if
(
!
Admin
::
user
()
->
can
(
'view-received-edit'
))
{
$actions
->
disableEdit
();
}
//删除
if
(
!
Admin
::
user
()
->
can
(
'view-received-delete'
))
{
$actions
->
disableDelete
();
}
});
});
}
...
...
@@ -95,4 +126,16 @@ protected function form()
return
$form
;
}
//开票金额
public
static
function
getInvoicedByCid
(
$cid
)
{
return
ModelsCovenantReceivePayment
::
where
([
'cid'
=>
$cid
,
'rtype'
=>
2
])
->
sum
(
'invoiced_money'
);
}
//已收款
public
static
function
getReceivedByCid
(
$cid
)
{
return
ModelsCovenantReceivePayment
::
where
([
'cid'
=>
$cid
,
'rtype'
=>
1
])
->
sum
(
'received_amount'
);
}
}
app/Admin/Repositories/LawyerCollect.php
View file @
b0498a1a
...
...
@@ -4,6 +4,7 @@
use
App\Models\Covenant
as
ModelsCovenant
;
use
App\Models\LawyerCost
as
ModelsLawyerCost
;
use
App\Models\Lawyer
as
ModelsLawyer
;
use
App\Models\CovenantReceivePayment
as
ModelCovenantReceivePayment
;
use
App\Models\Principal
;
use
Dcat\Admin\Repositories\EloquentRepository
;
...
...
@@ -35,6 +36,7 @@ public function get(Grid\Model $model)
// 获取筛选条件
$number
=
$model
->
filter
()
->
input
(
'number'
);
$lname
=
$model
->
filter
()
->
input
(
'name'
);
$year
=
$model
->
filter
()
->
input
(
'year'
)
??
date
(
"Y"
);
$received_at
=
$invoiced_at
=
[];
$received_at
[
'start'
]
=
$_GET
[
'received_at'
][
'start'
]
??
''
;
$received_at
[
'end'
]
=
$_GET
[
'received_at'
][
'end'
]
??
''
;
...
...
@@ -44,7 +46,13 @@ public function get(Grid\Model $model)
$param
=
[
'sort'
=>
$sort
,
'start'
=>
$start
,
'search'
=>
[
'number'
=>
$number
,
'lname'
=>
$lname
,
'invoiced_at'
=>
$invoiced_at
,
'received_at'
=>
$received_at
,]
'search'
=>
[
'number'
=>
$number
,
'lname'
=>
$lname
,
'year'
=>
$year
,
'invoiced_at'
=>
$invoiced_at
,
'received_at'
=>
$received_at
,
]
];
$data
=
$this
->
getList
(
$param
);
...
...
@@ -62,6 +70,7 @@ public function getList(array $param)
$start
=
$param
[
'start'
]
??
0
;
$number
=
$param
[
'search'
][
'number'
]
??
''
;
$lname
=
$param
[
'search'
][
'lname'
]
??
''
;
$year
=
$param
[
'search'
][
'year'
]
??
date
(
"Y"
);
$invoiced_at
=
$param
[
'search'
][
'invoiced_at'
]
??
[];
$received_at
=
$param
[
'search'
][
'received_at'
]
??
[];
$list
=
[];
...
...
@@ -176,21 +185,33 @@ public function getList(array $param)
foreach
(
$list
as
$key
=>
$item
)
{
$tmp
=
[];
//$tmp['id'] = $item->id;
//已收款
$receipt_money
=
ModelCovenantReceivePayment
::
getReceivedMoney
(
$item
->
lawyer_id
,
$year
);
//已开票
$invoiced_money
=
ModelCovenantReceivePayment
::
getInvoicedMoney
(
$item
->
lawyer_id
,
$year
);
//已收款未开票
$receipt_noinvoice
=
(
$receipt_money
-
$invoiced_money
)
>
0
?
$receipt_money
-
$invoiced_money
:
0
;
//已开票未收款
$invoice_noreceipt
=
(
$invoiced_money
-
$receipt_money
)
>
0
?
$invoiced_money
-
$receipt_money
:
0
;
//贴票金额
$lawyerObj
=
ModelsLawyer
::
find
(
$item
->
lawyer_id
);
$tickets_money
=
ModelsLawyerCost
::
getPostingTicketsMoney
(
$item
->
lawyer_id
,
$year
,
$lawyerObj
->
commission_rate
,
$lawyerObj
->
ticket_ratio
);
$tmp
[
'lnumber'
]
=
$item
->
lnumber
;
$tmp
[
'lname'
]
=
$item
->
lname
;
$tmp
[
'commission_ratio'
]
=
$item
->
commission_rate
;
$tmp
[
'receipt_money'
]
=
ModelCovenantReceivePayment
::
getReceivedMoney
(
$item
->
lawyer_id
)
;
$tmp
[
'commission_amount'
]
=
self
::
getCommissionAmount
(
$
item
->
lawyer_id
,
$item
->
commission_rate
);
$tmp
[
'receipt_noinvoice'
]
=
ModelCovenantReceivePayment
::
getReceiptNoinvoice
(
$item
->
lawyer_id
)
;
$tmp
[
'invoice_noreceipt'
]
=
ModelCovenantReceivePayment
::
getInvoiceNoreceipt
(
$item
->
lawyer_id
)
;
$tmp
[
'cost'
]
=
'7'
;
$tmp
[
'basic_salary'
]
=
ModelsLawyerCost
::
getBasiSalary
(
$item
->
lawyer_id
);
$tmp
[
'special_additional'
]
=
ModelsLawyerCost
::
getSpecialAdditional
(
$item
->
lawyer_id
);
$tmp
[
'social'
]
=
ModelsLawyerCost
::
getSocial
(
$item
->
lawyer_id
);
$tmp
[
'accumulation_fund'
]
=
ModelsLawyerCost
::
getAccumulationFund
(
$item
->
lawyer_id
);
$tmp
[
'posting_tickets_fee'
]
=
'9'
;
$tmp
[
'advance_fee'
]
=
ModelsLawyerCost
::
getAdvanceFee
(
$item
->
lawyer_id
);
$tmp
[
'payable_commission'
]
=
self
::
getPayableAmount
(
$item
->
lawyer_id
,
$
item
->
commission_rate
);
$tmp
[
'receipt_money'
]
=
$receipt_money
;
$tmp
[
'commission_amount'
]
=
self
::
getCommissionAmount
(
$
receipt_money
,
$item
->
commission_rate
);
$tmp
[
'receipt_noinvoice'
]
=
$receipt_noinvoice
;
$tmp
[
'invoice_noreceipt'
]
=
$invoice_noreceipt
;
$tmp
[
'cost'
]
=
ModelsLawyerCost
::
getTotalCost
(
$item
->
lawyer_id
,
$year
)
;
$tmp
[
'basic_salary'
]
=
ModelsLawyerCost
::
getBasiSalary
(
$item
->
lawyer_id
,
$year
);
$tmp
[
'special_additional'
]
=
ModelsLawyerCost
::
getSpecialAdditional
(
$item
->
lawyer_id
,
$year
);
$tmp
[
'social'
]
=
ModelsLawyerCost
::
getSocial
(
$item
->
lawyer_id
,
$year
);
$tmp
[
'accumulation_fund'
]
=
ModelsLawyerCost
::
getAccumulationFund
(
$item
->
lawyer_id
,
$year
);
$tmp
[
'posting_tickets_fee'
]
=
$tickets_money
;
$tmp
[
'advance_fee'
]
=
ModelsLawyerCost
::
getAdvanceFee
(
$item
->
lawyer_id
,
$year
);
$tmp
[
'payable_commission'
]
=
self
::
getPayableAmount
(
$item
->
lawyer_id
,
$
year
,
$item
->
commission_rate
,
$receipt_money
);
array_push
(
$data
,
$tmp
);
}
...
...
@@ -200,18 +221,16 @@ public function getList(array $param)
];
}
public
static
function
getPayableAmount
(
$lawyer_id
,
$
commission_rate
)
public
static
function
getPayableAmount
(
$lawyer_id
,
$
year
,
$commission_rate
,
$receipt_money
)
{
$received_money
=
ModelCovenantReceivePayment
::
getReceivedMoney
(
$lawyer_id
);
//创收已收款
$paid_amount
=
ModelsLawyerCost
::
getPaidAmount
(
$lawyer_id
);
//已支付款项
$result
=
$received_money
*
(
$commission_rate
/
100
)
-
$paid_amount
;
$paid_amount
=
ModelsLawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
);
//已支付款项
$result
=
$receipt_money
*
(
$commission_rate
/
100
)
-
$paid_amount
;
return
sprintf
(
'%.2f'
,
$result
);
}
//提成金额
public
static
function
getCommissionAmount
(
$
lawyer_id
,
$commission_rate
)
public
static
function
getCommissionAmount
(
$
receipt_money
,
$commission_rate
)
{
$received_money
=
ModelCovenantReceivePayment
::
getReceivedMoney
(
$lawyer_id
);
//创收已收款
$result
=
$received_money
*
(
$commission_rate
/
100
);
$result
=
$receipt_money
*
(
$commission_rate
/
100
);
return
sprintf
(
'%.2f'
,
$result
);
}
}
app/Models/CovenantReceivePayment.php
View file @
b0498a1a
...
...
@@ -75,7 +75,7 @@ public static function getReceivedMoney($lawyer_id = 0, $year = 0)
* received_at 收款日期
* invoiced_at 开票日期
*/
public
static
function
getReceivedMoneyByNumber
(
$number
,
$received_at
=
[],
$invoiced_at
=
[])
public
static
function
getReceivedMoneyByNumber
(
$number
,
$
year
,
$
received_at
=
[],
$invoiced_at
=
[])
{
$lawyer_id
=
$received_amount
=
0
;
...
...
@@ -130,7 +130,7 @@ public static function getReceivedMoneyByNumber($number, $received_at = [], $inv
}
}
}
$result
=
$note_monitor
->
where
(
'rtype'
,
1
)
->
groupBy
(
'rp.lawyer_id'
)
->
get
()
->
toArray
();
$result
=
$note_monitor
->
where
(
[
'rtype'
=>
1
,
'year'
=>
$year
]
)
->
groupBy
(
'rp.lawyer_id'
)
->
get
()
->
toArray
();
foreach
(
$result
as
$kk
=>
$vv
)
{
$received_amount
+=
$vv
->
received_amount
;
...
...
@@ -162,7 +162,7 @@ public static function getInvoicedMoney($lawyer_id = 0, $year = 0)
* received_at 收款日期
* invoiced_at 开票日期
*/
public
static
function
getInvoicedMoneyByNumber
(
$number
,
$received_at
=
[],
$invoiced_at
=
[])
public
static
function
getInvoicedMoneyByNumber
(
$number
,
$
year
,
$
received_at
=
[],
$invoiced_at
=
[])
{
$lawyer_id
=
$invoiced_money
=
0
;
...
...
@@ -217,7 +217,7 @@ public static function getInvoicedMoneyByNumber($number, $received_at = [], $inv
}
}
}
$result
=
$note_monitor
->
where
(
'rtype'
,
2
)
->
groupBy
(
'rp.lawyer_id'
)
->
get
()
->
toArray
();
$result
=
$note_monitor
->
where
(
[
'rtype'
=>
2
,
'year'
=>
$year
]
)
->
groupBy
(
'rp.lawyer_id'
)
->
get
()
->
toArray
();
foreach
(
$result
as
$kk
=>
$vv
)
{
$invoiced_money
+=
$vv
->
invoiced_money
;
}
...
...
@@ -231,7 +231,7 @@ public static function getInvoicedMoneyByNumber($number, $received_at = [], $inv
* number 律师编号
* received_at 收款日期
*/
public
static
function
getCommissionAmount
(
$number
,
$received_at
=
[])
public
static
function
getCommissionAmount
(
$number
,
$
year
,
$
received_at
=
[])
{
$lawyer_id
=
$total_money
=
0
;
...
...
@@ -260,7 +260,7 @@ public static function getCommissionAmount($number, $received_at = [])
}
}
$result
=
$note_monitor
->
where
(
'rtype'
,
1
)
->
groupBy
(
'rp.lawyer_id'
)
->
get
()
->
toArray
();
$result
=
$note_monitor
->
where
(
[
'rtype'
=>
1
,
'year'
=>
$year
]
)
->
groupBy
(
'rp.lawyer_id'
)
->
get
()
->
toArray
();
foreach
(
$result
as
$kk
=>
$vv
)
{
$lawyerObj
=
Lawyer
::
find
(
$vv
->
lawyer_id
);
...
...
app/Models/LawyerCost.php
View file @
b0498a1a
...
...
@@ -5,6 +5,7 @@
use
Dcat\Admin\Traits\HasDateTimeFormatter
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\DB
;
class
LawyerCost
extends
Model
{
...
...
@@ -67,38 +68,92 @@ class LawyerCost extends Model
[
'field'
=>
'personal_income_tax'
,
'name'
=>
'个人所得税'
],
];
//
//成本合计
public
static
function
getTotalCost
(
$lawyer_id
=
0
,
$year
=
0
)
{
//无票成本 + 律师年检费 + 律师年金
$where
=
[];
if
(
$lawyer_id
)
{
$where
[
'lawyer_id'
]
=
$lawyer_id
;
}
if
(
$year
)
{
$where
[
'year'
]
=
$year
;
}
$noticket_cost
=
self
::
where
(
$where
)
->
sum
(
'noticket_cost'
);
$annual_inspection_fee
=
self
::
where
(
$where
)
->
sum
(
'annual_inspection_fee'
);
$annuity
=
self
::
where
(
$where
)
->
sum
(
'annuity'
);
return
$noticket_cost
+
$annual_inspection_fee
+
$annuity
;
}
//基本工资
public
static
function
getBasiSalary
(
$lawyer_id
)
public
static
function
getBasiSalary
(
$lawyer_id
=
0
,
$year
=
0
)
{
return
self
::
where
([
'lawyer_id'
=>
$lawyer_id
])
->
sum
(
'basic_salary'
);
$where
=
[];
if
(
$lawyer_id
)
{
$where
[
'lawyer_id'
]
=
$lawyer_id
;
}
if
(
$year
)
{
$where
[
'year'
]
=
$year
;
}
return
self
::
where
(
$where
)
->
sum
(
'basic_salary'
);
}
//专项附加
public
static
function
getSpecialAdditional
(
$lawyer_id
)
public
static
function
getSpecialAdditional
(
$lawyer_id
=
0
,
$year
=
0
)
{
return
self
::
where
([
'lawyer_id'
=>
$lawyer_id
])
->
sum
(
'special_additional'
);
$where
=
[];
if
(
$lawyer_id
)
{
$where
[
'lawyer_id'
]
=
$lawyer_id
;
}
if
(
$year
)
{
$where
[
'year'
]
=
$year
;
}
return
self
::
where
(
$where
)
->
sum
(
'special_additional'
);
}
//社保
public
static
function
getSocial
(
$lawyer_id
)
public
static
function
getSocial
(
$lawyer_id
=
0
,
$year
=
0
)
{
$social_person_fee
=
self
::
where
([
'lawyer_id'
=>
$lawyer_id
])
->
sum
(
'social_person_fee'
);
$social_company_fee
=
self
::
where
([
'lawyer_id'
=>
$lawyer_id
])
->
sum
(
'social_company_fee'
);
$where
=
[];
if
(
$lawyer_id
)
{
$where
[
'lawyer_id'
]
=
$lawyer_id
;
}
if
(
$year
)
{
$where
[
'year'
]
=
$year
;
}
$social_person_fee
=
self
::
where
(
$where
)
->
sum
(
'social_person_fee'
);
$social_company_fee
=
self
::
where
(
$where
)
->
sum
(
'social_company_fee'
);
return
$social_person_fee
+
$social_company_fee
;
}
//公积金
public
static
function
getAccumulationFund
(
$lawyer_id
)
public
static
function
getAccumulationFund
(
$lawyer_id
=
0
,
$year
=
0
)
{
$accumulation_fund_person_fee
=
self
::
where
([
'lawyer_id'
=>
$lawyer_id
])
->
sum
(
'accumulation_fund_person_fee'
);
$accumulation_fund_company_fee
=
self
::
where
([
'lawyer_id'
=>
$lawyer_id
])
->
sum
(
'accumulation_fund_company_fee'
);
$where
=
[];
if
(
$lawyer_id
)
{
$where
[
'lawyer_id'
]
=
$lawyer_id
;
}
if
(
$year
)
{
$where
[
'year'
]
=
$year
;
}
$accumulation_fund_person_fee
=
self
::
where
(
$where
)
->
sum
(
'accumulation_fund_person_fee'
);
$accumulation_fund_company_fee
=
self
::
where
(
$where
)
->
sum
(
'accumulation_fund_company_fee'
);
return
$accumulation_fund_person_fee
+
$accumulation_fund_company_fee
;
}
//预支款
public
static
function
getAdvanceFee
(
$lawyer_id
)
public
static
function
getAdvanceFee
(
$lawyer_id
=
0
,
$year
=
0
)
{
return
self
::
where
([
'lawyer_id'
=>
$lawyer_id
])
->
sum
(
'advance_fee'
);
$where
=
[];
if
(
$lawyer_id
)
{
$where
[
'lawyer_id'
]
=
$lawyer_id
;
}
if
(
$year
)
{
$where
[
'year'
]
=
$year
;
}
return
self
::
where
(
$where
)
->
sum
(
'advance_fee'
);
}
...
...
@@ -131,7 +186,7 @@ public static function getPaidAmount($lawyer_id, $year = 0)
}
/**
* 贴票金额
*
单个律师
贴票金额
* commission_rate 提成比例
* ticket_ratio 贴票比例
*/
...
...
@@ -156,4 +211,76 @@ public static function getPostingTicketsMoney($lawyer_id, $year, $commission_rat
}
return
$ticket
;
}
/**
* 律师贴票金额含全部
*/
public
static
function
getAllPostingTicketsMoney
(
$lawyer_id
,
$year
)
{
$total
=
0
;
$where
=
[];
if
(
$lawyer_id
)
{
$where
[
'id'
]
=
$lawyer_id
;
}
$result
=
DB
::
table
(
'lawyer'
)
->
select
([
'id'
,
'number'
,
'commission_rate'
,
'ticket_ratio'
])
->
where
(
$where
)
->
limit
(
1500
)
->
get
();
if
(
$result
->
toArray
())
{
foreach
(
$result
as
$item
)
{
$lawyer_id
=
$item
->
id
;
$commission_rate
=
$item
->
commission_rate
;
$ticket_ratio
=
$item
->
ticket_ratio
;
$ticket
=
0
;
$received_money
=
CovenantReceivePayment
::
getReceivedMoney
(
$lawyer_id
,
$year
);
//创收已收款
$paid_amount
=
LawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
);
//已支付款项
$commission
=
$received_money
*
(
$commission_rate
/
100
);
//提成
if
(
$commission_rate
==
80
)
{
if
(
$commission
>
300000
)
{
$ticket
=
(
$received_money
-
$paid_amount
)
*
(
$ticket_ratio
/
100
);
}
}
elseif
(
$commission_rate
==
85
)
{
if
(
$commission
>
200000
)
{
$ticket
=
(
$received_money
-
$paid_amount
)
*
(
$ticket_ratio
/
100
);
}
}
elseif
(
$commission_rate
==
88
||
$commission_rate
==
90
)
{
if
(
$commission
>
200000
)
{
$ticket
=
(
$received_money
-
$paid_amount
)
*
(
$ticket_ratio
/
100
);
}
}
$total
+=
$ticket
;
}
}
return
$total
;
}
/**
* 统计所有律师可提成金额
*/
public
static
function
getAllPayableAmount
(
$lawyer_id
,
$year
)
{
$total
=
0
;
$where
=
[];
if
(
$lawyer_id
)
{
$where
[
'id'
]
=
$lawyer_id
;
}
$result
=
DB
::
table
(
'lawyer'
)
->
select
([
'id'
,
'number'
,
'commission_rate'
,
'ticket_ratio'
])
->
where
(
$where
)
->
limit
(
1500
)
->
get
();
if
(
$result
->
toArray
())
{
foreach
(
$result
as
$item
)
{
$lawyer_id
=
$item
->
id
;
$commission_rate
=
$item
->
commission_rate
;
$money
=
0
;
$receipt_money
=
CovenantReceivePayment
::
getReceivedMoney
(
$lawyer_id
,
$year
);
$paid_amount
=
LawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
);
//已支付款项
$money
=
$receipt_money
*
(
$commission_rate
/
100
)
-
$paid_amount
;
$total
+=
$money
;
}
}
return
$total
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment