diff --git a/Application/Admin/Controller/StatementController.class.php b/Application/Admin/Controller/StatementController.class.php index d4a5a1f95..d369fd60b 100644 --- a/Application/Admin/Controller/StatementController.class.php +++ b/Application/Admin/Controller/StatementController.class.php @@ -110,6 +110,8 @@ class StatementController extends ThinkController $Statement = M("statement","tab_"); $repart =false; $errorstr = ''; + $errorstr1 = ''; + $errorstr2 = ''; //开始时间被重叠部分 $checkmap = array( "statement_begin_time"=>array("ELT",strtotime($_REQUEST['time_start'])), @@ -126,7 +128,7 @@ class StatementController extends ThinkController }else{ $end = $_REQUEST['time_end']; } - $errorstr .= ($begin."到".$end."期间的数据已经结算过
"); + $errorstr = ($begin."到".$end."期间的数据已经结算过
"); } //结束被重复的部分 $checkmap = array( @@ -134,18 +136,41 @@ class StatementController extends ThinkController "statement_end_time"=>array("EGT",strtotime($_REQUEST['time_end'])), "company_id"=>$CompanyId ); - if($repart){ - $checkmap["id"]=array("NEQ",$bres["id"]); - } + $bres = $Statement->field("statement_begin_time,statement_end_time")->where($checkmap)->find(); if($bres){ $repart=true; $begin = date("Y-m-d",$bres["statement_begin_time"]); //统计相交时间 $end = $_REQUEST['time_end']; - $errorstr .= ($begin."到".$end."期间的数据已经结算过
"); + $errorstr1 = ($begin."到".$end."期间的数据已经结算过
"); + } + //中间被包住 + $checkmap = array( + "statement_begin_time"=>array("EGT",strtotime($_REQUEST['time_start'])), + "statement_end_time"=>array("ELT",strtotime($_REQUEST['time_end'])), + "company_id"=>$CompanyId + ); + $bres = $Statement->field("statement_begin_time,statement_end_time")->where($checkmap)->find(); + if($bres){ + $repart=true; + $begin = date("Y-m-d",$bres["statement_begin_time"]); + //统计相交时间 + $end = date("Y-m-d",$bres["statement_end_time"]); + $errorstr2 = ($begin."到".$end."期间的数据已经结算过
"); } + if($repart){ + if($errorstr1 == $errorstr){ + $errorstr1 =''; + } + if($errorstr1 == $errorstr2){ + $errorstr1 =''; + } + if($errorstr == $errorstr2){ + $errorstr2 =''; + } + $errorstr .=($errorstr1.$errorstr2); $this->ajaxReturn(array("error"=>$errorstr,"code"=>2001)); } diff --git a/Application/Admin/View/Statement/createCpStatement.html b/Application/Admin/View/Statement/createCpStatement.html index 56e1016d4..c5164d2b3 100644 --- a/Application/Admin/View/Statement/createCpStatement.html +++ b/Application/Admin/View/Statement/createCpStatement.html @@ -566,6 +566,11 @@ } $("#first_partner_id").select2(); $("#second_partner_id").select2(); + //重置数据 + + DATAOBJ.first_part_company=false; + DATAOBJ.second_part_company=false; + TPLSHOW.pushStatementTypeOption(); }) }) $("#first_partner_id").on("change",function(){ @@ -624,7 +629,7 @@ //CP上游公司 company_id = $("#first_partner_id").find("option:selected").val(); }else{ - company_type = $("#second_partner_id").find("option:selected").val(); + company_id = $("#second_partner_id").find("option:selected").val(); } //发起查询 var selectData = { @@ -869,6 +874,10 @@ EVENT.changeStatementType(); $("#statement_type").change();//默认支付给乙方 // TPLSHOW.showPartPayInfo();//查看底下是否有值 + }else{ + var str = ""; + $("#statement_type").html(str); + EVENT.changeStatementType(); } }, //支付信息显示