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

📄 modify.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();

 $query = "SELECT * from CP_DPCT_SUB where CPTL_ID=$CPTL_ID";
 $cursor= exequery($connection,$query);
 if($ROW=mysql_fetch_array($cursor))
    $DPCT_FLAG=1;
 else
    $DPCT_FLAG=0;
?>

<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">
<?
$query="select * from CP_CPTL_INFO where CPTL_ID=$CPTL_ID";
$cursor=exequery($connection,$query);
$CPTL_COUNT=0;
$DEPT_COUNT=0;
if($ROW=mysql_fetch_array($cursor))
{
   $CPTL_COUNT++;
   if($CPTL_COUNT>200)
      break;
   
   $CPTL_ID=$ROW["CPTL_ID"];
   $CPTL_NO=$ROW["CPTL_NO"];
   $CPTL_NAME=$ROW["CPTL_NAME"];
   $TYPE_ID=$ROW["TYPE_ID"];
   $DEPT_ID=$ROW["DEPT_ID"];
   $CPTL_VAL=$ROW["CPTL_VAL"];
   $CPTL_BAL=$ROW["CPTL_BAL"];
   $DPCT_YY=$ROW["DPCT_YY"];
   $MON_DPCT=$ROW["MON_DPCT"];
   $SUM_DPCT=$ROW["SUM_DPCT"];
   $CPTL_KIND=$ROW["CPTL_KIND"];
   $PRCS_ID=$ROW["PRCS_ID"];
   $FINISH_FLAG=$ROW["FINISH_FLAG"];
   $CREATE_DATE=$ROW["CREATE_DATE"];
   $FROM_YYMM=$ROW["FROM_YYMM"];
   $KEEPER=$ROW["KEEPER"];
   $REMARK=$ROW["REMARK"];
   
   if($CPTL_KIND=="01")
      $CPTL_KIND_DESC="资产";
   else if($CPTL_KIND=="02")
      $CPTL_KIND_DESC="费用";
      
   $query1="select * from CP_PRCS_PROP where PRCS_ID=$PRCS_ID";
   $cursor1=exequery($connection,$query1);
   if($ROW1=mysql_fetch_array($cursor1))
      $PRCS_LONG_DESC=$ROW1["PRCS_LONG_DESC"];
   
   $query1="select * from DEPARTMENT where DEPT_ID=$DEPT_ID";
   $cursor1= exequery($connection,$query1);
   if($ROW1=mysql_fetch_array($cursor1))
       $DEPT_NAME=$ROW1["DEPT_NAME"];
}
?>
<table border="0" width="90%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/menu/asset.gif" align="absmiddle"><span class="big3"> 修改固定资产</span>
    </td>
  </tr>
</table>
<br>
<table border="0" width="500" cellpadding="2" cellspacing="1" align="center" bgcolor="#000000" class="small">
  <form enctype="multipart/form-data" action="update.php"  method="post" name="form1">
    <tr>
      <td nowrap class="TableData" width="100"> 资产编号:</td>
      <td class="TableData"> 
        <input type="text" name="CPTL_NO" size="20" maxlength="100" class="BigInput" value="<?=$CPTL_NO?>">
      </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="<?=$CPTL_NAME?>">
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 资产类别:</td>
      <td class="TableData"> 
      <select name="TYPE_ID" class="BigSelect">
        <option value="0"<?if($TYPE_ID==0) echo " selected";?>></option>
<?
 $query = "SELECT * from CP_ASSET_TYPE order by TYPE_NO";
 $cursor= exequery($connection,$query);
 while($ROW=mysql_fetch_array($cursor))
 {
    $TYPE_ID1=$ROW["TYPE_ID"];
    $TYPE_NAME=$ROW["TYPE_NAME"];
?>
        <option value="<?=$TYPE_ID1?>"<?if($TYPE_ID==$TYPE_ID1) echo " selected";?>><?=$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"<?if($DEPT_ID==0) echo " selected";?>></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">
<?
if($DPCT_FLAG)
{
   if($CPTL_KIND=="01")
   {
?>
        <option value="01" selected">资产</option>
<?
   }
   else if($CPTL_KIND=="02")
   {
?>
        <option value="02" selected">费用</option>
<?
   }
}
else
{
?>
        <option value="01" <?if($CPTL_KIND=="01") echo "selected";?>>资产</option>
        <option value="02" <?if($CPTL_KIND=="02") echo "selected";?>>费用</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_ID1=$ROW["PRCS_ID"];
    $PRCS_LONG_DESC=$ROW["PRCS_LONG_DESC"];
?>
        <option value="<?=$PRCS_ID1?>"<?if($PRCS_ID1==$PRCS_ID) echo " selected";?>><?=$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" value="<?=$CPTL_VAL?>" class="BigInput" 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" value="<?=$CPTL_BAL?>"  class="BigInput" 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" value="<?=$DPCT_YY?>"  class="BigInput" 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" value="<?=$SUM_DPCT?>"  class="BigInput" 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="<?=$MON_DPCT?>" style="text-align:right;" readonly>&nbsp
<?
if($DPCT_FLAG==0)
{
?>
        <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"<?if($FINISH_FLAG=="1") echo " checked";?>><label for="FINISH_FLAG1">提足</label>
        <input type="radio" name="FINISH_FLAG" id="FINISH_FLAG2" value="0"<?if($FINISH_FLAG=="0") echo " checked";?>><label for="FINISH_FLAG2">未提足</label>
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 启用日期:</td>
      <td class="TableData"> 
        <input type="input" name="FROM_YYMM" size="12" value="<?if($FROM_YYMM!="0000-00-00") echo $FROM_YYMM;?>" class="BigInput">
        <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="<?=$KEEPER?>">
      </td>
    </tr>
    <tr>
      <td nowrap class="TableData" width="100"> 备注:</td>
      <td class="TableData"> 
        <textarea cols="45" name="REMARK" rows="3" class="BigInput" wrap="yes"><?=$REMARK?></textarea>
      </td>
    </tr>
    <tr align="center" class="TableControl">
      <td colspan="2" nowrap>
        <input type="hidden" value="<?=$CPTL_ID?>" name="CPTL_ID" >
        <input type="hidden" value="<?=$DPCT_FLAG?>" name="DPCT_FLAG" >
        <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='index.php'">
      </td>
    </tr>
   </form>
  </table>
</body>
</html>

⌨️ 快捷键说明

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