 <?php
 /*$config['dbUser']='root';
  $config['dbPass']='root';
  $_SESSION['dbName']='ufl_acc2015';
  $config['dbServer']='192.168.0.47';*/
 $connection = mysql_connect($config['dbServer'] , $config['dbUser'] , $config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'] , $connection) or die("Could not find DB");
$staffcode =$_POST['staffcode'];
$firstname =$_POST['firstname'];
$lastname =$_POST['lastname'];
$fathername =$_POST['fathername'];
$phone1 =$_POST['phone1'];
$phone2 =$_POST['phone2'];
$emailadress =$_POST['emailadress'];
$nationality =$_POST['nationality'];
$jobtitle='';
$passportnumber =$_POST['passportnumber'];
$staffdob ='';
$religions =$_POST['religions'];
$employedate =$_POST['employedate'];
$gender =$_POST['gender'];
$bloodgroup =$_POST['bloodgroup'];
$picture ='';
$prvjob ='';
$remark ='';
$inssurancenumber=$_POST['inssurancenumber'];
$inssurancedate=$_POST['inssurancedate'];
$inssuranceexpire=$_POST['inssuranceexpire'];
$passportdate=$_POST['passportdate'];
$passportexpire=$_POST['passportexpire'];
$cardnumber=$_POST['cardnumber'];
$carddate=$_POST['carddate'];
$cardexpire=$_POST['cardexpire'];
$birthplace=$_POST['birthplace'];
$visanumber=$_POST['visanumber'];
$visadate=$_POST['visadate'];
$visaexpire=$_POST['visaexpire'];
$bankacc=$_POST['bankacc'];
$bankname=$_POST['bankname'];
$quotaname=$_POST['quotaname'];
$marialstatus=$_POST['marialstatus'];
$totalchildren=$_POST['totalchildren'];
$salaryamount=$_POST['salaryamount'];
$leavedays=$_POST['leavedays'];
$visatype=$_POST['visatype'];

$tempnumber=$_POST['tempnumber'];
$tempdate=$_POST['tempdate'];
$tempexpire=$_POST['tempexpire'];
$resigned=$_POST['resigned'];
if ($resigned=='on'){$resigned=1;}
else $resigned=0;
$resigndate=$_POST['resigndate'];
$project=$_POST['project'];
$quotaexpire=$_POST['quotaexpire'];
$iban=$_POST['iban'];
$sortcode=$_POST['sortcode'];
$company=$_POST['company'];
$begininngdate=$employedate;
//
echo $employedate.$begininngdate;
$date=date_create($employedate);
$employedate= date_format($date,"Y/m/d H:i:s");
$fullname=$_POST['fullname'];
$bankbranch=$_POST['bankbranch'];
$allowance=$_POST['allowance'];
$allowance2=$_POST['allowance2'];
$accname=$_POST['accname'];
$aliennumber=$_POST['aliennumber'];
$aliendate=$_POST['aliendate'];
$alienexpire=$_POST['alienexpire'];
$query="insert into staff values ( $staffcode , '$firstname' , '$lastname', '$fathername', $phone1 , $phone2, '$emailadress','$nationality',
'$jobtitle' , $passportnumber, 
		'$staffdob' ,'$religions' , $employedate, '$gender' , '$bloodgroup' ,'$picture' , '$prvjob' , '$remark', $inssurancenumber,
		$inssurancedate, $inssuranceexpire, $passportdate, $passportexpire, $cardnumber, $carddate, $cardexpire,'$birthplace', $visanumber,
		$visadate, $visaexpire, '$bankacc', '$bankname', '$quotaname', '$marialstatus', $totalchildren, $salaryamount,  $leavedays ,
		'$visatype', $tempnumber, $tempdate, $tempexpire, $resigned, $resigndate,  $project ,$quotaexpire, '$iban' ,$sortcode, 
		'$company', $begininngdate, '$fullname', '$bankbranch' ,$allowance, $allowance2 , '$accname' , $aliennumber, $aliendate, $alienexpire)";


//echo "$query";
$res = mysql_query($query,$connection);

