<?php
$tdatabuyers_advance1 = array();
$tdatabuyers_advance1[".searchableFields"] = array();
$tdatabuyers_advance1[".ShortName"] = "buyers_advance1";
$tdatabuyers_advance1[".OwnerID"] = "";
$tdatabuyers_advance1[".OriginalTable"] = "buyers";


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

//	field labels
$fieldLabelsbuyers_advance1 = array();
$fieldToolTipsbuyers_advance1 = array();
$pageTitlesbuyers_advance1 = array();
$placeHoldersbuyers_advance1 = array();

if(mlang_getcurrentlang()=="English")
{
	$fieldLabelsbuyers_advance1["English"] = array();
	$fieldToolTipsbuyers_advance1["English"] = array();
	$placeHoldersbuyers_advance1["English"] = array();
	$pageTitlesbuyers_advance1["English"] = array();
	$fieldLabelsbuyers_advance1["English"]["advance_id"] = "Advance Id";
	$fieldToolTipsbuyers_advance1["English"]["advance_id"] = "";
	$placeHoldersbuyers_advance1["English"]["advance_id"] = "";
	$fieldLabelsbuyers_advance1["English"]["details"] = "Details";
	$fieldToolTipsbuyers_advance1["English"]["details"] = "";
	$placeHoldersbuyers_advance1["English"]["details"] = "";
	$fieldLabelsbuyers_advance1["English"]["left"] = "Left";
	$fieldToolTipsbuyers_advance1["English"]["left"] = "";
	$placeHoldersbuyers_advance1["English"]["left"] = "";
	$fieldLabelsbuyers_advance1["English"]["buyer_name"] = "Buyer Name";
	$fieldToolTipsbuyers_advance1["English"]["buyer_name"] = "";
	$placeHoldersbuyers_advance1["English"]["buyer_name"] = "";
	$fieldLabelsbuyers_advance1["English"]["buyers_id"] = "Buyers Id";
	$fieldToolTipsbuyers_advance1["English"]["buyers_id"] = "";
	$placeHoldersbuyers_advance1["English"]["buyers_id"] = "";
	$fieldLabelsbuyers_advance1["English"]["advance_amount"] = "Advance Amount";
	$fieldToolTipsbuyers_advance1["English"]["advance_amount"] = "";
	$placeHoldersbuyers_advance1["English"]["advance_amount"] = "";
	$fieldLabelsbuyers_advance1["English"]["usage"] = "Usage";
	$fieldToolTipsbuyers_advance1["English"]["usage"] = "";
	$placeHoldersbuyers_advance1["English"]["usage"] = "";
	$fieldLabelsbuyers_advance1["English"]["date"] = "Date";
	$fieldToolTipsbuyers_advance1["English"]["date"] = "";
	$placeHoldersbuyers_advance1["English"]["date"] = "";
	if (count($fieldToolTipsbuyers_advance1["English"]))
		$tdatabuyers_advance1[".isUseToolTips"] = true;
}


	$tdatabuyers_advance1[".NCSearch"] = true;



$tdatabuyers_advance1[".shortTableName"] = "buyers_advance1";
$tdatabuyers_advance1[".nSecOptions"] = 0;

$tdatabuyers_advance1[".mainTableOwnerID"] = "";
$tdatabuyers_advance1[".entityType"] = 1;
$tdatabuyers_advance1[".connId"] = "test2_at_localhost";


$tdatabuyers_advance1[".strOriginalTableName"] = "buyers";

	



$tdatabuyers_advance1[".showAddInPopup"] = false;

$tdatabuyers_advance1[".showEditInPopup"] = false;

$tdatabuyers_advance1[".showViewInPopup"] = false;

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


	$tdatabuyers_advance1[".listAjax"] = true;
//	temporary
$tdatabuyers_advance1[".listAjax"] = false;

	$tdatabuyers_advance1[".audit"] = true;

	$tdatabuyers_advance1[".locking"] = false;


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

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

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

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



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




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

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

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

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



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

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

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

$tdatabuyers_advance1[".isUseAjaxSuggest"] = true;

$tdatabuyers_advance1[".rowHighlite"] = true;



																																																																																																						

