<?php



$tdatamarza_stock = array();
$tdatamarza_stock[".searchableFields"] = array();
$tdatamarza_stock[".ShortName"] = "marza_stock";
$tdatamarza_stock[".OwnerID"] = "";
$tdatamarza_stock[".OriginalTable"] = "Vinha";


$tdatamarza_stock[".pagesByType"] = my_json_decode( "{\"export\":[\"export\"],\"list\":[\"list\"],\"masterlist\":[\"masterlist\"],\"masterprint\":[\"masterprint\"],\"print\":[\"print\"],\"search\":[\"search\"]}" );
$tdatamarza_stock[".originalPagesByType"] = $tdatamarza_stock[".pagesByType"];
$tdatamarza_stock[".pages"] = types2pages( my_json_decode( "{\"export\":[\"export\"],\"list\":[\"list\"],\"masterlist\":[\"masterlist\"],\"masterprint\":[\"masterprint\"],\"print\":[\"print\"],\"search\":[\"search\"]}" ) );
$tdatamarza_stock[".originalPages"] = $tdatamarza_stock[".pages"];
$tdatamarza_stock[".defaultPages"] = my_json_decode( "{\"export\":\"export\",\"list\":\"list\",\"masterlist\":\"masterlist\",\"masterprint\":\"masterprint\",\"print\":\"print\",\"search\":\"search\"}" );
$tdatamarza_stock[".originalDefaultPages"] = $tdatamarza_stock[".defaultPages"];

//	field labels
$fieldLabelsmarza_stock = array();
$fieldToolTipsmarza_stock = array();
$pageTitlesmarza_stock = array();
$placeHoldersmarza_stock = array();

if(mlang_getcurrentlang()=="Portuguese(Standard)")
{
	$fieldLabelsmarza_stock["Portuguese(Standard)"] = array();
	$fieldToolTipsmarza_stock["Portuguese(Standard)"] = array();
	$placeHoldersmarza_stock["Portuguese(Standard)"] = array();
	$pageTitlesmarza_stock["Portuguese(Standard)"] = array();
	$fieldLabelsmarza_stock["Portuguese(Standard)"]["Marza"] = "Marza";
	$fieldToolTipsmarza_stock["Portuguese(Standard)"]["Marza"] = "";
	$placeHoldersmarza_stock["Portuguese(Standard)"]["Marza"] = "";
	$fieldLabelsmarza_stock["Portuguese(Standard)"]["Total"] = "Total";
	$fieldToolTipsmarza_stock["Portuguese(Standard)"]["Total"] = "";
	$placeHoldersmarza_stock["Portuguese(Standard)"]["Total"] = "";
	$fieldLabelsmarza_stock["Portuguese(Standard)"]["Vendas"] = "Vendas";
	$fieldToolTipsmarza_stock["Portuguese(Standard)"]["Vendas"] = "";
	$placeHoldersmarza_stock["Portuguese(Standard)"]["Vendas"] = "";
	$fieldLabelsmarza_stock["Portuguese(Standard)"]["stock"] = "Stock";
	$fieldToolTipsmarza_stock["Portuguese(Standard)"]["stock"] = "";
	$placeHoldersmarza_stock["Portuguese(Standard)"]["stock"] = "";
	if (count($fieldToolTipsmarza_stock["Portuguese(Standard)"]))
		$tdatamarza_stock[".isUseToolTips"] = true;
}


	$tdatamarza_stock[".NCSearch"] = true;


	$tdatamarza_stock[".scrollGridBody"] = true;

$tdatamarza_stock[".shortTableName"] = "marza_stock";
$tdatamarza_stock[".nSecOptions"] = 0;

$tdatamarza_stock[".mainTableOwnerID"] = "";
$tdatamarza_stock[".entityType"] = 1;

$tdatamarza_stock[".strOriginalTableName"] = "Vinha";

	



$tdatamarza_stock[".showAddInPopup"] = true;

$tdatamarza_stock[".showEditInPopup"] = false;

