Commit c89a065b authored by hujun's avatar hujun

办公楼成功报告

parent c8e25c62
<?php
namespace app\model;
use think\Db;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/2/1
* Time : 17:15
* Intro:
*/
class OfficeOBargainLogModel extends BaseModel
{
protected $table = "office_o_bargain_log";
private $db_;
function __construct()
{
$this->db_ = Db::name($this->table);
}
public function addLog($params)
{
Db::startTrans();
try {
$this->db_->insertAll($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
public function insertLog($params)
{
Db::startTrans();
try {
$id = $this->db_->insertGetId($params);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* 查询列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getLogAgent($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->field($field)
->alias('a')
->join('a_agents b', 'a.operation_id = b.id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
/**
* 查询列表
*
* @param $params
* @return int|string
*/
public function getLogAgentTotal($params) {
return $this->alias('a')
->join('a_agents b', 'a.operation_id = b.id', 'left')
->where($params)
->count();
}
}
\ No newline at end of file
...@@ -1330,32 +1330,14 @@ class OfficeOBargainModel extends Model ...@@ -1330,32 +1330,14 @@ class OfficeOBargainModel extends Model
$where_['a.id'] = $params['id']; $where_['a.id'] = $params['id'];
} }
try { $result = $this->db_
$result = $this->db_ ->field($filed)
->field($filed) ->alias("a")
->alias("a") ->join("o_partial_commission b", "a.id = b.bargain_id", "left")
->join("o_partial_commission b", "a.id = b.bargain_id", "left") ->where($where_)
->where($where_) ->whereOr($whereOr_)
->whereOr($whereOr_) ->order("a.id asc")
->order("a.id asc") ->find();
->find();
$result['scale'] = empty($result['new_scale']) ? $result['scale'] : $result['new_scale'];
$result['scale_fee'] = empty($result['should_commission']) ? $result['scale_fee'] : $result['should_commission'];
$m_agent = new AAgents();
$filed_agent = 'a.id,a.name,a.phone,b.store_name,c.district_name,a.store_id,a.district_id';
$agent_info = $m_agent->getStoreDistrict($filed_agent, [ 'a.id' => $result['agent_id'] ]);
$result['district_name'] = $agent_info['district_name'];
$result['store_name'] = $agent_info['store_name'];
$result['name'] = $agent_info['name'];
$result['phone'] = $agent_info['phone'];
$result['store_id'] = $agent_info['store_id'];
$result['district_id'] = $agent_info['district_id'];
} catch (\Exception $ex) {
$result = $ex->getMessage();
}
return $result; return $result;
} }
......
<?php
/**
* Created by PhpStorm.
* User: hujun
* Date: 2018/3/22
* Time: 15:25
*/
namespace app\model;
class OfficeOFinancialAudit extends BaseModel
{
/**
* 添加审核通过记录
*
* @param $data
* @return false|int
*/
public function addAudit($data)
{
$save_data['bargain_id'] = $data['bargain_id'];
$save_data['agent_id'] = $data['agent_id'];
$save_data['order_no'] = $data['order_no'];
$save_data['order_id'] = $data['order_id'];
$save_data['source'] = $data['source'];
$save_data['status'] = $data['status'];
$save_data['remark'] = $data['remark'];
$save_data['audit_level'] = $data['audit_level'];
$save_data['audit_id'] = $data['audit_id'];
$save_data['audit_name'] = $data['audit_name'];
return $this->save($save_data);
}
/**
* 获取最新审核
*
* @param $bargain_id
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getLastStep($bargain_id, $source)
{
return $this->field('id,audit_level')->where([
'bargain_id' => $bargain_id,
'status' => 1,
'source' => $source,
'is_del' => 0
])->order('id desc')->find();
}
/**
* @param $id
* @param $params
* @return int
* @throws \think\exception\PDOException
*/
public function updateBargainById($id, $params)
{
$params["update_time"] = date("Y-m-d H:i:s", time());
$this->startTrans();
try {
$this->where('id', $id)->update($params);
$this->commit();
return 1;
} catch (\Exception $e) {
$this->rollback();
return 0;
}
}
/**
* 撤销数据
*
* @param int $bargain_id
* @param array $params
* @return bool
* @throws \think\exception\PDOException
*/
public function backOutUpdate(int $bargain_id, array $params = []): bool
{
if (empty($bargain_id)) {
return false;
}
$this->startTrans();
// $data['is_del'] = 1; //去除之前的审核记录
// $this->editData($data, $bargain_id, 'bargain_id');
$m_bargain = new OBargainModel();
$update_data['status'] = 20;
$update_data['audit_level'] = 0;
$update_data['content'] = $params['content']; //撤销原因
// $result_bargain = $m_bargain->updateBargain($bargain_id, $update_data);
$where[] = ['EXP', 'id='.$bargain_id.' or father_id='.$bargain_id];
$where['status'] = ['in', '10,11,12,13'];
$result_bargain = $m_bargain->updateBargainByWhere($update_data, $where);
if ($result_bargain) {
$this->commit();
$result = true;
} else {
$this->rollback();
$result = false;
}
return $result;
}
/**
* 查询成交报告记录
*
* @param $filed
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectFinancialByOrderNo($filed, $params)
{
$where_ = [];
if (isset($params["order_id"])) {
$where_["order_id"] = $params["order_id"];
}
$where_["is_del"] = 0;
$where_["source"] = 3;
$data = $this
->field($filed)
->where($where_)
->select();
return $data;
}
}
\ No newline at end of file
...@@ -786,6 +786,16 @@ class OfficeOReportModel extends Model ...@@ -786,6 +786,16 @@ class OfficeOReportModel extends Model
->count('a.id'); ->count('a.id');
return $result; return $result;
} }
/**
* @param $field
* @param $where
* @return mixed
*/
public function getFieldValue($field, $where) {
return $this->db->where($where)->value($field);
}
} }
......
...@@ -1076,6 +1076,19 @@ Route::group('office_index', [ ...@@ -1076,6 +1076,19 @@ Route::group('office_index', [
'reportListThree/:check_status' => ['index/OfficeBargain/reportList', ['method' => 'get'], ['check_status' => 3]], //财务 成交报告-未结单-第三级审核 'reportListThree/:check_status' => ['index/OfficeBargain/reportList', ['method' => 'get'], ['check_status' => 3]], //财务 成交报告-未结单-第三级审核
'reportListStatement/:check_status' => ['index/OfficeBargain/reportList', ['method' => 'get'], ['check_status' => 4]], //财务 成交报告-已结单 'reportListStatement/:check_status' => ['index/OfficeBargain/reportList', ['method' => 'get'], ['check_status' => 4]], //财务 成交报告-已结单
'reportListAll/:check_status' => ['index/OfficeBargain/reportList', ['method' => 'get'], ['check_status' => 10]], //财务 成交报告-全部 'reportListAll/:check_status' => ['index/OfficeBargain/reportList', ['method' => 'get'], ['check_status' => 10]], //财务 成交报告-全部
'editBargainInfo' => ['index/OfficeBargain/editBargainInfo', ['method' => 'post']], //修改成交报告佣金
'checkReferrer' => ['index/OfficeBargain/checkReferrer', ['method' => 'get']], //检查是否有邀请人(客户邀请客户)
'searchOrderAgents' => ['index/OfficeBargain/searchOrderAgents', ['method' => 'GET']], //order_id获取盘方,客方,反签,独家,合作方
'addBargain' => ['index/OfficeBargain/addBargain', ['method' => 'post']], //新增成交报告佣金(分佣提成)
'getBargainCommission' => ['index/OfficeBargain/getBargainCommission', ['method' => 'GET|POST']], //获取成交报告分佣方佣金和修改
'delPartialCommission' => ['index/OfficeBargain/delPartialCommission', ['method' => 'POST']], //删除分佣方
'getRealIncome' => ['index/OfficeBargain/getRealIncome', ['method' => 'GET']], //获取实收日期
'addRealIncome' => ['index/OfficeBargain/addRealIncome', ['method' => 'POST']], //增加和编辑实收佣金
'addTallAge' => ['index/OfficeBargain/addTallAge', ['method' => 'POST']], //新增和编辑开票税费
'getTaxesById' => ['index/OfficeBargain/getTaxesById', ['method' => 'POST|GET']], //财务结单
'delTaxes' => ['index/OfficeBargain/delTaxes', ['method' => 'POST']], //删除开票税费
'backOutToOne' => ['index/OfficeBargain/backOutToOne', ['method' => 'POST']], //财务 成交报告-撤销成交报告
]); ]);
Route::group('office_api', [ Route::group('office_api', [
......
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