Commit 9370ad6d authored by zhuwei's avatar zhuwei

计算实收

parent adfaf76a
......@@ -178,7 +178,7 @@ class StatementService
$performanceSum = $this->bargainModel->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
$result["performance_month"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$real_performanceSum = $this->bargainModel->getReceived($where_);
$real_performanceSum = $this->bargainModel->getReceivedV2($where_);
$result["real_performance_month"] = isset($real_performanceSum[0]["num"]) ? $real_performanceSum[0]["num"] : 0;
//本周业绩
......
......@@ -851,7 +851,36 @@ class OBargainModel extends Model
->join("o_partial_commission b", "a.id=b.bargain_id", "right")
->where($where_)
->select();
//echo $this->getLastSql();
return $date;
}
/**
* 计算实收
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getReceivedV2($params)
{
$where_ = [];
$field = "sum(b.practical_fee) as num";
if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"];
}
if (isset($params["create_time"])) {
$where_["b.confirm_date"] = $params["create_time"];
}
$where_["b.is_del"] = 0;
$where_["b.confirm_status"] = 1;
$where_["a.status"] = array( "in", '10,11,13');
$date = Db::table($this->table)
->field($field)
->alias("a")
->join("o_partial_commission b", "a.id=b.bargain_id", "right")
->where($where_)
->select();
return $date;
}
......
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