<?php
require_once(getabspath("classes/cipherer.php"));
$tdataranking_clientes_cant = array();
	$tdataranking_clientes_cant[".NumberOfChars"] = 80; 
	$tdataranking_clientes_cant[".ShortName"] = "ranking_clientes_cant";
	$tdataranking_clientes_cant[".OwnerID"] = "";
	$tdataranking_clientes_cant[".OriginalTable"] = "venta";

//	field labels
$fieldLabelsranking_clientes_cant = array();
if(mlang_getcurrentlang()=="Spanish")
{
	$fieldLabelsranking_clientes_cant["Spanish"] = array();
	$fieldToolTipsranking_clientes_cant["Spanish"] = array();
	$fieldLabelsranking_clientes_cant["Spanish"]["cliente"] = "Cliente";
	$fieldToolTipsranking_clientes_cant["Spanish"]["cliente"] = "";
	$fieldLabelsranking_clientes_cant["Spanish"]["ranking"] = "Ranking";
	$fieldToolTipsranking_clientes_cant["Spanish"]["ranking"] = "";
	$fieldLabelsranking_clientes_cant["Spanish"]["cantidad"] = "Cantidad";
	$fieldToolTipsranking_clientes_cant["Spanish"]["cantidad"] = "";
	$fieldLabelsranking_clientes_cant["Spanish"]["total"] = "Total";
	$fieldToolTipsranking_clientes_cant["Spanish"]["total"] = "";
	if (count($fieldToolTipsranking_clientes_cant["Spanish"]))
		$tdataranking_clientes_cant[".isUseToolTips"] = true;
}
	
	
	$tdataranking_clientes_cant[".NCSearch"] = true;



$tdataranking_clientes_cant[".shortTableName"] = "ranking_clientes_cant";
$tdataranking_clientes_cant[".nSecOptions"] = 0;
$tdataranking_clientes_cant[".recsPerRowList"] = 1;
$tdataranking_clientes_cant[".mainTableOwnerID"] = "";
$tdataranking_clientes_cant[".moveNext"] = 1;
$tdataranking_clientes_cant[".nType"] = 1;

$tdataranking_clientes_cant[".strOriginalTableName"] = "venta";




$tdataranking_clientes_cant[".showAddInPopup"] = false;

$tdataranking_clientes_cant[".showEditInPopup"] = false;

$tdataranking_clientes_cant[".showViewInPopup"] = false;

$tdataranking_clientes_cant[".fieldsForRegister"] = array();
	
if (!isMobile())
	$tdataranking_clientes_cant[".listAjax"] = true;
else 
	$tdataranking_clientes_cant[".listAjax"] = false;

	$tdataranking_clientes_cant[".audit"] = false;

	$tdataranking_clientes_cant[".locking"] = false;


$tdataranking_clientes_cant[".exportTo"] = true;

$tdataranking_clientes_cant[".printFriendly"] = true;


$tdataranking_clientes_cant[".showSimpleSearchOptions"] = false;

$tdataranking_clientes_cant[".showSearchPanel"] = true;

if (isMobile())
	$tdataranking_clientes_cant[".isUseAjaxSuggest"] = false;
else 
	$tdataranking_clientes_cant[".isUseAjaxSuggest"] = true;

$tdataranking_clientes_cant[".rowHighlite"] = true;

// button handlers file names
$tdataranking_clientes_cant[".isUsebuttonHandlers"] = true;

$tdataranking_clientes_cant[".addPageEvents"] = true;

// use timepicker for search panel
$tdataranking_clientes_cant[".isUseTimeForSearch"] = false;




$tdataranking_clientes_cant[".allSearchFields"] = array();


$tdataranking_clientes_cant[".googleLikeFields"][] = "ranking";
$tdataranking_clientes_cant[".googleLikeFields"][] = "cantidad";
$tdataranking_clientes_cant[".googleLikeFields"][] = "total";