$tdatamarza_stock[".showViewInPopup"] = false;

//page's base css files names
$popupPagesLayoutNames = array();
			;
$popupPagesLayoutNames["add"] = "add";
$tdatamarza_stock[".popupPagesLayoutNames"] = $popupPagesLayoutNames;


$tdatamarza_stock[".listAjax"] = false;
//	temporary
$tdatamarza_stock[".listAjax"] = false;

	$tdatamarza_stock[".audit"] = true;

	$tdatamarza_stock[".locking"] = true;


$pages = $tdatamarza_stock[".defaultPages"];

if( $pages[PAGE_EDIT] ) {
	$tdatamarza_stock[".edit"] = true;
	$tdatamarza_stock[".afterEditAction"] = 1;
	$tdatamarza_stock[".closePopupAfterEdit"] = 1;
	$tdatamarza_stock[".afterEditActionDetTable"] = "";
}

if( $pages[PAGE_ADD] ) {
$tdatamarza_stock[".add"] = true;
$tdatamarza_stock[".afterAddAction"] = 1;
$tdatamarza_stock[".closePopupAfterAdd"] = 1;
$tdatamarza_stock[".afterAddActionDetTable"] = "";
}

if( $pages[PAGE_LIST] ) {
	$tdatamarza_stock[".list"] = true;
}



$tdatamarza_stock[".strSortControlSettingsJSON"] = "";




if( $pages[PAGE_VIEW] ) {
$tdatamarza_stock[".view"] = true;
}

if( $pages[PAGE_IMPORT] ) {
$tdatamarza_stock[".import"] = true;
}

if( $pages[PAGE_EXPORT] ) {
$tdatamarza_stock[".exportTo"] = true;
}

if( $pages[PAGE_PRINT] ) {
$tdatamarza_stock[".printFriendly"] = true;
}



$tdatamarza_stock[".showSimpleSearchOptions"] = true; // temp fix #13449

// Allow Show/Hide Fields in GRID
$tdatamarza_stock[".allowShowHideFields"] = true; // temp fix #13449
//

// Allow Fields Reordering in GRID
$tdatamarza_stock[".allowFieldsReordering"] = true; // temp fix #13449
//

$tdatamarza_stock[".isUseAjaxSuggest"] = true;

$tdatamarza_stock[".rowHighlite"] = true;



			

$tdatamarza_stock[".ajaxCodeSnippetAdded"] = false;

$tdatamarza_stock[".buttonsAdded"] = false;

$tdatamarza_stock[".addPageEvents"] = false;

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


$tdatamarza_stock[".badgeColor"] = "6B8E23";


$tdatamarza_stock[".allSearchFields"] = array();
$tdatamarza_stock[".filterFields"] = array();
$tdatamarza_stock[".requiredSearchFields"] = array();

$tdatamarza_stock[".googleLikeFields"] = array();
$tdatamarza_stock[".googleLikeFields"][] = "Marza";
$tdatamarza_stock[".googleLikeFields"][] = "Total";
$tdatamarza_stock[".googleLikeFields"][] = "Vendas";
$tdatamarza_stock[".googleLikeFields"][] = "stock";



$tdatamarza_stock[".tableType"] = "list";

$tdatamarza_stock[".printerPageOrientation"] = 0;
$tdatamarza_stock[".nPrinterPageScale"] = 100;

$tdatamarza_stock[".nPrinterSplitRecords"] = 40;

$tdatamarza_stock[".geocodingEnabled"] = false;










$tdatamarza_stock[".pageSize"] = 999;

$tdatamarza_stock[".warnLeavingPages"] = true;



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

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

