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.227.26.84
<?php
include("sys_session.php");
include("sys_mainphp.php");
include("sys_connect.php");
$resp_mesg="";
$resp_stat="";
$resp_file="";
if($_POST['load_data']=='grid_data')
{
$dept_code=$_POST['dept_code'];
$move_type=$_POST['move_type'];
$move_find=$_POST['move_find'];
require("sys_grid_data.php");
$i=1;
if($type_id=="ADMIN")
{
$grid_sele="select * from staffmove where fdeptcode='$dept_code' and fmovetype like '$move_type' and (fstrttown like '%$move_find%' or fdesttown like '%$move_find%') and fdeleted='F' order by fstrtdate desc";
}
elseif($type_id=="CHIEF")
{
$grid_sele="select * from staffmove where fdeptcode='$dept_code' and fmovetype like '$move_type' and (fstrttown like '%$move_find%' or fdesttown like '%$move_find%') and fdeleted='F' order by fstrtdate desc";
}
else
{
$grid_sele="select * from staffmove where fdeptcode='$dept_code' and fmovetype like '$move_type' and (fstrttown like '%$move_find%' or fdesttown like '%$move_find%') and femplcode='$empl_id' and fdeleted='F' order by fstrtdate desc";
}
$grid_para = grid_limit($grid_sele);
$page_numb = $grid_para[0];
$last_page = $grid_para[1];
$page_limt = $grid_para[2];
$lowr_limt = $grid_para[3];
$mysql = $grid_sele." limit $lowr_limt, $page_limt";
$myres = mysqli_query($mycon,$mysql);
$mycnt = mysqli_num_rows($myres);
if($mycnt>0)
{
echo "<table>";
echo "<thead>";
echo "<tr>";
echo "<th> # </th>";
echo "<th> Date</th>";
echo "<th> Dept</th>";
echo "<th> Name</th>";
echo "<th> From Place </th>";
echo "<th> To Place </th>";
echo "<th> Purpose </th>";
echo "<th> Action </th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_assoc($myres))
{
$page_link ="<a class='grid_link' href=# onClick=edit_data('$row[fmovecode]')>Edit</a> | ";
$page_link.="<a class='grid_link' href=# onClick=dele_data('$row[fmovecode]')>Delete</a>";
$strt_date = date('d-m-Y',strtotime($row["fstrtdate"]));
$empl_name = get_empl_name($row["femplcode"]);
echo "<tr>";
echo "<td width=4% align=center>$i</td>";
echo "<td width=10% align=center>$strt_date</td>";
echo "<td width=8% align=center>$row[fdeptcode]</td>";
echo "<td width=20% align=left>$empl_name</td>";
echo "<td width=15% align=center>$row[fstrttown]</td>";
echo "<td width=15% align=center>$row[fdesttown]</td>";
echo "<td width=12% align=center>$row[fmovetype]</td>";
echo "<td width='15%' align='center'>$page_link</td>";
echo "</tr>";
$i++;
}
echo "</tbody>";
echo "</table>";
include("sys_grid_navbar.php");
}
else
{
echo "<div class='alert alert-info'>No details found!</div>";
}
}
if($_POST['load_data']=='sele_dept')
{
if($type_id=='ADMIN')
{
$mysql="select * from masdept where fdeleted<>'T' and ifnull(fdeleted,'F')='F' order by fdeptcode";
}
elseif($type_id=='CHIEF')
{
$mysql="select * from masdept where fdepthead='$empl_id' and ifnull(fdeleted,'F')='F' 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);
while($row = mysqli_fetch_assoc($myres))
{
echo "<option value='$row[fdeptcode]'>$row[fdeptname]</option>";
}
}
if($_POST['load_data']=='dept_data')
{
if($type_id=='ADMIN')
{
$mysql="select * from masdept where fdeleted<>'T' and ifnull(fdeleted,'F')='F' order by fdeptcode";
}
elseif($type_id=='CHIEF')
{
$mysql="select * from masdept where fdepthead='$empl_id' and ifnull(fdeleted,'F')='F' 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($_POST['load_data']=='empl_data')
{
$dept_code=$_POST["dept_code"];
if($type_id=='ADMIN')
{
$mysql="select * from masempl where fdeptcode='$dept_code' and femplstat='T' order by femplname";
}
elseif($type_id=='CHIEF')
{
$mysql="select * from masempl where fdeptcode='$dept_code' and femplstat='T' order by femplname";
}
else
{
$mysql="select * from masempl where femplcode='$empl_id' and femplstat='T' order by femplname";
}
$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[femplcode]'>$row[femplname]</option>";
}
}
if($_POST['load_data']=='town_list')
{
$mysql="select * from mastown order by ftownname";
$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[ftownname]'>$row[ftownname]</option>";
}
}
if($_POST['load_data']=='disp_data')
{
$disp_code=$_POST['disp_code'];
$mysql="select * from staffmove where fmovecode='$disp_code'";
$myres=mysqli_query($mycon,$mysql);
$rows = array();
while($r = mysqli_fetch_assoc($myres))
{
$rows = $r;
}
echo json_encode($rows);
}
if($_POST['load_data']=='dele_data')
{
$dele_code = $_POST['dele_code'];
$mysql="update staffmove set fdeleted='T' where fmovecode='$dele_code'";
$myres=mysqli_query($mycon,$mysql);
}
if($_POST['load_data']=='save_data')
{
$page_mode=$_POST['page_mode'];
if($page_mode=="add")
{
$mysql ="insert into staffmove (fstrtdate, fdeptcode, femplcode, fstrttown, fdesttown, fmovetype, fmovestat, fmoveremk, ";
$mysql.="fupdtuser, fupdttime) values(str_to_date('$_POST[move_date]','%d-%m-%Y'), ";
$mysql.="'$_POST[dept_code]', '$_POST[empl_code]', '$_POST[strt_town]', '$_POST[dest_town]', ";
$mysql.="'$_POST[move_type]', '$_POST[move_stat]', '$_POST[move_remk]' , '$user_id' ,now())";
$myres=mysqli_query($mycon,$mysql);
$resp_mesg="Details inserted!";
}
else
{
$mysql ="update staffmove set fdeptcode='$_POST[dept_code]', femplcode='$_POST[empl_code]',";
$mysql.="fstrtdate=str_to_date('$_POST[move_date]','%d-%m-%Y'), ";
$mysql.="fstrttown='$_POST[strt_town]', fdesttown='$_POST[dest_town]', fmovetype='$_POST[move_type]', fmovestat='$_POST[move_stat]', ";
$mysql.="fmoveremk='$_POST[move_remk]', fupdtuser='$user_id', fupdttime=now() where fmovecode='$_POST[move_code]'";
$myres=mysqli_query($mycon,$mysql);
$resp_mesg="Details updated!";
}
echo json_encode(array("mesg"=>$resp_mesg, "stat"=>$resp_stat, "file"=>$resp_file));
}
?>
|