	PRIVATE LNYESNO,LCJOB_NO,LCISSUENO
	STORE " " TO LCJOB_NO,LCISSUENO
	
	LNYESNO = 0
	LNYESNO = MESSAGEBOX("Before runing this option there should nor be any pending Job Card with Material issue" + CHR(13) + CHR(13) + " So Please COMPLETE ALL PENDING JOBCARD and run this option ...","AUTOSOFT",4+64)
	IF LNYESNO = 7
		RETURN .F.
	ENDIF 
	USE IN ISSUE
	USE IN ISSUEBOD
				
	IF ! USEDBF(YEAR_PATH,'ISSUE','','',.F.,.T.,.T.,MPROG_PATH + '\YEARSTRU\',.F.)
		RETU .F.
	ENDIF 		

	SELECT ISSUE
	ZAP IN issue 
	IF ! USEDBF(YEAR_PATH,'ISSUEBOD','','',.F.,.T.,.T.,MPROG_PATH + '\YEARSTRU\',.F.)
		RETU .F.
	ENDIF

	SELECT ISSUEBOD
	ZAP  IN issuebod
	
	SELECT JOB_BODY
	SET ORDE TO JOBCARD_NO
	SET ORDER TO JOBCARD_NO IN JOB_MAST
	SET RELATION TO JOBCARD_NO INTO JOB_MAST ADDITIVE 
	LCJOB_NO = "*"
	LCISSUENO = " "
	lcissue_seq = ''
	BROWSE FOR ! EMPTY(spare_rt) OR ! EMPTY(oil_rt) OR ! EMPTY(warranty)
	SCAN FOR ! EMPTY(spare_rt) OR ! EMPTY(oil_rt) OR ! EMPTY(warranty)
		IF LCJOB_NO <> JOB_BODY.JOBCARD_NO
			= next_no('ISSUE','ISSUE_NO','ISSUE_NO',LCISSUENO,'0',.T.)
			SELECT JOB_BODY
			lcjob_no = job_mast.jobcard_no
			lcissue_seq = '001'
			INSERT INTO ISSUE (issue_no,issue_dt,jobcard_no,pay_mode,godown_no) ;
				VALUES ;
			(lcissueno,job_mast.job_dt,job_mast.jobcard_no,job_mast.pay_mode,"01")
		ENDIF 
		INSERT INTO ISSUEBOD ;
			(issue_no,issue_seq,item_no,spare_rt,labour_rt,oil_rt, ;
			warranty,qty,st_rt,amount,cd_rt,sd_rt,cd_amt,sd_amt,JOB_NO) ;
		VALUES ;
			(lcissueno,lcissue_seq,job_body.item_no,job_body.spare_rt,job_body.labour_rt,;
			job_body.oil_rt,job_body.warranty,job_body.qty,job_body.ST_RT,job_body.amount,job_body.cd_rt,;
			job_body.sd_rt,job_body.cd_amt,job_body.sd_amt,LCJOB_NO)
		lcissue_seq = PADL(ALLTRIM(STR(VAL(lcissue_seq) + 1)),3,'0')
		SELECT JOB_BODY
	ENDS
