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.118.33.130
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/upcoming_events.php |
<?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_type = $_POST['dept_type'];
$dept_stat = $_POST['dept_stat'];
$dept_find = $_POST['dept_find'];
require("sys_grid_data.php");
$i = 1;
if ($type_id == "ADMIN") {
$myqry = " ";
} else {
$myqry = " inner join masdept_user u on d.fdeptcode = u.fdeptcode and u.fusercode='$user_id' ";
}
$grid_sele = "select dp.fdeptcode as fdeptcode,fdeptname,fdeptshrt,fdeptlogo,dp.fdepttype,fdeptstat,fdepthead,
concat('[',dp.fdepthead,'] ',em.femplname) as lheadname
from masdept dp
left join masempl em on dp.fdepthead=em.femplcode
left join masdept_type mt on dp.fdepttype=mt.fdepttype " . $myqry . "
where (dp.fdeptcode like '%$dept_find%' or fdeptname like '%$dept_find%') and dp.fdepttype like '$dept_type' and fdeptstat like '$dept_stat'
and ifnull(dp.fdeleted,'F')<>'T'
order by ftypeordr,fdeptcode";
$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 class=''>";
echo "<thead>";
echo "<tr>";
echo "<th width='5%'> # </th>";
echo "<th width='8%'> Client Type </th>";
echo "<th width='8%'> Client Code </th>";
echo "<th width='30%'> Client Name </th>";
echo "<th width='8%'> Short Name </th>";
echo "<th width='20%'> Incharge </th>";
echo "<th width='10%'> Status </th>";
echo "<th width='15%'> Action </th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while ($myrow = mysqli_fetch_assoc($myres)) {
$page_link = "<a class='btn btn-success btn-sm' href=# onClick=edit_data('$myrow[fdeptcode]')><span class='glyphicon glyphicon-edit'></span></a>";
$page_link .= " <a class='btn btn-danger btn-sm' href=# onClick=dele_data('$myrow[fdeptcode]')><span class='glyphicon glyphicon-trash'></span></a>";
if ($myrow['fdeptstat'] == 'T') {
$page_link .= " <a class='btn btn-primary btn-sm' href=# onClick=inac_dept('$myrow[fdeptcode]')><span class='glyphicon glyphicon-remove'></span> Disable</a>";
}
if ($myrow['fdeptstat'] != 'T') {
$page_link .= " <a class='btn btn-primary btn-sm' href=# onClick=actv_dept('$myrow[fdeptcode]')><span class='glyphicon glyphicon-ok'></span> Enable</a>";
}
$dept_logo = strtolower("img-dept/" . $myrow['fdeptlogo']);
$dept_stat = $myrow['fdeptstat'] == 'T' ? "ACTIVE" : "INACTIVE";
echo "<tr>";
echo "<td align='center'>$i</td>";
echo "<td align='center'>$myrow[fdepttype]</td>";
echo "<td align='center'>$myrow[fdeptcode]</td>";
echo "<td align='left'> <img src='$dept_logo' height='30px' width='28px' style='border:1px solid #ccc;' align='absmiddle' alt=''> $myrow[fdeptname]</td>";
echo "<td align='center'>$myrow[fdeptshrt]</td>";
echo "<td align='left'> $myrow[lheadname]</td>";
echo "<td align='center'> $dept_stat</td>";
echo "<td 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 ($load_data == 'dept_head') {
$mysql = "select * from masempl where femplstat='T' and fusertype in (select fusertype from sys_user_type where fuserordr<2) order by femplname";
$myres = mysqli_query($mycon, $mysql);
if (mysqli_num_rows($myres) > 1) {
echo "<option value=0>--Select--</option>";
}
while ($myrow = mysqli_fetch_assoc($myres)) {
echo "<option value='$myrow[femplcode]'>$myrow[femplname]</option>";
}
}
if ($load_data == 'dept_time') {
$mysql = "select * from mastime order by ftimecode";
$myres = mysqli_query($mycon, $mysql);
if (mysqli_num_rows($myres) > 1) {
echo "<option value=0>--Select--</option>";
}
while ($myrow = mysqli_fetch_assoc($myres)) {
echo "<option value='$myrow[ftimecode]'>$myrow[ftimedesc]</option>";
}
}
if ($load_data == 'actv_dept') {
$mysql = "update masdept set fdeptstat='T' where fdeptcode='$_POST[prim_code]'";
$myres = mysqli_query($mycon, $mysql);
}
if ($load_data == 'inac_dept') {
$mysql = "update masdept set fdeptstat='F' where fdeptcode='$_POST[prim_code]'";
$myres = mysqli_query($mycon, $mysql);
}
if ($load_data == 'dele_data') {
$dept_code = $_POST['dele_code'];
$mysql = "update masdept 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 masdept where fdeptcode='$dept_code'";
$myres = mysqli_query($mycon, $mysql);
$myrows = array();
while ($r = mysqli_fetch_assoc($myres)) {
$myrows = $r;
}
echo json_encode($myrows);
}
if ($load_data == 'save_data') {
$page_mode = $_POST['page_mode'];
$dept_code = strtoupper($_POST['dept_code']);
$dept_name = strtoupper(str_replace("'", "`", $_POST['dept_name']));
$dept_logo = $_POST['dept_logo'];
$dept_logo = strtolower(str_replace(' ', '_', $dept_logo));
$mysql = "select * from masdept where fdeptcode='$_POST[dept_code]'";
$myres = mysqli_query($mycon, $mysql);
$mycnt = mysqli_num_rows($myres);
if ($page_mode == "add") {
if ($mycnt == 0) {
$mysql = "insert into masdept (fdeptcode,fdepttype,fdeptshrt,fdeptname,fdepthead,fdeptstat,fattnenbl,fexpnenbl,fsalrenbl,fcoderate,
fdeptbank,fcgpsaddr,flocation, fattnfrze,fexpnfrze,flogitime,flogotime,fsatdlogi,fsatdlogo,fdeptlogo,fdeleted)
values(
'$dept_code','$_POST[dept_type]','$_POST[dept_shrt]','$dept_name','$_POST[dept_head]','$_POST[dept_stat]',
'$_POST[attn_enbl]','$_POST[expn_enbl]','$_POST[salr_enbl]',
'$_POST[code_rate]','$_POST[dept_bank]',
'$_POST[cgps_addr]','$_POST[cgps_loca]',
str_to_date('$_POST[attn_frze]','%d/%m/%Y'),
str_to_date('$_POST[expn_frze]','%d/%m/%Y'),
'$_POST[logi_time]','$_POST[logo_time]',
'$_POST[satd_logi]','$_POST[satd_logo]',
'$dept_logo','F')";
$myres = mysqli_query($mycon, $mysql);
$resp_mesg = "New Client added!";
set_user_logs($dept_id, $user_id, 'DEPT', 'DEPARTMENT ADDED: ' . $_POST['dept_code']);
} else {
$resp_mesg = "Client already exists!";
$resp_stat = "F";
}
} else {
if ($mycnt == 0) {
$resp_mesg = "Client does not exists!";
$resp_stat = "F";
} else {
$mysql = "update masdept set fdeptshrt='$_POST[dept_shrt]',fdepttype='$_POST[dept_type]',fdeptname='$dept_name',fdepthead='$_POST[dept_head]',
fdeptstat='$_POST[dept_stat]',fattnenbl='$_POST[attn_enbl]',fexpnenbl='$_POST[expn_enbl]',fsalrenbl='$_POST[salr_enbl]',
fexpnfrze=str_to_date('$_POST[expn_frze]','%d/%m/%Y'), fattnfrze=str_to_date('$_POST[attn_frze]','%d/%m/%Y'),
flogitime='$_POST[logi_time]', flogotime='$_POST[logo_time]',
fsatdlogi='$_POST[satd_logi]', fsatdlogo='$_POST[satd_logo]',
fcoderate='$_POST[code_rate]', fdeptbank='$_POST[dept_bank]',
fcgpsaddr='$_POST[cgps_addr]',
flocation='$_POST[cgps_loca]',
fdeptlogo='$dept_logo' where fdeptcode='$dept_code'";
$myres = mysqli_query($mycon, $mysql);
$resp_mesg = "Details updated!";
set_user_logs($dept_id, $user_id, 'DEPT', 'DEPARTMENT UPDATED: ' . $_POST['dept_code']);
}
}
$mysql = "insert ignore into masattn_stat select '$dept_code' as fdeptcode,fattntype,fattnstat,fstatdesc,flogitime,flogotime,ftrvlamnt,fstatordr,fdeleted from masattn_stat where fdeptcode='000'";
$myres = mysqli_query($mycon, $mysql);
$mysql = "update masattn_stat set flogitime='$_POST[logi_time]',flogotime='$_POST[logo_time]' where fdeptcode ='$dept_code' and fattntype='PR'";
$myres = mysqli_query($mycon, $mysql);
echo json_encode(array("mesg" => $resp_mesg, "stat" => $resp_stat, "file" => $resp_file));
}
|