$tdataranking_clientes_cant[".panelSearchFields"][] = "cliente";


$tdataranking_clientes_cant[".isTableType"] = "list";

	



// Access doesn't support subqueries from the same table as main


$tdataranking_clientes_cant[".totalsFields"][] = array(
	"fName" => "cantidad", 
	"numRows" => 0,
	"totalsType" => "TOTAL",
	"viewFormat" => '');
$tdataranking_clientes_cant[".totalsFields"][] = array(
	"fName" => "total", 
	"numRows" => 0,
	"totalsType" => "TOTAL",
	"viewFormat" => 'Number');

$tdataranking_clientes_cant[".pageSize"] = 20;

$tstrOrderBy = "";
if(strlen($tstrOrderBy) && strtolower(substr($tstrOrderBy,0,8))!="order by")
	$tstrOrderBy = "order by ".$tstrOrderBy;
$tdataranking_clientes_cant[".strOrderBy"] = $tstrOrderBy;

$tdataranking_clientes_cant[".orderindexes"] = array();

$tdataranking_clientes_cant[".sqlHead"] = "SELECT @n := @n + 1 AS ranking,      t.cliente,      t.cantidad,      t.total";
$tdataranking_clientes_cant[".sqlFrom"] = "FROM (      SELECT           cliente,          COUNT(idventa) AS cantidad,          SUM(total_venta) AS total      FROM venta      WHERE anulada = 'NO'      GROUP BY cliente      ORDER BY cantidad DESC  ) AS t, (SELECT @n := 0) AS r";
$tdataranking_clientes_cant[".sqlWhereExpr"] = "";
$tdataranking_clientes_cant[".sqlTail"] = "";




//fill array of records per page for list and report without group fields
$arrRPP = array();
$arrRPP[] = 10;
$arrRPP[] = 20;
$arrRPP[] = 30;
$arrRPP[] = 50;
$arrRPP[] = 100;
$arrRPP[] = 500;
$arrRPP[] = -1;
$tdataranking_clientes_cant[".arrRecsPerPage"] = $arrRPP;

//fill array of groups per page for report with group fields
$arrGPP = array();
$arrGPP[] = 1;
$arrGPP[] = 3;
$arrGPP[] = 5;
$arrGPP[] = 10;
$arrGPP[] = 50;
$arrGPP[] = 100;
$arrGPP[] = -1;
$tdataranking_clientes_cant[".arrGroupsPerPage"] = $arrGPP;

$tableKeysranking_clientes_cant = array();
$tdataranking_clientes_cant[".Keys"] = $tableKeysranking_clientes_cant;

$tdataranking_clientes_cant[".listFields"] = array();
$tdataranking_clientes_cant[".listFields"][] = "ranking";
$tdataranking_clientes_cant[".listFields"][] = "cliente";
$tdataranking_clientes_cant[".listFields"][] = "cantidad";
$tdataranking_clientes_cant[".listFields"][] = "total";

$tdataranking_clientes_cant[".viewFields"] = array();

$tdataranking_clientes_cant[".addFields"] = array();
$tdataranking_clientes_cant[".addFields"][] = "total";
$tdataranking_clientes_cant[".addFields"][] = "cantidad";
$tdataranking_clientes_cant[".addFields"][] = "ranking";
$tdataranking_clientes_cant[".addFields"][] = "cliente";

$tdataranking_clientes_cant[".inlineAddFields"] = array();

$tdataranking_clientes_cant[".editFields"] = array();

$tdataranking_clientes_cant[".inlineEditFields"] = array();

$tdataranking_clientes_cant[".exportFields"] = array();
$tdataranking_clientes_cant[".exportFields"][] = "ranking";
$tdataranking_clientes_cant[".exportFields"][] = "cliente";
$tdataranking_clientes_cant[".exportFields"][] = "cantidad";
$tdataranking_clientes_cant[".exportFields"][] = "total";

