do set_menu


private lcmonth,lcmonth_no,lcyear
store ' ' to lcmonth,lcmonth_no,lcyear

do attention with 'This report is based on BILL DATE'
defi wind lwmonth from 0,0 to 10,70 colo RGB(,,,255,255,215)
acti wind lwmonth
move wind lwmonth cent

@ 2,4 SAY "Month :" &gcrepo_clr

@ 1,14 GET lcmonth ;
	PICTURE "@^ \<January;\<February;mar\<Ch;\<April;\<May;\<June;j\<Uly;au\<Gust;\<September;\<Octomber;\<November;\<December" ;
	DEFAULT "January" ;
	MESSAGE 'Press Enter For Selecting Month From The List' when altdnarr() valid gctab_key() &gcrepo_clr
	
read
rele wind lwmonth


if ! decomont(lcmonth,lcmonth_no)
	retu .F.
endif
if lcmonth_no > 3 
	lcyear = ltrim(str(year(mstart_dt)))
else	
	lcyear = ltrim(str(year(mend_dt)))
endif
date1 = ctod('01/' + ltrim(str(lcmonth_no)) + '/' + lcyear)
date2 = gomo(date1,1) - 1
do attention with 'This report is based on JOB DATE' + CHR(13) + 'Also JOB CARDS WITH BLANK COUPON NO. WILL NOT BE CONSIDERED'

sele modelcol.model_no,sum(iif(job_mast.serviceseq = '01',1,0000)) as first, ;
	sum(iif(job_mast.serviceseq = '02',1,0000)) as second, ;
	sum(iif(job_mast.serviceseq = '03',1,0000)) as third, ;
	sum(iif(job_mast.serviceseq = '04',1,0000)) as fourth, ;		
	sum(iif(job_mast.serviceseq = '05',1,0000)) as fifth, ;	
	sum(iif(job_mast.serviceseq = '06',1,0000)) as sixth, ;
	job_mast.deli_dt ;
from job_mast,client,modelcol ;
where job_mast.client_no = client.client_no ;
	and client.modelcolno = modelcol.modelcolno ;
	and betw(job_mast.job_dt,date1,date2) ;
	and job_mast.servicetyp = 'F' ;
	and ! empt(job_mast.coupon_no) ;
GROU by modelcol.model_no,job_mast.deli_dt ;
into curs query	
sele query
if _tally > 0
	private lnresp
	lnresp = 0
	wait wind '!!! WAIT !!! Generating Report ... ' nowa
	repo form free_srv preview
	do alert with "Do you want to Print Free Service Coupon Report ?",1,"\<No;\<Yes",lnresp
	if lnresp = 2
		repo form free_srv to print
	endif
else
	do alert with 'No free Service detail found for given month'
endif
use in query
do cls_menu			
	
	
	
PROCEDURE gctab_key

KEYBOARD '{TAB}'


PROCEDURE ALTDNARR

KEYBOARD '{ALT+DNARROW}'
