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

//	field labels
$fieldLabelsventa_provedores = array();
if(mlang_getcurrentlang()=="Spanish")
{
	$fieldLabelsventa_provedores["Spanish"] = array();
	$fieldToolTipsventa_provedores["Spanish"] = array();
	$fieldLabelsventa_provedores["Spanish"]["cliente"] = "Cliente";
	$fieldToolTipsventa_provedores["Spanish"]["cliente"] = "";
	$fieldLabelsventa_provedores["Spanish"]["total"] = "Total";
	$fieldToolTipsventa_provedores["Spanish"]["total"] = "";
	$fieldLabelsventa_provedores["Spanish"]["costo"] = "Costo";
	$fieldToolTipsventa_provedores["Spanish"]["costo"] = "";
	$fieldLabelsventa_provedores["Spanish"]["precio"] = "Precio";
	$fieldToolTipsventa_provedores["Spanish"]["precio"] = "";
	$fieldLabelsventa_provedores["Spanish"]["importe"] = "Importe";
	$fieldToolTipsventa_provedores["Spanish"]["importe"] = "";
	$fieldLabelsventa_provedores["Spanish"]["subtotal"] = "Subtotal";
	$fieldToolTipsventa_provedores["Spanish"]["subtotal"] = "";
	$fieldLabelsventa_provedores["Spanish"]["descuento"] = "Descuento";
	$fieldToolTipsventa_provedores["Spanish"]["descuento"] = "";
	$fieldLabelsventa_provedores["Spanish"]["ganancia"] = "Ganancia";
	$fieldToolTipsventa_provedores["Spanish"]["ganancia"] = "";
	if (count($fieldToolTipsventa_provedores["Spanish"]))
		$tdataventa_provedores[".isUseToolTips"] = true;
}
	
	
	$tdataventa_provedores[".NCSearch"] = true;



$tdataventa_provedores[".shortTableName"] = "venta_provedores";
$tdataventa_provedores[".nSecOptions"] = 0;
$tdataventa_provedores[".recsPerRowList"] = 1;
$tdataventa_provedores[".mainTableOwnerID"] = "";
$tdataventa_provedores[".moveNext"] = 1;
$tdataventa_provedores[".nType"] = 1;

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




$tdataventa_provedores[".showAddInPopup"] = false;

$tdataventa_provedores[".showEditInPopup"] = false;

$tdataventa_provedores[".showViewInPopup"] = false;

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

	$tdataventa_provedores[".audit"] = false;

	$tdataventa_provedores[".locking"] = false;

$tdataventa_provedores[".edit"] = true;

$tdataventa_provedores[".exportTo"] = true;



$tdataventa_provedores[".showSimpleSearchOptions"] = false;

$tdataventa_provedores[".showSearchPanel"] = true;

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

$tdataventa_provedores[".rowHighlite"] = true;

// button handlers file names

$tdataventa_provedores[".addPageEvents"] = true;

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




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

$tdataventa_provedores[".allSearchFields"][] = "costo";
$tdataventa_provedores[".allSearchFields"][] = "precio";
$tdataventa_provedores[".allSearchFields"][] = "importe";
$tdataventa_provedores[".allSearchFields"][] = "subtotal";
$tdataventa_provedores[".allSearchFields"][] = "descuento";
$tdataventa_provedores[".allSearchFields"][] = "ganancia";
$tdataventa_provedores[".allSearchFields"][] = "cliente";

$tdataventa_provedores[".googleLikeFields"][] = "costo";
$tdataventa_provedores[".googleLikeFields"][] = "precio";
$tdataventa_provedores[".googleLikeFields"][] = "importe";
$tdataventa_provedores[".googleLikeFields"][] = "subtotal";
$tdataventa_provedores[".googleLikeFields"][] = "descuento";
$tdataventa_provedores[".googleLikeFields"][] = "ganancia";

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

$tdataventa_provedores[".advSearchFields"][] = "costo";
$tdataventa_provedores[".advSearchFields"][] = "precio";
$tdataventa_provedores[".advSearchFields"][] = "importe";
$tdataventa_provedores[".advSearchFields"][] = "subtotal";
$tdataventa_provedores[".advSearchFields"][] = "descuento";
$tdataventa_provedores[".advSearchFields"][] = "ganancia";
$tdataventa_provedores[".advSearchFields"][] = "cliente";

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

	



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


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

