

	function DAILY_SALES()
	{
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		JSVC_MAP_ARRAY.VAR_SET
		(
			GET_MAP_ARRAY, 'PARAM_REC_JORDER_DATE_COMPLETE_FROM', 
			JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD 00:00:00.000000")
		);
		JSVC_MAP_ARRAY.VAR_SET
		(
			GET_MAP_ARRAY, 'PARAM_REC_JORDER_DATE_COMPLETE_TO', 
			JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD 23:59:59.999999")
		);
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_USER_ASSIGN', JSVC_NUM.VAR_NVALL(JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ID));
		//JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_LONG_B_FROM', 0);
		//JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_LONG_B_TO', 0);
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_STATUS', 4);

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET
		(
			GET_MAP_ARRAY,
			DAILY_SALES_CALLBACK,
			true
		);
	}

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

		// 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)
		{
			alert("No transaction/s found");
			return;
		}

		// Populate DGV
		// _______________________________________________________________________
		var Smry = '';
		Smry += '<table border="0" style="width: 100%; border-collapse: collapse; font-size: 10px; margin-bottom: 0 !important;">';
		Smry += '<tr><td style="text-align: center;">Daily Sales</td></tr>';
		Smry += '<tr><td></td></tr>';
		Smry += '<tr><td style="text-align: left;">Agent: '+JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_NAME+'</td></tr>';
		Smry += '<tr><td style="text-align: left;">Date: '+JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD HH:mm:ss")+'</td></tr>';
		Smry += '</table>';

		Smry += '<table border="0" style="width: 100%; border-collapse: collapse; font-size: 10px; margin-bottom: 0 !important;">';
		Smry += '<tr><th style="text-align: left;">Customer</th> <th style="text-align: right;">Sub-Total</th></tr>';

		var ROW_INDEX = 1;
		var TOTAL = 0;
		var NAME = '';
		var CTR = JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT"));
		while(ROW_INDEX <= CTR)
		{
			NAME = 	JSRC_JSON.REF_READ(JSON_OBJECT, "REC_CLIENT_FIRSTNAME", ROW_INDEX) + ' ' + JSRC_JSON.REF_READ(JSON_OBJECT, "REC_CLIENT_LASTNAME", ROW_INDEX);
			Smry += '<tr><td style="text-align: left;">'+NAME+'</td>';
			Smry += '<td style="text-align: right;">'+JSVC_NUM.VAR_CFORMAT(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_AMOUNT", ROW_INDEX))+'</td></tr>';
			TOTAL += JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_AMOUNT", ROW_INDEX));
			ROW_INDEX++;
		}

		Smry += '<tr><td></td><td style="text-align: right;">Total : '+JSVC_NUM.VAR_CFORMAT(TOTAL)+'</td></tr>';
		Smry += '</table>';

		Android.CALL('PRINT', '<html><body>' + Smry + '</body></html>');
	}

	FORM_INITIALIZE2();