IF BOF() OR EOF()
	DO err_beep
	DO alert WITH '!!! ERROR !!!;No receipt found for printing;;Pressed key has no menaning here'
	RETU
ENDIF
&&& Receipt for Party Collection (cheque on Hand method) where client & booking is not involved
IF receptType = 'PARTY'
	IF ! SEEK(receipt.creditAc,'ledger','account_no')
		DO err_msg WITH 'CREDIT ACCOUNT PARTY INFORMATION IS NOT FOUND' + 'PRINTING IS TERMINATED'
		RETURN 
	ENDIF 
	= wget_pnam("PARTY PAYMENT RECEIPT")
	PRIVATE lnrecpt_rec
	lnrecpt_rec = RECNO('receipt')
	DO prinRepo WITH 'wShowroomPartyRecpt','','','',1
	GO (lnrecpt_rec) IN receipt
	RETURN 
ENDIF

IF EMPTY(gcsrname)
	DO err_msg WITH '!!! SORRY !!!' + CHR(13) + 'SALES RECEIPT FORMAT IS NOT DEFINED' + CHR(13) + 'DEFINE IT FROM' + CHR(13) + 'MASTER-->CONFIGURE COMPANY--> SALES RECEIPT NAME' + CHR(13) + 'FOR WINDOWS *WSALESRECEIPT   & DOS  RECEPT_1'
	RETURN 
ENDIF 
PRIVATE lnrecpt_rec,lcrepnam,lnnoofcopies,lcAgent,lcrepnamstaryesno
lcAgent = ' '
lnrecpt_rec = RECN('RECEIPT')
STORE 1 TO lnnoofcopies
SELE receipt
lnamt_recvd = getrecpt(receipt.client_no)
GO lnrecpt_rec IN receipt
IF SEEK(receipt.client_no,'SALEMAST','CLIENT_NO')
ENDIF
IF SEEK(receipt.client_no,'CLIENT','CLIENT_NO')
ENDIF
IF SEEK(ALLTRIM(client.modelcolno),'MODELCOL','MODELCOLNO')
	IF SEEK(MODELCOL.MODEL_NO,'MODEL','MODEL_NO')
	ENDIF 
ENDIF 
IF ! SEEK(receipt.client_no,'BOOKING','CLIENT_NO')
	DO err_msg WITH 'Booking INFO was not found' + CHR(13) + 'RECEIPT will not be printed'
	RETURN
ELSE
	if ! EMPTY(booking.agent_no)
		if SEEK(booking.agent_no,'agent','agent_no')
			lcAgent = agent.agent
		ELSE
			do err_msg with 'Agent was not found in agent master'
		endif
	endif
ENDIF

*****************************************************************************************************************

IF ';' $ gcsrname
	DEFINE wind  get_recpt from 0,0 to 6,70 pane
	ACTIVATE wind get_recpt 
	MOVE wind  get_recpt cent
	@ 2,2 say 'Invoice File : ' 

	lcrepnam = subs(gcsrname,1,at(';',gcsrname) - 1)
	@ 1,20 get lcrepnam pict '@^ ' + allt(gcsrname) size 3,14
	READ 
	RELEASE wind get_recpt
ELSE 
	lcrepnam = allt(gcsrname)
ENDIF
lcrepnamstaryesno = ALLTRIM(lcrepnam)



*****************************************************************************************************************
*lcrepnam = ALLTRIM(gcsrname)

IF ',' $ lcrepnam
	lnnoofcopies  = VAL(SUBSTR(lcrepnam,AT(',',lcrepnam) + 1))
	lcrepnam = SUBSTR(lcrepnam,1,AT(',',lcrepnam) -1)
ENDIF 
IF LNNOOFCOPIES > 1 AND LEFT(lcrepnam,1) <> '*'
	no_copies = LNNOOFCOPIES
	LNNOOFCOPIES = 1
ELSE 
	no_copies = 1
	LNNOOFCOPIES = 1
ENDIF


IF EMPTY(gcsrname) OR EMPTY(lcRepNam) OR (lcRepNam = '*' AND LEN(lcRepNam) = 1) 
	IF LEFT(lcrepnamstaryesno,1) = '*'
		out_typ = 'PRINT (WIN)'
	ELSE
		out_typ = 'PRINT (DOS)'
	ENDIF	
	PRIVATE I
	FOR I = 1 TO LNNOOFCOPIES
		IF LEFT(lcrepnamstaryesno,1) = '*'
			lcrepnam = SUBSTR(lcrepnam,2)
			DO prinrepo WITH lcRepNam,'','','',1			
		ELSE 
			DO prinrepo WITH '',lcrepnam,'','',1			
		ENDIF
		GO (lnrecpt_rec) IN receipt
	ENDFOR
ELSE

	IF lcrepnamstaryesno = '*' 
		out_typ = 'PRINT (WIN)'
		lcrepnam = SUBSTR(lcrepnam,2)
	ELSE
		out_typ = 'PRINT (DOS)'
	ENDIF
	
	IF ! ('.FRX' $ UPPER(lcrepnam))
		lcrepnam = ALLTRIM(lcrepnam) + '.FRX'
	ELSE
		lcrepnam = ALLTRIM(lcrepnam)
	ENDIF
	
	IF ! FILE(lcrepnam)
		DO ERR_MSG WITH 'REPORT FILE : ' + ALLTRIM(lcrepnam ) + ' DOES NOT EXIST' + CHR(13) + 'REPORT WILL NOT BE PRINTED'
		GO (lnrecpt_rec) IN receipt
		RETURN 
	ENDIF		

	PRIVATE I
	FOR I = 1 TO LNNOOFCOPIES
		IF lcrepnamstaryesno = '*'
			DO prinrepo WITH lcRepNam,'','','',1			
		ELSE
			DO prinrepo WITH '',LCREPNAM,'','',1			
		ENDIF
		GO (lnrecpt_rec) IN receipt
	ENDFOR
ENDIF
GO (lnrecpt_rec) IN receipt