$tdataventa_provedores[".pageSize"] = 20;

$tstrOrderBy = "ORDER BY venta.idventa DESC";
if(strlen($tstrOrderBy) && strtolower(substr($tstrOrderBy,0,8))!="order by")
	$tstrOrderBy = "order by ".$tstrOrderBy;
$tdataventa_provedores[".strOrderBy"] = $tstrOrderBy;

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

$tdataventa_provedores[".sqlHead"] = "SELECT venta.cliente,  SUM(det_venta.costo) AS costo,  SUM(det_venta.precio) AS precio,  SUM(det_venta.importe) AS importe,  SUM(det_venta.subtotal) AS subtotal,  SUM(det_venta.descuento) AS descuento,  SUM(det_venta.ganancia) AS ganancia,  venta.total";
$tdataventa_provedores[".sqlFrom"] = "FROM venta  INNER JOIN det_venta ON venta.idventa = det_venta.idventa  INNER JOIN articulo ON det_venta.idarticulo = articulo.idarticulo";
$tdataventa_provedores[".sqlWhereExpr"] = "";
$tdataventa_provedores[".sqlTail"] = "GROUP BY venta.cliente";




//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;
$tdataventa_provedores[".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;
$tdataventa_provedores[".arrGroupsPerPage"] = $arrGPP;

$tableKeysventa_provedores = array();
$tdataventa_provedores[".Keys"] = $tableKeysventa_provedores;

$tdataventa_provedores[".listFields"] = array();
$tdataventa_provedores[".listFields"][] = "costo";
$tdataventa_provedores[".listFields"][] = "precio";
$tdataventa_provedores[".listFields"][] = "importe";
$tdataventa_provedores[".listFields"][] = "subtotal";
$tdataventa_provedores[".listFields"][] = "descuento";
$tdataventa_provedores[".listFields"][] = "ganancia";
$tdataventa_provedores[".listFields"][] = "cliente";
$tdataventa_provedores[".listFields"][] = "total";

$tdataventa_provedores[".viewFields"] = array();
$tdataventa_provedores[".viewFields"][] = "costo";
$tdataventa_provedores[".viewFields"][] = "precio";
$tdataventa_provedores[".viewFields"][] = "importe";
$tdataventa_provedores[".viewFields"][] = "subtotal";
$tdataventa_provedores[".viewFields"][] = "descuento";
$tdataventa_provedores[".viewFields"][] = "ganancia";

$tdataventa_provedores[".addFields"] = array();
$tdataventa_provedores[".addFields"][] = "cliente";
$tdataventa_provedores[".addFields"][] = "total";

$tdataventa_provedores[".inlineAddFields"] = array();
$tdataventa_provedores[".inlineAddFields"][] = "costo";
$tdataventa_provedores[".inlineAddFields"][] = "precio";
$tdataventa_provedores[".inlineAddFields"][] = "importe";
$tdataventa_provedores[".inlineAddFields"][] = "subtotal";
$tdataventa_provedores[".inlineAddFields"][] = "descuento";
$tdataventa_provedores[".inlineAddFields"][] = "ganancia";

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

$tdataventa_provedores[".inlineEditFields"] = array();
$tdataventa_provedores[".inlineEditFields"][] = "costo";
$tdataventa_provedores[".inlineEditFields"][] = "precio";
$tdataventa_provedores[".inlineEditFields"][] = "importe";
$tdataventa_provedores[".inlineEditFields"][] = "subtotal";
$tdataventa_provedores[".inlineEditFields"][] = "descuento";
$tdataventa_provedores[".inlineEditFields"][] = "ganancia";

$tdataventa_provedores[".exportFields"] = array();
$tdataventa_provedores[".exportFields"][] = "costo";
$tdataventa_provedores[".exportFields"][] = "precio";
$tdataventa_provedores[".exportFields"][] = "importe";
$tdataventa_provedores[".exportFields"][] = "subtotal";
$tdataventa_provedores[".exportFields"][] = "descuento";
$tdataventa_provedores[".exportFields"][] = "ganancia";
$tdataventa_provedores[".exportFields"][] = "cliente";
$tdataventa_provedores[".exportFields"][] = "total";

$tdataventa_provedores[".printFields"] = array();
$tdataventa_provedores[".printFields"][] = "costo";
$tdataventa_provedores[".printFields"][] = "precio";
$tdataventa_provedores[".printFields"][] = "importe";
$tdataventa_provedores[".printFields"][] = "subtotal";
$tdataventa_provedores[".printFields"][] = "descuento";
$tdataventa_provedores[".printFields"][] = "ganancia";

//	cliente
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 1;
	$fdata["strName"] = "cliente";
	$fdata["GoodName"] = "cliente";
	$fdata["ownerTable"] = "venta";
	$fdata["Label"] = "Cliente"; 
	$fdata["FieldType"] = 3;
	
		
		
		$fdata["bListPage"] = true; 
	
		$fdata["bAddPage"] = true; 
	
		
		
		
		
		$fdata["bAdvancedSearch"] = true; 
	
		
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "cliente"; 
		$fdata["FullName"] = "venta.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("venta_provedores"), '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;
	
		
		
		
		
		
		
//	Begin validation
	$edata["validateAs"] = array();
						$edata["validateAs"]["basicValidate"][] = "IsRequired";
	
			//	End validation
	
		
				
		$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats
	
		$fdata["isSeparate"] = false;
	
		
		
	$tdataventa_provedores["cliente"] = $fdata;
//	costo
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 2;
	$fdata["strName"] = "costo";
	$fdata["GoodName"] = "costo";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Costo"; 
	$fdata["FieldType"] = 14;
	
		
		
		$fdata["bListPage"] = true; 
	
		
		$fdata["bInlineAdd"] = true; 
	
		
		$fdata["bInlineEdit"] = true; 
	
		$fdata["bViewPage"] = true; 
	
		$fdata["bAdvancedSearch"] = true; 
	
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "costo"; 
		$fdata["FullName"] = "SUM(det_venta.costo)";
	
		
		
				$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;
	
		
		
	$tdataventa_provedores["costo"] = $fdata;
//	precio
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "precio";
	$fdata["GoodName"] = "precio";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Precio"; 
	$fdata["FieldType"] = 14;
	
		
		
		$fdata["bListPage"] = true; 
	
		
		$fdata["bInlineAdd"] = true; 
	
		
		$fdata["bInlineEdit"] = true; 
	
		$fdata["bViewPage"] = true; 
	
		$fdata["bAdvancedSearch"] = true; 
	
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "precio"; 
		$fdata["FullName"] = "SUM(det_venta.precio)";
	
		
		
				$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;
	
		
		
	$tdataventa_provedores["precio"] = $fdata;
//	importe
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "importe";
	$fdata["GoodName"] = "importe";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Importe"; 
	$fdata["FieldType"] = 14;
	
		
		
		$fdata["bListPage"] = true; 
	
		
		$fdata["bInlineAdd"] = true; 
	
		
		$fdata["bInlineEdit"] = true; 
	
		$fdata["bViewPage"] = true; 
	
		$fdata["bAdvancedSearch"] = true; 
	
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "importe"; 
		$fdata["FullName"] = "SUM(det_venta.importe)";
	
		
		
				$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;
	
		
		
	$tdataventa_provedores["importe"] = $fdata;
//	subtotal
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 5;
	$fdata["strName"] = "subtotal";
	$fdata["GoodName"] = "subtotal";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Subtotal"; 
	$fdata["FieldType"] = 14;
	
		
		
		$fdata["bListPage"] = true; 
	
		
		$fdata["bInlineAdd"] = true; 
	
		
		$fdata["bInlineEdit"] = true; 
	
		$fdata["bViewPage"] = true; 
	
		$fdata["bAdvancedSearch"] = true; 
	
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "subtotal"; 
		$fdata["FullName"] = "SUM(det_venta.subtotal)";
	
		
		
				$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;
	
		
		
	$tdataventa_provedores["subtotal"] = $fdata;
//	descuento
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 6;
	$fdata["strName"] = "descuento";
	$fdata["GoodName"] = "descuento";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Descuento"; 
	$fdata["FieldType"] = 14;
	
		
		
		$fdata["bListPage"] = true; 
	
		
		$fdata["bInlineAdd"] = true; 
	
		
		$fdata["bInlineEdit"] = true; 
	
		$fdata["bViewPage"] = true; 
	
		$fdata["bAdvancedSearch"] = true; 
	
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "descuento"; 
		$fdata["FullName"] = "SUM(det_venta.descuento)";
	
		
		
				$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;
	
		
		
	$tdataventa_provedores["descuento"] = $fdata;
//	ganancia
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 7;
	$fdata["strName"] = "ganancia";
	$fdata["GoodName"] = "ganancia";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = "Ganancia"; 
	$fdata["FieldType"] = 14;
	
		
		
		$fdata["bListPage"] = true; 
	
		
		$fdata["bInlineAdd"] = true; 
	
		
		$fdata["bInlineEdit"] = true; 
	
		$fdata["bViewPage"] = true; 
	
		$fdata["bAdvancedSearch"] = true; 
	
		$fdata["bPrinterPage"] = true; 
	
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "ganancia"; 
		$fdata["FullName"] = "SUM(det_venta.ganancia)";
	
		
		
				$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;
	
		
		
	$tdataventa_provedores["ganancia"] = $fdata;
//	total
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 8;
	$fdata["strName"] = "total";
	$fdata["GoodName"] = "total";
	$fdata["ownerTable"] = "venta";
	$fdata["Label"] = "Total"; 
	$fdata["FieldType"] = 3;
	
		
		
		$fdata["bListPage"] = true; 
	
		$fdata["bAddPage"] = true; 
	
		
		
		
		
		
		
		$fdata["bExportPage"] = true; 
	
		$fdata["strField"] = "total"; 
		$fdata["FullName"] = "venta.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" => "Readonly");
	
		
		
	
