Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/erp/views/
Upload File :
Current File : /var/www/html/mmishra/erp/views/hrm_view.php

<?php
//if (!class_exists($erpView)) {
// face detector class
	require_once __DIR__."/erp_view.php";
//}

class hrmView extends erpView {
    var $controller;
    var $model;

    public function __construct($controller, $model) {
               
		$this->controller 				= $controller;	// instantiate controller
        $this->model 					= $model;		// instantiate model
    }

    public function __destruct() {
		// throw last executed sql statement
		//if ($this->model->sqlStmt) print("<hr>" .$this->model->sqlStmt);
		
        if (!in_array($this->controller->menu, ['insurence', 'upload', 'nodeficit', 'payment', 'PGPayment', 'PGResponse', 'specimen', 'import', 'booking', 'photograph', 'photoshop']) && !in_array($this->controller->action, ['print', 'show', 'docUpload'])) {
			print(":|:" .$this->erpMenus(). ":|:" .$this->erpXupdate(). ":|:" .$this->erpError(). ":|:" .$this->erpClock(). ":|:" .$this->erpLogin());
		}
	}
	
    public function hrmDashboard($action, $tupleID) {
		$app					= $this->controller->app;
		$menu					= $this->controller->menu;
		$instituteID			= $this->controller->instituteID;		
		
		$str = "<h3>" .$this->model->getAppTitle($app). "Dashboard</h3>";
		foreach (array_keys($this->controller->degreeLevels) as $degreeLevel) {
			$programs = $this->model->selectProgram($instituteID, $degreeLevel);
			if ($programs) {
				$str .= "<table border='1' class='interface'>
				<tr valign='top'><th>Degree</th><th>Program</th><th>Student Strength</th><th>Student Withdrawn</th><th>Candidates Reported</th><th>Category-wise Summary Table</th></tr>";
				foreach ($programs as $program) {
					// loop through records
					$programID 	= $program['programID'];
					$minRank1 	= 0;
					$maxRank1 	= 0;
					// initialize variables
					$sTotal 	= 0; $wTotal = 0; $aTotal = 0; $genders = ''; $student4 = null;
					foreach (array_keys($this->controller->genders) as $key) {
						$student1[$key] 					= 0;
						$withdrawal1[$key] 					= 0;
						$applicant1[$key] 					= 0;
						$genders .= "<th>$key</th>";
					}
					foreach (array_keys(array_merge($this->controller->categorys,$this->controller->dasaCategorys)) as $key) {
						$student2[$key] 					= 0;
						$withdrawal2[$key] 					= 0;
						$applicant2[$key] 					= 0;
						$minRank[$key]						= 0;
						$maxRank[$key]						= 0;
					}

					foreach (array_keys(array_merge($this->controller->categorys,$this->controller->dasaCategorys)) as $key1) {
						foreach (array_keys($this->controller->genders) as $key2) {
							$student3[$key1.'-'.$key2] 		= 0;
							$withdrawal3[$key1.'-'.$key2] 	= 0;
							$applicant3[$key1.'-'.$key2] 	= 0;
						}
					}
					
					$states = $this->model->listStates('IN');
					foreach ($states as $row) {
						$state[$programID.'-'.$row['stateID']] = 0;
					}
					
					$countrys = $this->model->listCountrys();
					foreach ($countrys as $row) {
						$country[$programID.'-'.$row['countryCode']] = 0;
					}

					// gender/category wise student breakup
					$enrolments = $this->model->selectEnrolment($instituteID, $programID);
					foreach ($enrolments as $row) {
						if ($row['pwdStatus'] == 'Y') $row['category'] = 'PWD';
						$student1[trim($row['gender'])]++;
						if (!$student2[trim($row['category'])]) $student2[trim($row['category'])] = 0;
						$student2[trim($row['category'])]++;
						$student3[trim($row['category']).'-'.trim($row['gender'])]++;
						if (!$student4[trim($row['loginID'])]) $student4[trim($row['loginID'])] = 0;
						$student4[trim($row['loginID'])]++;
						$state[$programID.'-'.$row['homeState']]++;
						$country[$programID.'-'.$row['nationality']]++;
						$minRank1 					= $minRank1 < $row['lastScore'] ? $minRank1 : $row['lastScore'];
						$maxRank1 					= $maxRank1 > $row['lastScore'] ? $maxRank1 : $row['lastScore'];
						$minRank[$row['category']] 	= $minRank[$row['category']] < $row['lastScore'] ? $minRank[$row['category']] : $row['lastScore'];
						$maxRank[$row['category']] 	= $maxRank[$row['category']] > $row['lastScore'] ? $maxRank[$row['category']] : $row['lastScore'];
						$sTotal++;
					}
					$sBreakup = "<div align='right'>";
					foreach ($student1 as $key => $value) {
						$sBreakup .= $key. " : ". ($value < 10 ? '00' .$value : ($value < 100 ? '0' .$value : $value)). "<br>";
					}
					$sBreakup .= "<hr width='70%' align='right'>Total: ". ($sTotal < 10 ? '00' .$sTotal : ($sTotal < 100 ? '0' .$sTotal : $sTotal)). "</div>
					<p><b>Rank</b><br>Min.: $minRank1<br> Max.: $maxRank1</p>";

					// gender/category wise withdrawal breakup
					$withdrawals = $this->model->selectWithdrawal($instituteID, $programID);
					foreach ($withdrawals as $row) {			
						$withdrawal1[trim($row['gender'])]++;
						if (!$withdrawal2[trim($row['category'])]) 	$withdrawal2[trim($row['category'])] = 0;
						$withdrawal2[trim($row['category'])]++;
						$withdrawal3[trim($row['category']).'-'.trim($row['gender'])]++;
						$wTotal++;
					}
					$wBreakup = "<div align='right'>";
					foreach ($withdrawal1 as $key => $value) {
						$wBreakup .= $key. " : ". ($value < 10 ? '00' .$value : ($value < 100 ? '0' .$value : $value)). "<br>";
					}
					$wBreakup .= "<hr width='70%' align='right'>Total : ". ($wTotal < 10 ? '00' .$wTotal : ($wTotal < 100 ? '0' .$wTotal : $wTotal)). "</div>";
						
					// gender/category wise applicants breakup
					$applicants = $this->model->selectApplicant1($instituteID, $programID);
					foreach ($applicants as $row) {			
						$applicant1[trim($row['gender'])]++;
						if (!$applicant2[trim($row['category'])]) 	$applicant2[trim($row['category'])] = 0;
						$applicant2[trim($row['category'])]++;
						$applicant3[trim($row['category']).'-'.trim($row['gender'])]++;
						$aTotal++;
					}
					$aBreakup = "<div align='right'>";
					foreach ($applicant1 as $key => $value) {
						$aBreakup .= $key. " : ". ($value < 10 ? '00' .$value : ($value < 100 ? '0' .$value : $value)). "<br>";
					}
					$aBreakup .= "<hr width='70%' align='right'>Total : ". ($aTotal < 10 ? '00' .$aTotal : ($aTotal < 100 ? '0' .$aTotal : $aTotal)). "</div>";
						
					$str .= "<tr valign='top'><th>" .$degreeLevel. "<br><br>Duration:<br>EnrollNo.:</th><th width='10%'>" .$program['programCode']. "<br><br>" .$program['timeDuration']. " Year<br>" .$program['rollnoPrefix']. " / " .$program['lastRollno']."</th><td width='10%'>$sBreakup</td><td width='10%'>$wBreakup</td><td width='10%'>$aBreakup</td>
					<td><table border='1' class='interface'>
					<tr valign='top'><th width='10%'>Category</th><th width='10%'>Fees</th><th width='10%'>Mess</th><th>Admissions</th>$genders<th>Withdrawals</th>$genders<th>Candidates</th>$genders<th>MinRank</th><th>MaxRank</th></tr>";

					if ($degreeLevel == 'UG' ) {
						$cats = array_keys(array_merge($this->controller->categorys, $this->controller->dasaCategorys));
					} else {
						$cats = array_keys($this->controller->categorys);
					}
					foreach ($cats as $category) {
						$no++;
						$fees = $this->model->getFeesAmount($instituteID, $programID, $category);
						$mess = $this->model->getMessCharges($instituteID, $programID, $category);
											
						$sTotal1 = ($student2[$category] < 10 ? '00' .$student2[$category] : ($student2[$category] < 100 ? '0' .$student2[$category] : $student2[$category]));
						$wTotal1 = ($withdrawal2[$category] < 10 ? '00' .$withdrawal2[$category] : ($withdrawal2[$category] < 100 ? '0' .$withdrawal2[$category] : $withdrawal2[$category]));
						$aTotal1 = ($applicant2[$category] < 10 ? '00' .$applicant2[$category] : ($applicant2[$category] < 100 ? '0' .$applicant2[$category] : $applicant2[$category]));
						
						$sBreakup = ''; $wBreakup = ''; $aBreakup = '';
						foreach (array_keys($this->controller->genders) as $key) {
							$sBreakup .= "<td align='center'>" .($student3[$category.'-'.$key] < 10 ? '00' .$student3[$category.'-'.$key] : ($student3[$category.'-'.$key] < 100 ? '0' .$student3[$category.'-'.$key] : $student3[$category.'-'.$key])). '</td>';
							$wBreakup .= "<td align='center'>" .($withdrawal3[$category.'-'.$key] < 10 ? '00' .$withdrawal3[$category.'-'.$key] : ($withdrawal3[$category.'-'.$key] < 100 ? '0' .$withdrawal3[$category.'-'.$key] : $withdrawal3[$category.'-'.$key])). '</td>';
							$aBreakup .= "<td align='center'>" .($applicant3[$category.'-'.$key] < 10 ? '00' .$applicant3[$category.'-'.$key] : ($applicant3[$category.'-'.$key] < 100 ? '0' .$applicant3[$category.'-'.$key] : $applicant3[$category.'-'.$key])). '</td>';
						}		
						$bgc = $no % 2 ? 'f0f8ff' : 'ffffff';
						$str .= "<tr valign='top' bgcolor='$bgc'><td width='15%' nowrap>" .$category. "</td><td width='15%' align='right' nowrap>" .$fees['curency']. ' ' .$fees['amount']. "</td><td width='15%' align='right' nowrap>" .$mess['curency']. ' ' .$mess['amount']. "</td><td align='center'>" .$sTotal1. "</td>" .$sBreakup. "<td align='center'>" .$wTotal1. "</td>" .$wBreakup. "<td align='center'>" .$aTotal1. "</td>" .$aBreakup. "</td><td>" .$minRank[$category]. "</td><td>" .$maxRank[$category]. "</td></tr>";
					}
					$str .= "</table></td></tr>";
					if ($sTotal) {
						$str .= "<tr><th colspan='2'>State-wise Count</th><td colspan='4'>";
						foreach ($states as $row) {
							$str .= ($state[$programID.'-'.$row['stateID']] ? "[" .$row['stateName']. ": " .$state[$programID.'-'.$row['stateID']]. "] " : '');
						}
						$str .= "</td></tr>
						<tr><th colspan='2'>Country-wise Count</th><td colspan='4'>";
						foreach ($countrys as $row) {
							$str .= ($country[$programID.'-'.$row['countryCode']] ? "[" .$row['countryName']. ": " .$country[$programID.'-'.$row['countryCode']]. "] " : '');
						}
						$str .= "</td></tr>
						<tr><th colspan='2'>Staff-wise Count</th><td colspan='4'>";
						foreach ($student4 as $key => $value) {
							$str .= "[" .ucwords($key) .": $value] ";
						}
						$str .= "</td></tr>";
					}
					//$applicants = $this->model->selectApplicant($instituteID, $programID);				
				}
				$str .= "</table><br>";
			}
		}
		
		return $str; 
	}

