*PROCEDURE prindirect

PARAMETER mbill_no


PRIVATE lntotcounter
STORE 0 TO lntotcounter

SELECT job_body
COUNT TO lntotcounter FOR jobcard_no = 'DS'
IF lntotcounter <= 0
	MESSAGEBOX("Pressed key has no meaning here ..","AUTOSOFT",0+16)
	RETURN .f.
ELSE
	PRIVATE cur_rec,lcjobcard_no,lcjobmast_ord,lcret_name
	lcjobcard_no = ' '
	lcjobmast_ord = ORDE('JOB_MAST')
	cur_rec = RECN('JOB_MAST')
	WAIT WIND '!!! WAIT !!! Generating Report ...' NOWA
	IF profseek(mbill_no,'JOB_MAST','BILL_NO')
		lcjobcard_no = job_mast.jobcard_no
		lcret_name = job_mast.retail_nam
	ENDIF
	IF profseek(lcjobcard_no,'ISSUE','JOBCARD_NO')
		IF ! profseek(issue.godown_no,'GODOWN','GODOWN_NO')
			DO alert WITH 'There was problem in getting godown info.'
		ENDIF
	ENDIF
	SELE job_body
	LOCA FOR jobcard_no = lcjobcard_no
	IF FOUND()
		SET ORDE TO item_no IN itemmast
		SET RELA TO item_no INTO itemmast ADDI
		*	set orde to jobcard_no in job_mast
		*	set rela to jobcard_no into job_mast addi
		SET ORDE TO account_no IN ledger
		= get_oprin('DIRECT SALES BILL PRINTING')
		_PADVANCE = 'LINEFEED'
		*	if job_mast.bill_no <> 'C'
		REPO FORM it_bill FOR jobcard_no = lcjobcard_no TO (out_file) NOCO
		*	else
		*		repo form it_esti for jobcard_no = lcjobcard_no to (out_file) noco
		*	endif
		_PADVANCE = 'FORMFEED'
		*	set rela off into job_mast
		SET RELA OFF INTO itemmast
		*	sele job_mast
		*	set orde to (lcjobmast_ord)
	ENDIF
	*go (cur_rec)
	DO out_repo
ENDIF 