$tdatamarza_stock[".sqlHead"] = "SELECT Marza,Total , Vendas, (Total - vendas) as stock";
$tdatamarza_stock[".sqlFrom"] = "FROM   ( SELECT Marza,SUM(Totale) AS Total FROM Assegnatos GROUP BY Marza)A    Inner JOIN     ( SELECT CodMarza,SUM(Quantidade) AS Vendas FROM Vinha GROUP BY CodMarza)B      on (Marza=CodMarza)";
$tdatamarza_stock[".sqlWhereExpr"] = "";
$tdatamarza_stock[".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;
$tdatamarza_stock[".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;
$tdatamarza_stock[".arrGroupsPerPage"] = $arrGPP;

$tdatamarza_stock[".highlightSearchResults"] = true;

$tableKeysmarza_stock = array();
$tdatamarza_stock[".Keys"] = $tableKeysmarza_stock;


$tdatamarza_stock[".hideMobileList"] = array();




//	Marza
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 1;
	$fdata["strName"] = "Marza";
	$fdata["GoodName"] = "Marza";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("Marza_stock","Marza");
	$fdata["FieldType"] = 200;

	
	
	
			

		$fdata["strField"] = "Marza";

		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "Marza";

	
	
				$fdata["UploadFolder"] = "files";

//  Begin View Formats
	$fdata["ViewFormats"] = array();

	$vdata = array("ViewFormat" => "");

	
	
	
	
	
	
	
	
	
	
	
	
		$vdata["NeedEncode"] = true;

	
		$vdata["truncateText"] = true;
	$vdata["NumberOfChars"] = 80;

	$fdata["ViewFormats"]["view"] = $vdata;
//  End View Formats

//	Begin Edit Formats
	$fdata["EditFormats"] = array();

	$edata = array("EditFormat" => "Lookup wizard");

	
		$edata["weekdayMessage"] = array("message" => "", "messageType" => "Text");
	$edata["weekdays"] = "[]";


	
	

// Begin Lookup settings
				$edata["LookupType"] = 2;
	$edata["LookupTable"] = "Assegnatos";
			$edata["autoCompleteFieldsOnEdit"] = 0;
	$edata["autoCompleteFields"] = array();
		$edata["LCType"] = 0;

	
			$edata["LookupUnique"] = true;

	$edata["LinkField"] = "Marza";
	$edata["LinkFieldType"] = 0;
	$edata["DisplayField"] = "Marza";

	

	
	$edata["LookupOrderBy"] = "Marza";

	
	
	
	

	
	
		$edata["SelectSize"] = 1;

// End Lookup Settings


	
	
	
	
			$edata["acceptFileTypes"] = ".+$";
		$edata["acceptFileTypesHtml"] = "";

		$edata["maxNumberOfFiles"] = 1;

	
	
	
	
	
	
		$edata["controlWidth"] = 200;

//	Begin validation
	$edata["validateAs"] = array();
	$edata["validateAs"]["basicValidate"] = array();
	$edata["validateAs"]["customMessages"] = array();
	
	
	//	End validation

	
			
	
	
	
	$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats


	$fdata["isSeparate"] = false;




// the field's search options settings
		$fdata["defaultSearchOption"] = "Equals";

			// the default search options list
				$fdata["searchOptionsList"] = array("Contains", "Equals", "Starts with", "More than", "Less than", "Between", "Empty", NOT_EMPTY);
// the end of search options settings


//Filters settings
	$fdata["filterTotals"] = 0;
		$fdata["filterMultiSelect"] = 0;
			$fdata["filterFormat"] = "Values list";
		$fdata["showCollapsed"] = false;

		$fdata["sortValueType"] = 0;
		$fdata["numberOfVisibleItems"] = 10;

		$fdata["filterBy"] = 0;

	

	
	
//end of Filters settings


	$tdatamarza_stock["Marza"] = $fdata;
		$tdatamarza_stock[".searchableFields"][] = "Marza";
//	Total
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 2;
	$fdata["strName"] = "Total";
	$fdata["GoodName"] = "Total";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("Marza_stock","Total");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "Total";

		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "Total";

	
	
				$fdata["UploadFolder"] = "files";

//  Begin View Formats
	$fdata["ViewFormats"] = array();

	$vdata = array("ViewFormat" => "Number");

	
	
	
	
	
	
		$vdata["DecimalDigits"] = 0;

	
	
	
	
	
		$vdata["NeedEncode"] = true;

	
		$vdata["truncateText"] = true;
	$vdata["NumberOfChars"] = 80;

	$fdata["ViewFormats"]["view"] = $vdata;
//  End View Formats

//	Begin Edit Formats
	$fdata["EditFormats"] = array();

	$edata = array("EditFormat" => "Text field");

	
		$edata["weekdayMessage"] = array("message" => "", "messageType" => "Text");
	$edata["weekdays"] = "[]";


	
	



		$edata["IsRequired"] = true;

	
	
	
			$edata["acceptFileTypes"] = ".+$";
		$edata["acceptFileTypesHtml"] = "";

		$edata["maxNumberOfFiles"] = 1;

	
	
	
	
			$edata["HTML5InuptType"] = "text";

		$edata["EditParams"] = "";
		
		$edata["controlWidth"] = 200;

//	Begin validation
	$edata["validateAs"] = array();
	$edata["validateAs"]["basicValidate"] = array();
	$edata["validateAs"]["customMessages"] = array();
				$edata["validateAs"]["basicValidate"][] = getJsValidatorName("Number");
						$edata["validateAs"]["basicValidate"][] = "IsRequired";
		
	
	//	End validation

	
			
	
	
	
	$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats


	$fdata["isSeparate"] = false;




// the field's search options settings
		$fdata["defaultSearchOption"] = "Contains";

			// the default search options list
				$fdata["searchOptionsList"] = array("Contains", "Equals", "Starts with", "More than", "Less than", "Between", "Empty", NOT_EMPTY);
// the end of search options settings


//Filters settings
	$fdata["filterTotals"] = 0;
		$fdata["filterMultiSelect"] = 0;
			$fdata["filterFormat"] = "Values list";
		$fdata["showCollapsed"] = false;

		$fdata["sortValueType"] = 0;
		$fdata["numberOfVisibleItems"] = 10;

		$fdata["filterBy"] = 0;

	

	
	
//end of Filters settings


	$tdatamarza_stock["Total"] = $fdata;
		$tdatamarza_stock[".searchableFields"][] = "Total";
//	Vendas
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "Vendas";
	$fdata["GoodName"] = "Vendas";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("Marza_stock","Vendas");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "Vendas";

		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "Vendas";

	
	
				$fdata["UploadFolder"] = "files";

//  Begin View Formats
	$fdata["ViewFormats"] = array();

	$vdata = array("ViewFormat" => "Number");

	
	
	
	
	
	
		$vdata["DecimalDigits"] = 0;

	
	
	
	
	
		$vdata["NeedEncode"] = true;

	
		$vdata["truncateText"] = true;
	$vdata["NumberOfChars"] = 80;

	$fdata["ViewFormats"]["view"] = $vdata;
//  End View Formats

//	Begin Edit Formats
	$fdata["EditFormats"] = array();

	$edata = array("EditFormat" => "Text field");

	
		$edata["weekdayMessage"] = array("message" => "", "messageType" => "Text");
	$edata["weekdays"] = "[]";


	
	



		$edata["IsRequired"] = true;

	
	
	
			$edata["acceptFileTypes"] = ".+$";
		$edata["acceptFileTypesHtml"] = "";

		$edata["maxNumberOfFiles"] = 1;

	
	
	
	
			$edata["HTML5InuptType"] = "text";

		$edata["EditParams"] = "";
		
		$edata["controlWidth"] = 200;

//	Begin validation
	$edata["validateAs"] = array();
	$edata["validateAs"]["basicValidate"] = array();
	$edata["validateAs"]["customMessages"] = array();
				$edata["validateAs"]["basicValidate"][] = getJsValidatorName("Number");
						$edata["validateAs"]["basicValidate"][] = "IsRequired";
		
	
	//	End validation

	
			
	
	
	
	$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats


	$fdata["isSeparate"] = false;




// the field's search options settings
		$fdata["defaultSearchOption"] = "Contains";

			// the default search options list
				$fdata["searchOptionsList"] = array("Contains", "Equals", "Starts with", "More than", "Less than", "Between", "Empty", NOT_EMPTY);
// the end of search options settings


//Filters settings
	$fdata["filterTotals"] = 0;
		$fdata["filterMultiSelect"] = 0;
			$fdata["filterFormat"] = "Values list";
		$fdata["showCollapsed"] = false;

		$fdata["sortValueType"] = 0;
		$fdata["numberOfVisibleItems"] = 10;

		$fdata["filterBy"] = 0;

	

	
	
//end of Filters settings


	$tdatamarza_stock["Vendas"] = $fdata;
		$tdatamarza_stock[".searchableFields"][] = "Vendas";
//	stock
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "stock";
	$fdata["GoodName"] = "stock";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("Marza_stock","stock");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "stock";

		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "(Total - vendas)";

	
	
				$fdata["UploadFolder"] = "files";

//  Begin View Formats
	$fdata["ViewFormats"] = array();

	$vdata = array("ViewFormat" => "Number");

	
	
	
	
	
	
		$vdata["DecimalDigits"] = 0;

	
	
	
	
	
		$vdata["NeedEncode"] = true;

	
		$vdata["truncateText"] = true;
	$vdata["NumberOfChars"] = 80;

	$fdata["ViewFormats"]["view"] = $vdata;
//  End View Formats

//	Begin Edit Formats
	$fdata["EditFormats"] = array();

	$edata = array("EditFormat" => "Text field");

	
		$edata["weekdayMessage"] = array("message" => "", "messageType" => "Text");
	$edata["weekdays"] = "[]";


	
	



		$edata["IsRequired"] = true;

	
	
	
			$edata["acceptFileTypes"] = ".+$";
		$edata["acceptFileTypesHtml"] = "";

		$edata["maxNumberOfFiles"] = 1;

	
	
	
	
			$edata["HTML5InuptType"] = "text";

		$edata["EditParams"] = "";
		
		$edata["controlWidth"] = 200;

//	Begin validation
	$edata["validateAs"] = array();
	$edata["validateAs"]["basicValidate"] = array();
	$edata["validateAs"]["customMessages"] = array();
				$edata["validateAs"]["basicValidate"][] = getJsValidatorName("Number");
						$edata["validateAs"]["basicValidate"][] = "IsRequired";
		
	
	//	End validation

	
			
	
	
	
	$fdata["EditFormats"]["edit"] = $edata;
//	End Edit Formats


	$fdata["isSeparate"] = false;




// the field's search options settings
		$fdata["defaultSearchOption"] = "Contains";

			// the default search options list
				$fdata["searchOptionsList"] = array("Contains", "Equals", "Starts with", "More than", "Less than", "Between", "Empty", NOT_EMPTY);
// the end of search options settings


//Filters settings
	$fdata["filterTotals"] = 0;
		$fdata["filterMultiSelect"] = 0;
			$fdata["filterFormat"] = "Values list";
		$fdata["showCollapsed"] = false;

		$fdata["sortValueType"] = 0;
		$fdata["numberOfVisibleItems"] = 10;

		$fdata["filterBy"] = 0;

	

	
	
//end of Filters settings


	$tdatamarza_stock["stock"] = $fdata;
		$tdatamarza_stock[".searchableFields"][] = "stock";


$tables_data["Marza stock"]=&$tdatamarza_stock;
$field_labels["Marza_stock"] = &$fieldLabelsmarza_stock;
$fieldToolTips["Marza_stock"] = &$fieldToolTipsmarza_stock;
$placeHolders["Marza_stock"] = &$placeHoldersmarza_stock;
$page_titles["Marza_stock"] = &$pageTitlesmarza_stock;

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

		$dIndex = 0;
	$detailsParam = array();
	$detailsParam["dDataSourceTable"]="Vinha";
		$detailsParam["dOriginalTable"] = "Vinha";



				$detailsParam["dType"]=PAGE_LIST;
	$detailsParam["dShortTable"] = "Vinha";
	$detailsParam["dCaptionTable"] = GetTableCaption("Vinha");
	$detailsParam["masterKeys"] =array();
	$detailsParam["detailKeys"] =array();


		
	$detailsTablesData["Marza stock"][$dIndex] = $detailsParam;

	
		$detailsTablesData["Marza stock"][$dIndex]["masterKeys"] = array();

	$detailsTablesData["Marza stock"][$dIndex]["masterKeys"][]="Marza";

				$detailsTablesData["Marza stock"][$dIndex]["detailKeys"] = array();

	$detailsTablesData["Marza stock"][$dIndex]["detailKeys"][]="CodMarza";

// tables which are master tables for current table (detail)
$masterTablesData["Marza stock"] = array();



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


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










function createSqlQuery_marza_stock()
{
$proto1=array();
$proto1["m_strHead"] = "SELECT";
$proto1["m_strFieldList"] = "Marza,Total , Vendas, (Total - vendas) as stock";
$proto1["m_strFrom"] = "FROM   ( SELECT Marza,SUM(Totale) AS Total FROM Assegnatos GROUP BY Marza)A    Inner JOIN     ( SELECT CodMarza,SUM(Quantidade) AS Vendas FROM Vinha GROUP BY CodMarza)B      on (Marza=CodMarza)";
$proto1["m_strWhere"] = "";
$proto1["m_strOrderBy"] = "";
	
		;
			$proto1["cipherer"] = null;
$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"] = false;
$proto3["m_inBrackets"] = false;
$proto3["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto3);

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

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

$proto1["m_having"] = $obj;
$proto1["m_fieldlist"] = array();
						$proto7=array();
			$obj = new SQLField(array(
	"m_strName" => "Marza",
	"m_strTable" => "A",
	"m_srcTableName" => "Marza stock"
));

$proto7["m_sql"] = "Marza";
$proto7["m_srcTableName"] = "Marza stock";
$proto7["m_expr"]=$obj;
$proto7["m_alias"] = "";
$obj = new SQLFieldListItem($proto7);

$proto1["m_fieldlist"][]=$obj;
						$proto9=array();
			$obj = new SQLField(array(
	"m_strName" => "Total",
	"m_strTable" => "A",
	"m_srcTableName" => "Marza stock"
));

$proto9["m_sql"] = "Total";
$proto9["m_srcTableName"] = "Marza stock";
$proto9["m_expr"]=$obj;
$proto9["m_alias"] = "";
$obj = new SQLFieldListItem($proto9);

$proto1["m_fieldlist"][]=$obj;
						$proto11=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "Vendas"
));

$proto11["m_sql"] = "Vendas";
$proto11["m_srcTableName"] = "Marza stock";
$proto11["m_expr"]=$obj;
$proto11["m_alias"] = "";
$obj = new SQLFieldListItem($proto11);

$proto1["m_fieldlist"][]=$obj;
						$proto13=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "(Total - vendas)"
));

