PROCEDURE importbooking

PRIVATE lcdrive_nam,ldfrom_dt,ldto_dt
lcdrive_nam = 'A'
ldfrom_dt = {  /  /    }
ldto_dt = {  /  /    }

DO set_menu
CLEAR
@ 10,10 say 'Drive Name : ' get lcdrive_nam pict '@!' size 1,1 valid between(lcdrive_nam,'A','Z')
@ 14,10 say 'From Date : ' get ldfrom_dt size 1,10
@ 16,10 say 'To Date   : ' get ldto_dt size 1,10
READ
IF ! FILE(lcdrive_nam + ':\BOOKING.DBF')
	DO alert WITH 'BOOKING Exported File Does not exist;Either Wrong Drive is mentioned or Floppy is not working'
ELSE 
	IF ! FILE(lcdrive_nam + ':\CLIENT.DBF')
		DO alert WITH 'CLIENT Exported File Does not exist;Either Wrong Drive is mentioned or Floppy is not working'
	ELSE 
		USE lcdrive_nam + ':\BOOKING.DBF' IN 0 ALIAS IMPBOOK
		USE lcdrive_nam + ':\CLIENT.DBF' IN 0 ALIAS IMPCLIENT
		SELECT IMPBOOK
		SCAN FOR BETWEEN(booking_dt,ldfrom_dt,ldto_dt)
			IF ! SEEK(IMPBOOK.CLIENT,'CLIENT','CLIENT')
				DO ADD_booking IN importBOOKING
			ELSE
			   DO ALERT WITH 'For this booking Client ' + ALLTRIM(impbook.client)  + CHR(13) + +' Already exists in client info' + CHR(13) + 'So Booking No. ' + impbook.booking_no + ' will not be Imported'
			ENDIF 
		ENDSCAN 
		USE IN IMPBOOK
		USE IN IMPCLIENT 
		DO alert WITH 'Operation Completed Successfully'
	ENDIF	
ENDIF 
DO cls_menu

PROCEDURE ADD_booking

PRIVATE lcclient_no,lcbook_no
lcclient_no = ''
lcbook_no = '' 
IF SEEK(IMPBOOK.CLIENT_NO,'IMPCLIENT','CLIENT_NO')
    SELECT IMPCLIENT
    SCATTER MEMV
ENDIF
= next_no('CLIENT','CLIENT_NO','CLIENT_NO',lcclient_no)
m.client_no =lcclient_no
INSERT INTO client FROM MEMVAR 
SELECT impbook
SCATTER memv
= next_no('BOOKING','BOOKING_NO','BOOKING_NO',lcbook_no)
m.booking_no = lcbook_no
m.client_no =lcclient_no
INSERT INTO booking FROM MEMVAR 
SELECT impbook