//	Begin Lookup settings
	//	End Lookup Settings

		$edata["IsRequired"] = true; 
	
		
		
		
			$edata["acceptFileTypes"] = ".+$";
	
		$edata["maxNumberOfFiles"] = 1;
	
		
		
		
		
		
		$edata["inputStyle"] = " width:100px;";
	$edata["controlWidth"] = 100;
	
//	Begin validation
	$edata["validateAs"] = array();
						
			//	End validation
	
		
				
		$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats
	
		$fdata["isSeparate"] = false;
	
		
		
	$tdataventa_provedores["total"] = $fdata;

	
$tables_data["venta_provedores"]=&$tdataventa_provedores;
$field_labels["venta_provedores"] = &$fieldLabelsventa_provedores;
$fieldToolTips["venta_provedores"] = &$fieldToolTipsventa_provedores;

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

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

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










function createSqlQuery_venta_provedores()
{
$proto0=array();
$proto0["m_strHead"] = "SELECT";
$proto0["m_strFieldList"] = "venta.cliente,  SUM(det_venta.costo) AS costo,  SUM(det_venta.precio) AS precio,  SUM(det_venta.importe) AS importe,  SUM(det_venta.subtotal) AS subtotal,  SUM(det_venta.descuento) AS descuento,  SUM(det_venta.ganancia) AS ganancia,  venta.total";
$proto0["m_strFrom"] = "FROM venta  INNER JOIN det_venta ON venta.idventa = det_venta.idventa  INNER JOIN articulo ON det_venta.idarticulo = articulo.idarticulo";
$proto0["m_strWhere"] = "";
$proto0["m_strOrderBy"] = "ORDER BY venta.idventa DESC";
$proto0["m_strTail"] = "GROUP BY venta.cliente";
$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 SQLField(array(
	"m_strName" => "cliente",
	"m_strTable" => "venta"
));

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

$proto0["m_fieldlist"][]=$obj;
						$proto7=array();
			$proto8=array();
$proto8["m_functiontype"] = "SQLF_SUM";
$proto8["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "costo",
	"m_strTable" => "det_venta"
));

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

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

