Commit 19ad83df authored by hujun's avatar hujun

三级审核列表修改

parent 7012c977
......@@ -72,7 +72,6 @@ class Finance extends Basic
$where['a.father_id'] = 0;
$where['c.is_del'] = 0;
$where['a.status'] = 10;
$order = 'e.id desc';
if (!empty($this->params['create_time']) && empty($this->params['end_time'])) {
......@@ -103,15 +102,21 @@ class Finance extends Basic
case 2 :
//成交报告列表-第二级审核
$where['e.audit_level'] = 0;
$where[]= ['EXP','e.id in (SELECT MAX(id) FROM o_financial_audit WHERE is_del = 0 and `status`<>3 GROUP BY bargain_id)'];
$where['e.is_del'] = 0;
break;
case 3 :
//成交报告列表-第三级审核
$where['e.audit_level'] = 1;
$where['e.is_del'] = 0;
$where[]= ['EXP','e.id in (SELECT MAX(id) FROM o_financial_audit WHERE is_del = 0 and `status`<>3 GROUP BY bargain_id)'];
break;
case 4 :
//成交报告列表-已结单
$where['a.account_statement'] = 1;
$where['a.status'] = 11;
$where['e.audit_level'] = 2;
break;
/* case 5 :
//成交报告列表-待撤销
......@@ -123,8 +128,8 @@ class Finance extends Basic
break;*/
default :
//成交报告列表-第一级审核
$where['e.audit_level'] = NULL;
$order = 'a.id DESC';
$order = 'a.id DESC';
$where[]= ['EXP','e.audit_level IS NULL or e.id not in (SELECT MAX(id) FROM o_financial_audit WHERE is_del = 0 and `status`<>3 GROUP BY bargain_id)'];
}
if (!empty($this->params['status'])) {
......@@ -164,6 +169,7 @@ class Finance extends Basic
$params['audit_level'] = $this->params['check_status'];
$params['remark'] = $this->params['remark'];
$status = $bargain->addCheckBargain($this->params['id'], $params, $this->params['source'], $this->params['status']);
if (empty($status)) {
$data['code'] = 101;
$data['msg'] = '审核失败';
......@@ -1162,8 +1168,9 @@ class Finance extends Basic
$insert_data['audit_id'] = $this->userId;
$insert_data['audit_name'] = $this->userName;
$insert_data['audit_level'] = 3;
$data = $m_bargain->addCheckBargain($this->params['bargain_id'], $insert_data, 1, 10);
$insert_data['audit_level'] = 2;
$insert_data['is_del'] = 1;
$data = $m_bargain->addCheckBargain($this->params['bargain_id'], $insert_data, 1, 10);
$code = 200;
$msg = "";
......
......@@ -254,6 +254,7 @@ class OBargainModel extends Model
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('o_financial_audit e', 'e.bargain_id = a.id', 'left')
->where($params)
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
......@@ -274,6 +275,7 @@ class OBargainModel extends Model
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('o_financial_audit e', 'e.bargain_id = a.id', 'left')
->where($params)
->group('a.id')
->count();
}
......@@ -331,14 +333,14 @@ class OBargainModel extends Model
if ($return) {
if ($data['audit_level'] == 3 && $status == 10) {
if ($data['audit_level'] == 2 && $status == 10) {
$update_data['status'] = 11;
$update_data['account_statement'] = 1;
$update_data['account_time'] = time();
$this->save($update_data, [ 'id' => $bargain_data['id'] ]);
}
if ($data['audit_level'] == 3 && $status == 20) {
if ($data['audit_level'] == 2 && $status == 20) {
$this->where('id', $bargain_data['id'])->setField('status', 21);
}
......@@ -663,14 +665,11 @@ class OBargainModel extends Model
->select();
$m_agent = new AAgents();
$m_fee = new OTaxes();
foreach ($data as $k => $v) {
if (isset($v['agent_id'])) {
$district_store = $m_agent->getStoreDistrict('store_name,district_name', [ 'a.id' => $v['agent_id'] ]);
$data[$k]['district_store'] = $district_store['district_name'] . '-' . $district_store['store_name'];
}
// $data[$k]['tax_fee'] = $m_fee->where('bargain_id', $v['id'])->sum('fee');
}
return $data;
......
......@@ -43,7 +43,8 @@ class OFinancialAudit extends BaseModel
public function getLastStep($bargain_id) {
return $this->field('id,audit_level')->where([
'bargain_id' => $bargain_id,
'status' => 1
'status' => 1,
'is_del' => 0
])->order('id desc')->find();
}
......
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