Commit 9404246e authored by clone's avatar clone

1

parent 3d593665
...@@ -69,7 +69,7 @@ class DailyPaperService ...@@ -69,7 +69,7 @@ class DailyPaperService
//todo 获取各个list //todo 获取各个list
$result["list"] = $this->getPayLogList($store_id, $daily_data); $result["list"] = $this->getPayLogList($store_id, $daily_data);
//todo 统计入账出账等 //todo 统计入账出账等
$sum_info =$this->getSum($store_id, $daily_data); $sum_info = $this->getSum($store_id, $daily_data);
$result["recorded_money"] = $sum_info["sum_arr"]; $result["recorded_money"] = $sum_info["sum_arr"];
$result["adjustment_money"] = $sum_info["adjustment_arr"]; $result["adjustment_money"] = $sum_info["adjustment_arr"];
$result["remittance_money"] = $result["recorded_money"] - $result["adjustment_money"]; $result["remittance_money"] = $result["recorded_money"] - $result["adjustment_money"];
...@@ -170,14 +170,16 @@ class DailyPaperService ...@@ -170,14 +170,16 @@ class DailyPaperService
$field = "sum(money) as money,pay_type"; $field = "sum(money) as money,pay_type";
$params["agent_id"] = array("in", ($ids)); $params["agent_id"] = array("in", ($ids));
$params["is_del"] = 0; $params["is_del"] = 0;
$params["source"] = array("in",("0,1")); $params["source"] = array("in", ("0,1"));
$params["create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59")); $params["create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$payLogModel = new OPayLogModel(); $payLogModel = new OPayLogModel();
$total_arr = $payLogModel->getTotal($field, $params, "pay_type"); $total_arr = $payLogModel->getTotal($field, $params, "pay_type");
$total["alipay"] = 0; $total["alipay"] = 0;
$total["alipay_2"] = 0; $total["alipay_2"] = 0;
$total["alipay_3"] = 0;//陈志杰支付宝
$total["tenpay"] = 0; $total["tenpay"] = 0;
$total["tenpay_2"] = 0; $total["tenpay_2"] = 0;
$total["tenpay_3"] = 0;//陈志杰微信
$total["pos"] = 0; $total["pos"] = 0;
$total["realty_pay"] = 0; $total["realty_pay"] = 0;
$total["family_pay"] = 0; $total["family_pay"] = 0;
...@@ -185,10 +187,11 @@ class DailyPaperService ...@@ -185,10 +187,11 @@ class DailyPaperService
$total["cash"] = 0; $total["cash"] = 0;
$total["other_bank"] = 0; $total["other_bank"] = 0;
$total["bank_card"] = 0; $total["bank_card"] = 0;
//71 筠姐上海银行卡 72林老师建行卡 73新同联福居银行卡 //71 筠姐上海银行卡 72林老师建行卡 73新同联福居银行卡 74陈志杰招商
$total["bank_card_yun"] = 0; $total["bank_card_yun"] = 0;
$total["bank_card_lin"] = 0; $total["bank_card_lin"] = 0;
$total["bank_card_new"] = 0; $total["bank_card_new"] = 0;
$total["bank_card_chen"] = 0;
if (count($total_arr) <= 0) { if (count($total_arr) <= 0) {
return $total; return $total;
} }
...@@ -203,6 +206,9 @@ class DailyPaperService ...@@ -203,6 +206,9 @@ class DailyPaperService
case 12: case 12:
$total["alipay"] = $item["money"]; $total["alipay"] = $item["money"];
break; break;
case 13:
$total["alipay_3"] = $item["money"];
break;
case 20: case 20:
$total["tenpay"] = $item["money"]; $total["tenpay"] = $item["money"];
break; break;
...@@ -212,6 +218,9 @@ class DailyPaperService ...@@ -212,6 +218,9 @@ class DailyPaperService
case 22: case 22:
$total["tenpay"] = $item["money"]; $total["tenpay"] = $item["money"];
break; break;
case 23:
$total["tenpay_3"] = $item["money"];
break;
case 30: case 30:
$total["pos"] = $item["money"]; $total["pos"] = $item["money"];
break; break;
...@@ -242,6 +251,9 @@ class DailyPaperService ...@@ -242,6 +251,9 @@ class DailyPaperService
case 73: case 73:
$total["bank_card_new"] = $item["money"]; $total["bank_card_new"] = $item["money"];
break; break;
case 74:
$total["bank_card_chen"] = $item["money"];
break;
} }
} }
return $total; return $total;
...@@ -277,7 +289,7 @@ class DailyPaperService ...@@ -277,7 +289,7 @@ class DailyPaperService
$payLogModel->selectPayLogListByBargain($field, $params) $payLogModel->selectPayLogListByBargain($field, $params)
); );
foreach ($info["agency_fee"] as $k=>$v) { foreach ($info["agency_fee"] as $k => $v) {
$info["agency_fee"][$k]['current_agent_name'] = ''; $info["agency_fee"][$k]['current_agent_name'] = '';
if ($v['bargain_id'] > 0) { if ($v['bargain_id'] > 0) {
$current_agent_name = $this->getBargainAgent($v['bargain_id']); $current_agent_name = $this->getBargainAgent($v['bargain_id']);
...@@ -286,7 +298,7 @@ class DailyPaperService ...@@ -286,7 +298,7 @@ class DailyPaperService
} }
} }
$open_data = $payLogOpenModel->getFind('id', 0, ['pay_log_id'=>$v['id']]); $open_data = $payLogOpenModel->getFind('id', 0, ['pay_log_id' => $v['id']]);
if ($open_data['id']) { if ($open_data['id']) {
$info["agency_fee"][$k]['is_check'] = 1; $info["agency_fee"][$k]['is_check'] = 1;
} else { } else {
...@@ -302,7 +314,7 @@ class DailyPaperService ...@@ -302,7 +314,7 @@ class DailyPaperService
$new_case_fee_arr = $this->getHousePan($case_fee_arr); $new_case_fee_arr = $this->getHousePan($case_fee_arr);
$info["case_fee"] = $this->getHouseAndAgentInfo($new_case_fee_arr); $info["case_fee"] = $this->getHouseAndAgentInfo($new_case_fee_arr);
foreach ($info["case_fee"] as $k=>$v) { foreach ($info["case_fee"] as $k => $v) {
$info["case_fee"][$k]['current_agent_name'] = ''; $info["case_fee"][$k]['current_agent_name'] = '';
if ($v['bargain_id'] > 0) { if ($v['bargain_id'] > 0) {
$current_agent_name = $this->getBargainAgent($v['bargain_id']); $current_agent_name = $this->getBargainAgent($v['bargain_id']);
...@@ -323,9 +335,9 @@ class DailyPaperService ...@@ -323,9 +335,9 @@ class DailyPaperService
); );
$m_report = new OReportModel(); $m_report = new OReportModel();
foreach ($info["earnest_money"] as $k=>$v) { foreach ($info["earnest_money"] as $k => $v) {
if ($v['report_id'] > 0) { if ($v['report_id'] > 0) {
$current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id'=>$v['report_id']]); $current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id' => $v['report_id']]);
$info["earnest_money"][$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name']; $info["earnest_money"][$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name'];
} else { } else {
$info['earnest_money'][$k]['current_agent_name'] = ''; $info['earnest_money'][$k]['current_agent_name'] = '';
...@@ -337,9 +349,9 @@ class DailyPaperService ...@@ -337,9 +349,9 @@ class DailyPaperService
$info["custody_money"] = $this->getHouseAndAgentInfo( $info["custody_money"] = $this->getHouseAndAgentInfo(
$payLogModel->selectPayLogListByBargainReport($field_money, $params) $payLogModel->selectPayLogListByBargainReport($field_money, $params)
); );
foreach ($info["custody_money"] as $k=>$v) { foreach ($info["custody_money"] as $k => $v) {
if ($v['report_id'] > 0) { if ($v['report_id'] > 0) {
$current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id'=>$v['report_id']]); $current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id' => $v['report_id']]);
$info['custody_money'][$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name']; $info['custody_money'][$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name'];
} else { } else {
$info['custody_money'][$k]['current_agent_name'] = ''; $info['custody_money'][$k]['current_agent_name'] = '';
...@@ -389,6 +401,7 @@ class DailyPaperService ...@@ -389,6 +401,7 @@ class DailyPaperService
return $data; return $data;
} }
/** /**
* @param $data * @param $data
* @return mixed * @return mixed
...@@ -507,13 +520,14 @@ class DailyPaperService ...@@ -507,13 +520,14 @@ class DailyPaperService
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
private function getCheckList($daily_id,$agent_id = 0) private function getCheckList($daily_id, $agent_id = 0)
{ {
$field = "id,daily_id,operation_id,operation_name,remark,alipay,tenpay,realty_pay,family_pay,private_bank, $field = "id,daily_id,operation_id,operation_name,remark,alipay,tenpay,realty_pay,family_pay,private_bank,
cash,pos,other_bank,create_time,update_time,tenpay_2,alipay_2,bank_card,bank_card_yun,bank_card_lin,bank_card_new"; cash,pos,other_bank,create_time,update_time,tenpay_2,alipay_2,tenpay_3,alipay_3,bank_card,bank_card_yun,bank_card_lin
,bank_card_new,bank_card_chen";
$params["daily_id"] = $daily_id; $params["daily_id"] = $daily_id;
$params["is_del"] = 0; $params["is_del"] = 0;
if($agent_id > 0){ if ($agent_id > 0) {
$params["operation_id"] = $agent_id; $params["operation_id"] = $agent_id;
} }
...@@ -543,7 +557,7 @@ class DailyPaperService ...@@ -543,7 +557,7 @@ class DailyPaperService
*/ */
public function addDaily($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay, public function addDaily($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay, $private_bank, $cash, $pos, $other_bank, $tenpay_2, $alipay_2, $site_id, $bank_card, $family_pay, $private_bank, $cash, $pos, $other_bank, $tenpay_2, $alipay_2, $site_id, $bank_card,
$bank_card_yun ,$bank_card_lin,$bank_card_new) $bank_card_yun, $bank_card_lin, $bank_card_new)
{ {
$agent_info_arr["agent_id"] = $agent_id; $agent_info_arr["agent_id"] = $agent_id;
$agent_info_field = "id,name,store_id,district_id,level"; $agent_info_field = "id,name,store_id,district_id,level";
...@@ -557,13 +571,13 @@ class DailyPaperService ...@@ -557,13 +571,13 @@ class DailyPaperService
} }
} }
//todo 判断是否提交过, //todo 判断是否提交过,
$dailyInfo = $this->getDailyInfo($agent_id,$daily_date,1); $dailyInfo = $this->getDailyInfo($agent_id, $daily_date, 1);
if(count($dailyInfo) > 0 ){ if (count($dailyInfo) > 0) {
return ["code" => 101, "msg" => "请勿重复提交日报"]; return ["code" => 101, "msg" => "请勿重复提交日报"];
} }
$params = $this->dailyBin($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay, $params = $this->dailyBin($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay, $private_bank, $cash, $pos, $other_bank, $agent_info[0]["store_id"], $agent_info[0]["district_id"], $family_pay, $private_bank, $cash, $pos, $other_bank, $agent_info[0]["store_id"], $agent_info[0]["district_id"],
$tenpay_2, $alipay_2, $site_id, $bank_card,$bank_card_yun ,$bank_card_lin,$bank_card_new); $tenpay_2, $alipay_2, $site_id, $bank_card, $bank_card_yun, $bank_card_lin, $bank_card_new);
$is_ok = $this->oDailyModel->addDaily($params); $is_ok = $this->oDailyModel->addDaily($params);
if ($is_ok > 0) { if ($is_ok > 0) {
return ["code" => 200, "data" => null]; return ["code" => 200, "data" => null];
...@@ -574,7 +588,7 @@ class DailyPaperService ...@@ -574,7 +588,7 @@ class DailyPaperService
public function dailyBin($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay, $family_pay, $private_bank, public function dailyBin($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay, $family_pay, $private_bank,
$cash, $pos, $other_bank, $store_id, $district_id, $tenpay_2, $alipay_2, $site_id, $bank_card, $cash, $pos, $other_bank, $store_id, $district_id, $tenpay_2, $alipay_2, $site_id, $bank_card,
$bank_card_yun ,$bank_card_lin,$bank_card_new) $bank_card_yun, $bank_card_lin, $bank_card_new)
{ {
$arr["agent_id"] = $agent_id; $arr["agent_id"] = $agent_id;
$arr["agent_name"] = $agent_name; $arr["agent_name"] = $agent_name;
...@@ -628,37 +642,37 @@ class DailyPaperService ...@@ -628,37 +642,37 @@ class DailyPaperService
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function addDailyCheck($daily_id, $agent_id, $agent_name, $alipay, $tenpay, $realty_pay, $family_pay, $private_bank, public function addDailyCheck($daily_id, $agent_id, $agent_name, $alipay, $tenpay, $realty_pay, $family_pay, $private_bank,
$cash, $pos, $other_bank, $remark,$operation_status, $tenpay_2, $alipay_2, $bank_card, $cash, $pos, $other_bank, $remark, $operation_status, $tenpay_2, $alipay_2, $bank_card,
$bank_card_yun ,$bank_card_lin,$bank_card_new) $bank_card_yun, $bank_card_lin, $bank_card_new)
{ {
$agent_info_arr["agent_id"] = $agent_id; $agent_info_arr["agent_id"] = $agent_id;
$agent_info_field = "id,name,store_id,district_id,level"; $agent_info_field = "id,name,store_id,district_id,level";
$agent_info = $this->aAgentsModel->getAgentById($agent_info_field, $agent_info_arr); $agent_info = $this->aAgentsModel->getAgentById($agent_info_field, $agent_info_arr);
if (count($agent_info) <= 0 ) { if (count($agent_info) <= 0) {
return ["code" => 101, "msg" => "经纪人信息错误"]; return ["code" => 101, "msg" => "经纪人信息错误"];
} }
//todo 判断是否提交过, //todo 判断是否提交过,
$dailyInfo = $this->getCheckList($daily_id,$agent_id); $dailyInfo = $this->getCheckList($daily_id, $agent_id);
if(count($dailyInfo) > 0 ){ if (count($dailyInfo) > 0) {
return ["code" => 101, "msg" => "您已经审核过了"]; return ["code" => 101, "msg" => "您已经审核过了"];
} }
$params = $this->dailyLogBin($daily_id, $agent_id, $agent_name, $alipay, $tenpay, $realty_pay, $params = $this->dailyLogBin($daily_id, $agent_id, $agent_name, $alipay, $tenpay, $realty_pay,
$family_pay, $private_bank, $cash, $pos, $other_bank, $remark,$operation_status, $tenpay_2, $alipay_2, $bank_card, $family_pay, $private_bank, $cash, $pos, $other_bank, $remark, $operation_status, $tenpay_2, $alipay_2, $bank_card,
$bank_card_yun ,$bank_card_lin,$bank_card_new); $bank_card_yun, $bank_card_lin, $bank_card_new);
$is_ok = $this->oDailyLogModel->addDailyCheck($params); $is_ok = $this->oDailyLogModel->addDailyCheck($params);
if($is_ok > 0){ if ($is_ok > 0) {
if($operation_status == 1){//修改主表审核状态 if ($operation_status == 1) {//修改主表审核状态
$update_where["id"] = $daily_id; $update_where["id"] = $daily_id;
$update_params["status"] = 1; $update_params["status"] = 1;
$update_params["update_time"] = date("Y-m-d H:i:s",time()); $update_params["update_time"] = date("Y-m-d H:i:s", time());
$this->oDailyModel->updateDaily($update_where,$update_params); $this->oDailyModel->updateDaily($update_where, $update_params);
} }
return ["code" => 200, "data"=>null]; return ["code" => 200, "data" => null];
}else{ } else {
return ["code" => 101, "msg" => "审核异常"]; return ["code" => 101, "msg" => "审核异常"];
} }
...@@ -688,9 +702,9 @@ class DailyPaperService ...@@ -688,9 +702,9 @@ class DailyPaperService
* @param $bank_card_new * @param $bank_card_new
* @return mixed * @return mixed
*/ */
public function dailyLogBin($daily_id, $agent_id, $agent_name, $alipay, $tenpay, $realty_pay,$family_pay, $private_bank, public function dailyLogBin($daily_id, $agent_id, $agent_name, $alipay, $tenpay, $realty_pay, $family_pay, $private_bank,
$cash, $pos, $other_bank, $remark,$operation_status, $tenpay_2, $alipay_2, $bank_card, $cash, $pos, $other_bank, $remark, $operation_status, $tenpay_2, $alipay_2, $bank_card,
$bank_card_yun ,$bank_card_lin,$bank_card_new) $bank_card_yun, $bank_card_lin, $bank_card_new)
{ {
$arr["daily_id"] = $daily_id; $arr["daily_id"] = $daily_id;
$arr["operation_id"] = $agent_id; $arr["operation_id"] = $agent_id;
...@@ -727,13 +741,13 @@ class DailyPaperService ...@@ -727,13 +741,13 @@ class DailyPaperService
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
private function getDailyInfo($store_id, $daily_data,$type = 0) private function getDailyInfo($store_id, $daily_data, $type = 0)
{ {
$field_info_field = "id,agent_id,agent_name,daily_date,alipay,tenpay,realty_pay,family_pay,private_bank, $field_info_field = "id,agent_id,agent_name,daily_date,alipay,tenpay,realty_pay,family_pay,private_bank,
cash,pos,other_bank,status,create_time,update_time,alipay_2,tenpay_2,site_id,bank_card,bank_card_yun,bank_card_lin,bank_card_new"; cash,pos,other_bank,status,create_time,update_time,alipay_2,tenpay_2,site_id,bank_card,bank_card_yun,bank_card_lin,bank_card_new";
if($type == 1){ if ($type == 1) {
$daily_info_params["agent_id"] = $store_id; $daily_info_params["agent_id"] = $store_id;
}else{ } else {
$daily_info_params["store_id"] = $store_id; $daily_info_params["store_id"] = $store_id;
} }
...@@ -761,7 +775,8 @@ class DailyPaperService ...@@ -761,7 +775,8 @@ class DailyPaperService
* @param $daily_id * @param $daily_id
* @return int * @return int
*/ */
public function isCheck($daily_id) { public function isCheck($daily_id)
{
$where['daily_id'] = $daily_id; $where['daily_id'] = $daily_id;
$where['is_del'] = 0; $where['is_del'] = 0;
$num = $this->oDailyLogModel->getTotal($where); $num = $this->oDailyLogModel->getTotal($where);
...@@ -778,13 +793,14 @@ class DailyPaperService ...@@ -778,13 +793,14 @@ class DailyPaperService
* @param $district_id * @param $district_id
* @return array * @return array
*/ */
public function checkAgent($agent_id) { public function checkAgent($agent_id)
{
$check_rule = new VipService(); $check_rule = new VipService();
$is_ = $check_rule->checkRule($agent_id, 'index/dailyDetail'); $is_ = $check_rule->checkRule($agent_id, 'index/dailyDetail');
if ($is_) { if ($is_) {
$result = ["code"=>101, "msg"=>"没有查看财务日报权限"]; $result = ["code" => 101, "msg" => "没有查看财务日报权限"];
} else { } else {
$result = ["code"=>200]; $result = ["code" => 200];
} }
return $result; return $result;
} }
...@@ -800,17 +816,17 @@ class DailyPaperService ...@@ -800,17 +816,17 @@ class DailyPaperService
*/ */
public function getBargainAgent($bargain_id) public function getBargainAgent($bargain_id)
{ {
$bargain_where[] = ['EXP','a.id ='.$bargain_id.' or father_id='. $bargain_id]; $bargain_where[] = ['EXP', 'a.id =' . $bargain_id . ' or father_id=' . $bargain_id];
$bargain_where['a.status'] = ['in','10,11,13']; $bargain_where['a.status'] = ['in', '10,11,13'];
$bargain_where['a.role'] = ['in','3,4,5']; $bargain_where['a.role'] = ['in', '3,4,5'];
$m_bargain = new OBargainModel(); $m_bargain = new OBargainModel();
$bargain_data = $m_bargain->agentBargainAll('a.role,a.scale,b.name', $bargain_where); $bargain_data = $m_bargain->agentBargainAll('a.role,a.scale,b.name', $bargain_where);
$role_arr = [1=>'盘方', 2=>'客方',3=>'反签',4=>'独家',5=>'合作方',6=>'APP盘下载方',7=>'APP客下载方']; $role_arr = [1 => '盘方', 2 => '客方', 3 => '反签', 4 => '独家', 5 => '合作方', 6 => 'APP盘下载方', 7 => 'APP客下载方'];
$name = ''; $name = '';
foreach ($bargain_data as $k2=>$v2) { foreach ($bargain_data as $k2 => $v2) {
$name .= $v2['name'] . '('.$role_arr[$v2['role']].$v2['scale'].'%),'; $name .= $v2['name'] . '(' . $role_arr[$v2['role']] . $v2['scale'] . '%),';
} }
return rtrim($name, ','); return rtrim($name, ',');
......
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