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 : 3.133.109.141
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/work_entry_org.php |
<?php
include("sys_session.php");
include("sys_connect.php");
include("sys_mainphp.php");
$resp_mesg="";
$resp_stat="";
$resp_file="";
if($_POST['load_data']=='grid_data')
{
$work_find=$_POST['work_find'];
require("sys_grid_data.php");
$i=1;
$grid_sele = "";
$grid_sele.= "select * from workentry where femplcode='$empl_id' and fworkname like '%$work_find%' and ifnull(fdeleted,'F')='F' ";
$grid_sele.= "order by fworkdate desc, fworkcode 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> Work Name </th>";
echo "<th> Status </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[fworkcode]')>Edit</a> | ";
$page_link.="<a class='grid_link' href=# onClick=dele_data('$row[fworkcode]')>Delete</a>";
echo "<tr id=$row[fworkcode]>";
echo "<td width=4% align=center>$i</td>";
echo "<td width=10% align=center>".date('d-m-Y',strtotime($row['fworkdate']))."</td>";
echo "<td width=50% align=left>".strtoupper($row['fworkname'])."</td>";
echo "<td width=15% align=center>$row[fworkstat]</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']=='dele_data')
{
$dele_code = $_POST['dele_code'];
$mysql="update workentry set fdeleted='T' where fworkcode='$dele_code'";
$myres=mysqli_query($mycon,$mysql);
}
if($_POST['load_data']=='disp_data')
{
$work_code=$_POST['work_code'];
$mysql="select * from workentry where fworkcode='$work_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'];
$work_code=$_POST['work_code'];
$work_name=$_POST['work_name'];
$work_detl=$_POST['work_detl'];
$work_stat=$_POST['work_stat'];
$work_remk=$_POST['work_remk'];
if($page_mode=="add")
{
$updt_time=date("d-m-Y H:i:s");
$mysql ="";
$mysql.="insert into workentry (femplcode,fworkdate, fworkname, fworkdetl, fworkremk, fworkstat, fupdtuser, fupdttime) ";
$mysql.="values('$empl_id', str_to_date('$_POST[work_date]','%d-%m-%Y') , '$_POST[work_name]', '$work_detl', ";
$mysql.="'$work_remk', '$work_stat', '$user_id',now())";
$myres=mysqli_query($mycon,$mysql);
$resp_stat="T";
$resp_mesg="Details inserted!";
}
else
{
$mysql ="update workentry set fworkname='$work_name', fworkdetl='$work_detl', fworkremk='$work_remk', fworkstat='$work_stat', ";
$mysql.=" fupdtuser='$user_id',fupdttime=now() where fworkcode='$work_code'";
$myres=mysqli_query($mycon,$mysql);
$resp_stat="T";
$resp_mesg="Details updated!";
}
echo json_encode(array("mesg"=>$resp_mesg, "stat"=>$resp_stat, "file"=>$resp_file));
}
?>
|