$tdatabuyers_advance1[".ajaxCodeSnippetAdded"] = false;

$tdatabuyers_advance1[".buttonsAdded"] = false;

$tdatabuyers_advance1[".addPageEvents"] = false;

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


$tdatabuyers_advance1[".badgeColor"] = "008b8b";


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

$tdatabuyers_advance1[".googleLikeFields"] = array();
$tdatabuyers_advance1[".googleLikeFields"][] = "buyers id";
$tdatabuyers_advance1[".googleLikeFields"][] = "buyer_name";
$tdatabuyers_advance1[".googleLikeFields"][] = "advance_amount";
$tdatabuyers_advance1[".googleLikeFields"][] = "details";
$tdatabuyers_advance1[".googleLikeFields"][] = "usage";
$tdatabuyers_advance1[".googleLikeFields"][] = "date";
$tdatabuyers_advance1[".googleLikeFields"][] = "advance_id";
$tdatabuyers_advance1[".googleLikeFields"][] = "left";



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

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

$tdatabuyers_advance1[".nPrinterSplitRecords"] = 40;

$tdatabuyers_advance1[".geocodingEnabled"] = false;










$tdatabuyers_advance1[".pageSize"] = 20;

$tdatabuyers_advance1[".warnLeavingPages"] = true;



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

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


$tdatabuyers_advance1[".sqlHead"] = "SELECT buyers.id as \"buyers id\",  buyers.buyer_name,  buyers_advance.advance_amount,  buyers_advance.details,  ifnull(puttt.pur,0) as \"usage\",  DATE(buyers_advance.`date`) as \"date\",  buyers_advance.id as advance_id,  buyers_advance.advance_amount - ifnull(puttt.pur,0) as \"left\"";
$tdatabuyers_advance1[".sqlFrom"] = "FROM buyers  LEFT OUTER JOIN buyers_advance ON buyers.id = buyers_advance.buyer_id  left join (SELECT `advance_id`,SUM(`amount`) as pur from sales group by `advance_id`) as puttt on buyers_advance.id = puttt.`advance_id`";
$tdatabuyers_advance1[".sqlWhereExpr"] = "buyers_advance.id!=\"\"";
$tdatabuyers_advance1[".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;
$tdatabuyers_advance1[".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;
$tdatabuyers_advance1[".arrGroupsPerPage"] = $arrGPP;

$tdatabuyers_advance1[".highlightSearchResults"] = true;

$tableKeysbuyers_advance1 = array();
$tdatabuyers_advance1[".Keys"] = $tableKeysbuyers_advance1;


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




//	buyers id
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 1;
	$fdata["strName"] = "buyers id";
	$fdata["GoodName"] = "buyers_id";
	$fdata["ownerTable"] = "buyers";
	$fdata["Label"] = GetFieldLabel("buyers_advance","buyers_id");
	$fdata["FieldType"] = 3;

	
		$fdata["AutoInc"] = true;

	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "buyers.id";

	
	
				$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["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


	$tdatabuyers_advance1["buyers id"] = $fdata;
		$tdatabuyers_advance1[".searchableFields"][] = "buyers id";
//	buyer_name
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 2;
	$fdata["strName"] = "buyer_name";
	$fdata["GoodName"] = "buyer_name";
	$fdata["ownerTable"] = "buyers";
	$fdata["Label"] = GetFieldLabel("buyers_advance","buyer_name");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "buyers.buyer_name";

	
	
				$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["EditParams"].= " maxlength=100";

		$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


	$tdatabuyers_advance1["buyer_name"] = $fdata;
		$tdatabuyers_advance1[".searchableFields"][] = "buyer_name";
//	advance_amount
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "advance_amount";
	$fdata["GoodName"] = "advance_amount";
	$fdata["ownerTable"] = "buyers_advance";
	$fdata["Label"] = GetFieldLabel("buyers_advance","advance_amount");
	$fdata["FieldType"] = 14;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "buyers_advance.advance_amount";

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

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

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

	
	
	
	
	
	
		$vdata["DecimalDigits"] = 2;

	
	
	
	
		
	
		$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


	$tdatabuyers_advance1["advance_amount"] = $fdata;
		$tdatabuyers_advance1[".searchableFields"][] = "advance_amount";
//	details
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "details";
	$fdata["GoodName"] = "details";
	$fdata["ownerTable"] = "buyers_advance";
	$fdata["Label"] = GetFieldLabel("buyers_advance","details");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "buyers_advance.details";

	
	
				$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


	$tdatabuyers_advance1["details"] = $fdata;
		$tdatabuyers_advance1[".searchableFields"][] = "details";
//	usage
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 5;
	$fdata["strName"] = "usage";
	$fdata["GoodName"] = "usage";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("buyers_advance","usage");
	$fdata["FieldType"] = 14;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "ifnull(puttt.pur,0)";

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

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

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

	
	
	
	
	
	
		$vdata["DecimalDigits"] = 2;

	
	
	
	
		
	
		$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


	$tdatabuyers_advance1["usage"] = $fdata;
		$tdatabuyers_advance1[".searchableFields"][] = "usage";
//	date
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 6;
	$fdata["strName"] = "date";
	$fdata["GoodName"] = "date";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("buyers_advance","date");
	$fdata["FieldType"] = 7;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "DATE(buyers_advance.`date`)";

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

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

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

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

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


	
	



		$edata["IsRequired"] = true;

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

		$edata["maxNumberOfFiles"] = 1;

	
	
		$edata["DateEditType"] = 13;
	$edata["InitialYearFactor"] = 100;
	$edata["LastYearFactor"] = 10;

	
	
	
		$edata["controlWidth"] = 200;

//	Begin validation
	$edata["validateAs"] = array();
	$edata["validateAs"]["basicValidate"] = array();
	$edata["validateAs"]["customMessages"] = array();
						$edata["validateAs"]["basicValidate"][] = "IsRequired";
		
	
	//	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("Equals", "More than", "Less than", "Between", EMPTY_SEARCH, 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


	$tdatabuyers_advance1["date"] = $fdata;
		$tdatabuyers_advance1[".searchableFields"][] = "date";
//	advance_id
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 7;
	$fdata["strName"] = "advance_id";
	$fdata["GoodName"] = "advance_id";
	$fdata["ownerTable"] = "buyers_advance";
	$fdata["Label"] = GetFieldLabel("buyers_advance","advance_id");
	$fdata["FieldType"] = 3;

	
		$fdata["AutoInc"] = true;

	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "buyers_advance.id";

	
	
				$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["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


	$tdatabuyers_advance1["advance_id"] = $fdata;
		$tdatabuyers_advance1[".searchableFields"][] = "advance_id";
//	left
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 8;
	$fdata["strName"] = "left";
	$fdata["GoodName"] = "left";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("buyers_advance","left");
	$fdata["FieldType"] = 14;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "buyers_advance.advance_amount - ifnull(puttt.pur,0)";

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

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

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

	
	
	
	
	
	
		$vdata["DecimalDigits"] = 2;

	
	
	
	
		
	
		$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


	$tdatabuyers_advance1["left"] = $fdata;
		$tdatabuyers_advance1[".searchableFields"][] = "left";


$tables_data["buyers advance"]=&$tdatabuyers_advance1;
$field_labels["buyers_advance"] = &$fieldLabelsbuyers_advance1;
$fieldToolTips["buyers_advance"] = &$fieldToolTipsbuyers_advance1;
$placeHolders["buyers_advance"] = &$placeHoldersbuyers_advance1;
$page_titles["buyers_advance"] = &$pageTitlesbuyers_advance1;

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

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



	
				$strOriginalDetailsTable="buyers";
	$masterParams = array();
	$masterParams["mDataSourceTable"]="buyers";
	$masterParams["mOriginalTable"]= $strOriginalDetailsTable;
	$masterParams["mShortTable"]= "buyers";
	$masterParams["masterKeys"]= array();
	$masterParams["detailKeys"]= array();

	$masterParams["type"] = PAGE_LIST;
					$masterTablesData["buyers advance"][0] = $masterParams;
				$masterTablesData["buyers advance"][0]["masterKeys"] = array();
	$masterTablesData["buyers advance"][0]["masterKeys"][]="id";
				$masterTablesData["buyers advance"][0]["detailKeys"] = array();
	$masterTablesData["buyers advance"][0]["detailKeys"][]="buyers id";
		
// -----------------end  prepare master-details data arrays ------------------------------//



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











function createSqlQuery_buyers_advance1()
{
$proto0=array();
$proto0["m_strHead"] = "SELECT";
$proto0["m_strFieldList"] = "buyers.id as \"buyers id\",  buyers.buyer_name,  buyers_advance.advance_amount,  buyers_advance.details,  ifnull(puttt.pur,0) as \"usage\",  DATE(buyers_advance.`date`) as \"date\",  buyers_advance.id as advance_id,  buyers_advance.advance_amount - ifnull(puttt.pur,0) as \"left\"";
$proto0["m_strFrom"] = "FROM buyers  LEFT OUTER JOIN buyers_advance ON buyers.id = buyers_advance.buyer_id  left join (SELECT `advance_id`,SUM(`amount`) as pur from sales group by `advance_id`) as puttt on buyers_advance.id = puttt.`advance_id`";
$proto0["m_strWhere"] = "buyers_advance.id!=\"\"";
$proto0["m_strOrderBy"] = "";
	
		;
			$proto0["cipherer"] = null;
$proto2=array();
$proto2["m_sql"] = "buyers_advance.id!=\"\"";
$proto2["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "buyers_advance",
	"m_srcTableName" => "buyers advance"
));

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

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

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

$proto0["m_having"] = $obj;
$proto0["m_fieldlist"] = array();
						$proto6=array();
			$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "buyers",
	"m_srcTableName" => "buyers advance"
));

$proto6["m_sql"] = "buyers.id";
$proto6["m_srcTableName"] = "buyers advance";
$proto6["m_expr"]=$obj;
$proto6["m_alias"] = "buyers id";
$obj = new SQLFieldListItem($proto6);

$proto0["m_fieldlist"][]=$obj;
						$proto8=array();
			$obj = new SQLField(array(
	"m_strName" => "buyer_name",
	"m_strTable" => "buyers",
	"m_srcTableName" => "buyers advance"
));

$proto8["m_sql"] = "buyers.buyer_name";
$proto8["m_srcTableName"] = "buyers advance";
$proto8["m_expr"]=$obj;
$proto8["m_alias"] = "";
$obj = new SQLFieldListItem($proto8);

$proto0["m_fieldlist"][]=$obj;
						$proto10=array();
			$obj = new SQLField(array(
	"m_strName" => "advance_amount",
	"m_strTable" => "buyers_advance",
	"m_srcTableName" => "buyers advance"
));

$proto10["m_sql"] = "buyers_advance.advance_amount";
$proto10["m_srcTableName"] = "buyers advance";
$proto10["m_expr"]=$obj;
$proto10["m_alias"] = "";
$obj = new SQLFieldListItem($proto10);

$proto0["m_fieldlist"][]=$obj;
						$proto12=array();
			$obj = new SQLField(array(
	"m_strName" => "details",
	"m_strTable" => "buyers_advance",
	"m_srcTableName" => "buyers advance"
));

$proto12["m_sql"] = "buyers_advance.details";
$proto12["m_srcTableName"] = "buyers advance";
$proto12["m_expr"]=$obj;
$proto12["m_alias"] = "";
$obj = new SQLFieldListItem($proto12);

$proto0["m_fieldlist"][]=$obj;
						$proto14=array();
			$proto15=array();
$proto15["m_functiontype"] = "SQLF_CUSTOM";
$proto15["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "puttt.pur"
));

$proto15["m_arguments"][]=$obj;
						$obj = new SQLNonParsed(array(
	"m_sql" => "0"
));

$proto15["m_arguments"][]=$obj;
$proto15["m_strFunctionName"] = "ifnull";
$obj = new SQLFunctionCall($proto15);

$proto14["m_sql"] = "ifnull(puttt.pur,0)";
$proto14["m_srcTableName"] = "buyers advance";
$proto14["m_expr"]=$obj;
$proto14["m_alias"] = "usage";
$obj = new SQLFieldListItem($proto14);

$proto0["m_fieldlist"][]=$obj;
						$proto18=array();
			$proto19=array();
$proto19["m_functiontype"] = "SQLF_CUSTOM";
$proto19["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "buyers_advance.`date`"
));

