<?php
$tdataloans_ = array();
$tdataloans_[".searchableFields"] = array();
$tdataloans_[".ShortName"] = "loans_";
$tdataloans_[".OwnerID"] = "";
$tdataloans_[".OriginalTable"] = "loans";


$tdataloans_[".pagesByType"] = my_json_decode( "{\"add\":[\"add\"],\"edit\":[\"edit\"],\"export\":[\"export\"],\"import\":[\"import\"],\"list\":[\"list1\",\"list\",\"list2\"],\"print\":[\"print\"],\"search\":[\"search\"],\"view\":[\"view\"]}" );
$tdataloans_[".originalPagesByType"] = $tdataloans_[".pagesByType"];
$tdataloans_[".pages"] = types2pages( my_json_decode( "{\"add\":[\"add\"],\"edit\":[\"edit\"],\"export\":[\"export\"],\"import\":[\"import\"],\"list\":[\"list1\",\"list\",\"list2\"],\"print\":[\"print\"],\"search\":[\"search\"],\"view\":[\"view\"]}" ) );
$tdataloans_[".originalPages"] = $tdataloans_[".pages"];
$tdataloans_[".defaultPages"] = my_json_decode( "{\"add\":\"add\",\"edit\":\"edit\",\"export\":\"export\",\"import\":\"import\",\"list\":\"list1\",\"print\":\"print\",\"search\":\"search\",\"view\":\"view\"}" );
$tdataloans_[".originalDefaultPages"] = $tdataloans_[".defaultPages"];

//	field labels
$fieldLabelsloans_ = array();
$fieldToolTipsloans_ = array();
$pageTitlesloans_ = array();
$placeHoldersloans_ = array();

if(mlang_getcurrentlang()=="English")
{
	$fieldLabelsloans_["English"] = array();
	$fieldToolTipsloans_["English"] = array();
	$placeHoldersloans_["English"] = array();
	$pageTitlesloans_["English"] = array();
	$fieldLabelsloans_["English"]["id"] = "Id";
	$fieldToolTipsloans_["English"]["id"] = "";
	$placeHoldersloans_["English"]["id"] = "";
	$fieldLabelsloans_["English"]["emp_id"] = "Emp Id";
	$fieldToolTipsloans_["English"]["emp_id"] = "";
	$placeHoldersloans_["English"]["emp_id"] = "";
	$fieldLabelsloans_["English"]["loan_id"] = "Loan Id";
	$fieldToolTipsloans_["English"]["loan_id"] = "";
	$placeHoldersloans_["English"]["loan_id"] = "";
	$fieldLabelsloans_["English"]["loan_amount"] = "Loan Amount";
	$fieldToolTipsloans_["English"]["loan_amount"] = "";
	$placeHoldersloans_["English"]["loan_amount"] = "";
	$fieldLabelsloans_["English"]["date"] = "Date";
	$fieldToolTipsloans_["English"]["date"] = "";
	$placeHoldersloans_["English"]["date"] = "";
	$fieldLabelsloans_["English"]["user"] = "User";
	$fieldToolTipsloans_["English"]["user"] = "";
	$placeHoldersloans_["English"]["user"] = "";
	$fieldLabelsloans_["English"]["DETAILS"] = "Details";
	$fieldToolTipsloans_["English"]["DETAILS"] = "";
	$placeHoldersloans_["English"]["DETAILS"] = "";
	$fieldLabelsloans_["English"]["status"] = "Status";
	$fieldToolTipsloans_["English"]["status"] = "";
	$placeHoldersloans_["English"]["status"] = "";
	$fieldLabelsloans_["English"]["left_amount"] = "Left Amount";
	$fieldToolTipsloans_["English"]["left_amount"] = "";
	$placeHoldersloans_["English"]["left_amount"] = "";
	if (count($fieldToolTipsloans_["English"]))
		$tdataloans_[".isUseToolTips"] = true;
}


	$tdataloans_[".NCSearch"] = true;



$tdataloans_[".shortTableName"] = "loans_";
$tdataloans_[".nSecOptions"] = 0;

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


$tdataloans_[".strOriginalTableName"] = "loans";

	



$tdataloans_[".showAddInPopup"] = false;

$tdataloans_[".showEditInPopup"] = false;

$tdataloans_[".showViewInPopup"] = false;

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


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

	$tdataloans_[".audit"] = true;

	$tdataloans_[".locking"] = false;


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

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

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

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



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




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

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

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

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



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

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

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

$tdataloans_[".isUseAjaxSuggest"] = true;

$tdataloans_[".rowHighlite"] = true;



																																																			

