Commit b0ba3362 by lizhilin

更新

parent 50469b0a
...@@ -12,6 +12,16 @@ ...@@ -12,6 +12,16 @@
class CovenantClosed extends RowAction class CovenantClosed extends RowAction
{ {
protected $cid = 0;
/**
* 接收参数
*/
public function __construct($title = '', $cid = 0)
{
$this->cid = $cid;
parent::__construct($title);
$this->title = $title;
}
/** /**
* @return string * @return string
...@@ -47,13 +57,12 @@ public function handle(Request $request) ...@@ -47,13 +57,12 @@ public function handle(Request $request)
*/ */
public function render() public function render()
{ {
$cid = $this->getKey() ?? 0;
// 这里直接创建一个modal框 model的内容由工具表单提供,这里也需要创建一个工具表单才行 // 这里直接创建一个modal框 model的内容由工具表单提供,这里也需要创建一个工具表单才行
return Modal::make() return Modal::make()
->lg() ->lg()
->title('已结案') ->title('已结案')
->button("已结案") ->button("已结案")
->body(CovenantClosedForm::make()->payload(['id' => $this->getKey()])); ->body(CovenantClosedForm::make()->payload(['cid' => $this->cid]));
//->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮 //->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮
} }
......
...@@ -13,6 +13,17 @@ ...@@ -13,6 +13,17 @@
class CovenantInvoice extends RowAction class CovenantInvoice extends RowAction
{ {
protected $cid = 0;
/**
* 接收参数
*/
public function __construct($title = '', $cid = 0)
{
$this->cid = $cid;
parent::__construct($title);
$this->title = $title;
}
/** /**
* @return string * @return string
*/ */
...@@ -52,7 +63,7 @@ public function render() ...@@ -52,7 +63,7 @@ public function render()
->lg() ->lg()
->title('添加开票') ->title('添加开票')
->button("添加开票") ->button("添加开票")
->body(CovenantInvoiceForm::make()->payload(['id' => $this->getKey()])); ->body(CovenantInvoiceForm::make()->payload(['cid' => $this->cid]));
//->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮 //->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮
} }
......
...@@ -12,6 +12,16 @@ ...@@ -12,6 +12,16 @@
class CovenantReceive extends RowAction class CovenantReceive extends RowAction
{ {
protected $cid = 0;
/**
* 接收参数
*/
public function __construct($title = '', $cid = 0)
{
$this->cid = $cid;
parent::__construct($title);
$this->title = $title;
}
/** /**
* @return string * @return string
...@@ -50,9 +60,9 @@ public function render() ...@@ -50,9 +60,9 @@ public function render()
// 这里直接创建一个modal框 model的内容由工具表单提供,这里也需要创建一个工具表单才行 // 这里直接创建一个modal框 model的内容由工具表单提供,这里也需要创建一个工具表单才行
return Modal::make() return Modal::make()
->lg() ->lg()
->title('添加收款') ->title('添加收款' . $this->cid)
->button("添加收款") ->button("添加收款")
->body(CovenantReceiveForm::make()->payload(['id' => $this->getKey()])); ->body(CovenantReceiveForm::make()->payload(['cid' => $this->cid]));
//->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮 //->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮
} }
......
...@@ -13,6 +13,17 @@ ...@@ -13,6 +13,17 @@
class CovenantReturn extends RowAction class CovenantReturn extends RowAction
{ {
protected $cid = 0;
/**
* 接收参数
*/
public function __construct($title = '', $cid = 0)
{
$this->cid = $cid;
parent::__construct($title);
$this->title = $title;
}
/** /**
* @return string * @return string
*/ */
...@@ -47,13 +58,12 @@ public function handle(Request $request) ...@@ -47,13 +58,12 @@ public function handle(Request $request)
*/ */
public function render() public function render()
{ {
$cid = $this->getKey() ?? 0;
// 这里直接创建一个modal框 model的内容由工具表单提供,这里也需要创建一个工具表单才行 // 这里直接创建一个modal框 model的内容由工具表单提供,这里也需要创建一个工具表单才行
return Modal::make() return Modal::make()
->lg() ->lg()
->title('已退还') ->title('已退还')
->button("已退还") ->button("已退还")
->body(CovenantReturnForm::make()->payload(['id' => $this->getKey()])); ->body(CovenantReturnForm::make()->payload(['cid' => $this->cid]));
//->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮 //->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮
} }
......
...@@ -73,12 +73,12 @@ protected function grid() ...@@ -73,12 +73,12 @@ protected function grid()
$actions->disableDelete(); $actions->disableDelete();
} }
//已结案 //已结案
if (Admin::user()->can('hetong-closed')) { if (Admin::user()->can('hetong-closed') && $actions->row->is_closed == 0) {
$actions->append(new CovenantClosed($actions->row->id)); $actions->append(new CovenantClosed('已结案', $actions->row->id));
} }
// 已退还 // 已退还
if (Admin::user()->can('hetong-return')) { if (Admin::user()->can('hetong-return') && $actions->row->is_return == 0) {
$actions->append(new CovenantReturn($actions->row->id)); $actions->append(new CovenantReturn('已退还', $actions->row->id));
} }
}); });
}); });
......
...@@ -35,7 +35,7 @@ protected function grid() ...@@ -35,7 +35,7 @@ protected function grid()
// $grid->disableViewButton(); // $grid->disableViewButton();
// $grid->disableCreateButton(); // $grid->disableCreateButton();
$grid->filter(function (Grid\Filter $filter) { $grid->filter(function (Grid\Filter $filter) use ($number) {
// 更改为 panel 布局 // 更改为 panel 布局
$filter->panel(); $filter->panel();
$filter->like('year', '年份')->width(3)->default(date("Y")); $filter->like('year', '年份')->width(3)->default(date("Y"));
......
...@@ -73,11 +73,11 @@ protected function grid() ...@@ -73,11 +73,11 @@ protected function grid()
$grid->actions(function (Grid\Displayers\Actions $actions) use ($lawyerID) { $grid->actions(function (Grid\Displayers\Actions $actions) use ($lawyerID) {
//添加收款 //添加收款
if (Admin::user()->can('receive-payment')) { if (Admin::user()->can('receive-payment')) {
$actions->append(new CovenantReceive($actions->row->id)); $actions->append(new CovenantReceive('添加收款', $actions->row->cid));
} }
//添加开票 //添加开票
if (Admin::user()->can('invoiced-payment')) { if (Admin::user()->can('invoiced-payment')) {
$actions->append(new CovenantInvoice($actions->row->id)); $actions->append(new CovenantInvoice('添加开票', $actions->row->cid));
} }
//查看收款 //查看收款
$cid = $actions->row->cid; $cid = $actions->row->cid;
......
...@@ -24,14 +24,12 @@ class CovenantClosedForm extends Form implements LazyRenderable ...@@ -24,14 +24,12 @@ class CovenantClosedForm extends Form implements LazyRenderable
*/ */
public function handle(array $input) public function handle(array $input)
{ {
$cid = $this->payload['id']; $cid = $this->payload['cid'];
DB::beginTransaction(); DB::beginTransaction();
try { try {
$return_fee = floatval($input['return_fee']);
$uObj = ModelsCovenant::find($cid); $uObj = ModelsCovenant::find($cid);
if ($uObj && $uObj->is_return == 0 && $return_fee) { if ($uObj && $uObj->is_closed == 0) {
$uObj->is_return = 1; $uObj->is_closed = 1;
$uObj->return_fee = $return_fee;
$uObj->save(); $uObj->save();
} }
DB::commit(); DB::commit();
......
...@@ -25,7 +25,7 @@ class CovenantInvoiceForm extends Form implements LazyRenderable ...@@ -25,7 +25,7 @@ class CovenantInvoiceForm extends Form implements LazyRenderable
*/ */
public function handle(array $input) public function handle(array $input)
{ {
$cid = $this->payload['id']; //合同ID $cid = $this->payload['cid']; //合同ID
DB::beginTransaction(); DB::beginTransaction();
try { try {
$invoiced_at = trim($input['invoiced_at']); $invoiced_at = trim($input['invoiced_at']);
......
...@@ -25,7 +25,7 @@ class CovenantReceiveForm extends Form implements LazyRenderable ...@@ -25,7 +25,7 @@ class CovenantReceiveForm extends Form implements LazyRenderable
*/ */
public function handle(array $input) public function handle(array $input)
{ {
$cid = $this->payload['id']; //合同ID $cid = $this->payload['cid']; //合同ID
DB::beginTransaction(); DB::beginTransaction();
try { try {
$received_type = (int)$input['received_type']; $received_type = (int)$input['received_type'];
......
...@@ -24,12 +24,14 @@ class CovenantReturnForm extends Form implements LazyRenderable ...@@ -24,12 +24,14 @@ class CovenantReturnForm extends Form implements LazyRenderable
*/ */
public function handle(array $input) public function handle(array $input)
{ {
$cid = $this->payload['id']; $cid = $this->payload['cid'];
DB::beginTransaction(); DB::beginTransaction();
try { try {
$return_fee = floatval($input['return_fee']);
$uObj = ModelsCovenant::find($cid); $uObj = ModelsCovenant::find($cid);
if ($uObj && $uObj->is_closed == 0) { if ($uObj && $uObj->is_return == 0 && $return_fee) {
$uObj->is_closed = 1; $uObj->is_return = 1;
$uObj->return_fee = $return_fee;
$uObj->save(); $uObj->save();
} }
DB::commit(); DB::commit();
...@@ -46,7 +48,7 @@ public function handle(array $input) ...@@ -46,7 +48,7 @@ public function handle(array $input)
*/ */
public function form() public function form()
{ {
$this->text('return_fee', '退还结案费'); $this->text('return_fee', '退还结案费')->required();
} }
/** /**
......
...@@ -54,7 +54,8 @@ public function get(Grid\Model $model) ...@@ -54,7 +54,8 @@ public function get(Grid\Model $model)
$sort = $model->getSort(); $sort = $model->getSort();
// 获取筛选条件 // 获取筛选条件
$number = $model->filter()->input('number'); $lawyerID = $model->filter()->input('no') ?? 0;
$number = $model->filter()->input('number') ?? ''; //合同编号
$cname = $model->filter()->input('cname'); $cname = $model->filter()->input('cname');
$principal = $model->filter()->input('principal'); $principal = $model->filter()->input('principal');
$received_at = $invoiced_at = []; $received_at = $invoiced_at = [];
...@@ -66,7 +67,7 @@ public function get(Grid\Model $model) ...@@ -66,7 +67,7 @@ public function get(Grid\Model $model)
$param = [ $param = [
'sort' => $sort, 'sort' => $sort,
'start' => $start, 'start' => $start,
'search' => ['number' => $number, 'cname' => $cname, 'principal' => $principal, 'invoiced_at' => $invoiced_at, 'received_at' => $received_at,] 'search' => ['lawyer_id' => $lawyerID, 'number' => $number, 'cname' => $cname, 'principal' => $principal, 'invoiced_at' => $invoiced_at, 'received_at' => $received_at,]
]; ];
$data = $this->getList($param); $data = $this->getList($param);
...@@ -82,12 +83,16 @@ public function getList(array $param) ...@@ -82,12 +83,16 @@ public function getList(array $param)
{ {
$prePage = $param['per_page'] ?? 20; $prePage = $param['per_page'] ?? 20;
$start = $param['start'] ?? 0; $start = $param['start'] ?? 0;
$lawyer_id = $param['search']['lawyer_id'] ?? 0;
$number = $param['search']['number'] ?? ''; $number = $param['search']['number'] ?? '';
$cname = $param['search']['cname'] ?? ''; $cname = $param['search']['cname'] ?? '';
$invoiced_at = $param['search']['invoiced_at'] ?? []; $invoiced_at = $param['search']['invoiced_at'] ?? [];
$principal = $param['search']['principal'] ?? ''; $principal = $param['search']['principal'] ?? '';
$received_at = $param['search']['received_at'] ?? []; $received_at = $param['search']['received_at'] ?? [];
$list = []; $list = $condition = [];
if ($lawyer_id) {
$condition['rp.lawyer_id'] = $lawyer_id;
}
if ($invoiced_at['start'] && $received_at['start']) { if ($invoiced_at['start'] && $received_at['start']) {
$in_start = $invoiced_at['start'] ?? ''; $in_start = $invoiced_at['start'] ?? '';
$in_end = $invoiced_at['end'] ?? ''; $in_end = $invoiced_at['end'] ?? '';
...@@ -100,6 +105,7 @@ public function getList(array $param) ...@@ -100,6 +105,7 @@ public function getList(array $param)
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->whereBetween('rp.received_at', [$re_start, $re_end]) ->whereBetween('rp.received_at', [$re_start, $re_end])
->whereBetween('rp.invoiced_at', [$in_start, $in_end]) ->whereBetween('rp.invoiced_at', [$in_start, $in_end])
->where($condition)
->groupBy('rp.cid'); ->groupBy('rp.cid');
} else { } else {
if ($in_end) { if ($in_end) {
...@@ -108,6 +114,7 @@ public function getList(array $param) ...@@ -108,6 +114,7 @@ public function getList(array $param)
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->whereDate('rp.received_at', '>', $re_start) ->whereDate('rp.received_at', '>', $re_start)
->whereBetween('rp.invoiced_at', [$in_start, $in_end]) ->whereBetween('rp.invoiced_at', [$in_start, $in_end])
->where($condition)
->groupBy('rp.cid'); ->groupBy('rp.cid');
} elseif ($re_end) { } elseif ($re_end) {
$note_monitor = DB::table('covenant_receive_payment AS rp') $note_monitor = DB::table('covenant_receive_payment AS rp')
...@@ -115,6 +122,7 @@ public function getList(array $param) ...@@ -115,6 +122,7 @@ public function getList(array $param)
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->whereDate('rp.invoiced_at', '>', $in_start) ->whereDate('rp.invoiced_at', '>', $in_start)
->whereBetween('rp.received_at', [$re_start, $re_end]) ->whereBetween('rp.received_at', [$re_start, $re_end])
->where($condition)
->groupBy('rp.cid'); ->groupBy('rp.cid');
} else { } else {
$note_monitor = DB::table('covenant_receive_payment AS rp') $note_monitor = DB::table('covenant_receive_payment AS rp')
...@@ -122,6 +130,7 @@ public function getList(array $param) ...@@ -122,6 +130,7 @@ public function getList(array $param)
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->whereDate('rp.invoiced_at', '>', $in_start) ->whereDate('rp.invoiced_at', '>', $in_start)
->whereDate('rp.received_at', '>', $re_start) ->whereDate('rp.received_at', '>', $re_start)
->where($condition)
->groupBy('rp.cid'); ->groupBy('rp.cid');
} }
} }
...@@ -141,12 +150,14 @@ public function getList(array $param) ...@@ -141,12 +150,14 @@ public function getList(array $param)
->select(['rp.*', 'c.cname', 'c.ctype']) ->select(['rp.*', 'c.cname', 'c.ctype'])
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->whereBetween('rp.received_at', [$start, $end]) ->whereBetween('rp.received_at', [$start, $end])
->where($condition)
->groupBy('rp.cid'); ->groupBy('rp.cid');
} else { } else {
$note_monitor = DB::table("covenant_receive_payment as rp") $note_monitor = DB::table("covenant_receive_payment as rp")
->select(['rp.*', 'c.cname', 'c.ctype']) ->select(['rp.*', 'c.cname', 'c.ctype'])
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->whereDate('rp.received_at', '>', $start) ->whereDate('rp.received_at', '>', $start)
->where($condition)
->groupBy('rp.cid'); ->groupBy('rp.cid');
} }
// 计算列表总数 // 计算列表总数
...@@ -166,12 +177,14 @@ public function getList(array $param) ...@@ -166,12 +177,14 @@ public function getList(array $param)
->select(['rp.*', 'c.cname', 'c.ctype']) ->select(['rp.*', 'c.cname', 'c.ctype'])
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->whereBetween('rp.received_at', [$start, $end]) ->whereBetween('rp.received_at', [$start, $end])
->where($condition)
->groupBy('rp.cid'); ->groupBy('rp.cid');
} else { } else {
$note_monitor = DB::table("covenant_receive_payment as rp") $note_monitor = DB::table("covenant_receive_payment as rp")
->select(['rp.*', 'c.cname', 'c.ctype']) ->select(['rp.*', 'c.cname', 'c.ctype'])
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->whereDate('rp.received_at', '>', $start) ->whereDate('rp.received_at', '>', $start)
->where($condition)
->groupBy('rp.cid'); ->groupBy('rp.cid');
} }
// 计算列表总数 // 计算列表总数
...@@ -182,6 +195,9 @@ public function getList(array $param) ...@@ -182,6 +195,9 @@ public function getList(array $param)
} }
} else { //关键词搜索 } else { //关键词搜索
$note_monitor = DB::table('covenant')->select(['id as cid', 'number', 'cname', 'principal', 'ctype']); $note_monitor = DB::table('covenant')->select(['id as cid', 'number', 'cname', 'principal', 'ctype']);
if ($lawyer_id) {
$note_monitor = $note_monitor->where("lawyer_id", $lawyer_id);
}
if ($number) { if ($number) {
$note_monitor = $note_monitor->where("number", $number); $note_monitor = $note_monitor->where("number", $number);
} }
......
...@@ -28,6 +28,7 @@ public function get(Grid\Model $model) ...@@ -28,6 +28,7 @@ public function get(Grid\Model $model)
{ {
// 获取筛选条件 // 获取筛选条件
$year = $model->filter()->input('year') ?? date("Y"); $year = $model->filter()->input('year') ?? date("Y");
$lnum = $model->filter()->input('no') ?? '';
$data = []; $data = [];
$nowyear = date('Y'); $nowyear = date('Y');
...@@ -42,61 +43,64 @@ public function get(Grid\Model $model) ...@@ -42,61 +43,64 @@ public function get(Grid\Model $model)
//总计 //总计
$tmp['total'] = 0; $tmp['total'] = 0;
for ($i = 1; $i <= $monthNum; $i++) { for ($i = 1; $i <= $monthNum; $i++) {
$tmp[$i] = '0.00'; $tmp[$i] = '0.00';
$condition = ['year' => $year, 'month' => $i, 'number' => $lnum];
//基本工资 //基本工资
if ($val['field'] == 'basic_salary') { if ($val['field'] == 'basic_salary') {
$basic_salary = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('basic_salary'); $basic_salary = ModelLawyerCost::where($condition)->sum('basic_salary');
$tmp[$i] = $basic_salary; $tmp[$i] = $basic_salary;
$fieldTotal += $basic_salary; $fieldTotal += $basic_salary;
} }
//专项附加 //专项附加
if ($val['field'] == 'special_additional') { if ($val['field'] == 'special_additional') {
$special_additional = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('special_additional'); $special_additional = ModelLawyerCost::where($condition)->sum('special_additional');
$tmp[$i] = $special_additional; $tmp[$i] = $special_additional;
$fieldTotal += $special_additional; $fieldTotal += $special_additional;
} }
//社保 //社保
if ($val['field'] == 'social') { if ($val['field'] == 'social') {
$social_person_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('social_person_fee'); $social_person_fee = ModelLawyerCost::where($condition)->sum('social_person_fee');
$social_company_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('social_company_fee'); $social_company_fee = ModelLawyerCost::where($condition)->sum('social_company_fee');
$tmp[$i] = sprintf("%.2f", ($social_person_fee + $social_company_fee)); $tmp[$i] = sprintf("%.2f", ($social_person_fee + $social_company_fee));
} }
//社保个人部分 //社保个人部分
if ($val['field'] == 'social_person_fee') { if ($val['field'] == 'social_person_fee') {
$social_person_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('social_person_fee'); $social_person_fee = ModelLawyerCost::where($condition)->sum('social_person_fee');
$tmp[$i] = $social_person_fee; $tmp[$i] = $social_person_fee;
} }
//社保企业部分 //社保企业部分
if ($val['field'] == 'social_company_fee') { if ($val['field'] == 'social_company_fee') {
$social_company_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('social_company_fee'); $social_company_fee = ModelLawyerCost::where($condition)->sum('social_company_fee');
$tmp[$i] = $social_company_fee; $tmp[$i] = $social_company_fee;
} }
//公积金 //公积金
if ($val['field'] == 'accumulation_fund') { if ($val['field'] == 'accumulation_fund') {
$person_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('accumulation_fund_person_fee'); $person_fee = ModelLawyerCost::where($condition)->sum('accumulation_fund_person_fee');
$company_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('accumulation_fund_company_fee'); $company_fee = ModelLawyerCost::where($condition)->sum('accumulation_fund_company_fee');
$tmp[$i] = sprintf("%.2f", ($person_fee + $company_fee)); $tmp[$i] = sprintf("%.2f", ($person_fee + $company_fee));
} }
//公积金个人部分 //公积金个人部分
if ($val['field'] == 'accumulation_fund_person_fee') { if ($val['field'] == 'accumulation_fund_person_fee') {
$person_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('accumulation_fund_person_fee'); $person_fee = ModelLawyerCost::where($condition)->sum('accumulation_fund_person_fee');
$tmp[$i] = sprintf("%.2f", $person_fee); $tmp[$i] = sprintf("%.2f", $person_fee);
} }
//公积金企业部分 //公积金企业部分
if ($val['field'] == 'accumulation_fund_company_fee') { if ($val['field'] == 'accumulation_fund_company_fee') {
$company_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('accumulation_fund_company_fee'); $company_fee = ModelLawyerCost::where($condition)->sum('accumulation_fund_company_fee');
$tmp[$i] = sprintf("%.2f", $company_fee); $tmp[$i] = sprintf("%.2f", $company_fee);
} }
//律所年检费 //律所年检费
if ($val['field'] == 'annual_inspection_fee') { if ($val['field'] == 'annual_inspection_fee') {
$annual_inspection_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('annual_inspection_fee'); $annual_inspection_fee = ModelLawyerCost::where($condition)->sum('annual_inspection_fee');
$tmp[$i] = $annual_inspection_fee; $tmp[$i] = $annual_inspection_fee;
} }
//律所年金 //律所年金
if ($val['field'] == 'annuity') { if ($val['field'] == 'annuity') {
$annuity = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('annuity'); $annuity = ModelLawyerCost::where($condition)->sum('annuity');
$tmp[$i] = $annuity; $tmp[$i] = $annuity;
} }
...@@ -104,25 +108,25 @@ public function get(Grid\Model $model) ...@@ -104,25 +108,25 @@ public function get(Grid\Model $model)
//助理律师成本 //助理律师成本
if ($val['field'] == 'assistant_fee') { if ($val['field'] == 'assistant_fee') {
$assistant_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('assistant_fee'); $assistant_fee = ModelLawyerCost::where($condition)->sum('assistant_fee');
$tmp[$i] = $assistant_fee; $tmp[$i] = $assistant_fee;
} }
//办公室租赁成本 //办公室租赁成本
if ($val['field'] == 'office_rental_fee') { if ($val['field'] == 'office_rental_fee') {
$office_rental_fee = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('office_rental_fee'); $office_rental_fee = ModelLawyerCost::where($condition)->sum('office_rental_fee');
$tmp[$i] = $office_rental_fee; $tmp[$i] = $office_rental_fee;
} }
//无票成本 //无票成本
if ($val['field'] == 'noticket_cost') { if ($val['field'] == 'noticket_cost') {
$noticket_cost = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('noticket_cost'); $noticket_cost = ModelLawyerCost::where($condition)->sum('noticket_cost');
$tmp[$i] = $noticket_cost; $tmp[$i] = $noticket_cost;
} }
//个人所得税 //个人所得税
if ($val['field'] == 'personal_income_tax') { if ($val['field'] == 'personal_income_tax') {
$personal_income_tax = ModelLawyerCost::where(['year' => $year, 'month' => $i])->sum('personal_income_tax'); $personal_income_tax = ModelLawyerCost::where($condition)->sum('personal_income_tax');
$tmp[$i] = $personal_income_tax; $tmp[$i] = $personal_income_tax;
} }
...@@ -132,14 +136,7 @@ public function get(Grid\Model $model) ...@@ -132,14 +136,7 @@ public function get(Grid\Model $model)
$data[$key] = $tmp; $data[$key] = $tmp;
} }
// echo "<pre>";
// print_r($data);
// die;
return $data; return $data;
// $data = [
// ['id' => 1, 'year' => '2016', 'jzsqNum' => '100', 'jzhpNum' => '100', 'sbTotal' => '100'],
// ['id' => 2, 'year' => '2017', 'jzsqNum' => '100', 'jzhpNum' => '100', 'sbTotal' => '100']
// ];
// return $data;
} }
} }
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