<?php



$tdataplanta_stock_confirmados_ = array();
$tdataplanta_stock_confirmados_[".searchableFields"] = array();
$tdataplanta_stock_confirmados_[".ShortName"] = "planta_stock_confirmados_";
$tdataplanta_stock_confirmados_[".OwnerID"] = "";
$tdataplanta_stock_confirmados_[".OriginalTable"] = "Vinha";


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

//	field labels
$fieldLabelsplanta_stock_confirmados_ = array();
$fieldToolTipsplanta_stock_confirmados_ = array();
$pageTitlesplanta_stock_confirmados_ = array();
$placeHoldersplanta_stock_confirmados_ = array();

if(mlang_getcurrentlang()=="Portuguese(Standard)")
{
	$fieldLabelsplanta_stock_confirmados_["Portuguese(Standard)"] = array();
	$fieldToolTipsplanta_stock_confirmados_["Portuguese(Standard)"] = array();
	$placeHoldersplanta_stock_confirmados_["Portuguese(Standard)"] = array();
	$pageTitlesplanta_stock_confirmados_["Portuguese(Standard)"] = array();
	$fieldLabelsplanta_stock_confirmados_["Portuguese(Standard)"]["Total"] = "Total";
	$fieldToolTipsplanta_stock_confirmados_["Portuguese(Standard)"]["Total"] = "";
	$placeHoldersplanta_stock_confirmados_["Portuguese(Standard)"]["Total"] = "";
	$fieldLabelsplanta_stock_confirmados_["Portuguese(Standard)"]["Vendas"] = "Vendas";
	$fieldToolTipsplanta_stock_confirmados_["Portuguese(Standard)"]["Vendas"] = "";
	$placeHoldersplanta_stock_confirmados_["Portuguese(Standard)"]["Vendas"] = "";
	$fieldLabelsplanta_stock_confirmados_["Portuguese(Standard)"]["stock"] = "Stock";
	$fieldToolTipsplanta_stock_confirmados_["Portuguese(Standard)"]["stock"] = "";
	$placeHoldersplanta_stock_confirmados_["Portuguese(Standard)"]["stock"] = "";
	$fieldLabelsplanta_stock_confirmados_["Portuguese(Standard)"]["Codice"] = "Codice";
	$fieldToolTipsplanta_stock_confirmados_["Portuguese(Standard)"]["Codice"] = "";
	$placeHoldersplanta_stock_confirmados_["Portuguese(Standard)"]["Codice"] = "";
	if (count($fieldToolTipsplanta_stock_confirmados_["Portuguese(Standard)"]))
		$tdataplanta_stock_confirmados_[".isUseToolTips"] = true;
}


	$tdataplanta_stock_confirmados_[".NCSearch"] = true;


	$tdataplanta_stock_confirmados_[".scrollGridBody"] = true;

$tdataplanta_stock_confirmados_[".shortTableName"] = "planta_stock_confirmados_";
$tdataplanta_stock_confirmados_[".nSecOptions"] = 0;

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

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

	



$tdataplanta_stock_confirmados_[".showAddInPopup"] = true;

$tdataplanta_stock_confirmados_[".showEditInPopup"] = false;

$tdataplanta_stock_confirmados_[".showViewInPopup"] = false;

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


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

	$tdataplanta_stock_confirmados_[".audit"] = true;

	$tdataplanta_stock_confirmados_[".locking"] = true;


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

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

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

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



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




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

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

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

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



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

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

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

$tdataplanta_stock_confirmados_[".isUseAjaxSuggest"] = true;

$tdataplanta_stock_confirmados_[".rowHighlite"] = true;



			

$tdataplanta_stock_confirmados_[".ajaxCodeSnippetAdded"] = false;

$tdataplanta_stock_confirmados_[".buttonsAdded"] = false;

$tdataplanta_stock_confirmados_[".addPageEvents"] = false;

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


$tdataplanta_stock_confirmados_[".badgeColor"] = "5F9EA0";


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

$tdataplanta_stock_confirmados_[".googleLikeFields"] = array();
$tdataplanta_stock_confirmados_[".googleLikeFields"][] = "Codice";
$tdataplanta_stock_confirmados_[".googleLikeFields"][] = "Total";
$tdataplanta_stock_confirmados_[".googleLikeFields"][] = "Vendas";
$tdataplanta_stock_confirmados_[".googleLikeFields"][] = "stock";



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

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

$tdataplanta_stock_confirmados_[".nPrinterSplitRecords"] = 40;

$tdataplanta_stock_confirmados_[".geocodingEnabled"] = false;










$tdataplanta_stock_confirmados_[".pageSize"] = 999;

$tdataplanta_stock_confirmados_[".warnLeavingPages"] = true;



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

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

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

$tdataplanta_stock_confirmados_[".highlightSearchResults"] = true;

$tableKeysplanta_stock_confirmados_ = array();
$tdataplanta_stock_confirmados_[".Keys"] = $tableKeysplanta_stock_confirmados_;


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




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

	
	
	
			

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

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

	
	
				$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" => "Text field");

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


	
	



	
	
	
	
			$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();
	
	
	//	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


	$tdataplanta_stock_confirmados_["Codice"] = $fdata;
		$tdataplanta_stock_confirmados_[".searchableFields"][] = "Codice";