$tdataloans_[".ajaxCodeSnippetAdded"] = false;

$tdataloans_[".buttonsAdded"] = false;

$tdataloans_[".addPageEvents"] = false;

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


$tdataloans_[".badgeColor"] = "DB7093";


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

$tdataloans_[".googleLikeFields"] = array();
$tdataloans_[".googleLikeFields"][] = "id";
$tdataloans_[".googleLikeFields"][] = "emp_id";
$tdataloans_[".googleLikeFields"][] = "loan_id";
$tdataloans_[".googleLikeFields"][] = "loan_amount";
$tdataloans_[".googleLikeFields"][] = "date";
$tdataloans_[".googleLikeFields"][] = "user";
$tdataloans_[".googleLikeFields"][] = "DETAILS";
$tdataloans_[".googleLikeFields"][] = "status";
$tdataloans_[".googleLikeFields"][] = "left_amount";



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

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

$tdataloans_[".nPrinterSplitRecords"] = 40;

$tdataloans_[".geocodingEnabled"] = false;










$tdataloans_[".pageSize"] = 20;

$tdataloans_[".warnLeavingPages"] = true;



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

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


$tdataloans_[".sqlHead"] = "SELECT loans.id,  loans.emp_id,  loans.loan_id,  loans.loan_amount,  loans.`date`,  loans.`user`,  CONCAT(sys_manage.fullname, \" - \", loa_types.loan_name) AS DETAILS,  CONCAT(loans.loan_amount,\" - \",ifnull(pur.st1,0)) as status,  loans.loan_amount - ifnull(pur.st1,0) as left_amount";
$tdataloans_[".sqlFrom"] = "FROM loans  LEFT OUTER JOIN loa_types ON loans.loan_id = loa_types.id  LEFT OUTER JOIN sys_manage ON loans.emp_id = sys_manage.ID  LEFT JOIN (select loan,sum(amount) as st1 from payment_of_loan_installments  group by loan ) as pur on loans.id=pur.loan";
$tdataloans_[".sqlWhereExpr"] = "";
$tdataloans_[".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;
$tdataloans_[".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;
$tdataloans_[".arrGroupsPerPage"] = $arrGPP;

$tdataloans_[".highlightSearchResults"] = true;

$tableKeysloans_ = array();
$tableKeysloans_[] = "id";
$tdataloans_[".Keys"] = $tableKeysloans_;


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




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

	
		$fdata["AutoInc"] = true;

	
			

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

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


	$tdataloans_["id"] = $fdata;
		$tdataloans_[".searchableFields"][] = "id";
//	emp_id
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 2;
	$fdata["strName"] = "emp_id";
	$fdata["GoodName"] = "emp_id";
	$fdata["ownerTable"] = "loans";
	$fdata["Label"] = GetFieldLabel("loans_","emp_id");
	$fdata["FieldType"] = 3;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "loans.emp_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();
				$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


	$tdataloans_["emp_id"] = $fdata;
		$tdataloans_[".searchableFields"][] = "emp_id";
//	loan_id
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "loan_id";
	$fdata["GoodName"] = "loan_id";
	$fdata["ownerTable"] = "loans";
	$fdata["Label"] = GetFieldLabel("loans_","loan_id");
	$fdata["FieldType"] = 3;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "loans.loan_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" => "Lookup wizard");

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


	
	

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

	
		
	$edata["LinkField"] = "id";
	$edata["LinkFieldType"] = 0;
	$edata["DisplayField"] = "loan_name";

	

	
	$edata["LookupOrderBy"] = "";

	
	
	
	

	
	
		$edata["SelectSize"] = 1;

// End Lookup Settings


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

		$edata["maxNumberOfFiles"] = 1;

	
	
	
	
	
	
		$edata["controlWidth"] = 200;

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

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


	$fdata["isSeparate"] = false;




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

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


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

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

		$fdata["filterBy"] = 0;

	

	
	
//end of Filters settings


	$tdataloans_["loan_id"] = $fdata;
		$tdataloans_[".searchableFields"][] = "loan_id";
//	loan_amount
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "loan_amount";
	$fdata["GoodName"] = "loan_amount";
	$fdata["ownerTable"] = "loans";
	$fdata["Label"] = GetFieldLabel("loans_","loan_amount");
	$fdata["FieldType"] = 14;

	
	
	
			

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

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


	$tdataloans_["loan_amount"] = $fdata;
		$tdataloans_[".searchableFields"][] = "loan_amount";
//	date
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 5;
	$fdata["strName"] = "date";
	$fdata["GoodName"] = "date";
	$fdata["ownerTable"] = "loans";
	$fdata["Label"] = GetFieldLabel("loans_","date");
	$fdata["FieldType"] = 135;

	
	
	
			

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

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


	$tdataloans_["date"] = $fdata;
		$tdataloans_[".searchableFields"][] = "date";
//	user
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 6;
	$fdata["strName"] = "user";
	$fdata["GoodName"] = "user";
	$fdata["ownerTable"] = "loans";
	$fdata["Label"] = GetFieldLabel("loans_","user");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "loans.`user`";

	
	
				$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


	$tdataloans_["user"] = $fdata;
		$tdataloans_[".searchableFields"][] = "user";
//	DETAILS
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 7;
	$fdata["strName"] = "DETAILS";
	$fdata["GoodName"] = "DETAILS";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("loans_","DETAILS");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "CONCAT(sys_manage.fullname, \" - \", loa_types.loan_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


	$tdataloans_["DETAILS"] = $fdata;
		$tdataloans_[".searchableFields"][] = "DETAILS";
//	status
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 8;
	$fdata["strName"] = "status";
	$fdata["GoodName"] = "status";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("loans_","status");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "CONCAT(loans.loan_amount,\" - \",ifnull(pur.st1,0))";

	
	
				$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


	$tdataloans_["status"] = $fdata;
		$tdataloans_[".searchableFields"][] = "status";
//	left_amount
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 9;
	$fdata["strName"] = "left_amount";
	$fdata["GoodName"] = "left_amount";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("loans_","left_amount");
	$fdata["FieldType"] = 14;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "loans.loan_amount - ifnull(pur.st1,0)";

	
	
				$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


	$tdataloans_["left_amount"] = $fdata;
		$tdataloans_[".searchableFields"][] = "left_amount";


$tables_data["loans."]=&$tdataloans_;
$field_labels["loans_"] = &$fieldLabelsloans_;
$fieldToolTips["loans_"] = &$fieldToolTipsloans_;
$placeHolders["loans_"] = &$placeHoldersloans_;
$page_titles["loans_"] = &$pageTitlesloans_;

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

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



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



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











function createSqlQuery_loans_()
{
$proto0=array();
$proto0["m_strHead"] = "SELECT";
$proto0["m_strFieldList"] = "loans.id,  loans.emp_id,  loans.loan_id,  loans.loan_amount,  loans.`date`,  loans.`user`,  CONCAT(sys_manage.fullname, \" - \", loa_types.loan_name) AS DETAILS,  CONCAT(loans.loan_amount,\" - \",ifnull(pur.st1,0)) as status,  loans.loan_amount - ifnull(pur.st1,0) as left_amount";
$proto0["m_strFrom"] = "FROM loans  LEFT OUTER JOIN loa_types ON loans.loan_id = loa_types.id  LEFT OUTER JOIN sys_manage ON loans.emp_id = sys_manage.ID  LEFT JOIN (select loan,sum(amount) as st1 from payment_of_loan_installments  group by loan ) as pur on loans.id=pur.loan";
$proto0["m_strWhere"] = "";
$proto0["m_strOrderBy"] = "";
	
		;
			$proto0["cipherer"] = null;
$proto2=array();
$proto2["m_sql"] = "";
$proto2["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

$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" => "loans",
	"m_srcTableName" => "loans."
));

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

$proto0["m_fieldlist"][]=$obj;
						$proto8=array();
			$obj = new SQLField(array(
	"m_strName" => "emp_id",
	"m_strTable" => "loans",
	"m_srcTableName" => "loans."
));

$proto8["m_sql"] = "loans.emp_id";
$proto8["m_srcTableName"] = "loans.";
$proto8["m_expr"]=$obj;
$proto8["m_alias"] = "";
$obj = new SQLFieldListItem($proto8);

$proto0["m_fieldlist"][]=$obj;
						$proto10=array();
			$obj = new SQLField(array(
	"m_strName" => "loan_id",
	"m_strTable" => "loans",
	"m_srcTableName" => "loans."
));

$proto10["m_sql"] = "loans.loan_id";
$proto10["m_srcTableName"] = "loans.";
$proto10["m_expr"]=$obj;
$proto10["m_alias"] = "";
$obj = new SQLFieldListItem($proto10);

$proto0["m_fieldlist"][]=$obj;
						$proto12=array();
			$obj = new SQLField(array(
	"m_strName" => "loan_amount",
	"m_strTable" => "loans",
	"m_srcTableName" => "loans."
));

$proto12["m_sql"] = "loans.loan_amount";
$proto12["m_srcTableName"] = "loans.";
$proto12["m_expr"]=$obj;
$proto12["m_alias"] = "";
$obj = new SQLFieldListItem($proto12);

$proto0["m_fieldlist"][]=$obj;
						$proto14=array();
			$obj = new SQLField(array(
	"m_strName" => "date",
	"m_strTable" => "loans",
	"m_srcTableName" => "loans."
));

$proto14["m_sql"] = "loans.`date`";
$proto14["m_srcTableName"] = "loans.";
$proto14["m_expr"]=$obj;
$proto14["m_alias"] = "";
$obj = new SQLFieldListItem($proto14);

$proto0["m_fieldlist"][]=$obj;
						$proto16=array();
			$obj = new SQLField(array(
	"m_strName" => "user",
	"m_strTable" => "loans",
	"m_srcTableName" => "loans."
));

$proto16["m_sql"] = "loans.`user`";
$proto16["m_srcTableName"] = "loans.";
$proto16["m_expr"]=$obj;
$proto16["m_alias"] = "";
$obj = new SQLFieldListItem($proto16);

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

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

$proto19["m_arguments"][]=$obj;
						$obj = new SQLNonParsed(array(
	"m_sql" => "loa_types.loan_name"
));

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

$proto18["m_sql"] = "CONCAT(sys_manage.fullname, \" - \", loa_types.loan_name)";
$proto18["m_srcTableName"] = "loans.";
$proto18["m_expr"]=$obj;
$proto18["m_alias"] = "DETAILS";
$obj = new SQLFieldListItem($proto18);

$proto0["m_fieldlist"][]=$obj;
						$proto23=array();
			$proto24=array();
$proto24["m_functiontype"] = "SQLF_CUSTOM";
$proto24["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "loans.loan_amount"
));

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

