Commit a3f83343 authored by hujun's avatar hujun

收款列表修改

parent 81cdb40c
......@@ -2952,116 +2952,64 @@ class Finance extends Basic
try {
$order = new OPayLogModel();
if (empty($this->params['excel'])) {
$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,';
$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,d.internal_address as address,e.name as agent_name';
$list = $order->getAddPayLogOrderListLimit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
$data['total'] = $order->getAddPayLogOrderListLimitTotal($where);
$m_store = new AStore();
$m_pay_adjustment = new OPayLogAdjustment();
$m_report = new OReportModel();
$m_agent_house = new GHousesToAgents();
$m_house = new GHouses();
$m_refund = new ORefundModel();
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) {
$bargain_data = $this->m_bargain->getDetail('id,father_id', ['order_id'=>$v['order_id']]);
$bargain_id = $bargain_data['id'];
if ($bargain_data['father_id'] != 0) {
$bargain_id = $bargain_data['father_id'];
}
$list[$k]['bargain_id'] = empty($bargain_id)? '':$bargain_id;
} else {
$list[$k]['bargain_id'] = '';
}
$list[$k]['current_agent_name'] = $list[$k]['store_name'] = "";
if ($v['type'] == 92) {
$is_exclusive_type = $m_house->getHouseValue('is_exclusive_type', ['id'=>$v['house_id']]);
//案场费 对应业务员:盘方
$current_where['a.is_del'] = 0;
if ($is_exclusive_type) {
$current_where['a.type'] = 3;
} else {
$current_where['a.type'] = 2;
}
$current_agent_name = $m_agent_house->getHousesAgents($v['house_id'], 'b.name,b.store_id', $current_where);
$list[$k]['current_agent_name'] = empty($current_agent_name[0]['name']) ? '':$current_agent_name[0]['name'];
$store_name = $m_store->getStoreKeyById('store_name', ['id'=>$current_agent_name[0]['store_id']]);
$list[$k]['store_name'] = empty($store_name)? '' : $store_name;
}
$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,';
$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,d.internal_address as address,e.name as agent_name';
$list = $order->getAddPayLogOrderListLimit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
$data['total'] = $order->getAddPayLogOrderListLimitTotal($where);
if ($v['type'] == 10 || $v['type'] == 30 || $v['type'] == 91) {
//意向金/保管金 10/30 对应业务员:约带看的人 即 反签方
//中介费 对应业务员:约带看的人 即 反签方
$current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id'=>$v['f_id']]);
if (!empty($current_agent_name[0]['report_store_id'])) {
$store_name = $m_store->getStoreKeyById('store_name', ['id'=>$current_agent_name[0]['report_store_id']]);
$list[$k]['store_name'] = empty($store_name)? '' : $store_name;
}
$list[$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? '' : $current_agent_name[0]['report_agent_name'];
}
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'];
$m_pay_adjustment = new OPayLogAdjustment();
$m_refund = new ORefundModel();
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;
}
$data['list'] = $list;
//加时间条件
if ($is_show) {
$data['money_total'] = $order->getMoneyTotal($where, 'a.real_money'); //总额
if ($v['type'] != 10 && $v['type'] != 30) {
$bargain_data = $this->m_bargain->getDetail('id,father_id', ['order_id'=>$v['order_id']]);
$bargain_id = $bargain_data['id'];
if ($bargain_data['father_id'] != 0) {
$bargain_id = $bargain_data['father_id'];
}
$list[$k]['bargain_id'] = empty($bargain_id)? '':$bargain_id;
} else {
$data['money_total'] = '';
$list[$k]['bargain_id'] = '';
}
$data['list'] = $this->numberTransitionString($data['list']);
} else {
$pageNo = 1;
$pageSize = 50000; //最多5万条数据
$field = 'a.id,a.create_time,c.user_name,c.user_phone,c.report_agent_name,c.report_agent_phone,
f.store_name,g.district_name,a.money,a.real_money,a.transaction_fee,a.type,a.pay_type,
d.internal_address,a.house_number,a.source';
$data = $order->getAddPayLogOrderListLimit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
foreach ($data as $k => $v) {
if (!empty($v['user_phone'])) {
$data[$k]['user_phone'] = substr_replace($v['user_phone'], '****', 3, 4);
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'] = '';
}
}
$data = $this->numberTransitionString($data);
$list[$k]['pay_type_num'] = $v['pay_type'];
$list[$k]['type_num'] = $v['type'];
}
$export = new ExportExcelUntil();
$title = ['提交时间', '收款ID', '带看ID', '成交报告ID', '入账日期', '提交人', '对应业务员', '所属门店', '类型', '收款金额(元)', '实付金额', '来源', '状态'];
$export->exportTable('收款记录', $data, 14, '收款记录', $title);
$data['list'] = $list;
//加时间条件
if ($is_show) {
$data['money_total'] = $order->getMoneyTotal($where, 'a.real_money'); //总额
} else {
$data['money_total'] = '';
}
$data['list'] = $this->numberTransitionString($data['list']);
} catch (\Exception $e) {
$msg = '内部错误:' . $e->getMessage();
if ($this->params['excel'] == 1) {
......@@ -3189,7 +3137,7 @@ class Finance extends Basic
if (!empty($this->params['bargain_id'])) {
$where['a.bargain_id'] = $this->params['bargain_id'];
}
// try {
try {
$order = new OPayLogModel();
if (empty($this->params['excel'])) {
$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,';
......@@ -3252,31 +3200,6 @@ class Finance extends Basic
$list[$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name'];
}
}
// if ($v['type'] == 92) {
// $is_exclusive_type = $m_house->getHouseValue('is_exclusive_type', ['id'=>$v['house_id']]);
// //案场费 对应业务员:盘方
// $current_where['a.is_del'] = 0;
// if ($is_exclusive_type) {
// $current_where['a.type'] = 3;
// } else {
// $current_where['a.type'] = 2;
// }
// $current_agent_name = $m_agent_house->getHousesAgents($v['house_id'], 'b.name,b.store_id', $current_where);
// $list[$k]['current_agent_name'] = empty($current_agent_name[0]['name']) ? '':$current_agent_name[0]['name'];
// $store_name = $m_store->getStoreKeyById('store_name', ['id'=>$current_agent_name[0]['store_id']]);
// $list[$k]['store_name'] = empty($store_name)? '' : $store_name;
// }
//
// if ($v['type'] == 10 || $v['type'] == 30 || $v['type'] == 91) {
// //意向金/保管金 10/30 对应业务员:约带看的人 即 反签方
// //中介费 对应业务员:约带看的人 即 反签方
// $current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id'=>$v['f_id']]);
// if (!empty($current_agent_name[0]['report_store_id'])) {
// $store_name = $m_store->getStoreKeyById('store_name', ['id'=>$current_agent_name[0]['report_store_id']]);
// $list[$k]['store_name'] = empty($store_name)? '' : $store_name;
// }
// $list[$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? '' : $current_agent_name[0]['report_agent_name'];
// }
if (!empty($v['income_time'])) {
$income_time = date('Y-m-d H:i:s', strtotime($v['income_time']));
......@@ -3341,10 +3264,10 @@ class Finance extends Basic
$export->exportTable('收款记录', $excel_data, 12, '收款记录', $title);
}
// } catch (\Exception $e) {
// $msg = '内部错误:' . $e->getMessage();
// return $this->error($msg);
// }
} catch (\Exception $e) {
$msg = '内部错误:' . $e->getMessage();
return $this->error($msg);
}
}
......
......@@ -422,8 +422,6 @@
<th class="text-center">成交报告ID</th>
<th class="text-center">入账日期</th>
<th class="text-center">提交人</th>
<th class="text-center">对应业务员</th>
<th class="text-center">所属门店</th>
<th class="text-center">类型</th>
<th class="text-center">收款金额</th>
<th class="text-center">实付金额</th>
......
......@@ -8,8 +8,6 @@
<td>[%= it[item]['bargain_id'] %]</td>
<td>[%= it[item]['income_time'] %]</td>
<td>[%= it[item]['name'] %]</td>
<td>[%= it[item]['current_agent_name'] %]</td>
<td>[%= it[item]['store_name'] %]</td>
<td>[%= it[item]['type'] %]</td>
<td>[%= it[item]['money'] %]</td>
<td>[%= it[item]['real_money'] %]</td>
......
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