Commit 19f3ea43 by lizhilin

更新

parent fc773c95
......@@ -206,25 +206,27 @@ protected function form()
{
$form = Form::make(new ModelLawyerCost(), function (Form $form) {
$form->display('id');
$form->text('year');
$form->select('month')->options(ModelLawyerCost::MONTH);
$form->text('number');
$form->text('lname');
$form->text('basic_salary');
$form->text('social_person_fee');
$form->text('social_company_fee');
//$form->display('social', '社保')->default(100);
$form->text('accumulation_fund_person_fee');
$form->text('accumulation_fund_company_fee');
$form->text('annual_inspection_fee');
$form->text('annuity');
$form->text('office_rental_fee');
//$form->text('noticket_cost');
$form->text('year')->default(date('Y'));
$form->select('month')->options(ModelLawyerCost::MONTH)->required();
$form->text('number')->required();
$form->text('lname')->required();
$form->text('basic_salary')->required();
$form->text('special_additional')->required();
$form->text('social_person_fee')->required();
$form->text('social_company_fee')->required();
$form->text('social', '社保')->readOnly();
$form->text('accumulation_fund_person_fee')->required();
$form->text('accumulation_fund_company_fee')->required();
$form->text('accumulation_fund', '公积金')->readOnly();
$form->text('annual_inspection_fee')->required();
$form->text('annuity')->required();
$form->text('office_rental_fee')->required();
$form->text('noticket_cost')->readOnly();
//$form->text('posting_tickets_fee');
$form->text('assistant_fee');
$form->text('special_additional');
$form->text('assistant_fee')->required();
$form->text('special_additional')->required();
$form->text('advance_fee');
$form->text('personal_income_tax');
$form->text('personal_income_tax')->required();
$form->disableCreatingCheck();
$form->disableEditingCheck();
......@@ -236,11 +238,54 @@ protected function form()
$form->display('updated_at');
});
Admin::script(
<<<JS
$(function () {
//社保
$("input[name='social_company_fee']").on('blur', function() {
var person_fee = $("input[name='social_person_fee']").val().length>0?$("input[name='social_person_fee']").val():0;
var company_fee = $("input[name='social_company_fee']").val().length>0?$("input[name='social_company_fee']").val():0;
var total = parseFloat(person_fee) + parseFloat(company_fee);
$("input[name='social']").val(total);
});
//公积金
$("input[name='accumulation_fund_company_fee']").on('blur', function() {
var person_fee = $("input[name='accumulation_fund_person_fee']").val().length>0?$("input[name='accumulation_fund_person_fee']").val():0;
var company_fee = $("input[name='accumulation_fund_company_fee']").val().length>0?$("input[name='accumulation_fund_company_fee']").val():0;
var accumulation_fund = parseFloat(person_fee) + parseFloat(company_fee);
$("input[name='accumulation_fund']").val(accumulation_fund);
});
//无票成本
$("input[name='office_rental_fee']").on('blur', function() {
//基本工资
var salary = $("input[name='basic_salary']").val().length>0?$("input[name='basic_salary']").val():0;
//专项附加
var additional = $("input[name='special_additional']").val().length>0?$("input[name='special_additional']").val():0;
//社保单位部分
var social_company = $("input[name='social_company_fee']").val().lenght>0?$("input[name='social_company_fee']").val():0;
//公积金单位部分
var accumulation_fund = $("input[name='accumulation_fund_company_fee']").val().length>0?$("input[name='accumulation_fund_company_fee']").val():0;
//助理律师成本
var assistant_fee = $("input[name='assistant_fee']").val().length>0?$("input[name='assistant_fee']").val():0;
//办公室租赁成本
var office_rental_fee = $("input[name='office_rental_fee']").val().length>0?$("input[name='office_rental_fee']").val():0;
var cost = parseFloat(salary) + parseFloat(additional)+ parseFloat(social_company)+ parseFloat(accumulation_fund)+ parseFloat(assistant_fee)+ parseFloat(office_rental_fee);
$("input[name='noticket_cost']").val(cost);
});
});
JS
);
//副表保存规格
$form->saved(
function (Form $form, $result) {
$cost_id = $form->getKey();
//律师ID
$number = $_POST['number'] ?? 0;
$lawyer_id = DB::table('lawyer')->where('number', $number)->value('id');
$basic_salary = $_POST['basic_salary'] ?? 0;
$special_additional = $_POST['special_additional'] ?? 0;
$social_company_fee = $_POST['social_company_fee'] ?? 0;
......@@ -248,9 +293,15 @@ function (Form $form, $result) {
$assistant_fee = $_POST['assistant_fee'] ?? 0;
$office_rental_fee = $_POST['office_rental_fee'] ?? 0;
//无票成本
$noticket_cost = floatval($basic_salary) + floatval($special_additional) + floatval($social_company_fee) + floatval($accumulation_fund_company_fee) + floatval($assistant_fee) + floatval($office_rental_fee);
//社保
$social_person_fee = $_POST['social_person_fee'] ?? 0;
$social = floatval($social_person_fee) + floatval($social_company_fee);
//公积金
$accumulation_fund_person_fee = $_POST['accumulation_fund_person_fee'] ?? 0;
$accumulation_fund = floatval($accumulation_fund_person_fee) + floatval($accumulation_fund_company_fee);
if ($result) {
$noticket_cost = $basic_salary + $special_additional + $social_company_fee + $accumulation_fund_company_fee + $assistant_fee + $office_rental_fee;
DB::table('lawyer_cost')->where("id", $cost_id)->update(['noticket_cost' => $noticket_cost]);
DB::table('lawyer_cost')->where("id", $cost_id)->update(['lawyer_id' => $lawyer_id, 'social' => $social, 'accumulation_fund' => $accumulation_fund, 'noticket_cost' => $noticket_cost]);
}
}
);
......
......@@ -133,25 +133,27 @@ protected function form()
{
$form = Form::make(new ModelLawyerCost(), function (Form $form) {
$form->display('id');
$form->text('year');
$form->text('year')->required();
$form->select('month')->options(ModelLawyerCost::MONTH);
$form->display('number');
$form->text('lname');
$form->text('basic_salary');
$form->text('social_person_fee');
$form->text('social_company_fee');
//$form->display('social', '社保')->default(100);
$form->text('accumulation_fund_person_fee');
$form->text('accumulation_fund_company_fee');
$form->text('annual_inspection_fee');
$form->text('annuity');
$form->text('office_rental_fee');
//$form->text('noticket_cost');
$form->text('lname')->required();
$form->text('basic_salary')->required();
$form->text('social_person_fee')->required();
$form->text('social_company_fee')->required();
//$social = $form->model()->social;
$form->text('social', '社保')->readOnly();
$form->text('accumulation_fund_person_fee')->required();
$form->text('accumulation_fund_company_fee')->required();
$form->text('accumulation_fund', '公积金')->readOnly();
$form->text('annual_inspection_fee')->required();
$form->text('annuity')->required();
$form->text('office_rental_fee')->required();
$form->text('noticket_cost')->readOnly();
//$form->text('posting_tickets_fee');
$form->text('assistant_fee');
$form->text('special_additional');
$form->text('assistant_fee')->required();
$form->text('special_additional')->required();
$form->text('advance_fee');
$form->text('personal_income_tax');
$form->text('personal_income_tax')->required();
$form->disableCreatingCheck();
$form->disableEditingCheck();
......@@ -159,10 +161,49 @@ protected function form()
$form->disableDeleteButton();
$form->disableViewButton();
$form->display('created_at');
$form->display('updated_at');
// $form->display('created_at');
// $form->display('updated_at');
});
Admin::script(
<<<JS
$(function () {
//社保
$("input[name='social_company_fee']").on('blur', function() {
var person_fee = $("input[name='social_person_fee']").val().length>0?$("input[name='social_person_fee']").val():0;
var company_fee = $("input[name='social_company_fee']").val().length>0?$("input[name='social_company_fee']").val():0;
var total = parseFloat(person_fee) + parseFloat(company_fee);
$("input[name='social']").val(total);
});
//公积金
$("input[name='accumulation_fund_company_fee']").on('blur', function() {
var person_fee = $("input[name='accumulation_fund_person_fee']").val().length>0?$("input[name='accumulation_fund_person_fee']").val():0;
var company_fee = $("input[name='accumulation_fund_company_fee']").val().length>0?$("input[name='accumulation_fund_company_fee']").val():0;
var accumulation_fund = parseFloat(person_fee) + parseFloat(company_fee);
$("input[name='accumulation_fund']").val(accumulation_fund);
});
//无票成本
$("input[name='office_rental_fee']").on('blur', function() {
//基本工资
var salary = $("input[name='basic_salary']").val().length>0?$("input[name='basic_salary']").val():0;
//专项附加
var additional = $("input[name='special_additional']").val().length>0?$("input[name='special_additional']").val():0;
//社保单位部分
var social_company = $("input[name='social_company_fee']").val().lenght>0?$("input[name='social_company_fee']").val():0;
//公积金单位部分
var accumulation_fund = $("input[name='accumulation_fund_company_fee']").val().length>0?$("input[name='accumulation_fund_company_fee']").val():0;
//助理律师成本
var assistant_fee = $("input[name='assistant_fee']").val().length>0?$("input[name='assistant_fee']").val():0;
//办公室租赁成本
var office_rental_fee = $("input[name='office_rental_fee']").val().length>0?$("input[name='office_rental_fee']").val():0;
var cost = parseFloat(salary) + parseFloat(additional)+ parseFloat(social_company)+ parseFloat(accumulation_fund)+ parseFloat(assistant_fee)+ parseFloat(office_rental_fee);
$("input[name='noticket_cost']").val(cost);
});
});
JS
);
//副表保存规格
$form->saved(
function (Form $form, $result) {
......@@ -175,9 +216,15 @@ function (Form $form, $result) {
$assistant_fee = $_POST['assistant_fee'] ?? 0;
$office_rental_fee = $_POST['office_rental_fee'] ?? 0;
//无票成本
$noticket_cost = floatval($basic_salary) + floatval($special_additional) + floatval($social_company_fee) + floatval($accumulation_fund_company_fee) + floatval($assistant_fee) + floatval($office_rental_fee);
//社保
$social_person_fee = $_POST['social_person_fee'] ?? 0;
$social = floatval($social_person_fee) + floatval($social_company_fee);
//公积金
$accumulation_fund_person_fee = $_POST['accumulation_fund_person_fee'] ?? 0;
$accumulation_fund = floatval($accumulation_fund_person_fee) + floatval($accumulation_fund_company_fee);
if ($result) {
$noticket_cost = $basic_salary + $special_additional + $social_company_fee + $accumulation_fund_company_fee + $assistant_fee + $office_rental_fee;
DB::table('lawyer_cost')->where("id", $cost_id)->update(['noticket_cost' => $noticket_cost]);
DB::table('lawyer_cost')->where("id", $cost_id)->update(['social' => $social, 'accumulation_fund' => $accumulation_fund, 'noticket_cost' => $noticket_cost]);
}
}
);
......
......@@ -45,7 +45,7 @@ protected function grid()
->body(CovenantInvoiceForm::make()->payload(['cid' => $cid])));
});
}
$grid->model()->where('lawyer_id', $lawyer_id)->where('rtype', 2)->orderBy("id", "desc");
$grid->model()->where(['rtype' => 2, 'lawyer_id' => $lawyer_id, 'cid' => $cid])->orderBy("id", "desc");
//$grid->column('id')->sortable();
$grid->column('invoiced_at', '开票时间');
$grid->column('invoiced_money', '开票金额');
......
......@@ -50,7 +50,7 @@ protected function grid()
});
$grid->model()->where('lawyer_id', $lawyer_id)->where('rtype', 1)->orderBy("id", "desc");
$grid->model()->where(['rtype' => 1, 'lawyer_id' => $lawyer_id, 'cid' => $cid])->orderBy("id", "desc");
//$grid->column('id')->sortable();
$grid->column('received_type', '收款账户')->display(function ($val) {
return $val == 1 ? '基本户' : '其它';
......
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