<?php
$tdatastock_balance = array();
$tdatastock_balance[".searchableFields"] = array();
$tdatastock_balance[".ShortName"] = "stock_balance";
$tdatastock_balance[".OwnerID"] = "";
$tdatastock_balance[".OriginalTable"] = "product";


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

//	field labels
$fieldLabelsstock_balance = array();
$fieldToolTipsstock_balance = array();
$pageTitlesstock_balance = array();
$placeHoldersstock_balance = array();

if(mlang_getcurrentlang()=="English")
{
	$fieldLabelsstock_balance["English"] = array();
	$fieldToolTipsstock_balance["English"] = array();
	$placeHoldersstock_balance["English"] = array();
	$pageTitlesstock_balance["English"] = array();
	$fieldLabelsstock_balance["English"]["id"] = "Id";
	$fieldToolTipsstock_balance["English"]["id"] = "";
	$placeHoldersstock_balance["English"]["id"] = "";
	$fieldLabelsstock_balance["English"]["bar_code"] = "Bar Code";
	$fieldToolTipsstock_balance["English"]["bar_code"] = "";
	$placeHoldersstock_balance["English"]["bar_code"] = "";
	$fieldLabelsstock_balance["English"]["product_name"] = "Product Name";
	$fieldToolTipsstock_balance["English"]["product_name"] = "";
	$placeHoldersstock_balance["English"]["product_name"] = "";
	$fieldLabelsstock_balance["English"]["unit"] = "Unit";
	$fieldToolTipsstock_balance["English"]["unit"] = "";
	$placeHoldersstock_balance["English"]["unit"] = "";
	$fieldLabelsstock_balance["English"]["in_1"] = "In-1";
	$fieldToolTipsstock_balance["English"]["in_1"] = "";
	$placeHoldersstock_balance["English"]["in_1"] = "";
	$fieldLabelsstock_balance["English"]["out_1"] = "Out-1";
	$fieldToolTipsstock_balance["English"]["out_1"] = "";
	$placeHoldersstock_balance["English"]["out_1"] = "";
	$fieldLabelsstock_balance["English"]["balance_1"] = "Balance-1";
	$fieldToolTipsstock_balance["English"]["balance_1"] = "";
	$placeHoldersstock_balance["English"]["balance_1"] = "";
	$fieldLabelsstock_balance["English"]["in_2"] = "In-2";
	$fieldToolTipsstock_balance["English"]["in_2"] = "";
	$placeHoldersstock_balance["English"]["in_2"] = "";
	$fieldLabelsstock_balance["English"]["out_2"] = "Out-2";
	$fieldToolTipsstock_balance["English"]["out_2"] = "";
	$placeHoldersstock_balance["English"]["out_2"] = "";
	$fieldLabelsstock_balance["English"]["balance_2"] = "Balance-2";
	$fieldToolTipsstock_balance["English"]["balance_2"] = "";
	$placeHoldersstock_balance["English"]["balance_2"] = "";
	$fieldLabelsstock_balance["English"]["in_3"] = "In-3";
	$fieldToolTipsstock_balance["English"]["in_3"] = "";
	$placeHoldersstock_balance["English"]["in_3"] = "";
	$fieldLabelsstock_balance["English"]["out_3"] = "Out-3";
	$fieldToolTipsstock_balance["English"]["out_3"] = "";
	$placeHoldersstock_balance["English"]["out_3"] = "";
	$fieldLabelsstock_balance["English"]["balance_3"] = "Balance-3";
	$fieldToolTipsstock_balance["English"]["balance_3"] = "";
	$placeHoldersstock_balance["English"]["balance_3"] = "";
	$fieldLabelsstock_balance["English"]["in_all"] = "In-all";
	$fieldToolTipsstock_balance["English"]["in_all"] = "";
	$placeHoldersstock_balance["English"]["in_all"] = "";
	$fieldLabelsstock_balance["English"]["out_all"] = "Out-all";
	$fieldToolTipsstock_balance["English"]["out_all"] = "";
	$placeHoldersstock_balance["English"]["out_all"] = "";
	$fieldLabelsstock_balance["English"]["balance_all"] = "Balance-all";
	$fieldToolTipsstock_balance["English"]["balance_all"] = "";
	$placeHoldersstock_balance["English"]["balance_all"] = "";
	if (count($fieldToolTipsstock_balance["English"]))
		$tdatastock_balance[".isUseToolTips"] = true;
}


	$tdatastock_balance[".NCSearch"] = true;



$tdatastock_balance[".shortTableName"] = "stock_balance";
$tdatastock_balance[".nSecOptions"] = 0;

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


$tdatastock_balance[".strOriginalTableName"] = "product";

	



$tdatastock_balance[".showAddInPopup"] = false;

$tdatastock_balance[".showEditInPopup"] = false;

$tdatastock_balance[".showViewInPopup"] = false;

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


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

	$tdatastock_balance[".audit"] = true;

	$tdatastock_balance[".locking"] = false;


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

if( $pages[PAGE_EDIT] ) {
	$tdatastock_balance[".edit"] = true;
	$tdatastock_balance[".afterEditAction"] = 1;
	$tdatastock_balance[".closePopupAfterEdit"] = 1;
	$tdatastock_balance[".afterEditActionDetTable"] = "Detail tables not found!";
}

if( $pages[PAGE_ADD] ) {
$tdatastock_balance[".add"] = true;
$tdatastock_balance[".afterAddAction"] = 1;
$tdatastock_balance[".closePopupAfterAdd"] = 0;
$tdatastock_balance[".afterAddActionDetTable"] = "Detail tables not found!";
}

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



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




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

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

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

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



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

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

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

$tdatastock_balance[".isUseAjaxSuggest"] = true;

$tdatastock_balance[".rowHighlite"] = true;



																																																			

$tdatastock_balance[".ajaxCodeSnippetAdded"] = false;

$tdatastock_balance[".buttonsAdded"] = false;

$tdatastock_balance[".addPageEvents"] = false;

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


$tdatastock_balance[".badgeColor"] = "9ACD32";


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

$tdatastock_balance[".googleLikeFields"] = array();
$tdatastock_balance[".googleLikeFields"][] = "id";
$tdatastock_balance[".googleLikeFields"][] = "bar_code";
$tdatastock_balance[".googleLikeFields"][] = "product_name";
$tdatastock_balance[".googleLikeFields"][] = "unit";
$tdatastock_balance[".googleLikeFields"][] = "in-1";
$tdatastock_balance[".googleLikeFields"][] = "out-1";
$tdatastock_balance[".googleLikeFields"][] = "balance-1";
$tdatastock_balance[".googleLikeFields"][] = "in-2";
$tdatastock_balance[".googleLikeFields"][] = "out-2";
$tdatastock_balance[".googleLikeFields"][] = "balance-2";
$tdatastock_balance[".googleLikeFields"][] = "in-3";
$tdatastock_balance[".googleLikeFields"][] = "out-3";
$tdatastock_balance[".googleLikeFields"][] = "balance-3";
$tdatastock_balance[".googleLikeFields"][] = "in-all";
$tdatastock_balance[".googleLikeFields"][] = "out-all";
$tdatastock_balance[".googleLikeFields"][] = "balance-all";



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

$tdatastock_balance[".printerPageOrientation"] = 0;
$tdatastock_balance[".isPrinterPageFitToPage"] = 0;
$tdatastock_balance[".nPrinterPageScale"] = 100;

$tdatastock_balance[".nPrinterSplitRecords"] = 40;

$tdatastock_balance[".geocodingEnabled"] = false;





$tdatastock_balance[".isResizeColumns"] = true;





$tdatastock_balance[".pageSize"] = 20;

$tdatastock_balance[".warnLeavingPages"] = true;



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

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


