diff --git a/Application/Admin/Controller/AggregateFinanceSetController.class.php b/Application/Admin/Controller/AggregateFinanceSetController.class.php index ce92f5dd1..2b6bb592f 100644 --- a/Application/Admin/Controller/AggregateFinanceSetController.class.php +++ b/Application/Admin/Controller/AggregateFinanceSetController.class.php @@ -109,7 +109,6 @@ class AggregateFinanceSetController extends Controller { $dataurl .= $this->apihost."&".http_build_query($arr); $html = file_get_contents($dataurl); $rsp = json_decode($html,true); - var_dump($dataurl); if($rsp['code'] != 1){ echo $rsp['error'].PHP_EOL;die; } @@ -147,6 +146,7 @@ class AggregateFinanceSetController extends Controller { echo "----补点统计ok".PHP_EOL; } } + diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php index 144089765..60583a02b 100644 --- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php +++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php @@ -13,9 +13,15 @@ class AggregateFinanceStatementController extends ThinkController "1"=>"申请开票", "2"=>"审核同意", "3"=>"已开票", - "4"=>"上传收款凭证", + "4"=>"已上传凭证", "5"=>"已到账" ]; + public $admininfo; + public function _initialize() + { + $this->admininfo = $_SESSION['onethink_admin']['user_auth']; + parent::_initialize(); + } public function lists() { $is_export= false; if (isset($_REQUEST['export']) && $_REQUEST['export']==1){ @@ -311,6 +317,8 @@ class AggregateFinanceStatementController extends ThinkController if($info["verify_status"] == 3){ $save['verify_status'] = 4; $save['create_time'] = time(); + $save["admin_name"]=$this->admininfo["username"]; + $save["admin_id"]=$this->admininfo["uid"]; } M("aggregate_statement","tab_")->where("id = '{$id}'")->save($save); $array=array( @@ -346,7 +354,50 @@ class AggregateFinanceStatementController extends ThinkController 'info' => "操作成功" )); } - + //审批通过 + public function agreeApply(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $savedata = ["verify_status"=>2,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]]; + M("aggregate_statement","tab_")->where("id in ({$ids})")->save($savedata); + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"审批通过成功" + )); + } + //审核拒绝 + public function refuseApply(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $savedata = ["verify_status"=>-1,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]]; + M("aggregate_statement","tab_")->where("id in ({$ids})")->save($savedata); + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"审批拒绝成功" + )); + } + //已开票 + public function Invoiced(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $savedata = ["verify_status"=>3,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]]; + M("aggregate_statement","tab_")->where("id in ({$ids})")->save($savedata); + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"已开票成功" + )); + } + //已到账 + public function Received(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $savedata = ["verify_status"=>5,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]]; + M("aggregate_statement","tab_")->where("id in ({$ids})")->save($savedata); + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"已到账成功" + )); + } //导出 public function export() { diff --git a/Application/Admin/View/AggregateFinanceStatement/lists.html b/Application/Admin/View/AggregateFinanceStatement/lists.html index bf2813157..e3f985e12 100644 --- a/Application/Admin/View/AggregateFinanceStatement/lists.html +++ b/Application/Admin/View/AggregateFinanceStatement/lists.html @@ -115,9 +115,9 @@
审批通过 审批拒绝 + 已开票 + 已到账 - 已开票 - 已到账 重算对账金额 批量导出 @@ -264,6 +264,7 @@ $("body").append(iframeExcel) } }) + //审批通过 $("#agreeApply").on("click",function(){ var flag = false; var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { @@ -278,7 +279,7 @@ return; } if(flag){ - layer.confirm("审批成功仅会对 已申请发票结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){ + layer.confirm("审批成功仅会对 [已申请发票] 结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){ _doAgreeApply(); layer.close(index); }); @@ -287,7 +288,144 @@ } function _doAgreeApply(){ //执行 - + $.ajax({ + type: "POST", + url: "{:U('agreeApply')}", + dataType: 'json', + async: false, + data: {ids:text}, + success:function(data){ + if(data.status==1){ + layer.msg("" + data.info + ""); + setTimeout(function(){ + window.location.reload(); + },1500); + } + } + }); + } + }) + //审批拒绝 + $("#refuseApply").on("click",function(){ + var flag = false; + var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { + if($(elem).data("status") != 1){ + flag = true; + }else{ + return $(elem).val(); + } + }).get().join(","); + if(text == ''){ + layer.msg("" + '无需要审核拒绝的结算单' + ""); + return; + } + if(flag){ + layer.confirm("审批拒绝仅会对 [已申请发票] 结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){ + _doRefuseApply(); + layer.close(index); + }); + }else{ + _doRefuseApply(); + } + function _doRefuseApply(){ + //执行 + $.ajax({ + type: "POST", + url: "{:U('refuseApply')}", + dataType: 'json', + async: false, + data: {ids:text}, + success:function(data){ + if(data.status==1){ + layer.msg("" + data.info + ""); + setTimeout(function(){ + window.location.reload(); + },1500); + } + } + }); + } + }) + //已开票 + $("#Invoiced").on("click",function(){ + var flag = false; + var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { + if($(elem).data("status") != 2){ + flag = true; + }else{ + return $(elem).val(); + } + }).get().join(","); + if(text == ''){ + layer.msg("" + '无需要进行已开票的结算单' + ""); + return; + } + if(flag){ + layer.confirm("已开票仅会对 [审核同意] 结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){ + _doInvoiced(); + layer.close(index); + }); + }else{ + _doInvoiced(); + } + function _doInvoiced(){ + //执行 + $.ajax({ + type: "POST", + url: "{:U('Invoiced')}", + dataType: 'json', + async: false, + data: {ids:text}, + success:function(data){ + if(data.status==1){ + layer.msg("" + data.info + ""); + setTimeout(function(){ + window.location.reload(); + },1500); + } + } + }); + } + }) + //已到账 + $("#Received").on("click",function(){ + var flag = false; + var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { + if($(elem).data("status") == 3 || $(elem).data("status") == 4){ + return $(elem).val(); + }else{ + flag = true; + } + }).get().join(","); + if(text == ''){ + layer.msg("" + '无需要进行已到账的结算单' + ""); + return; + } + if(flag){ + layer.confirm("已到账仅会对 [已开票]或[已上传凭证] 结算单处理,选择中包含其他的状态的结算单将被忽略,点击取消停止操作",{title:false}, function(index){ + _doReceived(); + layer.close(index); + }); + }else{ + _doReceived(); + } + function _doReceived(){ + //执行 + $.ajax({ + type: "POST", + url: "{:U('Received')}", + dataType: 'json', + async: false, + data: {ids:text}, + success:function(data){ + if(data.status==1){ + layer.msg("" + data.info + ""); + setTimeout(function(){ + window.location.reload(); + },1500); + } + } + }); } }) @@ -509,6 +647,8 @@ }); }); + + $(".statement_del").click(function () { var del = $(this).data(); layer.confirm('【警告】撤销后将不可回退,如需继续请点击确认', {