一个笔记本折旧计算器

<?php
/*
 * Created on 2012-10-24
 *
 * @ by dongs365@163.com
 *
 */
$a=$b=$c=$h=$i=$d=$e=$f=$g=$j=$k=$l="";//初始所有值
if (!empty($_POST['ti'])){//判断提交
 	$a=$_POST['bjb_a']; //购买金额
 	$b=($a<=3500) ? "0" : (($a>3500 and $a<=6000) ? "2000" : ((($a>6000 and $a<=8000)) ? "3000" : "0") ) ;//个人缴费
 	$c=$_POST['bjb_c'];//使用月数
 	$h=$a/48;//每月折旧
 	$i=$b/48;//每月费用
 	$d=$c*$h;//耗损折旧
 	$e=$a-$b;//公司缴纳
 	$f=48-$c;//剩余月数
 	$g=$a-$d;//剩余价值
 	$j=round($c*$i,2);//使用费用
 	$k=round($b-$j,2);//公司退还
 	$l=round($g-$b,2);//个人购买
    $l= ($l<0) ? "0" : $l;//判断是否为负数
 	$l= ($c<12) ? "不能购买" : $l;//判断是否1年
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>笔记本价格计算器</title>
</head>
<body align="center">
<form id="ti" name="ti" action="" method="post">
<table  cellspacing=0 cellpadding=5 border=1 style="border-collapse:collapse;background-color:#CCCCCC" bordercolor="0">
<tr>
<td align="center" colspan="6" style="font-size:25px;">笔记本价格计算器<font size="2">(单位/元/月)</font></td>
</tr>
<tr>
<td align="center" colspan="6" style="color:#F00;font-size:15px;" >红色部分填入数据然后计算</td>
</tr>
<tr>
<td width="80" style="color:#F00">购买金额:</td>
<td width="42">
  <input type="text" name="bjb_a" value="<?php echo $a; ?>" size="6" maxlength="6"/>
</td>
<td width="80">个人缴纳:</td>
<td width="42">
  <input type="text" name="bjb_b" value="<?php echo $b; ?>" size="6" maxlength="6" readonly/>
</td>
<td width="80" style="color:#F00">使用月数:</td>
<td width="42">
  <input type="text" name="bjb_c" value="<?php echo $c; ?>" size="6" maxlength="6"/>
</td>
</tr>
<tr>
<td>折旧耗损:</td>
<td>
  <input type="text" name="bjb_d" value="<?php echo $d; ?>" size="6" maxlength="6" readonly/>
</td>
<td>公司缴纳:</td>
<td>
  <input type="text" name="bjb_e" value="<?php echo $e; ?>" size="6" maxlength="6" readonly/>
</td>
<td>剩余月数:</td>
<td>
  <input type="text" name="bjb_f" value="<?php echo $f; ?>" size="6" maxlength="6" readonly/>
</td>
</tr>
<tr>
<td>剩余价值:</td>
<td>
  <input type="text" name="bjb_g" value="<?php echo $g; ?>" size="6" maxlength="6" readonly/>
</td>
<td>每月折旧:</td>
<td>
  <input type="text" name="bjb_h" value="<?php echo $h; ?>" size="6" maxlength="6" readonly/>
</td>
<td>每月费用:</td>
<td>
  <input type="text" name="bjb_i" value="<?php echo $i; ?>" size="6" maxlength="6" readonly/>
</td>
</tr>
<tr>
<td>使用费用:</td>
<td>
  <input type="text" name="bjb_j" value="<?php echo $j; ?>" size="6" maxlength="6" readonly/>
</td>
<td>公司退还:</td>
<td>
  <input type="text" name="bjb_k" value="<?php echo $k; ?>" size="6" maxlength="6" readonly/>
</td>
<td>个人购买:</td>
<td>
  <input type="text" name="bjb_l" value="<?php echo $l; ?>" size="6" maxlength="6" readonly/>
</td>
</tr>
<tr>
<td colspan="6" style="text-align:center" >
<input type="submit" name="ti" value="计算"/>
<input type="submit" name="chong" value="重置"/></td>
</tr>
</table>
</from>
</body>
<html>

转载于:https://my.oschina.net/u/166866/blog/85143

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值