📄 print_newporeport.aspx
字号:
}
}
//填充供应商名称
//提交服务器
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;
}
}
}
hideZeroRow(document.all("tb1"),6);
function hideZeroRow(table,field)
{
var displayCount=0;
for(var i=1;i<table.rows.length-1;i++)
{
if(vbTrim(table.rows[i].cells[field].outerText)=="0"||vbTrim(table.rows[i].cells[field].outerText)=="0.00"||vbTrim(table.rows[i].cells[field].outerText)=="0.000")
{
table.rows[i].style.display="none";
}
else
{
displayCount++;
table.rows[i].cells[0].innerText=displayCount;
}
}
to=Total(table,9);
document.all("tdTotal").innerText="合计:¥"+to+"元 (大写:"+getUpercase(to)+")";
stuffTable(document.all("tb1"),displayCount);
}
function Total(table,field)
{
var total=0;
for(var i=1;i<table.rows.length-1;i++)
{
if(vbTrim(table.rows[i].cells[field].outerText!=""))
total+=VBparseInt2(vbTrim(table.rows[i].cells[field].outerText));
}
return parseFloat(total).toFixed(2);
}
function stuffTable(tb,count)
{
for(var i=19;i>count;i--)
{
var rows=tb.rows.length-1;
var row=tb.insertRow(rows);
for(var ii=0;ii<11;ii++)
{
var cell=row.insertCell();
cell.className="td1";
cell.innerText=" ";
}
}
}
function getUpercase(total)
{
var chinese_ary=new Array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖");
var position_ary2=new Array("","拾","佰","仟","萬","拾","佰","仟","亿");
var s=total.toString();
if(s.indexOf(".")==-1)
{
s+=".00";
}
var ary=s.split(".");
ary[1]=ary[1].slice(0,2);if(ary[1].length==0){ary[1]="00";}else{if(ary[1].length==1){ary[1]=ary[1]+"0"}};
var dd="";
if(ary[1].slice(1,2)==0)
{
if(ary[1].slice(0,1)==0)
{
dd="整";
}
else
{
dd=chinese_ary[ary[1].slice(0,1)]+"角"
}
}
else
{
if(ary[1].slice(0,1)==0)
{
dd="零"+chinese_ary[ary[1].slice(1,2)]+"分"
}
else
{
dd=chinese_ary[ary[1].slice(0,1)]+"角"+chinese_ary[ary[1].slice(1,2)]+"分"
}
}
len=ary[0].length;
var newArray=new Array();
var uperTotal="";
var ii=0;
for(var i=len-1;i>=0;i--)
{
newArray[i]=ary[0].toString().slice(i,i+1);
if(ii % 4==0)
{
uperTotal="|"+uperTotal;
}
uperTotal=(chinese_ary[newArray[i]])+uperTotal;
ii++;
}
var a=uperTotal.split("|");
ii=0;
var result="";
for(var i=a.length-2;i>=0;i--)
{
var tmp=a[i];
var beginFlag=true;
var uperCase="";
var seriesFlag=false;
var iPosition=0;
for(var iii=tmp.length-1;iii>=0;iii--)
{
if(tmp.slice(iii,iii+1)=="零")
{
if(beginFlag)
{
uperCase+="";
}
else
{
if(seriesFlag)
{
uperCase+="";
}
else
{
uperCase="零"+uperCase;
}
seriesFlag=true;
}
}
else
{
beginFlag=false;
seriesFlag=false;
uperCase=tmp.slice(iii,iii+1)+position_ary2[iPosition]+uperCase;
}
iPosition++;
}
switch(ii)
{
case 0:
uperCase+="元";
break;
case 1:
uperCase+="萬";
break;
case 2:
uperCase+="亿";
break;
}
ii++;
result=(uperCase)+result;
}
return(result+dd);
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -