FUNCTION getcomplain

parameter pccomplain,pccomplainno,pnfrt,pcguj_comp,pcHindi_Comp
SELECT curJobComp
private malias,lcon_enter,lctmp_wind,lcCtrlSpacebar,lnlines,lnestitime
lcCtrlSpacebar = ON('KEY','Ctrl+SpaceBar')
lctmp_wind = SYS(2015)
malias = alia()
lnlines = 0
lnestitime = 0
SELECT ' ' as sele_flg,complainno,complain,frt_time,SPACE(7) as prevJobNo,{} as prevJobDt,SPACE(3) as prevMechNo, ;
	guj_comp,hindi_comp ;
	 FROM complainmaster;
	 ORDER BY complainno ;
	INTO CURSOR lcgetcomplain READWRITE 	
	
SELECT lcgetcomplain
SCAN
	IF complainno $ pccomplainno AND ! EMPTY(pccomplainno)
		REPLACE sele_flg WITH 'Y'
	ELSE 
		REPLACE sele_flg WITH ' '
	ENDIF 	
	SELECT lcgetcomplain
ENDSCAN 
IF ! EMPTY(pccomplain)
	IF yesno('CURRENT COMPLAIN IS NOT BLANK' +CHR(13) + 'DO YOU WANT TO MAKE CURRENT COMPLAIN BLANK AND REGENERATE ?') = 'YES'
		pccomplain = ''
	ENDIF 
ENDIF 
pccomplainno = ''
STORE '' TO pcguj_comp,pcHindi_Comp
defi wind (lctmp_wind) from 5,1 to 30,99 &gcview_clr
lcon_enter = on('KEY','ENTER')
on key labe ctrl+spacebar do chkRepeate with complainno,m.client_no,m.job_dt,m.jobcard_no   && ctrlspace
BROWSE  fiel sele_flg :h= 'Y/N' :v= chkRepeate(complainno,m.client_no,m.job_dt,m.jobcard_no),complainno :R :h= 'CODE',complain :h= 'COMPLAIN' :60,frt_time :h= 'FRT' ;
	wind (lctmp_wind) ;
	title 'Ctrl+A Add | Ctrl+S Search | Ctrl+F Find | Ctrl+Space to Select | Esc Exit' ;
	noap node nomo nome
ON KEY LABEL ctrl+enter &lcCtrlSpacebar	

DELETE FROM curJobComp
SELECT lcgetcomplain
SCAN FOR sele_flg = 'Y'
	INSERT INTO curJobComp ;
		(complainno,prevJobNo,prevJobDt,prevMechNo) ;
	VALUES(lcgetcomplain.complainno,lcgetcomplain.prevJobNo,lcgetcomplain.prevJobDt,lcgetcomplain.prevMechNo)
	SELECT lcgetcomplain
	lnlines = lnlines + 1
	pccomplain = ALLTrim(pccomplain) + IIF(EMPTY(pccomplain),'',CHR(13)) + ALLTrim(complain)
	lnestitime = lnestitime + frt_time
	pccomplainno = pccomplainno + IIF(EMPTY(pccomplainno),'',';') + complainno
*!*		IF gcLanguage = 'GUJARATI'
		pcguj_comp = ALLTrim(pcguj_comp) + IIF(EMPTY(pcguj_comp),'','*') + ALLTrim(guj_comp)
*!*		ENDIF 
*!*		IF gcLanguage = 'HINDI'
		pcHindi_Comp = ALLTrim(pcHindi_Comp) + IIF(EMPTY(pcHindi_Comp),'','*') + ALLTrim(hindi_comp)
*!*		ENDIF	
	SELECT lcgetcomplain
ENDSCAN
USE IN lcgetcomplain
FOR i = 0 TO lnlines
	KEYBOARD '{DNARROW}' 
ENDFOR 
KEYBOARD '{END}' 
m.esti_time = lnestitime
SHOW get m.esti_time
SELECT (malias)
RELEASE WINDOWS (lctmp_wind)