PROCEDURE prin_dc

**** Change Done on 21/04/98 For Multiple DC Printing

PRIVATE lnsale_rec,lnamt_recvd
IF ALIA() <> 'SALEMAST'
	RETU
ENDIF

if ! empt(salemast.prindcflg)
	resp = 1
	do alert with 'DC was Printed Successfully;;do you want to print this DC ?',1,'\<No;\<Yes',resp
	if resp = 1
		retu .f.
	endif
ENDIF
IF EMPTY(salemast.actualdcdt)
	resp = 1
	do alert with 'Blank Actual DC Date Found ;;do you want to print this DC ?',1,'\<No;\<Yes',resp
	if resp = 1
		retu .f.
	ENDIF
ENDIF 	
lnsale_rec = RECN('SALEMAST')
lnamt_recvd = 0
= get_oprin('Delivery Challan Printing')
SELE salemast
lncredit_amt = clicramt(client_no)
lnamt_recvd = getrecpt(salemast.client_no)
IF ! SEEK(salemast.client_no,'CLIENT','CLIENT_NO')
	DO err_msg WITH 'Client Information was not found for this Client' + CHR(13) + 'Printing will not be done'
	RETURN .F.
ENDIF 
IF ! EMPTY(salemast.ref_no)
	IF ! SEEK(salemast.ref_no,'VEHICLE','REF_NO')
		IF ! EMPTY(salemast.ref_no)
			DO err_msg WITH 'Vehicle Chasis No. was not found' + CHR(13) + 'DC will not be printed'
			RETURN .F.
		ENDIF 
	ENDIF 
	IF ! SEEK(vehicle.supplier_n,'LEDGER','ACCOUNT_NO')
		do err_msg with 'SUPPLIER WAS NOT FOUND FOR THIS VEHICLE'
	ENDIF
ENDIF 
IF SEEK(salemast.client_no,'CRTM','CLIENT_NO')
ENDIF
SELECT client
IF SEEK(CLIENT.MODELCOLNO,'MODELCOL','MODELCOLNO')
	IF SEEK(MODELCOL.MODEL_NO,'MODEL','MODEL_NO')
	ENDIF 
ENDIF
SELECT salemast
IF EMPTY(gcdcname)
	DO prinrepo WITH 'WDELIVERY','DELIVERY','','',1
ELSE
	lcrepnam = gcdcname + '.FRX'
	IF ! FILE(lcrepnam)			
		MESSAGEBOX("Please copy REPORT file and try again ...","AUTOSOFT",0+64)
	ELSE 			
		DO prinrepo WITH gcdcname,gcdcname,'','',1
	ENDIF 			
ENDIF 
GO (lnsale_rec) in salemast
IF RLOC('SALEMAST')
	REPL salemast.dcamtrecvd WITH lnamt_recvd
	IF out_typ = 'PRINT (DOS)' OR out_typ = 'Modify & Print' OR out_typ = 'PRINT (WIN)'
		REPLACE salemast.prindcflg WITH 'Y'
	ENDIF
	UNLO IN salemast
ENDIF
SELECT salemast
