Commit 020edd79 authored by hujun's avatar hujun

撤销成交报告业绩统计

parent b619f3dc
......@@ -2649,20 +2649,18 @@ class Finance extends Basic
return $this->response(101, '收款存在调整,不能撤销!');
}
$check = $this->updatePerformanceAll($this->params['bargain_id']);
if ($check['status'] == 'fail') {
return $this->response(101, '更新个人业绩失败,请重试!');
}
$params['content'] = trim($this->params['content']); //撤销原因
$m_financial = new OFinancialAudit();
$result = $m_financial->backOutUpdate($this->params['bargain_id'], $params);
if ($result) {
$check = $this->updatePerformanceAll($this->params['bargain_id']);
if ($check['status'] == 'fail') {
return $this->response(101, '更新个人业绩失败,请重试!');
}
$code = 200;
$this->editRecordLog($this->params['bargain_id'], '[撤销成交报告]', 3); //日志记录
$this->updatePerformanceAll($this->params['bargain_id'], 1);
$bargain_data = $this->m_bargain->getBargainDetail('order_id,order_no,agent_id', [ 'id' => $this->params['bargain_id'] ]);
$financial_data['bargain_id'] = $this->params['bargain_id'];
$financial_data['audit_name'] = $this->userName;
......@@ -2802,7 +2800,7 @@ class Finance extends Basic
$where_bargain['agent_id'] = $agent_id;
$where_bargain['create_time'] = ['BETWEEN', [$date.' 00:00:00', $date.' 23:59:59']];
//实收
$receivedSum = $this->m_bargain->getReceivedGroupTimeNew($where_bargain);
$receivedSum = $this->m_bargain->getAddBargainNumGroupTimeNew($where_bargain, 2); //1表示业绩 2表示实收
$received_sum = empty($receivedSum[0]["num"]) ? 0 : $receivedSum[0]["num"];
//业绩
......@@ -2810,7 +2808,7 @@ class Finance extends Basic
$performance_sum = empty($performanceSum[0]["num"])? 0:$performanceSum[0]["num"];
$id = $m_agent_total->getTotalEndTimeByAgentId('id', ['total_time'=>$date, 'agent_id'=>$where_bargain['agent_id']]);
if (empty($id[0])) {
if (empty($id[0]['id'])) {
$insert_data[] = [
'store_id' => $store_id,
'district_id' => $district_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