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

📄 index.php

📁 极限网络智能办公系统 Office Automation V3.0官方100%源代码.
💻 PHP
字号:
<?
include_once("inc/auth.php");
include_once("../check_cfg.php");
include_once("inc/utility_all.php");

//---------------- 检查折旧相关参数是否配置好 ----------------------------
check_assetcfg();

$CUR_DATE=date("Y-m-d",time());
?>

<html>
<head>
<title>增加固定资产</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script Language="JavaScript">
function CheckForm()
{
   if(document.form1.CPTL_NAME.value=="")
   { alert("资产名称不能为空!");
     document.form1.CPTL_NAME.focus();
     return (false);
   }
   if(document.form1.DEPT_ID.value=="")
   { alert("所属部门不能为空!");
     document.form1.DEPT_ID.focus();
     return (false);
   }
   if(document.form1.CPTL_VAL.value=="")
   { alert("资产原值不能为空!");
     document.form1.CPTL_VAL.focus();
     return (false);
   }
   if(document.form1.CPTL_BAL.value==""&&document.form1.CPTL_KIND.value=="01")
   { alert("残值(率)不能为空!");
     document.form1.CPTL_BAL.focus();
     return (false);
   }
   if(document.form1.DPCT_YY.value==""&&document.form1.CPTL_KIND.value=="01")
   { alert("折旧年限不能为空!");
     document.form1.DPCT_YY.focus();
     return (false);
   }
   if(document.form1.SUM_DPCT.value==""&&document.form1.CPTL_KIND.value=="01")
   { alert("累计折旧不能为空!");
     document.form1.SUM_DPCT.focus();
     return (false);
   }
   if(document.form1.MON_DPCT.value==""&&document.form1.CPTL_KIND.value=="01")
   { alert("月折旧额不能为空!");
     document.form1.MON_DPCT.focus();
     return (false);
   }
   if(document.form1.CPTL_KIND.value=="")
   { alert("资产性质不能为空!");
     document.form1.CPTL_KIND.focus();
     return (false);
   }
   if(document.form1.PRCS_ID.value=="")
   { alert("增加类型不能为空!");
     document.form1.PRCS_ID.focus();
     return (false);
   }
   if(document.form1.FINISH_FLAG.value==""&&document.form1.CPTL_KIND.value=="01")
   { alert("折旧不能为空!");
     document.form1.FINISH_FLAG.focus();
     return (false);
   }
   if(document.form1.KEEPER.value=="")
   { alert("保管人不能为空!");
     document.form1.KEEPER.focus();
     return (false);
   }
   
   return true;
}
function sendForm()
{
   if(CheckForm())
      document.form1.submit();
}

//verify for netscape/mozilla
var isNS4 = (navigator.appName=="Netscape")?1:0;

function check_input()
{
  if(!isNS4)
  {
  	 if(event.keyCode < 45 || event.keyCode > 57)
  	    event.returnValue = false;
  }
  else
  {
  	 if(event.which < 45 || event.which > 57)
  	    return false;
  }  
}

function  ForDight(Dight,How)  
{  
           Dight  =  Math.round  (Dight*Math.pow(10,How))/Math.pow(10,How);  
           return  Dight;  
} 

function check_value(obj)
{
   
   if(obj.value=="")
      return;
   val=parseFloat(obj.value);
   if(isNaN(val))
   {
      alert("非法的数字");
      obj.focus();
      return;
   }
   if(val<0)
   {
      alert("数值不能小于0");
      obj.focus();
      return;
   }
   
   obj.value=ForDight(val,2);

   value_array=obj.value.split(".");
   if(value_array.length==1)
   {
   	  obj.value=value_array[0]+".00";
   	  return;
   }
   else if(value_array.length==2)
   {
   	  if(value_array[1].length==0)
   	    obj.value=value_array[0]+".00";
   	  else if(value_array[1].length==1)
   	    obj.value=value_array[0]+"."+value_array[1]+"0";
   	  else if(value_array[1].length>=2)
   	    obj.value=value_array[0]+"."+value_array[1].substr(0,2);
   }
}

