<?php
include(getabspath("include/Vendor_Details_settings.php"));

function DisplayMasterTableInfo_Vendor_Details($params)
{
	$detailtable=$params["detailtable"];
	$keys=$params["keys"];
	global $conn,$strTableName;
	$xt = new Xtempl();
	
	$oldTableName=$strTableName;
	$strTableName="Vendor Details";

//$strSQL = "SELECT  idvendor_list,  `Vendor Name`,  `Brief About`,  `Web Address`,  Remarks  FROM vendor_list  ";

$sqlHead="SELECT idvendor_list,  `Vendor Name`,  `Brief About`,  `Web Address`,  Remarks";
$sqlFrom="FROM vendor_list";
$sqlWhere="";
$sqlTail="";

$where="";

if($detailtable=="Contact Details")
{
		$where.= GetFullFieldName("Vendor Name")."=".make_db_value("Vendor Name",$keys[1-1]);
}
if($detailtable=="Open Leads")
{
		$where.= GetFullFieldName("Vendor Name")."=".make_db_value("Vendor Name",$keys[1-1]);
}
if(!$where)
{
	$strTableName=$oldTableName;
	return;
}
	$str = SecuritySQL("Export");
	if(strlen($str))
		$where.=" and ".$str;
	
	$strWhere=whereAdd($sqlWhere,$where);
	if(strlen($strWhere))
		$strWhere=" where ".$strWhere." ";
	$strSQL= $sqlHead.' '.$sqlFrom.$strWhere.$sqlTail;

//	$strSQL=AddWhere($strSQL,$where);

	LogInfo($strSQL);
	$rs=db_query($strSQL,$conn);
	$data=db_fetch_array($rs);
	if(!$data)
	{
		$strTableName=$oldTableName;
		return;
	}
	$keylink="";
	$keylink.="&key1=".htmlspecialchars(rawurlencode(@$data["idvendor_list"]));
	


//	idvendor_list - 
			$value="";
				$value = ProcessLargeText(GetData($data,"idvendor_list", ""),"field=idvendor%5Flist".$keylink,"",MODE_PRINT);
			$xt->assign("idvendor_list_mastervalue",$value);

//	Vendor Name - 
			$value="";
				$value = ProcessLargeText(GetData($data,"Vendor Name", ""),"field=Vendor+Name".$keylink,"",MODE_PRINT);
			$xt->assign("Vendor_Name_mastervalue",$value);

//	Brief About - HTML
			$value="";
				$value = GetData($data,"Brief About", "HTML");
			$xt->assign("Brief_About_mastervalue",$value);

//	Web Address - Hyperlink
			$value="";
				$value = GetData($data,"Web Address", "Hyperlink");
			$xt->assign("Web_Address_mastervalue",$value);

//	Remarks - HTML
			$value="";
				$value = GetData($data,"Remarks", "HTML");
			$xt->assign("Remarks_mastervalue",$value);
	$xt->display("Vendor_Details_masterprint.htm");
	$strTableName=$oldTableName;

}

?>