EMPLOYEE SALARY SYSTEM USING PHP AND MYSQL

<?php

mysql_connect("localhost","root","") or die ("Unable to execute");

$sql="create database payroll";

$res=mysql_query($sql) or die ("Unable to execute");

echo"<b>Database Created</b<br>";

mysql_selectdb('payroll');

$sql="CREATE TABLE `employee` (

`id` int NOT NULL AUTO_INCREMENT,

`name` varchar(20) NOT NULL ,

`designation` varchar(50) NOT NULL ,

`basic_salary` float NOT NULL ,

`merged_da` float NOT NULL ,

`dp` float NOT NULL ,

`hra` float NOT NULL ,

`gross_salary` float NOT NULL ,

`epf` float NOT NULL ,

`lic` float NOT NULL ,

`net_salary` float NOT NULL ,

primary key(id)

) ";

$res=mysql_query($sql)or die ("Unable to execute");

echo"<b>Table Created</b>";

?>

html

head

title>Employee Salary System</title>

</head>

body

<b>Employee Salary System</b>

br /<br />

<form action="frontend.php" method="post">

pre

Employee Name: <input type="text" name="name">

Select Designation: <select name="designation">

option>Lecturer</option>

option>Senior Lecture</option>

option>Assistant Professor</option>

option>Associative Professor</option>

</select>

The Basic Salary : <input type="text" name="basic_salary" >

<input type="submit" name="submit" value="submit"/>

</pre>

</form>

</body>

</html>

<?php

mysql_connect("localhost","root","");

mysql_selectdb('payroll');

if(isset($_POST['submit']))

{

$name=$_POST['name'];

$designation=$_POST['designation'];

$basic_salary=$_POST['basic_salary'];

$merged_da = $basic_salary*(50/100);

$dp = $basic_salary*(84/100);

$hra = $basic_salary*(7.5/100);

$gross_salary = $merged_da+$dp+$hra;

$epf = 800;

$lic = 1000;

$net_salary = $gross_salary+$epf+$lic;

$sql="insert into employee(name,designation,basic_salary,merged_da,dp,hra,gross_salary,epf,lic,net_salary)values('$name','$designation','$basic_salary','$merged_da','$dp','$hra','$gross_salary','$epf','$lic','$net_salary')";

$res=mysql_query($sql);

}

$sql="select * from employee";

$res=mysql_query($sql);

echo"<table border=2 align=center>

trthS.No</thth>NAME</thth>DESIGNATION</thth>BASIC SALARY</thth>MERGED DA</thth>DP</thth>HRA</thth>GROSS SALARY</thth>EPF</thth>LIC</thth>NET SALARY</th>";

while($r=mysql_fetch_array($res))

{

echo "<tr>";

echo "<th>".$r['id']."</th>";

echo "<th>".$r['name']."</th>";

echo "<th>".$r['designation']."</th>";

echo "<th>".$r['basic_salary']."</th>";

echo "<th>".$r['merged_da']."</th>";

echo "<th>".$r['dp']."</th>";

echo "<th>".$r['hra']."</th>";

echo "<th>".$r['gross_salary']."</th>";

echo "<th>".$r['epf']."</th>";

echo "<th>".$r['lic']."</th>";

echo "<th>".$r['net_salary']."</th>";

echo "</tr>";

}

echo "</table>";

?>

STUDENT MARK STATEMENT USING PHP AND MYSQL

<?php

mysql_connect("localhost","root","") or die ("Unable to execute");

$sql="create database studentmark";

$res=mysql_query($sql) or die ("Unable to execute");

echo"<b>Database Created</b>";

mysql_selectdb('studentmark');

$sql="CREATE TABLE `student` (

`id` int(100) NOT NULL AUTO_INCREMENT,

`name` varchar(20) NOT NULL ,

`rollno` varchar(20) NOT NULL ,

`m1` float NOT NULL ,

`m2` float NOT NULL ,

`m3` float NOT NULL ,

`m4` float NOT NULL ,

`m5` float NOT NULL ,

`total` float NOT NULL ,

`average` float NOT NULL ,

`result` varchar(10) NOT NULL ,

`grade` varchar(100) NOT NULL ,

primary key(id)

) ";

$res=mysql_query($sql) or die ("Unable to execute");

echo"<b>Table Created</b>";

?>

html

head

title>Student Mark Statement</title>

</head>

body

center<b>Student Mark Statement</b>

br />

br />

<form action="frontend.php" method="post">

<table cellpadding="10">

<tr

<td>Name</td<td<input type="text" name="name"/</td>

</trtr

<td>Rollno</td<td<input type="text" name="rollno"/</td>

</trtr

<td>Mark1</td<td<input type="text" name="m1"/</td>

</trtr

<td>Mark2</td<td<input type="text" name="m2"/</td>

</trtr

<td>Mark3</td<td<input type="text" name="m3"/</td>

</tr> <tr

<td<input type="submit" name="submit" value="submit"/</td>

</tr

</table>

</form>

</center>

</body>

</html>

<?php

mysql_connect("localhost","root","");

mysql_selectdb('studentmark');

if(isset($_POST['submit']))

{

$name=$_POST['name'];

$rollno=$_POST['rollno'];

$m1=$_POST['m1'];

$m2=$_POST['m2'];

$m3=$_POST['m3'];

$total = $m1+$m2+$m3;

$average = $total/3;

if($m1>=50 & $m2>=50 & $m3>=50)

{

$result = "Pass";

}

else

{

$result = "Fail";

}

if($m1>=50 & $m2>=50 & $m3>=50)

{

if($average>=80)

{

$grade = "First Class with Distiniction";

}

elseif($average>=60 & $average<80)

{

$grade = "First Class";

}

elseif($average>=50 & $average<60)

{

$grade = "Second Class";

}

else

{

$grade = "No Class";

}

}

else

{

$grade = "No Class";

}

$sql="insert into student(name,rollno,m1,m2,m3,total,average,result,grade)values('$name','$rollno','$m1','$m2','$m3','$total','$average','$result','$grade')";

$res=mysql_query($sql);

}

$sql="select * from student";

$res=mysql_query($sql);

echo"<table border=2 align=center>

<tr<th>S.No</th<th>NAME</th<th>ROLLNO</th<th>MARK1</th<th>MARK2</th<th>MARK3</th<th>TOTAL</th<th>AVERAGE</th<th>RESULT</th<th>GRADE</th<th>VIEW GRAPH</th>";

while($r=mysql_fetch_array($res))

{

echo "<tr>";

echo "<th>".$r['id']."</th>";

echo "<th>".$r['name']."</th>";

echo "<th>".$r['rollno']."</th>";

echo "<th>".$r['m1']."</th>";

echo "<th>".$r['m2']."</th>";

echo "<th>".$r['m3']."</th>";

echo "<th>".$r['total']."</th>";

echo "<th>".$r['average']."</th>";

echo "<th>".$r['result']."</th>";

echo "<th>".$r['grade']."</th>";

echo "<th<a href='graph.php?id=".$r['id']."'>View</a</th>";

echo "</tr>";

}

echo "</table>";

?>

<?php

mysql_connect("localhost","root","");

mysql_selectdb('studentmark');

$sql="select * from student where id=".$_GET['id'];

$res=mysql_query($sql);

$r=mysql_fetch_array($res);

$m1=$r['m1'];

$m2=$r['m2'];

$m3=$r['m3'];

$total=$r['total'];

$average=$r['average'];

include('phpgraphlib.php');

$graph = new PHPGraphLib(500,350);

$data = array("Mark1"=>$m1,"Mark2"=>$m2,"Mark3"=>$m3,"Total"=>$total,"Averag"=>$average);

$graph->addData($data);

$graph->setTitle('Student Mark Statement');

$graph->createGraph();

?>

STOCK MANAGEMENT SYSTEM USING PHP AND MYSQL

<?php

mysql_connect("localhost","root","") or die ("Unable to execute");

$sql="create database stock";

$res=mysql_query($sql) or die ("Unable to execute");

echo"<b>Database Created</b>";

mysql_selectdb('stock');

$sql="CREATE TABLE `stock` (

`id` int NOT NULL AUTO_INCREMENT,

`item` varchar(20) NOT NULL ,

`quantity` float NOT NULL ,

`amount` float NOT NULL ,

primary key(id)

) ";

$res=mysql_query($sql)or die ("Unable to execute");

echo"<b>Table Created</b>";

$sql="CREATE TABLE `sales` (

`id` int NOT NULL AUTO_INCREMENT,

`item` varchar(20) NOT NULL ,

`quantity` float NOT NULL ,

`amount` float NOT NULL ,

primary key(id)

) ";

$res=mysql_query($sql)or die ("Unable to execute");

echo"<b>Table Created</b>";

?>

html

head

title>Stock Management System</title>

</head>

body

<b>Stock Management System</b>

br />

<form action="frontend.php" method="post">

pre

Item : <input type="text" name="name">

Quantity : <input type="text" name="quantity">

Amount : <input type="text" name="amount">

br />

<input type="submit" name="additem" value="Add Stock"/> <a href="graph.php">View Stock graph</a> <input type="submit" name="submit" value="Sales"/>

</pre>

</form>

<?php

mysql_connect("localhost","root","");

mysql_selectdb('stock');

if(isset($_POST['submit']))

{

$item=$_POST['name'];

$quantity=$_POST['quantity'];

$amount=$_POST['amount'];

$total_amount = $quantity*$amount;

$sql="select * from stock";

$res=mysql_query($sql);

while($r=mysql_fetch_array($res))

{

$check_quantity = $r['quantity'];

$check_amount = $r['amount'];

}

if($quantity <= $check_quantity)

{

$fquantity = $check_quantity - $quantity;

$famount = $check_amount - $total_amount;

$query="UPDATE stock SET quantity='$fquantity' WHERE item='$item'";

mysql_query($query);

$sql="insert into sales(item,quantity,amount)values('$item','$quantity','$total_amount')";

$res=mysql_query($sql);

$sql="select * from sales";

$res=mysql_query($sql);

echo"<table border=2 align=center<tr<th>S.No</th<th>NAME</th<th>QUANTITY</th<th>AMOUNT</th>";

while($r=mysql_fetch_array($res))

{

echo "<tr>";

echo "<th>".$r['id']."</th>";

echo "<th>".$r['item']."</th>";

echo "<th>".$r['quantity']."</th>";

echo "<th>".$r['amount']."</th>";

echo "</tr>";

}

echo "</table>";

}

else

{

echo"<b>Only stock Avaliable :$check_quantity Unit <brbr> There is no avaliable Stock</b>";

}

}

if(isset($_POST['additem']))

{

$item=$_POST['name'];

$quantity=$_POST['quantity'];

$amount=$_POST['amount'];

$total_amount = $quantity*$amount;

$sql="insert into stock(item,quantity,amount)values('$item','$quantity','$total_amount')";

$res=mysql_query($sql);

echo"<table border=2 align=center<tr<th>S.No</th<th>NAME</th<th>QUANTITY</th<th>AMOUNT</th>";

$sql="select * from stock";

$res=mysql_query($sql);

while($r=mysql_fetch_array($res))

{

echo "<tr>";

echo "<th>".$r['id']."</th>";

echo "<th>".$r['item']."</th>";

echo "<th>".$r['quantity']."</th>";

echo "<th>".$r['amount']."</th>";

echo "</tr>";

}

echo "</table>";

}

?>

</body>

</html>

<?php

include('phpgraphlib.php');

$graph = new PHPGraphLib(500,350);

mysql_connect("localhost","root","");

mysql_selectdb('stock');

$sql="select * from stock";

$res=mysql_query($sql);

while($r=mysql_fetch_array($res))

{

$id=$r['id'];

$item=$r['item'];

$quantity=$r['quantity'];

$amount=$r['amount'];

$data = array("Item"=>$item,"Quantity"=>$quantity,"Amount"=>$amount);

$graph->addData($data);

}

$graph->setTitle($item);

$graph->createGraph();

?>

CREATING STUDENT MARK STATEMENT USING PYTHON

print "------"

studid = int(raw_input("Enter the Student ID: "))

studname = raw_input("Enter the Student Name: ")

mark1 = int(raw_input("Enter the Mark1 "))

mark2 = int(raw_input("Enter the Mark2 "))

mark3 = int(raw_input("Enter the Mark3 "))

total = mark1 + mark2 + mark3

average = total / 3

if(mark1>=50 and mark2>=50 and mark3>=50):

result = "Pass"

else:

result = "Fail"

if(mark1>=50 and mark2>=50 and mark3>=50):

if(average>=80):

grade = "First Class with Distiniction"

elif(average>=60 and average<80):

grade = "First Class"

elif(average>=50 and average<60):

grade = "Second Class"

else:

grade = "No Class"

else:

grade = "No Class"

print "------"

print "The Student ID is: ",studid

print "The Student Name is: ",studname

print "The Mark1 is: ",mark1

print "The Mark2 is: ",mark2

print "The Mark3 is: ",mark3

print "The Total Mark is: ",total

print "The Average Mark is: ",average

print "The Student Result is: ",result

print "The Student Grade is: ",grade

print "------"

CREATING STUDENT MARK STATEMENT USING PERL

print "------";

print "\n";

print "Enter the Student ID: ";

$studid = <STDIN>;

print "Enter the Student Name: ";

$studname = <STDIN>;

print "Enter the Mark1: ";

$mark1 = <STDIN>;

print "Enter the Mark2: ";

$mark2 = <STDIN>;

print "Enter the Mark3: ";

$mark3 = <STDIN>;

$total = $mark1 + $mark2 + $mark3;

$average = $total / 3;

if($mark1>=50 & $mark2>=50 & $mark3>=50)

{

$result = "Pass";

}

else

{

$result = "Fail";

}

if($mark1>=50 & $mark2>=50 & $mark3>=50)

{

if($average>=80)

{

$grade = "First Class with Distiniction";

}

elsif($average>=60 & $average<80)

{

$grade = "First Class";

}

elsif($average>=50 & $average<60)

{

$grade = "Second Class";

}

else

{

$grade = "No Class";

}

}

else

{

$grade = "No Class";

}

print "------";

print "\n";

print "The Student ID is: ",$studid;

print "The Student Name is: ",$studname;

print "The Mark1 is: ",$mark1;

print "The Mark2 is: ",$mark2;

print "The Mark3 is: ",$mark3;

print "The Total Mark is: ",$total;

print "The Average Mark is: ",$average;

print "The Student Result is: ",$result;

print "The Student Grade is: ",$grade;

print "------"