<?php require "_header.php"; ?>
<style type="text/css">
	th{
	width: 160px;
	}
</style>

<div id="main-report" align="center">
<center><h4>Customer 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="";
			$order_type="";
			
			$header_row_string="Customer Detail Report";
			
			$customer_id =Escape($_REQUEST["ID"]);
			$hiddendist_code =Escape($_REQUEST["hiddendist_code"]);
			
			if(isset($customer_id )){  
				if($customer_id!=""){
					$condition.=" and  lc.customer_id = '$customer_id' ";
				}
			}
			if($hiddendist_code !="" && $hiddendist_code !="All")
			{
			 	$condition.= " AND lc.district_id = '".$hiddendist_code."' ";  
			}	
			$condition .= " Order By lc.customer_orgname";
			$objCustomerMgmt = new CustomerMgmt();
			$out = $objCustomerMgmt->getAllRecords($limit,$start,$condition,$order_field,$order_type);
			if(dbRows($out)) {
			   ob_start(); //starting for 
				while($row=dbArray($out)) {
					//print_r($row);
					extract($row);
					if($employee_photo=="")
					$imgfile = $SiteImagePath."default.gif";
					else
					$imgfile = $EmployeeImagePath .$employee_photo;
					
				
		?>
		
		
		<table width="60%" align="center" class="report">
		  <tr>
			<th align="left" >Customer Org Name : </th>
			<td colspan="2" ><?php print $customer_orgname; ?></td>
			
		  </tr>
		  <tr>
			<th align="left">Current Address :</td>
			<td  colspan="2"><?php print $customer_address; ?> </td>
		  </tr>
		 
		  <tr>
			<th align="left">Phone No1.:</th>
			<td colspan="2"><?php print $customer_phone1;?>  </td>
		  </tr>
		  <tr>
			<th align="left">Phone No2.:</th>
			<td colspan="2"><?php print $customer_phone2;?> </td>
		  </tr>
           <tr>
			<th align="left">Website :</th>
			<td colspan="2"><?php print $customer_website; ?> </td>
		  </tr>
		   <tr>
			<th align="left">Email :</th>
			<td colspan="2"><?php print $customer_email;?> </td>
		  </tr>
           <tr>
			<th align="left">Tin No :</th>
			<td colspan="2"><?php print $customer_tinno;?> </td>
		  </tr>
		  <tr>
			 <th align="left">CST No :</th>
			<td colspan="2"><?php print $customer_cstno; ?></td>
		  </tr>
		  <tr>
			<th align="left">PAN No :</th>
			<td colspan="2"><?php print $customer_panno;?></td>
		  </tr>
           <tr>
			<th align="left">Service Tax No :</th>
			<td colspan="2"><?php print $customer_servicetaxno;?></td>
		  </tr>
           <tr>
			<th align="left">Customer Remark :</th>
			<td colspan="2"><?php print $customer_remark;?></td>
		  </tr>
          <tr>
			<th align="left">Contact Person :</th>
			<td colspan="2"><?php print $customer_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 $customer_cpmobile1;?></td>
		  </tr>
           <tr>
			<th align="left">Email :</th>
			<td colspan="2"><?php print $customer_cpemail1;?></td>
		  </tr>
		 
		  	
  </table>
  <br/>
		<?php } //while loop over
		     
			 
			  $HtmlCode= ob_get_contents();
			  ob_end_flush();
			  $HtmlUrl 	=	"customer-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";?>