Commit ca13b06d authored by hujun's avatar hujun

提示信息

parent 925c8df9
...@@ -3778,195 +3778,191 @@ class Finance extends Basic ...@@ -3778,195 +3778,191 @@ class Finance extends Basic
$msg = ''; $msg = '';
$code = 200; $code = 200;
try { $m_paylog = new OPayLogAdjustment();
$m_paylog = new OPayLogAdjustment(); /*提交时间 start*/
/*提交时间 start*/ if (!empty($this->params['start_time']) && empty($this->params['end_time'])) {
if (!empty($this->params['start_time']) && empty($this->params['end_time'])) { $where['a.create_time'] = ['> time', $this->params['start_time'] . ' 00:00:00'];
$where['a.create_time'] = ['> time', $this->params['start_time'] . ' 00:00:00']; $is_show = 1;
$is_show = 1; }
}
if (!empty($this->params['end_time']) && empty($this->params['start_time'])) {
$where['a.create_time'] = ['< time', $this->params['end_time'] . ' 23:59:59'];
$is_show = 1;
}
if (!empty($this->params['end_time']) && !empty($this->params['start_time'])) {
$where['a.create_time'] = ['between time', [
$this->params['start_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59'
]];
$is_show = 1;
}
/*提交时间 end*/
/*入账日期 start*/
if (!empty($this->params['income_start_time']) && empty($this->params['income_end_time'])) {
$where['b.income_time'] = ['> time', $this->params['income_start_time'] . ' 00:00:00'];
$is_show = 1;
}
if (!empty($this->params['income_end_time']) && empty($this->params['income_start_time'])) { if (!empty($this->params['end_time']) && empty($this->params['start_time'])) {
$where['b.income_time'] = ['< time', $this->params['end_time'] . ' 23:59:59']; $where['a.create_time'] = ['< time', $this->params['end_time'] . ' 23:59:59'];
$is_show = 1; $is_show = 1;
} }
if (!empty($this->params['income_end_time']) && !empty($this->params['income_start_time'])) { if (!empty($this->params['end_time']) && !empty($this->params['start_time'])) {
$where['b.income_time'] = ['between time', [ $where['a.create_time'] = ['between time', [
$this->params['income_start_time'] . ' 00:00:00', $this->params['income_end_time'] . ' 23:59:59' $this->params['start_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59'
]]; ]];
$is_show = 1; $is_show = 1;
} }
/*入账日期 end*/ /*提交时间 end*/
/*入账日期 start*/
if (!empty($this->params['income_start_time']) && empty($this->params['income_end_time'])) {
$where['b.income_time'] = ['> time', $this->params['income_start_time'] . ' 00:00:00'];
$is_show = 1;
}
//商铺ID if (!empty($this->params['income_end_time']) && empty($this->params['income_start_time'])) {
if (!empty($this->params['house_id'])) { $where['b.income_time'] = ['< time', $this->params['end_time'] . ' 23:59:59'];
$where['e.house_id'] = $this->params['house_id']; $is_show = 1;
$is_show = 1; }
}
//商铺地址 if (!empty($this->params['income_end_time']) && !empty($this->params['income_start_time'])) {
if (!empty($this->params['address'])) { $where['b.income_time'] = ['between time', [
$m_house = new GHouses(); $this->params['income_start_time'] . ' 00:00:00', $this->params['income_end_time'] . ' 23:59:59'
$id = $m_house->getList(1, 20, 'id desc', 'id',['internal_address'=>['like', '%' . $this->params['address'] . '%']]); ]];
$is_show = 1;
}
/*入账日期 end*/
foreach ($id as $v) { //商铺ID
$id_arr[] = $v['id']; if (!empty($this->params['house_id'])) {
} $where['e.house_id'] = $this->params['house_id'];
$is_show = 1;
}
if (!empty($where['e.house_id'])) { //商铺地址
$id_arr[] = $where['e.house_id']; if (!empty($this->params['address'])) {
} $m_house = new GHouses();
$id = $m_house->getList(1, 20, 'id desc', 'id',['internal_address'=>['like', '%' . $this->params['address'] . '%']]);
if (!empty($id_arr)) { foreach ($id as $v) {
$id_arr = array_unique($id_arr); $id_arr[] = $v['id'];
$where['e.house_id'] = ['in', $id_arr];
}
$is_show = 1;
} }
//提交人所在门店 if (!empty($where['e.house_id'])) {
if (!empty($this->params['store_id'])) { $id_arr[] = $where['e.house_id'];
$where['d.store_id'] = $this->params['store_id'];
$is_show = 1;
} }
//提交人所在部门 if (!empty($id_arr)) {
if (!empty($this->params['district_id'])) { $id_arr = array_unique($id_arr);
$where['d.district_id'] = $this->params['district_id']; $where['e.house_id'] = ['in', $id_arr];
$is_show = 1;
} }
$is_show = 1;
}
//提交人姓名 //提交人所在门店
if (!empty($this->params['agent_id'])) { if (!empty($this->params['store_id'])) {
$where['d.id'] = $this->params['agent_id']; $where['d.store_id'] = $this->params['store_id'];
$is_show = 1; $is_show = 1;
} }
//提交人手机号 //提交人所在部门
if (!empty($this->params['phone'])) { if (!empty($this->params['district_id'])) {
$where['d.phone'] = ['like', '%' . $this->params['phone'] . '%']; $where['d.district_id'] = $this->params['district_id'];
$is_show = 1; $is_show = 1;
} }
//入账方式 //提交人姓名
if (!empty($this->params['pay_type'])) { if (!empty($this->params['agent_id'])) {
$where['a.pay_type'] = $this->params['pay_type']; $where['d.id'] = $this->params['agent_id'];
$is_show = 1; $is_show = 1;
} }
//入账类型 //提交人手机号
if (!empty($this->params['type'])) { if (!empty($this->params['phone'])) {
$where['a.type'] = $this->params['type']; $where['d.phone'] = ['like', '%' . $this->params['phone'] . '%'];
$is_show = 1; $is_show = 1;
} }
//来源 //入账方式
if (!empty($this->params['source'])) { if (!empty($this->params['pay_type'])) {
$where['a.source'] = $this->params['source']; $where['a.pay_type'] = $this->params['pay_type'];
$is_show = 1; $is_show = 1;
} }
if (!empty($this->params['pay_id'])) { //入账类型
$where['a.paylog_id'] = $this->params['pay_id']; if (!empty($this->params['type'])) {
} $where['a.type'] = $this->params['type'];
$is_show = 1;
}
if (!empty($this->params['id'])) { //来源
$where['a.id'] = $this->params['id']; if (!empty($this->params['source'])) {
} $where['a.source'] = $this->params['source'];
$is_show = 1;
}
if (!empty($this->params['pay_id'])) {
$where['a.paylog_id'] = $this->params['pay_id'];
}
if (!empty($this->params['id'])) {
$where['a.id'] = $this->params['id'];
}
if (!empty($this->params['march_id'])) { if (!empty($this->params['march_id'])) {
$where['b.order_id'] = $this->params['march_id']; $where['b.order_id'] = $this->params['march_id'];
}
$field = 'a.create_time,a.id,b.order_id,e.house_id,a.paylog_id,a.money,b.income_time,a.type,a.new_paylog_id,a.operation_id';
$m_house = new GHouses();
$redis_service = new RedisCacheService();
if (empty($this->params['excel'])) {
$list = $m_paylog->getAdjustmentListLimit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
$data['total'] = $m_paylog->getAdjustmentListTotal($where);
//加时间条件
if ($is_show) {
$data['money_total'] = $m_paylog->getMoneyTotal($where, 'a.money'); //总额
} else {
$data['money_total'] = '';
} }
$field = 'a.create_time,a.id,b.order_id,e.house_id,a.paylog_id,a.money,b.income_time,a.type,a.new_paylog_id,a.operation_id'; foreach ($list as $k => $v) {
$m_house = new GHouses(); if ($v['operation_id']) {
$redis_service = new RedisCacheService(); $agent_data = $redis_service->getRedisCache(2, $v['operation_id']);
if (empty($this->params['excel'])) { $list[$k]['name'] = $agent_data['name'];
$list = $m_paylog->getAdjustmentListLimit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where); }
$data['total'] = $m_paylog->getAdjustmentListTotal($where); if ($v['house_id']) {
//加时间条件 $house_data = $m_house->getHouseDetail('id,internal_address', ['id'=>$v['house_id']]);
if ($is_show) { $list[$k]['house_id'] = $house_data['id'];
$data['money_total'] = $m_paylog->getMoneyTotal($where, 'a.money'); //总额 $list[$k]['address'] = $house_data['internal_address'];
} else { } else {
$data['money_total'] = ''; $list[$k]['house_id'] = '';
$list[$k]['address'] = '';
} }
}
$data['list'] = $list;
$data['list'] = $this->numberTransitionString($data['list']);
} else {
$list = $m_paylog->getAdjustmentListLimit(1, 40000, $order_ = 'a.id desc', $field, $where);
if (empty($list)) {
$this->closeWin = 1;
$this->error('暂无数据,请关闭页面!');
} else {
$excel_data = [];
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
if ($v['operation_id']) { $excel_data[$k]['create_time'] = $v['create_time'];
$agent_data = $redis_service->getRedisCache(2, $v['operation_id']); $excel_data[$k]['id'] = $v['id'];
$list[$k]['name'] = $agent_data['name']; $excel_data[$k]['order_id'] = $v['order_id'];
} $excel_data[$k]['paylog_id'] = $v['paylog_id'];
if ($v['house_id']) { if ($v['house_id']) {
$house_data = $m_house->getHouseDetail('id,internal_address', ['id'=>$v['house_id']]); $house_data = $m_house->getHouseDetail('id,internal_address', ['id' => $v['house_id']]);
$list[$k]['house_id'] = $house_data['id']; $excel_data[$k]['house_id'] = $house_data['id'];
$list[$k]['address'] = $house_data['internal_address']; $excel_data[$k]['address'] = $house_data['internal_address'];
} else { } else {
$list[$k]['house_id'] = ''; $excel_data[$k]['house_id'] = '';
$list[$k]['address'] = ''; $excel_data[$k]['address'] = '';
} }
} $excel_data[$k]['money'] = $v['money'];
$excel_data[$k]['income_time'] = $v['income_time'];
$data['list'] = $list; $excel_data[$k]['type'] = $v['type'];
$data['list'] = $this->numberTransitionString($data['list']); $excel_data[$k]['new_paylog_id'] = $v['new_paylog_id'];
} else {
$list = $m_paylog->getAdjustmentListLimit(1, 40000, $order_ = 'a.id desc', $field, $where);
if (!empty($list)) {
$excel_data = [];
foreach ($list as $k => $v) {
$excel_data[$k]['create_time'] = $v['create_time'];
$excel_data[$k]['id'] = $v['id'];
$excel_data[$k]['order_id'] = $v['order_id'];
$excel_data[$k]['paylog_id'] = $v['paylog_id'];
if ($v['house_id']) {
$house_data = $m_house->getHouseDetail('id,internal_address', ['id' => $v['house_id']]);
$excel_data[$k]['house_id'] = $house_data['id'];
$excel_data[$k]['address'] = $house_data['internal_address'];
} else {
$excel_data[$k]['house_id'] = '';
$excel_data[$k]['address'] = '';
}
$excel_data[$k]['money'] = $v['money'];
$excel_data[$k]['income_time'] = $v['income_time'];
$excel_data[$k]['type'] = $v['type'];
$excel_data[$k]['new_paylog_id'] = $v['new_paylog_id'];
if ($v['operation_id']) {
$agent_data = $redis_service->getRedisCache(2, $v['operation_id']);
$excel_data[$k]['name'] = $agent_data['name'];
}
if ($v['operation_id']) {
$agent_data = $redis_service->getRedisCache(2, $v['operation_id']);
$excel_data[$k]['name'] = $agent_data['name'];
} }
$export = new ExportExcelUntil();
$title = ['提交时间', '调整ID', '调整前带看ID', '调整前收款ID', '调整前商铺ID', '调整前商铺地址', '调整金额', '入账日期', '调整类型', '调整后收款ID', '提交人'];
$export->exportTable('调整出账', $excel_data, 10, '调整出账', $title);
} }
$export = new ExportExcelUntil();
$title = ['提交时间', '调整ID', '调整前带看ID', '调整前收款ID', '调整前商铺ID', '调整前商铺地址', '调整金额', '入账日期', '调整类型', '调整后收款ID', '提交人'];
$export->exportTable('调整出账', $excel_data, 10, '调整出账', $title);
} }
} catch (\Exception $e) {
$code = 101;
$msg = '内部错误:'.$e->getMessage();
} }
return $this->response($code, $msg, $data); return $this->response($code, $msg, $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