Commit 9720a4ca authored by zw's avatar zw

bug

parent e3e20554
......@@ -63,6 +63,11 @@ class DailyPaperService
$daily_info = $this->getDailyInfo($agent_id, $daily_data);
//todo 获取各个list
$result["list"] = $this->getPayLogList($store_id, $daily_data);
//todo 统计入账出账等
$sum_info =$this->getSum($store_id, $daily_data);
$result["recorded_money"] = $sum_info["sum_arr"];
$result["adjustment_money"] = $sum_info["adjustment_arr"];
$result["remittance_money"] = $result["recorded_money"] - $result["adjustment_money"];
$result["is_commit"] = 1;
switch ($is_store) {
......@@ -104,6 +109,36 @@ class DailyPaperService
}
/**
* @param $store_id
* @param $daily_data
* @return null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private function getSum($store_id, $daily_data)
{
$ids = $this->getAgentsByStoreId($store_id);
if (!$ids) {
return null;
}
//中介费入账
$field = "money";
$params["agent_id"] = array("in", ($ids));
$params["is_del"] = 0;
$params["create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$payLogModel = new OPayLogModel();
$info["sum_arr"] = $payLogModel->getSum($field, $params);
$field_adjustment = "b.money";
$params_adjustment["a.agent_id"] = array("in", ($ids));
$params_adjustment["b.is_del"] = 0;
$params_adjustment["b.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$info["adjustment_arr"] = $payLogModel->getAdjustmentSum($field_adjustment, $params_adjustment);
return $info;
}
/**
* 获取总数
* @param $store_id
......
......@@ -33,7 +33,7 @@ class DailyPaper extends Basic
public function dailyDetail()
{
$params = $this->params;
/* $params = array(
/* $params = array(
"store_id" => 730,//门店id
"is_store" => 0,//身份是否是店长,财务显示不一样 0店长 1财务
"daily_data" => "2018-12-01"
......
......@@ -483,6 +483,30 @@ class OPayLogModel extends Model
->select();
}
/**
* @param $filed
* @param $params
* @return float|int
*/
public function getSum($filed,$params){
return $this->db_
->where($params)
->sum($filed);
}
/**
* @param $filed
* @param $params
* @return float|int
*/
public function getAdjustmentSum($filed,$params){
return $this->db_
->alias('a')
->join('o_paylog_adjustment b','a.id=b.new_paylog_id')
->where($params)
->sum($filed);
}
/**
* @param $field
* @param $where
......
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