Commit 81cdb40c authored by hujun's avatar hujun

导出修改

parent ca694e6e
...@@ -3076,7 +3076,7 @@ class Finance extends Basic ...@@ -3076,7 +3076,7 @@ class Finance extends Basic
* 收款记录 Excel * 收款记录 Excel
*/ */
public function getCollectionExcel() { public function getCollectionExcel() {
set_time_limit(0);
$pageNo = 1; $pageNo = 1;
$pageSize = 10000; $pageSize = 10000;
$data = []; $data = [];
...@@ -3189,19 +3189,15 @@ class Finance extends Basic ...@@ -3189,19 +3189,15 @@ class Finance extends Basic
if (!empty($this->params['bargain_id'])) { if (!empty($this->params['bargain_id'])) {
$where['a.bargain_id'] = $this->params['bargain_id']; $where['a.bargain_id'] = $this->params['bargain_id'];
} }
try { // try {
$order = new OPayLogModel(); $order = new OPayLogModel();
if (empty($this->params['excel'])) { 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 = '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,d.internal_address as address,e.name as agent_name'; $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); $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_pay_adjustment = new OPayLogAdjustment();
$m_report = new OReportModel(); $m_report = new OReportModel();
$m_agent_house = new GHousesToAgents();
$m_house = new GHouses();
$m_refund = new ORefundModel(); $m_refund = new ORefundModel();
foreach ($list as $k=>$v) { foreach ($list as $k=>$v) {
$list[$k]['source_id'] = $list[$k]['is_adjustment'] = ''; $list[$k]['source_id'] = $list[$k]['is_adjustment'] = '';
...@@ -3234,31 +3230,53 @@ class Finance extends Basic ...@@ -3234,31 +3230,53 @@ class Finance extends Basic
} }
$list[$k]['current_agent_name'] = $list[$k]['store_name'] = ""; $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']]); if (($v['type'] == 92 || $v['type'] == 91) && $v['bargain_id'] > 0) {
//案场费 对应业务员:盘方 $bargain_where[] = ['EXP','a.id ='.$v['bargain_id'].' or father_id='. $v['bargain_id']];
$current_where['a.is_del'] = 0; $bargain_where['a.status'] = ['in','10,11,13'];
if ($is_exclusive_type) { $bargain_where['a.role'] = ['in','3,4,5'];
$current_where['a.type'] = 3; $bargain_data = $this->m_bargain->agentBargainAll('a.role,a.scale,b.name', $bargain_where);
} else { $role_arr = [1=>'盘方', 2=>'客方',3=>'反签',4=>'独家',5=>'合作方',6=>'APP盘下载方',7=>'APP客下载方'];
$current_where['a.type'] = 2; $name = '';
foreach ($bargain_data as $k2=>$v2) {
$name .= $v2['name'] . '('.$role_arr[$v2['role']].$v2['scale'].'%),';
} }
$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']; $list[$k]['current_agent_name'] = rtrim($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) { if ($v['type'] == 10 || $v['type'] == 30) {
//意向金/保管金 10/30 对应业务员:约带看的人 即 反签方 if (isset($house_data[0]['f_id'])) {
//中介费 对应业务员:约带看的人 即 反签方
$current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id'=>$v['f_id']]); $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'])) { $list[$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name'];
$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 ($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'])) { if (!empty($v['income_time'])) {
$income_time = date('Y-m-d H:i:s', strtotime($v['income_time'])); $income_time = date('Y-m-d H:i:s', strtotime($v['income_time']));
...@@ -3323,10 +3341,10 @@ class Finance extends Basic ...@@ -3323,10 +3341,10 @@ class Finance extends Basic
$export->exportTable('收款记录', $excel_data, 12, '收款记录', $title); $export->exportTable('收款记录', $excel_data, 12, '收款记录', $title);
} }
} catch (\Exception $e) { // } catch (\Exception $e) {
$msg = '内部错误:' . $e->getMessage(); // $msg = '内部错误:' . $e->getMessage();
return $this->error($msg); // return $this->error($msg);
} // }
} }
...@@ -3603,7 +3621,6 @@ class Finance extends Basic ...@@ -3603,7 +3621,6 @@ class Finance extends Basic
} }
$m_report = new OReportModel(); $m_report = new OReportModel();
$pay_data['current_agent_name'] = '';
$pay_data['current_agent_name'] = $pay_data['store_name'] = ""; $pay_data['current_agent_name'] = $pay_data['store_name'] = "";
if (($pay_data['type'] == 92 || $pay_data['type'] == 91) && $pay_data['bargain_id'] > 0) { if (($pay_data['type'] == 92 || $pay_data['type'] == 91) && $pay_data['bargain_id'] > 0) {
$where[] = ['EXP','a.id ='.$pay_data['bargain_id'].' or father_id='. $pay_data['bargain_id']]; $where[] = ['EXP','a.id ='.$pay_data['bargain_id'].' or father_id='. $pay_data['bargain_id']];
......
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