Sh3ll
OdayForums


Server : Apache
System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64
User : apache ( 48)
PHP Version : 8.0.28
Disable Function : NONE
Directory :  /var/www/html/mmishra/erp-15-06-18/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/mmishra/erp-15-06-18/views/hr_view.php
<?php

class hrView {
    const TRUE = 1;
    const FALSE = 0;

    var $action;
    var $error;

    //****************************department variables
    var $sID;
    var $sessionID;
    var $loginID;
    var $userIP;
    var $timeLogin;
    var $timeLogout;
    var $duration;

    //****************************designation variables
    var $logID;
    //var $loginID;
    //var $userIP;
    var $appURL;
    var $referer;
    var $timeAccess;

    //****************************payband variables;
    var $sqlID;
    var $tableID;
    var $tupleID;
    var $sqlCommand;
    //var timeAccess;
    //var $userID;

    //****************************employee roll variables;
    //var $recordID;
    //var $userIP;
    var $userText;
    //var $timeAccess;

    //****************************leave records variables
    var $wingID;
    var $wingName;
    var $description;
    var $wingIcon;
    var $iconColor;
    var $wingDept;
    var $wingAdmin;
    var $adminEmail;
    var $status;

    //****************************leave apps variables
    var $appID;
    var $appName;
    //var $description;
    //var $appURL;
    var $appIcon;
    //var $iconColor;
    var $appDept;
    var $appAdmin;
    //var $adminEmail;
    var $universal;
    //var $status;


    public function __construct() {
        //initialize variables
        $this->status = 'Enabled';
        $this->error = '';

        date_default_timezone_set('Asia/Kolkata');

        //connect database
        $con = mysql_connect('localhost', 'erp', 'erpa2018');
        if (!$con) {
            die('Connection error: ' .mysql_error());
        } else {
            mysql_select_db('erp_hrm');
        }
    }

    public function __destruct() {
    }

	function hrDashboard() {
		$str = "<b>Summary</b>
		<table class='report' style='width:20%' align='left'>";

		$rs = mysql_query("select count(wingID) as no from erp_wings");
		if (mysql_num_rows($rs)) {
			$o = mysql_fetch_object($rs);
			$str .= "<tr><td nowrap>ERP Wings</td><th>$o->no</th></tr>";
		}	

		$rs = mysql_query("select count(cadreID) as no from hr_cadres");
		if (mysql_num_rows($rs)) {
			$o = mysql_fetch_object($rs);
			$str .= "<tr><td nowrap>Cadres</td><th>$o->no</th></tr>";
		}	

		$rs = mysql_query("select count(desigID) as no from hr_designations");
		if (mysql_num_rows($rs)) {
			$o = mysql_fetch_object($rs);
			$str .= "<tr><td nowrap>Designations</td><th>$o->no</th></tr>";
		}	

		$rs = mysql_query("select count(leaveID) as no from hr_leavetypes");
		if (mysql_num_rows($rs)) {
			$o = mysql_fetch_object($rs);
			$str .= "<tr><td nowrap>Leaves</td><th>$o->no</th></tr>";
		}	

		$rs = mysql_query("select count(payID) as no from hr_paybands");
		if (mysql_num_rows($rs)) {
			$o = mysql_fetch_object($rs);
			$str .= "<tr><td nowrap>Paybands</td><th>$o->no</th></tr>";
		}	

		$rs = mysql_query("select count(deptID) as no from hr_departments");
		if (mysql_num_rows($rs)) {
			$o = mysql_fetch_object($rs);
			$str .= "<tr><td nowrap>Departments</td><th>$o->no</th></tr>";
		}	

		$str .= "</table>";

		return $str;
	}
	
