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

*DO WAIT_MSG
WAIT WIND '!!! WAIT !!! GATHERING DATA USING SQL ...' NOWA

SELECT 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.PAID_01_ST,WARRANTY.PAID_02_ST,WARRANTY.PAID_03_ST,WARRANTY.PAID_04_ST,;
	WARRANTY.PAID_05_ST,WARRANTY.PAID_06_ST,WARRANTY.PAID_07_ST,WARRANTY.PAID_08_ST,;
	WARRANTY.FREE_01_ST,WARRANTY.FREE_02_ST,WARRANTY.FREE_03_ST,WARRANTY.FREE_04_ST,;
	WARRANTY.FREE_05_ST,WARRANTY.FREE_06_ST,WARRANTY.FREE_07_ST,WARRANTY.FREE_08_ST,;
	WARRANTY.MALF_KM,WARRANTY.MALF_DT,;
	WARRANTY.CLAIM_NO,ITEMMAST.ITEM,WR_BODY.ITEM_NO,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

IF _TALLY > 0
	WAIT WINDOW 'GENERATING REPORT.........' NOWAIT
*	DEACTIVATE WINDOW WAIT 	
	DO PRINREPO WITH 'WWARC_TAG','WARC_TAG','','',0,.F.
ENDIF
DO CLS_MENU



*!*	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,;
*!*		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,;
*!*		WR_BODY.ITEM_NO,WR_BODY.QTY,WR_BODY.REPLREASON,;
*!*		DEALER.DEALER,DEALER.D_ADD1,DEALER.D_ADD2,DEALER.D_ADD3,DEALER.D_CITY,DEALER.D_PIN;
*!*		FROM WARRANTY,WR_BODY,CLIENT,ITEMMAST,DEALER;
*!*		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;
*!*			AND CLIENT.DEALER_COD = DEALER.DEALER_COD;
*!*		ORDER BY WARRANTY.CLAIM_NO;
*!*		INTO CURSOR QUERY
