do set_menu
= get_pupto('RTO Book Pending From Agent ....')
wait wind '!!! WAIT !!! Gathering Data Uing SQL...' nowa

do wait_msg

SELECT CLIENT.CLIENT,CLIENT.CLIENT_NO,CLIENT.MODELCOLNO,CLIENT.VEHICLE_NO,CLIENT.SALEBILLDT, ;
	CLIENT.SALEBILLNO,CLIENT.chasis_NO,CLIENT.ENGINE_NO,client.RTOPAIDON,booking.rtodocno, ;
	booking.hpa_name,booking.special_no,agent.agent,clientinfo.cliremark ;
FROM CLIENT LEFT JOIN booking ON client.client_no = booking.client_no ;
	 LEFT JOIN CLIENTINFO ON client.client_no = CLIENTINFO.client_no ;
	 LEFT JOIN agent ON booking.agent_no = agent.agent_no ;
WHERE ! EMPTY(client.rtopaidon) ;
	AND EMPTY(client.rtorecvddt) ;
ORDER BY client.rtopaidon,client.vehicle_no ;
INTO CURS QUERY 
	
IF _tally >= 1 then
	DO prinrepo WITH 'WRTOAPEN','RTOAPEND','','',''
ELSE
	DO ATTENTION WITH 'Record Not Found Given Period'
ENDIF
DO CLS_MENU