$dta = printProfile($query);
     $qry = $objects['oprt']->dataAdaptor("fetchLeave", $emp_uname);
     $dt = getLeaveDetails($qry);
     $grandData['empDetail'] = $dta;
     $grandData['leaveDetail'] = $dt;
     //print_r($grandData);
     echo json_encode($grandData);
     $objects['obj']->db_close();
     break;
 case "viewMyProfile":
     $objects = createObject();
     $uname = $objects['sess']->getUser();
     $query = $objects['oprt']->dataAdaptor("viewFullProfile", $uname);
     $dta = printProfile($query);
     $qry = $objects['oprt']->dataAdaptor("fetchLeave", $uname);
     $dt = getLeaveDetails($qry);
     echo json_encode($dta + $dt);
     $objects['obj']->db_close();
     break;
 case "deleteEmpProfile":
     $objects = createObject();
     $uname = mysqli_real_escape_string($objects['obj']->reCon(), $data->emp_uname);
     $query = $objects['oprt']->dataAdaptor("deleteEmpProfile", $uname);
     $result = $objects['obj']->query_db($query);
     $qr = $objects['oprt']->dataAdaptor("deleteLog", $uname);
     $res = $objects['obj']->query_db($qr);
     displayMsgs($res, 'Profile Deleted Successfully', 'Error in Deleting profile !!!');
     $objects['obj']->db_close();
     break;
 case "deleteCommute":
     $objects = createObject();
Exemple #2
0
<?php

require 'core/init.php';
if (isset($_POST['approve'])) {
    if ($_POST['approve'] == "approve") {
        mysql_query("INSERT INTO leave_track VALUES('','Approve','{$userid}','{$_POST['id']}')");
        $query = mysql_query("SELECT * FROM employees_leave WHERE EmpLeave_ID={$_POST['id']}");
        $employees = mysql_result($query, 0, "Employees_ID");
        $leave = mysql_result($query, 0, "Leave_ID");
        $duration = getLeaveDetails($leave, "Duration");
        echo $duration;
        mysql_query("UPDATE performances SET Leave_Amount = Leave_Amount-'{$duration}' WHERE Employees_ID= '{$employees}'");
        header("Location:main.php?page=ApproveLeave");
        exit;
    } else {
        mysql_query("INSERT INTO leave_track VALUES('','Not Approve','{$userid}','{$_POST['id']}')");
        header("Location:main.php?page=ApproveLeave");
        exit;
    }
}
Exemple #3
0
</td>
</tr>
<?php 
$query = mysql_query("SELECT * \nFROM employees_leave\nWHERE Employees_ID\nIN (\n\nSELECT Employees_ID\nFROM employees \nWHERE Privilege= 'supervisor'\n)");
while ($result = mysql_fetch_assoc($query)) {
    $query2 = mysql_query("SELECT Approval,Approve_By  FROM leave_track WHERE EmpLeave_ID = '{$result['EmpLeave_ID']}'");
    if (mysql_num_rows($query2) == 0) {
        $approval = "<form action='approving-leave.php' method='POST' ><input type='submit' name='approve' value='approve'><input type='submit' name='approve' value='not-approve'><input type='hidden' name ='id' value=" . $result['EmpLeave_ID'] . "></form>";
    } else {
        if (mysql_result($query2, 0, "Approval") == "Approve") {
            $approval = "Approved";
        } else {
            $approval = "Not Approve";
        }
    }
    echo "<tr><td>" . $result['Employees_ID'] . "</td><td>" . getLeaveDetails($result['Leave_ID'], "Duration") . "</td><td>" . getLeaveDetails($result['Leave_ID'], "Starting_Date") . "</td><td>" . getLeaveDetails($result['Leave_ID'], "Reason") . "</td><td>" . $approval . "</td></tr>";
}
?>

</table>
</div>

	
          </div>
        </div>

      </div>

    </div>

   
Exemple #4
0
<?php 
if (getuserdetails($userid, 'Privilege') == "supervisor") {
    $query = mysql_query("SELECT * \nFROM employees_leave\nWHERE Employees_ID\nIN (\n\nSELECT Employees_ID\nFROM employees_department\nWHERE Department_ID\nIN (\n\nSELECT Department_ID\nFROM department\nWHERE Supervisor_ID =  '{$userid}' \n)\n)\nAND Employees_ID\nIN (\n\nSELECT Employees_ID\nFROM employees\nWHERE Privilege =  'normal'\n)");
} else {
    $query = mysql_query("SELECT * \nFROM employees_leave\nWHERE Employees_ID\nIN (\n\nSELECT Employees_ID\nFROM employees \nWHERE Privilege= 'supervisor'\n)");
}
while ($result = mysql_fetch_assoc($query)) {
    $query2 = mysql_query("SELECT Approval,Approve_By  FROM leave_track WHERE EmpLeave_ID = '{$result['EmpLeave_ID']}'");
    if (mysql_num_rows($query2) == 0) {
        if (getLeaveDetails($result['Leave_ID'], "Duration") > getleaveamount($result['Employees_ID'])) {
            $approval = "<form action='approving-leave.php' method='POST' ><input type='submit' name='approve' value='not-approve'><input type='hidden' name ='id' value=" . $result['EmpLeave_ID'] . "></form>";
        } else {
            $approval = "<form action='approving-leave.php' method='POST' ><input type='submit' name='approve' value='approve'><input type='submit' name='approve' value='not-approve'><input type='hidden' name ='id' value=" . $result['EmpLeave_ID'] . "></form>";
        }
    } else {
        if (mysql_result($query2, 0, "Approval") == "Approve") {
            $approval = "Approved";
        } else {
            $approval = "Not Approve";
        }
    }
    echo "<tr><td>\n\t\t\t\t<ul class='nav navbar-nav navbar-left navbar-user'>\n            <li class='dropdown alerts-dropdown'>\n\t\t\t<a href='#' class='dropdown-toggle' data-toggle='dropdown'> " . $result['Employees_ID'] . "<b class='caret'></b></a>\t\n\t\t\t\t<ul class='dropdown-menu'>\n\t\t\t   ";
    include 'user-status.php';
    echo "</ul>\n            </li></ul></td><td>" . getLeaveDetails($result['Leave_ID'], "Duration") . "</td><td>" . getLeaveDetails($result['Leave_ID'], "Starting_Date") . "</td><td>" . getLeaveDetails($result['Leave_ID'], "Reason") . "</td><td>" . $approval . "</td></tr>";
}
?>

</table>
</div>