Location: PHPKode > projects > E-hris > general.php
<? 
  session_start();
  /*
   * e-hris (E-Human Resource Information System v 1.2.1) Is an open source human resource information management system
   * developed to automate all aspects of human resource management, with the dual benefits of reducing the workload of the HR department as well as increasing the efficiency of the department by standardising
   * HR processes for any organization from small-enterprises to large scale organizations.
   * Copyright (C) 2008  David Muturi

   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.

   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.

   * You should have received a copy of the GNU General Public License
   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>General</title>

	<link rel="stylesheet" type="text/css" href="css/employees.css" />
	<link rel="stylesheet" type="text/css" href="css/main.css"/>
	<link rel="stylesheet" href="js/example.css" TYPE="text/css" MEDIA="screen">
	<link href="css/text.css" rel="stylesheet" type="text/css" />

	<title> Employee/Staff Profile</title>
<style type="text/css">
<!--
.info   { color: black; background-color: transparent; font-weight: normal; }
  .warn   { color: rgb(120,0,0); background-color: transparent; font-weight: normal; }
  .error  { color: red; background-color: transparent; font-weight: bold }

-->
</style>
 
 <link rel="stylesheet" type="text/css" href="ajaxtabs/ajaxtabs.css" />
<link rel="stylesheet" type="text/css" href="css/jqueryslidemenu.css" />
 <style type="text/css">
<!--
h2
{
	color:#51790E;
	font-family: "Times New Roman", Times, serif;
	font-size: 30px;
	line-height: 30px;
	padding: 0px;
	margin-top: 20px;
	margin-right: 0px;
	margin-bottom: 20px;
	margin-left: 0px;
}

-->
 </style>

<script language="JavaScript" src="js/calendar1.js"></script><!--  -->
<script type="text/javascript" src="js/formval.js"></script>


<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jqueryslidemenu.js"></script>

<script type="text/javascript" src="ajaxtabs/ajaxtabs.js">

/***********************************************
* Ajax Tabs Content script v2.2- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>


<script language=Javascript>
  function showmore(empid)
	 {
        var url = "uploadpic.php?empid="+empid;

        newwin = window.open(url,'Add','width=300,height=400,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollbars=3');
        newwin.focus();
     }

   function attachdocs(empid)
	 {
        var url = "attachdocs.php?empid="+empid;

        newwin = window.open(url,'Add','width=400,height=400,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollbars=3');
        newwin.focus();
     }
   function Checkvalue(val,ctrl)
   {
     if (val >0 && ctrl=='numhrs')
       document.employeefrm.hpayrate.value=0;
	 if (val >0 && ctrl=='hpayrate')
       document.employeefrm.numhrs.value=0;
   }
   function Checkrent(val)
   {
     if (val==0)
       document.employeefrm.rentpayemp.value=0;

   }
   function Checkexpdate(val)
   {
     if (val!=1){
	   document.employeefrm.expdate.value="00-00-0000";
	   document.employeefrm.effdate.value="00-00-0000";
	 }
   }

   function Checkquitdate(val)
   {
     if (val==1)
	   document.employeefrm.qdate.value="00-00-0000";
	 else
	  document.employeefrm.qdate.value="";
   }

   function Checkacteffdate(val)
   {
     if (val!=1)
	   document.employeefrm.actdate.value="00-00-0000";
	 else
	  document.employeefrm.actdate.value="";
   }
</script>
</head>

<body>
<? 

 if (empty($_SESSION["username"]))
    die("<center><font color=red>You have not yet Logged in.<a href=login.php>Please click here to log in.</a></font></center>");
 else
   $username = $_SESSION["username"];
   
  $today=date("Y-m-d h:m:s");
  
  include "includes/functions.php";
  include "includes/config.php";
  require_once "includes/db.php";
  
  $d = new dbC();
  $d->connect($db_host, $db_user, $db_pass, $db); 
   
  if (!empty($_GET["empid"]))
    $id=$_GET["empid"];
	
  if (!empty($_GET["action"]))
    $action="update_go";

  //Get user credentials
	  $sqlstr="select * from hrusers  where username like '%".$username."%'";
	  $data=$d->query($sqlstr);
	  $row=$d->fetch_object($data);
	  $fullname=$row->name; 
	  $userid=$row->id;
	  $isadmin=$row->isadmin;
  
  //load edits
  
  if (!empty($_REQUEST["empid"]))
  {
    $id=$_REQUEST["empid"];
	$action = "update_go";
    $sqlstr="select * from prmember where rowid = '$id'";
	$sqlresult=$d->query($sqlstr);
	
	
	    $row=$d->fetch_object($sqlresult);
	 
	    $emptitle = $row->emptitle;  
		$rowid = $row->rowid;
	    $fname=$row->LastName;
		 if (empty($row->OtherNames)){
		  $othernames=explode(" ",$row->FullName);
		}  
		else
		{
		  $othernames=explode(" ",$row->OtherNames);
		  $mname=$othernames[0];
		}   
		
	    $lname=$othernames[1];
	    $empnum=$row->MemberNo;
	    
	    $prefnames=$fname;
	    $dob=datetimeconvert($row->BirthDate,2);
	    $placeofbirth=$row->placeofbirth;
	   
	     if (stristr($row->Sex,'Male') || stristr($row->Sex,'M'))
		   $gender='m';
		   
		if (stristr($row->Sex,'Female') || stristr($row->Sex,'F'))
		   $gender='f';;
		     
	   // $gender=$row->Sex;
	    $marital_status=$row->MaritalStatus;
	    $pin=$row->PINNumber;
	    $nssfnum=$row->NSSFNo;
	   
		$nationality=$row->nationality;
		$nhifnum=$row->NHIFNO;
		$empdate=datetimeconvert($row->EmpDate,2);
		$idnum=$row->IDNumber;
		$curr_res=$row->curr_res;
		$homeres=$row->homeres;
		
		$physical=$row->physical;
		$province=$row->province;
		$currdescrip=$row->currdescrip;
		$district=$row->district;
		$street=$row->street;
		
		$division=$row->division;
		$estate=$row->estate;
		$location=$row->location;
		$town=$row->town;
	    $sublocation=$row->sublocation;
		$postaladdr=$row->postaladdr;
		$phonenum=$row->phonenum;
		$unit_fk=$row->unit_fk;
		$suspended=$row->Suspended;
		
		$dlnum=$row->dlnum;
		$empstatus_fk=$row->empstatus_fk;
		$bankcode=$row->BankCode;
		
		if (!empty($datedlissued)) 
		  $datedlissued=dateconvert($row->datedlissued,2);
				  
		$position_fk=$row->position_fk;
		$dlclasses=$row->dlclasses;
		$dept=$row->Dept;
		
		$bank=$row->bankid_fk;
		$basicpay=$row->BasicPay;
		$branch=$row->branchid_fk;
		$accnum=$row->AccountNo;
		$jobgroup=$row->JobGroup;
		
		//echo $jobgroup;
		
		$numhrs=$row->M_days_Hrs;
		$monthid=$row->IncrMonth;
		$hpayrate=$row->Hr_PayRate;
		$housed = $row->Housed;
		
		$rentpayemp=$row->HouseCost;
		$stationcode = $row->Station;
		
		if (!empty($row->QuitDate)) 
	    $expdate=datetimeconvert($row->QuitDate,2);
	    
		$termsid=$row->termsid_fk;
		
		if (!empty($row->effdate)) 
		  $effdate=datetimeconvert($row->effdate,2);
	  
	   $actpos=$row->actposition;
	   $actscale=$row->actscale;
	 
	   if (!empty($row->acteffdate)) 
	     $acteffdate=datetimeconvert($row->acteffdate,2);
	 
	
  }
  else
    $action="add";
  
  if (hasaccess($d,1,$userid)) 
   $hasaccess=1; 
?>
<form action="employees.php" method="post" name="employeefrm">
<table width="100%"  border="0" bordercolor="#CCCCCC" bgcolor="#F7F7F7">
        <tr>
          <td scope="col"><div align="right"><strong>First Name</strong></div></td>
          <td colspan="2"  scope="col"><input name="fname" type="text" id="fname" <? if (!empty($fname)) echo "value=$fname"; ?>>
		 <div class="highlight" id="inf_fname">&nbsp;</div>
		  </td>
          <td width="119"  scope="col"><div align="right"><strong>Middle Name</strong></div></td>
          <td width="150"  scope="col">
            <input name="mname" type="text" id="mname" <? if (!empty($mname)) echo "value=$mname"; ?>>
          </td>
		  <td colspan="3" rowspan="6"  scope="col">
		    <div style="width: 230px;">
            <hr noshade size="3" color="#eb8137">
			<?
			if (!empty($id))  
			  echo "<center><img src='viewimg.php?imgid=$id' width=230 Height=230 ></center>"; ?>
			<hr noshade size="3" color="#eb8137">
            
      </div>
		  </td>
    </tr>
        <tr>
          <td scope="col" nowrap><div align="right"><strong>Last Name</strong></div></td>
          <td colspan="2" scope="col">
                <input name="lname" type="text" id="lname" <?  if (!empty($lname)) echo "value=$lname"; ?>>
          <div class="highlight" id="inf_lname">&nbsp;</div>
		  </td>
          <td  scope="col"><div align="right"><strong>Payroll Number </strong></div></td>
          <td  scope="col"><input name="payrollnum" type="text" id="payrollnum" <? if (!empty($empnum))  echo "value=$empnum"; ?>>
		  <div class="highlight" id="inf_pnames">&nbsp;</div>
		  </td>
    </tr>
        <tr>
          <td scope="col" nowrap><div align="right"><strong>Dob</strong></div></td>
          <td colspan="2" scope="col"><input name="dob" type="text" id="dob"  <? if (!empty($dob)) echo "value=$dob"; ?>>
		  <div class="highlight" id="inf_dob">&nbsp;</div>
		  </td>
          <td  scope="col"><div align="right"><strong>Place of Birth </strong></div></td>
          <td  scope="col"><input name="pbirth" type="text" id="pbirth" <? if (!empty($placeofbirth)) echo "value=$placeofbirth"; ?>>
		  <div class="highlight" id="inf_pbirth" >&nbsp;</div>
		  </td>
    </tr>
        <tr>
          <td scope="col" nowrap><div align="right"><strong>Gender</strong></div></td>
          <td colspan="2" scope="col">Male
            <input name="gender" type="radio" value="M"  <? if (!empty($gender) && ($gender=='m')) echo "checked";?>>
            <img src="images/male.gif" width="25" height="15"> Female
            <input name="gender" type="radio" value="F" <? if (!empty($gender) && ($gender=='f')) echo "checked";?>>
            <img src="images/female.gif" width="25" height="15">
			<div class="highlight" id="inf_gender">&nbsp;</div>
		  </td>
          <td  scope="col"><div align="right"><strong>Nationality</strong></div></td>
          <td  scope="col"><select name="nationality" id="nationality">
            <option value="">--SELECT--</option>
            <? Loadlookup("id","countryname","tbl_countries1",$nationality,$d); ?>
          </select><div class="highlight" id="inf_nationality">&nbsp;</div></td>
        </tr>
        <tr>
          <td scope="col" nowrap><div align="right"><strong>ID/Passport No</strong></div></td>
          <td colspan="2" scope="col"><input name="idnum" type="text" id="idnum" <?php if (!empty($idnum)) echo "value=$idnum" ?>>		    
            <div class="highlight" id="inf_idnum">&nbsp;</div>
	      </td><td  scope="col"><div align="right"><strong>Marital Status</strong></div></td>
          <td  scope="col"><select name="maritalstat">
            <option value="">--SELECT--</option>
            <? Loadlookup("id","description","tbl_maritalstatus",$marital_status,$d); ?>
          </select>
		  <div class="highlight" id="inf_maritalstat">&nbsp;</div>
		  </td>
        </tr>
        <tr>
          <td scope="col" nowrap><div align="right"><strong>NSSF No</strong></div></td>
          <td colspan="2" scope="col"><input name="nssfnum" type="text" id="nssfnum" <? if (!empty($nssfnum)) echo "value=$nssfnum" ?>>
		   <div class="highlight" id="inf_nssfnum">&nbsp;</div>
		  </td>
          <td  scope="col"><div align="right"><strong>PIN</strong></div></td>
          <td  scope="col"><input name="pin" type="text" id="pin" <?php if (!empty($pin)) echo "value=$pin" ?>>
		  <div class="highlight" id="inf_pin">&nbsp;</div>
		  </td>
    </tr>
        <tr>
          <td scope="col"><div align="right"><strong>NHIF No</strong></div></td>
          <td width="204" scope="col"><input name="nhifnum" type="text" id="nhifnum" <? if (!empty($nhifnum)) echo "value=$nhifnum" ?>>
		  <div class="highlight" id="inf_nhifnum">&nbsp;</div>
		  </td>
          <td colspan="2"  scope="col"><div align="right"><strong>Employment Date </strong></div></td>
          <td  scope="col"><input name="empdate" type="text" id="empdate" <? if (!empty($empdate)) echo "value=$empdate" ?>>
		  <div class="highlight" id="inf_empdate">&nbsp;</div>
		  </td>
          <td colspan="2"  scope="col"><div align="right"><strong>Account No</strong></div></td>
          <td  scope="col"><input name="accnum" type="text" id="accnum" <? if (!empty($accnum)) echo "value=$accnum" ?>>
            <div class="highlight" id="inf_accnum">&nbsp;</div></td>
    </tr>
        <tr>
          <td scope="col"><div align="right"><strong>Bank Code </strong></div></td>
          <td scope="col"><div class="highlight" id="inf_accnum">
            <select name="bank" id="bank" onBlur="">
              <option value="">--SELECT--</option>
              <? 
			  Loadlookup("bankcode","bankcode","prbank",$bankcode,$d);
			  //Lookup("bankcode","bankcode",$bank,"select distinct bankcode,bankcode from ",$d);
			  ?>
            </select>
            <div class="highlight" id="inf_bank">&nbsp;</div>
          </div>
		  </td>
          <td colspan="2"  scope="col"><div align="right"><strong>Job Group </strong></div></td>
          <td  scope="col"><select name="jobgrp" id="jobgrp" >
            <option value="">--SELECT--</option>
            <? 
			   Loadlookup("jobgroup","jobgroup","jobgroup",$jobgroup,$d);
			//Lookup("jobgroup","",$jobgroup,"select  jobgroup,jobgroup from  ",$d); ?>
          </select><div class="highlight" id="inf_jobgrp">&nbsp;</div></td>
          <td colspan="2"  scope="col"><div align="right"><strong>Basic Pay</strong></div></td>
          <td  scope="col"><input name="basicpay" type="text" id="basicpay" <? if (!empty($basicpay)) echo "value=$basicpay" ?>>
		  <div class="highlight" id="inf_basicpay">&nbsp;</div>
		  </td>
        </tr>
        <tr>
          <td scope="col"><div align="right"><strong>Designation</strong></div></td>
          <td scope="col">
            <select name="position" id="position">
              <option value="">--SELECT--</option>
              <? Loadlookup("id","designation","designation",$position_fk,$d); ?>
            </select><div class="highlight" id="inf_position">&nbsp;</div>
          </td>
          <td colspan="2"  scope="col"><div align="right"><strong>Unit/Branch</strong></div></td>
          <td  scope="col"><select name="branch" id="branch">
            <option value="">--SELECT--</option>
            <? Loadlookup("id","unit_name","tbl_units",$unit_fk,$d); ?>
          </select><div class="highlight" id="inf_branch">&nbsp;</div></td>
          <td  scope="col"><div align="right"><strong>Employee Status
          </strong></div></td>
          <td  scope="col"><span class="highlight">
            <select name="empstatus" id="empstatus" onChange="Checkquitdate(this.value)">
              <option value="">--SELECT--</option>
              <? Loadlookup("id","status","tbl_empstatus",$empstatus_fk,$d); ?>
            </select>
          </span></td>
          <td  scope="col"><input type="reset" name="Reset" value="Reset">
            <input type="submit" name="Submit" value="Submit" onClick="">
            <input name="action" type="hidden" <? if (!empty($action)) echo "value=$action" ?>>
            <input name="empid" type="hidden" <? if (!empty($id)) echo "value=$id" ?>>
            <input name="tabfrom" type="hidden" <? echo "value=GEN" ?>></td>
        </tr>

        
</table>
</form>
<?
  $d->close();
?>
</body>


</html>
Return current item: E-hris