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
2540ec48
Commit
2540ec48
authored
Jun 30, 2025
by
liuyingkang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(律师提成计算): 修复预留结案费计算逻辑并优化相关功能
修复预留结案费计算时未过滤合同类型的问题,优化已贴票金额显示和计算逻辑 调整律师成本计算规则,增加预支款和预留结案费处理 修复导出功能中输出缓冲区处理问题
parent
445032b5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
184 additions
and
52 deletions
+184
-52
app/Admin/Controllers/CovenantController.php
+31
-16
app/Admin/Controllers/LawyerCommissionCollectController.php
+4
-1
app/Admin/Controllers/LawyerCommissionController.php
+1
-1
app/Admin/Controllers/LawyerCostController.php
+1
-1
app/Admin/Extensions/lawyerCommissionExportExten.php
+13
-0
app/Admin/Repositories/LawyerCommission.php
+18
-2
app/Admin/Repositories/LawyerCommission.php-20250110
+1
-0
app/Models/CovenantReceivePayment.php
+28
-1
app/Models/LawyerCost.php
+87
-30
No files found.
app/Admin/Controllers/CovenantController.php
View file @
2540ec48
...
@@ -59,18 +59,33 @@ protected function grid()
...
@@ -59,18 +59,33 @@ protected function grid()
$grid
->
column
(
'sign_at'
);
$grid
->
column
(
'sign_at'
);
$grid
->
column
(
'principal'
,
'委托人'
);
$grid
->
column
(
'principal'
,
'委托人'
);
$grid
->
column
(
'lawyer.name'
,
'办案律师'
);
$grid
->
column
(
'lawyer.name'
,
'办案律师'
);
$grid
->
column
(
'amount'
)
->
display
(
function
(
$val
)
{
return
number_format
(
$val
,
2
);
});
$grid
->
column
(
'payment_method'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'payment_method'
)
->
display
(
function
(
$val
)
{
return
$val
==
1
?
'开票付款'
:
'付款开票'
;
return
$val
==
1
?
'开票付款'
:
'付款开票'
;
});
});
$grid
->
column
(
'reserve_fee'
,
'预留结案费'
)
->
display
(
function
()
{
$lawyerObj
=
ModelLawyer
::
find
(
$this
->
lawyer_id
);
//行政2角色无法看到amount、reserve_fee
$commission_rate
=
$lawyerObj
->
commission_rate
;
if
(
Admin
::
user
()
->
roles
->
contains
(
'id'
,
4
))
{
$result
=
$this
->
amount
*
$commission_rate
/
100
*
0.05
;
$grid
->
disableColumnSelector
();
return
number_format
(
$result
,
2
);
$grid
->
disableActions
();
});
}
else
{
$grid
->
column
(
'amount'
)
->
display
(
function
(
$val
)
{
return
number_format
(
$val
,
2
);
});
$grid
->
column
(
'reserve_fee'
,
'预留结案费'
)
->
display
(
function
()
{
// 只有特定合同类型才计算预留结案费
if
(
!
in_array
(
$this
->
ctype
,
[
1
,
2
,
3
,
6
,
8
]))
{
return
number_format
(
0
,
2
);
}
$lawyerObj
=
ModelLawyer
::
find
(
$this
->
lawyer_id
);
$commission_rate
=
$lawyerObj
->
commission_rate
;
$result
=
$this
->
amount
*
$commission_rate
/
100
*
0.05
;
return
number_format
(
$result
,
2
);
});
}
$grid
->
column
(
'is_closed'
,
'结案状态'
)
->
display
(
function
(
$val
)
{
$grid
->
column
(
'is_closed'
,
'结案状态'
)
->
display
(
function
(
$val
)
{
return
$val
?
'已结案'
:
'未结案'
;
return
$val
?
'已结案'
:
'未结案'
;
});
});
...
@@ -188,7 +203,7 @@ protected function detail($id)
...
@@ -188,7 +203,7 @@ protected function detail($id)
// $form->select('lawyer_id')->options($lawyers)->required();
// $form->select('lawyer_id')->options($lawyers)->required();
// $form->text('amount')->required();
// $form->text('amount')->required();
// $form->select('payment_method')->options(Covenant::PAYMENT_METHOD)->default(1)->required();
// $form->select('payment_method')->options(Covenant::PAYMENT_METHOD)->default(1)->required();
// $form->text('avoid', '回避信息' );
// $form->text('avoid', '回避信息' );
// $form->text('remark', '备注');
// $form->text('remark', '备注');
...
@@ -227,15 +242,15 @@ public function destroy($id)
...
@@ -227,15 +242,15 @@ public function destroy($id)
try
{
try
{
// 软删除关联的收款、开票记录
// 软删除关联的收款、开票记录
ModelCovenantReceivePayment
::
where
(
'cid'
,
$id
)
->
update
([
'deleted_at'
=>
now
()]);
ModelCovenantReceivePayment
::
where
(
'cid'
,
$id
)
->
update
([
'deleted_at'
=>
now
()]);
// 删除合同
// 删除合同
$res
=
$this
->
form
()
->
destroy
(
$id
);
$res
=
$this
->
form
()
->
destroy
(
$id
);
DB
::
commit
();
DB
::
commit
();
return
$res
;
return
$res
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
DB
::
rollBack
();
DB
::
rollBack
();
Log
::
Add
(
'debug'
,
'删除合同失败:'
.
$e
->
getMessage
());
Log
::
Add
(
'debug'
,
'删除合同失败:'
.
$e
->
getMessage
());
return
false
;
return
false
;
}
}
}
}
...
@@ -267,8 +282,8 @@ protected function form()
...
@@ -267,8 +282,8 @@ protected function form()
$form
->
select
(
'lawyer_id'
)
->
options
(
$lawyers
)
->
required
();
$form
->
select
(
'lawyer_id'
)
->
options
(
$lawyers
)
->
required
();
$form
->
text
(
'amount'
)
->
required
();
$form
->
text
(
'amount'
)
->
required
();
$form
->
select
(
'payment_method'
)
->
options
(
Covenant
::
PAYMENT_METHOD
)
->
default
(
1
)
->
required
();
$form
->
select
(
'payment_method'
)
->
options
(
Covenant
::
PAYMENT_METHOD
)
->
default
(
1
)
->
required
();
$form
->
text
(
'avoid'
,
'回避信息'
);
$form
->
text
(
'avoid'
,
'回避信息'
);
$form
->
text
(
'remark'
,
'备注'
);
$form
->
text
(
'remark'
,
'备注'
);
$form
->
disableCreatingCheck
();
$form
->
disableCreatingCheck
();
...
@@ -302,7 +317,7 @@ function (Form $form, $result) {
...
@@ -302,7 +317,7 @@ function (Form $form, $result) {
DB
::
commit
();
DB
::
commit
();
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
DB
::
rollBack
();
DB
::
rollBack
();
Log
::
Add
(
'debug'
,
'更新合同关联记录失败:'
.
$e
->
getMessage
());
Log
::
Add
(
'debug'
,
'更新合同关联记录失败:'
.
$e
->
getMessage
());
}
}
}
}
);
);
...
...
app/Admin/Controllers/LawyerCommissionCollectController.php
View file @
2540ec48
...
@@ -85,7 +85,10 @@ public function lawyerCommissionExport(Request $request)
...
@@ -85,7 +85,10 @@ public function lawyerCommissionExport(Request $request)
$param
=
json_decode
(
$request
->
get
(
'param'
));
$param
=
json_decode
(
$request
->
get
(
'param'
));
ob_end_clean
();
// 检查是否有活动的输出缓冲区
if
(
ob_get_level
()
>
0
)
{
ob_end_clean
();
}
return
Excel
::
download
(
new
lawyerCommissionExportExten
(
$param
),
$filename
.
'.xlsx'
);
return
Excel
::
download
(
new
lawyerCommissionExportExten
(
$param
),
$filename
.
'.xlsx'
);
}
}
}
}
app/Admin/Controllers/LawyerCommissionController.php
View file @
2540ec48
...
@@ -41,7 +41,7 @@ protected function grid()
...
@@ -41,7 +41,7 @@ protected function grid()
return
number_format
(
$tickets_money
,
2
);
return
number_format
(
$tickets_money
,
2
);
});
});
$grid
->
column
(
'commission_retention'
,
'预留结案费'
)
->
display
(
function
()
use
(
$year
)
{
$grid
->
column
(
'commission_retention'
,
'预留结案费'
)
->
display
(
function
()
use
(
$year
)
{
$received_money
=
ModelCovenantReceivePayment
::
getReceivedMoney
(
$this
->
id
,
$year
);
//创收已收款
$received_money
=
ModelCovenantReceivePayment
::
getReceivedMoney
ByPayableAmount
(
$this
->
id
,
$year
);
//创收已收款
$commission_rate
=
$this
->
commission_rate
;
//提成比例
$commission_rate
=
$this
->
commission_rate
;
//提成比例
$result
=
$received_money
*
(
$commission_rate
/
100
)
*
0.05
;
$result
=
$received_money
*
(
$commission_rate
/
100
)
*
0.05
;
return
number_format
(
$result
,
2
);
return
number_format
(
$result
,
2
);
...
...
app/Admin/Controllers/LawyerCostController.php
View file @
2540ec48
...
@@ -273,7 +273,7 @@ protected function form()
...
@@ -273,7 +273,7 @@ protected function form()
$form
->
text
(
'annuity'
);
$form
->
text
(
'annuity'
);
$form
->
text
(
'assistant_fee'
);
$form
->
text
(
'assistant_fee'
);
$form
->
text
(
'office_rental_fee'
);
$form
->
text
(
'office_rental_fee'
);
$form
->
text
(
'posting_tickets_fee_the
ory
'
,
'已贴票金额'
);
$form
->
text
(
'posting_tickets_fee_the'
,
'已贴票金额'
);
$form
->
text
(
'noticket_cost'
)
->
readOnly
();
$form
->
text
(
'noticket_cost'
)
->
readOnly
();
$form
->
text
(
'advance_fee'
);
$form
->
text
(
'advance_fee'
);
$form
->
text
(
'personal_income_tax'
)
->
required
();
$form
->
text
(
'personal_income_tax'
)
->
required
();
...
...
app/Admin/Extensions/lawyerCommissionExportExten.php
View file @
2540ec48
...
@@ -186,6 +186,13 @@ public function getList($param)
...
@@ -186,6 +186,13 @@ public function getList($param)
$reserved_closing_fee
=
$receiveMoeny
*
(
$commission_rate
/
100
)
*
0.05
;
$reserved_closing_fee
=
$receiveMoeny
*
(
$commission_rate
/
100
)
*
0.05
;
$tmp
[
$i
]
=
sprintf
(
'%.2f'
,
$reserved_closing_fee
);
$tmp
[
$i
]
=
sprintf
(
'%.2f'
,
$reserved_closing_fee
);
}
}
//已贴票金额
if
(
$val
[
'field'
]
==
'posting_tickets_fee_the'
)
{
$posting_tickets_fee_the
=
ModelLawyerCost
::
where
(
$condition
)
->
sum
(
'posting_tickets_fee_the'
);
$tmp
[
$i
]
=
$posting_tickets_fee_the
;
}
//贴票金额
//贴票金额
if
(
$val
[
'field'
]
==
'posting_tickets_money'
)
{
if
(
$val
[
'field'
]
==
'posting_tickets_money'
)
{
$tickets_money
=
ModelLawyerCost
::
getPostingTicketsMoney
(
$lawyer_id
,
$year
,
$commission_rate
,
$ticket_ratio
,
$i
);
$tickets_money
=
ModelLawyerCost
::
getPostingTicketsMoney
(
$lawyer_id
,
$year
,
$commission_rate
,
$ticket_ratio
,
$i
);
...
@@ -200,6 +207,12 @@ public function getList($param)
...
@@ -200,6 +207,12 @@ public function getList($param)
$royalty_amount
=
$receiveMoeny
*
(
$commission_rate
/
100
);
$royalty_amount
=
$receiveMoeny
*
(
$commission_rate
/
100
);
$paid_amount
=
ModelLawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
,
$i
);
$paid_amount
=
ModelLawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
,
$i
);
$payable_money
=
$royalty_amount
-
$paid_amount
;
$payable_money
=
$royalty_amount
-
$paid_amount
;
//还需要减去10预留结案费
$reserved_closing_fee
=
$receiveMoeny
*
(
$commission_rate
/
100
)
*
0.05
;
$payable_money
-=
$reserved_closing_fee
;
$tmp
[
$i
]
=
$payable_money
;
$tmp
[
$i
]
=
$payable_money
;
}
}
//个人所得税
//个人所得税
...
...
app/Admin/Repositories/LawyerCommission.php
View file @
2540ec48
...
@@ -151,9 +151,18 @@ public function get(Grid\Model $model)
...
@@ -151,9 +151,18 @@ public function get(Grid\Model $model)
}
}
//预留结案费
//预留结案费
if
(
$val
[
'field'
]
==
'reserved_closing_fee'
)
{
if
(
$val
[
'field'
]
==
'reserved_closing_fee'
)
{
$reserved_closing_fee
=
$receiveMoeny
*
(
$commission_rate
/
100
)
*
0.05
;
$PayableAmount
=
ModelCovenantReceivePayment
::
getReceivedMoneyByPayableAmount
(
$lawyer_id
,
$year
,
$i
);
$reserved_closing_fee
=
$PayableAmount
*
(
$commission_rate
/
100
)
*
0.05
;
$tmp
[
$i
]
=
sprintf
(
'%.2f'
,
$reserved_closing_fee
);
$tmp
[
$i
]
=
sprintf
(
'%.2f'
,
$reserved_closing_fee
);
}
}
//已贴票金额
if
(
$val
[
'field'
]
==
'posting_tickets_fee_the'
)
{
$posting_tickets_fee_the
=
ModelLawyerCost
::
where
(
$condition
)
->
sum
(
'posting_tickets_fee_the'
);
$tmp
[
$i
]
=
$posting_tickets_fee_the
;
}
//贴票金额
//贴票金额
if
(
$val
[
'field'
]
==
'posting_tickets_money'
)
{
if
(
$val
[
'field'
]
==
'posting_tickets_money'
)
{
$tickets_money
=
ModelLawyerCost
::
getPostingTicketsMoney
(
$lawyer_id
,
$year
,
$commission_rate
,
$ticket_ratio
,
$i
);
$tickets_money
=
ModelLawyerCost
::
getPostingTicketsMoney
(
$lawyer_id
,
$year
,
$commission_rate
,
$ticket_ratio
,
$i
);
...
@@ -161,13 +170,19 @@ public function get(Grid\Model $model)
...
@@ -161,13 +170,19 @@ public function get(Grid\Model $model)
}
}
//提成留底
//提成留底
if
(
$val
[
'field'
]
==
'commission_retention'
)
{
if
(
$val
[
'field'
]
==
'commission_retention'
)
{
$tmp
[
$i
]
=
$commission_retention
;
$tmp
[
$i
]
=
'4万'
;
// 默认显示4万
}
}
//可支付提成结算金额
//可支付提成结算金额
//这段代码的核心逻辑是通过提成金额减去已支付款项,计算出律师实际可获得的提成结算金额。提成金额 - 已支付款项 = 可支付提成结算金额。
if
(
$val
[
'field'
]
==
'payable_commission_amount'
)
{
if
(
$val
[
'field'
]
==
'payable_commission_amount'
)
{
$royalty_amount
=
$receiveMoeny
*
(
$commission_rate
/
100
);
$royalty_amount
=
$receiveMoeny
*
(
$commission_rate
/
100
);
$paid_amount
=
ModelLawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
,
$i
);
$paid_amount
=
ModelLawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
,
$i
);
$payable_money
=
$royalty_amount
-
$paid_amount
;
$payable_money
=
$royalty_amount
-
$paid_amount
;
// //还需要减去10预留结案费
// $reserved_closing_fee = $receiveMoeny * ($commission_rate / 100) * 0.05;
// $payable_money -= $reserved_closing_fee;
$tmp
[
$i
]
=
$payable_money
;
$tmp
[
$i
]
=
$payable_money
;
}
}
//个人所得税
//个人所得税
...
@@ -188,6 +203,7 @@ public function get(Grid\Model $model)
...
@@ -188,6 +203,7 @@ public function get(Grid\Model $model)
//转成字符串
//转成字符串
foreach
(
$data
as
$kk
=>
&
$vv
)
{
foreach
(
$data
as
$kk
=>
&
$vv
)
{
if
(
$vv
[
'title'
]
==
'提成比例'
||
$vv
[
'title'
]
==
'提成留底'
)
{
if
(
$vv
[
'title'
]
==
'提成比例'
||
$vv
[
'title'
]
==
'提成留底'
)
{
$vv
[
'total'
]
=
$vv
[
'title'
]
==
'提成留底'
?
'4万'
:
$vv
[
'total'
];
// 默认显示4万
continue
;
continue
;
}
}
if
(
isset
(
$vv
[
1
]))
{
if
(
isset
(
$vv
[
1
]))
{
...
...
app/Admin/Repositories/LawyerCommission
-20250110.php
→
app/Admin/Repositories/LawyerCommission
.php-20250110
View file @
2540ec48
...
@@ -186,6 +186,7 @@ public function get(Grid\Model $model)
...
@@ -186,6 +186,7 @@ public function get(Grid\Model $model)
//转成字符串
//转成字符串
foreach ($data as $kk => &$vv) {
foreach ($data as $kk => &$vv) {
if ($vv['title'] == '提成比例' || $vv['title'] == '提成留底') {
if ($vv['title'] == '提成比例' || $vv['title'] == '提成留底') {
$vv['total'] = $vv['title'] == '提成留底' ? '4万' : $vv['total'];
continue;
continue;
}
}
if (isset($vv[1])) {
if (isset($vv[1])) {
...
...
app/Models/CovenantReceivePayment.php
View file @
2540ec48
...
@@ -39,7 +39,7 @@ class CovenantReceivePayment extends Model
...
@@ -39,7 +39,7 @@ class CovenantReceivePayment extends Model
*/
*/
public
function
covenant
()
public
function
covenant
()
{
{
return
$this
->
belongsTo
(
Covenant
::
class
,
'c
ovenant_
id'
,
'id'
);
return
$this
->
belongsTo
(
Covenant
::
class
,
'cid'
,
'id'
);
}
}
/**
/**
...
@@ -103,6 +103,33 @@ public static function getReceivedMoney($lawyer_id = 0, $year = 0, $month = 0)
...
@@ -103,6 +103,33 @@ public static function getReceivedMoney($lawyer_id = 0, $year = 0, $month = 0)
->
sum
(
'received_amount'
);
->
sum
(
'received_amount'
);
return
$money
;
return
$money
;
}
}
//创收已收款by预留结案费【专门用于计算预留结案费】
//合同类型中民事诉讼代理、刑事诉讼辩护及代理、行政诉讼代理、仲裁业务、其它是需要计算结案费,以外的类型是不用计算的。
//具体看:Covenant::CTYPE[$val];1、2、3、6、8
public
static
function
getReceivedMoneyByPayableAmount
(
$lawyer_id
=
0
,
$year
=
0
,
$month
=
0
)
{
$where
=
[
'rtype'
=>
1
];
if
(
$lawyer_id
)
{
$where
[
'lawyer_id'
]
=
$lawyer_id
;
}
if
(
$year
)
{
$where
[
'year'
]
=
$year
;
}
if
(
$month
)
{
$where
[
'month'
]
=
$month
;
}
// 修改为通过关联合同表查询指定类别
$money
=
self
::
where
(
$where
)
->
whereHas
(
'covenant'
,
function
(
$query
)
{
$query
->
whereIn
(
'ctype'
,
[
1
,
2
,
3
,
6
,
8
]);
})
->
sum
(
'received_amount'
);
return
$money
;
}
/**
/**
* 创收已收款
* 创收已收款
* number 律师编号
* number 律师编号
...
...
app/Models/LawyerCost.php
View file @
2540ec48
...
@@ -8,6 +8,10 @@
...
@@ -8,6 +8,10 @@
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
App\Command\Log
;
use
App\Command\Log
;
use
App\Models\CovenantReceivePayment
as
ModelCovenantReceivePayment
;
use
App\Models\LawyerCost
as
ModelLawyerCost
;
use
App\Models\Lawyer
as
ModelLawyer
;
class
LawyerCost
extends
Model
class
LawyerCost
extends
Model
{
{
use
HasDateTimeFormatter
;
use
HasDateTimeFormatter
;
...
@@ -64,6 +68,7 @@ class LawyerCost extends Model
...
@@ -64,6 +68,7 @@ class LawyerCost extends Model
[
'field'
=>
'assistant_fee'
,
'name'
=>
'8.助理律师成本'
],
[
'field'
=>
'assistant_fee'
,
'name'
=>
'8.助理律师成本'
],
[
'field'
=>
'advance_fee'
,
'name'
=>
'9.预支款'
],
[
'field'
=>
'advance_fee'
,
'name'
=>
'9.预支款'
],
[
'field'
=>
'reserved_closing_fee'
,
'name'
=>
'10.预留结案费'
],
[
'field'
=>
'reserved_closing_fee'
,
'name'
=>
'10.预留结案费'
],
[
'field'
=>
'posting_tickets_fee_the'
,
'name'
=>
'11.已贴票金额'
],
[
'field'
=>
'posting_tickets_money'
,
'name'
=>
'贴票金额'
],
[
'field'
=>
'posting_tickets_money'
,
'name'
=>
'贴票金额'
],
[
'field'
=>
'commission_retention'
,
'name'
=>
'提成留底'
],
[
'field'
=>
'commission_retention'
,
'name'
=>
'提成留底'
],
[
'field'
=>
'payable_commission_amount'
,
'name'
=>
'可支付提成结算金额'
],
[
'field'
=>
'payable_commission_amount'
,
'name'
=>
'可支付提成结算金额'
],
...
@@ -161,6 +166,31 @@ public static function getAdvanceFee($lawyer_id = 0, $year = 0)
...
@@ -161,6 +166,31 @@ public static function getAdvanceFee($lawyer_id = 0, $year = 0)
//已支付款项
//已支付款项
/**
* 获取已支付款项
*
* 计算规则:
* 1. 根据律师ID、年份和月份查询相关记录
* 2. 累加各项费用:1-11
* - 基本工资
* - 专项附加
* - 社保单位部分
* - 公积金单位部分
* - 律所年检费
* - 律所年金
* - 办公室租金
* - 助理律师成本
* - 预支款
* - 预留结案费
* - 已贴票金额
* 3. 减去已贴票金额
* 4. 返回最终计算结果
*
* @param int $lawyer_id 律师ID
* @param int $year 年份
* @param int $month 月份
* @return float 已支付款项
*/
public
static
function
getPaidAmount
(
$lawyer_id
,
$year
=
0
,
$month
=
0
)
public
static
function
getPaidAmount
(
$lawyer_id
,
$year
=
0
,
$month
=
0
)
{
{
$paid_amount
=
0
;
$paid_amount
=
0
;
...
@@ -175,20 +205,34 @@ public static function getPaidAmount($lawyer_id, $year = 0, $month = 0)
...
@@ -175,20 +205,34 @@ public static function getPaidAmount($lawyer_id, $year = 0, $month = 0)
if
(
$list
->
toArray
())
{
if
(
$list
->
toArray
())
{
$basic_salary
=
$special_additional
=
$social_company_fee
=
$accumulation_fund_company_fee
=
0
;
$basic_salary
=
$special_additional
=
$social_company_fee
=
$accumulation_fund_company_fee
=
0
;
$annual_inspection_fee
=
$annuity
=
$office_rental_fee
=
$assistant_fee
=
$posting_tickets_fee_the
=
0
;
$annual_inspection_fee
=
$annuity
=
$office_rental_fee
=
$assistant_fee
=
$posting_tickets_fee_the
=
0
;
$advance_fee
=
$reserved_closing_fee
=
0
;
foreach
(
$list
as
$item
)
{
foreach
(
$list
as
$item
)
{
$basic_salary
+=
$item
->
basic_salary
;
// 累加各项费用
$special_additional
+=
$item
->
special_additional
;
$basic_salary
+=
$item
->
basic_salary
;
// 基本工资
$social_company_fee
+=
$item
->
social_company_fee
;
$special_additional
+=
$item
->
special_additional
;
// 专项附加
$accumulation_fund_company_fee
+=
$item
->
accumulation_fund_company_fee
;
$social_company_fee
+=
$item
->
social_company_fee
;
// 社保单位部分
$annual_inspection_fee
+=
$item
->
annual_inspection_fee
;
$accumulation_fund_company_fee
+=
$item
->
accumulation_fund_company_fee
;
// 公积金单位部分
$annuity
+=
$item
->
annuity
;
$annual_inspection_fee
+=
$item
->
annual_inspection_fee
;
// 律所年检费
$office_rental_fee
+=
$item
->
office_rental_fee
;
$annuity
+=
$item
->
annuity
;
// 律所年金
$assistant_fee
+=
$item
->
assistant_fee
;
$office_rental_fee
+=
$item
->
office_rental_fee
;
// 办公室租金
$posting_tickets_fee_the
+=
$item
->
posting_tickets_fee_the
;
//已贴票金额[要减去已贴票金额]
$assistant_fee
+=
$item
->
assistant_fee
;
// 助理律师成本
$advance_fee
+=
$item
->
advance_fee
;
// 预支款
$posting_tickets_fee_the
+=
$item
->
posting_tickets_fee_the
;
// 已贴票金额[要减去已贴票金额]
}
}
//律师比例
$Lawyer
=
ModelLawyer
::
where
([
'id'
=>
$lawyer_id
])
->
first
();
//创收收款
$receiveMoeny
=
ModelCovenantReceivePayment
::
getReceivedMoney
(
$lawyer_id
,
$year
,
$month
);
//预留结案费
$reserved_closing_fee
=
$receiveMoeny
*
(
$Lawyer
[
'commission_rate'
]
/
100
)
*
0.05
;
$paid_amount
=
$basic_salary
+
$special_additional
+
$social_company_fee
$paid_amount
=
$basic_salary
+
$special_additional
+
$social_company_fee
+
$accumulation_fund_company_fee
+
$annual_inspection_fee
+
$annuity
+
$accumulation_fund_company_fee
+
$annual_inspection_fee
+
$annuity
+
$office_rental_fee
+
$assistant_fee
-
$posting_tickets_fee_the
;
+
$office_rental_fee
+
$assistant_fee
+
$advance_fee
+
$reserved_closing_fee
+
$posting_tickets_fee_the
;
if
(
$lawyer_id
==
'5'
)
{
if
(
$lawyer_id
==
'5'
)
{
Log
::
add
(
'已支付款项'
,
[
Log
::
add
(
'已支付款项'
,
[
...
@@ -200,7 +244,9 @@ public static function getPaidAmount($lawyer_id, $year = 0, $month = 0)
...
@@ -200,7 +244,9 @@ public static function getPaidAmount($lawyer_id, $year = 0, $month = 0)
'annuity'
=>
$annuity
,
'annuity'
=>
$annuity
,
'office_rental_fee'
=>
$office_rental_fee
,
'office_rental_fee'
=>
$office_rental_fee
,
'assistant_fee'
=>
$assistant_fee
,
'assistant_fee'
=>
$assistant_fee
,
'posting_tickets_fee_the'
=>
$posting_tickets_fee_the
,
//已贴票金额
'advance_fee'
=>
$advance_fee
,
'reserved_closing_fee'
=>
$reserved_closing_fee
,
'posting_tickets_fee_the'
=>
$posting_tickets_fee_the
,
'paid_amount'
=>
$paid_amount
,
//已贴票金额
'paid_amount'
=>
$paid_amount
,
//已贴票金额
]);
]);
}
}
...
@@ -220,14 +266,21 @@ public static function getPostingTicketsMoney($lawyer_id, $year, $commission_rat
...
@@ -220,14 +266,21 @@ public static function getPostingTicketsMoney($lawyer_id, $year, $commission_rat
$paid_amount
=
LawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
,
$month
);
//已支付款项
$paid_amount
=
LawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
,
$month
);
//已支付款项
$commission
=
$received_money
*
(
$commission_rate
/
100
);
//提成
$commission
=
$received_money
*
(
$commission_rate
/
100
);
//提成
Log
::
add
(
'贴票金额'
,
[
if
(
$lawyer_id
==
5
)
{
'received_money'
=>
$received_money
,
Log
::
add
(
'贴票金额'
,
[
'paid_amount'
=>
$paid_amount
,
'received_money'
=>
$received_money
,
'commission'
=>
$commission
,
'paid_amount'
=>
$paid_amount
,
'ticket_ratio'
=>
$ticket_ratio
,
'commission'
=>
$commission
,
'commission_rate'
=>
$commission_rate
,
'ticket_ratio'
=>
$ticket_ratio
,
'ticket'
=>
$ticket
,
'commission_rate'
=>
$commission_rate
,
]);
'ticket'
=>
$ticket
,
]);
}
//预支款不参与贴票金额计算,但是paid_amount包含预支款,所以在这里加上预支款
$advance_fee
=
self
::
where
([
'lawyer_id'
=>
$lawyer_id
,
'year'
=>
$year
,
'month'
=>
$month
])
->
sum
(
'advance_fee'
);
$paid_amount
-=
$advance_fee
;
if
(
$commission_rate
==
80
)
{
if
(
$commission_rate
==
80
)
{
if
(
$commission
>
300000
)
{
if
(
$commission
>
300000
)
{
...
@@ -244,14 +297,18 @@ public static function getPostingTicketsMoney($lawyer_id, $year, $commission_rat
...
@@ -244,14 +297,18 @@ public static function getPostingTicketsMoney($lawyer_id, $year, $commission_rat
}
}
}
}
if
(
$lawyer_id
==
5
)
{
Log
::
add
(
'贴票金额2'
,
[
'received_money'
=>
$received_money
,
'paid_amount'
=>
$paid_amount
,
'commission'
=>
$commission
,
'ticket_ratio'
=>
$ticket_ratio
,
'ticket'
=>
$ticket
,
'advance_fee'
=>
$advance_fee
,
]);
}
Log
::
add
(
'贴票金额2'
,
[
'received_money'
=>
$received_money
,
'paid_amount'
=>
$paid_amount
,
'commission'
=>
$commission
,
'ticket_ratio'
=>
$ticket_ratio
,
'ticket'
=>
$ticket
,
]);
return
$ticket
;
return
$ticket
;
}
}
...
@@ -284,14 +341,14 @@ public static function getAllPostingTicketsMoney($lawyer_id, $year)
...
@@ -284,14 +341,14 @@ public static function getAllPostingTicketsMoney($lawyer_id, $year)
$monthArr
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
];
$monthArr
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
];
foreach
(
$monthArr
as
$m
)
{
foreach
(
$monthArr
as
$m
)
{
$ticket
=
0
;
$ticket
=
0
;
//创收已收款
//创收已收款
$received_money
=
CovenantReceivePayment
::
getReceivedMoney
(
$lawyer_id
,
$year
,
$m
);
$received_money
=
CovenantReceivePayment
::
getReceivedMoney
(
$lawyer_id
,
$year
,
$m
);
//已支付款项
//已支付款项
$paid_amount
=
LawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
,
$m
);
$paid_amount
=
LawyerCost
::
getPaidAmount
(
$lawyer_id
,
$year
,
$m
);
//提成=创收已收款*提成比例
//提成=创收已收款*提成比例
$commission
=
$received_money
*
(
$commission_rate
/
100
);
$commission
=
$received_money
*
(
$commission_rate
/
100
);
if
(
$commission_rate
==
80
)
{
if
(
$commission_rate
==
80
)
{
if
(
$commission
>
300000
)
{
if
(
$commission
>
300000
)
{
...
@@ -309,7 +366,7 @@ public static function getAllPostingTicketsMoney($lawyer_id, $year)
...
@@ -309,7 +366,7 @@ public static function getAllPostingTicketsMoney($lawyer_id, $year)
$total
+=
$ticket
;
$total
+=
$ticket
;
if
(
$lawyerObj
->
name
==
'周志强'
&&
$m
<
4
)
{
if
(
$lawyerObj
->
name
==
'周志强'
&&
$m
<
4
)
{
//我说怎么一直计算不对,加了贴票金额但是总得不变,原来是有的月份根本不计算贴票金额,没达标
//我说怎么一直计算不对,加了贴票金额但是总得不变,原来是有的月份根本不计算贴票金额,没达标
Log
::
add
(
'全年贴票金额'
.
$m
,
[
Log
::
add
(
'全年贴票金额'
.
$m
,
[
...
...
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