Commit 78f7c207 by lizhilin

更新

parent 2f291d78
......@@ -25,46 +25,50 @@ class LawyerCollectController extends AdminController
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'] ?? '';
//筛选参数
$received_at = $invoiced_at = $params = [];
$params['number'] = $_GET['number'] ?? ''; //律师编号
$params['year'] = $_GET['number'] ?? date('Y'); //律师编号
$received_at['start'] = isset($_GET['received_at']['start']) && $_GET['received_at']['start'] ? $_GET['received_at']['start'] . "-01" : '';
$received_at['end'] = isset($_GET['received_at']['end']) && $_GET['received_at']['end'] ? $_GET['received_at']['end'] . "-31" : '';
$invoiced_at['start'] = isset($_GET['invoiced_at']['start']) && $_GET['invoiced_at']['start'] ? $_GET['invoiced_at']['start'] . '-01' : '';
$invoiced_at['end'] = isset($_GET['invoiced_at']['end']) && $_GET['invoiced_at']['end'] ? $_GET['invoiced_at']['end'] . '-31' : '';
$lawyer_id = 0;
$number = $params['number'];
$year = $params['year'];
$lawyObj = ModelLawyer::where('number', $number)->first();
if ($lawyObj) {
$lawyer_id = $lawyObj->number;
}
$totalInfo = ModelLawyer::getTotalInfo($params, $received_at, $invoiced_at);
//创收已收款
$received_amount = ModelsCovenantReceivePayment::getReceivedMoneyByNumber($number, $year, $received_at, $invoiced_at);
$received_amount = $totalInfo['receipt_money']; //ModelsCovenantReceivePayment::getReceivedMoneyByNumber($number, $year, $received_at, $invoiced_at);
//已开票
$invoiced_money = ModelsCovenantReceivePayment::getInvoicedMoneyByNumber($number, $year, $received_at, $invoiced_at);
$invoiced_money = $totalInfo['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, $year, $received_at);
$commissionAmount = $totalInfo['commission_amount']; //ModelsCovenantReceivePayment::getCommissionAmount($number, $year, $received_at);
//成本合计
$costTotal = ModelLawyerCost::getTotalCost($lawyer_id, $year);
$costTotal = $totalInfo['cost'];
//基本工资
$basicSalary = ModelLawyerCost::getBasiSalary($lawyer_id, $year);
$basicSalary = $totalInfo['salary'];
//专项附加
$special_additional = ModelLawyerCost::getSpecialAdditional($lawyer_id, $year);
$special_additional = $totalInfo['special_additional'];
//社保
$social = ModelLawyerCost::getSocial($lawyer_id, $year);
$social = $totalInfo['social'];
//公积金
$accumulation_fund = ModelLawyerCost::getAccumulationFund($lawyer_id, $year);
$accumulation_fund = $totalInfo['accumulation_fund'];
//贴票金额
$posting_tickets = ModelLawyerCost::getAllPostingTicketsMoney($lawyer_id, $year);
$posting_tickets = $totalInfo['tickets_money'];
//预支款
$advance_fee = ModelLawyerCost::getAdvanceFee($lawyer_id, $year);
$advance_fee = $totalInfo['advance_fee'];
//可结算提成
$payable_amount = ModelLawyerCost::getAllPayableAmount($lawyer_id, $year);
$payable_amount = $totalInfo['payable_commission'];
// 添加一行表头数据
$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 ">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment