<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#form1 table tr td {
color: #000;
}
#form1 table {
color: #000;
}
#form1 table {
color: #FFF;
}
</style>
</head>
<?php
if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])){
$tieuthu=$_POST["csm"] - $_POST["csc"];
$muc1=$_POST["m1"];
$muc2=$_POST["m2"];
$muc3=$_POST["m3"];
if($tieuthu<0)
$thanhtien="Dữ liệu ko chính sác";
else if($tieuthu<=100)
$thanhtien=$tieuthu*$muc1;
else if($tieuthu<=200)
$thanhtien=100*$muc1+($tieuthu-100)*$muc2;
else
$thanhtien=100*$muc1+100*$muc2+($tieuthu-200)*$muc3;
}
?>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="566" border="5">
<tr>
<td colspan="4" align="center" bgcolor="#CC0000"style="color:white">TÍNH TIỀN ĐIỆN </td>
</tr>
<tr>
<td width="169" bgcolor="#66CCFF">Chỉ số cũ</td>
<td colspan="2" bgcolor="#66CCFF"><label for="csc"></label>
<input name="csc" type="text" id="csc" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $_POST["csc"];?>" size="54"/></td>
<td width="47" bgcolor="#66CCFF">KW</td>
</tr>
<tr>
<td bgcolor="#66CCFF">Chỉ số mới</td>
<td colspan="2" bgcolor="#66CCFF"><label for="csm"></label>
<input name="csm" type="text" id="csm" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $_POST["csm"];?>" size="54"/></td>
<td bgcolor="#66CCFF">KW</td>
</tr>
<tr>
<td rowspan="4" bgcolor="#66CCFF">Đơn giá</td>
<td width="139" align="center" bgcolor="#66CCFF">Số KW tiêu thụ</td>
<td width="175" align="center" bgcolor="#66CCFF">Đơn giá</td>
<td bgcolor="#66CCFF"> </td>
</tr>
<tr>
<td bgcolor="#66CCFF">Mức 1 (0-100)</td>
<td bgcolor="#66CCFF"><label for="m1"></label>
<input name="m1" type="text" id="m1" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $muc1;?>" size="29"/></td>
<td bgcolor="#66CCFF">VNĐ</td>
</tr>
<tr>
<td bgcolor="#66CCFF">Mức 2 (101-200)</td>
<td bgcolor="#66CCFF"><label for="m2"></label>
<input name="m2" type="text" id="m2" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $muc2;?>" size="29"/></td>
<td bgcolor="#66CCFF">VNĐ</td>
</tr>
<tr>
<td bgcolor="#66CCFF">Mức 3 (>200)</td>
<td bgcolor="#66CCFF"><label for="m3"></label>
<input name="m3" type="text" id="m3" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $muc3;?>" size="29"/></td>
<td bgcolor="#66CCFF">VNĐ</td>
</tr>
<tr>
<td bgcolor="#66CCFF">Thành tiền</td>
<td colspan="2" bgcolor="#66CCFF"><label for="textfield6"></label>
<input name="textfield6" type="text" id="textfield6" size="54" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $thanhtien;?>"/></td>
<td bgcolor="#66CCFF">VNĐ</td>
</tr>
<tr>
<td colspan="4" align="center" bgcolor="#66CCFF"><input type="submit" name="button" id="button" value="Tính" /></td>
</tr>
</table>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#form1 table tr td {
color: #000;
}
#form1 table {
color: #000;
}
#form1 table {
color: #FFF;
}
</style>
</head>
<?php
if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])){
$tieuthu=$_POST["csm"] - $_POST["csc"];
$muc1=$_POST["m1"];
$muc2=$_POST["m2"];
$muc3=$_POST["m3"];
if($tieuthu<0)
$thanhtien="Dữ liệu ko chính sác";
else if($tieuthu<=100)
$thanhtien=$tieuthu*$muc1;
else if($tieuthu<=200)
$thanhtien=100*$muc1+($tieuthu-100)*$muc2;
else
$thanhtien=100*$muc1+100*$muc2+($tieuthu-200)*$muc3;
}
?>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="566" border="5">
<tr>
<td colspan="4" align="center" bgcolor="#CC0000"style="color:white">TÍNH TIỀN ĐIỆN </td>
</tr>
<tr>
<td width="169" bgcolor="#66CCFF">Chỉ số cũ</td>
<td colspan="2" bgcolor="#66CCFF"><label for="csc"></label>
<input name="csc" type="text" id="csc" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $_POST["csc"];?>" size="54"/></td>
<td width="47" bgcolor="#66CCFF">KW</td>
</tr>
<tr>
<td bgcolor="#66CCFF">Chỉ số mới</td>
<td colspan="2" bgcolor="#66CCFF"><label for="csm"></label>
<input name="csm" type="text" id="csm" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $_POST["csm"];?>" size="54"/></td>
<td bgcolor="#66CCFF">KW</td>
</tr>
<tr>
<td rowspan="4" bgcolor="#66CCFF">Đơn giá</td>
<td width="139" align="center" bgcolor="#66CCFF">Số KW tiêu thụ</td>
<td width="175" align="center" bgcolor="#66CCFF">Đơn giá</td>
<td bgcolor="#66CCFF"> </td>
</tr>
<tr>
<td bgcolor="#66CCFF">Mức 1 (0-100)</td>
<td bgcolor="#66CCFF"><label for="m1"></label>
<input name="m1" type="text" id="m1" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $muc1;?>" size="29"/></td>
<td bgcolor="#66CCFF">VNĐ</td>
</tr>
<tr>
<td bgcolor="#66CCFF">Mức 2 (101-200)</td>
<td bgcolor="#66CCFF"><label for="m2"></label>
<input name="m2" type="text" id="m2" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $muc2;?>" size="29"/></td>
<td bgcolor="#66CCFF">VNĐ</td>
</tr>
<tr>
<td bgcolor="#66CCFF">Mức 3 (>200)</td>
<td bgcolor="#66CCFF"><label for="m3"></label>
<input name="m3" type="text" id="m3" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $muc3;?>" size="29"/></td>
<td bgcolor="#66CCFF">VNĐ</td>
</tr>
<tr>
<td bgcolor="#66CCFF">Thành tiền</td>
<td colspan="2" bgcolor="#66CCFF"><label for="textfield6"></label>
<input name="textfield6" type="text" id="textfield6" size="54" value="<?php if(isset($_POST["csc"])&& isset($_POST["csm"])&& isset($_POST["m1"]) && isset($_POST["m2"]) && isset($_POST["m3"])) echo $thanhtien;?>"/></td>
<td bgcolor="#66CCFF">VNĐ</td>
</tr>
<tr>
<td colspan="4" align="center" bgcolor="#66CCFF"><input type="submit" name="button" id="button" value="Tính" /></td>
</tr>
</table>
</form>
</body>
</html>
0 comments:
Post a Comment