    public function hrmNotice() {
		
		return $str;
    }
  
	
    public function hrmCadre($action, $cadreID) {
		$app					= $this->controller->app;
		$menu					= $this->controller->menu;
		
		$cadreID 				= $this->controller->manageCadre($action, $cadreID);// initiate controller action 
		// controller locks/unlocks field through manage call
		$ro 					= $this->controller->editLock;							// ensure default edit lock

        $cadres 				= $this->model->listCadres();
        $cadre 					= $this->model->getCadre($cadreID);					// get record
       	$toolbar				= $this->erpToolbar('', 2);
		
		$str = $this->pageHeader($findbar, $toolbar);

		$str .= "<table width='100%'>
		<tr><th width='70%'>cadre #{$cadreID} Detail</th><th width='30%'>Cadre List</th></tr>
        <tr valign='top'><td>
        <table class='interface'>
		<tr><td nowrap width='20%'>Cadre Code</td><td><input type='text' name='cadreCode' size='50' value='" .$cadre['cadreCode']. "' placeholder='unique 5 characters' $ro></td></tr>
       	<tr><td nowrap>Cadre Name</td><td><input type='text' name='cadreName' size='50' value='" .$cadre['cadreName']. "' placeholder='max. 50 character' $ro></td></tr>
        </table>
		</td><td>
		<ul class='listbar'>";		        
        foreach($cadres as $cadre) {
			$str .= "<li>" .($cadre['cadreID'] == $cadreID ? "<b>" .$cadre['cadreCode']. "</b>" : "<a href='' onclick=\"inner('$app/$menu/open/". $cadre['cadreID']."'); return false;\">" .$cadre['cadreCode']. "</a>"). " (" .$cadre['status']. ")</li>";
        }
        $str .= "</ul></td></tr>
        </table>" .$this->pageFooter('', $toolbar);
				
        return $str;
    }
  
