Calculate NET SALARY of employees using following criteria In Php.
If basic salary is greater than 10,000 then
- Dearness allowance (DA) =5% of basic salary
- House Rent Allowance (HRA)= 5% of basic salary
- Provident Fund (Pf) =2% of basic salary
- Dearness allowance (DA) = 10% of basic salary
- House Rent Allowance (HRA) = 10% of basic salary
- Provident Fund (Pf) = 10% of basic salary
- Dearness allowance (DA) = 15% of basic salary
- House Rent Allowance (HRA) = 15% of basic salary
- Provident Fund (Pf) = 15% of basic salary
Code For Calculate Net Basic Salary
<html>
<body>
<form name="frm1" method="GET" action=""> // Basic Html Form
BASIC SALARY:<input type="text" name="bs"> // Input Textbox for take value to calculate
<br>
<input type="submit" name="submit" value="submit"> // Submit value for calculate
</form>
<?php
$page=$_GET['frm1']; //to get a value from the html form
if($page="frm1")
{
$bsal=$_GET['bs']; // to get value of textbox
if($bsal>=10000) // If basic salary is greater than 10,000 then
{
$da=0.05*$bsal;
$hra=0.05*$bsal;
$pf=0.02*$bsal;
$ns=$bsal+$da+$hra-$pf;
echo("net salary is $ns");
}
else if ($bsal>=25000) // If basic salary is greater than 25,000 then
{
$da=0.1*$bsal;
$hra=0.1*$bsal;
$pf=0.1*$bsal;
$ns=$bsal+$da+$hra-$pf;
echo("net salary is $ns");
}
else if($bsal>=50000) //If basic salary is greater than 50,000 then
{
$da=0.15*$bsal;
$hra=0.15*$bsal;
$pf=0.15*$bsal;
$ns=$bsal+$da+$hra-$pf;
echo("net salary is $ns");
}
else
{
$da=0;
$hra=0;
$pf=0;
$ns=$bsal+$da+$hra-$pf;
echo("net salary is $ns");
}
}
?>



No comments:
Post a Comment
Thanks For Comment Will get you Soon..