Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.117.101.250
<?php
include("sys_session.php");
include("sys_mainphp.php");
include("sys_connect.php");
$load_data=$_POST['load_data'];
$resp_mesg="";
$resp_stat="";
$resp_file="";
if($load_data=='grid_data')
{
$dept_code=$_POST['dept_code'];
$resn_code=$_POST['resn_code'];
$mcpr_stat=$_POST['mcpr_stat'];
$mcno_find=$_POST['mcno_find'];
if (!(isset($_POST['page_numb'])))
{$page_numb = 1;}
else
{$page_numb = intval($_POST['page_numb']);}
$page_limt = ($_POST["page_limt"] <> "" && is_numeric($_POST["page_limt"]) ) ? intval($_POST["page_limt"]) : 10;
$grid_query="select * from mcprint where fdeptcode='$dept_code' and (fstrtmcno like '%$mcno_find%' or flastmcno like '%$mcno_find%') and fresncode like '%$resn_code%' and ifnull(fdeleted,'F')<>'T' order by fdeptcode,fstrtmcno";
$myres=mysqli_query($mycon,$grid_query);
$mycnt=mysqli_num_rows($myres);
$last_page=ceil($mycnt/$page_limt);
if ($page_numb < 1)
{$page_numb = 1;}
elseif ($page_numb > $last_page)
{$page_numb = $last_page;}
if($last_page==0)
{$lowr_limt = ($page_numb) * $page_limt;}
else
{$lowr_limt = ($page_numb-1) * $page_limt;}
$mysql=$grid_query." limit $lowr_limt, $page_limt";
if($myres=mysqli_query($mycon,$mysql))
{
$i=1;
echo "<table class='table_grid' border=1>";
echo "<tr>";
echo "<th> # </th>";
echo "<th> Dept. </th>";
echo "<th> Exam Date </th>";
echo "<th> Degree </th>";
echo "<th> Exam </th>";
echo "<th> College </th>";
echo "<th> Reg. No. </th>";
echo "<th> Start MC </th>";
echo "<th> Ending MC </th>";
echo "<th> Total </th>";
echo "<th> Reason </th>";
echo "<th> MC Date </th>";
echo "<th> Status </th>";
echo "<th> Action </th>";
echo "</tr>";
while($row = mysqli_fetch_assoc($myres))
{
$page_link ="<a class='grid_link' href=# onClick=edit_data('$row[fdeptcode]')>Edit</a> | ";
$page_link.="<a class='grid_link' href=# onClick=dele_data('$row[fdeptcode]')>Delete</a>";
$mcpr_stat = $row['fmcissued']=='T' ? "ISSUED" : "NOT ISSUED";
echo "<tr>";
echo "<td width='4%' align='center'> $i</td>";
echo "<td width='06%' align='center'>$row[fdeptcode]</td>";
echo "<td width='08%' align='center'>$row[fexamdate]</td>";
echo "<td width='06%' align='center'>$row[fdegrcode]</td>";
echo "<td width='06%' align='center'>$row[fexamcode]</td>";
echo "<td width='06%' align='center'>$row[fcollcode]</td>";
echo "<td width='08%' align='center'>$row[fregrcode]</td>";
echo "<td width='08%' align='center'>$row[fstrtmcno]</td>";
echo "<td width='08%' align='center'>$row[flastmcno]</td>";
echo "<td width='06%' align='center'>$row[ftotlmcno]</td>";
echo "<td width='06%' align='center'>$row[fresncode]</td>";
echo "<td width='08%' align='center'>$row[fmcnodate]</td>";
echo "<td width='08%' align='center'>$mcpr_stat</td>";
echo "<td width='15%' align='center'>$page_link</td>";
echo "</tr>";
$i++;
}
//NAVIGATION
echo "<tr>";
echo "<th align='center' colspan='99'>";
echo "<div style='width:80%;float:left;text-align:left;'>Pages: ";
if (($page_numb-1) > 0)
{
echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,1);'> First</a>";
echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,$page_numb-1);'> Previous</a>";
}
for($i=1; $i<=$last_page; $i++)
{
if ($i == $page_numb){echo "<a href='javascript:void(0);' class='selected'> $i</a>";}
else{echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,$i);'> $i</a>";}
}
if (($page_numb+1) <= $last_page){echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,$page_numb+1);'> Next</a>";}
if (($page_numb) != $last_page){echo "<a href='javascript:void(0);' onclick='load_grid_data($page_limt,$last_page);'> Last</a>";}
echo "</div>";
echo "<div style='width:20%;float:right; text-align:right;'>Rows / Page - ";
echo "<select onChange='load_page_limt(this.value);' style='width:50px;'>";
?>
<option value="13" <?php if ($_POST["page_limt"] == 13) { echo ' selected="selected"'; } ?> >13</option>
<option value="20" <?php if ($_POST["page_limt"] == 20) { echo ' selected="selected"'; } ?> >20</option>
<option value="40" <?php if ($_POST["page_limt"] == 40) { echo ' selected="selected"'; } ?> >40</option>
<option value="50" <?php if ($_POST["page_limt"] == 50) { echo ' selected="selected"'; } ?> >50</option>
<option value="100" <?php if ($_POST["page_limt"] == 100) { echo ' selected="selected"'; } ?> >100</option>
<?php
echo "</select>";
echo "</div>";
echo "</th>";
echo "</tr>";
echo "</table>";
//NAVIGATION ENDS
}
}
if($load_data=='dept_data')
{
if($type_id=='ADMIN')
{
$mysql="select * from masdept where fdeleted<>'T' order by fdeptcode";
}
elseif($type_id=='CHIEF')
{
$mysql="select * from masdept where fdeptstat='T' and fdepthead='$empl_id' order by fdeptname";
}
else
{
$mysql="select * from masdept where fdeptcode='$dept_id' and ifnull(fdeleted,'F')='F' order by fdeptcode";
}
$myres=mysqli_query($mycon,$mysql);
if(mysqli_num_rows($myres)>1)
{
echo "<option value=0>--Select--</option>";
}
while($row = mysqli_fetch_assoc($myres))
{
echo "<option value='$row[fdeptcode]'>$row[fdeptname]</option>";
}
}
if($load_data=='exam_data')
{
$dept_code=$_POST['dept_code'];
$mysql="select * from masmcexam where fdeptcode='$dept_code' and fdeleted<>'T' order by fyearmode";
$myres=mysqli_query($mycon,$mysql);
if(mysqli_num_rows($myres)>1)
{
echo "<option value=%>ALL [EXAM]</option>";
}
while($row = mysqli_fetch_assoc($myres))
{
echo "<option value='$row[fyearmode]'>$row[fexamdate]</option>";
}
}
if($load_data=='resn_data')
{
$mysql="select * from masmcresn where fdeleted<>'T' order by fresncode";
$myres=mysqli_query($mycon,$mysql);
if(mysqli_num_rows($myres)>1)
{
echo "<option value=%>ALL [REASON]</option>";
}
while($row = mysqli_fetch_assoc($myres))
{
echo "<option value='$row[fresncode]'>$row[fresndesc]</option>";
}
}
if($load_data=='dele_data')
{
$dept_code = $_POST['dele_code'];
$mysql="update mcprint set fdeleted='T' where fdeptcode='$dept_code'";
$myres=mysqli_query($mycon,$mysql);
}
if($load_data=='disp_data')
{
$dept_code=$_POST['dept_code'];
$mysql="select * from mcprint where fdeptcode='$dept_code'";
$myres=mysqli_query($mycon,$mysql);
$rows = array();
while($r = mysqli_fetch_assoc($myres))
{
$rows = $r;
}
echo json_encode($rows);
}
if($load_data=='save_data')
{
$page_mode=$_POST['page_mode'];
$dept_code=$_POST['dept_code'];
$dept_name=$_POST['dept_name'];
$dept_head=$_POST['dept_head'];
$dept_stat=$_POST['dept_stat'];
$attn_updt=$_POST['attn_updt'];
$salr_comp=$_POST['salr_comp'];
$logi_time=$_POST['logi_time'];
$logo_time=$_POST['logo_time'];
$expn_date=$_POST['expn_date'];
$code_rate=$_POST['code_rate'];
$dept_bank=$_POST['dept_bank'];
$mysql="select * from mcprint where fdeptcode='$dept_code'";
$myres=mysqli_query($mycon,$mysql);
$mycnt=mysqli_num_rows($myres);
if($page_mode=="add")
{
if($mycnt==0)
{
$mysql="insert into mcprint (fdeptcode,fdeptname,fdepthead, fdeptstat, fattnupdt, fsalrcomp, fcoderate,fdeptbank,fdeleted) values('$dept_code','$dept_name','$dept_head' ,'$dept_stat','$attn_updt','$salr_comp', '$code_rate','$dept_bank','F')";
$myres=mysqli_query($mycon,$mysql);
$resp_mesg="Details inserted!";
}
else
{
$resp_mesg="Department already exists!";
$resp_stat="F";
}
}
else
{
if($mycnt==0)
{
$resp_mesg="Department does not exists!";
$resp_stat="F";
}
else
{
$mysql="update mcprint set fdeptname='$dept_name',fdepthead='$dept_head', fdeptstat='$dept_stat', fattnupdt='$attn_updt', fsalrcomp='$salr_comp', flogitime='$logi_time', flogotime='$logo_time' , fexpndate=str_to_date('$expn_date','%d-%m-%Y'), fcoderate='$code_rate' , fdeptbank='$dept_bank' where fdeptcode='$dept_code'";
$myres=mysqli_query($mycon,$mysql);
$resp_mesg="Details updated!";
}
}
echo json_encode(array("mesg"=>$resp_mesg, "stat"=>$resp_stat, "file"=>$resp_file));
}
?>
|