Commit d5542c2f authored by zw's avatar zw

财务日报

parent 5f6a35fc
......@@ -32,11 +32,11 @@ class DailyPaper extends Basic
public function dailyDetail(){
$params = $this->params;
$params = array(
"store_id" => 1,//门店id
"store_id" => 73,//门店id
"is_store" => 0,//身份是否是店长,财务显示不一样 0店长 1财务
"daily_data" => "2018-12-01"
);
$this->agentId = 1;
$this->agentId = 74;
if(!isset($params["store_id"]) || !isset($params["is_store"]) || !isset($params["daily_data"])){
return $this->response("101","请求参数错误");
}
......
......@@ -6,6 +6,7 @@ use app\api_broker\service\VerifyService;
use app\model\AAgents;
use app\model\ODaily;
use app\model\ODailyLog;
use app\model\OPayLogAdjustment;
use app\model\OPayLogModel;
/**
......@@ -108,23 +109,30 @@ class DailyPaperService
}
$payLogModel = new OPayLogModel();
//中介费入账
$field = "a.id,c.id as bargain_id,b.house_id,c.price,c.commission,a.money,a.pay_type,a.transfer_name,
d.report_agent_id,c.is_open,a.is_dividend,a.create_time";
$field = "a.id,c.id as bargain_id,b.house_id,c.price,a.money,a.pay_type,a.transfer_name,
d.report_agent_id,c.is_open,a.is_dividend,a.receipt_number,a.create_time";
$params["a.agent_id"] = array("in",($ids));
$params["a.is_del"] = 0;
$params["a.type"] = 91;
$params["c.father_id"] = 0;
$info["agency_fee"] = $payLogModel->selectPayLogList($field,$params);
$info["agency_fee"] = $payLogModel->selectPayLogListByBargain($field,$params);
//案场费入账 盘方
$params["a.type"] = 92;
$info["case_fee"] = $payLogModel->selectPayLogList($field,$params);
$info["case_fee"] = $payLogModel->selectPayLogListByBargain($field,$params);
$field_money = "a.id,b.house_id,a.pay_type,a.transfer_name, d.report_agent_id,a.is_dividend,a.receipt_number,a.create_time";
//意向金
$params["a.type"] = 10;
$info["earnest_money"] = $payLogModel->selectPayLogList($field,$params);
unset($params["c.father_id"]);
$info["earnest_money"] = $payLogModel->selectPayLogListByBargainReport($field_money,$params);
//保管金
$params["a.type"] = 30;
$info["custody_money"] = $payLogModel->selectPayLogList($field,$params);
$info["custody_money"] = $payLogModel->selectPayLogListByBargainReport($field_money,$params);
//调整出账
$field_adjustment = "b.id,c.house_id,a.income_time,b.type,a.receipt_number,a.create_time";
$params_adjustment["a.agent_id"] = array("in",($ids));
$params_adjustment["a.is_del"] = 0;
$info["adjustment"] = $payLogModel->selectAdjustmentList($field_adjustment,$params_adjustment);
return $info;
}
......
......@@ -465,7 +465,7 @@ class OPayLogModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectPayLogList($filed,$params)
public function selectPayLogListByBargain($filed,$params)
{
return $this->db_->field($filed)
->alias("a")
......@@ -475,6 +475,34 @@ class OPayLogModel extends Model
->where($params)
->select();
}
/**
* @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 selectPayLogListByBargainReport($filed,$params)
{
return $this->db_->field($filed)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->join("o_report d", "a.report_id = d.id", "left")
->where($params)
->select();
}
public function selectAdjustmentList($filed,$params)
{
return $this->db_->field($filed)
->alias("a")
->join("o_paylog_adjustment b", "a.order_id = b.id", "right")
->join("o_order c", "a.order_id = c.id", "left")
->where($params)
->select();
}
/**
* @param $field
......
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