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

📄 purchaseorderreport.aspx

📁 尚洋仓库管理系统,对仓库
💻 ASPX
📖 第 1 页 / 共 3 页
字号:
   function CheckNumber(val)
        if IsNumeric(val)  then
            CheckNumber=true
        else
            CheckNumber=false
        end if
   end function
   
</script>


<script language="javascript">
    var currentTR=null;
    function addToPurchaseOrder(tb1)
    {
        var isExist;
        if(dataValidate())
        {
            
            var row=tb1.insertRow(tb1.rows.length);
            
            row.style.height="22";
            row.style.whiteSpace="nowrap";
            row.style.backgroundColor="#ffffff";

            addMoveEvent(row);
            addOutEvent(row);
            addClickEvent(row);
            
            var cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtId").value;

            cell=row.insertCell();
            cell.className="td1";                
            cell.innerText=document.all("txtStuffNo").value;
            
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtStuffName").value+" ";
            
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtStuffSpec").value+" ";
              
              
            cell=row.insertCell();
            cell.className="td1";                
            cell.innerText=document.all("txtQuantity").value;
            
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtPrice").value+" ";
            
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtUnit").value+" ";
              
              
            cell=row.insertCell();
            cell.className="td1";
            cell.innerText=document.all("txtPrice").value*document.all("txtQuantity").value;
                
        }
    }
     function addMoveEvent(obj)
    {
        obj.attachEvent("onmouseover",function(){RowMouseOver(obj);});
    }
    function addOutEvent(obj)
    {
        obj.attachEvent("onmouseout",function(){RowMouseOut(obj);});
    }
    function addClickEvent(obj)
    {
        obj.attachEvent("onclick",function(){modifyRecord(obj);});
    }
    
    function modifyRecord(obj)
    {
        if(obj==null||obj=="undefined")
        {
            alert("请先选择要修改的物料");
            return;
        }
        userOperate="modify";
        chooseTr(obj);
        document.all("txtId").value=vbTrim(obj.cells[0].outerText);
        document.all("txtStuffNo").value=vbTrim(obj.cells[1].outerText);
        document.all("txtStuffName").value=vbTrim(obj.cells[2].outerText);
        document.all("txtStuffSpec").value=vbTrim(obj.cells[3].outerText);
        document.all("txtQuantity").value=vbTrim(obj.cells[4].outerText);
        document.all("txtPrice").value=vbTrim(obj.cells[5].outerText);
        document.all("txtUnit").value=vbTrim(obj.cells[6].outerText);
    }
    
    //是否数字,是否为空,是否为日期,下拉框是否被选中
    //数据验证
    
    function dataValidate()
    {
        if(document.all("txtId").value.length==0)
        {
            alert("请先选择一种物料,然后添加到采购订单!\n\n请单击[搜索]");
            return false;
        }
        if(document.all("txtQuantity").value.length==0||document.all("txtQuantity").value<"1")
        {
            alert("请输入该物料的采购数量!");
            return false;
        }
        if(!CheckNumber(document.all("txtQuantity").value))
        {
            alert("采购数量请输入数值类型!");
            return false;
        }
        if(!CheckNumber(document.all("txtPrice").value))
        {
            alert("物料单价请输入数值类型!");
            return false;
        }
        
        //重复记录验证
        for(var iTr=1;iTr<document.all("tb1").rows.length;iTr++)
        {
            if(vbTrim(document.all("tb1").rows[iTr].cells[0].outerText)==document.all("txtId").value)
            {
                //alert("物料[ "+document.all("tb1").rows[iTr].cells[2].outerText+" ]已添加到明细中!");
                document.all("tb1").rows[iTr].cells[4].innerText=document.all("txtQuantity").value;
                document.all("tb1").rows[iTr].cells[7].innerText=document.all("txtQuantity").value*document.all("txtPrice").value;
                alert("采购数量已更新!");
                return false;
            }
        }
        return true;
    }
    
    //删除明细项目
    function deleteDetails()
    {
        if(currentTR==null||currentTR=="undefined")
        {
            alert("请先选择要删除的物料");
        }
        else
        {
             var obj;
            var obj2=currentTR;
            if((obj=currentTR.nextSibling)!=null)
            {
                currentTR=obj;
            }
            else
            {
                if((obj=currentTR.previousSibling)!=null)
                {
                    currentTR=obj;
                }
                else
                {
                    currentTR=null;
                }
            }
            
            tb1.deleteRow(obj2.rowIndex);
            if(currentTR!=null)
            {
                chooseTr(currentTR);
            }
        }
    }
    //填充供应商名称
    
    //提交服务器
    function PostToServer(op)
    {
        //
        
        if(document.all("sltSupplier").value=="")
        {
            alert("请先选择供应商!");
            return;
        }
        if(document.all("txtExceptDate").value=="")
        {
            alert("请输入采购单到货日期!");
            return;
        }
        if(!CompareDate(document.all("txtExceptDate").value,document.all("txtPurchaseDate").value))
        {
            alert("到货日期不能比订购日期早!\n请从新输入到货日期。");
            return;
        }
        if((vbTrim(document.all("txtPONo").value)).length==0)
        {
            alert("请输入定单编号!");
            return;
        }
        if(document.all("tb1").rows.length<2)
        {
            alert("该采购单还没任何需要采购的物料,\n请先添加采购单的物料明细!");
            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=&id="+document.all("pupkid").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[4].outerText+"*";//数量
            d+=table.rows[row].cells[5].outerText+"*";//单价
            d+=table.rows[row].cells[6].outerText+"*";//单位
            d+=table.rows[row].cells[7].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("add"=="add")
                alert("添加采购单成功!");
            else
                alert("修改采购单成功!");
        }        
        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 %>";
        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);
        }
        
    }
    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;
           }
        }
    }
</script>

⌨️ 快捷键说明

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