fs-danaus
2022-03-26 59226b7f7f2986501b3dc3efcf9c646bb0e64ff3
提交 | 用户 | age
a6a76f 1 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
F 2 @_add_js_css_@
3 <script type="text/javascript">
4   var spellPath = "/<%=session.getAttribute(SessionKey.DATA_BASE_ID)%>/<%=session.getAttribute(SessionKey.VERSION_ID)%>/<%=session.getAttribute(SessionKey.SYSTEM_LANGUAGE)%>/";
5   var Custom_Doccode="@CustomDoccode@";
6   var formId=<%=formId%>;
7   panelFormId=formId;
8   var formType=<%=formType%>;
9   var user="<%=userCode%>";
10   var isSuperUser="<%=isSuperUser %>";
11   var cccode='<%=session.getAttribute(SessionKey.CCCODE)%>';
12   //确认前状态
13   var predocstatus="[?predocstatus]";
14   var check=0;//来判断是否保存与确定
15   var grid;//全局
16   var plane;
17   var planesj;
18   var btnId=null;//决定按钮检查
19   //通过,驳回,时代按钮所需全局变量
20   var panelHasSave=false;//面板是否保存
21   //判断当前页面是不是新单
22   var isNew='<%=isNew%>';
23
24   function commitIs(check,flag){
25     //flag标记数据范围检查已通过
e91881 26       showLoading();
F 27       grid = mygrid;
28       var doc = getDoc('doccode', ".value");
29       var pm = panMain[panIndex];
30       grid.setPanelAction(((isNew == 1 && doc == "") ? "add" : "update"), pm.tableIs, doc);
31       plane = pm.getPanMap();
32       plane._YCAUDIT_ = shenji(panIndex, plane, doc);    //审计处理
33       grid.postData(plane, check);
34       //    操作时间:2014-3-26 15:52:04 ——辛煜波
35       if (check == 3) {
36           grid.tran(btnId == null ? "" : btnId, function (showIs, check) {
37               parent.errShow.frame = parent.frames[inThisFrame];
38               parent.errShow.show_divErro(showIs, check);
39               btnId = null;
40           }, 3, flag);
41           tranOk = false;
42           grid.aflg = 0;
43       } else {
44           grid.save(btnId == null ? "" : btnId, function (showIs, check) {
45               parent.errShow.frame = parent.frames[inThisFrame];
46               parent.errShow.show_divErro(showIs, check);
a6a76f 47                  btnId=null;
59226b 48           }, check, flag);
F 49       }
a6a76f 50   }
59226b 51
F 52   function save(o, c) {
53       //2012-10-12  lqc
54       var flag = checkSession();//session失效后弹出登录框,flag为true时表示已经失效
55       if (flag) {
56           return;
57       }
58       if (!c || c == 0) {
59           if (o == 5) {//表示单据类型直接点保存,是为区分有在线支付功能时,确认也是执行保存操作
60               if ("undefined" != typeof onlinePay && onlinePay != null) {
61                   onlinePay.pay = 0;
62                   onlinePay.refund = 0;
63                   onlinePay.isOnlinePay = false;
64               }
65               o = 2;//转换为2
66           }
67           save$(o);
68       } else {
69           centerPopup(formId, 2, function () {
70               save$(o);
71           }, '');
72       }
a6a76f 73   }
59226b 74
F 75   function save$(op) {
76       showLoading();
77       if (panMain[panIndex].checkUp()) {
78           check = op;
79           commitPan(check);
80       } else {
a6a76f 81         closeLoading();
F 82     }
83   }
84   function commitPan(check){//确定是凭证状态检查 
85      if(check==3){
86          var url = '/panState.do?formid='+formId+'&docdate='+getDoc("docdate",".value")+'&periodtype=#periodtype#&companyId='+getDoc("#comanyId#",".value");
87          url=encodeURI(url);url=encodeURI(url);//必须两次
88          $.post(url,'',showPanMessge,'text');
89      }else{
90          commitIs(check);
91      }
92   }
93   var notOk='';//判断是否检查凭证定义的正确性,''为正确
94   function showPanMessge(date){
95     date=date.substring(0,date.length-1);
96     var mass=date.split("#");
97     var in_fo=null;notOk='';
98     for(i=0;i<mass.length;i++){
99         if(mass[i]!=""&&mass[i]!=null){
100             in_fo=mass[i].split(";pb;");
101             if(in_fo.length>1&&in_fo[1]=="0"){
102                 alert(in_fo[0]);
103 //                 if(confirm(in_fo[0])){
104                     notOk='not';
105 //                 }else{
106 //                       notOk='not';
107 //             }
108             }else{                                
109                 if(confirm(in_fo[0])){
110                     notOk=='';                        
111                 }else{        
112                     notOk='not';                    
113                 break;
114                 }
115             }    
116         }
117     }
118
119     if(notOk==''){
120         commitIs(check);
121     }else{
122         closeLoading();
123     }
124   }
125   function clearDoc(){//复单
126     location.href ="?isNew=1&cp=1&doccode="+getDoc('doccode','.value');
127     panMain[panIndex].noCopy();//取消不复制字段
128   }
129   function delDoc(){ //删单
130     if(confirm("是否真的删除此单据?")) {
131         showLoading();
132         $.post("/panDelete.do?docstatus="+getDoc('docstatus','.value'),{"formid":formId,"doccode":getDoc('doccode','.value')},getMess,'text');   
133     }
134   }
135   function disDoc(){  //作废单
136     if(confirm("是否真的作废此单据?")) {
137         showLoading();
138         $.post("/panDiscard.do?docstatus="+getDoc('docstatus','.value'),{"formid":formId,"doccode":getDoc('doccode','.value')},getMess,'text');   
139     }
140   }
141   function getMess(data){
142     closeLoading();
143     var json=JSON.parse(data);
144     if(json.state==0){
145         alert('已经处理!');
146         if(opener!=null && typeof opener !="undefined" && opener.window!=null){ 
147             opener.window.location.reload();//刷新父窗口
148         }
149         closeme();//关闭当前窗口
150     }else{
151         alert(json.msg);//直接弹出错误
152     }
153   }
154   if(navigator.userAgent.match(/iPad|iPhone|Android/i)){
155         try{
156             var myScroll = new IScroll('#scrollbody', {
157                  mouseWheel: true,
158                  scrollbars: true,
159                  zoom: true,
160                  scrollX: true,
161                  scrollY: true,
162                  wheelAction: 'zoom'
163             });
164         }catch(e){}
165   }
166 </script>