/*insert into staff values 050 , 'f' , 'fff', 'f', 3432423 , 766, '' , '23', '' ,'1' , '04/05/2016', 'f' , 'a' ,'' , '' , '', '456', 56, 56, 34, 45, 67, 854, 45,'ff', 452, 53, 45, 'fff', '', '001', 's', 4, , '', 56, 45, 45, 546, , 23, 45 ,56, 'f' ,4523, 'f', , 'fffff', 'gdh' ,563, 5665 , 'f' , 546, 546, 546 050 123	";*/


 print <<<HERE
	<html >
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge , chrome=1"> 
	<meta name="viewport" content="width=device-width ,  initial-scale=1.0"> 
	<link rel="stylesheet" type="text/css" media="all" href="css-v2/style.css">
	
	<link rel="stylesheet" type="text/css" media="all" href="css-v2/newstyle.css">
	<script type="text/javascript" src="js/tabsClass/tabber.js"></script>
	<link rel="stylesheet" href="js/tabsClass/tabber.css" type="text/css" />
	
	<link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar.css?random=20101112" media="screen"></link>
<script type="text/javascript" src="dhtmlgoodies_calendar.js?random=20100118"></script>

	
	<script type="text/javascript" language="javascript">
	
	

	var tabberOptions = {
		'manualStartup':true , 
		'onClick': function(argsObj) {
			
			var t = argsObj.tabber; /* Tabber object */
			var id = t.id; /* ID of the main tabber DIV */
			var i = argsObj.index; /* Which tab was clicked (0 is the first tab) */
			var e = argsObj.event; /* Event object */
			
			if (id == 'tab1') document.getElementById('PTabIndex').value = i;
			} , 
			
			/* Optional: set an ID for each tab navigation link */
		
			'addLinkId': true
			};
			
			
			//mycode get ledger names
			
			

</script>
						
<script type="text/javascript">
// alert("change the info you want and save them when finished");
</script>

<title>HR</title>
<style type="text/css">

