<?php require "_header.php";

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

</script>
<style type="text/css">
	body {
		font-family: Arial, sans-serif;
	}

	.id-card {
		width: 85%;
		border: 1px solid #ccc;
		border-radius: 10px;
		overflow: hidden;
		margin: 20px auto;
		background-size: cover;
		background-repeat: no-repeat;
	}

	.id-card table {
		width: 100%;
	}

	.id-card img {
		width: 100%;
		height: 100%;
		display: block;
	}

	.id-card th,
	.id-card td {
		padding: 10px;
		text-align: left;
	}

	.container {
		width: 95%;
		margin: 0 auto;
	}

	.id-card .photo {
		width: 150px;
		height: 150px;
		vertical-align: top;
	}

	.id-card .info {
		padding-left: 10px;
	}

	table.i-card {
		margin-top: 270px;
		/* Adjust based on layout */
	}

	th {
		color: rgb(6, 106, 96);
		font-size: 22px;
		font-weight: 600;
	}

	td {
		font-weight: 600;
		font-size: 22px;
	}

	.college_name {
		font-family: QTAbbie;
		font-size: 24px;
		font-weight: bold;
		padding: 2px 2px 2px 2px;
		text-align: center;
	}

	.college_address {
		font-family: Tahoma, Geneva, sans-serif;
		font-size: 11px;
		text-align: center;
		padding: 2px 2px 2px 2px;
	}

	@media print {
		.page-break {
			page-break-before: always;
			page-break-inside: avoid;
			page-break-after: auto;
			height: 0;
		}
	}
</style>
<?php