	function toolBar($pKey='') {
		$str = "<span style='letter-spacing: 1px'>";
		if ($this->tupleID) {
			$str .= "<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=new'); return false;\" title='New record'><i style='font-size: 15pt' class='far fa-file'></i></a>&nbsp;&nbsp;
			<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=edit'); return false;\" title='Edit record'><i style='font-size: 15pt' class='far fa-edit'></i></a>&nbsp;&nbsp;
			<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=save'); return false;\" title='Save record'><i style='font-size: 15pt' class='far fa-save'></i></a>&nbsp;&nbsp;";
			//if ($_REQUEST['action'] == 'edit') {
			//	$str .= "<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=save'); return false;\" title='Save record'><i style='font-size: 15pt' class='far fa-save'></i></a>&nbsp;&nbsp;";
			//} else {
			//	$str .= "<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=edit'); return false;\" title='Edit record'><i style='font-size: 15pt' class='far fa-edit'></i></a>&nbsp;&nbsp;";
			//}
			$str .= "<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=up'); return false;\" title='Move upward'><i style='font-size: 15pt' class='fas fa-arrow-up'></i></a>&nbsp;&nbsp;
			<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=down'); return false;\" title='Move downward'><i style='font-size: 15pt' class='fas fa-arrow-down'></i></a>&nbsp;&nbsp;";
			if ($this->status == 'Enabled') {
				$str .= "<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=disable'); return false;\" title='Disable record'><i style='font-size: 15pt' class='far fa-thumbs-down'></i></a>&nbsp;&nbsp;
				<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=enable'); return false;\" title='Enable record'><i style='font-size: 15pt' class='far fa-thumbs-up'></i></a>&nbsp;&nbsp;";
			} else {
				$str .= "<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=disable'); return false;\" title='Disable record'><i style='font-size: 15pt' class='far fa-thumbs-down'></i></a>&nbsp;&nbsp;
				<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=enable'); return false;\" title='Enable record'><i style='font-size: 15pt' class='far fa-thumbs-up'></i></a>&nbsp;&nbsp;";
			}
			$str .= "<a href='' onclick=\"printMe('content'); return false;\" title='Print record'><i style='font-size: 15pt' class='fa fa-print'></i></a>&nbsp;&nbsp;";
			
			$str .= "<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=trash'); return false;\" title='Delete record'><i style='font-size: 15pt' class='far fa-trash-alt'></i></a>&nbsp;&nbsp;";
			if ($_REQUEST['action'] == 'trash') {
				$str .= "Are you sure? 
				[ <a href='' onclick=\"postAction('pageID0=$this->pageID0&$pKey=$this->tupleID&action=delete'); return false;\" title='Confirm deletion'><i style='font-size: 15pt' class='far fa-check-circle'></i></a> | 
				<a href='' onclick=\"postAction('pageID0=$this->pageID0&$pKey=$this->tupleID&action=edit'); return false;\" title='Revert back'><i style='font-size: 15pt' class='far fa-times-circle'></i></a> ]&nbsp;&nbsp;";
			}
		} else { 
			$str .= "<a href='' onclick=\"postAction('pageID0=$this->pageID0&action=save'); return false;\" title='Save record'><i style='font-size: 15pt' class='far fa-save'></i></a>&nbsp;&nbsp;";
		}

		$str .= "</span>";
		
		return $str;
	}
	
	//*******************************cadre functions
	function viewInterface() {
		$myHR = new hrModel();
		$this->getCadre($id);
		
		$str = "<h3><i class='fab fa-cadre'></i> Employee Cadres</h3>
		<table width='100%'><tr><th width='70%'>Cadre Details<br></th><th width='30%'>Employee Cadres</th></tr>
		<tr valign='top'><td>
		<table class='interface'>
		<tr><td nowrap>Cadre Name</td><td><input type='text' name='cadreName' size='50' value='$myHR->cadreName' $ro></td></tr>
		</table>
		<input type='hidden' name='cadreID' value='$myHR->cadreID'>
		</td><td>" .$this->listCadres(). "</td></tr>
		</table>";
		
		echo $str;
	}
	
	function getCadre() {
		$this->tableID = 'hr_cadres';
		$this->tupleID = $this->cadreID;
		$rs = mysql_query("select * from $this->tableID where cadreID=$this->tupleID");
		if (mysql_num_rows($rs)) {
			$o = mysql_fetch_object($rs);
			$this->cadreName = $o->cadreName;
			$this->status = $o->status;
		}
	}

	function selectCadre() {
		$str = "<select name='cadreID'>";
		$rs = mysql_query("select * from hr_cadres where status='Enabled' order by cadreID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= "<option value='$o->cadreID'" .($this->cadreID == $o->cadreID ? ' selected' : ''). ">$o->cadreName</option>";
		}
		$str .= "</select>";
		
		return $str;
	}

	function listCadres() {
		$str = '<ul>';
		$rs = mysql_query("select * from hr_cadres order by cadreID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= '<li>';
			if ($o->cadreID == $this->cadreID) {
				$str .= "<b>$o->cadreName</b>";
			} else {
				$str .= "<a href='' onclick=\"refreshContent('pageID0=$this->pageID0&cadreID=$o->cadreID&tableID=hr_cadres&tupleID=$o->cadreID'); return false;\">$o->cadreName</a>";
			}
			$str .= '</li>';
		}
		$str .= '</ul>';
		
		return $str;
	}
	
	//*******************************department functions
	function getDepartment() {
		$this->tableID = 'erp_wings';
		$this->tupleID = $this->wingID;
		$rs = mysql_query("select * from $this->tableID where wingID=$this->tupleID");
		if (mysql_num_rows($rs)) {
			$o = mysql_fetch_object($rs);
			$this->wingName = $o->wingName;
			$this->description = $o->description;
			$this->wingIcon = $o->wingIcon;
			$this->iconColor = $o->iconColor;
			$this->wingDept = $o->wingDept;
			$this->wingAdmin = $o->wingAdmin;
			$this->adminEmail = $o->adminEmail;
			$this->status = $o->status;
		}
	}

	function selectDepartment() {
		$str = "<table width='200px'>";
		$rs = mysql_query("select * from erp_wings where status='Enabled' order by wingID");
		while ($o = mysql_fetch_object($rs)) {
			if ($this->wingID0 == $o->wingID) 
				$str .= "<tr><td align='center'><i class='$o->wingIcon' style='font-size:20px'></i></td><td><b>$o->wingName <i class='fas fa-check'></i></b></td></tr>";
			else
				$str .= "<tr><td align='center'><a href='' onclick=\"refreshPayband('wingID0=$o->wingID'); return false;\" title='$o->description'><i class='$o->wingIcon' style='font-size:20px'></i></a></td><td> $o->wingName</td></tr>";
		}
		$str .= "</table>";
		
		return $str;
	}

	function listDepartments() {
		$str = '<ul>';
		$rs = mysql_query("select * from erp_wings order by wingID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= '<li>';
			if ($o->wingID == $this->wingID) {
				$str .= "<b>$o->wingName</b>";
			} else {
				$str .= "<a href='' onclick=\"refreshContent('pageID0=$this->pageID0&wingID=$o->wingID&tableID=erp_wings&tupleID=$o->wingID'); return false;\">$o->wingName</a>";
			}
			$str .= '</li>';
		}
		$str .= '</ul>';
		
		return $str;
	}
	
		
	//*******************************designation functions
	function getDesignation() {
		$this->tableID = 'erp_apps';
		$this->tupleID = $this->appID;
		$rs = mysql_query("select * from erp_apps where appID=$this->tupleID");
		while ($o = mysql_fetch_object($rs)) {
			$this->appName = $o->appName;
			$this->description = $o->description;
			$this->appURL = $o->appURL;
			$this->appIcon = $o->appIcon;
			$this->iconColor = $o->iconColor;
			$this->appDept = $o->appDept;
			$this->appAdmin = $o->appAdmin;
			$this->adminEmail = $o->adminEmail;
			$this->universal = $o->universal;
			$this->status = $o->status;
		}
	}

	function selectDesignation() {
		$str = "<select name='appID'><option value='0'></option>";		
		$rs = mysql_query("select * from erp_apps where wingID=$this->wingID0 order by appName");
		while ($o = mysql_fetch_object($rs)) {
			$str .= "<option value='$o->appID'" .($o->appID == $this->appID ? ' selected' : ''). ">$o->appName</option>";
		}
		$str .= '</select>';

		return $str;
	}

	function listDesignations() {
		$str = '<ul>';
		$rs = mysql_query("select a.*,w.wingName from erp_apps as a, erp_wings as w where a.wingID=w.wingID and w.wingID=$this->wingID0 order by appID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= '<li>';
			if ($o->appID == $this->appID) {
				$str .= "<b>$o->wingName > $o->appName</b>";
			} else {
				$str .= "<a href='' onclick=\"refreshContent('pageID0=$this->pageID0&appID=$o->appID&tableID=erp_apps&tupleID=$o->appID'); return false;\">$o->wingName > $o->appName</a>";
			}
			$str .= '</li>';
		}
		$str .= '</ul>';
		
		return $str;
	}
	
	
	//*******************************payband functions
	function getPayband() {
		$this->tableID = 'erp_menus';
		$this->tupleID = $this->menuID;
		$rs = mysql_query("select * from erp_menus where menuID=$this->tupleID");
		while ($o = mysql_fetch_object($rs)) {
			$this->appID = $o->appID;
			$this->interface = $o->interface;
			$this->menuName = $o->menuName;
			$this->description = $o->description;
			$this->menuURL = $o->menuURL;
			$this->menuIcon = $o->menuIcon;
			$this->protection = $o->protection;
			$this->status = $o->status;
		}
	}

	function selectPayband() {
		$str = "<select name='menuID'><option value='0'></option>";		
		$rs = mysql_query("select * from erp_menus order by appID,menuID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= "<option value='$o->menuID'" .($o->menuID == $this->menuID ? ' selected' : ''). ">$o->menuName</option>";
		}
		$str .= '</select>';
		
		return $str;
	}

	function listPaybands() {
		$str = '<ul>';
		$rs = mysql_query("select m.*,a.appName,w.wingName from erp_menus as m,erp_apps as a, erp_wings as w where m.appID=a.appID and a.wingID=w.wingID and w.wingID=$this->wingID0 order by wingName,appName,interface,menuID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= '<li>';
			if ($o->menuID == $this->menuID) {
				$str .= "<b>$o->wingName > $o->appName > $o->menuName</b>";
			} else {
				$str .= "<a href='' onclick=\"refreshContent('pageID0=$this->pageID0&&menuID=$o->menuID&tableID=erp_menus&tupleID=$o->menuID'); return false;\">$o->wingName > $o->appName > $o->menuName</a>";
			}
			$str .= '</li>';
		}
		$str .= '</ul>';
		
		return $str;
	}
	

	//*******************************employee functions
	function getEmployee() {
		$this->tableID = 'erp_groups';
		$this->tupleID = $this->groupID;
		$rs = mysql_query("select * from erp_groups where groupID=$this->tupleID");
		while ($o = mysql_fetch_object($rs)) {
			$this->groupName = $o->groupName;
			$this->aclInsert = $o->aclInsert;
			$this->aclUpdate = $o->aclUpdate;
			$this->aclDelete = $o->aclDelete;
			$this->status = $o->status;
		}
	}

	function selectEmployee() {
		$str = "<select name='groupID'><option value='0'></option>";		
		$rs = mysql_query("select * from erp_groups order by groupName");
		while ($o = mysql_fetch_object($rs)) {
			$str .= "<option value='$o->groupID'" .($o->groupID == $this->groupID ? ' selected' : ''). ">$o->groupName</option>";
		}
		$str .= '</select>';
		
		return $str;
	}

	function listEmployees() {
		$str = '<ul>'; 
		$rs = mysql_query("select * from erp_groups order by groupName");
		while ($o = mysql_fetch_object($rs)) {
			$str .= '<li>';
			if ($o->groupID == $this->groupID) {
				$str .= "<b>$o->groupName</b>";
			} else {
				$str .= "<a href='' onclick=\"refreshContent('pageID0=$this->pageID0&groupID=$o->groupID&tableID=erp_groups&tupleID=$o->groupID'); return false;\">$o->groupName</a>";
			}
			$str .= '</li>';
		}
		$str .= '</ul>';
		
		return $str;
	}
	
	//*******************************leave record functions
	function getLeave() {
		$this->tableID = 'erp_users';
		$this->tupleID = $this->userID;
		$rs = mysql_query("select * from erp_users where userID=$this->tupleID");
		while ($o = mysql_fetch_object($rs)) {
			$this->loginID = $o->loginID;
			$this->groupID = $o->groupID;
			$this->aclInsert = $o->aclInsert;
			$this->aclUpdate = $o->aclUpdate;
			$this->aclDelete = $o->aclDelete;
			$this->status = $o->status;
		}
	}

	function selectLeave() {
		$str = "<select name='userID'><option value='0'></option>";		
		$rs = mysql_query("select * from erp_users order by loginID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= "<option value='$o->userID'" .($o->userID == $this->userID ? ' selected' : ''). ">$o->loginID</option>";
		}
		$str .= '</select>';
		
		return $str;
	}

	function listLeaves() {
		$str = '<ul>'; 
		$rs = mysql_query("select u.*,g.groupName from erp_users as u,erp_groups as g where u.groupID=g.groupID order by groupName,loginID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= '<li>';
			if ($o->userID == $this->userID) {
				$str .= "<b>$o->groupName > $o->loginID</b>";
			} else {
				$str .= "<a href='' onclick=\"refreshContent('pageID0=$this->pageID0&userID=$o->userID&tableID=erp_users&tupleID=$o->userID'); return false;\">$o->groupName > $o->loginID</a>";
			}
			$str .= '</li>';
		}
		$str .= '</ul>';
		
		return $str;
	}
	
	//*******************************leave app functions
	function getLeaveapp() {
		$this->tableID = 'erp_acls';
		$this->tupleID = $this->aclID;
		$rs = mysql_query("select * from erp_acls where aclID=$this->tupleID");
		while ($o = mysql_fetch_object($rs)) {
			$this->menuID = $o->menuID;
			$this->userID = $o->userID;
			$this->aclInsert = $o->aclInsert;
			$this->aclUpdate = $o->aclUpdate;
			$this->aclDelete = $o->aclDelete;
			$this->status = $o->status;
		}
	}

	function listLeaveapps() {
		$str = '<ul>'; 
		$rs = mysql_query("select a.*,m.menuName,u.loginID from erp_acls as a, erp_menus as m, erp_users as u where a.menuID=m.menuID and a.userID=u.userID order by a.userID,aclID");
		while ($o = mysql_fetch_object($rs)) {
			$str .= '<li>';
			if ($o->aclID == $this->aclID) {
				$str .= "<b>$o->loginID > $o->menuName</b>";
			} else {
				$str .= "<a href='' onclick=\"refreshContent('pageID0=$this->pageID0&aclID=$o->aclID&tableID=erp_acls&tupleID=$o->aclID'); return false;\">$o->loginID > $o->menuName</a>";
			}
			$str .= '</li>';
		}
		$str .= '</ul>';
		
		return $str;
	}
	

}


?>

ZeroDay Forums Mini