    public function hrmPayband($action, $payID) {
		$app					= $this->controller->app;
		$menu					= $this->controller->menu;
		
		$payID	 				= $this->controller->managePayband($action, $payID);// initiate controller action 
		// controller locks/unlocks field through manage call
		$ro 					= $this->controller->editLock;							// ensure default edit lock
        
        $paybands 				= $this->model->listPaybands();						// get record
        $payband				= $this->model->getPayband($payID);					// get record
		
      	$toolbar				= $this->erpToolbar('', 2);
		
		$str = $this->pageHeader($findbar, $toolbar);
		$str .= "<table width='100%'>
		<tr><th width='70%'>Payband #{$payID} Detail</th><th width='30%'>Payband List</th></tr>
        <tr valign='top'><td>
        <table class='interface'>
		<tr><td nowrap>Pay Level</td><td><input type='number' name='payLevel' size='50' value='" .$payband['payLevel']. "' placeholder='number' $ro></td></tr>
       	<tr><td nowrap>Minimum Pay</td><td><input type='number' name='minPay' size='50' value='" .$payband['minPay']. "' placeholder='number' $ro></td></tr>
		<tr><td nowrap>Maximum Pay</td><td><input type='number' name='maxPay' value='" .$payband['maxPay']. "' placeholder='number' $ro></td></tr>
		<tr><td nowrap>Grade Pay</td><td><input type='number' name='gradePay' size='50' value='" .$payband['gradePay']. "' placeholder='number' $ro></td></tr>
        </table>
		</td><td>
		<ul class='listbar'>";		
        foreach($paybands as $payband) {
			$str .= "<li>" .($payband['payID'] == $payID ? "<b>Level " .$payband['payLevel']. "</b>" : "<a href='' onclick=\"inner('$app/$menu/open/". $payband['payID']."'); return false;\">Level " .$payband['payLevel']. "</a>"). " (" .$payband['status']. ")</li>";
        }
        $str .= "</ul></td></tr>
        </table>" .$this->pageFooter('', $toolbar);
				
        return $str;
    }
	

