= get_pdt('*** R.T.O. RECEIPT CLIENT LIST ***')
WAIT WINDOW "!!! WAIT !!! Gathering data Using SQL ... " NOWA
DO WAIT_MSG
SELECT RTOINSURANCE.TRAN_DT,RTOINSURANCE.DOC_NO,CLIENT.CLIENT,CLIENT.MODELCOLNO, ;
	CLIENT.CHASIS_NO,CLIENT.ENGINE_NO,CLIENT.RTORECPTNO,CLIENT.RTORECVDDT, ;
	CLIENT.RTOPAIDON,CLIENT.VEHICLE_NO ;
FROM RTOINSURANCE,RTOINSBODY,CLIENT ;
WHERE RTOINSURANCE.DOC_NO = RTOINSBODY.DOC_NO ;
	AND RTOINSBODY.CLIENT_NO = CLIENT.CLIENT_NO ;
	AND BETWEEN(RTOINSURANCE.TRAN_DT,DATE1,DATE2) ;
	AND ! EMPTY(CLIENT.RTORECPTNO) ;
ORDER BY RTOINSURANCE.TRAN_DT,CLIENT.CLIENT ;
INTO CURSOR QUERY

SELECT QUERY
IF _TALLY > 0
	WAIT WINDOW "!!! WAIT !!! Generating Report .. " nowa
	REPORT FORM RTOLIST TO (OUT_FILE) NOCO
	DEACTIVATE WINDOW WAIT
	DO OUT_REPO
ELSE
	DEACTIVATE WINDOW WAIT
	DO ALERT WITH "No Record found for given Period .. "
ENDIF