Commit fe46b2f5 authored by hujun's avatar hujun

税费和实收

parent 5c16e28b
......@@ -601,4 +601,38 @@ class Finance extends Basic
$data = $m_partial->addCommission($this->params, $this->userId);
return $this->response("200", "request success", $data);
}
/**
* 开票税费查询
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getTallAge() {
if (empty($this->params['bargain_id'])) {
return $this->response(101, '查询开票税费参数错误!');
}
$m_fee = new OFee();
$field = 'a.id,a.fee,a.operation_date,b.scale,c.name,c.phone';
$data = $m_fee->getBargainFeeDetail($this->params['bargain_id'], 1, $field);
return $this->response("200", "request success", $data);
}
/**
* 新增开票
*
* @return \think\Response
* @throws \Exception
*/
public function addTallAge() {
if (empty($this->params['bargain_id'])) {
return $this->response(101, '新增实收参数错误');
}
$m_fee = new OFee();
$data = $m_fee->addFee($this->params['tallage'], $this->params['bargain_id'], 1, $this->userId);
return $this->response("200", "request success", $data);
}
}
......@@ -55,12 +55,35 @@ class OFee extends BaseModel
public function addFee($data, $bargain_id, $type = 0, int $agent_id) {
$insert_data = [];
foreach ($data as $k => $v) {
$insert_data[$k]['id'] = $v['id'];
$insert_data[$k]['bargain_id'] = $bargain_id;
$insert_data[$k]['fee'] = $v['fee'];
$insert_data[$k]['agent_id'] = $agent_id;
$insert_data[$k]['type'] = $type;
$insert_data[$k]['operation_date'] = $v['operation_date'];
}
return $this->saveAll($insert_data);
}
/**
* 根据成交报告-实收佣金 或 税费开票 查询详情
*
* @param int $bargain_id
* @param int $type
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainFeeDetail(int $bargain_id, int $type = 0, string $field) {
return $this->field($field)
->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('a_agents c', 'b.agent_id = c.id', 'left')
->where('bargain_id', $bargain_id)
->where('type', $type)
->select();
}
}
\ No newline at end of file
......@@ -113,21 +113,26 @@ class OPartialCommission extends BaseModel
}
/**
* 增加实收佣金
* 增加和编辑实收佣金
*
* @param $data
* @param $agent_id
* @return int|string
*/
public function addCommission($data, $agent_id) {
$insert_data['id'] = $data['id'];
$insert_data['bargain_id'] = $data['bargain_id'];
$insert_data['practical_fee'] = $data['practical_fee'];
$insert_data['cash'] = $data['cash'];
$insert_data['service_charge'] = $data['service_charge'];
$insert_data['tallage'] = $data['tallage'];
$insert_data['charity_fund'] = $data['charity_fund'];
$insert_data['real_fee'] = $data['real_fee'];
$insert_data['agent_id'] = $agent_id;
return $this->insert($insert_data);
if (empty($insert_data['id'])) {
return $this->insert($insert_data);
} else {
return $this->update($insert_data);
}
}
}
\ No newline at end of file
......@@ -217,7 +217,9 @@ Route::group('index', [
'phone_up_list' => ['index/remark/phone_up_list', [ 'method' => 'get|post' ] ], //电话跟进列表
'selectReportAll' => ['index/Finance/selectReportAll', [ 'method' => 'get|post' ] ], //时间轴
'partialCommissionList' => ['index/Finance/partialCommissionList', [ 'method' => 'get' ] ], //分佣提成明细表
'addRealIncome' => ['index/Finance/addRealIncome', [ 'method' => 'POST' ] ], //增加实收佣金
'addRealIncome' => ['index/Finance/addRealIncome', [ 'method' => 'POST' ] ], //增加和编辑实收佣金
'getTallAge' => ['index/Finance/getTallAge', [ 'method' => 'GET' ] ], //开票税费查询
'addTallAge' => ['index/Finance/addTallAge', [ 'method' => 'POST' ] ], //新增和编辑开票税费
'test123' => ['index/WatchShop/test123', [ 'method' => 'get|post' ] ], //时间轴
'agent_zhuan_aagent' => [ 'index/agent/agent_zhuan_aagent', [ 'method' => 'post|get' ] ],//经纪人
'shop_a_store' => [ 'index/agent/shop_a_store', [ 'method' => 'post|get' ] ],//经纪人
......
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