    public function hrmDesignation($action, $desiID) {
		$app					= $this->controller->app;
		$menu					= $this->controller->menu;
		
		$desiID	 				= $this->controller->manageDesignation($action, $desiID);// initiate controller action 
		// controller locks/unlocks field through manage call
		$ro 					= $this->controller->editLock;							// ensure default edit lock
        
        $cadres					= $this->model->selectCadre();						// get record

        $designations			= $this->model->listDesignations();						// get record
        $designation			= $this->model->getDesignation($desiID);					// get record
		
      	$toolbar				= $this->erpToolbar('', 2);
		
		$str = $this->pageHeader($findbar, $toolbar);
		$str .= "<table width='100%'>
		<tr><th width='70%'>Designation #{$desiID} Detail</th><th width='30%'>Designation List</th></tr>
        <tr valign='top'><td>
        <table class='interface'>
		<tr><td nowrap>Designation Code</td><td><input type='text' name='desiCode' size='50' value='" .$designation['desiCode']. "' placeholder='5 letters' $ro></td></tr>
       	<tr><td nowrap>Designation <span class='rightbar'>(In English)</span></td><td><input type='text' name='desiEnglish' size='50' value='" .$designation['desiEnglish']. "' placeholder='50 characters' $ro></td></tr>
		<tr><td nowrap><span class='rightbar'>(In Hindi)</span></td><td><input type='text' name='desiHindi' size='50' value='" .$designation['desiHindi']. "' placeholder='hindi version' $ro></td></tr>
		<tr><td nowrap>Cadre</td><td><select name='cadreID' style='width: 150px' $ro>";
		foreach ($cadres as $cadre) {
			$str .= "<option value='" .$cadre['cadreID']. "' " .($cadre['cadreID'] == $designation['cadreID'] ? self::SL : $this->dis). ">" .$cadre['cadreName']. "</option>";
		}
		$str .= "</select></td></tr>
        </table>
		</td><td>
		<ul class='listbar'>";		
        foreach($designations as $designation) {
			$str .= "<li>" .($designation['desiID'] == $desiID ? "<b>" .$designation['desiCode']. "</b>" : "<a href='' onclick=\"inner('$app/$menu/open/". $designation['desiID']."'); return false;\">" .$designation['desiCode']. "</a>"). " (" .$designation['status']. ")</li>";
        }
        $str .= "</ul></td></tr>
        </table>" .$this->pageFooter('', $toolbar);
				
        return $str;
    }


    public function hrmLeavetype($action, $leaveID) {
		$app					= $this->controller->app;
		$menu					= $this->controller->menu;
		
		$leaveID	 			= $this->controller->manageLeavetype($action, $leaveID);// initiate controller action 
		// controller locks/unlocks field through manage call
		$ro 					= $this->controller->editLock;							// ensure default edit lock
        
        $leavetypes				= $this->model->listLeavetypes();						// get record
        $leavetype				= $this->model->getLeavetype($leaveID);					// get record
		
      	$toolbar				= $this->erpToolbar('', 2);
		
		$str = $this->pageHeader($findbar, $toolbar);
		$str .= "<table width='100%'>
		<tr><th width='70%'>Leave #{$leaveID} Detail</th><th width='30%'>Leave List</th></tr>
        <tr valign='top'><td>
        <table class='interface'>
		<tr><td nowrap>Leave Code</td><td><input type='text' name='leaveCode' size='50' value='" .$leavetype['leaveCode']. "' placeholder='5 letters' $ro></td></tr>
       	<tr><td nowrap>Leave Name</td><td><input type='text' name='leaveName' size='50' value='" .$leavetype['leaveName']. "' placeholder='50 characters' $ro></td></tr>
		<tr><td nowrap>Payment Term</td><td><select name='payTerm' style='width: 150px' $ro>";
		foreach ($this->controller->payTerms as $key => $value) {
			$str .= "<option value='$key'" .($key == $leavetype['payTerm'] ? self::SL : $this->dis). ">$value</option>";
		}
		$str .= "</select></td></tr>
		<tr><td nowrap>Days / Year</td><td><input type='number' name='yearDays' value='" .$leavetype['yearDays']. "' placeholder='number' $ro></td></tr>
		<tr><td nowrap>Accumulative</td><td><select name='accumulative' style='width: 150px' $ro>";
		foreach ($this->controller->yesnoChoices as $key => $value) {
			$str .= "<option value='$key'" .($key == $leavetype['accumulative'] ? self::SL : $this->dis). ">$value</option>";
		}
		$str .= "</select></td></tr>
        </table>
		</td><td>
		<ul class='listbar'>";		
        foreach($leavetypes as $leavetype) {
			$str .= "<li>" .($leavetype['leaveID'] == $leaveID ? "<b>" .$leavetype['leaveCode']. "</b>" : "<a href='' onclick=\"inner('$app/$menu/open/". $leavetype['leaveID']."'); return false;\">" .$leavetype['leaveCode']. "</a>"). " (" .$leavetype['status']. ")</li>";
        }
        $str .= "</ul></td></tr>
        </table>" .$this->pageFooter('', $toolbar);
				
        return $str;
    }