$proto0["m_fieldlist"][]=$obj;
						$proto10=array();
			$proto11=array();
$proto11["m_functiontype"] = "SQLF_SUM";
$proto11["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "precio",
	"m_strTable" => "det_venta"
));

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

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

$proto0["m_fieldlist"][]=$obj;
						$proto13=array();
			$proto14=array();
$proto14["m_functiontype"] = "SQLF_SUM";
$proto14["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "importe",
	"m_strTable" => "det_venta"
));

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

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

$proto0["m_fieldlist"][]=$obj;
						$proto16=array();
			$proto17=array();
$proto17["m_functiontype"] = "SQLF_SUM";
$proto17["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "subtotal",
	"m_strTable" => "det_venta"
));

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

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

$proto0["m_fieldlist"][]=$obj;
						$proto19=array();
			$proto20=array();
$proto20["m_functiontype"] = "SQLF_SUM";
$proto20["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "descuento",
	"m_strTable" => "det_venta"
));

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

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

$proto0["m_fieldlist"][]=$obj;
						$proto22=array();
			$proto23=array();
$proto23["m_functiontype"] = "SQLF_SUM";
$proto23["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "ganancia",
	"m_strTable" => "det_venta"
));

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

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

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

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

$proto0["m_fieldlist"][]=$obj;
$proto0["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";
$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);

