<?php
$tdataadvances_to_supplier_status = array();
$tdataadvances_to_supplier_status[".searchableFields"] = array();
$tdataadvances_to_supplier_status[".ShortName"] = "advances_to_supplier_status";
$tdataadvances_to_supplier_status[".OwnerID"] = "";
$tdataadvances_to_supplier_status[".OriginalTable"] = "advances_to_supplier";


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

//	field labels
$fieldLabelsadvances_to_supplier_status = array();
$fieldToolTipsadvances_to_supplier_status = array();
$pageTitlesadvances_to_supplier_status = array();
$placeHoldersadvances_to_supplier_status = array();

if(mlang_getcurrentlang()=="English")
{
	$fieldLabelsadvances_to_supplier_status["English"] = array();
	$fieldToolTipsadvances_to_supplier_status["English"] = array();
	$placeHoldersadvances_to_supplier_status["English"] = array();
	$pageTitlesadvances_to_supplier_status["English"] = array();
	$fieldLabelsadvances_to_supplier_status["English"]["details"] = "Details";
	$fieldToolTipsadvances_to_supplier_status["English"]["details"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["details"] = "";
	$fieldLabelsadvances_to_supplier_status["English"]["customer_name"] = "Customer Name";
	$fieldToolTipsadvances_to_supplier_status["English"]["customer_name"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["customer_name"] = "";
	$fieldLabelsadvances_to_supplier_status["English"]["unic_id"] = "Unic Id";
	$fieldToolTipsadvances_to_supplier_status["English"]["unic_id"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["unic_id"] = "";
	$fieldLabelsadvances_to_supplier_status["English"]["advance_id"] = "Advance Id";
	$fieldToolTipsadvances_to_supplier_status["English"]["advance_id"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["advance_id"] = "";
	$fieldLabelsadvances_to_supplier_status["English"]["left"] = "Left";
	$fieldToolTipsadvances_to_supplier_status["English"]["left"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["left"] = "";
	$fieldLabelsadvances_to_supplier_status["English"]["customer_id"] = "Customer Id";
	$fieldToolTipsadvances_to_supplier_status["English"]["customer_id"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["customer_id"] = "";
	$fieldLabelsadvances_to_supplier_status["English"]["date"] = "Date";
	$fieldToolTipsadvances_to_supplier_status["English"]["date"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["date"] = "";
	$fieldLabelsadvances_to_supplier_status["English"]["Advance_amount"] = "Advance Amount";
	$fieldToolTipsadvances_to_supplier_status["English"]["Advance_amount"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["Advance_amount"] = "";
	$fieldLabelsadvances_to_supplier_status["English"]["usage"] = "Usage";
	$fieldToolTipsadvances_to_supplier_status["English"]["usage"] = "";
	$placeHoldersadvances_to_supplier_status["English"]["usage"] = "";
	if (count($fieldToolTipsadvances_to_supplier_status["English"]))
		$tdataadvances_to_supplier_status[".isUseToolTips"] = true;
}


	$tdataadvances_to_supplier_status[".NCSearch"] = true;



$tdataadvances_to_supplier_status[".shortTableName"] = "advances_to_supplier_status";
$tdataadvances_to_supplier_status[".nSecOptions"] = 0;

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


$tdataadvances_to_supplier_status[".strOriginalTableName"] = "advances_to_supplier";

	



$tdataadvances_to_supplier_status[".showAddInPopup"] = false;

$tdataadvances_to_supplier_status[".showEditInPopup"] = false;

$tdataadvances_to_supplier_status[".showViewInPopup"] = false;

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


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

	$tdataadvances_to_supplier_status[".audit"] = true;

	$tdataadvances_to_supplier_status[".locking"] = false;


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

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

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

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



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




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

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

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

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



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

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

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

$tdataadvances_to_supplier_status[".isUseAjaxSuggest"] = true;

$tdataadvances_to_supplier_status[".rowHighlite"] = true;



																																																																																																						

$tdataadvances_to_supplier_status[".ajaxCodeSnippetAdded"] = false;

$tdataadvances_to_supplier_status[".buttonsAdded"] = false;

$tdataadvances_to_supplier_status[".addPageEvents"] = false;

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


$tdataadvances_to_supplier_status[".badgeColor"] = "e07878";


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

$tdataadvances_to_supplier_status[".googleLikeFields"] = array();
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "customer_id";
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "customer_name";
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "date";
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "Advance_amount";
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "usage";
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "unic_id";
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "details";
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "advance_id";
$tdataadvances_to_supplier_status[".googleLikeFields"][] = "left";



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

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

$tdataadvances_to_supplier_status[".nPrinterSplitRecords"] = 40;

$tdataadvances_to_supplier_status[".geocodingEnabled"] = false;










$tdataadvances_to_supplier_status[".pageSize"] = 20;

$tdataadvances_to_supplier_status[".warnLeavingPages"] = true;



$tstrOrderBy = "ORDER BY advances_to_supplier.advance_amount - ifnull(puttt.pur,0) DESC";
if(strlen($tstrOrderBy) && strtolower(substr($tstrOrderBy,0,8))!="order by")
	$tstrOrderBy = "order by ".$tstrOrderBy;
$tdataadvances_to_supplier_status[".strOrderBy"] = $tstrOrderBy;

$tdataadvances_to_supplier_status[".orderindexes"] = array();
	$tdataadvances_to_supplier_status[".orderindexes"][] = array(9, (0 ? "ASC" : "DESC"), "advances_to_supplier.advance_amount - ifnull(puttt.pur,0)");



$tdataadvances_to_supplier_status[".sqlHead"] = "SELECT customer.id AS \"customer_id\",  customer.customer_name,  DATE(advances_to_supplier.`date`)as \"date\",  ifnull(advances_to_supplier.advance_amount,0) AS \"Advance_amount\",   ifnull(puttt.pur,0) as \"usage\",  CONCAT(customer.id,ifnull(advances_to_supplier.id,\"\")) AS \"unic_id\",  CONCAT(advances_to_supplier.details,\"-\",customer.phone_number) AS \"details\",  advances_to_supplier.id as \"advance_id\",  advances_to_supplier.advance_amount - ifnull(puttt.pur,0) as \"left\"";
$tdataadvances_to_supplier_status[".sqlFrom"] = "FROM customer    LEFT OUTER JOIN advances_to_supplier ON customer.id = advances_to_supplier.supplier_id  left join (SELECT `advance_id`,SUM(`amount`) as pur from supplier_advance_cut group by `advance_id`) as puttt on advances_to_supplier.id = puttt.`advance_id`";
$tdataadvances_to_supplier_status[".sqlWhereExpr"] = "advances_to_supplier.id !=\"\"";
$tdataadvances_to_supplier_status[".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;
$tdataadvances_to_supplier_status[".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;
$tdataadvances_to_supplier_status[".arrGroupsPerPage"] = $arrGPP;

$tdataadvances_to_supplier_status[".highlightSearchResults"] = true;

$tableKeysadvances_to_supplier_status = array();
$tdataadvances_to_supplier_status[".Keys"] = $tableKeysadvances_to_supplier_status;


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




//	customer_id
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 1;
	$fdata["strName"] = "customer_id";
	$fdata["GoodName"] = "customer_id";
	$fdata["ownerTable"] = "customer";
	$fdata["Label"] = GetFieldLabel("advances_to_supplier_status","customer_id");
	$fdata["FieldType"] = 3;

	
		$fdata["AutoInc"] = true;

	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "customer.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


	$tdataadvances_to_supplier_status["customer_id"] = $fdata;
		$tdataadvances_to_supplier_status[".searchableFields"][] = "customer_id";
//	customer_name
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 2;
	$fdata["strName"] = "customer_name";
	$fdata["GoodName"] = "customer_name";
	$fdata["ownerTable"] = "customer";
	$fdata["Label"] = GetFieldLabel("advances_to_supplier_status","customer_name");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "customer.customer_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["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


	$tdataadvances_to_supplier_status["customer_name"] = $fdata;
		$tdataadvances_to_supplier_status[".searchableFields"][] = "customer_name";
//	date
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "date";
	$fdata["GoodName"] = "date";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("advances_to_supplier_status","date");
	$fdata["FieldType"] = 135;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "DATE(advances_to_supplier.`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["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();
	
	
	//	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


	$tdataadvances_to_supplier_status["date"] = $fdata;
		$tdataadvances_to_supplier_status[".searchableFields"][] = "date";
//	Advance_amount
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "Advance_amount";
	$fdata["GoodName"] = "Advance_amount";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("advances_to_supplier_status","Advance_amount");
	$fdata["FieldType"] = 14;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "ifnull(advances_to_supplier.advance_amount,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["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");
							
	
	//	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


	$tdataadvances_to_supplier_status["Advance_amount"] = $fdata;
		$tdataadvances_to_supplier_status[".searchableFields"][] = "Advance_amount";
//	usage
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 5;
	$fdata["strName"] = "usage";
	$fdata["GoodName"] = "usage";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("advances_to_supplier_status","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


	$tdataadvances_to_supplier_status["usage"] = $fdata;
		$tdataadvances_to_supplier_status[".searchableFields"][] = "usage";
//	unic_id
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 6;
	$fdata["strName"] = "unic_id";
	$fdata["GoodName"] = "unic_id";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("advances_to_supplier_status","unic_id");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "CONCAT(customer.id,ifnull(advances_to_supplier.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["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


	$tdataadvances_to_supplier_status["unic_id"] = $fdata;
		$tdataadvances_to_supplier_status[".searchableFields"][] = "unic_id";
//	details
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 7;
	$fdata["strName"] = "details";
	$fdata["GoodName"] = "details";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("advances_to_supplier_status","details");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "CONCAT(advances_to_supplier.details,\"-\",customer.phone_number)";

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

		$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


	$tdataadvances_to_supplier_status["details"] = $fdata;
		$tdataadvances_to_supplier_status[".searchableFields"][] = "details";
//	advance_id
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 8;
	$fdata["strName"] = "advance_id";
	$fdata["GoodName"] = "advance_id";
	$fdata["ownerTable"] = "advances_to_supplier";
	$fdata["Label"] = GetFieldLabel("advances_to_supplier_status","advance_id");
	$fdata["FieldType"] = 3;

	
		$fdata["AutoInc"] = true;

	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "advances_to_supplier.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


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

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "advances_to_supplier.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


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


$tables_data["advances_to_supplier_status"]=&$tdataadvances_to_supplier_status;
$field_labels["advances_to_supplier_status"] = &$fieldLabelsadvances_to_supplier_status;
$fieldToolTips["advances_to_supplier_status"] = &$fieldToolTipsadvances_to_supplier_status;
$placeHolders["advances_to_supplier_status"] = &$placeHoldersadvances_to_supplier_status;
$page_titles["advances_to_supplier_status"] = &$pageTitlesadvances_to_supplier_status;

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

		$dIndex = 0;
	$detailsParam = array();
	$detailsParam["dDataSourceTable"]="Payment in advance";
		$detailsParam["dOriginalTable"] = "supplier_advance_cut";



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


		
	$detailsTablesData["advances_to_supplier_status"][$dIndex] = $detailsParam;

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

	$detailsTablesData["advances_to_supplier_status"][$dIndex]["masterKeys"][]="advance_id";

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

	$detailsTablesData["advances_to_supplier_status"][$dIndex]["detailKeys"][]="advance_id";

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



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

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



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











function createSqlQuery_advances_to_supplier_status()
{
$proto0=array();
$proto0["m_strHead"] = "SELECT";
$proto0["m_strFieldList"] = "customer.id AS \"customer_id\",  customer.customer_name,  DATE(advances_to_supplier.`date`)as \"date\",  ifnull(advances_to_supplier.advance_amount,0) AS \"Advance_amount\",   ifnull(puttt.pur,0) as \"usage\",  CONCAT(customer.id,ifnull(advances_to_supplier.id,\"\")) AS \"unic_id\",  CONCAT(advances_to_supplier.details,\"-\",customer.phone_number) AS \"details\",  advances_to_supplier.id as \"advance_id\",  advances_to_supplier.advance_amount - ifnull(puttt.pur,0) as \"left\"";
$proto0["m_strFrom"] = "FROM customer    LEFT OUTER JOIN advances_to_supplier ON customer.id = advances_to_supplier.supplier_id  left join (SELECT `advance_id`,SUM(`amount`) as pur from supplier_advance_cut group by `advance_id`) as puttt on advances_to_supplier.id = puttt.`advance_id`";
$proto0["m_strWhere"] = "advances_to_supplier.id !=\"\"";
$proto0["m_strOrderBy"] = "ORDER BY advances_to_supplier.advance_amount - ifnull(puttt.pur,0) DESC";
	
		;
			$proto0["cipherer"] = null;
$proto2=array();
$proto2["m_sql"] = "advances_to_supplier.id !=\"\"";
$proto2["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "advances_to_supplier",
	"m_srcTableName" => "advances_to_supplier_status"
));

$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" => "customer",
	"m_srcTableName" => "advances_to_supplier_status"
));

$proto6["m_sql"] = "customer.id";
$proto6["m_srcTableName"] = "advances_to_supplier_status";
$proto6["m_expr"]=$obj;
$proto6["m_alias"] = "customer_id";
$obj = new SQLFieldListItem($proto6);

$proto0["m_fieldlist"][]=$obj;
						$proto8=array();
			$obj = new SQLField(array(
	"m_strName" => "customer_name",
	"m_strTable" => "customer",
	"m_srcTableName" => "advances_to_supplier_status"
));

$proto8["m_sql"] = "customer.customer_name";
$proto8["m_srcTableName"] = "advances_to_supplier_status";
$proto8["m_expr"]=$obj;
$proto8["m_alias"] = "";
$obj = new SQLFieldListItem($proto8);

$proto0["m_fieldlist"][]=$obj;
						$proto10=array();
			$proto11=array();
$proto11["m_functiontype"] = "SQLF_CUSTOM";
$proto11["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "advances_to_supplier.`date`"
));

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

$proto10["m_sql"] = "DATE(advances_to_supplier.`date`)";
$proto10["m_srcTableName"] = "advances_to_supplier_status";
$proto10["m_expr"]=$obj;
$proto10["m_alias"] = "date";
$obj = new SQLFieldListItem($proto10);

$proto0["m_fieldlist"][]=$obj;
						$proto13=array();
			$proto14=array();
$proto14["m_functiontype"] = "SQLF_CUSTOM";
$proto14["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "advances_to_supplier.advance_amount"
));

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

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

$proto13["m_sql"] = "ifnull(advances_to_supplier.advance_amount,0)";
$proto13["m_srcTableName"] = "advances_to_supplier_status";
$proto13["m_expr"]=$obj;
$proto13["m_alias"] = "Advance_amount";
$obj = new SQLFieldListItem($proto13);

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

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

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

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

$proto0["m_fieldlist"][]=$obj;
						$proto21=array();
			$proto22=array();
$proto22["m_functiontype"] = "SQLF_CUSTOM";
$proto22["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "customer.id"
));

$proto22["m_arguments"][]=$obj;
						$obj = new SQLNonParsed(array(
	"m_sql" => "ifnull(advances_to_supplier.id,\"\")"
));

$proto22["m_arguments"][]=$obj;
$proto22["m_strFunctionName"] = "CONCAT";
$obj = new SQLFunctionCall($proto22);

$proto21["m_sql"] = "CONCAT(customer.id,ifnull(advances_to_supplier.id,\"\"))";
$proto21["m_srcTableName"] = "advances_to_supplier_status";
$proto21["m_expr"]=$obj;
$proto21["m_alias"] = "unic_id";
$obj = new SQLFieldListItem($proto21);

$proto0["m_fieldlist"][]=$obj;
						$proto25=array();
			$proto26=array();
$proto26["m_functiontype"] = "SQLF_CUSTOM";
$proto26["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "advances_to_supplier.details"
));

$proto26["m_arguments"][]=$obj;
						$obj = new SQLNonParsed(array(
	"m_sql" => "\"-\""
));

$proto26["m_arguments"][]=$obj;
						$obj = new SQLNonParsed(array(
	"m_sql" => "customer.phone_number"
));

$proto26["m_arguments"][]=$obj;
$proto26["m_strFunctionName"] = "CONCAT";
$obj = new SQLFunctionCall($proto26);

$proto25["m_sql"] = "CONCAT(advances_to_supplier.details,\"-\",customer.phone_number)";
$proto25["m_srcTableName"] = "advances_to_supplier_status";
$proto25["m_expr"]=$obj;
$proto25["m_alias"] = "details";
$obj = new SQLFieldListItem($proto25);

$proto0["m_fieldlist"][]=$obj;
						$proto30=array();
			$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "advances_to_supplier",
	"m_srcTableName" => "advances_to_supplier_status"
));

$proto30["m_sql"] = "advances_to_supplier.id";
$proto30["m_srcTableName"] = "advances_to_supplier_status";
$proto30["m_expr"]=$obj;
$proto30["m_alias"] = "advance_id";
$obj = new SQLFieldListItem($proto30);

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

$proto32["m_sql"] = "advances_to_supplier.advance_amount - ifnull(puttt.pur,0)";
$proto32["m_srcTableName"] = "advances_to_supplier_status";
$proto32["m_expr"]=$obj;
$proto32["m_alias"] = "left";
$obj = new SQLFieldListItem($proto32);

$proto0["m_fieldlist"][]=$obj;
$proto0["m_fromlist"] = array();
												$proto34=array();
$proto34["m_link"] = "SQLL_MAIN";
			$proto35=array();
$proto35["m_strName"] = "customer";
$proto35["m_srcTableName"] = "advances_to_supplier_status";
$proto35["m_columns"] = array();
$proto35["m_columns"][] = "id";
$proto35["m_columns"][] = "customer_name";
$proto35["m_columns"][] = "phone_number";
$proto35["m_columns"][] = "address";
$proto35["m_columns"][] = "whatsapp";
$proto35["m_columns"][] = "photo";
$proto35["m_columns"][] = "branch_code";
$obj = new SQLTable($proto35);

$proto34["m_table"] = $obj;
$proto34["m_sql"] = "customer";
$proto34["m_alias"] = "";
$proto34["m_srcTableName"] = "advances_to_supplier_status";
$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_joinon"] = $obj;
$obj = new SQLFromListItem($proto34);

$proto0["m_fromlist"][]=$obj;
												$proto38=array();
$proto38["m_link"] = "SQLL_LEFTJOIN";
			$proto39=array();
$proto39["m_strName"] = "advances_to_supplier";
$proto39["m_srcTableName"] = "advances_to_supplier_status";
$proto39["m_columns"] = array();
$proto39["m_columns"][] = "id";
$proto39["m_columns"][] = "supplier_id";
$proto39["m_columns"][] = "supplier_name";
$proto39["m_columns"][] = "date";
$proto39["m_columns"][] = "advance_amount";
$proto39["m_columns"][] = "details";
$proto39["m_columns"][] = "user";
$obj = new SQLTable($proto39);

$proto38["m_table"] = $obj;
$proto38["m_sql"] = "LEFT OUTER JOIN advances_to_supplier ON customer.id = advances_to_supplier.supplier_id";
$proto38["m_alias"] = "";
$proto38["m_srcTableName"] = "advances_to_supplier_status";
$proto40=array();
$proto40["m_sql"] = "customer.id = advances_to_supplier.supplier_id";
$proto40["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "customer",
	"m_srcTableName" => "advances_to_supplier_status"
));

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

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

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

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

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

$proto43["m_having"] = $obj;
$proto43["m_fieldlist"] = array();
						$proto49=array();
			$obj = new SQLField(array(
	"m_strName" => "advance_id",
	"m_strTable" => "supplier_advance_cut",
	"m_srcTableName" => "advances_to_supplier_status"
));

$proto49["m_sql"] = "`advance_id`";
$proto49["m_srcTableName"] = "advances_to_supplier_status";
$proto49["m_expr"]=$obj;
$proto49["m_alias"] = "";
$obj = new SQLFieldListItem($proto49);

$proto43["m_fieldlist"][]=$obj;
						$proto51=array();
			$proto52=array();
$proto52["m_functiontype"] = "SQLF_SUM";
$proto52["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "amount",
	"m_strTable" => "supplier_advance_cut",
	"m_srcTableName" => "advances_to_supplier_status"
));

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

$proto51["m_sql"] = "SUM(`amount`)";
$proto51["m_srcTableName"] = "advances_to_supplier_status";
$proto51["m_expr"]=$obj;
$proto51["m_alias"] = "pur";
$obj = new SQLFieldListItem($proto51);

$proto43["m_fieldlist"][]=$obj;
$proto43["m_fromlist"] = array();
												$proto54=array();
$proto54["m_link"] = "SQLL_MAIN";
			$proto55=array();
$proto55["m_strName"] = "supplier_advance_cut";
$proto55["m_srcTableName"] = "advances_to_supplier_status";
$proto55["m_columns"] = array();
$proto55["m_columns"][] = "id";
$proto55["m_columns"][] = "advance_id";
$proto55["m_columns"][] = "amount";
$proto55["m_columns"][] = "date_time";
$proto55["m_columns"][] = "pur_id";
$proto55["m_columns"][] = "max_amount";
$obj = new SQLTable($proto55);

$proto54["m_table"] = $obj;
$proto54["m_sql"] = "supplier_advance_cut";
$proto54["m_alias"] = "";
$proto54["m_srcTableName"] = "advances_to_supplier_status";
$proto56=array();
$proto56["m_sql"] = "";
$proto56["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto43["m_fromlist"][]=$obj;
$proto43["m_groupby"] = array();
												$proto58=array();
						$obj = new SQLField(array(
	"m_strName" => "advance_id",
	"m_strTable" => "supplier_advance_cut",
	"m_srcTableName" => "advances_to_supplier_status"
));

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

$proto43["m_groupby"][]=$obj;
$proto43["m_orderby"] = array();
$proto43["m_srcTableName"]="advances_to_supplier_status";		
$obj = new SQLQuery($proto43);

$proto42["m_table"] = $obj;
$proto42["m_sql"] = "left join (SELECT `advance_id`,SUM(`amount`) as pur from supplier_advance_cut group by `advance_id`) as puttt on advances_to_supplier.id = puttt.`advance_id`";
$proto42["m_alias"] = "puttt";
$proto42["m_srcTableName"] = "advances_to_supplier_status";
$proto60=array();
$proto60["m_sql"] = "advances_to_supplier.id = puttt.`advance_id`";
$proto60["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "advances_to_supplier",
	"m_srcTableName" => "advances_to_supplier_status"
));

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

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

$proto0["m_fromlist"][]=$obj;
$proto0["m_groupby"] = array();
$proto0["m_orderby"] = array();
												$proto62=array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "advances_to_supplier.advance_amount - ifnull(puttt.pur,0)"
));

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

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

	return $obj;
}
$queryData_advances_to_supplier_status = createSqlQuery_advances_to_supplier_status();


	
		;

									

$tdataadvances_to_supplier_status[".sqlquery"] = $queryData_advances_to_supplier_status;



$tableEvents["advances_to_supplier_status"] = new eventsBase;
$tdataadvances_to_supplier_status[".hasEvents"] = false;

?>