$tdatastock_balance[".sqlHead"] = "SELECT `id`, `bar_code`,  `product_name`,`unit`,  IFNULL(pur1.st1, 0) AS \"in-1\", IFNULL(pur2.st2, 0) AS \"out-1\",IFNULL(pur1.st1, 0)-IFNULL(pur2.st2, 0) as \"balance-1\",  IFNULL(pur11.st11, 0) AS \"in-2\", IFNULL(pur21.st21, 0) AS \"out-2\",IFNULL(pur11.st11, 0)-IFNULL(pur21.st21, 0) as \"balance-2\",  IFNULL(pur12.st12, 0) AS \"in-3\", IFNULL(pur22.st22, 0) AS \"out-3\",IFNULL(pur12.st12, 0)-IFNULL(pur22.st22, 0) as \"balance-3\",  IFNULL(pur13.st13, 0) AS \"in-all\", IFNULL(pur23.st23, 0) AS \"out-all\",IFNULL(pur13.st13, 0)-IFNULL(pur23.st23, 0) as \"balance-all\"";
$tdatastock_balance[".sqlFrom"] = "FROM `product`   LEFT JOIN ( SELECT `bar_code`as kkk , SUM(`gross`) AS st1 FROM `purchasing_details`   WHERE 	outlet_code=1 GROUP BY bar_code) AS pur1 ON product.bar_code = pur1.kkk  LEFT JOIN ( SELECT `bar_code`as kk2 , SUM(`quntity`) AS st2 FROM `sales_details`   WHERE outlet_code=1 GROUP BY bar_code) AS pur2 ON product.bar_code = pur2.kk2    LEFT JOIN ( SELECT `bar_code`as kkk3 , SUM(`gross`) AS st11 FROM `purchasing_details`   WHERE outlet_code=2 GROUP BY bar_code) AS pur11 ON product.bar_code = pur11.kkk3  LEFT JOIN ( SELECT `bar_code`as kk23 , SUM(`quntity`) AS st21 FROM `sales_details`   WHERE outlet_code=2 GROUP BY bar_code) AS pur21 ON product.bar_code = pur21.kk23    LEFT JOIN ( SELECT `bar_code`as kkk4 , SUM(`gross`) AS st12 FROM `purchasing_details`   WHERE outlet_code=3 GROUP BY bar_code) AS pur12 ON product.bar_code = pur12.kkk4  LEFT JOIN ( SELECT `bar_code`as kk24 , SUM(`quntity`) AS st22 FROM `sales_details`   WHERE outlet_code=3 GROUP BY bar_code) AS pur22 ON product.bar_code = pur22.kk24    LEFT JOIN ( SELECT `bar_code`as kkk5 , SUM(`gross`) AS st13 FROM `purchasing_details`   WHERE 1 GROUP BY bar_code) AS pur13 ON product.bar_code = pur13.kkk5  LEFT JOIN ( SELECT `bar_code`as kk25 , SUM(`quntity`) AS st23 FROM `sales_details`   WHERE 1 GROUP BY bar_code) AS pur23 ON product.bar_code = pur23.kk25";
$tdatastock_balance[".sqlWhereExpr"] = "";
$tdatastock_balance[".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;
$tdatastock_balance[".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;
$tdatastock_balance[".arrGroupsPerPage"] = $arrGPP;

$tdatastock_balance[".highlightSearchResults"] = true;

$tableKeysstock_balance = array();
$tableKeysstock_balance[] = "id";
$tdatastock_balance[".Keys"] = $tableKeysstock_balance;


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




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

	
		$fdata["AutoInc"] = true;

	
			

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

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


	$tdatastock_balance["id"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "id";
//	bar_code
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 2;
	$fdata["strName"] = "bar_code";
	$fdata["GoodName"] = "bar_code";
	$fdata["ownerTable"] = "product";
	$fdata["Label"] = GetFieldLabel("stock_balance","bar_code");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "`bar_code`";

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

		$edata["controlWidth"] = 200;

//	Begin validation
	$edata["validateAs"] = array();
	$edata["validateAs"]["basicValidate"] = array();
	$edata["validateAs"]["customMessages"] = array();
						$edata["validateAs"]["basicValidate"][] = "IsRequired";
			$edata["validateAs"]["basicValidate"][] = "DenyDuplicated";
	$edata["validateAs"]["customMessages"]["DenyDuplicated"] = array("message" => "Value %value% already exists", "messageType" => "Text");

	
	//	End validation

	
			
	
		$edata["denyDuplicates"] = true;

	
	$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


	$tdatastock_balance["bar_code"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "bar_code";
//	product_name
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 3;
	$fdata["strName"] = "product_name";
	$fdata["GoodName"] = "product_name";
	$fdata["ownerTable"] = "product";
	$fdata["Label"] = GetFieldLabel("stock_balance","product_name");
	$fdata["FieldType"] = 200;

	
	
	
			

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

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

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

		$edata["maxNumberOfFiles"] = 1;

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

		$edata["EditParams"] = "";
			$edata["EditParams"].= " maxlength=50";

		$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"] = "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


	$tdatastock_balance["product_name"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "product_name";
//	unit
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 4;
	$fdata["strName"] = "unit";
	$fdata["GoodName"] = "unit";
	$fdata["ownerTable"] = "product";
	$fdata["Label"] = GetFieldLabel("stock_balance","unit");
	$fdata["FieldType"] = 200;

	
	
	
			

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

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "`unit`";

	
	
				$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"] = "units";
			$edata["autoCompleteFieldsOnEdit"] = 0;
	$edata["autoCompleteFields"] = array();
		$edata["LCType"] = 0;

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

				$edata["LookupWhereCode"] = true;


	
	$edata["LookupOrderBy"] = "";

	
	
		$edata["AllowToAdd"] = true;
			$edata["addPageId"] = "add";

	

	
	
		$edata["SelectSize"] = 1;

// End Lookup Settings


		$edata["IsRequired"] = true;

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

		$edata["maxNumberOfFiles"] = 1;

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


	$tdatastock_balance["unit"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "unit";
//	in-1
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 5;
	$fdata["strName"] = "in-1";
	$fdata["GoodName"] = "in_1";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","in_1");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "in-1";

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


	$tdatastock_balance["in-1"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "in-1";
//	out-1
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 6;
	$fdata["strName"] = "out-1";
	$fdata["GoodName"] = "out_1";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","out_1");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "out-1";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur2.st2, 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


	$tdatastock_balance["out-1"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "out-1";
//	balance-1
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 7;
	$fdata["strName"] = "balance-1";
	$fdata["GoodName"] = "balance_1";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","balance_1");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "balance-1";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur1.st1, 0)-IFNULL(pur2.st2, 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


	$tdatastock_balance["balance-1"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "balance-1";
//	in-2
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 8;
	$fdata["strName"] = "in-2";
	$fdata["GoodName"] = "in_2";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","in_2");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "in-2";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur11.st11, 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


	$tdatastock_balance["in-2"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "in-2";
//	out-2
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 9;
	$fdata["strName"] = "out-2";
	$fdata["GoodName"] = "out_2";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","out_2");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "out-2";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur21.st21, 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


	$tdatastock_balance["out-2"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "out-2";
//	balance-2
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 10;
	$fdata["strName"] = "balance-2";
	$fdata["GoodName"] = "balance_2";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","balance_2");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "balance-2";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur11.st11, 0)-IFNULL(pur21.st21, 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


	$tdatastock_balance["balance-2"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "balance-2";
//	in-3
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 11;
	$fdata["strName"] = "in-3";
	$fdata["GoodName"] = "in_3";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","in_3");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "in-3";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur12.st12, 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


	$tdatastock_balance["in-3"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "in-3";
//	out-3
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 12;
	$fdata["strName"] = "out-3";
	$fdata["GoodName"] = "out_3";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","out_3");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "out-3";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur22.st22, 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


	$tdatastock_balance["out-3"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "out-3";
//	balance-3
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 13;
	$fdata["strName"] = "balance-3";
	$fdata["GoodName"] = "balance_3";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","balance_3");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "balance-3";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur12.st12, 0)-IFNULL(pur22.st22, 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


	$tdatastock_balance["balance-3"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "balance-3";
//	in-all
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 14;
	$fdata["strName"] = "in-all";
	$fdata["GoodName"] = "in_all";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","in_all");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "in-all";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur13.st13, 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


	$tdatastock_balance["in-all"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "in-all";
//	out-all
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 15;
	$fdata["strName"] = "out-all";
	$fdata["GoodName"] = "out_all";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","out_all");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "out-all";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur23.st23, 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


	$tdatastock_balance["out-all"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "out-all";
//	balance-all
//	Custom field settings
	$fdata = array();
	$fdata["Index"] = 16;
	$fdata["strName"] = "balance-all";
	$fdata["GoodName"] = "balance_all";
	$fdata["ownerTable"] = "";
	$fdata["Label"] = GetFieldLabel("stock_balance","balance_all");
	$fdata["FieldType"] = 14;

	
	
	
			

		$fdata["strField"] = "balance-all";

	
		$fdata["isSQLExpression"] = true;
	$fdata["FullName"] = "IFNULL(pur13.st13, 0)-IFNULL(pur23.st23, 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


	$tdatastock_balance["balance-all"] = $fdata;
		$tdatastock_balance[".searchableFields"][] = "balance-all";


$tables_data["stock_balance"]=&$tdatastock_balance;
$field_labels["stock_balance"] = &$fieldLabelsstock_balance;
$fieldToolTips["stock_balance"] = &$fieldToolTipsstock_balance;
$placeHolders["stock_balance"] = &$placeHoldersstock_balance;
$page_titles["stock_balance"] = &$pageTitlesstock_balance;

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

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



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



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











function createSqlQuery_stock_balance()
{
$proto0=array();
$proto0["m_strHead"] = "SELECT";
$proto0["m_strFieldList"] = "`id`, `bar_code`,  `product_name`,`unit`,  IFNULL(pur1.st1, 0) AS \"in-1\", IFNULL(pur2.st2, 0) AS \"out-1\",IFNULL(pur1.st1, 0)-IFNULL(pur2.st2, 0) as \"balance-1\",  IFNULL(pur11.st11, 0) AS \"in-2\", IFNULL(pur21.st21, 0) AS \"out-2\",IFNULL(pur11.st11, 0)-IFNULL(pur21.st21, 0) as \"balance-2\",  IFNULL(pur12.st12, 0) AS \"in-3\", IFNULL(pur22.st22, 0) AS \"out-3\",IFNULL(pur12.st12, 0)-IFNULL(pur22.st22, 0) as \"balance-3\",  IFNULL(pur13.st13, 0) AS \"in-all\", IFNULL(pur23.st23, 0) AS \"out-all\",IFNULL(pur13.st13, 0)-IFNULL(pur23.st23, 0) as \"balance-all\"";
$proto0["m_strFrom"] = "FROM `product`   LEFT JOIN ( SELECT `bar_code`as kkk , SUM(`gross`) AS st1 FROM `purchasing_details`   WHERE 	outlet_code=1 GROUP BY bar_code) AS pur1 ON product.bar_code = pur1.kkk  LEFT JOIN ( SELECT `bar_code`as kk2 , SUM(`quntity`) AS st2 FROM `sales_details`   WHERE outlet_code=1 GROUP BY bar_code) AS pur2 ON product.bar_code = pur2.kk2    LEFT JOIN ( SELECT `bar_code`as kkk3 , SUM(`gross`) AS st11 FROM `purchasing_details`   WHERE outlet_code=2 GROUP BY bar_code) AS pur11 ON product.bar_code = pur11.kkk3  LEFT JOIN ( SELECT `bar_code`as kk23 , SUM(`quntity`) AS st21 FROM `sales_details`   WHERE outlet_code=2 GROUP BY bar_code) AS pur21 ON product.bar_code = pur21.kk23    LEFT JOIN ( SELECT `bar_code`as kkk4 , SUM(`gross`) AS st12 FROM `purchasing_details`   WHERE outlet_code=3 GROUP BY bar_code) AS pur12 ON product.bar_code = pur12.kkk4  LEFT JOIN ( SELECT `bar_code`as kk24 , SUM(`quntity`) AS st22 FROM `sales_details`   WHERE outlet_code=3 GROUP BY bar_code) AS pur22 ON product.bar_code = pur22.kk24    LEFT JOIN ( SELECT `bar_code`as kkk5 , SUM(`gross`) AS st13 FROM `purchasing_details`   WHERE 1 GROUP BY bar_code) AS pur13 ON product.bar_code = pur13.kkk5  LEFT JOIN ( SELECT `bar_code`as kk25 , SUM(`quntity`) AS st23 FROM `sales_details`   WHERE 1 GROUP BY bar_code) AS pur23 ON product.bar_code = pur23.kk25";
$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" => "product",
	"m_srcTableName" => "stock_balance"
));

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

$proto0["m_fieldlist"][]=$obj;
						$proto8=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto8["m_sql"] = "`bar_code`";
$proto8["m_srcTableName"] = "stock_balance";
$proto8["m_expr"]=$obj;
$proto8["m_alias"] = "";
$obj = new SQLFieldListItem($proto8);

$proto0["m_fieldlist"][]=$obj;
						$proto10=array();
			$obj = new SQLField(array(
	"m_strName" => "product_name",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto10["m_sql"] = "`product_name`";
$proto10["m_srcTableName"] = "stock_balance";
$proto10["m_expr"]=$obj;
$proto10["m_alias"] = "";
$obj = new SQLFieldListItem($proto10);

$proto0["m_fieldlist"][]=$obj;
						$proto12=array();
			$obj = new SQLField(array(
	"m_strName" => "unit",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto12["m_sql"] = "`unit`";
$proto12["m_srcTableName"] = "stock_balance";
$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" => "pur1.st1"
));

$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(pur1.st1, 0)";
$proto14["m_srcTableName"] = "stock_balance";
$proto14["m_expr"]=$obj;
$proto14["m_alias"] = "in-1";
$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" => "pur2.st2"
));

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

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

$proto18["m_sql"] = "IFNULL(pur2.st2, 0)";
$proto18["m_srcTableName"] = "stock_balance";
$proto18["m_expr"]=$obj;
$proto18["m_alias"] = "out-1";
$obj = new SQLFieldListItem($proto18);

$proto0["m_fieldlist"][]=$obj;
						$proto22=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "IFNULL(pur1.st1, 0)-IFNULL(pur2.st2, 0)"
));

$proto22["m_sql"] = "IFNULL(pur1.st1, 0)-IFNULL(pur2.st2, 0)";
$proto22["m_srcTableName"] = "stock_balance";
$proto22["m_expr"]=$obj;
$proto22["m_alias"] = "balance-1";
$obj = new SQLFieldListItem($proto22);

$proto0["m_fieldlist"][]=$obj;
						$proto24=array();
			$proto25=array();
$proto25["m_functiontype"] = "SQLF_CUSTOM";
$proto25["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "pur11.st11"
));

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

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

$proto24["m_sql"] = "IFNULL(pur11.st11, 0)";
$proto24["m_srcTableName"] = "stock_balance";
$proto24["m_expr"]=$obj;
$proto24["m_alias"] = "in-2";
$obj = new SQLFieldListItem($proto24);

$proto0["m_fieldlist"][]=$obj;
						$proto28=array();
			$proto29=array();
$proto29["m_functiontype"] = "SQLF_CUSTOM";
$proto29["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "pur21.st21"
));

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

$proto29["m_arguments"][]=$obj;
$proto29["m_strFunctionName"] = "IFNULL";
$obj = new SQLFunctionCall($proto29);

$proto28["m_sql"] = "IFNULL(pur21.st21, 0)";
$proto28["m_srcTableName"] = "stock_balance";
$proto28["m_expr"]=$obj;
$proto28["m_alias"] = "out-2";
$obj = new SQLFieldListItem($proto28);

$proto0["m_fieldlist"][]=$obj;
						$proto32=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "IFNULL(pur11.st11, 0)-IFNULL(pur21.st21, 0)"
));

$proto32["m_sql"] = "IFNULL(pur11.st11, 0)-IFNULL(pur21.st21, 0)";
$proto32["m_srcTableName"] = "stock_balance";
$proto32["m_expr"]=$obj;
$proto32["m_alias"] = "balance-2";
$obj = new SQLFieldListItem($proto32);

$proto0["m_fieldlist"][]=$obj;
						$proto34=array();
			$proto35=array();
$proto35["m_functiontype"] = "SQLF_CUSTOM";
$proto35["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "pur12.st12"
));

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

$proto35["m_arguments"][]=$obj;
$proto35["m_strFunctionName"] = "IFNULL";
$obj = new SQLFunctionCall($proto35);

$proto34["m_sql"] = "IFNULL(pur12.st12, 0)";
$proto34["m_srcTableName"] = "stock_balance";
$proto34["m_expr"]=$obj;
$proto34["m_alias"] = "in-3";
$obj = new SQLFieldListItem($proto34);

$proto0["m_fieldlist"][]=$obj;
						$proto38=array();
			$proto39=array();
$proto39["m_functiontype"] = "SQLF_CUSTOM";
$proto39["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "pur22.st22"
));

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

$proto39["m_arguments"][]=$obj;
$proto39["m_strFunctionName"] = "IFNULL";
$obj = new SQLFunctionCall($proto39);

$proto38["m_sql"] = "IFNULL(pur22.st22, 0)";
$proto38["m_srcTableName"] = "stock_balance";
$proto38["m_expr"]=$obj;
$proto38["m_alias"] = "out-3";
$obj = new SQLFieldListItem($proto38);

$proto0["m_fieldlist"][]=$obj;
						$proto42=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "IFNULL(pur12.st12, 0)-IFNULL(pur22.st22, 0)"
));

$proto42["m_sql"] = "IFNULL(pur12.st12, 0)-IFNULL(pur22.st22, 0)";
$proto42["m_srcTableName"] = "stock_balance";
$proto42["m_expr"]=$obj;
$proto42["m_alias"] = "balance-3";
$obj = new SQLFieldListItem($proto42);

$proto0["m_fieldlist"][]=$obj;
						$proto44=array();
			$proto45=array();
$proto45["m_functiontype"] = "SQLF_CUSTOM";
$proto45["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "pur13.st13"
));

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

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

$proto44["m_sql"] = "IFNULL(pur13.st13, 0)";
$proto44["m_srcTableName"] = "stock_balance";
$proto44["m_expr"]=$obj;
$proto44["m_alias"] = "in-all";
$obj = new SQLFieldListItem($proto44);

$proto0["m_fieldlist"][]=$obj;
						$proto48=array();
			$proto49=array();
$proto49["m_functiontype"] = "SQLF_CUSTOM";
$proto49["m_arguments"] = array();
						$obj = new SQLNonParsed(array(
	"m_sql" => "pur23.st23"
));

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

$proto49["m_arguments"][]=$obj;
$proto49["m_strFunctionName"] = "IFNULL";
$obj = new SQLFunctionCall($proto49);

$proto48["m_sql"] = "IFNULL(pur23.st23, 0)";
$proto48["m_srcTableName"] = "stock_balance";
$proto48["m_expr"]=$obj;
$proto48["m_alias"] = "out-all";
$obj = new SQLFieldListItem($proto48);

$proto0["m_fieldlist"][]=$obj;
						$proto52=array();
			$obj = new SQLNonParsed(array(
	"m_sql" => "IFNULL(pur13.st13, 0)-IFNULL(pur23.st23, 0)"
));

$proto52["m_sql"] = "IFNULL(pur13.st13, 0)-IFNULL(pur23.st23, 0)";
$proto52["m_srcTableName"] = "stock_balance";
$proto52["m_expr"]=$obj;
$proto52["m_alias"] = "balance-all";
$obj = new SQLFieldListItem($proto52);

$proto0["m_fieldlist"][]=$obj;
$proto0["m_fromlist"] = array();
												$proto54=array();
$proto54["m_link"] = "SQLL_MAIN";
			$proto55=array();
$proto55["m_strName"] = "product";
$proto55["m_srcTableName"] = "stock_balance";
$proto55["m_columns"] = array();
$proto55["m_columns"][] = "id";
$proto55["m_columns"][] = "bar_code";
$proto55["m_columns"][] = "product_name";
$proto55["m_columns"][] = "price";
$proto55["m_columns"][] = "discount";
$proto55["m_columns"][] = "category";
$proto55["m_columns"][] = "cost";
$proto55["m_columns"][] = "unit";
$proto55["m_columns"][] = "reorder_level";
$proto55["m_columns"][] = "brand";
$proto55["m_columns"][] = "image";
$proto55["m_columns"][] = "tax";
$proto55["m_columns"][] = "hide";
$proto55["m_columns"][] = "branch_code";
$obj = new SQLTable($proto55);

$proto54["m_table"] = $obj;
$proto54["m_sql"] = "`product`";
$proto54["m_alias"] = "";
$proto54["m_srcTableName"] = "stock_balance";
$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);

$proto0["m_fromlist"][]=$obj;
												$proto58=array();
$proto58["m_link"] = "SQLL_LEFTJOIN";
			$proto59=array();
$proto59["m_strHead"] = " SELECT";
$proto59["m_strFieldList"] = "`bar_code`as kkk , SUM(`gross`) AS st1";
$proto59["m_strFrom"] = "FROM `purchasing_details`";
$proto59["m_strWhere"] = "outlet_code=1";
$proto59["m_strOrderBy"] = "";
	
		;
			$proto59["cipherer"] = null;
$proto61=array();
$proto61["m_sql"] = "outlet_code=1";
$proto61["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "outlet_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

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

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

$proto59["m_having"] = $obj;
$proto59["m_fieldlist"] = array();
						$proto65=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

$proto65["m_sql"] = "`bar_code`";
$proto65["m_srcTableName"] = "stock_balance";
$proto65["m_expr"]=$obj;
$proto65["m_alias"] = "kkk";
$obj = new SQLFieldListItem($proto65);

$proto59["m_fieldlist"][]=$obj;
						$proto67=array();
			$proto68=array();
$proto68["m_functiontype"] = "SQLF_SUM";
$proto68["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "gross",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto67["m_sql"] = "SUM(`gross`)";
$proto67["m_srcTableName"] = "stock_balance";
$proto67["m_expr"]=$obj;
$proto67["m_alias"] = "st1";
$obj = new SQLFieldListItem($proto67);

$proto59["m_fieldlist"][]=$obj;
$proto59["m_fromlist"] = array();
												$proto70=array();
$proto70["m_link"] = "SQLL_MAIN";
			$proto71=array();
$proto71["m_strName"] = "purchasing_details";
$proto71["m_srcTableName"] = "stock_balance";
$proto71["m_columns"] = array();
$proto71["m_columns"][] = "id";
$proto71["m_columns"][] = "pur_id";
$proto71["m_columns"][] = "bar_code";
$proto71["m_columns"][] = "unit";
$proto71["m_columns"][] = "gross";
$proto71["m_columns"][] = "price";
$proto71["m_columns"][] = "tar";
$proto71["m_columns"][] = "net";
$proto71["m_columns"][] = "sub_total";
$proto71["m_columns"][] = "stock_rece_code";
$proto71["m_columns"][] = "stock_send_code";
$proto71["m_columns"][] = "product";
$proto71["m_columns"][] = "details";
$proto71["m_columns"][] = "package_details";
$proto71["m_columns"][] = "cstatus";
$proto71["m_columns"][] = "outlet_code";
$proto71["m_columns"][] = "user";
$obj = new SQLTable($proto71);

$proto70["m_table"] = $obj;
$proto70["m_sql"] = "`purchasing_details`";
$proto70["m_alias"] = "";
$proto70["m_srcTableName"] = "stock_balance";
$proto72=array();
$proto72["m_sql"] = "";
$proto72["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto59["m_fromlist"][]=$obj;
$proto59["m_groupby"] = array();
												$proto74=array();
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto59["m_groupby"][]=$obj;
$proto59["m_orderby"] = array();
$proto59["m_srcTableName"]="stock_balance";		
$obj = new SQLQuery($proto59);

$proto58["m_table"] = $obj;
$proto58["m_sql"] = "LEFT JOIN ( SELECT `bar_code`as kkk , SUM(`gross`) AS st1 FROM `purchasing_details`   WHERE 	outlet_code=1 GROUP BY bar_code) AS pur1 ON product.bar_code = pur1.kkk";
$proto58["m_alias"] = "pur1";
$proto58["m_srcTableName"] = "stock_balance";
$proto76=array();
$proto76["m_sql"] = "product.bar_code = pur1.kkk";
$proto76["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto76["m_column"]=$obj;
$proto76["m_contained"] = array();
$proto76["m_strCase"] = "= pur1.kkk";
$proto76["m_havingmode"] = false;
$proto76["m_inBrackets"] = false;
$proto76["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto76);

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

$proto0["m_fromlist"][]=$obj;
												$proto78=array();
$proto78["m_link"] = "SQLL_LEFTJOIN";
			$proto79=array();
$proto79["m_strHead"] = " SELECT";
$proto79["m_strFieldList"] = "`bar_code`as kk2 , SUM(`quntity`) AS st2";
$proto79["m_strFrom"] = "FROM `sales_details`";
$proto79["m_strWhere"] = "outlet_code=1";
$proto79["m_strOrderBy"] = "";
	
		;
			$proto79["cipherer"] = null;
$proto81=array();
$proto81["m_sql"] = "outlet_code=1";
$proto81["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "outlet_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

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

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

$proto79["m_having"] = $obj;
$proto79["m_fieldlist"] = array();
						$proto85=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

$proto85["m_sql"] = "`bar_code`";
$proto85["m_srcTableName"] = "stock_balance";
$proto85["m_expr"]=$obj;
$proto85["m_alias"] = "kk2";
$obj = new SQLFieldListItem($proto85);

$proto79["m_fieldlist"][]=$obj;
						$proto87=array();
			$proto88=array();
$proto88["m_functiontype"] = "SQLF_SUM";
$proto88["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "quntity",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto87["m_sql"] = "SUM(`quntity`)";
$proto87["m_srcTableName"] = "stock_balance";
$proto87["m_expr"]=$obj;
$proto87["m_alias"] = "st2";
$obj = new SQLFieldListItem($proto87);

$proto79["m_fieldlist"][]=$obj;
$proto79["m_fromlist"] = array();
												$proto90=array();
$proto90["m_link"] = "SQLL_MAIN";
			$proto91=array();
$proto91["m_strName"] = "sales_details";
$proto91["m_srcTableName"] = "stock_balance";
$proto91["m_columns"] = array();
$proto91["m_columns"][] = "id";
$proto91["m_columns"][] = "bar_code";
$proto91["m_columns"][] = "product";
$proto91["m_columns"][] = "quntity";
$proto91["m_columns"][] = "price";
$proto91["m_columns"][] = "m_id";
$proto91["m_columns"][] = "sub_total";
$proto91["m_columns"][] = "user";
$proto91["m_columns"][] = "discount";
$proto91["m_columns"][] = "tax";
$proto91["m_columns"][] = "newp";
$proto91["m_columns"][] = "stk_tra";
$proto91["m_columns"][] = "unit";
$proto91["m_columns"][] = "stk_tra_status";
$proto91["m_columns"][] = "package_details";
$proto91["m_columns"][] = "date_time";
$proto91["m_columns"][] = "outlet_code";
$obj = new SQLTable($proto91);

$proto90["m_table"] = $obj;
$proto90["m_sql"] = "`sales_details`";
$proto90["m_alias"] = "";
$proto90["m_srcTableName"] = "stock_balance";
$proto92=array();
$proto92["m_sql"] = "";
$proto92["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto79["m_fromlist"][]=$obj;
$proto79["m_groupby"] = array();
												$proto94=array();
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto79["m_groupby"][]=$obj;
$proto79["m_orderby"] = array();
$proto79["m_srcTableName"]="stock_balance";		
$obj = new SQLQuery($proto79);

$proto78["m_table"] = $obj;
$proto78["m_sql"] = "LEFT JOIN ( SELECT `bar_code`as kk2 , SUM(`quntity`) AS st2 FROM `sales_details`   WHERE outlet_code=1 GROUP BY bar_code) AS pur2 ON product.bar_code = pur2.kk2";
$proto78["m_alias"] = "pur2";
$proto78["m_srcTableName"] = "stock_balance";
$proto96=array();
$proto96["m_sql"] = "product.bar_code = pur2.kk2";
$proto96["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto96["m_column"]=$obj;
$proto96["m_contained"] = array();
$proto96["m_strCase"] = "= pur2.kk2";
$proto96["m_havingmode"] = false;
$proto96["m_inBrackets"] = false;
$proto96["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto96);

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

$proto0["m_fromlist"][]=$obj;
												$proto98=array();
$proto98["m_link"] = "SQLL_LEFTJOIN";
			$proto99=array();
$proto99["m_strHead"] = " SELECT";
$proto99["m_strFieldList"] = "`bar_code`as kkk3 , SUM(`gross`) AS st11";
$proto99["m_strFrom"] = "FROM `purchasing_details`";
$proto99["m_strWhere"] = "outlet_code=2";
$proto99["m_strOrderBy"] = "";
	
		;
			$proto99["cipherer"] = null;
$proto101=array();
$proto101["m_sql"] = "outlet_code=2";
$proto101["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "outlet_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

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

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

$proto99["m_having"] = $obj;
$proto99["m_fieldlist"] = array();
						$proto105=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

$proto105["m_sql"] = "`bar_code`";
$proto105["m_srcTableName"] = "stock_balance";
$proto105["m_expr"]=$obj;
$proto105["m_alias"] = "kkk3";
$obj = new SQLFieldListItem($proto105);

$proto99["m_fieldlist"][]=$obj;
						$proto107=array();
			$proto108=array();
$proto108["m_functiontype"] = "SQLF_SUM";
$proto108["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "gross",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto107["m_sql"] = "SUM(`gross`)";
$proto107["m_srcTableName"] = "stock_balance";
$proto107["m_expr"]=$obj;
$proto107["m_alias"] = "st11";
$obj = new SQLFieldListItem($proto107);

$proto99["m_fieldlist"][]=$obj;
$proto99["m_fromlist"] = array();
												$proto110=array();
$proto110["m_link"] = "SQLL_MAIN";
			$proto111=array();
$proto111["m_strName"] = "purchasing_details";
$proto111["m_srcTableName"] = "stock_balance";
$proto111["m_columns"] = array();
$proto111["m_columns"][] = "id";
$proto111["m_columns"][] = "pur_id";
$proto111["m_columns"][] = "bar_code";
$proto111["m_columns"][] = "unit";
$proto111["m_columns"][] = "gross";
$proto111["m_columns"][] = "price";
$proto111["m_columns"][] = "tar";
$proto111["m_columns"][] = "net";
$proto111["m_columns"][] = "sub_total";
$proto111["m_columns"][] = "stock_rece_code";
$proto111["m_columns"][] = "stock_send_code";
$proto111["m_columns"][] = "product";
$proto111["m_columns"][] = "details";
$proto111["m_columns"][] = "package_details";
$proto111["m_columns"][] = "cstatus";
$proto111["m_columns"][] = "outlet_code";
$proto111["m_columns"][] = "user";
$obj = new SQLTable($proto111);

$proto110["m_table"] = $obj;
$proto110["m_sql"] = "`purchasing_details`";
$proto110["m_alias"] = "";
$proto110["m_srcTableName"] = "stock_balance";
$proto112=array();
$proto112["m_sql"] = "";
$proto112["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto99["m_fromlist"][]=$obj;
$proto99["m_groupby"] = array();
												$proto114=array();
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto99["m_groupby"][]=$obj;
$proto99["m_orderby"] = array();
$proto99["m_srcTableName"]="stock_balance";		
$obj = new SQLQuery($proto99);

$proto98["m_table"] = $obj;
$proto98["m_sql"] = "LEFT JOIN ( SELECT `bar_code`as kkk3 , SUM(`gross`) AS st11 FROM `purchasing_details`   WHERE outlet_code=2 GROUP BY bar_code) AS pur11 ON product.bar_code = pur11.kkk3";
$proto98["m_alias"] = "pur11";
$proto98["m_srcTableName"] = "stock_balance";
$proto116=array();
$proto116["m_sql"] = "product.bar_code = pur11.kkk3";
$proto116["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto116["m_column"]=$obj;
$proto116["m_contained"] = array();
$proto116["m_strCase"] = "= pur11.kkk3";
$proto116["m_havingmode"] = false;
$proto116["m_inBrackets"] = false;
$proto116["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto116);

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

$proto0["m_fromlist"][]=$obj;
												$proto118=array();
$proto118["m_link"] = "SQLL_LEFTJOIN";
			$proto119=array();
$proto119["m_strHead"] = " SELECT";
$proto119["m_strFieldList"] = "`bar_code`as kk23 , SUM(`quntity`) AS st21";
$proto119["m_strFrom"] = "FROM `sales_details`";
$proto119["m_strWhere"] = "outlet_code=2";
$proto119["m_strOrderBy"] = "";
	
		;
			$proto119["cipherer"] = null;
$proto121=array();
$proto121["m_sql"] = "outlet_code=2";
$proto121["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "outlet_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

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

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

$proto119["m_having"] = $obj;
$proto119["m_fieldlist"] = array();
						$proto125=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

$proto125["m_sql"] = "`bar_code`";
$proto125["m_srcTableName"] = "stock_balance";
$proto125["m_expr"]=$obj;
$proto125["m_alias"] = "kk23";
$obj = new SQLFieldListItem($proto125);

$proto119["m_fieldlist"][]=$obj;
						$proto127=array();
			$proto128=array();
$proto128["m_functiontype"] = "SQLF_SUM";
$proto128["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "quntity",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto127["m_sql"] = "SUM(`quntity`)";
$proto127["m_srcTableName"] = "stock_balance";
$proto127["m_expr"]=$obj;
$proto127["m_alias"] = "st21";
$obj = new SQLFieldListItem($proto127);

$proto119["m_fieldlist"][]=$obj;
$proto119["m_fromlist"] = array();
												$proto130=array();
$proto130["m_link"] = "SQLL_MAIN";
			$proto131=array();
$proto131["m_strName"] = "sales_details";
$proto131["m_srcTableName"] = "stock_balance";
$proto131["m_columns"] = array();
$proto131["m_columns"][] = "id";
$proto131["m_columns"][] = "bar_code";
$proto131["m_columns"][] = "product";
$proto131["m_columns"][] = "quntity";
$proto131["m_columns"][] = "price";
$proto131["m_columns"][] = "m_id";
$proto131["m_columns"][] = "sub_total";
$proto131["m_columns"][] = "user";
$proto131["m_columns"][] = "discount";
$proto131["m_columns"][] = "tax";
$proto131["m_columns"][] = "newp";
$proto131["m_columns"][] = "stk_tra";
$proto131["m_columns"][] = "unit";
$proto131["m_columns"][] = "stk_tra_status";
$proto131["m_columns"][] = "package_details";
$proto131["m_columns"][] = "date_time";
$proto131["m_columns"][] = "outlet_code";
$obj = new SQLTable($proto131);

$proto130["m_table"] = $obj;
$proto130["m_sql"] = "`sales_details`";
$proto130["m_alias"] = "";
$proto130["m_srcTableName"] = "stock_balance";
$proto132=array();
$proto132["m_sql"] = "";
$proto132["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto119["m_fromlist"][]=$obj;
$proto119["m_groupby"] = array();
												$proto134=array();
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto119["m_groupby"][]=$obj;
$proto119["m_orderby"] = array();
$proto119["m_srcTableName"]="stock_balance";		
$obj = new SQLQuery($proto119);

$proto118["m_table"] = $obj;
$proto118["m_sql"] = "LEFT JOIN ( SELECT `bar_code`as kk23 , SUM(`quntity`) AS st21 FROM `sales_details`   WHERE outlet_code=2 GROUP BY bar_code) AS pur21 ON product.bar_code = pur21.kk23";
$proto118["m_alias"] = "pur21";
$proto118["m_srcTableName"] = "stock_balance";
$proto136=array();
$proto136["m_sql"] = "product.bar_code = pur21.kk23";
$proto136["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto136["m_column"]=$obj;
$proto136["m_contained"] = array();
$proto136["m_strCase"] = "= pur21.kk23";
$proto136["m_havingmode"] = false;
$proto136["m_inBrackets"] = false;
$proto136["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto136);

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

$proto0["m_fromlist"][]=$obj;
												$proto138=array();
$proto138["m_link"] = "SQLL_LEFTJOIN";
			$proto139=array();
$proto139["m_strHead"] = " SELECT";
$proto139["m_strFieldList"] = "`bar_code`as kkk4 , SUM(`gross`) AS st12";
$proto139["m_strFrom"] = "FROM `purchasing_details`";
$proto139["m_strWhere"] = "outlet_code=3";
$proto139["m_strOrderBy"] = "";
	
		;
			$proto139["cipherer"] = null;
$proto141=array();
$proto141["m_sql"] = "outlet_code=3";
$proto141["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "outlet_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

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

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

$proto139["m_having"] = $obj;
$proto139["m_fieldlist"] = array();
						$proto145=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

$proto145["m_sql"] = "`bar_code`";
$proto145["m_srcTableName"] = "stock_balance";
$proto145["m_expr"]=$obj;
$proto145["m_alias"] = "kkk4";
$obj = new SQLFieldListItem($proto145);

$proto139["m_fieldlist"][]=$obj;
						$proto147=array();
			$proto148=array();
$proto148["m_functiontype"] = "SQLF_SUM";
$proto148["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "gross",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto147["m_sql"] = "SUM(`gross`)";
$proto147["m_srcTableName"] = "stock_balance";
$proto147["m_expr"]=$obj;
$proto147["m_alias"] = "st12";
$obj = new SQLFieldListItem($proto147);

$proto139["m_fieldlist"][]=$obj;
$proto139["m_fromlist"] = array();
												$proto150=array();
$proto150["m_link"] = "SQLL_MAIN";
			$proto151=array();
$proto151["m_strName"] = "purchasing_details";
$proto151["m_srcTableName"] = "stock_balance";
$proto151["m_columns"] = array();
$proto151["m_columns"][] = "id";
$proto151["m_columns"][] = "pur_id";
$proto151["m_columns"][] = "bar_code";
$proto151["m_columns"][] = "unit";
$proto151["m_columns"][] = "gross";
$proto151["m_columns"][] = "price";
$proto151["m_columns"][] = "tar";
$proto151["m_columns"][] = "net";
$proto151["m_columns"][] = "sub_total";
$proto151["m_columns"][] = "stock_rece_code";
$proto151["m_columns"][] = "stock_send_code";
$proto151["m_columns"][] = "product";
$proto151["m_columns"][] = "details";
$proto151["m_columns"][] = "package_details";
$proto151["m_columns"][] = "cstatus";
$proto151["m_columns"][] = "outlet_code";
$proto151["m_columns"][] = "user";
$obj = new SQLTable($proto151);

$proto150["m_table"] = $obj;
$proto150["m_sql"] = "`purchasing_details`";
$proto150["m_alias"] = "";
$proto150["m_srcTableName"] = "stock_balance";
$proto152=array();
$proto152["m_sql"] = "";
$proto152["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto139["m_fromlist"][]=$obj;
$proto139["m_groupby"] = array();
												$proto154=array();
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto139["m_groupby"][]=$obj;
$proto139["m_orderby"] = array();
$proto139["m_srcTableName"]="stock_balance";		
$obj = new SQLQuery($proto139);

$proto138["m_table"] = $obj;
$proto138["m_sql"] = "LEFT JOIN ( SELECT `bar_code`as kkk4 , SUM(`gross`) AS st12 FROM `purchasing_details`   WHERE outlet_code=3 GROUP BY bar_code) AS pur12 ON product.bar_code = pur12.kkk4";
$proto138["m_alias"] = "pur12";
$proto138["m_srcTableName"] = "stock_balance";
$proto156=array();
$proto156["m_sql"] = "product.bar_code = pur12.kkk4";
$proto156["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto156["m_column"]=$obj;
$proto156["m_contained"] = array();
$proto156["m_strCase"] = "= pur12.kkk4";
$proto156["m_havingmode"] = false;
$proto156["m_inBrackets"] = false;
$proto156["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto156);

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

$proto0["m_fromlist"][]=$obj;
												$proto158=array();
$proto158["m_link"] = "SQLL_LEFTJOIN";
			$proto159=array();
$proto159["m_strHead"] = " SELECT";
$proto159["m_strFieldList"] = "`bar_code`as kk24 , SUM(`quntity`) AS st22";
$proto159["m_strFrom"] = "FROM `sales_details`";
$proto159["m_strWhere"] = "outlet_code=3";
$proto159["m_strOrderBy"] = "";
	
		;
			$proto159["cipherer"] = null;
$proto161=array();
$proto161["m_sql"] = "outlet_code=3";
$proto161["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "outlet_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

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

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

$proto159["m_having"] = $obj;
$proto159["m_fieldlist"] = array();
						$proto165=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

$proto165["m_sql"] = "`bar_code`";
$proto165["m_srcTableName"] = "stock_balance";
$proto165["m_expr"]=$obj;
$proto165["m_alias"] = "kk24";
$obj = new SQLFieldListItem($proto165);

$proto159["m_fieldlist"][]=$obj;
						$proto167=array();
			$proto168=array();
$proto168["m_functiontype"] = "SQLF_SUM";
$proto168["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "quntity",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto167["m_sql"] = "SUM(`quntity`)";
$proto167["m_srcTableName"] = "stock_balance";
$proto167["m_expr"]=$obj;
$proto167["m_alias"] = "st22";
$obj = new SQLFieldListItem($proto167);

$proto159["m_fieldlist"][]=$obj;
$proto159["m_fromlist"] = array();
												$proto170=array();
$proto170["m_link"] = "SQLL_MAIN";
			$proto171=array();
$proto171["m_strName"] = "sales_details";
$proto171["m_srcTableName"] = "stock_balance";
$proto171["m_columns"] = array();
$proto171["m_columns"][] = "id";
$proto171["m_columns"][] = "bar_code";
$proto171["m_columns"][] = "product";
$proto171["m_columns"][] = "quntity";
$proto171["m_columns"][] = "price";
$proto171["m_columns"][] = "m_id";
$proto171["m_columns"][] = "sub_total";
$proto171["m_columns"][] = "user";
$proto171["m_columns"][] = "discount";
$proto171["m_columns"][] = "tax";
$proto171["m_columns"][] = "newp";
$proto171["m_columns"][] = "stk_tra";
$proto171["m_columns"][] = "unit";
$proto171["m_columns"][] = "stk_tra_status";
$proto171["m_columns"][] = "package_details";
$proto171["m_columns"][] = "date_time";
$proto171["m_columns"][] = "outlet_code";
$obj = new SQLTable($proto171);

$proto170["m_table"] = $obj;
$proto170["m_sql"] = "`sales_details`";
$proto170["m_alias"] = "";
$proto170["m_srcTableName"] = "stock_balance";
$proto172=array();
$proto172["m_sql"] = "";
$proto172["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto159["m_fromlist"][]=$obj;
$proto159["m_groupby"] = array();
												$proto174=array();
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto159["m_groupby"][]=$obj;
$proto159["m_orderby"] = array();
$proto159["m_srcTableName"]="stock_balance";		
$obj = new SQLQuery($proto159);

$proto158["m_table"] = $obj;
$proto158["m_sql"] = "LEFT JOIN ( SELECT `bar_code`as kk24 , SUM(`quntity`) AS st22 FROM `sales_details`   WHERE outlet_code=3 GROUP BY bar_code) AS pur22 ON product.bar_code = pur22.kk24";
$proto158["m_alias"] = "pur22";
$proto158["m_srcTableName"] = "stock_balance";
$proto176=array();
$proto176["m_sql"] = "product.bar_code = pur22.kk24";
$proto176["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto176["m_column"]=$obj;
$proto176["m_contained"] = array();
$proto176["m_strCase"] = "= pur22.kk24";
$proto176["m_havingmode"] = false;
$proto176["m_inBrackets"] = false;
$proto176["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto176);

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

$proto0["m_fromlist"][]=$obj;
												$proto178=array();
$proto178["m_link"] = "SQLL_LEFTJOIN";
			$proto179=array();
$proto179["m_strHead"] = " SELECT";
$proto179["m_strFieldList"] = "`bar_code`as kkk5 , SUM(`gross`) AS st13";
$proto179["m_strFrom"] = "FROM `purchasing_details`";
$proto179["m_strWhere"] = "1";
$proto179["m_strOrderBy"] = "";
	
		;
			$proto179["cipherer"] = null;
$proto181=array();
$proto181["m_sql"] = "1";
$proto181["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLNonParsed(array(
	"m_sql" => "1"
));

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

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

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

$proto179["m_having"] = $obj;
$proto179["m_fieldlist"] = array();
						$proto185=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

$proto185["m_sql"] = "`bar_code`";
$proto185["m_srcTableName"] = "stock_balance";
$proto185["m_expr"]=$obj;
$proto185["m_alias"] = "kkk5";
$obj = new SQLFieldListItem($proto185);

$proto179["m_fieldlist"][]=$obj;
						$proto187=array();
			$proto188=array();
$proto188["m_functiontype"] = "SQLF_SUM";
$proto188["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "gross",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto187["m_sql"] = "SUM(`gross`)";
$proto187["m_srcTableName"] = "stock_balance";
$proto187["m_expr"]=$obj;
$proto187["m_alias"] = "st13";
$obj = new SQLFieldListItem($proto187);

$proto179["m_fieldlist"][]=$obj;
$proto179["m_fromlist"] = array();
												$proto190=array();
$proto190["m_link"] = "SQLL_MAIN";
			$proto191=array();
$proto191["m_strName"] = "purchasing_details";
$proto191["m_srcTableName"] = "stock_balance";
$proto191["m_columns"] = array();
$proto191["m_columns"][] = "id";
$proto191["m_columns"][] = "pur_id";
$proto191["m_columns"][] = "bar_code";
$proto191["m_columns"][] = "unit";
$proto191["m_columns"][] = "gross";
$proto191["m_columns"][] = "price";
$proto191["m_columns"][] = "tar";
$proto191["m_columns"][] = "net";
$proto191["m_columns"][] = "sub_total";
$proto191["m_columns"][] = "stock_rece_code";
$proto191["m_columns"][] = "stock_send_code";
$proto191["m_columns"][] = "product";
$proto191["m_columns"][] = "details";
$proto191["m_columns"][] = "package_details";
$proto191["m_columns"][] = "cstatus";
$proto191["m_columns"][] = "outlet_code";
$proto191["m_columns"][] = "user";
$obj = new SQLTable($proto191);

$proto190["m_table"] = $obj;
$proto190["m_sql"] = "`purchasing_details`";
$proto190["m_alias"] = "";
$proto190["m_srcTableName"] = "stock_balance";
$proto192=array();
$proto192["m_sql"] = "";
$proto192["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto179["m_fromlist"][]=$obj;
$proto179["m_groupby"] = array();
												$proto194=array();
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "purchasing_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto179["m_groupby"][]=$obj;
$proto179["m_orderby"] = array();
$proto179["m_srcTableName"]="stock_balance";		
$obj = new SQLQuery($proto179);

$proto178["m_table"] = $obj;
$proto178["m_sql"] = "LEFT JOIN ( SELECT `bar_code`as kkk5 , SUM(`gross`) AS st13 FROM `purchasing_details`   WHERE 1 GROUP BY bar_code) AS pur13 ON product.bar_code = pur13.kkk5";
$proto178["m_alias"] = "pur13";
$proto178["m_srcTableName"] = "stock_balance";
$proto196=array();
$proto196["m_sql"] = "product.bar_code = pur13.kkk5";
$proto196["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto196["m_column"]=$obj;
$proto196["m_contained"] = array();
$proto196["m_strCase"] = "= pur13.kkk5";
$proto196["m_havingmode"] = false;
$proto196["m_inBrackets"] = false;
$proto196["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto196);

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

$proto0["m_fromlist"][]=$obj;
												$proto198=array();
$proto198["m_link"] = "SQLL_LEFTJOIN";
			$proto199=array();
$proto199["m_strHead"] = " SELECT";
$proto199["m_strFieldList"] = "`bar_code`as kk25 , SUM(`quntity`) AS st23";
$proto199["m_strFrom"] = "FROM `sales_details`";
$proto199["m_strWhere"] = "1";
$proto199["m_strOrderBy"] = "";
	
		;
			$proto199["cipherer"] = null;
$proto201=array();
$proto201["m_sql"] = "1";
$proto201["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLNonParsed(array(
	"m_sql" => "1"
));

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

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

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

$proto199["m_having"] = $obj;
$proto199["m_fieldlist"] = array();
						$proto205=array();
			$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

$proto205["m_sql"] = "`bar_code`";
$proto205["m_srcTableName"] = "stock_balance";
$proto205["m_expr"]=$obj;
$proto205["m_alias"] = "kk25";
$obj = new SQLFieldListItem($proto205);

$proto199["m_fieldlist"][]=$obj;
						$proto207=array();
			$proto208=array();
$proto208["m_functiontype"] = "SQLF_SUM";
$proto208["m_arguments"] = array();
						$obj = new SQLField(array(
	"m_strName" => "quntity",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto207["m_sql"] = "SUM(`quntity`)";
$proto207["m_srcTableName"] = "stock_balance";
$proto207["m_expr"]=$obj;
$proto207["m_alias"] = "st23";
$obj = new SQLFieldListItem($proto207);

$proto199["m_fieldlist"][]=$obj;
$proto199["m_fromlist"] = array();
												$proto210=array();
$proto210["m_link"] = "SQLL_MAIN";
			$proto211=array();
$proto211["m_strName"] = "sales_details";
$proto211["m_srcTableName"] = "stock_balance";
$proto211["m_columns"] = array();
$proto211["m_columns"][] = "id";
$proto211["m_columns"][] = "bar_code";
$proto211["m_columns"][] = "product";
$proto211["m_columns"][] = "quntity";
$proto211["m_columns"][] = "price";
$proto211["m_columns"][] = "m_id";
$proto211["m_columns"][] = "sub_total";
$proto211["m_columns"][] = "user";
$proto211["m_columns"][] = "discount";
$proto211["m_columns"][] = "tax";
$proto211["m_columns"][] = "newp";
$proto211["m_columns"][] = "stk_tra";
$proto211["m_columns"][] = "unit";
$proto211["m_columns"][] = "stk_tra_status";
$proto211["m_columns"][] = "package_details";
$proto211["m_columns"][] = "date_time";
$proto211["m_columns"][] = "outlet_code";
$obj = new SQLTable($proto211);

$proto210["m_table"] = $obj;
$proto210["m_sql"] = "`sales_details`";
$proto210["m_alias"] = "";
$proto210["m_srcTableName"] = "stock_balance";
$proto212=array();
$proto212["m_sql"] = "";
$proto212["m_uniontype"] = "SQLL_UNKNOWN";
	$obj = new SQLNonParsed(array(
	"m_sql" => ""
));

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

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

$proto199["m_fromlist"][]=$obj;
$proto199["m_groupby"] = array();
												$proto214=array();
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "sales_details",
	"m_srcTableName" => "stock_balance"
));

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

$proto199["m_groupby"][]=$obj;
$proto199["m_orderby"] = array();
$proto199["m_srcTableName"]="stock_balance";		
$obj = new SQLQuery($proto199);

$proto198["m_table"] = $obj;
$proto198["m_sql"] = "LEFT JOIN ( SELECT `bar_code`as kk25 , SUM(`quntity`) AS st23 FROM `sales_details`   WHERE 1 GROUP BY bar_code) AS pur23 ON product.bar_code = pur23.kk25";
$proto198["m_alias"] = "pur23";
$proto198["m_srcTableName"] = "stock_balance";
$proto216=array();
$proto216["m_sql"] = "product.bar_code = pur23.kk25";
$proto216["m_uniontype"] = "SQLL_UNKNOWN";
						$obj = new SQLField(array(
	"m_strName" => "bar_code",
	"m_strTable" => "product",
	"m_srcTableName" => "stock_balance"
));

$proto216["m_column"]=$obj;
$proto216["m_contained"] = array();
$proto216["m_strCase"] = "= pur23.kk25";
$proto216["m_havingmode"] = false;
$proto216["m_inBrackets"] = false;
$proto216["m_useAlias"] = false;
$obj = new SQLLogicalExpr($proto216);

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

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

	return $obj;
}
$queryData_stock_balance = createSqlQuery_stock_balance();


	
		;

																

$tdatastock_balance[".sqlquery"] = $queryData_stock_balance;



include_once(getabspath("include/stock_balance_events.php"));
$tableEvents["stock_balance"] = new eventclass_stock_balance;
$tdatastock_balance[".hasEvents"] = true;

?>