$proto13["m_sql"] = "(Total - vendas)";
$proto13["m_srcTableName"] = "Marza stock";
$proto13["m_expr"]=$obj;
$proto13["m_alias"] = "stock";
$obj = new SQLFieldListItem($proto13);

$proto1["m_fieldlist"][]=$obj;
$proto1["m_fromlist"] = array();
												$proto15=array();
$proto15["m_link"] = "SQLL_MAIN";
			$proto16=array();
$proto16["m_strHead"] = " SELECT";
$proto16["m_strFieldList"] = "Marza,SUM(Totale) AS Total";
$proto16["m_strFrom"] = "FROM Assegnatos";
$proto16["m_strWhere"] = "";
$proto16["m_strOrderBy"] = "";
	
		;
			$proto16["cipherer"] = null;
$proto18=array();
$proto18["m_sql"] = "";
$proto18["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

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

$proto16["m_having"] = $obj;
$proto16["m_fieldlist"] = array();
						$proto22=array();
			$obj = new SQLField(array(
	"m_strName" => "Marza",
	"m_strTable" => "Assegnatos",
	"m_srcTableName" => "Marza stock"
));

$proto22["m_sql"] = "Marza";
$proto22["m_srcTableName"] = "Marza stock";
$proto22["m_expr"]=$obj;
$proto22["m_alias"] = "";
$obj = new SQLFieldListItem($proto22);

$proto16["m_fieldlist"][]=$obj;
						$proto24=array();
			$proto25=array();
$proto25["m_functiontype"] = "SQLF_SUM";
$proto25["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "Totale",
	"m_strTable" => "Assegnatos",
	"m_srcTableName" => "Marza stock"
));

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