$proto24["m_arguments"][]=$obj;
						$obj = new SQLNonParsed(array(
	"m_sql" => "ifnull(pur.st1,0)"
));

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

$proto23["m_sql"] = "CONCAT(loans.loan_amount,\" - \",ifnull(pur.st1,0))";
$proto23["m_srcTableName"] = "loans.";
$proto23["m_expr"]=$obj;
$proto23["m_alias"] = "status";
$obj = new SQLFieldListItem($proto23);

$proto0["m_fieldlist"][]=$obj;
						$proto28=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "loans.loan_amount - ifnull(pur.st1,0)"
));

$proto28["m_sql"] = "loans.loan_amount - ifnull(pur.st1,0)";
$proto28["m_srcTableName"] = "loans.";
$proto28["m_expr"]=$obj;
$proto28["m_alias"] = "left_amount";
$obj = new SQLFieldListItem($proto28);

$proto0["m_fieldlist"][]=$obj;
$proto0["m_fromlist"] = array();
												$proto30=array();
$proto30["m_link"] = "SQLL_MAIN";
			$proto31=array();
$proto31["m_strName"] = "loans";
$proto31["m_srcTableName"] = "loans.";
$proto31["m_columns"] = array();
$proto31["m_columns"][] = "id";
$proto31["m_columns"][] = "emp_id";
$proto31["m_columns"][] = "loan_id";
$proto31["m_columns"][] = "loan_amount";
$proto31["m_columns"][] = "date";
$proto31["m_columns"][] = "user";
$proto31["m_columns"][] = "outlet_code";
$obj = new SQLTable($proto31);

