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.191.200.151
<?php
include("sys_session.php");
include("sys_mainphp.php");
include("sys_connect.php");
$resp_mesg="";
$resp_stat="";
$resp_file="";
if($_POST['load_data']=='sele_dept')
{
if($type_id=='ADMIN')
{
$mysql="select * from masdept where fdeleted<>'T' order by fdeptcode";
}
elseif($type_id=='CHIEF')
{
$mysql="select * from masdept where fdepthead='$empl_id' and fdeleted<>'T' order by fdeptname";
}
else
{
$mysql="select * from masdept where fdeptcode='$dept_id' and fdeleted<>'T' order by fdeptcode";
}
$myres=mysqli_query($mycon,$mysql);
if(mysqli_num_rows($myres)>1)
{
echo "<option value=%>ALL DEPARTMENTS</option>";
}
while($row = mysqli_fetch_assoc($myres))
{
echo "<option value='$row[fdeptcode]'>$row[fdeptname]</option>";
}
}
if($_POST['load_data']=='grid_data')
{
$dept_code=$_POST['dept_code'];
$empl_stat=$_POST['empl_stat'];
$find_data=$_POST['find_data'];
require("sys_grid_data.php");
$i=1;
$grid_sele = "";
$grid_sele.= "select masempl.*,masdesn.*,masdept.fdeptstat,masdept.fdepthead from masempl,masdesn,masdept where ";
$grid_sele.= "masempl.fdeptcode like '$dept_code' and femplstat like '$empl_stat' and femplname like '%$find_data%' ";
$grid_sele.= "and ifnull(masempl.fdeleted,'F')<>'T' and masempl.fdesncode=masdesn.fdesncode ";
if($type_id=="ADMIN")
{
$grid_sele.= "and masempl.fdeptcode=masdept.fdeptcode ";
}
elseif ($type_id=="CHIEF")
{
$grid_sele.= "and masempl.fdeptcode=masdept.fdeptcode and masdept.fdepthead = '$empl_id' ";
}
else
{
$grid_sele.= "and masempl.fdeptcode=masdept.fdeptcode and masempl.fdeptcode = '$dept_id' ";
}
$grid_sele.= "order by fdeptcode,fdesnordr,masdesn.fdesncode,fempltype,femplname";
$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> Dept.</th>";
echo "<th> Code </th>";
echo "<th> Employee Name</th>";
echo "<th> Designation </th>";
echo "<th> Mobile </th>";
echo "<th> Type </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[femplcode]')>Edit</a>";
$page_link.=" | <a class='grid_link' href=# onClick=dele_data('$row[femplcode]')>Delete</a>";
if($row['femplstat']=='T'){$page_link.=" | <a class='grid_link' href=# onClick=inac_empl('$row[femplcode]')>Deactivate</a>";}
if($row['femplstat']!='T'){$page_link.=" | <a class='grid_link' href=# onClick=actv_empl('$row[femplcode]')>Activate</a>";}
if($row['fempltype']=='P') $empl_type="PERMANENT";
if($row['fempltype']=='T') $empl_type="TEMPORARY";
if($row['fsalrtype']=='0') $salr_type="-";
if($row['fsalrtype']=='C') $salr_type="CONSOLIDATED";
if($row['fsalrtype']=='D') $salr_type="DAILYWAGE";
$empl_stat = $row['femplstat']=='T' ? "ACTIVE" : "INACTIVE";
echo "<tr>";
echo "<td width=4% align=center>$i</td>";
echo "<td width=6% align=center>$row[fdeptcode]</td>";
echo "<td width=6% align=center>$row[femplcode]</td>";
echo "<td width=20% align=left>$row[femplname]</td>";
echo "<td width=16% align=left>$row[fdesnname]</td>";
echo "<td width=10% align=center>$row[femplmobl]</td>";
echo "<td width=10% align=center>$salr_type</td>";
echo "<td width='20%' align='left'>$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($load_data=='actv_empl')
{
$mysql="update masempl set femplstat='T' where femplcode='$_POST[prim_code]'";
$myres=mysqli_query($mycon,$mysql);
}
if($load_data=='inac_empl')
{
$mysql="update masempl set femplstat='F' where femplcode='$_POST[prim_code]'";
$myres=mysqli_query($mycon,$mysql);
}
if($_POST['load_data']=='dele_data')
{
$empl_code = $_POST['dele_code'];
$mysql="update masempl set fdeleted='T' where femplcode='$empl_code'";
$myres=mysqli_query($mycon,$mysql);
}
if($_POST['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 fdepthead='$empl_id' and fdeleted<>'T' order by fdeptname";
}
else
{
$mysql="select * from masdept where fdeptcode='$dept_id' and fdeleted<>'T' order by fdeptcode";
}
$myres=mysqli_query($mycon,$mysql);
if(mysqli_num_rows($myres)>1)
{
echo "<option value=%>--SELECT--</option>";
}
while($row = mysqli_fetch_assoc($myres))
{
echo "<option value='$row[fdeptcode]'>$row[fdeptname]</option>";
}
}
if($_POST['load_data']=='desn_data')
{
if($type_id=='ADMIN')
{
$mysql="select * from masdesn order by fdesnordr";
}
elseif($type_id=='CHIEF')
{
$mysql="select * from masdesn order by fdesnordr";
}
else
{
$mysql="select * from masdesn order by fdesnordr";
}
$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[fdesncode]'>$row[fdesnname]</option>";
}
}
if($_POST['load_data']=='bank_data')
{
$mysql="select * from masbank order by fbankcode";
$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[fbankcode]'>$row[fbankname]</option>";
}
}
if($_POST['load_data']=='disp_data')
{
$empl_code=$_POST['empl_code'];
$mysql="select * from masempl where femplcode='$empl_code'";
$myres=mysqli_query($mycon,$mysql);
$rows = array();
while($r = mysqli_fetch_assoc($myres))
{
$rows = $r;
}
echo json_encode($rows);
}
if($_POST['load_data']=='save_data')
{
$page_mode=$_POST['page_mode'];
$empl_name=strtoupper($_POST['empl_name']);
if($page_mode=="add")
{
$mysqlx="select * from masempl where femplname='$_POST[empl_name]' and fdeptcode='$_POST[dept_code]' and fdeleted<>'T'";
$myresx=mysqli_query($mycon,$mysqlx);
$mycnt=mysqli_num_rows($myresx);
if($mycnt!=0)
{
$resp_mesg="Employee already exists!";
$resp_stat="";
}
$mysql1="select * from sys_control";
$myres1=mysqli_query($mycon,$mysql1);
$row1 = mysqli_fetch_assoc($myres1);
$empl_slno=$row1["femplslno"] + 1;
$empl_code="E" . str_pad($empl_slno,3,'0',STR_PAD_LEFT);
$mysql = "";
$mysql.= "insert into masempl (femplcode,femplname,fdesncode,fdeptcode,fempltype,femplgend,femplbday,femplmobl,femplmail,";
$mysql.= "fsalrcomp,fsalrtype,fsalrbase,fsalrdays,fsalrhour,fjoindate,ftermdate,femplstat,fexpnentr,fattnentr,femplremk,";
$mysql.= "femplphot,ftotlcasl,fempladhr,facntname,facntnumb,fbankifsc,fbankcode,fdeleted) ";
$mysql.= "values('$empl_code','$empl_name','$_POST[desn_code]','$_POST[dept_code]','$_POST[empl_type]','$_POST[empl_gend]',";
$mysql.= "str_to_date('$_POST[empl_bday]','%d-%m-%Y'),'$_POST[empl_mobl]','$_POST[empl_mail]','$_POST[salr_comp]','$_POST[salr_type]',";
$mysql.= "'$_POST[salr_base]','$_POST[salr_days]','$_POST[salr_hour]',str_to_date('$_POST[join_date]','%d-%m-%Y'),";
$mysql.= "str_to_date('$_POST[term_date]','%d-%m-%Y'),'$_POST[empl_stat]','$_POST[expn_entr]','$_POST[attn_entr]','$_POST[empl_remk]',";
$mysql.= "'$_POST[empl_phot]','$_POST[totl_casl]','$_POST[empl_adhr]','$_POST[acnt_name]','$_POST[bank_acnt]',";
$mysql.= "'$_POST[bank_ifsc]','$_POST[bank_code]','F')";
$myres=mysqli_query($mycon,$mysql);
$mysql="update sys_control set femplslno='$empl_slno'";
$myres=mysqli_query($mycon,$mysql);
$resp_mesg="Details inserted!";
$resp_stat="T";
}
else
{
$mysql = "";
$mysql.= "update masempl set femplname='$empl_name',fdesncode='$_POST[desn_code]',fdeptcode='$_POST[dept_code]',";
$mysql.= "fempltype='$_POST[empl_type]',femplgend='$_POST[empl_gend]',femplbday=str_to_date('$_POST[empl_bday]','%d-%m-%Y'),";
$mysql.= "femplmobl='$_POST[empl_mobl]',femplmail='$_POST[empl_mail]',fsalrcomp='$_POST[salr_comp]',fsalrtype='$_POST[salr_type]',";
$mysql.= "fsalrbase='$_POST[salr_base]',fsalrdays='$_POST[salr_days]',fsalrhour='$_POST[salr_hour]',";
$mysql.= "fjoindate=str_to_date('$_POST[join_date]','%d-%m-%Y'),ftermdate=str_to_date('$_POST[term_date]','%d-%m-%Y'),";
$mysql.= "femplstat='$_POST[empl_stat]',fexpnentr='$_POST[expn_entr]',fattnentr='$_POST[attn_entr]',femplremk='$_POST[empl_remk]',";
$mysql.= "femplphot='$_POST[empl_phot]',fempladhr='$_POST[empl_adhr]',facntname='$_POST[acnt_name]',facntnumb='$_POST[bank_acnt]',";
$mysql.= "fbankifsc='$_POST[bank_ifsc]',fbankcode='$_POST[bank_code]',ftotlcasl='$_POST[totl_casl]',fdeleted='F' ";
$mysql.= "where femplcode='$_POST[empl_code]'";
$myres=mysqli_query($mycon,$mysql);
$resp_mesg="Details updated!";
$resp_stat="T";
}
echo json_encode(array("mesg"=>$resp_mesg, "stat"=>$resp_stat, "file"=>$resp_file));
}
?>
|