$proto24["m_sql"] = "SUM(Totale)";
$proto24["m_srcTableName"] = "Marza stock";
$proto24["m_expr"]=$obj;
$proto24["m_alias"] = "Total";
$obj = new SQLFieldListItem($proto24);

$proto16["m_fieldlist"][]=$obj;
$proto16["m_fromlist"] = array();
												$proto27=array();
$proto27["m_link"] = "SQLL_MAIN";
			$proto28=array();
$proto28["m_strName"] = "Assegnatos";
$proto28["m_srcTableName"] = "Marza stock";
$proto28["m_columns"] = array();
$proto28["m_columns"][] = "Data";
$proto28["m_columns"][] = "Marza";
$proto28["m_columns"][] = "Talea";
$proto28["m_columns"][] = "Varieta";
$proto28["m_columns"][] = "Totale";
$proto28["m_columns"][] = "Codice";
$proto28["m_columns"][] = "Clone";
$obj = new SQLTable($proto28);

$proto27["m_table"] = $obj;
$proto27["m_sql"] = "Assegnatos";
$proto27["m_alias"] = "";
$proto27["m_srcTableName"] = "Marza stock";
$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"] = false;
$proto29["m_inBrackets"] = false;
$proto29["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto29);

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

$proto16["m_fromlist"][]=$obj;
$proto16["m_groupby"] = array();
												$proto31=array();
						$obj = new SQLField(array(
	"m_strName" => "Marza",
	"m_strTable" => "Assegnatos",
	"m_srcTableName" => "Marza stock"
));

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

$proto16["m_groupby"][]=$obj;
$proto16["m_orderby"] = array();
$proto16["m_srcTableName"]="Marza stock";		
$obj = new SQLQuery($proto16);

$proto15["m_table"] = $obj;
$proto15["m_sql"] = "( SELECT Marza,SUM(Totale) AS Total FROM Assegnatos GROUP BY Marza)A";
$proto15["m_alias"] = "A";
$proto15["m_srcTableName"] = "Marza stock";
$proto33=array();
$proto33["m_sql"] = "";
$proto33["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto1["m_fromlist"][]=$obj;
												$proto35=array();
$proto35["m_link"] = "SQLL_INNERJOIN";
			$proto36=array();
$proto36["m_strHead"] = " SELECT";
$proto36["m_strFieldList"] = "CodMarza,SUM(Quantidade) AS Vendas";
$proto36["m_strFrom"] = "FROM Vinha";
$proto36["m_strWhere"] = "";
$proto36["m_strOrderBy"] = "";
	
		;
			$proto36["cipherer"] = null;
$proto38=array();
$proto38["m_sql"] = "";
$proto38["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

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

$proto36["m_having"] = $obj;
$proto36["m_fieldlist"] = array();
						$proto42=array();
			$obj = new SQLField(array(
	"m_strName" => "CodMarza",
	"m_strTable" => "Vinha",
	"m_srcTableName" => "Marza stock"
));

$proto42["m_sql"] = "CodMarza";
$proto42["m_srcTableName"] = "Marza stock";
$proto42["m_expr"]=$obj;
$proto42["m_alias"] = "";
$obj = new SQLFieldListItem($proto42);

$proto36["m_fieldlist"][]=$obj;
						$proto44=array();
			$proto45=array();
$proto45["m_functiontype"] = "SQLF_SUM";
$proto45["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "Quantidade",
	"m_strTable" => "Vinha",
	"m_srcTableName" => "Marza stock"
));

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

$proto44["m_sql"] = "SUM(Quantidade)";
$proto44["m_srcTableName"] = "Marza stock";
$proto44["m_expr"]=$obj;
$proto44["m_alias"] = "Vendas";
$obj = new SQLFieldListItem($proto44);

$proto36["m_fieldlist"][]=$obj;
$proto36["m_fromlist"] = array();
												$proto47=array();
$proto47["m_link"] = "SQLL_MAIN";
			$proto48=array();
$proto48["m_strName"] = "Vinha";
$proto48["m_srcTableName"] = "Marza stock";
$proto48["m_columns"] = array();
$proto48["m_columns"][] = "CodVenda";
$proto48["m_columns"][] = "CodUser";
$proto48["m_columns"][] = "Data";
$proto48["m_columns"][] = "CodPlanta";
$proto48["m_columns"][] = "CodCliente";
$proto48["m_columns"][] = "Quantidade";
$proto48["m_columns"][] = "Confirmado";
$proto48["m_columns"][] = "Pago20%";
$proto48["m_columns"][] = "Encomendado";
$proto48["m_columns"][] = "PagoTotal";
$proto48["m_columns"][] = "Fornecido";
$proto48["m_columns"][] = "NEntrega";
$proto48["m_columns"][] = "PE";
$proto48["m_columns"][] = "Clone";
$proto48["m_columns"][] = "NE";
$proto48["m_columns"][] = "Saldo";
$proto48["m_columns"][] = "CodMarza";
$proto48["m_columns"][] = "Saldo1";
$proto48["m_columns"][] = "Escolha";
$obj = new SQLTable($proto48);

$proto47["m_table"] = $obj;
$proto47["m_sql"] = "Vinha";
$proto47["m_alias"] = "";
$proto47["m_srcTableName"] = "Marza stock";
$proto49=array();
$proto49["m_sql"] = "";
$proto49["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto36["m_fromlist"][]=$obj;
$proto36["m_groupby"] = array();
												$proto51=array();
						$obj = new SQLField(array(
	"m_strName" => "CodMarza",
	"m_strTable" => "Vinha",
	"m_srcTableName" => "Marza stock"
));

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

$proto36["m_groupby"][]=$obj;
$proto36["m_orderby"] = array();
$proto36["m_srcTableName"]="Marza stock";		
$obj = new SQLQuery($proto36);

$proto35["m_table"] = $obj;
$proto35["m_sql"] = "Inner JOIN     ( SELECT CodMarza,SUM(Quantidade) AS Vendas FROM Vinha GROUP BY CodMarza)B      on (Marza=CodMarza)";
$proto35["m_alias"] = "B";
$proto35["m_srcTableName"] = "Marza stock";
$proto53=array();
$proto53["m_sql"] = "Marza=CodMarza";
$proto53["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "Marza",
	"m_strTable" => "A",
	"m_srcTableName" => "Marza stock"
));

$proto53["m_column"]=$obj;
$proto53["m_contained"] = array();
$proto53["m_strCase"] = "=CodMarza";
$proto53["m_havingmode"] = false;
$proto53["m_inBrackets"] = true;
$proto53["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto53);

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

$proto1["m_fromlist"][]=$obj;
$proto1["m_groupby"] = array();
$proto1["m_orderby"] = array();
$proto1["m_srcTableName"]="Marza stock";		
$obj = new SQLQuery($proto1);

	return $obj;
}
$queryData_marza_stock = createSqlQuery_marza_stock();


	
		;

				

$tdatamarza_stock[".sqlquery"] = $queryData_marza_stock;

$tableEvents["Marza stock"] = new eventsBase;
$tdatamarza_stock[".hasEvents"] = false;

?>