	function FORM_LOAD()
	{
		POS_SALE_LIST_DGV = DataGridView("POS_SALE_LIST_DGV");
		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_CAT_STOCKFLOW_ID_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_CAT_STOCKFLOW_ID_CMB");
			// JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_CMB", FLAG_BIGINT_NULL,"Any Branch");
			JSCUS_SQL._CATEGORY._STOCKFLOW.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					if(IS_SUCCESS === false)
					{
						console.error("CONNECTION ERROR: \n" + RESPONSE_STRING);
						return;
					}
					
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						console.error("REQUEST ERROR: \n" + RESPONSE_STRING);
						return;
					}
					
					if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
					{
						POS_SALE_LIST_DGV.ROW.CLEAR();
						JSOC_ELEMENT.VAR_VALUE("SALES_BY_PRODUCT_TOTAL_SALES", "0.00");
						return;
					}		
					
					HTTP_STOCKFLOW_JSON = JSON_OBJECT;		
				},
				"SEARCH_CAT_STOCKFLOW_ID_CMB",
				true,
				2
			);
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_ACC_GROUP_ID_CMB");
			// JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_CMB", FLAG_BIGINT_NULL,"Any Branch");
			JSCUS_SQL._ACCOUNT._GROUP.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function()
				{
					HTTP_SEARCH_PRODUCTS();
				},
				"SEARCH_ACC_GROUP_ID_CMB",
				true,
				2
			);
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_ACCOUNT_ID_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_ACC_ACCOUNT_ID_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_ACC_ACCOUNT_ID_CMB", FLAG_BIGINT_NULL.toString(), "Any User");
			JSCUS_SQL._ACCOUNT._MEMBER.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(){},
				"SEARCH_ACC_ACCOUNT_ID_CMB",
				true,
				2
			);
		}		
		
	}


	function HTTP_SEARCH_PRODUCTS()
	{
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._EOD_PRODUCT.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_EODPROD_ACC_GROUP_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_CMB")));
		}

		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_FROM_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_DATE_FROM_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET
			(
				GET_MAP_ARRAY, 'PARAM_REC_EODPROD_DATE_REPORT_FROM', 
				JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 00:00:00.000000"
			);
			JSVC_MAP_ARRAY.VAR_SET
			(
				GET_MAP_ARRAY, 'PARAM_REC_EODPROD_DATE_REPORT_TO', 
				JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 23:59:59.999999"
			);
		}
		
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_FIELD', 'REC_EODPROD_CAT_PRODUCT_DESCRIPTION');
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_TYPE', 'ASC');	
		
		JSCUS_SQL._RECORD._EOD_PRODUCT.CUS_GET
		(
			GET_MAP_ARRAY,
			HTTP_SEARCH_CALLBACK_PRODUCTS,
			true
		); 		
	}
		
		
	function HTTP_SEARCH_CALLBACK_PRODUCTS(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();
		
		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			console.error("CONNECTION ERROR: \n" + RESPONSE_STRING);
			return;
		}
		
		// Validate JSON Response
		// _______________________________________________________________________
		var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
		if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
		{
			console.error("REQUEST ERROR: \n" + RESPONSE_STRING);
			return;
		}
		
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			POS_SALE_LIST_DGV.ROW.CLEAR();
			return;
		}

		// Populate DGV
		// _______________________________________________________________________
		POS_SALE_LIST_DGV.POPULATE_FROM_QUERY
		(
		 		JSON_OBJECT, 
		 		'',
		 		false,
		 		false,
		 		1,
		 		[2, 1]
		);
	}	
		
		
	function HTTP_SEARCH_SALES_BEGIN()
	{
		var DGV_COUNT = POS_SALE_LIST_DGV.ROW.COUNT();
		var DGV_INDEX = 0;
		
		while(DGV_COUNT > DGV_INDEX)
		{
			if(POS_SALE_LIST_DGV.CELL.VALUE("CAT_PRODUCT_CHK", DGV_INDEX) == true)
			{
				PROCESSING_DGV_INDEX = DGV_INDEX;
				HTTP_SEARCH_SALES(POS_SALE_LIST_DGV.CELL.VALUE("REC_EODPROD_CAT_PRODUCT_ID", DGV_INDEX), 0);
				POS_SALE_LIST_DGV.CELL.VALUE("CAT_PRODUCT_CHK", DGV_INDEX, false);
				return true;
			}
			DGV_INDEX ++;
		}
		
		return false;
	}	
	
		
	function HTTP_SEARCH_SALES(PRODUCT_ID, SKIP_INDEX)
	{
		GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_SALE_LIST.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();	
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_ACC_GROUP_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_CMB")));
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_ACCOUNT_ID_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_ACC_ACCOUNT_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_ACCOUNT_ID_CMB")));
		}
		
		
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_LIST_CAT_PRODUCT_ID', PRODUCT_ID);
		
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_FROM_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_DATE_FROM_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET
			(
				GET_MAP_ARRAY, 'PARAM_REC_POSSALE_DATE_TRANSACT_FROM', 
				JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 00:00:00.000000"
			);
			JSVC_MAP_ARRAY.VAR_SET
			(
				GET_MAP_ARRAY, 'PARAM_REC_POSSALE_DATE_TRANSACT_TO', 
				JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 23:59:59.999999"
			);
		}
		
		// ~~~~~
		
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_FIELD', 'REC_POSSALE_DATE_TRANSACT');
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_TYPE', 'ASC');	
		
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_SKIP', 0);
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_LIMIT', 1000);	

		// ~~~~~

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_SALE_LIST.CUS_GET_ALL
		(
			GET_MAP_ARRAY,
			function(IS_SUCCESS, RESPONSE_STRING)
			{
				HTTP_SEARCH_CALLBACK_SALES(PRODUCT_ID, IS_SUCCESS, RESPONSE_STRING);
			},
			true
		);
	}


	function HTTP_SEARCH_CALLBACK_SALES(PRODUCT_ID, IS_SUCCESS, RESPONSE_STRING)
	{
		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			console.error("CONNECTION ERROR: \n" + RESPONSE_STRING);
			CUS_SEND_DIALOG_TRY_DISMISS();
			return;
		}
		
		// Validate JSON Response
		// _______________________________________________________________________
		var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
		if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
		{
			console.error("REQUEST ERROR: \n" + RESPONSE_STRING);
			CUS_SEND_DIALOG_TRY_DISMISS();
			return;
		}
		
		// Clear table
		// _______________________________________________________________________
		var HH_INDEX = 7;
		while(23 >= HH_INDEX)
		{
			POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_STR.VAR_FIX(HH_INDEX.toString(), null, 2, 2, '0') + "_SOLD", PROCESSING_DGV_INDEX, 0);
			POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_STR.VAR_FIX(HH_INDEX.toString(), null, 2, 2, '0') + "_REM", PROCESSING_DGV_INDEX, 0);			
			HH_INDEX ++;
		}
	
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{		
			HTTP_SEARCH_STOCKCARD(PRODUCT_ID, 0);	
			POS_SALE_LIST_DGV.CELL.VALUE("REC_EODPROD_TRANSACTION_COUNT", PROCESSING_DGV_INDEX, 0);
			return;
		}
			
			
		// Show sold stock per hour
		// _______________________________________________________________________
		var ROW_SIZE = JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT"));
		var ROW_INDEX = 1;
		var CURRENT_HOUR = JSVC_DATE.VAR_TO_DATE(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_DATE_TRANSACT", ROW_INDEX));
		var END_HOUR = JSVC_DATE.VAR_TO_DATE(JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 23:59:59.999999");
		
		var FROM_HOUR = JSVC_DATE.VAR_TO_DATE(JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 07:00:00.000000");
		var TO_HOUR = JSVC_DATE.VAR_TO_DATE(JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 07:59:59.999999");
		POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_SOLD", PROCESSING_DGV_INDEX, 0);
		POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_REM", PROCESSING_DGV_INDEX, 0);
				
		var PRODUCT_TRANSACTION_ID = [];
										
		while(ROW_SIZE >= ROW_INDEX)
		{
			// Get Current Hour
			CURRENT_HOUR = JSVC_DATE.VAR_TO_DATE(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_DATE_TRANSACT", ROW_INDEX));
			
			// Push transaction ID if unique
			if
			(
				JSVC_ARR.VAR_CONTAINS
				(
					PRODUCT_TRANSACTION_ID, 
					JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_ID", ROW_INDEX)
				) == false
			)
			{
				PRODUCT_TRANSACTION_ID.push(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_ID", ROW_INDEX));
			}
			
			// Ignore all transaction before starting hour
			if(CURRENT_HOUR < FROM_HOUR)
			{
				ROW_INDEX ++;
				continue;
			}
			
			// Reached End Hour
			if(CURRENT_HOUR > END_HOUR)
			{
				break;
			}
			
			// Start Next Hour
			if(CURRENT_HOUR > TO_HOUR)
			{
				FROM_HOUR = JSVC_DATE.VAR_ADD("HH", 1, FROM_HOUR);
				TO_HOUR = JSVC_DATE.VAR_ADD("HH", 1, TO_HOUR);	
				POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_SOLD", PROCESSING_DGV_INDEX, 0);
				POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_REM", PROCESSING_DGV_INDEX, 0);
				
				// Skip Hour if transaction is larger than the current hour
				if(CURRENT_HOUR >= TO_HOUR)
				{
					continue;
				}
			}
			
			// Populate Count
			POS_SALE_LIST_DGV.CELL.VALUE
			(
				"REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_SOLD", PROCESSING_DGV_INDEX,
				JSVC_NUM.VAR_NVALL
				(
					POS_SALE_LIST_DGV.CELL.VALUE
					(
						"REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_SOLD", 
						PROCESSING_DGV_INDEX
					)
				) +
				JSVC_NUM.VAR_NVALL
				(
					JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_QUANTITY", ROW_INDEX)
				)
			);
			ROW_INDEX ++;
		}
		
		while(END_HOUR > TO_HOUR)
		{
			TO_HOUR = JSVC_DATE.VAR_ADD("HH", 1, TO_HOUR);	
			POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_DATE.VAR_FORMAT(TO_HOUR, "HH") + "_SOLD", PROCESSING_DGV_INDEX, 0);
			POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_DATE.VAR_FORMAT(TO_HOUR, "HH") + "_REM", PROCESSING_DGV_INDEX, 0);			
		}
	
		POS_SALE_LIST_DGV.CELL.VALUE("REC_EODPROD_TRANSACTION_COUNT", PROCESSING_DGV_INDEX, PRODUCT_TRANSACTION_ID.length);
		HTTP_SEARCH_STOCKCARD(PRODUCT_ID, 0);
	}
	
	
	function HTTP_SEARCH_STOCKCARD(PRODUCT_ID, SKIP_INDEX)
	{
		GET_MAP_ARRAY = JSCUS_SQL._RECORD._STOCK_CARD.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();	
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_STOCKCARD_ACC_GROUP_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_CMB")));
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_STOCKCARD_CAT_PRODUCT_ID', PRODUCT_ID);
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_STOCKCARD_CAT_PRODUCT_ID', PRODUCT_ID);
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_FROM_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_DATE_FROM_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET
			(
				GET_MAP_ARRAY, 'PARAM_REC_STOCKCARD_DATE_TRANSACTION_FROM', 
				JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 00:00:00.000000"
			);
			JSVC_MAP_ARRAY.VAR_SET
			(
				GET_MAP_ARRAY, 'PARAM_REC_STOCKCARD_DATE_TRANSACTION_TO', 
				JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 23:59:59.999999"
			);
		}	
		
		
		JSCUS_SQL._RECORD._STOCK_CARD.CUS_GET
		(
			GET_MAP_ARRAY,
			function(IS_SUCCESS, RESPONSE_STRING)
			{
				HTTP_SEARCH_CALLBACK_STOCKCARD(PRODUCT_ID, IS_SUCCESS, RESPONSE_STRING);
			},
			true
		); 	
	}


	function HTTP_SEARCH_CALLBACK_STOCKCARD(PRODUCT_ID, IS_SUCCESS, RESPONSE_STRING)
	{
		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			console.error("CONNECTION ERROR: \n" + RESPONSE_STRING);
			CUS_SEND_DIALOG_TRY_DISMISS();
			return;
		}
		
		// Validate JSON Response
		// _______________________________________________________________________
		var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
		if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
		{
			console.error("REQUEST ERROR: \n" + RESPONSE_STRING);
			CUS_SEND_DIALOG_TRY_DISMISS();
			return;
		}
		
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			HTTP_COMPUTE_BALANCE();			
			return;
		}
		
		
		// Show sold stock per hour
		// _______________________________________________________________________
		var ROW_SIZE = JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT"));
		var ROW_INDEX = 1;
		var CURRENT_HOUR = JSVC_DATE.VAR_TO_DATE(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_STOCKCARD_DATE_TRANSACTION", ROW_INDEX));
		var END_HOUR = JSVC_DATE.VAR_TO_DATE(JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 23:59:59.999999");
		
		var FROM_HOUR = JSVC_DATE.VAR_TO_DATE(JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 07:00:00.000000");
		var TO_HOUR = JSVC_DATE.VAR_TO_DATE(JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_DTP"), "YYYY-MM-DD") + " 07:59:59.999999");
								
		while(ROW_SIZE >= ROW_INDEX)
		{
			// Get Current Hour
			CURRENT_HOUR = JSVC_DATE.VAR_TO_DATE(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_STOCKCARD_DATE_TRANSACTION", ROW_INDEX));
			
			// Ignore all transaction before starting hour
			if(CURRENT_HOUR < FROM_HOUR)
			{
				ROW_INDEX ++;
				continue;
			}
			
			// Reached End Hour
			if(CURRENT_HOUR > END_HOUR)
			{
				break;
			}
			
			// Start Next Hour
			if(CURRENT_HOUR > TO_HOUR)
			{
				FROM_HOUR = JSVC_DATE.VAR_ADD("HH", 1, FROM_HOUR);
				TO_HOUR = JSVC_DATE.VAR_ADD("HH", 1, TO_HOUR);	
	
				// Skip Hour if transaction is larger than the current hour
				if(CURRENT_HOUR >= TO_HOUR)
				{
					continue;
				}
			}
			
			// Populate Count
			if
			(
				JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_STOCKCARD_CAT_STOCKFLOW_ID", ROW_INDEX)) == 7 ||
				JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_STOCKCARD_CAT_STOCKFLOW_ID", ROW_INDEX)) == 12 ||
				JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_STORAGE_IS_STORE", ROW_INDEX)) != 2
			)
			{
				// Skip Merged Details
			}
			else if(JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_STOCKFLOW_IS_IN", ROW_INDEX)) == 2)
			{
				POS_SALE_LIST_DGV.CELL.VALUE
				(
					"REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_MOVE", PROCESSING_DGV_INDEX,
					JSVC_NUM.VAR_NVAL
					(
						POS_SALE_LIST_DGV.CELL.VALUE
						(
							"REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_MOVE", 
							PROCESSING_DGV_INDEX
						)
					) +
					JSVC_NUM.VAR_NVAL
					(
						JSRC_JSON.REF_READ(JSON_OBJECT, "REC_STOCKCARD_QUANTITY", ROW_INDEX)
					)
				);			
			}
			else
			{
				POS_SALE_LIST_DGV.CELL.VALUE
				(
					"REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_MOVE", PROCESSING_DGV_INDEX,
					JSVC_NUM.VAR_NVAL
					(
						POS_SALE_LIST_DGV.CELL.VALUE
						(
							"REC_TIME_" + JSVC_DATE.VAR_FORMAT(FROM_HOUR, "HH") + "_MOVE", 
							PROCESSING_DGV_INDEX
						)
					) -
					JSVC_NUM.VAR_NVAL
					(
						JSRC_JSON.REF_READ(JSON_OBJECT, "REC_STOCKCARD_QUANTITY", ROW_INDEX)
					)
				);				
			}
			ROW_INDEX ++;
		}		
		HTTP_COMPUTE_BALANCE();
	}


	function HTTP_COMPUTE_BALANCE()
	{
		var HOUR_INDEX = 7;
		
		while(23 >= HOUR_INDEX)
		{
			if(HOUR_INDEX == 7)
			{
				POS_SALE_LIST_DGV.CELL.VALUE
				(
					"REC_TIME_" + JSVC_STR.VAR_FIX((HOUR_INDEX).toString(), null, 2, 2, '0') + "_REM", PROCESSING_DGV_INDEX, 
					POS_SALE_LIST_DGV.CELL.VALUE("REC_EODPROD_BBAL_STORE", PROCESSING_DGV_INDEX)
				);	
			}
			else
			{
				POS_SALE_LIST_DGV.CELL.VALUE
				(
					"REC_TIME_" + JSVC_STR.VAR_FIX(HOUR_INDEX.toString(), null, 2, 2, '0') + "_REM", PROCESSING_DGV_INDEX, 
					JSVC_NUM.VAR_NVAL
					(
						POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_STR.VAR_FIX((HOUR_INDEX - 1).toString(), null, 2, 2, '0') + "_REM", PROCESSING_DGV_INDEX)
					) +
					JSVC_NUM.VAR_NVAL
					(
						POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_STR.VAR_FIX((HOUR_INDEX).toString(), null, 2, 2, '0') + "_MOVE", PROCESSING_DGV_INDEX)
					)
				);
				
				POS_SALE_LIST_DGV.CELL.VALUE
				(
					"REC_TIME_" + JSVC_STR.VAR_FIX(HOUR_INDEX.toString(), null, 2, 2, '0') + "_REM", PROCESSING_DGV_INDEX, 
					JSVC_NUM.VAR_NVAL
					(
						POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_STR.VAR_FIX(HOUR_INDEX.toString(), null, 2, 2, '0') + "_REM", PROCESSING_DGV_INDEX)
					) -
					JSVC_NUM.VAR_NVAL
					(
						POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_STR.VAR_FIX((HOUR_INDEX).toString(), null, 2, 2, '0') + "_SOLD", PROCESSING_DGV_INDEX)
					)
				);					
			}
			HOUR_INDEX ++;		
		}
		
		
	
		POS_SALE_LIST_DGV.CELL.VALUE
		(
			"REC_EODPROD_BBAL_STORE", PROCESSING_DGV_INDEX, 
			JSVC_NUM.VAR_CFORMAT
			(
				JSVC_NUM.VAR_NVAL
				(
					POS_SALE_LIST_DGV.CELL.VALUE("REC_EODPROD_BBAL_STORE", PROCESSING_DGV_INDEX)
				)
			)
		);	
					
		var HOUR_INDEX = 7;		
		while(23 >= HOUR_INDEX)
		{
			POS_SALE_LIST_DGV.CELL.VALUE
			(
				"REC_TIME_" + JSVC_STR.VAR_FIX(HOUR_INDEX.toString(), null, 2, 2, '0') + "_SOLD", PROCESSING_DGV_INDEX, 
				JSVC_NUM.VAR_CFORMAT
				(
					JSVC_NUM.VAR_NVAL
					(
						POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_STR.VAR_FIX(HOUR_INDEX.toString(), null, 2, 2, '0') + "_SOLD", PROCESSING_DGV_INDEX)
					)
				)
			);	

			POS_SALE_LIST_DGV.CELL.VALUE
			(
				"REC_TIME_" + JSVC_STR.VAR_FIX(HOUR_INDEX.toString(), null, 2, 2, '0') + "_REM", PROCESSING_DGV_INDEX, 
				JSVC_NUM.VAR_CFORMAT
				(
					JSVC_NUM.VAR_NVAL
					(
						POS_SALE_LIST_DGV.CELL.VALUE("REC_TIME_" + JSVC_STR.VAR_FIX(HOUR_INDEX.toString(), null, 2, 2, '0') + "_REM", PROCESSING_DGV_INDEX)
					)
				)
			);	
					
			HOUR_INDEX ++;		
		}	
		
		if(HTTP_SEARCH_SALES_BEGIN() == false)
		{
			CUS_SEND_DIALOG_TRY_DISMISS();
		}		
	}
	
	FORM_INITIALIZE();
	FORM_LOAD();