Commit 7ed2268a by lizhilin

更新

parent 71524c25
......@@ -44,10 +44,10 @@ protected function grid()
$grid->column('is_closed', '结案状态')->display(function ($val) {
return $val ? '已结案' : '未结案';
});
$grid->column('is_return', '退状态')->display(function ($val) {
$grid->column('is_return', '退状态')->display(function ($val) {
return $val ? '已退案' : '未退案';
});
$grid->column('return_fee', '退结案费');
$grid->column('return_fee', '退结案费');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
......@@ -75,7 +75,7 @@ protected function grid()
$row['ctype'] = Covenant::CTYPE[$row['ctype']];
$row['payment_method'] = ($row['payment_method'] == 1) ? '开票付款' : '付款开票';
$row['is_closed'] = ($row['is_closed'] == 1) ? '已结案' : '未结案';
$row['is_return'] = ($row['is_return'] == 1) ? '已退还' : '未退还';
$row['is_return'] = ($row['is_return'] == 1) ? '已退案' : '未退案';
}
return $rows;
});
......@@ -93,7 +93,7 @@ protected function grid()
if (Admin::user()->can('hetong-closed') && $actions->row->is_closed == 0) {
$actions->append(new CovenantClosed('', $actions->row->id));
}
// 已退
// 已退
if (Admin::user()->can('hetong-return') && $actions->row->is_return == 0) {
$actions->append(new CovenantReturn('', $actions->row->id));
}
......
......@@ -83,12 +83,12 @@ protected function grid()
$grid->actions(function (Grid\Displayers\Actions $actions) {
//成本汇总
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')) {
$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()
//查看收款
$cid = $actions->row->cid;
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')) {
$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()
$linkstr = '';
//创收收款表
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')) {
$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;
});
......
......@@ -48,7 +48,7 @@ public function handle(array $input)
*/
public function form()
{
$this->text('return_fee', '退结案费')->required();
$this->text('return_fee', '退结案费')->required();
}
/**
......
......@@ -83,7 +83,7 @@ public function get(Grid\Model $model)
public function getList(array $param)
{
$prePage = $param['per_page'] ?? 20;
$start = $param['start'] ?? 0;
$stepstart = $param['start'] ?? 0;
$lawyer_id = $param['search']['lawyer_id'] ?? 0;
$number = $param['search']['number'] ?? '';
$cname = $param['search']['cname'] ?? '';
......@@ -92,12 +92,23 @@ public function getList(array $param)
$received_at = $param['search']['received_at'] ?? [];
$list = $condition = [];
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();
$note_monitor = DB::table('covenant_receive_payment AS rp')
->select(['rp.*', 'c.cname', 'c.ctype', 'c.number'])
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id');
$note_monitor = DB::table('covenant as c')
->select(['rp.*', 'c.id as cid', 'c.cname', 'c.ctype', 'c.number', 'c.lawyer_id', 'c.principal'])
->leftJoin('covenant_receive_payment AS rp', 'rp.cid', '=', 'c.id')
->where($condition);
if ($invoiced_at['start'] && $received_at['start']) {
$in_start = $invoiced_at['start'] ?? '';
$in_end = $invoiced_at['end'] ?? '';
......@@ -106,21 +117,17 @@ public function getList(array $param)
if ($in_start && $re_start) {
if ($in_end && $re_end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$re_start, $re_end])
->whereBetween('rp.invoiced_at', [$in_start, $in_end])
->where($condition);
->whereBetween('rp.invoiced_at', [$in_start, $in_end]);
} else {
if ($in_end) {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start)
->whereBetween('rp.invoiced_at', [$in_start, $in_end])
->where($condition);
->whereBetween('rp.invoiced_at', [$in_start, $in_end]);
} elseif ($re_end) {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereBetween('rp.received_at', [$re_start, $re_end])
->where($condition);
->whereBetween('rp.received_at', [$re_start, $re_end]);
} else {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereDate('rp.received_at', '>', $re_start)
->where($condition);
->whereDate('rp.received_at', '>', $re_start);
}
}
}
......@@ -130,11 +137,9 @@ public function getList(array $param)
if ($start) {
if ($end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$start, $end])
->where($condition);
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$start, $end]);
} else {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $start)
->where($condition);
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $start);
}
}
//
......@@ -144,33 +149,22 @@ public function getList(array $param)
if ($start) {
if ($end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$start, $end])
->where($condition);
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$start, $end]);
} else {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $start)
->where($condition);
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $start);
}
}
}
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();
$cObj = $note_monitor->groupBy('rp.cid')->get();
$cObj = $note_monitor->groupBy('c.id')->get();
if ($cObj->toArray()) {
$count = count($cObj->toArray());
}
// 获取列表
$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();
// echo "<pre>";
// 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