$proto19["m_arguments"][]=$obj;
$proto19["m_strFunctionName"] = "DATE";
$obj = new SQLFunctionCall($proto19);

$proto18["m_sql"] = "DATE(buyers_advance.`date`)";
$proto18["m_srcTableName"] = "buyers advance";
$proto18["m_expr"]=$obj;
$proto18["m_alias"] = "date";
$obj = new SQLFieldListItem($proto18);

$proto0["m_fieldlist"][]=$obj;
						$proto21=array();
			$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "buyers_advance",
	"m_srcTableName" => "buyers advance"
));

$proto21["m_sql"] = "buyers_advance.id";
$proto21["m_srcTableName"] = "buyers advance";
$proto21["m_expr"]=$obj;
$proto21["m_alias"] = "advance_id";
$obj = new SQLFieldListItem($proto21);

$proto0["m_fieldlist"][]=$obj;
						$proto23=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "buyers_advance.advance_amount - ifnull(puttt.pur,0)"
));

$proto23["m_sql"] = "buyers_advance.advance_amount - ifnull(puttt.pur,0)";
$proto23["m_srcTableName"] = "buyers advance";
$proto23["m_expr"]=$obj;
$proto23["m_alias"] = "left";
$obj = new SQLFieldListItem($proto23);

$proto0["m_fieldlist"][]=$obj;
$proto0["m_fromlist"] = array();
												$proto25=array();
