diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php index 9c8c954ae..8051c0c2a 100644 --- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php +++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php @@ -261,6 +261,81 @@ class AggregateFinanceStatementController extends ThinkController $this->assign("data",$senddata); $this->display(); } + //上传凭证 + public function uploadVoucher() + { + if(!isset($_REQUEST['id'])) $this->error("参数错误"); + $id = $_REQUEST['id']; + $this->assign("id",$id); + $this->display(); + } + //修改凭证 + public function editVoucher() + { + if(!isset($_REQUEST['id'])) $this->error("参数错误"); + $id = $_REQUEST['id']; + $info = M("aggregate_statement","tab_")->field("id,verify_status,ext_field")->where("id = '{$id}'")->find(); + $this->assign("id",$id); + $this->assign("ext_field",$info['ext_field']); + $this->display(); + } + //保存凭证 + public function saveVoucher() + { + if(!isset($_REQUEST['id'])) $this->error("参数错误"); + $id = $_REQUEST['id']; + + $path = '/Uploads/'; + $upload = new \Think\Upload();// 实例化上传类 + $upload->maxSize = 0 ;// 设置附件上传大小 + $upload->exts = array('jpg', 'gif', 'png', 'jpeg');;// 设置附件上传类型 + $upload->rootPath = '.'.$path; // 设置附件上传根目录 + $upload->savePath = ''; // 设置附件上传(子)目录 + // 上传文件 + $info = $upload->upload(); + if(!$info) {// 上传错误提示错误信息 + $msg = $upload->getError(); + $array= array('status' => 0, 'info' => $msg); + }else{// 上传成功 + // + $pf = $path.$info['file']['savepath'].$info['file']['savename']; + $save = [ + "ext_field"=>$pf, + ]; + //获取旧值,存在删除 + $info = M("aggregate_statement","tab_")->field("id,verify_status,ext_field")->where("id = '{$id}'")->find(); + if(!empty($info['ext_field'])){ + unlink("./".$info['ext_field']); + } + //如果是开票状态就改状态 + if($info["verify_status"] == 3){ + $save['verify_status'] = 4; + $save['create_time'] = time(); + } + M("aggregate_statement","tab_")->where("id = '{$id}'")->save($save); + $array=array( + 'status' => 1, + "info"=>"上传成功", + "file_path"=>$pf, + ); + } + $this->ajaxReturn($array); + } + //删除凭证 + public function delVoucher(){ + if(!isset($_REQUEST['id'])) $this->error("参数错误"); + $id = $_REQUEST['id']; + $info = M("aggregate_statement","tab_")->field("id,ext_field")->where("id = '{$id}'")->find(); + if(!empty($info['ext_field'])){ + unlink("./".$info['ext_field']); + } + M("aggregate_statement","tab_")->where("id = '{$id}'")->save(['ext_field'=>'']); + $this->ajaxReturn(array( + 'status' => 1, + 'info' => "删除成功" + )); + } + //导出 public function export() { diff --git a/Application/Admin/View/AggregateFinanceStatement/editVoucher.html b/Application/Admin/View/AggregateFinanceStatement/editVoucher.html new file mode 100644 index 000000000..b57b9a5f8 --- /dev/null +++ b/Application/Admin/View/AggregateFinanceStatement/editVoucher.html @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + +
+ + + + + + +
文件选择: + + 仅能添加一张凭证,重复添加将覆盖
+
+
+
确认修改
+
删除凭证
+
+
+
+ +
+
+ + + + + + diff --git a/Application/Admin/View/AggregateFinanceStatement/lists.html b/Application/Admin/View/AggregateFinanceStatement/lists.html index 72b77d20a..8b60e1004 100644 --- a/Application/Admin/View/AggregateFinanceStatement/lists.html +++ b/Application/Admin/View/AggregateFinanceStatement/lists.html @@ -178,7 +178,10 @@ {$data.admin_name} {$data.create_time} - 查看 + 查看 + 上传凭证 + 查看凭证 + 编辑凭证 @@ -377,6 +380,48 @@ content:'/admin.php?s=/AggregateFinanceStatement/editStatement/id/'+id }); }); + //上传凭证 + $(".uploadVoucher").click(function () { + var id = $(this).data("id"); + layer.open({ + type: 2, + title: "上传凭证", + shadeClose: true, + shade: 0.8, + area: ['60%', '60%'], + content:'/admin.php?s=/AggregateFinanceStatement/uploadVoucher/id/'+id, + end:function(){ + reload(); + } + }); + }); + //查看凭证 + $(".viewVoucher").click(function () { + var img = $(this).data("img"); + layer.open({ + type: 1, + title:false, + content:"" + }); + }); + //编辑凭证 + $(".editVoucher").click(function () { + var id = $(this).data("id"); + layer.open({ + type: 2, + title: "编辑凭证", + shadeClose: true, + shade: 0.8, + area: ['60%', '60%'], + content:'/admin.php?s=/AggregateFinanceStatement/editVoucher/id/'+id, + end:function(){ + reload(); + } + }); + }); + // + + // $("#downstream").click(function () { // layer.open({ diff --git a/Application/Admin/View/AggregateFinanceStatement/uploadVoucher.html b/Application/Admin/View/AggregateFinanceStatement/uploadVoucher.html new file mode 100644 index 000000000..45f383823 --- /dev/null +++ b/Application/Admin/View/AggregateFinanceStatement/uploadVoucher.html @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + +
+ + + + + + +
文件选择: + + 仅能添加一张凭证,重复添加将覆盖
+
+
+
确认添加
+
删除凭证
+
+
+
+ +
+
+ + + + + +