function cal_mon_dpct()
{
   if(form1.CPTL_VAL.value=="")
   {
      alert("\"资产原值\"不能为空");
      document.form1.CPTL_VAL.focus();
      return;
   }
   if(form1.CPTL_BAL.value=="")
   {
      alert("\"残值(率)\"不能为空");
      document.form1.CPTL_BAL.focus();
      return;
   }
   if(form1.DPCT_YY.value=="")
   {
      alert("\"折旧年限\"不能为空");
      document.form1.DPCT_YY.focus();
      return;
   }
   if(form1.SUM_DPCT.value=="")
   {
      form1.SUM_DPCT.value="0.00";
     
   }
   
   cptl_val=ForDight(parseFloat(form1.CPTL_VAL.value),2);
   sum_dpct=ForDight(parseFloat(form1.SUM_DPCT.value),2);
   cptl_bal=ForDight(parseFloat(form1.CPTL_BAL.value),2);
   dpct_yy=ForDight(parseFloat(form1.DPCT_YY.value),2);
   if(cptl_val<0)
   {
      alert("\"资产原值\"不能小于0");
      document.form1.CPTL_VAL.focus();
      return;
   }
   if(sum_dpct<0)
   {
      alert("\"累计折旧\"不能小于0");
      document.form1.SUM_DPCT.focus();
      return;
   }
   if(cptl_bal<0)
   {
      alert("\"残值(率)\"不能小于0");
      document.form1.CPTL_BAL.focus();
      return;
   }
   if(dpct_yy<0)
   {
      alert("\"折旧年限\"不能小于0");
      document.form1.DPCT_YY.focus();
      return;
   }
<?
 $query = "SELECT * from CP_ASSETCFG";
 $cursor= exequery($connection,$query);
 if($ROW=mysql_fetch_array($cursor))
    $BAL_SORT=$ROW["BAL_SORT"];
 if($BAL_SORT=="01")
 {
?>
    if(cptl_val<sum_dpct+cptl_bal)
    {
       alert("\"残值\"和\"累计折旧\"之和不能大于\"资产原值\"");
       return;
    }
    mon_dpct=(cptl_val-sum_dpct-cptl_bal)/(dpct_yy*12);
<?
 }
 else if($BAL_SORT=="02")
 {
?>
    if(cptl_val<sum_dpct)
    {
       alert("\"累计折旧\"不能大于\"资产原值\"");
       return;
    }
    if(cptl_bal>100)
    {
       alert("\"残值率\"不能大于\"100%\"");
       return;
    }
    mon_dpct=(cptl_val-sum_dpct)*(1-cptl_bal/100)/(dpct_yy*12);
<?
 }
?>
   form1.MON_DPCT.value=ForDight(mon_dpct,2);
 
   check_value(form1.MON_DPCT);
}

function td_calendar(fieldname)
{
  myleft=document.body.scrollLeft+event.clientX-event.offsetX+230;
  mytop=document.body.scrollTop+event.clientY-event.offsetY+50;

  window.showModalDialog("/inc/calendar.php?FIELDNAME="+fieldname,self,"edge:raised;scroll:0;status:0;help:0;resizable:1;dialogWidth:280px;dialogHeight:215px;dialogTop:"+mytop+"px;dialogLeft:"+myleft+"px");
}
</script>
</head>

<body class="bodycolor" topmargin="5">

<table border="0" width="90%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/notify_new.gif" align="absmiddle"><span class="big3"> 增加固定资产</span>
    </td>
  </tr>
</table>
<br>
<form enctype="multipart/form-data" action="submit.php"  method="post" name="form1">
  <table border="0" width="500" cellpadding="2" cellspacing="1" align="center" bgcolor="#000000" class="small">
    <tr>
      <td nowrap class="TableData" width="100"> 资产编号:</td>
      <td class="TableData"> 
        <input type="text" name="CPTL_NO" size="20" maxlength="100" class="BigInput" value="">
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 资产名称:</td>
      <td class="TableData"> 
        <input type="text" name="CPTL_NAME" size="40" maxlength="200" class="BigInput" value="">
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 资产类别:</td>
      <td class="TableData"> 
      <select name="TYPE_ID" class="BigSelect">
        <option value="0"></option>
<?
 $query = "SELECT * from CP_ASSET_TYPE order by TYPE_NO";
 $cursor= exequery($connection,$query);
 while($ROW=mysql_fetch_array($cursor))
 {
    $TYPE_ID=$ROW["TYPE_ID"];
    $TYPE_NAME=$ROW["TYPE_NAME"];
?>
        <option value="<?=$TYPE_ID?>"><?=$TYPE_NAME?></option>
<?
 }
