<?php
$strTableName="SPC-Pending";
$_SESSION["OwnerID"] = $_SESSION["_".$strTableName."_OwnerID"];

$strOriginalTableName="lead_table";

$gstrOrderBy="";
if(strlen($gstrOrderBy) && strtolower(substr($gstrOrderBy,0,8))!="order by")
	$gstrOrderBy="order by ".$gstrOrderBy;

$g_orderindexes=array();
$gsqlHead="SELECT lead_table.Leadid,  lead_table.Region,  lead_table.`Customer Name`,  lead_table.`Contact Person`,  lead_table.`Lead Details`,  lead_table.`Employee Name`,  lead_table.`Approx Closure Date`,  lead_table.`Lead Status`,  lead_table.`Manager Name`,  lead_table.`Manager Remarks`,  lead_table.`Sales Call Status`,  lead_table.`Lead Level`,  lead_table.`Requirement Details`,  lead_table.`Approx Value`,  lead_table.`First Quote Remarks`,  lead_table.`Proposed Closure Date`,  lead_table.`Projected Closure QTR`,  lead_table.`Proposed Solution Details`,  lead_table.`Quoted Price`,  lead_table.`Final Quote Remarks`,  lead_table.`Discussion Highlights`,  lead_table.`WIN / Lost Analysis`,  lead_table.`Alligned Vendor`,  COUNT(lead_bom.SPC_Status) AS SPC_Item_Count";
$gsqlFrom="FROM lead_table  INNER JOIN lead_bom ON lead_table.Leadid = lead_bom.Lead_ID";
$gsqlWhereExpr="(lead_bom.SPC_Status =\"Pending\")";
$gsqlTail="GROUP BY lead_table.Leadid, lead_table.Region, lead_table.`Customer Name`, lead_table.`Contact Person`, lead_table.`Lead Details`, lead_table.`Employee Name`, lead_table.`Approx Closure Date`, lead_table.`Lead Status`, lead_table.`Manager Name`, lead_table.`Manager Remarks`, lead_table.`Sales Call Status`, lead_table.`Lead Level`, lead_table.`Requirement Details`, lead_table.`Approx Value`, lead_table.`First Quote Remarks`, lead_table.`Proposed Closure Date`, lead_table.`Projected Closure QTR`, lead_table.`Proposed Solution Details`, lead_table.`Quoted Price`, lead_table.`Final Quote Remarks`, lead_table.`Discussion Highlights`, lead_table.`WIN / Lost Analysis`, lead_table.`Alligned Vendor`";

include(getabspath("include/SPC_Pending_settings.php"));

// alias for 'SQLQuery' object
$gQuery = &$queryData_SPC_Pending;
$eventObj = &$tableEvents["SPC-Pending"];

$reportCaseSensitiveGroupFields = false;

$gstrSQL = gSQLWhere("");


?>