$proto30["m_table"] = $obj;
$proto30["m_sql"] = "loans";
$proto30["m_alias"] = "";
$proto30["m_srcTableName"] = "loans.";
$proto32=array();
$proto32["m_sql"] = "";
$proto32["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto0["m_fromlist"][]=$obj;
												$proto34=array();
$proto34["m_link"] = "SQLL_LEFTJOIN";
			$proto35=array();
$proto35["m_strName"] = "loa_types";
$proto35["m_srcTableName"] = "loans.";
$proto35["m_columns"] = array();
$proto35["m_columns"][] = "id";
$proto35["m_columns"][] = "loan_name";
$obj = new SQLTable($proto35);

$proto34["m_table"] = $obj;
$proto34["m_sql"] = "LEFT OUTER JOIN loa_types ON loans.loan_id = loa_types.id";
$proto34["m_alias"] = "";
$proto34["m_srcTableName"] = "loans.";
$proto36=array();
$proto36["m_sql"] = "loans.loan_id = loa_types.id";
$proto36["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "loan_id",
	"m_strTable" => "loans",
	"m_srcTableName" => "loans."
));

$proto36["m_column"]=$obj;
$proto36["m_contained"] = array();
$proto36["m_strCase"] = "= loa_types.id";
$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"] = "sys_manage";
$proto39["m_srcTableName"] = "loans.";
$proto39["m_columns"] = array();
$proto39["m_columns"][] = "ID";
$proto39["m_columns"][] = "username";
$proto39["m_columns"][] = "password";
$proto39["m_columns"][] = "email";
$proto39["m_columns"][] = "fullname";
$proto39["m_columns"][] = "groupid";
$proto39["m_columns"][] = "active";
$proto39["m_columns"][] = "ext_security_id";
$proto39["m_columns"][] = "reset_token";
$proto39["m_columns"][] = "reset_date";
$proto39["m_columns"][] = "teliphone_number";
$proto39["m_columns"][] = "date";
$proto39["m_columns"][] = "branch_code";
$proto39["m_columns"][] = "outlet_code";
$proto39["m_columns"][] = "MyTheme";
$proto39["m_columns"][] = "MyThemeSize";
$proto39["m_columns"][] = "password2";
$obj = new SQLTable($proto39);

