Commit 7ed2268a by lizhilin

更新

parent 71524c25
...@@ -44,10 +44,10 @@ protected function grid() ...@@ -44,10 +44,10 @@ protected function grid()
$grid->column('is_closed', '结案状态')->display(function ($val) { $grid->column('is_closed', '结案状态')->display(function ($val) {
return $val ? '已结案' : '未结案'; return $val ? '已结案' : '未结案';
}); });
$grid->column('is_return', '退状态')->display(function ($val) { $grid->column('is_return', '退状态')->display(function ($val) {
return $val ? '已退案' : '未退案'; return $val ? '已退案' : '未退案';
}); });
$grid->column('return_fee', '退结案费'); $grid->column('return_fee', '退结案费');
// $grid->column('created_at'); // $grid->column('created_at');
// $grid->column('updated_at')->sortable(); // $grid->column('updated_at')->sortable();
...@@ -75,7 +75,7 @@ protected function grid() ...@@ -75,7 +75,7 @@ protected function grid()
$row['ctype'] = Covenant::CTYPE[$row['ctype']]; $row['ctype'] = Covenant::CTYPE[$row['ctype']];
$row['payment_method'] = ($row['payment_method'] == 1) ? '开票付款' : '付款开票'; $row['payment_method'] = ($row['payment_method'] == 1) ? '开票付款' : '付款开票';
$row['is_closed'] = ($row['is_closed'] == 1) ? '已结案' : '未结案'; $row['is_closed'] = ($row['is_closed'] == 1) ? '已结案' : '未结案';
$row['is_return'] = ($row['is_return'] == 1) ? '已退还' : '未退还'; $row['is_return'] = ($row['is_return'] == 1) ? '已退案' : '未退案';
} }
return $rows; return $rows;
}); });
...@@ -93,7 +93,7 @@ protected function grid() ...@@ -93,7 +93,7 @@ protected function grid()
if (Admin::user()->can('hetong-closed') && $actions->row->is_closed == 0) { 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') && $actions->row->is_return == 0) { 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));
} }
......
...@@ -83,12 +83,12 @@ protected function grid() ...@@ -83,12 +83,12 @@ protected function grid()
$grid->actions(function (Grid\Displayers\Actions $actions) { $grid->actions(function (Grid\Displayers\Actions $actions) {
//成本汇总 //成本汇总
if (Admin::user()->can('lycost-collect')) { if (Admin::user()->can('lycost-collect')) {
$actions->append('<a href="/lycost-collect?no=' . $this->number . '" alt="成本汇总" target="_blank"><i class="feather icon-book"> 成本汇总 </i></a>'); $actions->append('<a href="/lycost-collect?no=' . $this->number . '" alt="成本汇总" ><i class="feather icon-book"> 成本汇总 </i></a>');
} }
// 成本明细 // 成本明细
if (Admin::user()->can('lycost-list')) { if (Admin::user()->can('lycost-list')) {
$actions->append('<a href="/lycost-list?no=' . $this->number . '" alt="成本明细" target="_blank"><i class="feather icon-list"> 成本明细 </i></a>'); $actions->append('<a href="/lycost-list?no=' . $this->number . '" alt="成本明细" ><i class="feather icon-list"> 成本明细 </i></a>');
} }
}); });
}); });
......
...@@ -82,11 +82,11 @@ protected function grid() ...@@ -82,11 +82,11 @@ protected function grid()
//查看收款 //查看收款
$cid = $actions->row->cid; $cid = $actions->row->cid;
if (Admin::user()->can('view-received')) { 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-received?cid=' . $cid . '" alt="查看收款" >查看收款</a>');
} }
//查看开票 //查看开票
if (Admin::user()->can('view-invoiced')) { if (Admin::user()->can('view-invoiced')) {
$actions->append('<a href="/view-covenant-invoiced?cid=' . $cid . '" alt="查看开票" target="_blank">查看开票</a>'); $actions->append('<a href="/view-covenant-invoiced?cid=' . $cid . '" alt="查看开票" >查看开票</a>');
} }
}); });
}); });
......
...@@ -63,11 +63,11 @@ protected function grid() ...@@ -63,11 +63,11 @@ protected function grid()
$linkstr = ''; $linkstr = '';
//创收收款表 //创收收款表
if (Admin::user()->can('lawyer-covenant-income')) { if (Admin::user()->can('lawyer-covenant-income')) {
$linkstr .= '<a href="/lawyer-covenant-income?no=' . $id . '" target="_blank">创收收款表</a>&nbsp;&nbsp;'; $linkstr .= '<a href="/lawyer-covenant-income?no=' . $id . '" >创收收款表</a>&nbsp;&nbsp;';
} }
//已收款/已开票汇总 //已收款/已开票汇总
if (Admin::user()->can('received-invoiced')) { if (Admin::user()->can('received-invoiced')) {
$linkstr .= '<a href="/receive_payment?no=' . $id . '&year=' . $year . '" target="_blank">已收款/已开票汇总</a><br/>'; $linkstr .= '<a href="/receive_payment?no=' . $id . '&year=' . $year . '" >已收款/已开票汇总</a><br/>';
} }
return $linkstr; return $linkstr;
}); });
......
...@@ -48,7 +48,7 @@ public function handle(array $input) ...@@ -48,7 +48,7 @@ public function handle(array $input)
*/ */
public function form() public function form()
{ {
$this->text('return_fee', '退结案费')->required(); $this->text('return_fee', '退结案费')->required();
} }
/** /**
......
...@@ -83,7 +83,7 @@ public function get(Grid\Model $model) ...@@ -83,7 +83,7 @@ public function get(Grid\Model $model)
public function getList(array $param) public function getList(array $param)
{ {
$prePage = $param['per_page'] ?? 20; $prePage = $param['per_page'] ?? 20;
$start = $param['start'] ?? 0; $stepstart = $param['start'] ?? 0;
$lawyer_id = $param['search']['lawyer_id'] ?? 0; $lawyer_id = $param['search']['lawyer_id'] ?? 0;
$number = $param['search']['number'] ?? ''; $number = $param['search']['number'] ?? '';
$cname = $param['search']['cname'] ?? ''; $cname = $param['search']['cname'] ?? '';
...@@ -92,12 +92,23 @@ public function getList(array $param) ...@@ -92,12 +92,23 @@ public function getList(array $param)
$received_at = $param['search']['received_at'] ?? []; $received_at = $param['search']['received_at'] ?? [];
$list = $condition = []; $list = $condition = [];
if ($lawyer_id) { if ($lawyer_id) {
$condition['rp.lawyer_id'] = $lawyer_id; $condition['c.lawyer_id'] = $lawyer_id;
} }
if ($number) {
$condition['c.number'] = $number;
}
if ($principal) {
$condition['c.principal'] = $principal;
}
if ($cname) {
$condition['c.cname'] = $cname;
}
DB::enableQueryLog(); DB::enableQueryLog();
$note_monitor = DB::table('covenant_receive_payment AS rp') $note_monitor = DB::table('covenant as c')
->select(['rp.*', 'c.cname', 'c.ctype', 'c.number']) ->select(['rp.*', 'c.id as cid', 'c.cname', 'c.ctype', 'c.number', 'c.lawyer_id', 'c.principal'])
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id'); ->leftJoin('covenant_receive_payment AS rp', 'rp.cid', '=', 'c.id')
->where($condition);
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'] ?? '';
...@@ -106,21 +117,17 @@ public function getList(array $param) ...@@ -106,21 +117,17 @@ public function getList(array $param)
if ($in_start && $re_start) { if ($in_start && $re_start) {
if ($in_end && $re_end) { if ($in_end && $re_end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$re_start, $re_end]) $note_monitor = $note_monitor->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);
} else { } else {
if ($in_end) { if ($in_end) {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start) $note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start)
->whereBetween('rp.invoiced_at', [$in_start, $in_end]) ->whereBetween('rp.invoiced_at', [$in_start, $in_end]);
->where($condition);
} elseif ($re_end) { } elseif ($re_end) {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start) $note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereBetween('rp.received_at', [$re_start, $re_end]) ->whereBetween('rp.received_at', [$re_start, $re_end]);
->where($condition);
} else { } else {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start) $note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereDate('rp.received_at', '>', $re_start) ->whereDate('rp.received_at', '>', $re_start);
->where($condition);
} }
} }
} }
...@@ -130,11 +137,9 @@ public function getList(array $param) ...@@ -130,11 +137,9 @@ public function getList(array $param)
if ($start) { if ($start) {
if ($end) { if ($end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$start, $end]) $note_monitor = $note_monitor->whereBetween('rp.received_at', [$start, $end]);
->where($condition);
} else { } else {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $start) $note_monitor = $note_monitor->whereDate('rp.received_at', '>', $start);
->where($condition);
} }
} }
// //
...@@ -144,33 +149,22 @@ public function getList(array $param) ...@@ -144,33 +149,22 @@ public function getList(array $param)
if ($start) { if ($start) {
if ($end) { if ($end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$start, $end]) $note_monitor = $note_monitor->whereBetween('rp.received_at', [$start, $end]);
->where($condition);
} else { } else {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $start) $note_monitor = $note_monitor->whereDate('rp.received_at', '>', $start);
->where($condition);
} }
} }
} }
if ($number) {
$note_monitor = $note_monitor->having("number", $number);
}
if ($principal) {
$note_monitor = $note_monitor->having("principal", $principal);
}
if ($cname) {
$note_monitor = $note_monitor->having("cname", $cname);
}
// 计算列表总数 // 计算列表总数
$count = 0; //$note_monitor->count(); $count = 0; //$note_monitor->count();
$cObj = $note_monitor->groupBy('rp.cid')->get(); $cObj = $note_monitor->groupBy('c.id')->get();
if ($cObj->toArray()) { if ($cObj->toArray()) {
$count = count($cObj->toArray()); $count = count($cObj->toArray());
} }
// 获取列表 // 获取列表
$data = []; $data = [];
$list = $note_monitor->limit($prePage)->offset($start)->orderBy('rp.cid', 'desc')->get()->toArray(); $list = $note_monitor->limit($prePage)->offset($stepstart)->orderBy('c.id', 'desc')->get()->toArray();
$queries = DB::getQueryLog(); $queries = DB::getQueryLog();
// echo "<pre>"; // echo "<pre>";
// print_r($queries); // print_r($queries);
......
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