
	function FORM_LOAD()
	{
		PER_BRANCH_DGV = DataGridView("PER_BRANCH_DGV");
		SKU_SALES_DGV = DataGridView("SKU_SALES_DGV");
		SM_NM_DGV = DataGridView("SM_NM_DGV");
		PD_DGV = DataGridView("PD_DGV");

		PAGE_AUTH_REQUIRES_LOGIN();	

		HTTP_LOAD_BRANCH();
		//HTTP_TOTAL_SALES();
		//HTTP_LOAD_SALES_PER_SKU();
		//HTTP_LOAD_SALES_NONMOVING();
		//HTTP_LOAD_PENDING_DELIVERIES();
	}

	function HTTP_TOTAL_SALES()
	{
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_SALE.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_FROM_TS_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_DATE_FROM_TS_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_TS_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_TS_DTP"), "YYYY-MM-DD") + " 00:00:00.000000");
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_TO_TS_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_DATE_TO_TS_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_TO_TS_DTP")) == false
		)
		{
		 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_DATE_TRANSACT_TO', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_TO_TS_DTP"), "YYYY-MM-DD") + " 23:59:59.999999");
		}
		
		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_TS_CMB")));

		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_STATUS', 2);

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_SALE.CUS_GET
		(
			GET_MAP_ARRAY,
			HTTP_TOTAL_SALES_CALLBACK,
			true
		); 		
	}
	
	function HTTP_TOTAL_SALES_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();

		// Load Other Data
		// _______________________________________________________________________
		
		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			alert("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)
		{
			alert("REQUEST ERROR: \n" + RESPONSE_STRING);
			return;
		}

		var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");
		var CTR = 0;
		var COUNTER = 1;
		var TOTAL_SALES = 0;

		while(CTR < JSON_COUNT)
		{
			TOTAL_SALES += (
				JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_TOTAL_VATABLE", COUNTER)) +
				JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_TOTAL_VATEXEMPT", COUNTER)) +
				JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_TOTAL_NONVAT", COUNTER)) +
				JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_TOTAL_ZERORATED", COUNTER)) +
				JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_TOTAL_VATOTHER", COUNTER)) +
				JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_TOTAL_VAT", COUNTER))
			);

			CTR++;
			COUNTER++;
		}

		//JSOC_ELEMENT.VAR_VALUE("DASHBOARD_TOTAL_SALES_LBL", JSVC_NUM.VAR_CFORMAT(TOTAL_SALES));
	}

	function HTTP_LOAD_BRANCH()
	{
		var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._GROUP.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		//JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ACC_GROUP_SYSTEM_GENERATED', 1);

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._ACCOUNT._GROUP.CUS_GET
		(
			GET_MAP_ARRAY,
			HTTP_LOAD_BRANCH_CALLBACK,
			true
		); 		
	}

	function HTTP_LOAD_BRANCH_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();
		JSOC_ELEMENT.VAR_VALUE("DASHBOARD_TOTAL_SALES_LBL", "0.00");
		
		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			alert("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)
		{
			alert("REQUEST ERROR: \n" + RESPONSE_STRING);
			return;
		}

		// Populate DGV
		// _______________________________________________________________________
		PER_BRANCH_DGV.POPULATE_FROM_QUERY
		(
				JSON_OBJECT, 
				'',
				false,
				false,
				0,
				[2, 1]
		);

		var WEBTABLE_DATE = null;
		var ROW_INDEX = 1;

		//Initialize CMB
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_TS_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_ACC_GROUP_ID_TS_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_TS_CMB", FLAG_BIGINT_NULL.toString(),"All Branch");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_SKU_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_ACC_GROUP_ID_SKU_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_SKU_CMB", FLAG_BIGINT_NULL.toString(),"All Branch");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_SM_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_ACC_GROUP_ID_SM_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_SM_CMB", FLAG_BIGINT_NULL.toString(),"All Branch");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_PD_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_ACC_GROUP_ID_PD_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_PD_CMB", FLAG_BIGINT_NULL.toString(),"All Branch");
		}
		
		var CALLBACK_METHOD = function(IS_SUCCESS)
		{
			if(IS_SUCCESS)
			{
				var JSON_COUNT = JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "JSON_COUNT");
				var CTR = 0;
				var COUNTER = 1;
				var TOTAL_SALES = 0;
				while(CTR < JSON_COUNT)
				{
					//TOTAL_SALES =  TOTAL_SALES + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_TOTAL_PAID", COUNTER));
					TOTAL_SALES =  TOTAL_SALES + (
													JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_VATABLE", COUNTER)) +
											    	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_VATEXEMPT", COUNTER)) +
											    	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_NONVAT", COUNTER)) +
											   	 	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_ZERORATED", COUNTER)) +
											    	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_VATOTHER", COUNTER)) +
											    	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_VAT", COUNTER))
												);
					CTR++;
					COUNTER++;
				}
				PER_BRANCH_DGV.CELL.VALUE('TOTAL_SALES', INDEX_HOLDER, JSVC_NUM.VAR_CFORMAT(TOTAL_SALES));
				JSOC_ELEMENT.VAR_VALUE("DASHBOARD_TOTAL_SALES_LBL", JSVC_NUM.VAR_CFORMAT(JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE("DASHBOARD_TOTAL_SALES_LBL")) + TOTAL_SALES));
			}
		}

		while(PER_BRANCH_DGV.ROW.COUNT() >= ROW_INDEX)
		{
			PER_BRANCH_DGV.CELL.VALUE('TOTAL_SALES', ROW_INDEX - 1, '0.00'); //INITIAL VALUE LANG
			PROPERTY_ACC_GROUP_ID = JSRC_JSON.REF_READ(JSON_OBJECT, "ACC_GROUP_ID", ROW_INDEX);
			if(PROPERTY_ACC_GROUP_ID != null)
			{
				HTTP_BRANCH_SALES_LOAD(CALLBACK_METHOD, ROW_INDEX);
			}
			
			//INSERT NG DATA SA COMBO BOX
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_TS_CMB") == true)
			{
				JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_TS_CMB", PER_BRANCH_DGV.CELL.VALUE('ACC_GROUP_ID', ROW_INDEX - 1), PER_BRANCH_DGV.CELL.VALUE('ACC_GROUP_DESCRIPTION', ROW_INDEX - 1));
			}
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_SKU_CMB") == true)
			{
				JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_SKU_CMB", PER_BRANCH_DGV.CELL.VALUE('ACC_GROUP_ID', ROW_INDEX - 1), PER_BRANCH_DGV.CELL.VALUE('ACC_GROUP_DESCRIPTION', ROW_INDEX - 1));
			}
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_SM_CMB") == true)
			{
				JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_SM_CMB", PER_BRANCH_DGV.CELL.VALUE('ACC_GROUP_ID', ROW_INDEX - 1), PER_BRANCH_DGV.CELL.VALUE('ACC_GROUP_DESCRIPTION', ROW_INDEX - 1));
			}
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_PD_CMB") == true)
			{
				JSOC_CMB.VAR_ADD("SEARCH_ACC_GROUP_ID_PD_CMB", PER_BRANCH_DGV.CELL.VALUE('ACC_GROUP_ID', ROW_INDEX - 1), PER_BRANCH_DGV.CELL.VALUE('ACC_GROUP_DESCRIPTION', ROW_INDEX - 1));
			}
			ROW_INDEX++;
		}

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_TS_CMB") == true)
		{
			JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_TS_CMB", FLAG_BIGINT_NULL.toString());
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_SKU_CMB") == true)
		{
			JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_SKU_CMB", FLAG_BIGINT_NULL.toString());
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_SM_CMB") == true)
		{
			JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_SM_CMB", FLAG_BIGINT_NULL.toString());
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_PD_CMB") == true)
		{
			JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_PD_CMB", FLAG_BIGINT_NULL.toString());
		}
	}

	function HTTP_LOAD_SALES_PER_BRANCH()
	{
	    JSOC_ELEMENT.VAR_VALUE("DASHBOARD_TOTAL_SALES_LBL", "0.00");
		var WEBTABLE_DATE = null;
		var ROW_INDEX = 1;

		var CALLBACK_METHOD = function(IS_SUCCESS)
		{
			if(IS_SUCCESS)
			{
				var JSON_COUNT = JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "JSON_COUNT");
				var CTR = 0;
				var COUNTER = 1;
				var TOTAL_SALES = 0;
				while(CTR < JSON_COUNT)
				{
					//TOTAL_SALES =  TOTAL_SALES + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_TOTAL_PAID", COUNTER));
					TOTAL_SALES =  TOTAL_SALES + (
													JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_VATABLE", COUNTER)) +
											    	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_VATEXEMPT", COUNTER)) +
											    	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_NONVAT", COUNTER)) +
											   	 	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_ZERORATED", COUNTER)) +
											    	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_VATOTHER", COUNTER)) +
											    	JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES,"REC_POSSALE_TOTAL_VAT", COUNTER))
												);
					CTR++;
					COUNTER++;
				}
				PER_BRANCH_DGV.CELL.VALUE('TOTAL_SALES', INDEX_HOLDER, JSVC_NUM.VAR_CFORMAT(TOTAL_SALES));
				JSOC_ELEMENT.VAR_VALUE("DASHBOARD_TOTAL_SALES_LBL", JSVC_NUM.VAR_CFORMAT(JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE("DASHBOARD_TOTAL_SALES_LBL")) + TOTAL_SALES));
			}
		}

		while(PER_BRANCH_DGV.ROW.COUNT() >= ROW_INDEX)
		{
			PER_BRANCH_DGV.CELL.VALUE('TOTAL_SALES', ROW_INDEX - 1, '0.00'); //INITIAL VALUE LANG
			PROPERTY_ACC_GROUP_ID = PER_BRANCH_DGV.CELL.VALUE("ACC_GROUP_ID", ROW_INDEX - 1);
			if(PROPERTY_ACC_GROUP_ID != null)
			{
				HTTP_BRANCH_SALES_LOAD(CALLBACK_METHOD, ROW_INDEX);
			}
			ROW_INDEX++;
		}
	}

	function HTTP_LOAD_SALES_PER_SKU()
	{
		var 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_SKU_CMB") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_ACC_GROUP_ID_SKU_CMB') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_ACC_GROUP_ID_SKU_CMB")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_ACC_GROUP_ID', JSOC_ELEMENT.VAR_VALUE("SEARCH_ACC_GROUP_ID_SKU_CMB"));
		}

		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_FROM_SKU_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_DATE_FROM_SKU_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_SKU_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_SKU_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_SKU_DTP"), "YYYY-MM-DD") + " 23:59:59.000000");
		}

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);

		JSCUS_SQL._RECORD._POS_SALE_LIST.CUS_GET_ALL
		(
			GET_MAP_ARRAY,
			HTTP_LOAD_SALES_PER_SKU_CALLBACK,
			true
		); 
	}

	function HTTP_LOAD_SALES_PER_SKU_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();

		// Initialize DGV
		// _______________________________________________________________________
		SKU_SALES_DGV.ROW.CLEAR();

		// Load Other Data
		// _______________________________________________________________________

		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			alert("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)
		{
			alert("REQUEST ERROR: \n" + RESPONSE_STRING);
			return;
		}
		
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			SKU_SALES_DGV.ROW.CLEAR();
			return;
		}

		var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");

		var CTR = 0;
		var COUNTER = 1;
		var ROW_INDEX = 1;

		var IS_INSERTED = false;

		var TOTAL_SALES = 0;
		var TOTAL_QUANTITY = 0;

		var SUM_HOLDER = 0;

		while(CTR < JSON_COUNT)
		{
			while(SKU_SALES_DGV.ROW.COUNT() >= ROW_INDEX)
			{
				if(JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_CAT_PRODUCT_ID", COUNTER)) == JSVC_NUM.VAR_NVAL(SKU_SALES_DGV.CELL.VALUE('CAT_PRODBRANCH_CAT_PRODUCT_ID', ROW_INDEX - 1)))
				{
					SKU_SALES_DGV.CELL.VALUE("TOTAL_QUANTITY", ROW_INDEX - 1, (JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_QUANTITY", COUNTER)) + JSVC_NUM.VAR_NVAL(SKU_SALES_DGV.CELL.VALUE("TOTAL_QUANTITY", ROW_INDEX - 1))));

					SUM_HOLDER = 
					JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_VATABLE", COUNTER)) + 
					JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_VATEXEMPT", COUNTER)) + 
					JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_NONVAT", COUNTER)) + 
					JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_ZERORATED", COUNTER)) + 
					JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_VATOTHER", COUNTER)) + 
					JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_VAT", COUNTER));

					SKU_SALES_DGV.CELL.VALUE("TOTAL_SALES",  ROW_INDEX - 1, JSVC_NUM.VAR_NVAL(SKU_SALES_DGV.CELL.VALUE("TOTAL_SALES",  ROW_INDEX - 1)) + JSVC_NUM.VAR_NVAL(SUM_HOLDER));

					IS_INSERTED = true;
					break;
				}

				ROW_INDEX++;
			}

			if(IS_INSERTED === false)
			{
				var RINDEX = SKU_SALES_DGV.ROW.COUNT();

				SKU_SALES_DGV.ROW.INSERT_AT(RINDEX);
				SKU_SALES_DGV.CELL.VALUE("ROW_COUNT", RINDEX, RINDEX + 1);

				SKU_SALES_DGV.CELL.VALUE("CAT_PRODBRANCH_CAT_PRODUCT_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_CAT_PRODUCT_ID", COUNTER));
				SKU_SALES_DGV.CELL.VALUE("CAT_PRODBRANCH_CAT_PRODUCT_ID_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_CAT_PRODUCT_ID_DESCRIPTION", COUNTER));
				SKU_SALES_DGV.CELL.VALUE("TOTAL_QUANTITY", RINDEX, JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_QUANTITY", COUNTER)));

				SUM_HOLDER = JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_VATABLE", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_VATEXEMPT", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_NONVAT", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_ZERORATED", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_VATOTHER", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_TOPAY_VAT", COUNTER));

				SKU_SALES_DGV.CELL.VALUE("TOTAL_SALES", RINDEX, JSVC_NUM.VAR_NVAL(SUM_HOLDER));
			}

			IS_INSERTED = false; 
			ROW_INDEX = 1; 
			SUM_HOLDER = 0;
			
			CTR++;
			COUNTER++;
		}

		SKU_SALES_DGV.COLUMN.SORT("TOTAL_SALES", "DESC");

		var rows = $('#SKU_SALES_DGV > tbody > tr[id^="SKU_SALES_DGV_ROW_"]');
		var COUNTER = 1;

		$.each(rows, function(i, item) {
			if(COUNTER > 5)
				$(this).addClass('d-none');

			COUNTER++;
		});	

		SKU_SALES_DGV.COLUMN.CFORMAT("TOTAL_QUANTITY");
		SKU_SALES_DGV.COLUMN.CFORMAT("TOTAL_SALES");
	}

	function HTTP_LOAD_SALES_NONMOVING()
	{
		var 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_SM_CMB") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_ACC_GROUP_ID_SM_CMB') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_ACC_GROUP_ID_SM_CMB")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_ACC_GROUP_ID', JSOC_ELEMENT.VAR_VALUE("SEARCH_ACC_GROUP_ID_SM_CMB"));
		}

		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', 'DESC');

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);

		JSCUS_SQL._RECORD._POS_SALE_LIST.CUS_GET_ALL
		(
			GET_MAP_ARRAY,
			HTTP_LOAD_SALES_NONMOVING_CALLBACK,
			true
		); 
	}

	function HTTP_LOAD_SALES_NONMOVING_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();

		// Initialize DGV
		// _______________________________________________________________________
		SM_NM_DGV.ROW.CLEAR();

		// Load Other Data
		// _______________________________________________________________________

		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			alert("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)
		{
			alert("REQUEST ERROR: \n" + RESPONSE_STRING);
			return;
		}
		
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			SM_NM_DGV.ROW.CLEAR();
			return;
		}

		var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");

		var CTR = 0;
		var COUNTER = 1;
		var ROW_INDEX = 1;

		var IS_INSERTED = false;

		var LAST_DATE_SOLD = JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD");
		var LAST_DATE_SOLD_INDEX = 0;
		var QUANTITY_SOLD = 0;

		var SUM_HOLDER = 0;

		while(CTR < JSON_COUNT)
		{
			while(SM_NM_DGV.ROW.COUNT() >= ROW_INDEX)
			{
				if
				(
					JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_CAT_PRODUCT_ID", COUNTER)) == JSVC_NUM.VAR_NVAL(SM_NM_DGV.CELL.VALUE('CAT_PRODBRANCH_CAT_PRODUCT_ID', ROW_INDEX - 1)) &&
					JSVC_DATE.VAR_FORMAT(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_DATE_TRANSACT", COUNTER), "YYYY-MM-DD") >= LAST_DATE_SOLD
				)
				{
					LAST_DATE_SOLD = JSVC_DATE.VAR_FORMAT(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_DATE_TRANSACT", COUNTER), "YYYY-MM-DD");

					SM_NM_DGV.CELL.VALUE("LAST_DATE_SOLD", ROW_INDEX - 1, JSVC_DATE.VAR_FORMAT(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_DATE_TRANSACT", COUNTER), "YYYY-MM-DD"));
					SM_NM_DGV.CELL.VALUE("QUANTITY_SOLD", ROW_INDEX - 1, (JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_QUANTITY", COUNTER)) + JSVC_NUM.VAR_NVAL(SM_NM_DGV.CELL.VALUE("QUANTITY_SOLD", ROW_INDEX - 1))));
					
					IS_INSERTED = true;
					break;
				}

				ROW_INDEX++;
			}

			if(IS_INSERTED === false)
			{
				var RINDEX = SM_NM_DGV.ROW.COUNT();

				SM_NM_DGV.ROW.INSERT_AT(RINDEX);
				SM_NM_DGV.CELL.VALUE("ROW_COUNT", RINDEX, RINDEX + 1);

				SM_NM_DGV.CELL.VALUE("CAT_PRODBRANCH_CAT_PRODUCT_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_CAT_PRODUCT_ID", COUNTER));
				SM_NM_DGV.CELL.VALUE("CAT_PRODBRANCH_CAT_PRODUCT_ID_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_CAT_PRODUCT_ID_DESCRIPTION", COUNTER));
				SM_NM_DGV.CELL.VALUE("LAST_DATE_SOLD", RINDEX, JSVC_DATE.VAR_FORMAT(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_DATE_TRANSACT", COUNTER), "YYYY-MM-DD"));
				SM_NM_DGV.CELL.VALUE("QUANTITY_SOLD", RINDEX, JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_LIST_QUANTITY", COUNTER)));

				LAST_DATE_SOLD = JSVC_DATE.VAR_FORMAT(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSSALE_DATE_TRANSACT", COUNTER), "YYYY-MM-DD");
			}

			IS_INSERTED = false; 
			ROW_INDEX = 1; 
			SUM_HOLDER = 0;
			
			CTR++;
			COUNTER++;
		}

		/*SM_NM_DGV.COLUMN.SORT("TOTAL_SALES", "ASC");

		var rows = $('#SM_NM_DGV > tbody > tr[id^="SM_NM_DGV_ROW_"]');
		var COUNTER = 1;

		$.each(rows, function(i, item) {
			if(COUNTER > 5)
				$(this).addClass('d-none');

			COUNTER++;
		});	

		SM_NM_DGV.COLUMN.CFORMAT("TOTAL_QUANTITY");
		SM_NM_DGV.COLUMN.CFORMAT("TOTAL_SALES");*/
	}

	/*function HTTP_LOAD_BRANCH_PRODUCT()
	{
		var GET_MAP_ARRAY = JSCUS_SQL._CATEGORY._PRODUCT_BRANCH.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();

		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_CAT_PRODBRANCH_STATUS', 2);

		if(SEARCH_CMD_IDENTIFIER == 1) // SKU SEARCH BUTTON CLICKED
		{
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_SKU_CMB") == true)
			{
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_CAT_PRODBRANCH_ACC_GROUP_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_SKU_CMB")));
			}
		}
		else if (SEARCH_CMD_IDENTIFIER == 2) // SM/NM SEARCH BUTTON CLICKED
		{
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_SM_CMB") == true)
			{
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_CAT_PRODBRANCH_ACC_GROUP_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_SM_CMB")));
			}
		}

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._CATEGORY._PRODUCT_BRANCH.CUS_GET
		(
			GET_MAP_ARRAY,
			HTTP_LOAD_BRANCH_PRODUCT_CALLBACK,
			true
		);
	}*/

	/*function HTTP_LOAD_BRANCH_PRODUCT_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();

		// Load Other Data
		// _______________________________________________________________________

		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			alert("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)
		{
			alert("REQUEST ERROR: \n" + RESPONSE_STRING);
			return;
		}
		
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			if(SEARCH_CMD_IDENTIFIER == 1 || SEARCH_CMD_IDENTIFIER == 0)
				SKU_SALES_DGV.ROW.CLEAR();
			if(SEARCH_CMD_IDENTIFIER == 2 || SEARCH_CMD_IDENTIFIER == 0)
				SM_NM_DGV.ROW.CLEAR();
			return;
		}

		// Populate DGV
		// _______________________________________________________________________
		if(SEARCH_CMD_IDENTIFIER == 1 || SEARCH_CMD_IDENTIFIER == 0)
		{
			SKU_SALES_DGV.POPULATE_FROM_QUERY
			(
				JSON_OBJECT, 
				'',
				false,
				false,
				1,
				[2, 1]
			);
		}
		
		if(SEARCH_CMD_IDENTIFIER == 2 || SEARCH_CMD_IDENTIFIER == 0)
		{
			SM_NM_DGV.POPULATE_FROM_QUERY
			(
				JSON_OBJECT, 
				'',
				false,
				false,
				1,
				[2, 1]
			);
		}

		// Set Initial Value
		// _______________________________________________________________________
		var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");
		var CTR = 0;
		var COUNTER = 1;

		while(CTR < JSON_COUNT)
		{
			if(SEARCH_CMD_IDENTIFIER == 1 || SEARCH_CMD_IDENTIFIER == 0)
			{
				SKU_SALES_DGV.CELL.VALUE('TOTAL_QUANTITY', COUNTER - 1, '0.00');
				SKU_SALES_DGV.CELL.VALUE('TOTAL_SALES', COUNTER - 1, '0.00');
			}
			if(SEARCH_CMD_IDENTIFIER == 2 || SEARCH_CMD_IDENTIFIER == 0)
			{
				SM_NM_DGV.CELL.VALUE('TOTAL_QUANTITY', COUNTER - 1, '0.00');
				SM_NM_DGV.CELL.VALUE('TOTAL_AMOUNT', COUNTER - 1, '0.00');
			}

			//if SCMD = 0


			CTR++;
			COUNTER++;
		}

		SKU_SALES_DGV.ROW.CLEAR();

		var CALLBACK_METHOD = function(IS_SUCCESS)
		{
			if(IS_SUCCESS)
			{

				var JSON_COUNT = JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "JSON_COUNT");

				var CTR = 0;
				var COUNTER = 1;
				var TOTAL_SALES = 0;
				var TOTAL_QUANTITY = 0;

				var PRODUCT = '';

				while(CTR < JSON_COUNT)
				{
					TOTAL_QUANTITY += JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_LIST_QUANTITY", COUNTER));
					TOTAL_SALES += (JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_LIST_TOPAY_NONVAT", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_LIST_TOPAY_VAT", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_LIST_TOPAY_VATABLE", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_LIST_TOPAY_VATEXEMPT", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_LIST_TOPAY_VATOTHER", COUNTER)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_LIST_TOPAY_ZERORATED", COUNTER)));

					PRODUCT = JSRC_JSON.REF_READ(PROPERTY_CHILD_FILES, "REC_POSSALE_LIST_CAT_PRODUCT_ID_DESCRIPTION", COUNTER);

					CTR++;
					COUNTER++;
				}
				
				SKU_SALES_DGV.ROW.INSERT_AT(ROW_INDEX-1);
				SKU_SALES_DGV.CELL.VALUE('ROW_COUNT', ROW_INDEX - 1, ROW_INDEX);
				SKU_SALES_DGV.CELL.VALUE('CAT_PRODBRANCH_CAT_PRODUCT_ID_DESCRIPTION', ROW_INDEX - 1, PRODUCT);
				SKU_SALES_DGV.CELL.VALUE('TOTAL_QUANTITY', ROW_INDEX - 1, JSVC_NUM.VAR_CFORMAT(TOTAL_QUANTITY));
				SKU_SALES_DGV.CELL.VALUE('TOTAL_SALES', ROW_INDEX - 1, JSVC_NUM.VAR_CFORMAT(TOTAL_SALES));

				console.log(TOTAL_SALES); 
				if(TOTAL_SALES == 0) {
					SKU_SALES_DGV.ROW.DISPLAY(ROW_INDEX - 1, "none");
				}

				ROW_INDEX++;

				if(ROW_INDEX <= SKU_SALES_DGV.ROW.COUNT()) {
					PROPERTY_ACC_GROUP_ID = JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_PRODBRANCH_ACC_GROUP_ID", ROW_INDEX);
					PROPERTY_CAT_PRODUCT_ID = JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_PRODBRANCH_CAT_PRODUCT_ID", ROW_INDEX);

					HTTP_SALES_PER_PRODUCT_LOAD(CALLBACK_METHOD, ROW_INDEX);
				}
				else
					CUS_SEND_DIALOG_TRY_DISMISS();
			}
			else
				CUS_SEND_DIALOG_TRY_DISMISS();
		}

		ROW_INDEX = 1;

		PROPERTY_ACC_GROUP_ID = JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_PRODBRANCH_ACC_GROUP_ID", ROW_INDEX);
		PROPERTY_CAT_PRODUCT_ID = JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_PRODBRANCH_CAT_PRODUCT_ID", ROW_INDEX);

		HTTP_SALES_PER_PRODUCT_LOAD(CALLBACK_METHOD, ROW_INDEX);
	}*/

	function HTTP_LOAD_PENDING_DELIVERIES()
	{
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._PO_ORDER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_FROM_PD_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_DATE_FROM_PD_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_PD_DTP")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_PORDER_DATE_REQUEST_FROM', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_PD_DTP"), "YYYY-MM-DD") + " 00:00:00.000000");
		 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_PORDER_DATE_REQUEST_TO', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_PD_DTP"), "YYYY-MM-DD") + " 23:59:59.000000");
		}
		if(SEARCH_CMD_IDENTIFIER == 3) // PD SEARCH BUTTON CLICKED
		{
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ACC_GROUP_ID_PD_CMB") == true)
			{
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_PORDER_ACC_GROUP_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ACC_GROUP_ID_PD_CMB")));
			}
		}

		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_PORDER_STATUS', 1); //GET ALWAYS PENDING

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._PO_ORDER.CUS_GET
		(
			GET_MAP_ARRAY,
			HTTP_LOAD_PENDING_DELIVERIES_CALLBACK,
			true
		);
	}

	function HTTP_LOAD_PENDING_DELIVERIES_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();

		// Initialize DGV
		// _______________________________________________________________________
		PD_DGV.ROW.CLEAR();

		// Load Other Data
		// _______________________________________________________________________
		
		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			alert("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)
		{
			alert("REQUEST ERROR: \n" + RESPONSE_STRING);
			return;
		}
		
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			PD_DGV.ROW.CLEAR();
			return;
		}

		// Populate DGV
		// _______________________________________________________________________
		PD_DGV.POPULATE_FROM_QUERY
		(
			JSON_OBJECT, 
			'',
			false,
			false,
			1,
			[2, 1]
		);

		var WEBTABLE_DATE = null;
		var ROW_INDEX = 0;
		while(PD_DGV.ROW.COUNT() > ROW_INDEX)
		{
			// Read Current Value
			// ...........................................
			WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE
			(
				PD_DGV.CELL.VALUE
				(
						"REC_PORDER_DATE_REQUEST", 
						ROW_INDEX
				)
			);
			
			// Apply CFormat, and DateFormat
			// ...........................................
			if(JSVC_VAR.VAR_ISSET(WEBTABLE_DATE))
			{
				PD_DGV.CELL.VALUE
				(
						"REC_PORDER_DATE_REQUEST", ROW_INDEX, 
						JSVC_DATE.VAR_FORMAT(WEBTABLE_DATE, "MMM DD, YYYY")
				);				
			}			
			
			WEBTABLE_DATE = null;

			WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE
			(
				PD_DGV.CELL.VALUE
				(
						"REC_PORDER_DATE_EXPECT", 
						ROW_INDEX
				)
			);
			
			// Apply CFormat, and DateFormat
			// ...........................................
			if(JSVC_VAR.VAR_ISSET(WEBTABLE_DATE))
			{
				PD_DGV.CELL.VALUE
				(
						"REC_PORDER_DATE_EXPECT", ROW_INDEX, 
						JSVC_DATE.VAR_FORMAT(WEBTABLE_DATE, "MMM DD, YYYY")
				);				
			}
			// To next loop
			// ...........................................	
			ROW_INDEX ++;
		}			
	}

	FORM_INITIALIZE();
	FORM_LOAD();