<?php require "_header.php"; ?>
<div id="main-report" align="center">
	<center>
		<h4>Vendor Detail Report</h4>
	</center>
	<?php
	if ($_SESSION["cCompany_id"] == "") {
		?>
		<script language="javascript" type="text/javascript">
			location.href = 'report-form-employee.php';
		</script>
		<?php
	} elseif ($_SESSION["cCompany_id"] != "" && isset($_SESSION["cCompany_id"])) {

		$date = new Date();

		$limit = 0;
		$start = 0;
		$condition = "";
		$order_field = "vendor_id";
		$order_type = "ASC";

		$header_row_string = "Vendor Detail Report";

		$vendor_id = Escape($_REQUEST["ID"]);
		if (isset($vendor_id)) {
			if ($vendor_id != "") {
				$condition .= " and  lv.vendor_id  = '$vendor_id '";
			}
		}
		$objVendorMgmt = new VendorMgmt();
		$out = $objVendorMgmt->getAllRecords($limit, $start, $condition, $order_field, $order_type);
		if (dbRows($out)) {
			ob_start(); //starting for 
			while ($row = dbArray($out)) {
				//print_r($row);
				extract($row);



				?>
				<table width="60%" align="center" class="report">
					<tr>
						<th align="left">Vendor Org Name : </th>
						<td colspan="2"><?php print $vendor_orgname; ?></td>

					</tr>
					<tr>
						<th align="left">Address :</td>
						<td colspan="2"><?php print $vendor_address; ?> </td>
					</tr>

					<tr>
						<th align="left">Phone No1.:</th>
						<td colspan="2"><?php print $vendor_phone1; ?> </td>
					</tr>
					<tr>
						<th align="left">Phone No2.:</th>
						<td colspan="2"><?php print $vendor_phone2; ?> </td>
					</tr>
					<tr>
						<th align="left">Website :</th>
						<td colspan="2"><?php print $vendor_website; ?> </td>
					</tr>
					<tr>
						<th align="left">Email :</th>
						<td colspan="2"><?php print $vendor_email; ?> </td>
					</tr>
					<tr>
						<th align="left">Tin No :</th>
						<td colspan="2"><?php print $vendor_tinno; ?> </td>
					</tr>
					<tr>
						<th align="left">CST No :</th>
						<td colspan="2"><?php print $vendor_cstno; ?></td>
					</tr>
					<tr>
						<th align="left">PAN No :</th>
						<td colspan="2"><?php print $vendor_panno; ?></td>
					</tr>
					<tr>
						<th align="left">Service Tax No :</th>
						<td colspan="2"><?php print $vendor_servicetaxno; ?></td>
					</tr>
					<tr>
						<th align="left">Customer Remark :</th>
						<td colspan="2"><?php print $vendor_remark; ?></td>
					</tr>
					<tr>
						<th align="left">Contact Person :</th>
						<td colspan="2"><?php print $vendor_cpname1; ?> </td>
					</tr>
					<tr>
						<th align="left">Designation :</th>
						<td colspan="2"><?php print $designation_name; ?></td>
					</tr>
					<tr>
						<th align="left">Mobile :</th>
						<td colspan="2"><?php print $vendor_cpmobile1; ?></td>
					</tr>
					<tr>
						<th align="left">Email :</th>
						<td colspan="2"><?php print $vendor_cpemail1; ?></td>
					</tr>


				</table>
				<br />
			<?php } //while loop over
	

			$HtmlCode = ob_get_contents();
			ob_end_flush();
			$HtmlUrl = "employee-personal-detail-report-" . $_SESSION["cUserId"] . ".html";
			$HtmlPath = "report/" . $HtmlUrl;
			createHTMLReportPage($header_row_string, $HtmlUrl, $HtmlPath, $HtmlCode, false); ?>
			<br />
			<form name="frm" id="frm" action="" method="post">
				<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.frm.action = "print/create-print.php";
						document.frm.target = "_blank";
						document.frm.submit();
					}
					if (varAction == "PDF") {
						document.frm.action = "convertpdf/create-pdf.php";
						document.frm.target = "_blank";
						document.frm.submit();
					}
					else if (varAction == "HTML") {
						document.frm.action = "<?php echo $HtmlPath; ?>";
						document.frm.target = "_blank";
						document.frm.submit();
					}
					else if (varAction == "WORD") {
						document.frm.action = "convertword/create-word.php";
						document.frm.target = "_blank";
						document.frm.submit();
					}
					else if (varAction == "Excel") {
						document.frm.action = "convertword/create-excel.php";
						document.frm.target = "_blank";
						document.frm.submit();
					}
				}
			</script>
			<br /><br />
		<?php } else {
			echo "<center><b> No Records Found.</b></center>";
		}
	} else {
		echo "Session Expired";
	}
	?>
</div>
<?php require "_footer.php"; ?>