$proto38["m_table"] = $obj;
$proto38["m_sql"] = "LEFT OUTER JOIN sys_manage ON loans.emp_id = sys_manage.ID";
$proto38["m_alias"] = "";
$proto38["m_srcTableName"] = "loans.";
$proto40=array();
$proto40["m_sql"] = "loans.emp_id = sys_manage.ID";
$proto40["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "emp_id",
	"m_strTable" => "loans",
	"m_srcTableName" => "loans."
));

$proto40["m_column"]=$obj;
$proto40["m_contained"] = array();
$proto40["m_strCase"] = "= sys_manage.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"] = "loan,sum(amount) as st1";
$proto43["m_strFrom"] = "from payment_of_loan_installments";
$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" => "loan",
	"m_strTable" => "payment_of_loan_installments",
	"m_srcTableName" => "loans."
));

$proto49["m_sql"] = "loan";
$proto49["m_srcTableName"] = "loans.";
$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" => "payment_of_loan_installments",
	"m_srcTableName" => "loans."
));

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

$proto51["m_sql"] = "sum(amount)";
$proto51["m_srcTableName"] = "loans.";
$proto51["m_expr"]=$obj;
$proto51["m_alias"] = "st1";
$obj = new SQLFieldListItem($proto51);

$proto43["m_fieldlist"][]=$obj;
$proto43["m_fromlist"] = array();
												$proto54=array();
$proto54["m_link"] = "SQLL_MAIN";
			$proto55=array();
$proto55["m_strName"] = "payment_of_loan_installments";
$proto55["m_srcTableName"] = "loans.";
$proto55["m_columns"] = array();
$proto55["m_columns"][] = "id";
$proto55["m_columns"][] = "loan";
$proto55["m_columns"][] = "emp_id";
$proto55["m_columns"][] = "month";
$proto55["m_columns"][] = "loan_status";
$proto55["m_columns"][] = "amount";
$proto55["m_columns"][] = "user";
$proto55["m_columns"][] = "date";
$proto55["m_columns"][] = "pay_slip_link";
$obj = new SQLTable($proto55);

$proto54["m_table"] = $obj;
$proto54["m_sql"] = "payment_of_loan_installments";
$proto54["m_alias"] = "";
$proto54["m_srcTableName"] = "loans.";
$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" => "loan",
	"m_strTable" => "payment_of_loan_installments",
	"m_srcTableName" => "loans."
));

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

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

$proto42["m_table"] = $obj;
$proto42["m_sql"] = "LEFT JOIN (select loan,sum(amount) as st1 from payment_of_loan_installments  group by loan ) as pur on loans.id=pur.loan";
$proto42["m_alias"] = "pur";
$proto42["m_srcTableName"] = "loans.";
$proto60=array();
$proto60["m_sql"] = "loans.id=pur.loan";
$proto60["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "id",
	"m_strTable" => "loans",
	"m_srcTableName" => "loans."
));

$proto60["m_column"]=$obj;
$proto60["m_contained"] = array();
$proto60["m_strCase"] = "=pur.loan";
$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();
$proto0["m_srcTableName"]="loans.";		
$obj = new SQLQuery($proto0);

	return $obj;
}
$queryData_loans_ = createSqlQuery_loans_();


	
		;

									

$tdataloans_[".sqlquery"] = $queryData_loans_;



$tableEvents["loans."] = new eventsBase;
$tdataloans_[".hasEvents"] = false;

?>