Commit 25858c13 authored by hujun's avatar hujun

收款删除

parent ae991583
...@@ -12,7 +12,6 @@ use app\index\extend\Basic; ...@@ -12,7 +12,6 @@ use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil; use app\index\untils\ExportExcelUntil;
use app\model\AAgents; use app\model\AAgents;
use app\model\AStore; use app\model\AStore;
use app\model\OfficeGBuilding;
use app\model\OfficeGRoom; use app\model\OfficeGRoom;
use app\model\OfficeGRoomToAgent; use app\model\OfficeGRoomToAgent;
use app\model\OfficeOBargainModel; use app\model\OfficeOBargainModel;
...@@ -38,160 +37,136 @@ class OfficePayLog extends Basic ...@@ -38,160 +37,136 @@ class OfficePayLog extends Basic
} }
/** /**
* 收款记录 * 构造条件
* *
* @return \think\Response|\think\response\View|void * @param $params
* @return array
*/ */
public function getCollection() private function buildWhere($params)
{ {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo']; $where = [];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$data = [];
$where['a.is_del'] = 0;
$is_show = 0;
$msg = '';
/*提交时间 start*/ /*提交时间 start*/
if (!empty($this->params['start_time']) && empty($this->params['end_time'])) { if (!empty($params['start_time']) && empty($params['end_time'])) {
$where['a.create_time'] = ['> time', $this->params['start_time'] . ' 00:00:00']; $where['a.create_time'] = ['> time', $params['start_time'] . ' 00:00:00'];
$is_show = 1;
} }
if (!empty($this->params['end_time']) && empty($this->params['start_time'])) { if (!empty($params['end_time']) && empty($params['start_time'])) {
$where['a.create_time'] = ['< time', $this->params['end_time'] . ' 23:59:59']; $where['a.create_time'] = ['< time', $params['end_time'] . ' 23:59:59'];
$is_show = 1;
} }
if (!empty($this->params['end_time']) && !empty($this->params['start_time'])) { if (!empty($params['end_time']) && !empty($params['start_time'])) {
$where['a.create_time'] = [ $where['a.create_time'] = [
'between time', [ 'between time', [
$this->params['start_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' $params['start_time'] . ' 00:00:00', $params['end_time'] . ' 23:59:59'
] ]
]; ];
$is_show = 1;
} }
/*提交时间 end*/ /*提交时间 end*/
/*入账日期 start*/ /*入账日期 start*/
if (!empty($this->params['income_start_time']) && empty($this->params['income_end_time'])) { if (!empty($params['income_start_time']) && empty($params['income_end_time'])) {
$where['a.income_time'] = ['> time', $this->params['income_start_time'] . ' 00:00:00']; $where['a.income_time'] = ['> time', $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($params['income_end_time']) && empty($params['income_start_time'])) {
$where['a.income_time'] = ['< time', $this->params['end_time'] . ' 23:59:59']; $where['a.income_time'] = ['< time', $params['end_time'] . ' 23:59:59'];
$is_show = 1;
} }
if (!empty($this->params['income_end_time']) && !empty($this->params['income_start_time'])) { if (!empty($params['income_end_time']) && !empty($params['income_start_time'])) {
$where['a.income_time'] = [ $where['a.income_time'] = [
'between time', [ 'between time', [
$this->params['income_start_time'] . ' 00:00:00', $this->params['income_end_time'] . ' 23:59:59' $params['income_start_time'] . ' 00:00:00', $params['income_end_time'] . ' 23:59:59'
] ]
]; ];
$is_show = 1;
} }
/*入账日期 end*/ /*入账日期 end*/
/*收款确认日期 start*/ /*收款确认日期 start*/
if (!empty($this->params['open_time_start']) && empty($this->params['open_end_time'])) { if (!empty($params['open_time_start']) && empty($params['open_end_time'])) {
$where['a.open_time'] = ['> time', $this->params['open_time_start'] . ' 00:00:00']; $where['a.open_time'] = ['> time', $params['open_time_start'] . ' 00:00:00'];
$is_show = 1;
} }
if (!empty($this->params['open_time_end']) && empty($this->params['open_time_start'])) { if (!empty($params['open_time_end']) && empty($params['open_time_start'])) {
$where['a.open_time'] = ['< time', $this->params['open_time_end'] . ' 23:59:59']; $where['a.open_time'] = ['< time', $params['open_time_end'] . ' 23:59:59'];
$is_show = 1;
} }
if (!empty($this->params['open_time_end']) && !empty($this->params['open_time_start'])) { if (!empty($params['open_time_end']) && !empty($params['open_time_start'])) {
$where['a.open_time'] = [ $where['a.open_time'] = [
'between time', [ 'between time', [
$this->params['open_time_start'] . ' 00:00:00', $this->params['open_time_end'] . ' 23:59:59' $params['open_time_start'] . ' 00:00:00', $params['open_time_end'] . ' 23:59:59'
] ]
]; ];
$is_show = 1;
} }
/*入账日期 end*/ /*入账日期 end*/
//商铺地址 //商铺地址
if (!empty($this->params['internal_address'])) { if (!empty($params['internal_address'])) {
$where['g.address'] = ['like', '%' . $this->params['internal_address'] . '%']; $where['g.address'] = ['like', '%' . $params['internal_address'] . '%'];
$is_show = 1;
} }
//商铺ID //商铺ID
if (!empty($this->params['house_id'])) { if (!empty($params['house_id'])) {
$where['b.house_id'] = $this->params['house_id']; $where['b.house_id'] = $params['house_id'];
$is_show = 1;
} }
//提交人所在门店 //提交人所在门店
if (!empty($this->params['store_id'])) { if (!empty($params['store_id'])) {
$where['e.store_id'] = $this->params['store_id']; $where['e.store_id'] = $params['store_id'];
$is_show = 1;
} }
//提交人所在部门 //提交人所在部门
if (!empty($this->params['district_id'])) { if (!empty($params['district_id'])) {
$where['e.district_id'] = $this->params['district_id']; $where['e.district_id'] = $params['district_id'];
$is_show = 1;
} }
//提交人姓名 //提交人姓名
if (!empty($this->params['agent_id'])) { if (!empty($params['agent_id'])) {
$where['a.agent_id'] = $this->params['agent_id']; $where['a.agent_id'] = $params['agent_id'];
$is_show = 1;
} }
//入账方式 //入账方式
if (!empty($this->params['pay_type'])) { if (!empty($params['pay_type'])) {
$where['a.pay_type'] = $this->params['pay_type']; $where['a.pay_type'] = $params['pay_type'];
$is_show = 1;
} }
//入账类型 //入账类型
if (!empty($this->params['type'])) { if (!empty($params['type'])) {
$where['a.type'] = $this->params['type']; $where['a.type'] = $params['type'];
$is_show = 1;
} }
//来源 //来源
if ($this->params['source'] > -1) { if ($params['source'] > -1) {
if ($this->params['source'] == 1) { if ($params['source'] == 1) {
$where['a.source'] = ['in', '0,1']; $where['a.source'] = ['in', '0,1'];
} else { } else {
$where['a.source'] = $this->params['source']; $where['a.source'] = $params['source'];
} }
$is_show = 1;
} }
if (!empty($this->params['bargain_id'])) { if (!empty($params['bargain_id'])) {
// $order_id = $this->m_bargain->getFieldValue('order_id', ['id'=>$this->params['bargain_id'],'father_id'=>0]); // $order_id = $this->m_bargain->getFieldValue('order_id', ['id'=>$params['bargain_id'],'father_id'=>0]);
// if (!empty($order_id)) { // if (!empty($order_id)) {
// $where[] = ['EXP', 'a.order_id='.$order_id]; // $where[] = ['EXP', 'a.order_id='.$order_id];
// } // }
$where['a.bargain_id'] = $this->params['bargain_id']; $where['a.bargain_id'] = $params['bargain_id'];
$is_show = 1;
} }
if (!empty($this->params['pay_id'])) { if (!empty($params['pay_id'])) {
$where['a.id'] = $this->params['pay_id']; $where['a.id'] = $params['pay_id'];
} }
if (!empty($this->params['order_id'])) { if (!empty($params['order_id'])) {
$where['a.order_id'] = $this->params['order_id']; $where['a.order_id'] = $params['order_id'];
} }
if (!empty($this->params['bargain_id'])) { if (!empty($params['bargain_id'])) {
$where['a.bargain_id'] = $this->params['bargain_id']; $where['a.bargain_id'] = $params['bargain_id'];
} }
if (!empty($this->params['source_type'])) { if (!empty($params['source_type'])) {
$where['a.bargain_id'] = $this->params['bargain_id']; $where['a.bargain_id'] = $params['bargain_id'];
} }
if (is_numeric($this->params['source_type'])) { if (is_numeric($params['source_type'])) {
if ($this->params['source_type'] == 1) { if ($params['source_type'] == 1) {
$where['a.source'] = array('neq', 2); $where['a.source'] = array('neq', 2);
} else { } else {
$where['a.source'] = 2; $where['a.source'] = 2;
...@@ -199,8 +174,8 @@ class OfficePayLog extends Basic ...@@ -199,8 +174,8 @@ class OfficePayLog extends Basic
} }
//案场费和中介费是否开业 //案场费和中介费是否开业
if (isset($this->params['is_open'])) { if (isset($params['is_open'])) {
if ($this->params['is_open'] == 1) { if ($params['is_open'] == 1) {
$where['a.is_open'] = 1; $where['a.is_open'] = 1;
} else { } else {
$where['a.is_open'] = 0; $where['a.is_open'] = 0;
...@@ -209,14 +184,35 @@ class OfficePayLog extends Basic ...@@ -209,14 +184,35 @@ class OfficePayLog extends Basic
if (!isset($where['a.type'])) { if (!isset($where['a.type'])) {
$where['a.type'] = ['in', '91,92']; $where['a.type'] = ['in', '91,92'];
} }
$is_show = 1;
} }
if (isset($this->params['is_normality']) && $this->params['is_normality'] == 1) { if (isset($params['is_normality']) && $params['is_normality'] == 1) {
$where[] = ['EXP', '(select id from o_refund where pay_log_id=a.id and is_del = 0 group by pay_log_id) is null']; $where[] = ['EXP', '(select id from o_refund where pay_log_id=a.id and is_del = 0 group by pay_log_id) is null'];
$where[] = ['EXP', '(select id from o_paylog_adjustment where paylog_id=a.id and is_del = 0 group by paylog_id) is null ']; $where[] = ['EXP', '(select id from o_paylog_adjustment where paylog_id=a.id and is_del = 0 group by paylog_id) is null '];
}
return $where;
}
/**
* 收款记录
*
* @return \think\Response|\think\response\View|void
*/
public function getCollection()
{
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$data = [];
$where = $this->buildWhere($this->params);
if (empty($where)) {
$is_show = 0;
} else {
$is_show = 1; $is_show = 1;
} }
$where['a.is_del'] = 0;
$msg = '';
try { try {
$order = new OfficeOPayLogModel(); $order = new OfficeOPayLogModel();
...@@ -295,6 +291,76 @@ class OfficePayLog extends Basic ...@@ -295,6 +291,76 @@ class OfficePayLog extends Basic
return $this->response(200, $msg, $data); return $this->response(200, $msg, $data);
} }
/**
* 收款记录
*
* @return \think\Response|\think\response\View|void
*/
public function getCollectionDel()
{
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$data = [];
$where = $this->buildWhere($this->params);
$where['a.is_del'] = 0;
$msg = '';
try {
$order = new OfficeOPayLogModel();
$field = 'a.id,a.create_time,a.order_id,a.father_id,a.money,a.real_money,a.pay_type,a.type,a.source,a.transaction_fee,a.source,b.f_id,a.transfer_name,a.receipt_number,a.bargain_id,';
$field .= 'e.name,a.income_time,e.store_id,b.house_id,b.order_no,a.report_id,a.house_number,a.is_dividend,a.last_transfer_time,a.industry_type,a.agent_id,e.name as agent_name,g.address';
$list = $order->getAddPayLogOrderListLimit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
$data['total'] = $order->getAddPayLogOrderListLimitTotal($where);
$m_pay_adjustment = new OfficeOPayLogAdjustment();
$m_refund = new OfficeORefundModel();
foreach ($list as $k => $v) {
$list[$k]['source_id'] = $list[$k]['is_adjustment'] = '';
if ($v['source'] == 2) {
$source_id = $m_pay_adjustment->getFieldColumn('id', ['new_paylog_id' => $v['id'], 'is_del' => 0]);
$list[$k]['source_id'] = empty($source_id) ? 0 : implode(',', $source_id);
$adjustment_id = $m_pay_adjustment->getFieldColumn('id', ['paylog_id' => $v['id'], 'is_del' => 0]);
$list[$k]['is_adjustment'] = $adjustment_id ? 1 : 0;
} else {
$source_id = $m_pay_adjustment->getFieldColumn('id', ['paylog_id' => $v['id'], 'is_del' => 0]);
$list[$k]['source_id'] = empty($source_id) ? 0 : implode(',', $source_id);
$list[$k]['is_adjustment'] = $source_id ? 1 : 0;
}
$num = $m_refund->getFind('id', ['pay_log_id' => $v['id'], 'is_del' => 0]);
if ($num['id'] > 0) {
$list[$k]['is_refund'] = 1;
} else {
$list[$k]['is_refund'] = 0;
}
if ($v['type'] != 10 && $v['type'] != 30) {
$list[$k]['bargain_id'] = empty($v['bargain_id']) ? '' : $v['bargain_id'];
} else {
$list[$k]['bargain_id'] = '';
}
if (!empty($v['income_time'])) {
$income_time = date('Y-m-d H:i:s', strtotime($v['income_time']));
if ($income_time == $v['income_time']) {
$list[$k]['income_time'] = $income_time;
} else {
$list[$k]['income_time'] = '';
}
}
$list[$k]['pay_type_num'] = $v['pay_type'];
$list[$k]['type_num'] = $v['type'];
}
$data['list'] = $this->numberTransitionString($list);
} catch (\Exception $e) {
$msg = '内部错误:' . $e->getMessage();
if ($this->params['excel'] == 1) {
return $this->error($msg);
}
}
return $this->response(200, $msg, $data);
}
/** /**
* 收款记录 Excel * 收款记录 Excel
*/ */
...@@ -306,9 +372,6 @@ class OfficePayLog extends Basic ...@@ -306,9 +372,6 @@ class OfficePayLog extends Basic
$data = []; $data = [];
$where['a.is_del'] = 0; $where['a.is_del'] = 0;
$is_show = 0;
$msg = '';
/*提交时间 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'];
...@@ -333,7 +396,6 @@ class OfficePayLog extends Basic ...@@ -333,7 +396,6 @@ class OfficePayLog extends Basic
if (!empty($this->params['income_end_time']) && empty($this->params['income_start_time'])) { if (!empty($this->params['income_end_time']) && empty($this->params['income_start_time'])) {
$where['a.income_time'] = ['< time', $this->params['end_time'] . ' 23:59:59']; $where['a.income_time'] = ['< time', $this->params['end_time'] . ' 23:59:59'];
$is_show = 1;
} }
if (!empty($this->params['income_end_time']) && !empty($this->params['income_start_time'])) { if (!empty($this->params['income_end_time']) && !empty($this->params['income_start_time'])) {
...@@ -825,7 +887,7 @@ class OfficePayLog extends Basic ...@@ -825,7 +887,7 @@ class OfficePayLog extends Basic
$data['total'] = $m_paylog->getAdjustmentListTotal($where); $data['total'] = $m_paylog->getAdjustmentListTotal($where);
//加时间条件 //加时间条件
if ($is_show) { if ($is_show) {
$data['money_total'] = $m_paylog->getMoneyTotal($where, 'a.money'); //总额 $data['money_total'] = $m_paylog->getMoneyTotal($where); //总额
} else { } else {
$data['money_total'] = ''; $data['money_total'] = '';
} }
...@@ -1785,7 +1847,7 @@ class OfficePayLog extends Basic ...@@ -1785,7 +1847,7 @@ class OfficePayLog extends Basic
$data['total'] = $m_paylog->getAdjustmentListTotal($where); $data['total'] = $m_paylog->getAdjustmentListTotal($where);
//加时间条件 //加时间条件
if ($is_show) { if ($is_show) {
$data['money_total'] = $m_paylog->getMoneyTotal($where, 'a.money'); //总额 $data['money_total'] = $m_paylog->getMoneyTotal($where); //总额
} else { } else {
$data['money_total'] = ''; $data['money_total'] = '';
} }
......
...@@ -477,6 +477,11 @@ class PayLog extends Basic ...@@ -477,6 +477,11 @@ class PayLog extends Basic
return $data; return $data;
} }
/**
* 收款-删除
*
* @return \think\Response|\think\response\View|void
*/
public function getCollectionDel() public function getCollectionDel()
{ {
if (!$this->request->isAjax()) { if (!$this->request->isAjax()) {
......
...@@ -1184,7 +1184,7 @@ Route::group('office_index', [ ...@@ -1184,7 +1184,7 @@ Route::group('office_index', [
'getRecords' => ['index/OfficeRoom/getRecords', ['method' => 'GET']],//盘方操作记录 'getRecords' => ['index/OfficeRoom/getRecords', ['method' => 'GET']],//盘方操作记录
'batchChangDish' => ['index/OfficeRoom/batchChangDish', ['method' => 'post']],//批量修改盘方 'batchChangDish' => ['index/OfficeRoom/batchChangDish', ['method' => 'post']],//批量修改盘方
'getCollection' => ['index/OfficePayLog/getCollection', ['method' => 'GET']],//收款记录 'getCollection' => ['index/OfficePayLog/getCollection', ['method' => 'GET']],//收款记录
'getCollectionDel' => ['index/OfficePayLog/getCollection', ['method' => 'GET']],//收款记录 'getCollectionDel' => ['index/OfficePayLog/getCollectionDel', ['method' => 'GET']],//收款记录-删除
'getCollectionExcel' => ['index/OfficePayLog/getCollectionExcel', ['method' => 'get']],//导出收款记录 'getCollectionExcel' => ['index/OfficePayLog/getCollectionExcel', ['method' => 'get']],//导出收款记录
'adjustment' => ['index/OfficePayLog/adjustment', ['method' => 'get']],//导出收款记录 'adjustment' => ['index/OfficePayLog/adjustment', ['method' => 'get']],//导出收款记录
'getCollectionDetail' => ['index/OfficePayLog/getCollectionDetail', ['method' => 'get']],//收款详情 'getCollectionDetail' => ['index/OfficePayLog/getCollectionDetail', ['method' => 'get']],//收款详情
......
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