⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newpoedit.aspx

📁 尚洋仓库管理系统,对仓库
💻 ASPX
📖 第 1 页 / 共 4 页
字号:
                if((obj=currentTR.previousSibling)!=null)
                {
                    currentTR=obj;
                }
                else
                {
                    currentTR=null;
                }
            }
            
            tb1.deleteRow(obj2.rowIndex);
            if(currentTR!=null)
            {
                chooseTr(currentTR);
            }
        }
    }
    //填充供应商名称
    setSupplier();
    function setSupplier()
    {
        document.all("sltSupplier").innerHTML="";
        var op=document.createElement("OPTION");
        op.value="";
        document.all("sltSupplier").appendChild(op);
        //改XML
        var supplier="<%=SupplierString %>";
        var supplierAry=supplier.split("|");
        for(var ii=0;ii<supplierAry.length;ii++)
        {
            var ary=supplierAry[ii].split("*");
            var op=document.createElement("OPTION");
            op.value=ary[0];
            op.innerText=ary[1];
            document.all("sltSupplier").appendChild(op);
            
        }
    }
    setRNo();
    
    function setRNo()
    {
        var rno="<%=sltRno%>";
        if(rno.length==0)
            return;
       document.all("sltRno").innerHTML="";
        var op=document.createElement("OPTION");
        op.value="";
        document.all("sltRno").appendChild(op);
        //改XML
        var supplier="<%=sltRno %>";
        var supplierAry=supplier.split("|");
        for(var ii=0;ii<supplierAry.length;ii++)
        {
            var ary=supplierAry[ii].split("*");
            var op=document.createElement("OPTION");
            op.value=ary[0];
            op.innerText=ary[1];
            document.all("sltRno").appendChild(op);
            
        } 
    }
    //提交服务器
    function PostToServer(op)
    {
        //
        if(document.all("sltSupplier").value=="")
        {
            alert("请先选择供应商!");
            return;
        }
        if(document.all("txtExceptDate").value=="")
        {
            alert("请输入采购单到货日期!");
            return;
        }
        if(CompareDate(document.all("txtPurchaseDate").value,document.all("txtExceptDate").value))
        {
            alert("到货日期不能比订购日期早!\n请从新输入到货日期。");
            return;
        }
        if((vbTrim(document.all("txtPONo").value)).length==0)
        {
            alert("请输入定单编号!");
            return;
        }
        if(document.all("tb1").rows.length<2)
        {
            alert("该采购单还没任何需要采购的物料,\n请先添加采购单的物料明细!");
            return;
        }
        if(document.all("sltRno").value=="")
        {
            alert("请先选择需求计划单!");
            return;
        }
        
        var b=false;
        var details;
        var supplierId=document.all("sltSupplier").value;
        var podate=document.all("txtPurchaseDate").value;
        var expectdate=document.all("txtExceptDate").value;
        var pono=document.all("txtPONo").value;
        
        var table=document.all("tb1");
        //验证
        //
        details="op=<%=opflag%>&id="+document.all("pupkid").value+"&RNo="+document.all("sltRno").value+"&supplierId="+supplierId+"&podate="+podate+"&expectdate="+expectdate+"&pono="+pono+"&details=";
        var d="";
        for(var row=1;row<table.rows.length;row++)
        {
            d+=table.rows[row].cells[0].outerText+"*";//物料Id
            d+=table.rows[row].cells[7].outerText+"*";//数量
            d+=table.rows[row].cells[8].outerText+"*";//单价
            d+=table.rows[row].cells[6].outerText+"*";//单位
            d+=table.rows[row].cells[9].outerText+"*";//金额
            d+=table.rows[row].cells[10].outerText+"|";//交期
            
            b=true;
        }
        details+=d;
       
        var xmlHttp=new ActiveXObject("microsoft.XMLHTTP");
        xmlHttp.open("POST","handle/POHandle.aspx",false);
        xmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;");
        xmlHttp.send(details);
        
        var retValue=xmlHttp.responsetext;
        if(getState(retValue)=="1")//成功
        {
            if("<%=opflag%>"=="add")            
                alert("添加采购单成功!");
                
            else
                alert("修改采购单成功!");
            dialogArguments.document.all("btnSave").click();
            window.showModalDialog("NewPOReport.aspx?poid="+getMsg(retValue)+"&pop=1","","dialogWidth:650px;dialogHeight:500px");
        }        
        else
        {
            alert(getMsg(retValue));
        }
        
        
    }
    function getState(s)
    {
        var ary=s.split("|");
        return ary[0];
    }
    function getMsg(s)
    {
        var ary=s.split("|");
        return ary[1];
    }
    
    //修改
    setTimeout("FromModify()",100);
    function FromModify()
    {
        var supplierId="<%=supplierId%>";
        var poDate="<%=poDate %>";
        var expectDate="<%=expectDate %>"
        var poNo="<%=poNo %>";
        var rid="<%=rid %>";
        if(supplierId!="0")//为修改
        {
            document.all("txtPONo").readOnly=true;
            opFlag="modify";
            document.all("pupkid").value="<%=poid%>";
            document.all("txtPurchaseDate").value=poDate;
            document.all("txtExceptDate").value=expectDate;
            document.all("txtPONo").value=poNo;
            selectSltValueByValue(document.all("sltSupplier"),supplierId);
            selectSltValueByValue(document.all("sltRno"),rid);
        }
        
    }
    function selectSltValueByText(objSlt,text)
    {
        objSlt.selectedIndex=0;
        for(var i=0;i<objSlt.options.length;i++)
        {
            //alert(document.all("sltNewCategory").options.length);
            if(objSlt.options[i].outerText==text)
            {
                objSlt.selectedIndex=i;               
                return;
            }
        }
    }
    function selectSltValueByValue(objSlt,value)
    {
        objSlt.selectedIndex=0;
        for(var i=0;i<objSlt.options.length;i++)
        {
           if(vbTrim(objSlt.options[i].value)==value)
           {
           
            objSlt.selectedIndex=i;
            
            return;
           }
        }
    }
    function getRNoDetails()
    {
        var RId=document.all("sltRno").value;
        if(RId.length!=0)
        {
            var details="id="+RId+"&op=query";
            var xmlHttp=new ActiveXObject("microsoft.XMLHTTP");
            xmlHttp.open("POST","handle/RequirementHand.aspx",false);
            xmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;");
            xmlHttp.send(details);
            var xmlDom2=new ActiveXObject("msxml.DOMDocument");
            var retValue=xmlHttp.responsetext;
            if(getState(retValue)=="0")
            {
                alert(getMsg(retValue));
                return;
            }
            xmlDom2.loadXML(getMsg(retValue));
            var table=document.all("tb1")
            var len=table.rows.length;
            for(var i=len-1;i>0;i--)
            {
                
                table.deleteRow(i);
            }
            
            for(var i=0;i<xmlDom2.documentElement.childNodes.length;i++)
            {
                //alert(xml.documentElement.xml);
                var node=xmlDom2.documentElement.childNodes[i];
                
                var row=table.insertRow();
                addTrStyle(row);
                addMoveEvent(row);
                addOutEvent(row);
                addClickEvent(row);
                //addDblClickEvent(row);
                
                var cell;
                for(var iii=0;iii<node.attributes.length;iii++)
                {
                
                    cell=row.insertCell();
                    cell.innerText=node.attributes[iii].text+" ";
                    cell.className="td1";
                    
                }                        
                cell=row.insertCell();
                cell.innerText="0";
                cell.className="td1";
                cell=row.insertCell();
                cell.innerText="0";
                cell.className="td1";
                cell=row.insertCell();
                cell.innerText="0";
                cell.className="td1";
                
                
            }
        }
    }
    function addTrStyle(row)
    {
    
        row.style.height="22";
        row.style.whiteSpace="nowrap";
        row.style.backgroundColor="#ffffff";
        
    }
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -