private tmp_wind,lcrecpt_typ
tmp_wind = sys(2015)
lcrecpt_typ = 'All'
do set_menu
= get_pdt(' Receipt Register ')
wait wind '!!! WAIT !!! Gathering Data Uing SQL...' nowa
do wait_msg
defi wind (tmp_wind) from 0,0 to 8,70 colo rgb(,,,174,215,255)
acti wind (tmp_wind)
move wind (tmp_wind) cent
@ 2,2 say 'Type Of Receipts : ' &gcrepo_clr
@ 1,27 get lcrecpt_typ pict '@^ All;Cheques;Cash' when altdnarr() valid gctab_key() &gcrepo_clr
READ with (tmp_wind)
rele wind (tmp_wind)

sele receipt.receipt_no,receipt.receipt_dt,client.client,booking.modelcolno, ;
	receipt.amount,receipt.cheque_no,receipt.bank_nam,receipt.pay_mode,receipt.remark, ;
	client.salebillno,client.salebilldt,booking.hpa_name,booking.booking_no, ;
	booking.client_no,booking.agent_no, ;
	receipt.notestotal,receipt.notes_1000,receipt.notes_500,receipt.notes_100,receipt.notes_50, ;
	receipt.notes_20,receipt.notes_10,receipt.notes_5,receipt.notes_2,receipt.notes_1, ;
	canc_recp.return_flg as return ;
	from receipt,booking,client,receipt canc_recp ;
		wher receipt.booking_no=booking.booking_no ;
		and booking.client_no=client.client_no ;
		and betw(receipt_dt,date1,date2) ;
		and BETWEEN(canc_recp.cancel_dt,date1,date2) ;
	order by receipt.receipt_dt,receipt.receipt_no ;
	into curs query

PRIVATE lnresp
lnresp = 0

DO alert WITH "Do you want to print ",1,"\<A Receipt Date wise;\<B Receipt No. wise",lnresp

IF lnresp = 2
	SELECT query 
	INDEX ON SUBSTR(receipt_no,2) TAG tmprecptno ADDITIVE 
ENDIF 

if _tally > 0
	wait wind '!!! WAIT !!! Generating Reprort ...' nowa
	do case
		case lcrecpt_typ = 'All'
	do prinrepo with 'WRECEIPTREGISTER','RECE_REG','','','' 
*		repo form rece_reg to (out_file) noco
		case lcrecpt_typ = 'Cheques'
	do prinrepo with 'WRECEIPTREGISTER','RECE_REG',"pay_mode = 'CHEQUE'",'','' 
*		repo form rece_reg to (out_file) noco for pay_mode = 'c'			
		case lcrecpt_typ = 'Cash'
	do prinrepo with 'WRECEIPTREGISTER','RECE_REG',"pay_mode = 'CASH'",'','' 
*			repo form rece_reg to (out_file) noco for pay_mode = 'C'			
	endc			
	deac wind wait
*	do out_repo
else
	do alert with 'No Transection found for Given Period.'
endif
deac wind wait
do cls_menu			 


PROCEDURE gctab_key

KEYBOARD '{TAB}'


PROCEDURE ALTDNARR

KEYBOARD '{ALT+DNARROW}'
