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

//	field labels
$fieldLabelsrenking_clientes_total = array();
if(mlang_getcurrentlang()=="Spanish")
{
	$fieldLabelsrenking_clientes_total["Spanish"] = array();
	$fieldToolTipsrenking_clientes_total["Spanish"] = array();
	$fieldLabelsrenking_clientes_total["Spanish"]["cliente"] = "Cliente";
	$fieldToolTipsrenking_clientes_total["Spanish"]["cliente"] = "";
	$fieldLabelsrenking_clientes_total["Spanish"]["ranking"] = "Ranking";
	$fieldToolTipsrenking_clientes_total["Spanish"]["ranking"] = "";
	$fieldLabelsrenking_clientes_total["Spanish"]["cantidad_ventas"] = "Cantidad Ventas";
	$fieldToolTipsrenking_clientes_total["Spanish"]["cantidad_ventas"] = "";
	$fieldLabelsrenking_clientes_total["Spanish"]["monto_total"] = "Monto Total";
	$fieldToolTipsrenking_clientes_total["Spanish"]["monto_total"] = "";
	if (count($fieldToolTipsrenking_clientes_total["Spanish"]))
		$tdatarenking_clientes_total[".isUseToolTips"] = true;
}
	
	
	$tdatarenking_clientes_total[".NCSearch"] = true;



$tdatarenking_clientes_total[".shortTableName"] = "renking_clientes_total";
$tdatarenking_clientes_total[".nSecOptions"] = 0;
$tdatarenking_clientes_total[".recsPerRowList"] = 1;
$tdatarenking_clientes_total[".mainTableOwnerID"] = "";
$tdatarenking_clientes_total[".moveNext"] = 1;
$tdatarenking_clientes_total[".nType"] = 1;

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




$tdatarenking_clientes_total[".showAddInPopup"] = false;

$tdatarenking_clientes_total[".showEditInPopup"] = false;

$tdatarenking_clientes_total[".showViewInPopup"] = false;

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

	$tdatarenking_clientes_total[".audit"] = false;

	$tdatarenking_clientes_total[".locking"] = false;


$tdatarenking_clientes_total[".exportTo"] = true;

$tdatarenking_clientes_total[".printFriendly"] = true;


$tdatarenking_clientes_total[".showSimpleSearchOptions"] = false;

$tdatarenking_clientes_total[".showSearchPanel"] = true;

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

$tdatarenking_clientes_total[".rowHighlite"] = true;

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

$tdatarenking_clientes_total[".addPageEvents"] = true;

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




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


$tdatarenking_clientes_total[".googleLikeFields"][] = "ranking";
$tdatarenking_clientes_total[".googleLikeFields"][] = "cantidad_ventas";
$tdatarenking_clientes_total[".googleLikeFields"][] = "monto_total";

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


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

	



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


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

$tdatarenking_clientes_total[".pageSize"] = 20;

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

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

$tdatarenking_clientes_total[".sqlHead"] = "SELECT (@n := @n + 1) AS ranking,      t.cliente,      t.cantidad_ventas,      t.monto_total";
$tdatarenking_clientes_total[".sqlFrom"] = "FROM (      SELECT           cliente,          COUNT(idventa) AS cantidad_ventas,          SUM(total_venta) AS monto_total      FROM venta      WHERE anulada = 'NO'      GROUP BY cliente      ORDER BY monto_total DESC  ) AS t,   (SELECT @n := 0) AS r";
$tdatarenking_clientes_total[".sqlWhereExpr"] = "";
$tdatarenking_clientes_total[".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;
$tdatarenking_clientes_total[".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;
$tdatarenking_clientes_total[".arrGroupsPerPage"] = $arrGPP;

$tableKeysrenking_clientes_total = array();
$tdatarenking_clientes_total[".Keys"] = $tableKeysrenking_clientes_total;

$tdatarenking_clientes_total[".listFields"] = array();
$tdatarenking_clientes_total[".listFields"][] = "ranking";
$tdatarenking_clientes_total[".listFields"][] = "cantidad_ventas";
$tdatarenking_clientes_total[".listFields"][] = "monto_total";
$tdatarenking_clientes_total[".listFields"][] = "cliente";

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

$tdatarenking_clientes_total[".addFields"] = array();
$tdatarenking_clientes_total[".addFields"][] = "monto_total";
$tdatarenking_clientes_total[".addFields"][] = "cantidad_ventas";
$tdatarenking_clientes_total[".addFields"][] = "ranking";
$tdatarenking_clientes_total[".addFields"][] = "cliente";

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

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

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

$tdatarenking_clientes_total[".exportFields"] = array();
$tdatarenking_clientes_total[".exportFields"][] = "monto_total";
$tdatarenking_clientes_total[".exportFields"][] = "cantidad_ventas";
$tdatarenking_clientes_total[".exportFields"][] = "ranking";
$tdatarenking_clientes_total[".exportFields"][] = "cliente";

$tdatarenking_clientes_total[".printFields"] = array();
$tdatarenking_clientes_total[".printFields"][] = "ranking";
$tdatarenking_clientes_total[".printFields"][] = "cliente";
$tdatarenking_clientes_total[".printFields"][] = "cantidad_ventas";
$tdatarenking_clientes_total[".printFields"][] = "monto_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"] = 2;
	
		
		
		
		
		$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;
	
		
		
	$tdatarenking_clientes_total["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("renking_clientes_total"), '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;
	
		
		
	$tdatarenking_clientes_total["cliente"] = $fdata;
//	cantidad_ventas
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "cantidad_ventas";
	$fdata["GoodName"] = "cantidad_ventas";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Cantidad Ventas"; 
	$fdata["FieldType"] = 3;
	
		
		
		$fdata["bListPage"] = true; 
	
		$fdata["bAddPage"] = true; 
	
		
		
		
		
		
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "cantidad_ventas"; 
		$fdata["FullName"] = "t.cantidad_ventas";
	
		
		
				$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;
	
		
		
	$tdatarenking_clientes_total["cantidad_ventas"] = $fdata;
//	monto_total
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "monto_total";
	$fdata["GoodName"] = "monto_total";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Monto Total"; 
	$fdata["FieldType"] = 14;
	
		
		
		$fdata["bListPage"] = true; 
	
		$fdata["bAddPage"] = true; 
	
		
		
		
		
		
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "monto_total"; 
		$fdata["FullName"] = "t.monto_total";
	
		
		
				$fdata["FieldPermissions"] = true;
	
				$fdata["UploadFolder"] = "files";
		
//  Begin View Formats
	$fdata["ViewFormats"] = array();
	
	$vdata = array("ViewFormat" => "Number");
	
		
		
		
			
		
		$vdata["DecimalDigits"] = 2;
	
		
		
		
		
		$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;
	
		
		
	$tdatarenking_clientes_total["monto_total"] = $fdata;

	
$tables_data["renking_clientes_total"]=&$tdatarenking_clientes_total;
$field_labels["renking_clientes_total"] = &$fieldLabelsrenking_clientes_total;
$fieldToolTips["renking_clientes_total"] = &$fieldToolTipsrenking_clientes_total;

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

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

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










function createSqlQuery_renking_clientes_total()
{
$proto0=array();
$proto0["m_strHead"] = "SELECT";
$proto0["m_strFieldList"] = "(@n := @n + 1) AS ranking,      t.cliente,      t.cantidad_ventas,      t.monto_total";
$proto0["m_strFrom"] = "FROM (      SELECT           cliente,          COUNT(idventa) AS cantidad_ventas,          SUM(total_venta) AS monto_total      FROM venta      WHERE anulada = 'NO'      GROUP BY cliente      ORDER BY monto_total 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_ventas",
	"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" => "monto_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_ventas,          SUM(total_venta) AS monto_total";
$proto14["m_strFrom"] = "FROM venta";
$proto14["m_strWhere"] = "anulada = 'NO'";
$proto14["m_strOrderBy"] = "ORDER BY monto_total 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_ventas";
$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"] = "monto_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" => "monto_total "
));

$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_renking_clientes_total = createSqlQuery_renking_clientes_total();
				$tdatarenking_clientes_total[".sqlquery"] = $queryData_renking_clientes_total;
	
if(isset($tdatarenking_clientes_total["field2"])){
	$tdatarenking_clientes_total["field2"]["LookupTable"] = "carscars_view";
	$tdatarenking_clientes_total["field2"]["LookupOrderBy"] = "name";
	$tdatarenking_clientes_total["field2"]["LookupType"] = 4;
	$tdatarenking_clientes_total["field2"]["LinkField"] = "email";
	$tdatarenking_clientes_total["field2"]["DisplayField"] = "name";
	$tdatarenking_clientes_total[".hasCustomViewField"] = true;
}

include_once(getabspath("include/renking_clientes_total_events.php"));
$tableEvents["renking_clientes_total"] = new eventclass_renking_clientes_total;
$tdatarenking_clientes_total[".hasEvents"] = true;

$cipherer = new RunnerCipherer("renking_clientes_total");

?>