$tdataranking_clientes_cant[".printFields"] = array();
$tdataranking_clientes_cant[".printFields"][] = "ranking";
$tdataranking_clientes_cant[".printFields"][] = "cliente";
$tdataranking_clientes_cant[".printFields"][] = "cantidad";
$tdataranking_clientes_cant[".printFields"][] = "total";

//	ranking
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 1;
	$fdata["strName"] = "ranking";
	$fdata["GoodName"] = "ranking";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Ranking"; 
	$fdata["FieldType"] = 5;
	
		
		
		$fdata["bListPage"] = true; 
	
		$fdata["bAddPage"] = true; 
	
		
		
		
		
		
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "ranking"; 
		$fdata["FullName"] = "@n := @n + 1";
	
		
		
				$fdata["FieldPermissions"] = true;
	
				$fdata["UploadFolder"] = "files";
		
//  Begin View Formats
	$fdata["ViewFormats"] = array();
	
	$vdata = array("ViewFormat" => "Number");
	
		
		
		
			
		
		$vdata["DecimalDigits"] = 0;
	
		
		
		
		
		$vdata["NeedEncode"] = true;
	
	$fdata["ViewFormats"]["view"] = $vdata;
//  End View Formats

//	Begin Edit Formats 	
	$fdata["EditFormats"] = array();
	
	$edata = array("EditFormat" => "Text field");
	
		
		
	
//	Begin Lookup settings
	//	End Lookup Settings

		
		
		
		
			$edata["acceptFileTypes"] = ".+$";
	
		$edata["maxNumberOfFiles"] = 1;
	
		
		
		
		
		$edata["EditParams"] = "";
			
		
//	Begin validation
	$edata["validateAs"] = array();
				$edata["validateAs"]["basicValidate"][] = getJsValidatorName("Number");	
						
			//	End validation
	
		
				
		$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats
	
		$fdata["isSeparate"] = false;
	
		
		
	$tdataranking_clientes_cant["ranking"] = $fdata;
//	cliente
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 2;
	$fdata["strName"] = "cliente";
	$fdata["GoodName"] = "cliente";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Cliente"; 
	$fdata["FieldType"] = 3;
	
		
		
		$fdata["bListPage"] = true; 
	
		$fdata["bAddPage"] = true; 
	
		
		
		
		
		
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "cliente"; 
		$fdata["FullName"] = "t.cliente";
	
		
		
				$fdata["FieldPermissions"] = true;
	
				$fdata["UploadFolder"] = "files";
		
//  Begin View Formats
	$fdata["ViewFormats"] = array();
	
	$vdata = array("ViewFormat" => "");
	
		
		
		
			
		
		
		
		
		
		
		$vdata["NeedEncode"] = true;
	
	$fdata["ViewFormats"]["view"] = $vdata;
//  End View Formats

//	Begin Edit Formats 	
	$fdata["EditFormats"] = array();
	
	$edata = array("EditFormat" => "Lookup wizard");
	
		
		
	
//	Begin Lookup settings
								$edata["LookupType"] = 2;
	$edata["freeInput"] = 0;
	$edata["autoCompleteFieldsOnEdit"] = 0;
	$edata["autoCompleteFields"] = array();
				if(strpos(GetUserPermissions("ranking_clientes_cant"), 'S') !== false)
		$edata["LCType"] = 2;
	else 
		$edata["LCType"] = 0;
			
		
			
	$edata["LinkField"] = "idcliente";
	$edata["LinkFieldType"] = 3;
	$edata["DisplayField"] = "denominacion";
	
		
	$edata["LookupTable"] = "v_cliente";
	$edata["LookupOrderBy"] = "";
	
		
		
		
		
		$edata["AllowToAdd"] = true; 
	
				
	
	
	//	End Lookup Settings

		$edata["IsRequired"] = true; 
	
		
		
		
			$edata["acceptFileTypes"] = ".+$";
	
		$edata["maxNumberOfFiles"] = 1;
	
		
		
		
		
		
		$edata["inputStyle"] = " width:250px;";
	$edata["controlWidth"] = 250;
	
