Commit 9404246e authored by clone's avatar clone

1

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