private lcoil_name,lnoil_rate,lnsrv_rate,lcjobcard_no,lnjob_rec,lcmechanic,lcsupname,lcteam, ;
	ldnext_dt,lnnxt_kms,lcsrvtype,lcsrvseq

wait wind '!!! WAIT !!! Generating Report ...' nowa
store {  /  /  } to ldnext_dt
store ' ' to  lcoil_name,lcmechanic,lcsrvtype,lcsrvseq
store 00000 to lnnxt_kms
store 0000.00 to lnoil_rate,lnsrv_rate
lcjobcard_no = job_mast.jobcard_no
lnjob_rec = recn('JOB_MAST')
if profseek(job_mast.mechanicno,'MECHANIC','MECHANICNO')
	lcmechanic = mechanic.mechanic
*!*		if profseek(mechanic.sup_code,'TEAMMAST','SUP_CODE')
*!*			lcsupname = teammast.supervisor
*!*			lcteam = teammast.team_name
*!*		endif
endif

sele issue.jobcard_no,issue.issue_no,itemmast.item,itemmast.itemtype,itemmast.balance, ;
	issuebod.spare_rt as rate,issuebod.amount,issuebod.spare_rt,issuebod.labour_rt, ;
	issuebod.oil_rt,issuebod.pay_mode,issuebod.warranty,issuebod.qty, ;
	issuebod.st_rt,issuebod.wty_code,issuebod.old_code,issuebod.issue_seq ;
	from issue,issuebod,itemmast ;
	where issue.jobcard_no = lcjobcard_no ;
		and issue.issue_no = issuebod.issue_no ;
		and issuebod.item_no = itemmast.item_no ;
	orde by issue.issue_no,issuebod.issue_seq ;		
	into curs query
index on jobcard_no tag jobcard_no
sele query
if _tally > 0

	= get_oprin('Job Card Printing')
*	do get_pfile
	
	set orde to jobcard_no in job_mast
	set rela to jobcard_no into job_mast addi
	use (year_path) + 'common' in 0 agai alia common_a orde common_no
	sele job_mast
	set rela to jobcard_no + 'R' into common_a addi
	set orde to common_no in common
	set rela to jobcard_no + 'C' into common addi
	sele query
	if profseek(query.jobcard_no,'JOB_MAST','JOBCARD_NO')
		if profseek(job_mast.oil_no,'ITEMMAST','ITEM_NO')
			lcoil_name = itemmast.item
			lnoil_rate = itemmast.salerate
		endif
	endif			
	if job_mast.servicetyp = 'R'
		if profseek(job_mast.client_no,'CLIENT','CLIENT_NO')
			IF SEEK(client.modelcolno,'MODELCOL','MODELCOLNO')
				IF SEEK(MODELCOL.MODEL_NO,'MODEL','MODEL_NO')
					lnsrv_rate = MODEL.labour_rt + ROUND((MODEL.labour_rt)*GNSERVICETAX/100,2)
				ENDIF 
			ENDIF 
		endif				
	endif
	wait clea
*	do gnxthist
*	repo form job_misu to prin noco
*	DO prinrepo WITH 'WJOBMISU','JOBMISU','','',1,.F.
	DO prinrepo WITH 'WJOBMISU','JOBMISU','job_mast.jobcard_no = lcjobcard_no','',0,.F.
*	repo form jobmisu to (out_file) noco
*	do out_repo
	set rela off into job_mast
	sele job_mast
	set rela off into common
	set rela off into common_a
	go (lnjob_rec) in job_mast
	use in common_a
	use in query
else
	sele job_mast
	do cls_jobcard
	set orde to jobcard_no in job_mast
	use (year_path) + 'common' in 0 agai alia common_a orde common_no
	sele job_mast
	set rela to jobcard_no + 'R' into common_a addi
	set orde to client_no in client
	set rela to client_no into client addi
	set orde to common_no in common
	set rela to jobcard_no + 'C' into common addi

	= get_oprin('Job Card Printing')
*	do get_pfile

	wait wind '!!! WAIT !!! Generating Report ...' nowa
	if profseek(job_mast.jobcard_no,'JOB_MAST','JOBCARD_NO')
		if profseek(job_mast.oil_no,'ITEMMAST','ITEM_NO')
			lcoil_name = itemmast.item
			lnoil_rate = itemmast.salerate
		endif
	endif			
	if job_mast.servicetyp = 'R'
		if profseek(job_mast.client_no,'CLIENT','CLIENT_NO')
			IF SEEK(client.modelcolno,'MODELCOL','MODELCOLNO')
				IF SEEK(MODELCOL.MODEL_NO,'MODEL','MODEL_NO')
					lnsrv_rate = MODEL.labour_rt + ROUND((MODEL.labour_rt)*GNSERVICETAX/100,2)
				ENDIF 
			ENDIF 
		endif
	else
		lnsrv_rate = 0.00			
	endif
*	DO prinrepo WITH 'WJOBNISU','jobnisu','','',1,.F.	
	DO prinrepo WITH 'WJOBNISU','jobnisu','job_mast.jobcard_no = lcjobcard_no','',0,.F.
*	repo form jobnisu noco to (out_file) for job_mast.jobcard_no = lcjobcard_no 
*	do out_repo
	sele job_mast
	set rela off into client
	set rela off into common
	set rela off into common_a
	use in common_a
endif
sele job_mast
go (lnjob_rec)
retu
	