//	Begin validation
	$edata["validateAs"] = array();
						$edata["validateAs"]["basicValidate"][] = "IsRequired";
	
			//	End validation
	
		
				
		$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats
	
		$fdata["isSeparate"] = false;
	
		
		
	$tdataranking_clientes_cant["cliente"] = $fdata;
//	cantidad
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "cantidad";
	$fdata["GoodName"] = "cantidad";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Cantidad"; 
	$fdata["FieldType"] = 3;
	
		
		
		$fdata["bListPage"] = true; 
	
		$fdata["bAddPage"] = true; 
	
		
		
		
		
		
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "cantidad"; 
		$fdata["FullName"] = "t.cantidad";
	
		
		
				$fdata["FieldPermissions"] = true;
	
				$fdata["UploadFolder"] = "files";
		
//  Begin View Formats
	$fdata["ViewFormats"] = array();
	
	$vdata = array("ViewFormat" => "");
	
		
		
		
			
		
		
		
		
		
		
		$vdata["NeedEncode"] = true;
	
	$fdata["ViewFormats"]["view"] = $vdata;
//  End View Formats

//	Begin Edit Formats 	
	$fdata["EditFormats"] = array();
	
	$edata = array("EditFormat" => "Text field");
	
		
		
	
//	Begin Lookup settings
	//	End Lookup Settings

		
		
		
		
			$edata["acceptFileTypes"] = ".+$";
	
		$edata["maxNumberOfFiles"] = 1;
	
		
		
		
		
		$edata["EditParams"] = "";
			
		
//	Begin validation
	$edata["validateAs"] = array();
				$edata["validateAs"]["basicValidate"][] = getJsValidatorName("Number");	
						
			//	End validation
	
		
				
		$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats
	
		$fdata["isSeparate"] = false;
	
		
		
	$tdataranking_clientes_cant["cantidad"] = $fdata;
//	total
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "total";
	$fdata["GoodName"] = "total";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Total"; 
	$fdata["FieldType"] = 14;
	
		
		
		$fdata["bListPage"] = true; 
	
		$fdata["bAddPage"] = true; 
	
		
		
		
		
		
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "total"; 
		$fdata["FullName"] = "t.total";
	
		
		
				$fdata["FieldPermissions"] = true;
	
				$fdata["UploadFolder"] = "files";
		
//  Begin View Formats
	$fdata["ViewFormats"] = array();
	
	$vdata = array("ViewFormat" => "Number");
	
		
		
		
			
		
		$vdata["DecimalDigits"] = 0;
	
		
		
		
		
		$vdata["NeedEncode"] = true;
	
	$fdata["ViewFormats"]["view"] = $vdata;
//  End View Formats

//	Begin Edit Formats 	
	$fdata["EditFormats"] = array();
	
	$edata = array("EditFormat" => "Text field");
	
		
		
	
//	Begin Lookup settings
	//	End Lookup Settings

		
		
		
		
			$edata["acceptFileTypes"] = ".+$";
	
		$edata["maxNumberOfFiles"] = 1;
	
		
		
		
		
		$edata["EditParams"] = "";
			
		
//	Begin validation
	$edata["validateAs"] = array();
				$edata["validateAs"]["basicValidate"][] = getJsValidatorName("Number");	
						
			//	End validation
	
		
				
		$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats
	
		$fdata["isSeparate"] = false;
	
		
		
	$tdataranking_clientes_cant["total"] = $fdata;

	
$tables_data["ranking_clientes_cant"]=&$tdataranking_clientes_cant;
$field_labels["ranking_clientes_cant"] = &$fieldLabelsranking_clientes_cant;
$fieldToolTips["ranking_clientes_cant"] = &$fieldToolTipsranking_clientes_cant;