$proto25["m_link"] = "SQLL_MAIN";
			$proto26=array();
$proto26["m_strName"] = "buyers";
$proto26["m_srcTableName"] = "buyers advance";
$proto26["m_columns"] = array();
$proto26["m_columns"][] = "id";
$proto26["m_columns"][] = "buyer_name";
$proto26["m_columns"][] = "address";
$proto26["m_columns"][] = "phone_number";
$proto26["m_columns"][] = "e_mail";
$obj = new SQLTable($proto26);

$proto25["m_table"] = $obj;
$proto25["m_sql"] = "buyers";
$proto25["m_alias"] = "";
$proto25["m_srcTableName"] = "buyers advance";
$proto27=array();
$proto27["m_sql"] = "";
$proto27["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto0["m_fromlist"][]=$obj;
												$proto29=array();
$proto29["m_link"] = "SQLL_LEFTJOIN";
			$proto30=array();
$proto30["m_strName"] = "buyers_advance";
$proto30["m_srcTableName"] = "buyers advance";
$proto30["m_columns"] = array();
$proto30["m_columns"][] = "id";
$proto30["m_columns"][] = "buyer_id";
$proto30["m_columns"][] = "buyer_name";
$proto30["m_columns"][] = "date";
$proto30["m_columns"][] = "advance_amount";
$proto30["m_columns"][] = "details";
$proto30["m_columns"][] = "user";
$obj = new SQLTable($proto30);

$proto29["m_table"] = $obj;
$proto29["m_sql"] = "LEFT OUTER JOIN buyers_advance ON buyers.id = buyers_advance.buyer_id";
$proto29["m_alias"] = "";
$proto29["m_srcTableName"] = "buyers advance";
$proto31=array();
$proto31["m_sql"] = "buyers.id = buyers_advance.buyer_id";
$proto31["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "buyers",
	"m_srcTableName" => "buyers advance"
));

