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