$proto0["m_fromlist"][]=$obj;
												$proto31=array();
$proto31["m_link"] = "SQLL_INNERJOIN";
			$proto32=array();
$proto32["m_strName"] = "det_venta";
$proto32["m_columns"] = array();
$proto32["m_columns"][] = "iddet_venta";
$proto32["m_columns"][] = "idventa";
$proto32["m_columns"][] = "idarticulo";
$proto32["m_columns"][] = "costo";
$proto32["m_columns"][] = "precio";
$proto32["m_columns"][] = "cantidad";
$proto32["m_columns"][] = "importe";
$proto32["m_columns"][] = "subtotal";
$proto32["m_columns"][] = "descuento";
$proto32["m_columns"][] = "ganancia";
$proto32["m_columns"][] = "anulada";
$obj = new SQLTable($proto32);

$proto31["m_table"] = $obj;
$proto31["m_alias"] = "";
$proto33=array();
$proto33["m_sql"] = "venta.idventa = det_venta.idventa";
$proto33["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "idventa",
	"m_strTable" => "venta"
));

$proto33["m_column"]=$obj;
$proto33["m_contained"] = array();
$proto33["m_strCase"] = "= det_venta.idventa";
$proto33["m_havingmode"] = "0";
$proto33["m_inBrackets"] = "0";
$proto33["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto33);

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

$proto0["m_fromlist"][]=$obj;
												$proto35=array();
$proto35["m_link"] = "SQLL_INNERJOIN";
			$proto36=array();
$proto36["m_strName"] = "articulo";
$proto36["m_columns"] = array();
$proto36["m_columns"][] = "idarticulo";
$proto36["m_columns"][] = "codigo";
$proto36["m_columns"][] = "nombre";
$proto36["m_columns"][] = "idcategoria";
$proto36["m_columns"][] = "idsubcategoria";
$proto36["m_columns"][] = "costo";
$proto36["m_columns"][] = "precio";
$proto36["m_columns"][] = "stock";
$proto36["m_columns"][] = "idproveedor";
$proto36["m_columns"][] = "fecha_carga";
$proto36["m_columns"][] = "prefijo_cod";
$proto36["m_columns"][] = "sufijo_cod";
$proto36["m_columns"][] = "ult_cod_generado";
$proto36["m_columns"][] = "observacion";
$obj = new SQLTable($proto36);

$proto35["m_table"] = $obj;
$proto35["m_alias"] = "";
$proto37=array();
$proto37["m_sql"] = "det_venta.idarticulo = articulo.idarticulo";
$proto37["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "idarticulo",
	"m_strTable" => "det_venta"
));

$proto37["m_column"]=$obj;
$proto37["m_contained"] = array();
$proto37["m_strCase"] = "= articulo.idarticulo";
$proto37["m_havingmode"] = "0";
$proto37["m_inBrackets"] = "0";
$proto37["m_useAlias"] = "0";
$obj = new SQLLogicalExpr($proto37);

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

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

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

$proto0["m_groupby"][]=$obj;
$proto0["m_orderby"] = array();
												$proto41=array();
						$obj = new SQLField(array(
	"m_strName" => "idventa",
	"m_strTable" => "venta"
));

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

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

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

include_once(getabspath("include/venta_provedores_events.php"));
$tableEvents["venta_provedores"] = new eventclass_venta_provedores;
$tdataventa_provedores[".hasEvents"] = true;

$cipherer = new RunnerCipherer("venta_provedores");

?>