$proto31["m_column"]=$obj;
$proto31["m_contained"] = array();
$proto31["m_strCase"] = "= buyers_advance.buyer_id";
$proto31["m_havingmode"] = false;
$proto31["m_inBrackets"] = false;
$proto31["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto31);

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

$proto0["m_fromlist"][]=$obj;
												$proto33=array();
$proto33["m_link"] = "SQLL_LEFTJOIN";
			$proto34=array();
$proto34["m_strHead"] = "SELECT";
$proto34["m_strFieldList"] = "`advance_id`,SUM(`amount`) as pur";
$proto34["m_strFrom"] = "from sales";
$proto34["m_strWhere"] = "";
$proto34["m_strOrderBy"] = "";
	
		;
			$proto34["cipherer"] = null;
$proto36=array();
$proto36["m_sql"] = "";
$proto36["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto34["m_having"] = $obj;
$proto34["m_fieldlist"] = array();
						$proto40=array();
			$obj = new SQLField(array(
	"m_strName" => "advance_id",
	"m_strTable" => "sales",
	"m_srcTableName" => "buyers advance"
));

$proto40["m_sql"] = "`advance_id`";
$proto40["m_srcTableName"] = "buyers advance";
$proto40["m_expr"]=$obj;
$proto40["m_alias"] = "";
$obj = new SQLFieldListItem($proto40);

$proto34["m_fieldlist"][]=$obj;
						$proto42=array();
			$proto43=array();
$proto43["m_functiontype"] = "SQLF_SUM";
$proto43["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "amount",
	"m_strTable" => "sales",
	"m_srcTableName" => "buyers advance"
));

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

$proto42["m_sql"] = "SUM(`amount`)";
$proto42["m_srcTableName"] = "buyers advance";
$proto42["m_expr"]=$obj;
$proto42["m_alias"] = "pur";
$obj = new SQLFieldListItem($proto42);

$proto34["m_fieldlist"][]=$obj;
$proto34["m_fromlist"] = array();
												$proto45=array();
$proto45["m_link"] = "SQLL_MAIN";
			$proto46=array();
$proto46["m_strName"] = "sales";
$proto46["m_srcTableName"] = "buyers advance";
$proto46["m_columns"] = array();
$proto46["m_columns"][] = "id";
$proto46["m_columns"][] = "customer_name";
$proto46["m_columns"][] = "cash";
$proto46["m_columns"][] = "tt";
$proto46["m_columns"][] = "date_&_time";
$proto46["m_columns"][] = "branch_code";
$proto46["m_columns"][] = "user";
$proto46["m_columns"][] = "outlet_code";
$proto46["m_columns"][] = "h";
$proto46["m_columns"][] = "f";
$proto46["m_columns"][] = "advance_id";
$proto46["m_columns"][] = "amount";
$proto46["m_columns"][] = "left_advance";
$proto46["m_columns"][] = "details";
$proto46["m_columns"][] = "status";
$proto46["m_columns"][] = "customer_id";
$obj = new SQLTable($proto46);

$proto45["m_table"] = $obj;
$proto45["m_sql"] = "sales";
$proto45["m_alias"] = "";
$proto45["m_srcTableName"] = "buyers advance";
$proto47=array();
$proto47["m_sql"] = "";
$proto47["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto34["m_fromlist"][]=$obj;
$proto34["m_groupby"] = array();
												$proto49=array();
						$obj = new SQLField(array(
	"m_strName" => "advance_id",
	"m_strTable" => "sales",
	"m_srcTableName" => "buyers advance"
));

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

$proto34["m_groupby"][]=$obj;
$proto34["m_orderby"] = array();
$proto34["m_srcTableName"]="buyers advance";		
$obj = new SQLQuery($proto34);

$proto33["m_table"] = $obj;
$proto33["m_sql"] = "left join (SELECT `advance_id`,SUM(`amount`) as pur from sales group by `advance_id`) as puttt on buyers_advance.id = puttt.`advance_id`";
$proto33["m_alias"] = "puttt";
$proto33["m_srcTableName"] = "buyers advance";
$proto51=array();
$proto51["m_sql"] = "buyers_advance.id = puttt.`advance_id`";
$proto51["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "buyers_advance",
	"m_srcTableName" => "buyers advance"
));

$proto51["m_column"]=$obj;
$proto51["m_contained"] = array();
$proto51["m_strCase"] = "= puttt.`advance_id`";
$proto51["m_havingmode"] = false;
$proto51["m_inBrackets"] = false;
$proto51["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto51);

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

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

	return $obj;
}
$queryData_buyers_advance1 = createSqlQuery_buyers_advance1();


	
		;

								

$tdatabuyers_advance1[".sqlquery"] = $queryData_buyers_advance1;



$tableEvents["buyers advance"] = new eventsBase;
$tdatabuyers_advance1[".hasEvents"] = false;

?>