private del_dbf,del_cdx,tmp_wind,mseries
tmp_wind = sys(2015)
mseries = '  '
do set_menu
=get_pnam('MISSING BILL NO. REPORT')
defi wind (tmp_wind) from 0,0 to 5,50 pane
acti wind (tmp_wind)
move wind (tmp_wind) cent
@ 1,2 say 'Bill No. Series : ' get mseries pict '@!'  size 1,2
read
mseries = allt(mseries)
rele wind (tmp_wind)
if empt(mseries)
	mseries = '0'
endif
del_dbf = tmp_file('DBF')
del_cdx = subs(del_dbf,1,at('.',del_dbf) - 1) + '.cdx'
wait wind '!!! WAIT !!! Getting Missing BILL No Info...' nowa
sele dist bill_no ;
	from salemast ;
	where left(bill_no,len(mseries)) = mseries ;
		and val(subs(bill_no,len(mseries) + 1)) > 0 ;
	orde by bill_no ;
	into dbf (del_dbf)
use 
use (del_dbf) alia del_dbf	
if _TALLY = 0
	do err_beep
	do alert with '!!! ATTENTION !!!;No Bill Found in theis Series..'
	use in del_dbf
	dele file (del_dbf)
	do cls_menu
	retu
endif
inde on recn() tag recn of (del_cdx)
use (del_dbf) agai in 0 alia childmiss
set rela to recn() + 1 into childmiss 
wait wind '!!! Generating Report ..' nowa
loca for val(subs(bill_no,len(mseries) + 1)) + 1 <> val(subs(childmiss.bill_no,len(mseries) + 1)) and ! empt(childmiss.bill_no)
if found()
	set devi to prin
	set prin to (out_file)
	set prin on 
	set cons off
	? 'Run Date : ' ,date()
	? 'MISSING BILL NO. REPORT'
	? '-------------------------------------------'
	scan for val(subs(bill_no,len(mseries) + 1)) + 1 <> val(subs(childmiss.bill_no,len(mseries) + 1)) and ! empt(childmiss.bill_no)
		if val(subs(bill_no,len(mseries) + 1)) + 2 = val(subs(childmiss.bill_no,len(mseries) + 1))
			? round(val(subs(bill_no,len(mseries) + 1)) + 1,0)
		else
			? round(val(subs(bill_no,len(mseries) + 1)) + 1,0),' TO ',ltrim(str(round(val(subs(childmiss.bill_no,len(mseries) + 1)) - 1,0)))
		endif
	ends
	set devi to screen
	set cons on
	set prin to
	set prin off
	do out_repo
else
	do ok_beep
	do alert with '!!! Congratulations !!!;No Missing BILL NO Found..'
endif
use in childmiss
use in del_dbf
dele file (del_dbf)
*dele file (del_cdx)
do cls_menu