body , td , th {
	font-family: Verdana ,  Arial ,  Helvetica ,  sans-serif;
	font-size: 11px;
	}
	body {

	margin-top: 2px;
	margin-left: 1px;
}
a:link {
	text-decoration: none;
	color: #0000FF;
}
a:visited {
	text-decoration: none;
	color: #0000FF;
}
a:hover {
	text-decoration: none;
	color: #0000FF;
}
a:active {
	text-decoration: none;
	color: #0000FF;
}
.style1 {color: #999999; font-weight: bold; }
.style12 {
	font-size: 9px;
	color: #999999;
	font-weight: bold;
}
.style15 {color: #5151FF; font-size: 10px;}
.style16 {
	font-size: 16px;
	color: #FF0000;
	font-weight: bold;
	font-family: "Times New Roman" ,  Times ,  serif;
}
.style17 {font-size: 9px}
.style25 {color: #999999; font-weight: bold; font-size: 10px; }
.style26 {color: #FF0000}
.style27 {color: #999999 ;font-size: 10px;}
.style28 {color: #FFFFFF ;font-size: 10px;}

</style>


<link rel="stylesheet" type="text/css" media="all" href="css-v2/style.css">

</head>



<body>

<input type='hidden' name='PTabIndex' id='PTabIndex' value='$PTabIndex'>
HERE;

echo "<table border='0' cellpadding='0' cellspacing='0' border='0'  align='center' class='layout-width'>";
//get Tab to view tab number

	echo"<tr min-height='100'>
			<td align=left id='content-body'>";
	 echo"   <div class='tabber' id='tab1' style='width: 1250px; min-height:1000px; margin-left: 50px;  margin-top:10px; float:left; text-align:left;'> ";
			$styleoption=" style='vertical-align:middle; width:152px; font-family:monospace; font-size:initial ; font-weight:bold;'";
				////
		echo"	<div class='tabbertab'>
					<h2 title='staffinfo'>Staff Information</h2>";
		echo"		<div id='datagrid-d1' style='width:1088px; height:1600px; margin-top:5px; border:0px solid gray;'>";
			
			echo "<form name='form' method='post' action=''>";				
echo "<table border='0' cellpadding='5' cellspacing='0' align='left' valign='center' width='1200px'>
<col width=170>
<col width=50>
<col width=150>
<col width=100>
<col width=150>
<col width=60>
<col width=150>
<col width=200>

		<tr>
			<td > Staffcode</td>
			<td><input type='text' name='staffcode'></td>
			<td> nationality</td>
			<td>
			<select name='nationality' width='100%'>";
			$nationalityquery="select nationality_code,nationality_name from nationality";
			$nationality=mysql_query($nationalityquery, $connection) or die(mysql_error('555'));
			while($row=mysql_fetch_array($nationality)){
			echo "	<option value='$row[1]'>$row[1]</option>";
	}
			echo "	
			</select>
			</td>
			<td></td>
			<td align='right'>photo</td>
			<td  rowspan='4' border='1'>12</td>
		</tr>
		<tr>
			<td>First name</td>
			<td><input type='text' name='firstname'></td>
			
			<td>relegions</td>
			<td>
				<select name='religions'>";
				$religionquery="select religion_code,religion_name from religion";
			$religion=mysql_query($religionquery, $connection) or die(mysql_error());
			while($religionresult=mysql_fetch_array($religion)){
			echo "	<option value='$religionresult[1]'>$religionresult[1]</option>";
	}
			echo "	
				</select>
			</td>
		</tr>
		<tr>
			<td>Last Name</td>
			<td><input type='text' name='lastname'></td>
			<td>Employement Date</td>
			<td><input type='date' name='employedate'></td>
			<td>Project</td>
			<td><input type='text' name='project'></td>
		
			
		</tr>
		<tr>
			<td>Father Name</td>
			<td><input type='text' name='fathername'></td>
			<td>Full Name</td>
			<td colspan='3'><input type='text' name='fullname' style='width:100%'></td>	
		</tr>
		<tr>
			<td>Email Adress</td>
			<td><input type='text' name='emailadress'></td>
			<td>company</td>
			<td ><input type='text' name='company' style='width:100%'></td>
			<td>Leave Days</td>		
			<td ><input type='text' name='leavedays' style='width:100%'></td>			
			<td align='right' colspan='2'>Blood Grp <input type='text' name='bloodgroup' size='4'></td>			
		</tr>
		<tr>
			<td>Place of Birth</td>
			<td><input type='text' name='birthplace'></td>
			<td>Date of Birth</td>
			<td ><input type='text' name='birthdate' style='width:100%'></td>
			<td colspan='2' align='right'>Gender(M-F) &nbsp; &nbsp; <input type='text' name='gender'  size='4'></td>			
			<td align='right' colspan='2'>Total Children <input type='text' name='totalchildren' size='4'></td>			
		</tr>
		<tr>
			<td>Foreign Phone Number</td>
			<td><input type='text' name='phone1'></td>
			<td>Local Phone Number</td>
			<td ><input type='text' name='phone2' style='width:100%'></td>
			
			<td colspan='2' align='right'>Marial Status (M/S/D/W) &nbsp; &nbsp;
			<input type='text' name='marialstatus' size='4'></td>
			<td align='right'>allowance</td>
			<td ><input type='text' name='allowance2' style='width:100%'></td>
			
		</tr>
		<tr>
			<td>Bank Acc</td>
			<td><input type='text' name='bankacc'></td>
			<td>Bank Name</td>
			<td ><select name='bankname'>
			<option value=''></option>";
			
			$bankquery="select bank_id,bank_name from banks";
			$bankname=mysql_query($bankquery, $connection) or die(mysql_error());
			while($bankresult=mysql_fetch_array($bankname)){
			echo "<option value='$bankresult[0]'>$bankresult[1]</option>";
			}
			echo "</select></td>
			<td>Branch</td>		
			<td ><input type='text' name='bankbranch' style='width:100%'></td>			
			<td align='right'>Paid allowance</td>
			<td ><input type='text' name='allowance' style='width:100%'></td>
			
			
		</tr>
		<tr>
			<td> Acc Holder Name</td>
			<td><input type='text' name='accname'></td>
			<td>IBAN</td>
			<td ><input type='text' name='iban' style='width:100%'></td>
			<td> Sort Code </td>		
			<td ><input type='text' name='sortcode' style='width:100%'></td>			
			<td align='right'>Salary Amount</td>
			<td ><input type='text' name='salaryamount'  style='width:100%'></td>
			
			
		</tr>
		<tr>
			<td>Quota Position</td>
			<td>
			<select name='quotaname'>
			<option value=''></option>";
			$quotaquery="select quota_code,quota_name from quota";
			$quota=mysql_query($quotaquery, $connection) or die(mysql_error());
			while($quotaresult=mysql_fetch_array($quota)){
			echo "<option value='$quotaresult[0]'>$quotaresult[1]</option>";
			}
			echo "</select>
			</td>
			<td>Current Position</td>
			<td ><select name='curentpos'><option value=''></option></select></td>
			<td>Entry Date</td>		
			<td ><input type='text' name='entrydate' style='width:100%'></td>			
			<td align='right'>Quota Pos Expired</td>
			<td ><input type='text' name='quotaexpire' style='width:100%'></td>
			
			
		</tr>
		<tr>
			<td>Resignation Date </td>
			<td><input type='text' name='resigndate'></td>
			<td>Resignation Reason</td>
			<td ><input type='text' name='resignreason' style='width:100%'></td>
			<td><input type='checkbox' name='resigned'>Resigned</td>		
			
			
		</tr>
		<tr><td colspan='3'><table >
		<col width=150>
		<col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3'>Passport Information</td></tr>
			<tr><td>Passport N</td>
			<td ><input type='text' name='passportnumber' style='width:100%'></td>
			</tr><tr>
			<td>issue Date</td>
			<td ><input type='text' name='passportdate' style='width:100%'></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='passportexpire' style='width:100%'></td>
		</table>
		<td></td>
</td>		
<td colspan='3'><table >
<col width=150>		<col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3'>inssurance</td></tr>
			<tr><td>inssurance N</td>
			<td ><input type='text' name='inssurancenumber' style='width:100%'></td>
			</tr><tr>
			<td>Issue Date</td>
			<td ><input type='text' name='inssurancedate' style='width:100%'></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='inssuranceexpire' style='width:100%'></td>
		</table>
</td>


</tr>
	<tr><td colspan='3'><table >
	<col width=150>		<col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3'>Cerpac Information</td></tr>
			<tr><td>Card N</td>
			<td ><input type='text' name='cardnumber' style='width:100%'></td>
			</tr><tr>
			<td>issue Date</td>
			<td ><input type='text' name='carddate' style='width:100%'></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='cardexpire' style='width:100%'></td>
		</table>
		
</td>	<td></td>		
<td colspan='3'><table ><col width=170><col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3'>temporary cart Information</td></tr>
			<tr><td>temporary number N</td>
			<td ><input type='text' name='tempnumber' style='width:100%'></td>
			</tr><tr>
			<td>issue Date</td>
			<td ><input type='text' name='tempdate' style='width:100%'></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='tempexpire' style='width:100%'></td>
		</table>
</td>

</tr>
	<tr><td colspan='3'><table ><col width=150><col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3'>Visa Information</td></tr>
			<tr><td>visa N</td>
			<td ><input type='text' name='visanumber' style='width:100%'></td>
			<td>Type</td>
			<td>
				<select name='visatype'>
					<option value=''></option>
				</select>
			</td>
			
			</tr><tr>
			<td>issue Date</td>
			<td ><input type='text' name='visadate' style='width:100%'></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='visaexpire' style='width:100%'></td>
		</table>
		
</td><td></td>			
<td colspan='3'><table ><col width=170><col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3'>Alien</td></tr>
			<tr><td>Alien Card Number N</td>
			<td ><input type='text' name='aliennumber' style='width:100%'></td>
			</tr><tr>
			<td>issue Date</td>
			<td ><input type='text' name='aliendate' style='width:100%'></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='alienexpire' style='width:100%'></td>
		</table>
</td>


</tr><tr><td><button type='submit'>save</button.</td></tr>";
echo "<tr><td colspan='10'><table border='1' align='center'  >
<col width=100>
<col width=100>
<col width=100>";
echo "<tr>
		<td bgcolor='#F5F5F5'>staff code</td>
		<td> staff first name</td>
		<td>staff last name</td>
	</tr>";
$staffinf="select staff_code, staff_firstname,staff_lastname from staff";
	$result=mysql_query($staffinf, $connection) or die(mysql_error(''));
	while($rows=mysql_fetch_array($result)){
		echo "<tr height='20px'>";
		echo "<td> $rows[0]</td>" ;
		echo "<td> $rows[1]</td>" ;
		echo "<td> $rows[2]</td>" ;
		echo "</tr>";
	}
echo "</table>";

echo "</td></tr>";
echo"	</table></form> ";
echo"			</div>";      
echo"		</div> "; 



echo"	<div class='tabbertab'>
					<h2 title='house'>house</h2>";
		echo"		<div id='datagrid-d1' style='width:1088px; height:1080px; margin-top:5px; border:0px solid gray;'>";
			echo"  		<table border='0' cellpadding='0' cellspacing='0' align='left' valign='center' width=1000>";
			echo "<tr><td><table align='center' >";
			echo "<col width=100>
			<col width=150>
			<col width=100>
			<col width=150>
			<col width=100>
			<col width=150>
			";
							echo "<tr><td>HouseCode</td><td><input type='text' name='housecode' style='width:100%';></td></tr>
									<tr><td>House Name</td><td><input type='text' name='housecode' style='width:100%';></td>
									<td >adress</td><td colspan='3'><input type='text' name='housecode' style='width:100%';></td></tr>
									<tr>
										<td>Security</td><td><input type='text' name='security' style='width:100%';></td>
										<td>Internet</td><td><input type='text' name='internet' style='width:100%';></td>
										<td>Satellite</td><td><input type='text' name='satellite' style='width:100%';></td>
									</tr>
									<tr>
										<td>Rent Due Date</td><td><input type='text' name='duedate' style='width:100%';></td>
										<td>Rent Amount</td><td><input type='text' name='rentamount' style='width:100%';></td>
										<td>Land lord</td><td><input type='text' name='landlord' style='width:100%';></td>
									</tr>
									<tr>
										<td>Generator</td><td><input type='text' name='duedate' style='width:100%';></td>
										<td>Diesel Tank</td><td><input type='text' name='rentamount' style='width:100%';></td>
										
									</tr>
									
									
									";
echo"				</table>
</td></tr>";
echo 						"<tr height='10px'></tr>";
echo"<tr min-height='100'>
			<td align=left id='content-body'>";
	 echo"   <div class='tabber' id='tab1' style='width: 1000px; min-height:1000px; margin-left: 50px;  margin-top:10px; float:left; text-align:left;'> ";
			$styleoption=" style='vertical-align:middle; width:152px; font-family:monospace; font-size:initial ; font-weight:bold;'";
			
			//begin staff in house
			echo"	<div class='tabbertab'>
					<h2 title='Staff in house'>Staff in house</h2>";
		echo"		<div id='datagrid-d1'  border='0' style='width:1000px; height:850; margin-top:5px; border:0px solid grey;'>";
		
			echo"  		<table border='1' cellpadding='0' cellspacing='0' align='left' valign='center' align='center'>";
			echo "<col width=400>
			<col width=400>
			";
			echo "<tr height='20px'>
					<td>staff_code</td>
					<td> name</td>
					</tr>
					
					";
						$staffquery='select staff_code,staff_name from staff_housedt';
						$staffresult=mysql_query($staffquery,$connection);
						while($staff=mysql_fetch_array($staffresult))
						{	echo "<tr height='20px'>";
								echo "<td >$staff[0]</td>";
								echo "<td>$staff[1]</td>";
							echo "</tr>";
						}
				echo "
				</tr>";
			
			echo "</table></div></div>";
			//end staffin house
			//begin generator
				echo"	<div class='tabbertab'>
					<h2 title='generator'>generator</h2>";
		echo"		<div id='datagrid-d1' style='width:1088px; height:1000px; margin-top:5px; border:0px solid gray;'>";
			echo"  		<table border='1' cellpadding='0' cellspacing='0' align='left' valign='center' >";
			echo "<col width=200>
			<col width=600>
			";
			echo "<tr height='20px'>
					<td>Service date</td>
					<td> remark</td>
					</tr>
					
					";
						$generatorquery='select gen_serviceDate,gen_remark  from staff_housegen;';
						$generatorresult=mysql_query($generatorquery,$connection);
						while($generator=mysql_fetch_array($generatorresult))
						{	echo "<tr height='20px'>";
								echo "<td >$generator[0]</td>";
								echo "<td>$generator[1]</td>";
							echo "</tr>";
						}
				echo "
				</tr>";
			
			
			echo "</table></div></div>";
			//end generator
			//begin diesel
				echo"	<div class='tabbertab'>
					<h2 title='diesel'>Diesel</h2>";
		echo"		<div id='datagrid-d1' style='width:1088px; height:1000px; margin-top:5px; border:0px solid gray;'>";
			echo"  		<table border='1' cellpadding='0' cellspacing='0' align='left' valign='center'>";
			
			echo "<col width=200>
			<col width=100>
			<col width=100>
			<col width=100>
			<col width=350>
			";
			echo "<tr height='20px'>
					<td> date</td>
					<td> prv.Ltrs</td>
					<td> Ltrs.</td>
					<td> current Ltrs.</td>
					<td> remark</td>
					</tr>
					
					";
						$dieselquery='select shd_date,shd_prvltr,shd_ltr,shd_remark from staff_housediesel';
						$dieselresult=mysql_query($dieselquery,$connection);
						while($diesel=mysql_fetch_array($dieselresult))
						{	echo "<tr height='20px'>";
								echo "<td >$diesel[0]</td>";
								echo "<td>$diesel[1]</td>";
								echo "<td >$diesel[2]</td>";
								echo "<td>$diesel[3]</td>";
								echo "<td>$diesel[4]</td>";
							echo "</tr>";
						}
				echo "
				</tr>";
			echo "</table></div></div>";
			//end diesel
			//begin others
				echo"	<div class='tabbertab'>
					<h2 title='others'>others</h2>";
		echo"		<div id='datagrid-d1' style='width:1088px; height:20px; margin-top:5px; border:0px solid gray;'>";
			echo"  		<table border='1' cellpadding='0' cellspacing='0' align='left' valign='center' >";
			
				
			echo "<col width=200>
			<col width=200>
			<col width=200>
			";
			echo "<tr height='20px'>
					<td> type</td>
					<td> date</td>
					<td> remark</td>
					
					</tr>
					
					";
						$othersquery='select description, date_value,remark from staff_others';
						$othersresult=mysql_query($othersquery,$connection);
						while($others=mysql_fetch_array($othersresult))
						{	echo "<tr height='20px'>";
								echo "<td >$others[0]</td>";
								echo "<td>$others[1]</td>";
								echo "<td >$others[2]</td>";
							
							echo "</tr>";
						}
				
			
				
			echo "</table>";
				echo "<tr height='20px'></tr>";
				echo "<tr><td> kkk</td></tr>";
			
	echo "</div></div>";
			//end others
		
			
			echo "</div></td></tr>";

echo "</table>";
echo"			</div>";      
echo"		</div>"; 



echo" <tr height='30'><td align='center' id='content-bottom' ></td></tr>";


echo" </table> ";//end of last table menu

echo"<script type=\"text/javascript\" language=\"javascript\">";
echo"	tabberAutomatic(tabberOptions);";
echo"   vTabIndex = document.getElementById('PTabIndex').value; ";
echo"	if (document.getElementById('tab1')) document.getElementById('tab1').tabber.tabShow(vTabIndex); ";
echo"</script>";

print <<<HERE
</form>
</body>
</html>
HERE;
?>