//	Total
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 2;
	$fdata["strName"] = "Total";
	$fdata["GoodName"] = "Total";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("Planta_stock_confirmados_","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


	$tdataplanta_stock_confirmados_["Total"] = $fdata;
		$tdataplanta_stock_confirmados_[".searchableFields"][] = "Total";
//	Vendas
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "Vendas";
	$fdata["GoodName"] = "Vendas";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("Planta_stock_confirmados_","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


	$tdataplanta_stock_confirmados_["Vendas"] = $fdata;
		$tdataplanta_stock_confirmados_[".searchableFields"][] = "Vendas";
//	stock
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "stock";
	$fdata["GoodName"] = "stock";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("Planta_stock_confirmados_","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


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


$tables_data["Planta stock(confirmados)"]=&$tdataplanta_stock_confirmados_;
$field_labels["Planta_stock_confirmados_"] = &$fieldLabelsplanta_stock_confirmados_;
$fieldToolTips["Planta_stock_confirmados_"] = &$fieldToolTipsplanta_stock_confirmados_;
$placeHolders["Planta_stock_confirmados_"] = &$placeHoldersplanta_stock_confirmados_;
$page_titles["Planta_stock_confirmados_"] = &$pageTitlesplanta_stock_confirmados_;

// -----------------start  prepare master-details data arrays ------------------------------//
// tables which are detail tables for current table (master)
$detailsTablesData["Planta stock(confirmados)"] = 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["Planta stock(confirmados)"][$dIndex] = $detailsParam;

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

	$detailsTablesData["Planta stock(confirmados)"][$dIndex]["masterKeys"][]="Codice";

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

	$detailsTablesData["Planta stock(confirmados)"][$dIndex]["detailKeys"][]="CodPlanta";

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



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


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










function createSqlQuery_planta_stock_confirmados_()
{
$proto1=array();
$proto1["m_strHead"] = "SELECT";
$proto1["m_strFieldList"] = "Codice,Total , Vendas, (Total - vendas) as stock";
$proto1["m_strFrom"] = "FROM   ( SELECT Codice,SUM(Totale) AS Total FROM Assegnatos GROUP BY Codice)A    Inner JOIN     ( SELECT CodPlanta,SUM(Quantidade) AS Vendas FROM Vinha where confirmado=1 GROUP BY CodPlanta)B      on (Codice=CodPlanta)";
$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" => "Codice",
	"m_strTable" => "A",
	"m_srcTableName" => "Planta stock(confirmados)"
));

$proto7["m_sql"] = "Codice";
$proto7["m_srcTableName"] = "Planta stock(confirmados)";
$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" => "Planta stock(confirmados)"
));

$proto9["m_sql"] = "Total";
$proto9["m_srcTableName"] = "Planta stock(confirmados)";
$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"] = "Planta stock(confirmados)";
$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"] = "Planta stock(confirmados)";
$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"] = "Codice,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" => "Codice",
	"m_strTable" => "Assegnatos",
	"m_srcTableName" => "Planta stock(confirmados)"
));

$proto22["m_sql"] = "Codice";
$proto22["m_srcTableName"] = "Planta stock(confirmados)";
$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" => "Planta stock(confirmados)"
));

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

$proto24["m_sql"] = "SUM(Totale)";
$proto24["m_srcTableName"] = "Planta stock(confirmados)";
$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"] = "Planta stock(confirmados)";
$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"] = "Planta stock(confirmados)";
$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" => "Codice",
	"m_strTable" => "Assegnatos",
	"m_srcTableName" => "Planta stock(confirmados)"
));

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

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

$proto15["m_table"] = $obj;
$proto15["m_sql"] = "( SELECT Codice,SUM(Totale) AS Total FROM Assegnatos GROUP BY Codice)A";
$proto15["m_alias"] = "A";
$proto15["m_srcTableName"] = "Planta stock(confirmados)";
$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"] = "CodPlanta,SUM(Quantidade) AS Vendas";
$proto36["m_strFrom"] = "FROM Vinha";
$proto36["m_strWhere"] = "confirmado=1";
$proto36["m_strOrderBy"] = "";
	
		;
			$proto36["cipherer"] = null;
$proto38=array();
$proto38["m_sql"] = "confirmado=1";
$proto38["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "Confirmado",
	"m_strTable" => "Vinha",
	"m_srcTableName" => "Planta stock(confirmados)"
));

$proto38["m_column"]=$obj;
$proto38["m_contained"] = array();
$proto38["m_strCase"] = "=1";
$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" => "CodPlanta",
	"m_strTable" => "Vinha",
	"m_srcTableName" => "Planta stock(confirmados)"
));

$proto42["m_sql"] = "CodPlanta";
$proto42["m_srcTableName"] = "Planta stock(confirmados)";
$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" => "Planta stock(confirmados)"
));

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

$proto44["m_sql"] = "SUM(Quantidade)";
$proto44["m_srcTableName"] = "Planta stock(confirmados)";
$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"] = "Planta stock(confirmados)";
$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"] = "Planta stock(confirmados)";
$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" => "CodPlanta",
	"m_strTable" => "Vinha",
	"m_srcTableName" => "Planta stock(confirmados)"
));

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

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

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

$proto53["m_column"]=$obj;
$proto53["m_contained"] = array();
$proto53["m_strCase"] = "=CodPlanta";
$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"]="Planta stock(confirmados)";		
$obj = new SQLQuery($proto1);

	return $obj;
}
$queryData_planta_stock_confirmados_ = createSqlQuery_planta_stock_confirmados_();


	
		;

				

$tdataplanta_stock_confirmados_[".sqlquery"] = $queryData_planta_stock_confirmados_;

$tableEvents["Planta stock(confirmados)"] = new eventsBase;
$tdataplanta_stock_confirmados_[".hasEvents"] = false;

?>