
	/** 
	 * =======================================================================================================
	 * Perform SQL GET request to the table RECORD_INVOICE. Returns DataSet.
	 *
	 * @param VAR_PARAMETER_ARRAY String() Array with Request ParameterSet.
	 * @param CALLBACK_ADDRESS(bool, String) A callback method when the server response is received.
	 *
	 * @param SQL_KEEP_PARAMETER_TO_CACHE bool (Optional) If TRUE save to cache, for easier paging request.
	 * =======================================================================================================
	 */
	JSCUS_SQL._RECORD._INVOICE.CUS_SALES_REPORT = function
	(
		VAR_PARAMETER_ARRAY,
		CALLBACK_ADDRESS,
		
		SQL_KEEP_PARAMETER_TO_CACHE
	)
	{
		// Parameter Validation
		// _______________________________________________________________________
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(VAR_PARAMETER_ARRAY, 'VAR_PARAMETER_ARRAY', 'ARRAY');
		
		// Handle Optionals
		// _______________________________________________________________________		
		SQL_KEEP_PARAMETER_TO_CACHE = JSVC_VAR.VAR_OPTIONAL(SQL_KEEP_PARAMETER_TO_CACHE, false);
		
		// Process SQL Request
		// _______________________________________________________________________
		var PARAM_SET = "";			
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_REC_INVOICE_ACC_GROUP_ID', VAR_PARAMETER_ARRAY["PARAM_REC_INVOICE_ACC_GROUP_ID"]);
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_REC_INVOICE_DATE_DELIVERY_FROM', VAR_PARAMETER_ARRAY["PARAM_REC_INVOICE_DATE_DELIVERY_FROM"]);
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_REC_INVOICE_DATE_DELIVERY_TO', VAR_PARAMETER_ARRAY["PARAM_REC_INVOICE_DATE_DELIVERY_TO"]);

		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_ORDER_FIELD', VAR_PARAMETER_ARRAY["PARAM_ORDER_FIELD"]);
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_ORDER_TYPE', VAR_PARAMETER_ARRAY["PARAM_ORDER_TYPE"]);
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_SKIP', VAR_PARAMETER_ARRAY["PARAM_SKIP"]);
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_LIMIT', VAR_PARAMETER_ARRAY["PARAM_LIMIT"]);
				
		// Copy Parameter To Cache
		// _______________________________________________________________________
		if(SQL_KEEP_PARAMETER_TO_CACHE == true)
		{
			JSCUS_SQL._RECORD._INVOICE.PROPERTY_CACHED_QUERY = VAR_PARAMETER_ARRAY;
		}
							
		// Send SQL Request
		// _______________________________________________________________________					
		CUS_SEND_REQUEST
		(
			CALLBACK_ADDRESS,
			JSCUS_CACHE.SERVER_URL + '/Record/invoice/sales_report',
			'',
			PARAM_SET
		);	
	};

	
	/** 
	 * =======================================================================================================
	 * Populate SP-GET request request parameters with default value.
	 * =======================================================================================================
	 */
	JSCUS_SQL._RECORD._INVOICE.CUS_PREPARE_MAPPED_ARRAY_FOR_SALES_REPORT = function()
	{
		// Initialize
		var RESULT_MAPARRAY = [];

		// Populate default fields
		RESULT_MAPARRAY["PARAM_REC_INVOICE_ACC_GROUP_ID"] = FLAG_BIGINT_NULL;
		RESULT_MAPARRAY["PARAM_REC_INVOICE_DATE_DELIVERY_FROM"] = FLAG_DATETIME_NULL;
		RESULT_MAPARRAY["PARAM_REC_INVOICE_DATE_DELIVERY_TO"] = FLAG_DATETIME_NULL;					

		RESULT_MAPARRAY["PARAM_ORDER_FIELD"] = "ACC_GROUP_DESCRIPTION";
		RESULT_MAPARRAY["PARAM_ORDER_TYPE"] = "ASC";
		RESULT_MAPARRAY["PARAM_SKIP"] = 0;
		RESULT_MAPARRAY["PARAM_LIMIT"] = JSCUS_CACHE.SITE_SHOW_RESULT_PER_PAGE_PLAIN_TEXT;
		
		// Return prepared MapArray
		return RESULT_MAPARRAY;
	};