新建 文本文档.txt
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:5k
- <script type="text/javascript" language="javascript" src="../js/calendar.js"></script>
- <script type="text/javascript">
- //小计
- function sum1()
- {
- var ChargeMachine=0;
- if(document.getElementById("txt_ChargeMachine").value!=0)
- ChargeMachine= parseFloat(document.getElementById("txt_ChargeMachine").value);
-
- var ChargeStuff=0;
- if(document.getElementById("txt_ChargeStuff").value!=0)
- ChargeStuff= parseFloat(document.getElementById("txt_ChargeStuff").value);
-
- var ChargeOther=0;
- if(document.getElementById("txt_ChargeOther").value!=0)
- ChargeOther= parseFloat(document.getElementById("txt_ChargeOther").value);
-
- var ChargeManPower= 0;
- if(document.getElementById("TB_ChargeManPower").value!=0 || document.getElementById("TB_ChargeManPower").value!="" )
- ChargeManPower= parseFloat(document.getElementById("TB_ChargeManPower").value);
-
- var a= ChargeMachine + ChargeStuff + ChargeOther + ChargeManPower;
- document.getElementById("txt_ChargeSum").value= cheng(a,2);
- document.getElementById("TB_ChargeSum").value= cheng(a,2);
-
- if( document.getElementById("TB_ChargeSum").value=="NaN")
- {
- document.getElementById("TB_ChargeSum").value= "0";
- document.getElementById("txt_ChargeSum").value= 0;
- }
- }
-
- //保留两位小数
- function cheng(num,n) // num:被格式化的数字,n:要保留小数的位数
- {
- var dd=1;
- var tempnum;
- for(i=0;i<n;i++)
- {
- dd*=10;
- }
- tempnum=num*dd;
- tempnum=Math.round(tempnum);
- return tempnum/dd;
- // alert(tempnum/dd);
- }
-
- function modelesswin(url,mwidth,mheight)
- {
- if (document.all&&window.print)
- { url=url+"?projectid=" +document.getElementById('txt_ProjectID').value + "&projecttype =1";
- var re= window.showModalDialog(url,"","help:0;dialogWidth=1000px;dialogHeight=450px,scroll=no;");
- if (re!=undefined)
- {
- document.getElementById("TB_ChargeMachine").value=re;
- document.getElementById("txt_ChargeMachine").value=re;
- sum1();
- }
-
- }
- }
-
- function modelesswin2(url,mwidth,mheight)
- {
- if (document.all&&window.print)
- {
- url=url+"?projectid=" +document.getElementById('txt_ProjectID').value + "&projecttype =1";;
- var re=window.showModalDialog(url,"","help:0;dialogWidth=1000px;dialogHeight=450px,status=no;scroll=no;");
-
- if (re!=undefined)
- {
- document.getElementById("TB_ChargeStuff").value=re;
- document.getElementById("txt_ChargeStuff").value=re;
- sum1();
- }
- }
- }
- function modelesswin3(url,mwidth,mheight)
- {
- if (document.all&&window.print)
- {
- url=url+"?projectid=" +document.getElementById('txt_ProjectID').value + "&projecttype =1";;
- var re=window.showModalDialog(url,"","help:0;dialogWidth=800px;dialogHeight=450px,status=no;scroll=no;");
-
- if (re!=undefined)
- {
- document.getElementById("TB_ChargeOther").value=re;
- document.getElementById("txt_ChargeOther").value=re;
- sum1();
- }
- }
- }
-
- function CheckNull()
- {
- var ChargeSum;
- if (form1.txt_ChargeSum.value=="")
- {
- ChargeSum=-1;
- }
- else
- {
- ChargeSum=parseFloat(form1.txt_ChargeSum.value);
- }
- var s=form1.TB_ProjectName.value;
- s=s.replace(/^s+|s+$/g,"");
- if ( ChargeSum <=0 || s=="")
- {
- alert("系统提示:请正确填写! n 1、合计必需大于零; n 2、项目名称处不可为空。");
- return false;
- }
- }
-
- function checkNumber()
{
if(!(((window.event.keyCode>=48)&&(window.event.keyCode<=57))||(window.event.keyCode==13)||(window.event.keyCode==46)||(window.event.keyCode==45)))
{
window.event.keyCode=0;
alert("对不起,只能输入数字!");
}
}