PRIVATE LCFRM_NO,LCTO_NO
STORE SPACE(8) TO LCFRM_NO,LCTO_NO

DO SET_MENU

= GET_PNAM('WARRANTY CLAIM FORM')

DEFINE WINDOW LWFRMTO FROM 0,0 TO 14,78 
ACTIVATE WINDOW LWFRMTO
MOVE WINDOW LWFRMTO CENT

@ 1,2 SAY "FROM NO. : " GET LCFRM_NO 
@ 2,2 SAY "  TO NO. : " GET LCTO_NO 

LCFRM_NO = PADL(ALLTRIM(LCFRM_NO),8,'0')
LCTO_NO = PADL(ALLTRIM(LCTO_NO),8,'0')
READ
RELEASE WINDOWS LWFRMTO

IF LCFRM_NO > LCTO_NO
	MESSAGEBOX("TO NUMBER IS ALWAYS MORE THEN FROM NUMBER")
	DO CLS_MENU
ENDIF

WAIT WIND '!!! WAIT !!! GATHERING DATA USING SQL ...' NOWA

SELECT CLIENT.CLIENT,CLIENT.ADD1,CLIENT.ADD2,CLIENT.ADD3,CLIENT.CITY,CLIENT.PIN,CLIENT.PHONE_R,;
	CLIENT.VEHICLE_NO,CLIENT.CHASIS_NO,CLIENT.ENGINE_NO,CLIENT.SALE_DT,CLIENT.DEALER_COD,;
	WARRANTY.FREE_01_KM,WARRANTY.FREE_02_KM,WARRANTY.FREE_03_KM,WARRANTY.FREE_04_KM,;
	WARRANTY.FREE_05_KM,WARRANTY.FREE_06_KM,WARRANTY.FREE_07_KM,WARRANTY.FREE_08_KM,;
	WARRANTY.PAID_01_KM,WARRANTY.PAID_02_KM,WARRANTY.PAID_03_KM,WARRANTY.PAID_04_KM,;
	WARRANTY.PAID_05_KM,WARRANTY.PAID_06_KM,WARRANTY.PAID_07_KM,WARRANTY.PAID_08_KM,;
	WARRANTY.FREE_01_DT,WARRANTY.FREE_02_DT,WARRANTY.FREE_03_DT,WARRANTY.FREE_04_DT,;
	WARRANTY.FREE_05_DT,WARRANTY.FREE_06_DT,WARRANTY.FREE_07_DT,WARRANTY.FREE_08_DT,;
	WARRANTY.PAID_01_DT,WARRANTY.PAID_02_DT,WARRANTY.PAID_03_DT,WARRANTY.PAID_04_DT,;
	WARRANTY.PAID_05_DT,WARRANTY.PAID_06_DT,WARRANTY.PAID_07_DT,WARRANTY.PAID_08_DT,;
	WARRANTY.JOBCARD_DT,WARRANTY.JOBCARD_NO,WARRANTY.MALF_KM,WARRANTY.MALF_DT,;
	WARRANTY.REPAIR_KM,WARRANTY.REPAIR_DT,WARRANTY.CLAIM_NO,WARRANTY.CLAIM_DT,ITEMMAST.ITEM,;
	WARRANTY.SYMPTOMS,WR_BODY.ITEM_NO,WR_BODY.QTY,WR_BODY.REPLREASON ;
		FROM WARRANTY,WR_BODY,CLIENT,ITEMMAST ;
	WHERE BETWEEN(WARRANTY.CLAIM_NO,LCFRM_NO,LCTO_NO );
		AND	WARRANTY.CLAIM_NO = WR_BODY.CLAIM_NO;
		AND	WARRANTY.CLIENT_NO = CLIENT.CLIENT_NO;
		AND	WR_BODY.ITEM_NO = ITEMMAST.ITEM_NO;
	ORDER BY WARRANTY.CLAIM_NO;
	INTO CURSOR QUERY
SELECT QUERY
INDEX ON DEALER_COD TAG DEALER_COD ADDI
SET ORDER TO DEALER_COD IN DEALER
SET RELATION TO DEALER_COD INTO DEALER ADDI 

SELECT QUERY
IF _TALLY > 0
	WAIT WINDOW 'GENERATING REPORT.........' NOWAIT
	DO PRINREPO WITH 'WWAR_CLAI','WAR_CLAI','','',0,.F.
ENDIF
USE IN QUERY

DO CLS_MENU