DO SET_MENU

= GET_PDT('*** RTO BOOK WITH US ***')

SELECT CLIENT.CLIENT_NO,CLIENT.CLIENT,CLIENT.MODELCOLNO,CLIENT.PHONE_O,CLIENT.VEHICLE_NO,CLIENT.RTOPAIDON, ;
	CLIENT.PHONE_R,CLIENT.MOBILE,CLIENT.RTORECVDDT, ;
	BOOKING.HPA_NAME,BOOKING.SPECIAL_NO,AGENT.AGENT,CLIENTINFO.CLIREMARK, ;
	000000000.00 as balance ;
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.RTOISSUEDT) AND ! EMPTY(CLIENT.RTORECVDDT) ;
ORDER BY CLIENT.RTORECVDDT, CLIENT.CLIENT ;
INTO CURSOR QUERY readwrite

PRIVATE lndbamt,lncramt
STORE 000000000.00 TO lndbamt,lncramt

SELECT QUERY
GO TOP
SCAN

	LNDBAMT = CLICRAMT(QUERY.CLIENT_NO)
	LNCRAMT = CLIDRAMT(QUERY.CLIENT_NO)
	
	REPLACE QUERY.BALANCE WITH (LNCRAMT - LNDBAMT)
	
	SELECT QUERY
ENDSCAN 

DO PRINREPO WITH 'WRTOBOOK','RTOBOOKU'

USE IN query 

DO CLS_MENU