?>
      </select>
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 所属部门:</td>
      <td class="TableData">
      <select name="DEPT_ID" class="BigSelect">
        <option value="0"></option>
<?
      echo my_dept_tree(0,$DEPT_ID,0);
?>
      </select>
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 资产性质:</td>
      <td class="TableData"> 
      <select name="CPTL_KIND" class="BigSelect">
        <option value="01" selected>资产</option>
        <option value="02">费用</option>
      </select>
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 增加类型:</td>
      <td class="TableData"> 
      <select name="PRCS_ID" class="BigSelect">
<?
 $query = "SELECT * from CP_PRCS_PROP where left(PRCS_CLASS,1)='A' order by PRCS_CLASS";

 $cursor= exequery($connection,$query);
 while($ROW=mysql_fetch_array($cursor))
 {
    $PRCS_ID=$ROW["PRCS_ID"];
    $PRCS_LONG_DESC=$ROW["PRCS_LONG_DESC"];
?>
        <option value="<?=$PRCS_ID?>"><?=$PRCS_LONG_DESC?></option>
<?
 }
?>
      </select>
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 资产原值:</td>
      <td class="TableData"> 
        <input type="text" name="CPTL_VAL" size="20" maxlength="23" class="BigInput" value="" onkeypress="check_input()" onblur="check_value(this)" style="text-align:right;"> 数字
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> <?if($BAL_SORT=="01") echo "残值:"; else echo "残值率:";?></td>
      <td class="TableData"> 
        <input type="text" name="CPTL_BAL" size="20" maxlength="23" class="BigInput" value="" onkeypress="check_input()" onblur="check_value(this)" style="text-align:right;"> <?if($BAL_SORT=="01") echo "数字"; else echo "%";?>
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 折旧年限:</td>
      <td class="TableData"> 
        <input type="text" name="DPCT_YY" size="20" maxlength="13" class="BigInput" value="" onkeypress="check_input()" onblur="check_value(this)" style="text-align:right;"> 数字
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 累计折旧:</td>
      <td class="TableData"> 
        <input type="text"  name="SUM_DPCT" size="20" maxlength="23" class="BigInput" value="0.00" onkeypress="check_input()" onblur="check_value(this)" style="text-align:right;"> 数字
        为空表示新资产
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 月折旧额:</td>
      <td class="TableData"> 
        <input type="text" name="MON_DPCT" size="20" maxlength="23" class="BigStatic" value="" style="text-align:right;" readonly>&nbsp
        <input type="button" name="MON_DPCT_CAL"  class="SmallButton" onclick="cal_mon_dpct()" value="计算">
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 折旧:</td>
      <td class="TableData"> 
        <input type="radio" name="FINISH_FLAG" id="FINISH_FLAG1" value="1"><label for="FINISH_FLAG1">提足</label>
        <input type="radio" name="FINISH_FLAG" id="FINISH_FLAG2" value="0" checked ><label for="FINISH_FLAG2">未提足</label>
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 启用日期:</td>
      <td class="TableData"> 
        <input type="text" name="FROM_YYMM" size="12" maxlength="10" class="BigInput" value="<?=$CUR_DATE?>">
        <img src="/images/menu/calendar.gif" border="0" style="cursor:hand" onclick="td_calendar('form1.FROM_YYMM');"> 为空表示未启用
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 保管人:</td>
      <td class="TableData"> 
        <input type="text" name="KEEPER" size="15" maxlength="20" class="BigInput" value="">
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 备注:</td>
      <td class="TableData"> 
        <textarea cols="45" name="REMARK" rows="3" class="BigInput" wrap="yes"></textarea>
      </td>
    </tr>
    <tr align="center" class="TableControl">
      <td colspan="2" nowrap>
        <input type="button" value="增加" class="BigButton" onclick="sendForm();">&nbsp;&nbsp;
        <input type="button" value="重填" class="BigButton" onclick="location='index.php'">&nbsp;&nbsp;
        <input type="button" value="返回" class="BigButton" onClick="location='../'">
      </td>
    </tr>

  </table>
 </form>
</body>
</html>

⌨️ 快捷键说明

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