if ($_SESSION['VedantnrCollegeId'] != "" && isset($_SESSION['VedantnrCollegeId'])) {
	$employee_isteaching = Escape($_REQUEST['employee_isteaching']);
	$employee_designation = Escape($_REQUEST['employeedesignation']);
	$branch_id = Escape($_REQUEST['branch_hidden']);
	$employee_id = Escape($_REQUEST['employee_id_hid']);
	$order_by = $_REQUEST['hid_orderby'];
	$limit = 0;
	$start = 0;
	$SQL_CONDITION = "";
	$order_field = "";
	$order_type = "";

	if ($employee_id != "" && $employee_id != "undefined") {
		$SQL_CONDITION .= " AND employee_id = '" . $employee_id . "'";
	}
	if ($employee_designation != "" && $employee_designation != "undefined") {
		$SQL_CONDITION .= " AND employee_designation = '" . $employee_designation . "'";
	}
	if ($branch_id != "" && $branch_id != "undefined") {
		$SQL_CONDITION .= " AND branch_id = '" . $branch_id . "'";
	}
	if ($order_by != "" && $order_by != "undefined") {
		$order_field = $order_by;
		$order_type = " ASC ";
	} else {
		$order_field = "designation_priority ASC,employee_name ";
		$order_type = " ASC ";
	}
	$SQL_CONDITION .= " AND employee_active = 'YES' ";

	if ($SQL_CONDITION != "") {
		$SQL_STUDENT .= $SQL_CONDITION;
	}
	//echo $SQL_STUDENT;
	$objEmployeeMgmt = new EmployeeMgmt();
	$RES_STUDENT = $objEmployeeMgmt->getAllRecords($limit, $start, $SQL_STUDENT, $order_field, $order_type);

	$objCollegeMgmt = new CollegeMgmt();
	$qry_college = $objCollegeMgmt->getAllRecords($limit = 0, $start = 0, $condition = "", $order_field = "", $order_type = "");
	$qry_college_res = dbArray($qry_college);
	$part = 1;
	$count = 0;
	$page_break = 1;
	if (dbRows($RES_STUDENT)) {
		ob_start(); ?>
		<section class="portal-result">
			<div class="container">
				<center>
					<h4>Employee Identity Card</h4>
				</center>
				<?php
				while ($row = dbArray($RES_STUDENT)) {
					extract($row);

					if ($employee_photo != "") {
						$imgfile = $SiteBaseUrl . $EmployeeImagePath . "/" . $employee_photo;
					} else {
						$imgfile = $SiteBaseUrl . $EmployeeImagePath . "default.gif";
					}
					?>
					<div class="id-card">
						<table>
							<img src="<?php echo $SiteBaseUrl . $CollegeImagePath . $_SESSION["VedantnrCollegeLogo"]; ?>"
								alt="College Logo" style="width: 80px; height: auto; float: left; margin-right: 10px;">
							<div style="display: inline-block; vertical-align: middle;">
								<b style="font-size: 30px;"><?php echo $_SESSION["VedantnrCollegeName"]; ?></b><br>
								<?php echo $_SESSION["VedantnrCollegeAddress"]; ?><br>
								Phone: <?php echo $_SESSION["VedantnrCollegePhone"]; ?>&nbsp;&nbsp;
								Email: <?php echo $_SESSION["VedantnrCollegeEmail"]; ?>
							</div>

							<tr>
								<td rowspan="10" class="photo">
									<img src="<?php echo $imgfile; ?>" alt="">
									<?php print $employee_name ?>
									</br>
									<?php print $employee_designation1 ?>
								</td>
							</tr>
							<tr>
								<th style="width: 25%;">EMPLOYEE NO</th>
								<td style="width: 5px;">:</td>
								<td><?php echo $employee_no; ?></td>
							</tr>
							<tr height="60">
								<?php if ($branch_if == 'Administration') {
									?>
									<th>DEPARTMENT</th>
									<td>:</td>
									<td><?php echo "Administration" ?></td>
									<?php
								} else if ($branch_id == 'H. & A. S.') {
									?>
										<th>DEPARTMENT</th>
										<td>:</td>
										<td><?php echo "H. & A. S." ?></td>
									<?php
								} else if ($branch_name == 'Others') {
									?>
											<th>DEPARTMENT</th>
											<td>:</td>
											<td><?php echo "Others" ?></td>
									<?php
								} else {
									?>
											<th>DEPARTMENT</th>
											<td>:</td>
											<td><?php print $BranchName ?></td>
									<?php
								}
								?>
							</tr>
							<tr>
								<th>DATE OF JOINING</th>
								<td>:</td>
								<td><?php print date("d-m-Y", strtotime($employee_deptjoindate)) ?></td>
							</tr>
							<tr>
								<th>DATE OF BIRTH</th>
								<td>:</td>
								<td><?php print date("d-m-Y", strtotime($employee_birthdate)) ?></td>
							</tr>
							<tr>
								<th>BLOOD GROUP</th>
								<td>:</td>
								<td><?php print $employee_bloodgroup ?></td>
							</tr>
							<tr>
								<th>PAN NO</td>
								<td>:</td>
								<td><?php print $employee_panno ?></br></td>
							</tr>
							<tr>
								<th>RESIDENTIAL ADDRESS</th>
								<td>:</td>
								<td><?php echo $employee_permaddress; ?></td>
							</tr>
							<tr>
								<th>CELL NO</th>
								<td>:</td>
								<td><?php print $employee_phone ?></td>
							</tr>
							<tr>
								<th> &nbsp; </th>
								<th> &nbsp; </th>
								<th style="  text-align: -webkit-right;}">
									<img src="<?php echo $SiteBaseUrl . $EmployeeImagePath . 'employee_sign_' . $employee_id . '.jpg'; ?>"
										alt="Employee Signature" style="width: 200px; height: 100px;" />
								</th>
							</tr>
						</table>
					</div>
					<div class="page-break"></div>
					<?php
				}
				?>
			</div>
		</section>
		<?php
		$HtmlCode = ob_get_contents();
		ob_end_flush();

		$HtmlUrl = "student-identity-report-" . $_SESSION["VedantnrUserId"] . ".html";
		$HtmlPath = "report/" . $HtmlUrl;
		createHTMLReportPage($header_row_string, $HtmlUrl, $HtmlPath, $HtmlCode);

		?>
		<br />
		<form name="frm1" id="frm1" action="" method="get">
			<input type="hidden" name="txtFile" id="txtFile" value="<?php echo $HtmlUrl; ?>" />

			<input type="button" name="btnPdf" id="btnPdf" value="Print" onClick="SetPageAction('PRINT');" />
			<input type="button" name="btnPdf" id="btnPdf" value="Create PDF" onClick="SetPageAction('PDF');" />
			<input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onClick="SetPageAction('HTML');" />
			<input type="button" name="btnWord" id="btnWord" value="Create WORD" onClick="SetPageAction('WORD');" />

			<input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onClick="SetPageAction('Excel');" />

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

			function SetPageAction(varAction) {

				if (varAction == "PRINT") {
					document.frm1.action = "print/create-print.php";
					document.frm1.submit();
				}
				if (varAction == "PDF") {
					document.frm1.action = "convertpdf/create-pdf.php";
					document.frm1.target = "_blank";
					document.frm1.submit();
				}
				else if (varAction == "HTML") {
					document.frm1.action = "<?php echo $HtmlPath; ?>";
					document.frm1.target = "_blank";
					document.frm1.submit();
				}
				else if (varAction == "WORD") {
					document.frm1.action = "convertword/create-word.php";
					document.frm1.target = "_blank";
					document.frm1.submit();
				}
				else if (varAction == "Excel") {
					document.frm1.action = "convertword/create-excel.php";
					document.frm1.target = "_blank";
					document.frm1.submit();
				}
			}
		</script>

		<?php
	} else {
		echo "<b>No Data Found.</b>";
	}
}
?>
<?php require "_footer.php"; ?>