📄 semiproductentry.aspx
字号:
end sub
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;
}
//重复记录验证
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("sltDept").value=="")
{
alert("请先选择半成品来源的部门!");
return;
}
if(vbTrim(document.all("txtNo").value).length==0)
{
alert("请输入入库单的编号!");
return;
}
if(document.all("txtPurchaseDate").value=="")
{
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("txtNo").value;
var table=document.all("tb1");
//验证
//details="op=<%=opflag%>&id="+document.all("pupkid").value+"&supplierId="+supplierId+"&podate="+podate+"&expectdate="+expectdate+"&pono="+pono+"&details=";
details="op=<%=opflag%>&id="+document.all("pupkid").value+"&podate="+podate+"&operatorId="+document.all("sltOperator").value+"&deptid="+document.all("sltDept").value+"&remark="+document.all("txtRemark").value+"&pono="+pono+"&details=";
var d="";
for(var row=1;row<table.rows.length;row++)
{
d+=table.rows[row].cells[0].outerText+"*";//半成品Id
d+="0*"
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/SemiproductEntryHandle.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("修改半成品入库单成功!");
}
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;
}
}
}
BindingDept(document.all("sltDept"));
function BindingDept(objSlt)
{
objSlt.innerHTML="";
var xmlDom2=new ActiveXObject("msxml.DOMDocument");
xmlDom2.async=false;
xmlDom2.load("../XML/Dept.xml");
var op=document.createElement("OPTION");
objSlt.appendChild(op);
for(var i=0;i<xmlDom2.documentElement.childNodes[0].childNodes.length;i++)
{
var op=document.createElement("OPTION");
op.value=xmlDom2.documentElement.childNodes[0].childNodes[i].attributes[1].text;
op.innerText=xmlDom2.documentElement.childNodes[0].childNodes[i].attributes[0].text;
objSlt.appendChild(op);
}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -