-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathallotment.php
112 lines (101 loc) · 4.08 KB
/
allotment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
include 'db.php';
include 'headlogout.php';
session_start();
$pDatabase=Database::getInstance();
$pis=$_SESSION['abc'];
$name=$_SESSION['name'];
//echo $pis;
$f="SELECT grade,executivesgrade,nonexecutivesgrade from application where pisno='$pis'";
$fa=$pDatabase->query($f);
$t=mysqli_fetch_assoc($fa);
$grade=$t['grade'];
$des=$t['executivesgrade'];
$desi=$t['nonexecutivesgrade'];
//*checking grade and alloting quarter
if($grade=="Executive")
{
if($des=="E1" || $des=="E2")
{
$qa="SELECT * from quarter where vaccancy='vaccant' and type='B' group by 'type' order by 'quarterno'";
$qat=$pDatabase->query($qa);
$fe=mysqli_fetch_assoc($qat);
$r=mysqli_num_rows($qat);
$quatno=$fe['quarterno'];
$sec=$fe['sector'];
$type=$fe['type'];
if($r!=0) /*checking vaccancy of corresponding type*/
{
$u=$pDatabase->query("UPDATE quarter SET vaccancy='alloted' where quarterno='$quatno' and type='B'");
//$o=$pDatabase->query("UPDATE application SET alloted='alloted' where pisno='$pis'");
$quer="INSERT INTO allocation values('$pis','$name','$sec','$quatno','$type')";
$up=$pDatabase->query($quer);
}
}
else if($des=="E3" || $des=="E4" || $des=="E5" || $des=="E6")
{
$qa="SELECT * from quarter where vaccancy='vaccant' and type='C' group by 'type' order by 'quarterno'";
$qat=$pDatabase->query($qa);
$fe=mysqli_fetch_assoc($qat);
$r=mysqli_num_rows($qat);
$quatno=$fe['quarterno'];
$sec=$fe['sector'];
$type=$fe['type'];
if($r!=0)
{
$u=$pDatabase->query("UPDATE quarter SET vaccancy='alloted' where quarterno='$quatno' and type='C'");
//echo "Success";
// $o=$pDatabase->query("UPDATE application SET alloted='alloted' where pisno='$pis'");
$quer="INSERT INTO allocation values('$pis','$name','$sec','$quatno','$type')";
$up=$pDatabase->query($quer);
//echo $pis."</br>".$name."</br>".$sec."</br>".$quatno;
}
}
elseif ($des=="E7" || $des=="E8")
{
$qa="SELECT * from quarter where vaccancy='vaccant' and type='D' group by 'type' order by 'quarterno'";
$qat=$pDatabase->query($qa);
$fe=mysqli_fetch_assoc($qat);
$r=mysqli_num_rows($qat);
$quatno=$fe['quarterno'];
$sec=$fe['sector'];
$type=$fe['type'];
if($r!=0)
{
$u=$pDatabase->query("UPDATE quarter SET vaccancy='alloted' where quarterno='$quatno' and type='D'");
echo "Success";
//$o=$pDatabase->query("UPDATE application SET alloted='alloted' where pisno='$pis'");
$quer="INSERT INTO allocation values('$pis','$name','$sec','$quatno','$type')";
$up=$pDatabase->query($quer);
//echo $pis."</br>".$name."</br>".$sec."</br>".$quatno;
//echo "Success";
}
}
}
else if($grade=="Non Executive")
{
if($desi=="Technician" || $desi=="Supervisor")
{
$qa="SELECT * from quarter where vaccancy='vaccant' and type='A' group by 'type' order by 'quarterno'";
$qat=$pDatabase->query($qa);
$fe=mysqli_fetch_assoc($qat);
$r=mysqli_num_rows($qat);
$quatno=$fe['quarterno'];
$sec=$fe['sector'];
$type=$fe['type'];
if($r!=0)
{
$u=$pDatabase->query("UPDATE quarter SET vaccancy='alloted' where quarterno='$quatno' and type='A'");
//$o=$pDatabase->query("UPDATE application SET alloted='alloted' where pisno='$pis'");
$quer="INSERT INTO allocation values('$pis','$name','$sec','$quatno','$type')";
$up=$pDatabase->query($quer);
}
}
}
echo"<script type='text/javascript'>alert('This application is approved successfully.')</script>";
?>
<html>
<body>
<meta http-equiv="refresh" content="0;url=admin.php">
</body>
</html>