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

function DisplayMasterTableInfo_List_Management($params)
{
	$detailtable=$params["detailtable"];
	$keys=$params["keys"];
	global $conn,$strTableName;
	$xt = new Xtempl();
	
	$oldTableName=$strTableName;
	$strTableName="List Management";

//$strSQL = "Select  idCL,  `Customer Name`,  Address,  City,  `State`,  Country,  `Postal Code`,  `Web address`,  Area,  Customer_Category,  `Breif About the Company`,  `Existing Setup`,  `Interaction Summary`,  `Commercial Summary`,  `Customer Status`,  Region,  `Last Updated on`,  MonthName(`Last Updated on`) AS `LU-Month`,  Year(`Last Updated on`) AS `LU-Year`,  `Created on`,  `Assigned Executive`,  `Assigned Date`,  `Aligned Partner`  FROM customer_list  ORDER BY idCL DESC  ";

$sqlHead="Select idCL,  `Customer Name`,  Address,  City,  `State`,  Country,  `Postal Code`,  `Web address`,  Area,  Customer_Category,  `Breif About the Company`,  `Existing Setup`,  `Interaction Summary`,  `Commercial Summary`,  `Customer Status`,  Region,  `Last Updated on`,  MonthName(`Last Updated on`) AS `LU-Month`,  Year(`Last Updated on`) AS `LU-Year`,  `Created on`,  `Assigned Executive`,  `Assigned Date`,  `Aligned Partner`";
$sqlFrom="FROM customer_list";
$sqlWhere="";
$sqlTail="";

$where="";

if($detailtable=="Contact Details")
{
		$where.= GetFullFieldName("Customer Name")."=".make_db_value("Customer 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["idCL"]));
	

	$xt->display("List_Management_masterprint.htm");
	$strTableName=$oldTableName;

}

?>