    public function hrmDepartment($action, $deptID) {
		$app					= $this->controller->app;
		$menu					= $this->controller->menu;
		
		$deptID	 				= $this->controller->manageDepartment($action, $deptID);// initiate controller action 
		// controller locks/unlocks field through manage call
		$ro 					= $this->controller->editLock;							// ensure default edit lock
        
        $employees				= $this->model->selectEmployee(1);						// get record

        $departments			= $this->model->listDepartments();						// get record
        $department				= $this->model->getDepartment($deptID);					// get record
		
      	$toolbar				= $this->erpToolbar('', 2);
		
		$str = $this->pageHeader($findbar, $toolbar);
		$str .= "<table width='100%'>
		<tr><th width='70%'>Department #{$deptID} Detail</th><th width='30%'>Department List</th></tr>
        <tr valign='top'><td>
        <table class='interface'>
		<tr><td nowrap>Department Code</td><td><input type='text' name='deptCode' size='50' value='" .$department['deptCode']. "' placeholder='5 letters' $ro></td></tr>
       	<tr><td nowrap>Department Name</td><td><input type='text' name='deptName' size='50' value='" .$department['deptName']. "' placeholder='50 characters' $ro></td></tr>
		<tr><td nowrap>Department Head</td><td><select name='hodID' style='width: 150px' $ro>";
		foreach ($employees as $employee) {
			$str .= "<option value='" .$employee['employeeID']. "'" .($department['hodID'] == $employee['employeeID'] ? self::SL : $this->dis). ">" .$employee['nameEnglish']. "</option>";
		}
		$str .= "</select></td></tr>
        </table>
		</td><td>
		<ul class='listbar'>";		
        foreach($departments as $department) {
			$str .= "<li>" .($department['deptID'] == $deptID ? "<b>" .$department['deptCode']. "</b>" : "<a href='' onclick=\"inner('$app/$menu/open/". $department['deptID']."'); return false;\">" .$department['deptCode']. "</a>"). " (" .$department['status']. ")</li>";
        }
        $str .= "</ul></td></tr>
        </table>" .$this->pageFooter('', $toolbar);
				
        return $str;
    }
/*
	function hrmDashboard() {
		$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 hrmEmployee($action, $employeeID) {
		$app					= $this->controller->app;
		$menu					= $this->controller->menu;
		$cadreID				= $this->controller->params[0];

		$ro						= $this->controller->editLock;
		
        $cadres					= $this->model->selectCadre();						// get record
        $employees				= $this->model->selectEmployee($cadreID);						// get record

		$employee				= $this->model->getEmployee($employeeID);
		$toolbar 				= $this->erpToolbar('', 2);
				
		$findbar = "Cadre <select name='cadreID' style='width: 200px' onchange=\"inner('$app/$menu/open/0/'+this.options[this.selectedIndex].value); return false;\">
		<option value='0'>Select</option>";
		foreach ($cadres as $cadre) {
			$findbar .= "<option value='" .$cadre['cadreID']. "'" .($cadreID == $cadre['cadreID'] ? self::SL : ''). ">" .$cadre['cadreCode']. "</option>";
		}
		$findbar .= "</select>
		Employee No. <select name='employeeID' style='width: 200px' onchange=\"inner('$app/$menu/open/'+this.options[this.selectedIndex].value+'/$cadreID'); return false;\">
		<option value='0'>Select</option>";
		foreach ($employees as $employee1) {
			$findbar .= "<option value='" .$employee1['employeeID']. "'" .($employeeID == $employee1['employeeID'] ? self::SL : ''). ">" .$employee1['nameEnglish']. "</option>";
		}
		$findbar .= "</select>";

		$str = $this->pageHeader($findbar, $toolbar);
		$str .= "<table class='interface'>
		<tr><th nowrap>Emplooyee #{$employeeID} Detail<span class='rightbar'>Processed by: " .($employee['loginID'] ? ucwords($employee['loginID']) : $_SESSION['loginID']). " (dated: " .($employee['dateemployee'] ? $employee['dateEnrolment'] : date("Y-m-d: H:i:s")). ")</span></th>
		<th><iframe id='iframe' name='iframe' src='' width='100%' height='30px' frameborder='0' scrolling='no'></iframe></th></tr>
		<tr valign='top'><td width='50%'><input type='hidden' name='studentID' value='$studentID'>
		<table class='interface'>
		<tr><td colspan='2'><b>Personal detail</b></td></tr>
		<tr><td nowrap>Employee Name <span class='rightbar'>(in English)</span></td><td><input type='text' name='nameEnglish' size='60' value='" .$employee['nameEnglish']. "' placeholder='full name in english' $ro></td></tr>
		<tr><td nowrap><span class='rightbar'>(in Hindi)</span></td><td><input type='text' name='nameHindi' size='60' value='" .$employee['nameHindi']. "' placeholder='name in hindi (use google input)' $ro></td></tr>
		<tr><td nowrap>Date of Birth</td><td nowrap><input type='text' name='dateBirth' size='25' value='" .$employee['dateBirth']. "' placeholder='YYYY-MM-DD' $ro>
		<span class='rightbar'>Gender <select name='gender' style='width: 150px' $ro>";
		foreach ($this->controller->genders as $code => $desc) {
			$str .= "<option value='$code'" .(trim($employee['gender']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select></span></td></tr>
		<tr><td nowrap>Blood Group</td><td nowrap><select name='bloodGroup' style='width: 150px' $ro>";
		foreach ($this->controller->bloodGroups as $code) {
			$str .= "<option value='$code'" .(trim($employee['bloodGroup']) == $code ? self::SL : $this->dis). ">" .($code ? $code : 'Unknown'). "</option>";
		}
		$str .= "</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<span class='rightbar'>PwD &nbsp;<select name='pwdStatus' style='width: 150px' $ro>";
		foreach ($this->controller->pwdStatuss as $code => $desc) {
			$str .= "<option value='$code'" .(trim($employee['pwdStatus']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select></span></td></tr>
		<tr><td nowrap>Category</td><td><select name='category' style='width: 150px' onchange=\"if (this.value=='OBC' || this.value=='OBC-NCL') {form.subc.style.visibility='visible'; $('label[for=subl]').text('Sub Category');} else {form.subc.style.visibility='hidden'; $('label[for=subl]').text('');} return false;\" $ro>
		<option value='GEN'>Select</option>";
		foreach ($this->controller->subCategorys as $code => $desc) {
			$str .= "<option value='$code'" .($employee['category'] == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select>
		<span class='rightbar'><label for='subl'>Sub Category</label> <input id='subc' type='text' name='subCategory' size='25' value='" .$employee['subCategory']. "' placeholder='Caste name' $ro></span></td></tr>
		<tr><td>Marital Status</td><td nowrap><select name='maritalStatus' style='width: 150px' $ro>";
		foreach ($this->controller->maritalStatuss as $code => $desc) {
			$str .= "<option value='$code'" .(trim($employee['maritalStatus']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select>
		<span class='rightbar'>Religion <select name='religion' style='width: 150px'" .$this->dis. ">";
		foreach ($this->controller->religions as $code => $desc) {
			$str .= "<option value='$code'" .(trim($employee['religion']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select></span></td></tr>
		<tr><td nowrap>Nationality</td><td nowrap><select name='nationality' style='width: 150px' $ro>";
		$countrys	= $this->model->selectCountry();
		if (!$employee['nationality']) $employee['nationality'] = 'IN';    
		foreach ($countrys as $country) {
			$str .= "<option value='" .$country['countryCode']. "'" .(trim($employee['nationality']) == $country['countryCode'] ? self::SL : $this->dis). ">" .$country['countryName']. "</option>";
		}
		$str .= "</select>
		<span class='rightbar'>Aadhaar No. <input type='text' name='aadhaarNo' size='25' value='" .$employee['aadhaarNo']. "' maxlength='14' placeholder='12 digits (e.g. 1111-1111-1111)' $ro></span></td></tr>

		<tr><td colspan='2'><b>Contact detail</b></td></tr>
		<tr><td nowrap>Email</td><td nowrap><input type='text' name='email' size='60' value='" .$employee['email']. "' placeholder='Functional email address for alert mails' $ro>
		<span class='rightbar'>Phone No.<input type='text' name='phoneNo' size='25' value='" .$employee['phoneNo']. "' placeholder='Mobile number for OTP SMS and call' $ro></span></td></tr>
		<tr><td nowrap>Permanent Address<sup>1</sup></td><td><input type='text' id='padd' name='homeAddress' size='60' value='" .$employee['homeAddress']. "' placeholder='Native place address' $ro>
		<span class='rightbar'>Area <select name='area' style='width: 150px'" .$this->dis. ">";
		foreach ($this->controller->areas as $code => $desc) {
			$str .= "<option value='$code'" .(trim($employee['area']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select></td></tr>
		<tr><td nowrap>PIN Code</td><td nowrap><input type='text' id='ppin' name='homePIN' size='25' value='" .$employee['homePIN']. "' placeholder='6 digits pin code' $ro>
		<span class='rightbar'>Police Station <input type='text' name='policeStation' size='25' value='" .$employee['policeStation']. "' placeholder='Name of the nearest police station' $ro></span></td></tr>
		<tr><td nowrap>District</td><td nowrap>
		 <select id='district' name='homeDistrict' style='width: 150px' title='To get districts of your state, save form with state name' $ro>";
		if (!$employee['homeState']) $employee['homeState'] = 9;    
		$districts	= $this->model->selectDistrict($employee['homeState']);    
		if (!$employee['homeDistrict']) $employee['homeDistrict'] = 1;    
		foreach ($districts as $district) {
			$str .= "<option value='" .trim($district['districtID']). "'" .($employee['homeDistrict'] == $district['districtID'] ? self::SL : $this->dis). ">" .$district['districtName']. "</option>";
		}
		$str .= "</select>
		<span class='rightbar'> State <select id='state' name='homeState' style='width: 150px' title='To get districts of your state, save form with state name' onchange=\"update_district(this.value)\" $ro>";
		$states	= $this->model->selectState();    
		foreach ($states as $state) {
			$str .= "<option value='" .trim($state['stateID']). "'" .($state['stateID'] == $employee['homeState'] ? self::SL : $this->dis). ">" .$state['stateName']. "</option>";
		}
		$str .= "</select></span></td></tr>
		<tr valign='top'><td nowrap>Comm. Address <input type='checkbox' name='same1' value='1' onclick=\"form.cadd.value=form.padd.value;form.cpin.value=form.ppin.value;\"> Same<sup>1</sup>
		</td><td><input type='text' id='cadd' name='commAddress' size='60' value='" .$employee['commAddress']. "' placeholder='For correspondence in emergency' $ro></td></tr>
		<tr><td nowrap>PIN Code</td><td><input type='text' id='cpin' name='commPIN' size='25' value='" .$employee['commPIN']. "' placeholder='6 digits pin code' $ro></td></tr>
		<tr><td colspan='2'><hr><b>Account detail</b> (for refund purposes)
		<table width='100%' align='center'><tr>
		<td>Account No. <input type='text' name='accountNo' size='10' value='" .$employee['accountNo']. "' $ro></td>
		<td>Holder Name <input type='text' name='holderName' size='20' value='" .$employee['holderName']. "' $ro></td>
		<td>Bank Name <input type='text' name='bankName' size='20' value='" .$employee['bankName']. "' $ro></td>
		<td>IFSC Code <input type='text' name='ifscCode' size='10' value='" .$employee['ifscCode']. "' $ro></td></tr>
		</table>
		<hr></td></tr>
		</table></td><td>
		
		<table class='interface'>
		<tr><td colspan='2'><b>Father's detail</b></td></tr>
		<tr><td width='20%' nowrap>Father Name</td><td>
		<select id='fttl' name='fatherTitle' style='width: 50px' $ro>";
		list($ftitle, $fname) = explode(" ", $employee['fatherName'], 2);
		foreach (array_merge($this->controller->maleTitles, $this->controller->earnedTitles) as $code) {
			$str .= "<option value='$code'" .($code == $ftitle ? self::SL : $this->dis). ">$code</option>";
		}
		$str .= "</select><input type='text' id='fname' name='fatherName' size='50' value='" .$fname. "' placeholder='' $ro>";

/*		<span class='rightbar'>Profession <select id='fprof' name='fatherProfession' style='width: 150px' $ro>";
		foreach ($this->controller->professions as $code => $desc) {
			$str .= "<option value='$code'" .(trim($employee['fatherProfession']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select></span></td></tr>
		<tr><td nowrap>Address<sup>2</sup></td><td><input type='text' id='fadd' name='fatherAddress' size='60' value='" .$employee['fatherAddress']. "' placeholder='(Offic address, if applicable)' $ro></td></tr>
		<tr><td nowrap>Email</td><td nowrap><input type='text' id='femail' name='fatherEmail' size='60' value='" .$employee['fatherEmail']. "' placeholder='Functional email address' $ro>
		<span class='rightbar'>Phone No. <input type='text' id='fphone' name='fatherPhone' size='25' value='" .$employee['fatherPhone']. "' placeholder='Emergency contact number' $ro></span></td></tr>
		
		<tr><td colspan='2'><b>Mother's detail</b></td></tr>
		<tr><td nowrap>Mother Name</td><td>		
		<select id='mttl' name='motherTitle' style='width: 50px' $ro>";
		list($mtitle, $mname) = explode(" ", $employee['motherName'], 2);
		foreach (array_merge($this->controller->femaleTitles, $this->controller->earnedTitles) as $code) {
			$str .= "<option value='$code'" .($code == $mtitle ? self::SL : $this->dis). ">$code</option>";
		}
		$str .= "</select><input type='text' id='mname' name='motherName' size='50' value='" .$mname. "' placeholder='' $ro>
		<span class='rightbar'>Profession <select id='mprof' name='motherProfession' style='width: 150px' $ro>";
		foreach ($this->controller->professions as $code => $desc) {
			$str .= "<option value='$code'" .(trim($employee['motherProfession']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select></span></td></tr>
		<tr><td nowrap>Address <input type='checkbox' name='same2' value='1' onclick=\"form.madd.value=form.fadd.value; form.mphone.value=form.fphone.value; form.memail.value=form.femail.value;\"> Same<sup>2</sup></td>
		<td><input type='text' id='madd' name='motherAddress' size='60' value='" .$employee['motherAddress']. "' placeholder='(Offic address, if applicable)' $ro></td></tr>
		<tr><td nowrap>Email</td><td nowrap><input type='text' id='memail' name='motherEmail' size='60' value='" .$employee['motherEmail']. "' placeholder='Functional email address' $ro>
		<span class='rightbar'>Phone No. <input type='text' id='mphone' name='motherPhone' size='25' value='" .$employee['motherPhone']. "' placeholder='Emergency contact number' $ro></span></td></tr>

		<tr><td colspan='2'><b>Fee paying guardian's detail</b> [ Select from <input type='radio' name='choice' value='1' " .self::CK. ' ' .$this->dis. "> Others <input type='radio' name='choice' value='2'" .($employee['relationWith'] == 'Father' ? self::CK : $this->dis). " onclick=\"form.gttl.value=form.fttl.value; form.gname.value=form.fname.value; form.gprof.value=form.fprof.value; form.rwith.value='Father'; form.gadd.value=form.fadd.value; form.gphone.value=form.fphone.value; form.gemail.value=form.femail.value;\"> Father <input type='radio' name='choice' value='3'" .($employee['relationWith'] == 'Mother' ? self::CK : ''). " onclick=\"form.gttl.value=form.mttl.value; form.gname.value=form.mname.value; form.gprof.value=form.mprof.value; form.rwith.value='Mother'; form.gadd.value=form.madd.value; form.gphone.value=form.mphone.value; form.gemail.value=form.memail.value;\"> Mother ]</td></tr>
		<tr><td nowrap>Guadian Name</td><td nowrap>
		<select id='gttl' name='guardianTitle' style='width: 50px' $ro>";
		list($gtitle, $gname) = explode(" ", $employee['guardianName'], 2);
		foreach (array_unique(array_merge($this->controller->maleTitles, $this->controller->femaleTitles, $this->controller->earnedTitles)) as $code) {
			$str .= "<option value='$code'" .($code == $gtitle ? self::SL : $this->dis). ">$code</option>";
		}
		$str .= "</select><input type='text' id='gname' name='guardianName' size='50' value='$gname' placeholder='' $ro>
		<span class='rightbar'>Profession <select id='gprof' name='guardianProfession' style='width: 150px' $ro>";
		foreach ($this->controller->professions as $code => $desc) {
			$str .= "<option value='$code'" .(trim($employee['guardianProfession']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$str .= "</select></td></tr>
		<tr><td nowrap>Relation With</td><td><input type='text' id='rwith' name='relationWith' size='60' value='" .$employee['relationWith']. "' placeholder='Relation with candidate' $ro></span></td></tr>
		<tr><td nowrap>Address <input type='checkbox' name='same8' value='1' onclick=\"form.gadd.value=form.fadd.value; form.gphone.value=form.fphone.value; form.gemail.value=form.femail.value;\"> Same<sup>2</sup></td>
		<td><input type='text' id='gadd' name='guardianAddress' size='60' value='" .$employee['guardianAddress']. "' placeholder='(Offic address, if applicable)' $ro></td></tr>
		<tr><td nowrap>Email</td><td nowrap><input type='text' id='gemail' name='guardianEmail' size='60' value='" .$employee['guardianEmail']. "' placeholder='Functional email address' $ro>
		<span class='rightbar'>Phone No. <input type='text' id='gphone' name='guardianPhone' size='25' value='" .$employee['guardianPhone']. "' placeholder='Emergency contact number' $ro></span></td></tr>
		<tr valign='top'><td>Remark</td><td><textarea name='remark' rows='2' cols='60' placeholder='Put your remark here' $ro>" .$employee['eremark']. "</textarea></td></tr>
		</table>
		</td></tr>
		<tr valign='top' bgcolor='#f4f6f6'><td colspan='2'>
		<table class='interface'>
		<tr><td><b>Academic detail</b></td><td colspan='2' align='right'>JEE-AIR/GATE/CAT Score</td><td><input type='text' name='lastScore' size='10' value='" .$employee['lastScore']. "' $ro></td><td colspan='8'>(Select board name of X, XII and institute/university name of UG, PG (if applicable) from the given drop-down lists below.)</td></tr>";
		
		$xBoards 		= "<select id='xbl' name='xBoardlist' style='width: 20px;' onchange=\"form.xbt.value=this.value;\"" .$this->dis. ">";
		$xiiBoards 		= "<select id='xiibl' name='xiiBoardlist' style='width: 20px;' onchange=\"form.xiibt.value=this.value;\"" .$this->dis. ">";
		foreach (array_unique(array_merge($this->controller->secondarys, $this->controller->hsecondarys)) as $code => $desc) {
			$xBoards .= "<option value='$code'" .(trim($employee['xBoard']) == $code ? self::SL : $this->dis). ">$desc</option>";
			$xiiBoards .= "<option value='$code'" .(trim($employee['xiiBoard']) == $code ? self::SL : $this->dis). ">$desc</option>";
		}
		$xBoards .= "</select>";
		$xiiBoards .= "</select>";
		
		$str .= "<tr><td width='8%' nowrap align='right'>X Grade Point/%</td><td nowrap><input type='text' name='xGrade' size='6' value='" .$employee['xGrade']. "' placeholder='Mark/GP' $ro></td>
		<td width='8%' nowrap align='right'>Passing Year</td><td><input type='text' name='xYear' size='10' value='" .$employee['xYear']. "' placeholder='4 digits' $ro></td>
		<td width='8%' nowrap align='right'>Board</td><td nowrap><input id='xbt' type='text' name='xBoard' size='30' value='" .$employee['xBoard']. "' $ro>$xBoards</td>
		<td width='8%' nowrap align='right'>XII Grade Point/%</td><td nowrap><input type='text' name='xiiGrade' size='6' value='" .$employee['xiiGrade']. "' placeholder='Mark/GP' $ro></td>
		<td width='8%' nowrap align='right'>Passing Year</td><td><input type='text' name='xiiYear' size='10' value='" .$employee['xiiYear']. "' placeholder='4 digits' $ro></td>
		<td width='8%' nowrap align='right'>Board</td><td nowrap><input id='xiibt' type='text' name='xiiBoard' size='30' value='" .$employee['xiiBoard']. "' $ro>$xiiBoards</td></tr>";
		
		if ($degreeLevel != 'UG') {
			$ugInstitutes = "<select id='ugil' name='ugInstitutelist' style='width: 20px' onchange=\"form.ugit.value=this.value;\"" .$this->dis. ">";
			$pgInstitutes .= "<select id='pgil' name='pgInstitutelist' style='width: 20px' onchange=\"form.pgit.value=this.value;\"" .$this->dis. ">";
			foreach ($this->controller->institutes as $code => $desc) {
				$ugInstitutes .= "<option value='$code'" .(trim($employee['ugInstitute']) == $code ? self::SL : $this->dis). ">$desc</option>";
				$pgInstitutes .= "<option value='$code'" .(trim($employee['pgInstitute']) == $code ? self::SL : $this->dis). ">$desc</option>";
			}
			$ugInstitutes .= "</select>";
			$pgInstitutes .= "</select>";
			
			$str .= "<tr><td nowrap align='right'>UG Grade Point/%</td><td nowrap><input type='text' name='ugGrade' size='6' value='" .$employee['ugGrade']. "' placeholder='Mark/GP' $ro></td>
			<td nowrap align='right'>Passing Year</td><td><input type='text' name='ugYear' size='10' value='" .$employee['ugYear']. "' placeholder='4 digits' $ro></td>
			<td width='8%' nowrap align='right'>Institute</td><td nowrap><input id='ugit' type='text' name='ugInstitute' size='30' value='" .$employee['ugInstitute']. "' $ro>$ugInstitutes</td>
			<td nowrap align='right'>PG Grade Point/%</td><td nowrap><input type='text' name='pgGrade' size='6' value='" .$employee['pgGrade']. "' placeholder='Mark/GP' $ro></td>
			<td nowrap align='right'>Passing Year</td><td><input type='text' name='pgYear' size='10' value='" .$employee['pgYear']. "' placeholder='4 digits' $ro></td>
			<td width='8%' nowrap align='right'>Institute</td><td nowrap><input id='pgit' type='text' name='pgInstitute' size='30' value='" .$employee['pgInstitute']. "' $ro>$pgInstitutes</td></tr>";
		}
		*/
		$str .= "</table></td></tr>
		</table>" .$this->pageFooter('', $toolbar);

