PARAMETERS pcclient_no

PRIVATE LCCLINO,LCALIAS
LCALIAS = ALIAS()
LCCLINO = pcclient_no

SELECT salemast.dc_no,salemast.dc_dt,salemast.expecteddt,salemast.kms,client.client,client.chasis_no,client.engine_no, ;
	booking.hpa_name,booking.salesman,booking.accessory,crtm.TmpRegiNo ;
FROM salemast JOIN client ON salemast.client_no = client.client_no ;
	JOIN booking ON salemast.booking_no = booking.booking_no ; 
	LEFT JOIN CRTM ON SALEMAST.client_no = crtm.client_no ; 
WHERE salemast.client_no = pcclient_no ;
INTO CURSOR smdcprint readwrite

SELECT smdcprint 
REPLACE ALL TMPREGINO WITH IIF(TMPREGINO = '.NULL.',ISNULL(tmpregino),' ')

LNHANDEL = FCREATE('BARCODE.PRN',0)
IF LNHANDEL > 0
	=FPUTS(LNHANDEL,'')			
	=FPUTS(LNHANDEL,'')			
	=FPUTS(LNHANDEL,'Q412,019')
	=FPUTS(LNHANDEL,'q831')
	=FPUTS(LNHANDEL,'rN')
	=FPUTS(LNHANDEL,'S4')
	=FPUTS(LNHANDEL,'D7')
	=FPUTS(LNHANDEL,'ZT')
	=FPUTS(LNHANDEL,'JB')
	=FPUTS(LNHANDEL,'OD')
	=FPUTS(LNHANDEL,'R111,0')
	=FPUTS(LNHANDEL,'N')
	=FPUTS(LNHANDEL,'A24,49,0,4,1,1,N,"DC No.: ' + ALLTRIM(DC_NO) +  '"')
	=FPUTS(LNHANDEL,'A24,80,0,4,1,1,N,"DC Date: ' +  DTOC(dc_dt) +  '"')
	=FPUTS(LNHANDEL,'A24,110,0,4,1,1,N,"Name: ' + ALLTRIM(client) +  '"')
	=FPUTS(LNHANDEL,'A24,139,0,4,1,1,N,"Chasis: ' + ALLTRIM(chasis_no) +  '"')
	=FPUTS(LNHANDEL,'A24,170,0,4,1,1,N,"Engine: ' + ALLTRIM(engine_no) +  '"')
	=FPUTS(LNHANDEL,'A24,200,0,4,1,1,N,"Hpa: ' + ALLTRIM(hpa_name)  +  '"')
	=FPUTS(LNHANDEL,'A24,231,0,4,1,1,N,"Executive: ' + ALLTRIM(salesman) +  '"')
	=FPUTS(LNHANDEL,'A24,263,0,4,1,1,N,"Delivery Date: ' + DTOC(expecteddt) +  '"')
	=FPUTS(LNHANDEL,'A25,296,0,4,1,1,N,"Acc.: ' + ALLTRIM(STR(accessory)) +  '"')
	=FPUTS(LNHANDEL,'A233,293,0,4,1,1,N,"TMP.Reg.:  ' + ALLTRIM(TmpRegiNo) +  '"')
	=FPUTS(LNHANDEL,'A411,223,0,5,1,1,N,"KEY"')
	=FPUTS(LNHANDEL,'A23,324,0,4,1,1,N,"Dealer : ' + ALLTRIM(gccompany) + '"')
	=FPUTS(LNHANDEL,'P1')
	=FPUTS(LNHANDEL,'')			
	= FCLOSE(LNHANDEL)
	RUN type barcode.prn > prn
ENDIF 

IF ! EMPTY(LCALIAS)
	SELECT (LCALIAS)
ENDIF

