


	function FORM_LOAD()
	{
		TRANSFLOW_SMRY_DGV = DataGridView("TRANSFLOW_SMRY_DGV");
		POS_SHIFT_DGV = DataGridView("POS_SHIFT_DGV");

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB", FLAG_BIGINT_NULL.toString(),"Any Branch");
			var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._GROUP.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();

			JSCUS_SQL._ACCOUNT._GROUP.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(){ },
				"SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB",
				true,
				2,
				GET_MAP_ARRAY 
			);
		}

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_ACCOUNT_ID_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_ACCOUNT_ID_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_ACCOUNT_ID_CMB", FLAG_BIGINT_NULL.toString(),"Any Member");
			var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._MEMBER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();

			JSCUS_SQL._ACCOUNT._MEMBER.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(){ },	
				"SEARCH_REC_TRANSFLOW_SUMMARY_ACC_ACCOUNT_ID_CMB",
				true,
				2,
				GET_MAP_ARRAY 
			);
		}
	}

	function HTTP_LOAD_EOD()
	{
		if
		(
			JSVC_VAR.VAR_ISSET(SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB) &&
			JSOC_CMB.VAR_SELECTED_INDEX(SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB) < 0 ||
			JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB)) < 0
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Branch is required.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB.focus();
				}
			);	
			return;
		}

		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._EOD_PRODUCT.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_TRANSFLOW_SUMMARY_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_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB")));
		}
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_EODPROD_DATE_REPORT_FROM', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_DATE_FROM"), "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_REC_TRANSFLOW_SUMMARY_DATE_TO"), "YYYY-MM-DD") + " 23:59:59.999999");

		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_SKIP', SKIP);
		
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._EOD_PRODUCT.CUS_GET
		(
			GET_MAP_ARRAY,
			HTTP_LOAD_EOD_CALLBACK,
			true
		);
	}

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

		//RESET DGV
		// _______________________________________________________________________
		if (SKIP == 0)
			TRANSFLOW_SMRY_DGV.ROW.CLEAR();
		
		// 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 (SKIP == 0)
				TRANSFLOW_SMRY_DGV.ROW.CLEAR();
			return;
		}

		// Populate DGV
		// _______________________________________________________________________
		var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");
		var COUNTER = 1;
		while(COUNTER <= JSON_COUNT)
		{
			var R_INDEX = 1; var IS_INSERTED = 0;
			while(TRANSFLOW_SMRY_DGV.ROW.COUNT() >= R_INDEX)
			{
				if
				(
					JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_CAT_PRODUCT_ID", R_INDEX-1)) ==
					JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_CAT_PRODUCT_ID", COUNTER))
				)
				{
					IS_INSERTED = 1;
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_BBAL_STORE", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_BBAL_STORE", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_BBAL_STORE", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_DELIVER_RECV", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_DELIVER_RECV", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_DELIVER_RECV", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_DELIVERY_RTRN", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_DELIVERY_RTRN", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_DELIVERY_RTRN", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSA_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSA_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSA_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSB_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSB_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSB_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSD_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSD_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSD_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSE_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSE_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSE_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_BADORDER", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_BADORDER", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_BADORDER", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSC_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSC_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSC_AMOUNT", COUNTER)));
					
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_STOCK_IN", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_STOCK_IN", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_STOCK_IN", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_STOCK_OUT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_STOCK_OUT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_STOCK_OUT", COUNTER)));
					
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_EBAL_STORE", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_EBAL_STORE", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_EBAL_STORE", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_ABAL_STORE", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_ABAL_STORE", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_ABAL_STORE", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_SOLD_ITEM", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_SOLD_ITEM", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_SOLD_ITEM", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_SOLD_REDIRECT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_SOLD_REDIRECT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_SOLD_REDIRECT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_SENIOR_20P", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_SENIOR_20P", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_SENIOR_20P", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_SENIOR_5P", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_SENIOR_5P", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_SENIOR_5P", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_PWD_20P", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_PWD_20P", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_PWD_20P", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_PWD_5P", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_PWD_5P", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_PWD_5P", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_GOV_5P", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_GOV_5P", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_GOV_5P", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSA_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSA_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSA_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSB_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSB_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSB_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSC_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSC_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSC_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSD_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSD_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSD_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSE_AMOUNT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSE_AMOUNT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSE_AMOUNT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_OTHER", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_OTHER", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_OTHER", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATABLE", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATABLE", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_VATABLE", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATEXEMPT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATEXEMPT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_VATEXEMPT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_NONVAT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_NONVAT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_NONVAT", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_ZERORATED", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_ZERORATED", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_ZERORATED", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATOTHER", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATOTHER", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_VATOTHER", COUNTER)));
					TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VAT", R_INDEX-1, JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VAT", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_VAT", COUNTER)));
					break;
				}
				R_INDEX++;
			}

			if(IS_INSERTED == 0)
			{
				var RINDEX = TRANSFLOW_SMRY_DGV.ROW.COUNT();
				TRANSFLOW_SMRY_DGV.ROW.INSERT_AT(RINDEX);
				TRANSFLOW_SMRY_DGV.CELL.VALUE("ROW_COUNT", RINDEX, RINDEX + 1);
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_CAT_PRODUCT_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_CAT_PRODUCT_ID", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_CAT_PRODUCT_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_CAT_PRODUCT_DESCRIPTION", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_UOM", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_UOM", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_AMOUNT_PRICE", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_AMOUNT_PRICE", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_BBAL_STORE", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_BBAL_STORE", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_DELIVER_RECV", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_DELIVER_RECV", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_DELIVERY_RTRN", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_DELIVERY_RTRN", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSA_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSA_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSB_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSB_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSD_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSD_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSE_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSE_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_BADORDER", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_BADORDER", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_CUSC_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_CUSC_AMOUNT", COUNTER));
				
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_STOCK_IN", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_STOCK_IN", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_STOCK_OUT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_STOCK_OUT", COUNTER));
				
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_EBAL_STORE", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_EBAL_STORE", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_ABAL_STORE", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_ABAL_STORE", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_SOLD_ITEM", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_SOLD_ITEM", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_SF_SOLD_REDIRECT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_SF_SOLD_REDIRECT", COUNTER));
				
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_SENIOR_20P", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_SENIOR_20P", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_SENIOR_5P", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_SENIOR_5P", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_PWD_20P", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_PWD_20P", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_PWD_5P", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_PWD_5P", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_GOV_5P", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_GOV_5P", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSA_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSA_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSB_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSB_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSC_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSC_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSD_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSD_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_CUSE_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_CUSE_AMOUNT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_DC_OTHER", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_DC_OTHER", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATABLE", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_VATABLE", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATEXEMPT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_VATEXEMPT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_NONVAT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_NONVAT", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_ZERORATED", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_ZERORATED", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VATOTHER", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_VATOTHER", COUNTER));
				TRANSFLOW_SMRY_DGV.CELL.VALUE("REC_EODPROD_TOTAL_VAT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_EODPROD_TOTAL_VAT", COUNTER));
			}
			
			COUNTER++;
		}

		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_BBAL_STORE");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_DELIVER_RECV");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_DELIVERY_RTRN");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_CUSA_AMOUNT");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_CUSB_AMOUNT");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_CUSD_AMOUNT");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_CUSE_AMOUNT");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_BADORDER");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_CUSC_AMOUNT");
		
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_STOCK_IN");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_STOCK_OUT");
		
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_EBAL_STORE");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_ABAL_STORE");
		TRANSFLOW_SMRY_DGV.COLUMN.CFORMAT("REC_EODPROD_SF_SOLD_ITEM");

		var ROW_INDEX = 0;

		while(TRANSFLOW_SMRY_DGV.ROW.COUNT() > ROW_INDEX)
		{
			TRANSFLOW_SMRY_DGV.CELL.VALUE('TOTAL_SALES', ROW_INDEX,
				JSVC_NUM.VAR_CFORMAT(
					JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('TOTAL_SALES', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_TOTAL_VATABLE', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_TOTAL_VATEXEMPT', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_TOTAL_NONVAT', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_TOTAL_ZERORATED', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_TOTAL_VATOTHER', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_TOTAL_VAT', ROW_INDEX))
				));


			TRANSFLOW_SMRY_DGV.CELL.VALUE('TOTAL_DISCOUNT', ROW_INDEX,
				JSVC_NUM.VAR_CFORMAT(
					JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('TOTAL_DISCOUNT', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_SENIOR_20P', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_SENIOR_5P', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_PWD_20P', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_PWD_5P', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_GOV_5P', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_CUSA_AMOUNT', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_CUSB_AMOUNT', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_CUSC_AMOUNT', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_CUSD_AMOUNT', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_CUSE_AMOUNT', ROW_INDEX)) +
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_DC_OTHER', ROW_INDEX))
				));

			TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_SF_DESCREPANCY_TOTAL', ROW_INDEX,
				JSVC_NUM.VAR_CFORMAT(
					JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_ABAL_STORE', ROW_INDEX)) -
		    		JSVC_NUM.VAR_NVAL(TRANSFLOW_SMRY_DGV.CELL.VALUE('REC_EODPROD_EBAL_STORE', ROW_INDEX))
				));

			ROW_INDEX++;
		}

		if (JSON_COUNT == 1000)
		{
			SKIP = SKIP + 1000;
			HTTP_LOAD_EOD();
		}
		else
		{
			JSOC_ELEMENT.VAR_VALUE("SALES_BY_PRODUCT_TOTAL_SALES", JSVC_NUM.VAR_CFORMAT(TRANSFLOW_SMRY_DGV.COLUMN.SUM("TOTAL_SALES")));
			HTTP_LOAD_TRANS_COUNT();
		}
	}


	function HTTP_LOAD_TRANS_COUNT()
	{
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_SALE.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_TRANSFLOW_SUMMARY_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_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB")));
		}
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_DATE_TRANSACT_FROM', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_DATE_FROM"), "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_REC_TRANSFLOW_SUMMARY_DATE_TO"), "YYYY-MM-DD") + " 23:59:59.999999");
		
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, RESPONSE_STRING)
			{
				// Disable Dialogs
				// _______________________________________________________________________
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Validate
				// _______________________________________________________________________
				if(IS_SUCCESS === false)
				{
					alert("CONNECTION ERROR: \n" + RESPONSE_STRING);
					CALLBACK_METHOD(false);
					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);
					CALLBACK_METHOD(false);
					return;
				}
				
				if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
					JSOC_ELEMENT.VAR_VALUE("SALES_BY_PRODUCT_TOTAL_COUNT", 0);
				else
					JSOC_ELEMENT.VAR_VALUE("SALES_BY_PRODUCT_TOTAL_COUNT", JSVC_NUM.VAR_FORMAT(JSRC_JSON.REF_READ(JSON_OBJECT, "RECORD_COUNT", 1), 0));

				//CALL CASHIER SHIF
				HTTP_SEARCH();
			}

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_SALE.CUS_GET
		(
			GET_MAP_ARRAY,
			RESPONSE_HANDLER,
			true
		);
	}

	function HTTP_LOAD_CASH_INOUT(CALLBACK_METHOD, R_INDEX)
	{
		POS_SHIFT_DGV.CELL.VALUE('REC_SHIFT_CASH_IN', R_INDEX - 1, '0.00');
		POS_SHIFT_DGV.CELL.VALUE('REC_SHIFT_CASH_OUT', R_INDEX - 1, '0.00');
		POS_SHIFT_DGV.CELL.VALUE
		(
			'TOTAL_CB',
			R_INDEX - 1,
			JSVC_NUM.VAR_CFORMAT
			(
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10KS", R_INDEX - 1)) * 10000) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5KS", R_INDEX - 1)) * 5000) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_2KS", R_INDEX - 1)) * 2000) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1KS", R_INDEX - 1)) * 1000) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_500S", R_INDEX - 1)) * 500) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_200S", R_INDEX - 1)) * 200) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_100S", R_INDEX - 1)) * 100) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_50S", R_INDEX - 1)) * 50) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_20S", R_INDEX - 1)) * 20) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10S", R_INDEX - 1)) * 10) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5S", R_INDEX - 1)) * 5) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1S", R_INDEX - 1)) * 1) +
				(JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CENTS", R_INDEX - 1)) * 0.1)
			)
		);

		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_CASHFLOW.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSCASHFLOW_DATE_PROCESSED_FROM', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_DATE_FROM"), "YYYY-MM-DD") + " 00:00:00.000000");
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSCASHFLOW_DATE_PROCESSED_TO', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_DATE_TO"), "YYYY-MM-DD") + " 23:59:59.999999");
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSCASHFLOW_ACC_ACCOUNT_ID', JSVC_NUM.VAR_NVALL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_ACCOUNT_ID", R_INDEX - 1)));

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

				var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");
				var COUNTER = 1;
				var CASH_IN = 0;
				var CASH_OUT = 0;
				while(COUNTER <= JSON_COUNT)
				{
					if
					(
						JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB")) ==
						JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSDEVICE_ACC_GROUP_ID", COUNTER))
					)
					{
						if(JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSCASHFLOW_IS_IN", COUNTER)) == 1)
							CASH_IN = CASH_IN + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSCASHFLOW_AMOUNT", COUNTER));
						else
							CASH_OUT = CASH_OUT + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSCASHFLOW_AMOUNT", COUNTER));
					}
					
					COUNTER++;
				}

				POS_SHIFT_DGV.CELL.VALUE('REC_SHIFT_CASH_IN', R_INDEX - 1, JSVC_NUM.VAR_CFORMAT(CASH_IN));
				POS_SHIFT_DGV.CELL.VALUE('REC_SHIFT_CASH_OUT', R_INDEX - 1, JSVC_NUM.VAR_CFORMAT(CASH_OUT));
				CALLBACK_METHOD(true);
			}

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_CASHFLOW.CUS_GET
		(
			GET_MAP_ARRAY,
			RESPONSE_HANDLER,
			true
		);
	}

	function HTTP_SEARCH()
	{
		GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_SHIFT.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();	
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_SHIFT_TIME_BEGIN_FROM', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_DATE_FROM"), "YYYY-MM-DD") + " 00:00:00.000000");
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_SHIFT_TIME_BEGIN_TO', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_DATE_TO"), "YYYY-MM-DD") + " 23:59:59.999999");
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_SHIFT_ACC_GROUP_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB")));
		}
		
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_SHIFT.CUS_GET
		(
			GET_MAP_ARRAY,
			HTTP_SEARCH_CALLBACK,
			true
		); 		
	}
	
	
	// ===============================================================
	// Request Search - PART.B
	// ===============================================================
	function HTTP_SEARCH_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();

		//Reset DATAGRID
		POS_SHIFT_DGV.ROW.CLEAR();
		
		// 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)
		{
			return;
		}

		var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");
		var COUNTER = 1;
		while(COUNTER <= JSON_COUNT)
		{
			if (POS_SHIFT_DGV.ROW.COUNT() == 0)
			{
				var RINDEX = POS_SHIFT_DGV.ROW.COUNT();
				POS_SHIFT_DGV.ROW.INSERT_AT(RINDEX);
				POS_SHIFT_DGV.CELL.VALUE("ROW_COUNT", RINDEX, RINDEX + 1);
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ID", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_GROUP_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_GROUP_ID", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_GROUP_ID_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_GROUP_ID_DESCRIPTION", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_DEVICE_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_DEVICE_ID", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_ACCOUNT_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_ACCOUNT_ID", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_ACCOUNT_ID_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_ACCOUNT_ID_DESCRIPTION", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_TIME_BEGIN", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_TIME_BEGIN", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_TIME_END", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_TIME_END", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_BEGIN", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CASH_BEGIN", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10KS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_10KS", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5KS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_5KS", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_2KS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_2KS", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1KS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_1KS", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_500S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_500S", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_200S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_200S", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_100S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_100S", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_50S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_50S", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_20S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_20S", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_10S", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_5S", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_1S", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CENTS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_CENTS", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CHECK_COUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_CHECK_COUNT", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CHECK_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_CHECK_AMOUNT", COUNTER));
				POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_STATUS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_STATUS", COUNTER));
			}
			else
			{
				var R_INDEX = 1; var IS_INSERTED = 0;
				while(POS_SHIFT_DGV.ROW.COUNT() >= R_INDEX)
				{
					if
					(
						JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_ACCOUNT_ID", R_INDEX-1)) ==
						JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_ACCOUNT_ID", COUNTER))
						&&
						JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_GROUP_ID", R_INDEX-1)) ==
						JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_GROUP_ID", COUNTER))
					)
					{
						IS_INSERTED = 1;
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_BEGIN", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_BEGIN", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CASH_BEGIN", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10KS", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10KS", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_10KS", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5KS", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5KS", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_5KS", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_2KS", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_2KS", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_2KS", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1KS", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1KS", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_1KS", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_500S", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_500S", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_500S", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_200S", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_200S", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_200S", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_100S", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_100S", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_100S", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_50S", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_50S", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_50S", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_20S", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_20S", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_20S", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10S", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10S", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_10S", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5S", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5S", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_5S", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1S", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1S", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_1S", COUNTER)));
						POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CENTS", R_INDEX-1, JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CENTS", R_INDEX-1)) + JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_CENTS", COUNTER)));
						break;
					}
					R_INDEX++;
				}

				if(IS_INSERTED == 0)
				{
					var RINDEX = POS_SHIFT_DGV.ROW.COUNT();
					POS_SHIFT_DGV.ROW.INSERT_AT(RINDEX);
					POS_SHIFT_DGV.CELL.VALUE("ROW_COUNT", RINDEX, RINDEX + 1);
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ID", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_GROUP_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_GROUP_ID", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_GROUP_ID_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_GROUP_ID_DESCRIPTION", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_DEVICE_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_DEVICE_ID", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_ACCOUNT_ID", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_ACCOUNT_ID", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_ACCOUNT_ID_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_ACC_ACCOUNT_ID_DESCRIPTION", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_TIME_BEGIN", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_TIME_BEGIN", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_TIME_END", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_TIME_END", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_BEGIN", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CASH_BEGIN", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10KS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_10KS", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5KS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_5KS", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_2KS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_2KS", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1KS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_1KS", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_500S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_500S", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_200S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_200S", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_100S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_100S", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_50S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_50S", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_20S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_20S", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_10S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_10S", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_5S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_5S", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_1S", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_1S", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CENTS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_CENTS", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CHECK_COUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_CHECK_COUNT", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CREDIT_CHECK_AMOUNT", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_CREDIT_CHECK_AMOUNT", COUNTER));
					POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_STATUS", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_SHIFT_STATUS", COUNTER));
				}
			}
			
			COUNTER++;
		}
		
		
		// For Applying CFormat
		// _______________________________________________________________________	
		POS_SHIFT_DGV.COLUMN.CFORMAT("REC_SHIFT_CASH_BEGIN");
		POS_SHIFT_DGV.COLUMN.CFORMAT("REC_SHIFT_CREDIT_CENTS");
		var ROW_INDEX = 1;
		var ROW_INDEX2 = 1;

		var CALLBACK_METHOD2 = function(IS_SUCCESS)
		{
			if(IS_SUCCESS)
			{
				ROW_INDEX2++;
				if(ROW_INDEX2 <= POS_SHIFT_DGV.ROW.COUNT())
					HTTP_SYSTEM_SALES_BY_USER(CALLBACK_METHOD2, ROW_INDEX2);
				else
					CUS_SEND_DIALOG_TRY_DISMISS();
			}
			else
				CUS_SEND_DIALOG_TRY_DISMISS();
		}

		var CALLBACK_METHOD = function(IS_SUCCESS)
		{
			if(IS_SUCCESS)
			{
				ROW_INDEX++;
				if(ROW_INDEX <= POS_SHIFT_DGV.ROW.COUNT())
					HTTP_LOAD_CASH_INOUT(CALLBACK_METHOD, ROW_INDEX);
				else
				{
					HTTP_SYSTEM_SALES_BY_USER(CALLBACK_METHOD2, ROW_INDEX2);
					CUS_SEND_DIALOG_TRY_DISMISS();
				}
			}
			else
			{
				HTTP_SYSTEM_SALES_BY_USER(CALLBACK_METHOD2, ROW_INDEX2);
				CUS_SEND_DIALOG_TRY_DISMISS();
			}
		}

		// Initialize
		// _______________________________________________________________________	
		var WEBTABLE_DATE = null;
		HTTP_LOAD_CASH_INOUT(CALLBACK_METHOD, ROW_INDEX);
	
	}

	function HTTP_SYSTEM_SALES_BY_USER(CALLBACK_METHOD, R_INDEX)
	{
		POS_SHIFT_DGV.CELL.VALUE('TOTAL_SALES', R_INDEX - 1, '0.00');
		POS_SHIFT_DGV.CELL.VALUE('TOTAL_SHORT_OVER', R_INDEX - 1, '0.00');
		POS_SHIFT_DGV.CELL.VALUE('TOTAL_SYSTEM', R_INDEX - 1, '0.00');
		console.log('aw');

		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_SALE_LIST.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_ACC_ACCOUNT_ID', JSVC_NUM.VAR_NVALL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_ACC_ACCOUNT_ID", R_INDEX - 1)));
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSSALE_DATE_TRANSACT_FROM', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_TRANSFLOW_SUMMARY_DATE_FROM"), "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_REC_TRANSFLOW_SUMMARY_DATE_TO"), "YYYY-MM-DD") + " 23:59:59.999999");
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_TRANSFLOW_SUMMARY_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_REC_TRANSFLOW_SUMMARY_ACC_GROUP_ID_CMB")));
		}

		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, RESPONSE_STRING)
			{
				// Validate
				// _______________________________________________________________________
				if(IS_SUCCESS === false)
				{
					alert("CONNECTION ERROR: \n" + RESPONSE_STRING);
					CALLBACK_METHOD(false);
					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);
					CALLBACK_METHOD(false);
					return;
				}
				
				// JSON Empty (Clears the DataGrodView)
				// _______________________________________________________________________
				if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
				{
					CALLBACK_METHOD(true);
					return;
				}
				// Read Response And Assign ID
				// ...........................................
				else
				{
					var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");
					var COUNTER = 1;
					while(COUNTER <= JSON_COUNT)
					{
						POS_SHIFT_DGV.CELL.VALUE("TOTAL_SALES", R_INDEX - 1,
							JSVC_NUM.VAR_CFORMAT(
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE('TOTAL_SALES', R_INDEX - 1)) +
					    		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))
							));

						COUNTER++;
					}

					POS_SHIFT_DGV.CELL.VALUE
					(
						"TOTAL_SYSTEM",
						R_INDEX - 1,
						JSVC_NUM.VAR_CFORMAT
						(
							(
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_BEGIN", R_INDEX - 1)) +
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("TOTAL_SALES", R_INDEX - 1)) +
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_IN", R_INDEX - 1))
							) -
							(
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_OUT", R_INDEX - 1))
							)
						)
					);
					
					POS_SHIFT_DGV.CELL.VALUE
					(
						"TOTAL_SHORT_OVER",
						R_INDEX - 1,
						JSVC_NUM.VAR_CFORMAT
						(
							(
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("TOTAL_CB", R_INDEX - 1)) +
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_OUT", R_INDEX - 1))
							) -
							(
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_BEGIN", R_INDEX - 1)) +
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("TOTAL_SALES", R_INDEX - 1)) +
								JSVC_NUM.VAR_NVAL(POS_SHIFT_DGV.CELL.VALUE("REC_SHIFT_CASH_IN", R_INDEX - 1))
							)
						)
					);

					CALLBACK_METHOD(true);
				}
			};

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_SALE_LIST.CUS_GET_ALL
		(
			GET_MAP_ARRAY,
			RESPONSE_HANDLER,
			true
		);
	}


FORM_INITIALIZE();
FORM_LOAD();