		return $str;
	}

	public function hrmEmployees($action, $cadreID) {
		$app 					= $this->controller->app;					// application envoked        
		$menu 					= $this->controller->menu;					// menu envoked        
				
		$cadres					= $this->model->selectCadre();	// get record
		
		if ($cadreID) $toolbar= ($cadreID && file_exists(__DIR__ .'/../uploads/excel-' .$cadreID. '-' .date('Y'). '.csv') ? " <a href='uploads/excel-" .$cadreID. '-' .date('Y'). ".csv'>Download Excel</a>" : " <a href='' onclick=\"inner('$app/$menu/excel/$cadreID'); return false;\" title='Generate Excel Sheet'>Generate Excel</a>");
		$findbar = "Cadre <select name='programID' style='width: 200px' onchange=\"inner('$app/$menu/print/'+this.value); return false;\">
		<option value='0'>Select</option>";
		foreach ($cadres as $cadre) {
			$findbar .= "<option value='" .$cadre['cadreID']. "'" .($cadre['cadreID'] == $cadreID ? self::SL : ''). ">" .$cadre['cadreName']. "</option>";
		}
		$findbar .= "</select>";

		$rows = $this->model->selectEmployee($cadreID);
		
		$str = $this->pageHeader($findbar, $toolbar);
		$str .= $this->printReport($rows);	
		
        return $str;
	}
	
}


?>