// -----------------start  prepare master-details data arrays ------------------------------//
// tables which are detail tables for current table (master)
$detailsTablesData["ranking_clientes_cant"] = array();
	
// tables which are master tables for current table (detail)
$masterTablesData["ranking_clientes_cant"] = array();

// -----------------end  prepare master-details data arrays ------------------------------//

require_once(getabspath("classes/sql.php"));










function createSqlQuery_ranking_clientes_cant()
{
$proto0=array();
$proto0["m_strHead"] = "SELECT";
$proto0["m_strFieldList"] = "@n := @n + 1 AS ranking,      t.cliente,      t.cantidad,      t.total";
$proto0["m_strFrom"] = "FROM (      SELECT           cliente,          COUNT(idventa) AS cantidad,          SUM(total_venta) AS total      FROM venta      WHERE anulada = 'NO'      GROUP BY cliente      ORDER BY cantidad DESC  ) AS t, (SELECT @n := 0) AS r";
$proto0["m_strWhere"] = "";
$proto0["m_strOrderBy"] = "";
$proto0["m_strTail"] = "";
$proto0["cipherer"] = null;
$proto1=array();
$proto1["m_sql"] = "";
$proto1["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto1["m_column"]=$obj;
$proto1["m_contained"] = array();
$proto1["m_strCase"] = "";
$proto1["m_havingmode"] = "0";
$proto1["m_inBrackets"] = "0";
$proto1["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto1);

$proto0["m_where"] = $obj;
$proto3=array();
$proto3["m_sql"] = "";
$proto3["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto3["m_column"]=$obj;
$proto3["m_contained"] = array();
$proto3["m_strCase"] = "";
$proto3["m_havingmode"] = "0";
$proto3["m_inBrackets"] = "0";
$proto3["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto3);

$proto0["m_having"] = $obj;
$proto0["m_fieldlist"] = array();
						$proto5=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "@n := @n + 1"
));

$proto5["m_expr"]=$obj;
$proto5["m_alias"] = "ranking";
$obj = new SQLFieldListItem($proto5);

$proto0["m_fieldlist"][]=$obj;
						$proto7=array();
			$obj = new SQLField(array(
	"m_strName" => "cliente",
	"m_strTable" => "t"
));

$proto7["m_expr"]=$obj;
$proto7["m_alias"] = "";
$obj = new SQLFieldListItem($proto7);

$proto0["m_fieldlist"][]=$obj;
						$proto9=array();
			$obj = new SQLField(array(
	"m_strName" => "cantidad",
	"m_strTable" => "t"
));

$proto9["m_expr"]=$obj;
$proto9["m_alias"] = "";
$obj = new SQLFieldListItem($proto9);

$proto0["m_fieldlist"][]=$obj;
						$proto11=array();
			$obj = new SQLField(array(
	"m_strName" => "total",
	"m_strTable" => "t"
));

$proto11["m_expr"]=$obj;
$proto11["m_alias"] = "";
$obj = new SQLFieldListItem($proto11);

$proto0["m_fieldlist"][]=$obj;
$proto0["m_fromlist"] = array();
												$proto13=array();
$proto13["m_link"] = "SQLL_MAIN";
			$proto14=array();
$proto14["m_strHead"] = "      SELECT";
$proto14["m_strFieldList"] = "cliente,          COUNT(idventa) AS cantidad,          SUM(total_venta) AS total";
$proto14["m_strFrom"] = "FROM venta";
$proto14["m_strWhere"] = "anulada = 'NO'";
$proto14["m_strOrderBy"] = "ORDER BY cantidad DESC";
$proto14["m_strTail"] = "GROUP BY cliente";
$proto14["cipherer"] = null;
$proto15=array();
$proto15["m_sql"] = "anulada = 'NO'";
$proto15["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "anulada",
	"m_strTable" => "venta"
));

$proto15["m_column"]=$obj;
$proto15["m_contained"] = array();
$proto15["m_strCase"] = "= 'NO'";
$proto15["m_havingmode"] = "0";
$proto15["m_inBrackets"] = "0";
$proto15["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto15);

$proto14["m_where"] = $obj;
$proto17=array();
$proto17["m_sql"] = "";
$proto17["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto17["m_column"]=$obj;
$proto17["m_contained"] = array();
$proto17["m_strCase"] = "";
$proto17["m_havingmode"] = "0";
$proto17["m_inBrackets"] = "0";
$proto17["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto17);

$proto14["m_having"] = $obj;
$proto14["m_fieldlist"] = array();
						$proto19=array();
			$obj = new SQLField(array(
	"m_strName" => "cliente",
	"m_strTable" => "venta"
));

$proto19["m_expr"]=$obj;
$proto19["m_alias"] = "";
$obj = new SQLFieldListItem($proto19);

$proto14["m_fieldlist"][]=$obj;
						$proto21=array();
			$proto22=array();
$proto22["m_functiontype"] = "SQLF_COUNT";
$proto22["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "idventa",
	"m_strTable" => "venta"
));

$proto22["m_arguments"][]=$obj;
$proto22["m_strFunctionName"] = "COUNT";
$obj = new SQLFunctionCall($proto22);

$proto21["m_expr"]=$obj;
$proto21["m_alias"] = "cantidad";
$obj = new SQLFieldListItem($proto21);

$proto14["m_fieldlist"][]=$obj;
						$proto24=array();
			$proto25=array();
$proto25["m_functiontype"] = "SQLF_SUM";
$proto25["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "total_venta",
	"m_strTable" => "venta"
));

$proto25["m_arguments"][]=$obj;
$proto25["m_strFunctionName"] = "SUM";
$obj = new SQLFunctionCall($proto25);

$proto24["m_expr"]=$obj;
$proto24["m_alias"] = "total";
$obj = new SQLFieldListItem($proto24);

$proto14["m_fieldlist"][]=$obj;
$proto14["m_fromlist"] = array();
												$proto27=array();
$proto27["m_link"] = "SQLL_MAIN";
			$proto28=array();
$proto28["m_strName"] = "venta";
$proto28["m_columns"] = array();
$proto28["m_columns"][] = "idventa";
$proto28["m_columns"][] = "fecha";
$proto28["m_columns"][] = "cliente";
$proto28["m_columns"][] = "total_venta";
$proto28["m_columns"][] = "total_cobro";
$proto28["m_columns"][] = "observacion";
$proto28["m_columns"][] = "cobrada";
$proto28["m_columns"][] = "anulada";
$obj = new SQLTable($proto28);

$proto27["m_table"] = $obj;
$proto27["m_alias"] = "";
$proto29=array();
$proto29["m_sql"] = "";
$proto29["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto29["m_column"]=$obj;
$proto29["m_contained"] = array();
$proto29["m_strCase"] = "";
$proto29["m_havingmode"] = "0";
$proto29["m_inBrackets"] = "0";
$proto29["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto29);

$proto27["m_joinon"] = $obj;
$obj = new SQLFromListItem($proto27);

$proto14["m_fromlist"][]=$obj;
$proto14["m_groupby"] = array();
												$proto31=array();
						$obj = new SQLField(array(
	"m_strName" => "cliente",
	"m_strTable" => "venta"
));

$proto31["m_column"]=$obj;
$obj = new SQLGroupByItem($proto31);

$proto14["m_groupby"][]=$obj;
$proto14["m_orderby"] = array();
												$proto33=array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "cantidad "
));

$proto33["m_column"]=$obj;
$proto33["m_bAsc"] = 0;
$proto33["m_nColumn"] = 0;
$obj = new SQLOrderByItem($proto33);

$proto14["m_orderby"][]=$obj;					
$obj = new SQLQuery($proto14);

$proto13["m_table"] = $obj;
$proto13["m_alias"] = "t";
$proto35=array();
$proto35["m_sql"] = "";
$proto35["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto35["m_column"]=$obj;
$proto35["m_contained"] = array();
$proto35["m_strCase"] = "";
$proto35["m_havingmode"] = "0";
$proto35["m_inBrackets"] = "0";
$proto35["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto35);

$proto13["m_joinon"] = $obj;
$obj = new SQLFromListItem($proto13);

$proto0["m_fromlist"][]=$obj;
												$proto37=array();
$proto37["m_link"] = "SQLL_CROSSJOIN";
			$proto38=array();
$proto38["m_strHead"] = "SELECT";
$proto38["m_strFieldList"] = "@n := 0";
$proto38["m_strFrom"] = "";
$proto38["m_strWhere"] = "";
$proto38["m_strOrderBy"] = "";
$proto38["m_strTail"] = "";
$proto38["cipherer"] = null;
$proto39=array();
$proto39["m_sql"] = "";
$proto39["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto39["m_column"]=$obj;
$proto39["m_contained"] = array();
$proto39["m_strCase"] = "";
$proto39["m_havingmode"] = "0";
$proto39["m_inBrackets"] = "0";
$proto39["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto39);

$proto38["m_where"] = $obj;
$proto41=array();
$proto41["m_sql"] = "";
$proto41["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto41["m_column"]=$obj;
$proto41["m_contained"] = array();
$proto41["m_strCase"] = "";
$proto41["m_havingmode"] = "0";
$proto41["m_inBrackets"] = "0";
$proto41["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto41);

$proto38["m_having"] = $obj;
$proto38["m_fieldlist"] = array();
						$proto43=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "@n := 0"
));

$proto43["m_expr"]=$obj;
$proto43["m_alias"] = "";
$obj = new SQLFieldListItem($proto43);

$proto38["m_fieldlist"][]=$obj;
$proto38["m_fromlist"] = array();
$proto38["m_groupby"] = array();
$proto38["m_orderby"] = array();
$obj = new SQLQuery($proto38);

$proto37["m_table"] = $obj;
$proto37["m_alias"] = "r";
$proto45=array();
$proto45["m_sql"] = "";
$proto45["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$proto45["m_column"]=$obj;
$proto45["m_contained"] = array();
$proto45["m_strCase"] = "";
$proto45["m_havingmode"] = "0";
$proto45["m_inBrackets"] = "0";
$proto45["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto45);

$proto37["m_joinon"] = $obj;
$obj = new SQLFromListItem($proto37);

$proto0["m_fromlist"][]=$obj;
$proto0["m_groupby"] = array();
$proto0["m_orderby"] = array();
$obj = new SQLQuery($proto0);

	return $obj;
}
$queryData_ranking_clientes_cant = createSqlQuery_ranking_clientes_cant();
				$tdataranking_clientes_cant[".sqlquery"] = $queryData_ranking_clientes_cant;
	
if(isset($tdataranking_clientes_cant["field2"])){
	$tdataranking_clientes_cant["field2"]["LookupTable"] = "carscars_view";
	$tdataranking_clientes_cant["field2"]["LookupOrderBy"] = "name";
	$tdataranking_clientes_cant["field2"]["LookupType"] = 4;
	$tdataranking_clientes_cant["field2"]["LinkField"] = "email";
	$tdataranking_clientes_cant["field2"]["DisplayField"] = "name";
	$tdataranking_clientes_cant[".hasCustomViewField"] = true;
}

include_once(getabspath("include/ranking_clientes_cant_events.php"));
$tableEvents["ranking_clientes_cant"] = new eventclass_ranking_clientes_cant;
$tdataranking_clientes_cant[".hasEvents"] = true;

$cipherer = new RunnerCipherer("ranking_clientes_cant");

?>