*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="caut_ora.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS caut_anluna AS _container OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="cboan" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cboluna" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: caut_ani
		*m: caut_luni
		*m: initializare_anluna
		*p: ccursorluni		&& Numele cursorului pentru luni. Daca sunt mai multe obiecte caut_anluna, trebuie nume diferite.
		*p: nan
		*p: nluna
	*</DefinedPropArrayMethod>

	*<PropValue>
		ccursorluni = cursor_luni
		Height = 22
		Name = "caut_anluna"
		nan = 0
		nluna = 0
		Width = 153
	*</PropValue>

	ADD OBJECT 'cboan' AS _cbbase WITH ;
		BoundTo = .T., ;
		Height = 22, ;
		Left = 0, ;
		Name = "cboan", ;
		Top = 0, ;
		Width = 60
		*< END OBJECT: ClassLib="_cb_base.vcx" BaseClass="combobox" />

	ADD OBJECT 'cboluna' AS _cbbase WITH ;
		BoundColumn = 2, ;
		Height = 22, ;
		Left = 60, ;
		Name = "cboluna", ;
		Top = 0, ;
		Width = 93
		*< END OBJECT: ClassLib="_cb_base.vcx" BaseClass="combobox" />
	
	PROCEDURE caut_ani
		LOCAL lcSchema
		lcSchema = gcS
		
		lcSelect = [select * from lunilean ]
		lcCursor = [luni]
		
		IF USED(lcCursor)
			USE IN (lcCursor)
		ENDIF
		
		lnSucces = goExecutor.oExecute(lcSelect,lcCursor)
		IF lnSucces < 0
			aMESSAGEBOX('Eroare la selectie ' + goExecutor.cEroare)
			RETURN 
		ENDIF
		
		lcSelect1 = [select to_number(TRIM(nl),'99') as nrluna,an from ] +;
		            lcSchema + [.calendar order by to_number(an,'9999') * 12 + nrluna]
		lcCursor1 = [ocalendar]
		
		IF USED(lcCursor1)
			USE IN (lcCursor1)
		ENDIF
		
		lnSucces1 = goExecutor.oExecute(lcSelect1,lcCursor1)
		IF lnSucces1 < 0
			aMESSAGEBOX('Eroare la selectie ' + goExecutor.cEroare)
			RETURN 
		ENDIF
		
		SELECT DISTINCT an FROM ocalendar ORDER BY an INTO CURSOR cursor_ani
		
		this.cboan.RowSource = 'cursor_ani.an'
		this.cboAn.RowSourceType = 2
		this.cboan.Value = str(gnAn)
		this.nan = gnAn
		this.cboan.refresh
		
		this.caut_luni(.t.)
	ENDPROC

	PROCEDURE caut_luni
		LPARAMETERS llinit, tnLuna
		LOCAL lnluna, lcCursor, lcLuna
		lnLuna = IIF(!EMPTY(m.tnLuna), m.tnLuna, m.gnLuna)
		
		SELECT ocalendar
		    
		this.cboluna.RowSource = ''
		lcCursor = this.cCursorluni
		IF EMPTY(m.lcCursor)
			lcCursor = 'cursor_luni'
		ENDIF 
		
		SELECT l.numeluna,l.nrluna FROM luni l;
			JOIN ocalendar c ON c.nrluna = l.nrluna AND ALLTRIM(c.an) = ALLTRIM(this.cboan.value) ;
			INTO CURSOR (m.lcCursor);
			ORDER BY l.nrluna
		
		lcLuna = this.cboluna.DisplayValue 	
		
		this.cboluna.RowSource = m.lcCursor
		this.cboluna.RowSourceType = 2
		
		SELECT (m.lcCursor)
		IF llinit	
			LOCATE FOR nrluna = m.lnLuna
			this.cboluna.DisplayValue = &lcCursor..numeluna
		ELSE
			LOCATE FOR numeluna = m.lcLuna
			IF FOUND()	
				this.cboluna.DisplayValue = m.lcLuna
			ELSE 
				this.cboluna.DisplayValue = ''
			ENDIF		
		ENDIF
			
		this.nluna = VAL(ALLTRIM(this.cboluna.value))	
			
		this.cboluna.refresh
		
		
	ENDPROC

	PROCEDURE Init
		this.caut_ani
	ENDPROC

	PROCEDURE initializare_anluna
		LPARAMETERS tnAn, tnLuna
		
		LOCAL lnAn, lnLuna
		
		lnAn = IIF(EMPTY(m.tnAn), INT(m.gnAn), INT(m.tnAn))
		lnLuna = IIF(EMPTY(m.tnLuna), INT(m.gnLuna), INT(m.tnLuna))
		
		this.cboan.Value = str(m.lnAn)
		this.nan = m.lnAn
		
		this.caut_luni(.T., m.lnLuna)
		
		this.refresh
	ENDPROC

	PROCEDURE cboan.InteractiveChange
		this.Parent.nan = val(ALLTRIM(this.value))
		this.Parent.caut_luni
	ENDPROC

	PROCEDURE cboluna.InteractiveChange
		this.Parent.nluna = VAL(ALLTRIM(this.value))
	ENDPROC

ENDDEFINE

DEFINE CLASS cb_filtru_text AS _combobox OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="combobox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*p: ctraducere
		*p: filtru
	*</DefinedPropArrayMethod>

	*<PropValue>
		ctraducere = 
		filtru = 
		Name = "cb_filtru_text"
	*</PropValue>

ENDDEFINE

DEFINE CLASS ck_filtru_luna AS _checkbox OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="checkbox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*p: camp_nume
		*p: ctraducere
		*p: cvaloare1
		*p: cvaloare2
		*p: filtru
		*p: filtru_vfp
		*p: luna
	*</DefinedPropArrayMethod>

	*<PropValue>
		Alignment = 0
		camp_nume = 
		ctraducere = 
		cvaloare1 = 
		cvaloare2 = 
		filtru = 
		filtru_vfp = 
		luna = 
		Name = "ck_filtru_luna"
		_memberdata = <VFPData>

		</VFPData>
	*</PropValue>
	
	PROCEDURE InteractiveChange
		WITH this
			.filtru = ""
			.filtru_vfp = ""
			IF .Value = 0
				RETURN 
			ENDIF 
		
			PRIVATE pcValoare1, pcValoare2, pcFiltru, pcFiltruVFP && variabile pe care le completeaza forma frm_filtru_text
			pcValoare1 = .cValoare1
			pcValoare2 = .cValoare2	
			pcFiltruVFP = ""
			pcFiltru = ""
			
			DO FORM frm_filtru_luna WITH .camp_nume, .caption, .luna TO .filtru
			
			IF .filtru == ""
				.Value = 0
				.cValoare1 = ""
				.cValoare2 = ""	
				.filtru_vfp = ""
			ELSE
				.cValoare1 = pcValoare1
				.cValoare2 = pcValoare2				
				.filtru_vfp = pcFiltruVFP
			ENDIF 
			.cTraducere = "perioada intre "+pcValoare1+" si "+pcValoare2
		ENDWITH 
	ENDPROC

ENDDEFINE

DEFINE CLASS ck_filtru_nom AS _checkbox OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="checkbox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*p: camp_nume
		*p: camp_tabela
		*p: ctraducere
		*p: cvaloare1
		*p: filtru
		*p: filtru_vfp
		*p: tabela
		*p: titlu
	*</DefinedPropArrayMethod>

	*<PropValue>
		Alignment = 0
		camp_nume = 
		camp_tabela = 
		ctraducere = 
		cvaloare1 = 
		filtru = 
		filtru_vfp = 
		Name = "ck_filtru_nom"
		tabela = 
		titlu = 
	*</PropValue>
	
	PROCEDURE InteractiveChange
		WITH this
			.filtru = ""
			.filtru_vfp = ""
			IF .Value = 0
				RETURN 
			ENDIF 
			PRIVATE pcval,pnbuton,pcselect,pcfiltru,oRetObj
			STORE "" TO oRetObj
			pnbuton=1
			pcselect=['select distinct ]+.camp_tabela+[ from ]+gcS+[.]+.tabela+[ where 2=2']
			pcfiltru=[2=2]
			oRetObj=cauta_alfa(pcselect,pcfiltru,[''],[],.camp_tabela,.titlu,.caption)
			IF pnbuton=1
				pcval = "oRetObj."+.camp_tabela
				.cvaloare1 = ALLTRIM(&pcval)
				.filtru = [ AND UPPER(SUBSTR(]+ALLTRIM(.camp_nume)+[,1,]+ALLTRIM(STR(LEN(.cvaloare1)))+[))=']+.cvaloare1+[']
				.filtru_vfp = [	AND UPPER(LEFT(]+ALLTRIM(.camp_nume)+[,]+ALLTRIM(STR(LEN(.cvaloare1)))+[))==']+.cvaloare1+[']
				.cTraducere = ALLTRIM(.camp_nume) + " incepe cu " + ALLTRIM(NVL(.cvaloare1,""))
			ELSE
				.Value = 0
				.cValoare1 = ""
				.filtru = ""
				.filtru_vfp = ""
				.cTraducere = ""
			ENDIF 
			
			RELEASE oRetObj
		ENDWITH 
	ENDPROC

ENDDEFINE

DEFINE CLASS ck_filtru_nomgeneral AS _checkbox OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="checkbox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*p: campuri_afisate
		*p: campuri_headere
		*p: campuri_selectate
		*p: camp_filtru
		*p: camp_tabela
		*p: ctraducere
		*p: filtru_nom
		*p: filtru_ora
		*p: filtru_vfp
		*p: nvaloare
		*p: ordine_nom
		*p: tabela
		*p: titlu
	*</DefinedPropArrayMethod>

	*<PropValue>
		Alignment = 0
		campuri_afisate = 
		campuri_headere = 
		campuri_selectate = 
		camp_filtru = 
		camp_tabela = 
		ctraducere = 
		filtru_nom = 
		filtru_ora = 
		filtru_vfp = 
		Name = "ck_filtru_nomgeneral"
		nvaloare = 
		ordine_nom = 
		tabela = 
		titlu = 
	*</PropValue>
	
	PROCEDURE InteractiveChange
		LOCAL lcSelect, lcFiltru, lcOrdine, lcNumeProc, llAllInlist,lcFiltruOriginal, lcPrimaColoana, lcSchema
		LOCAL lcVal
		LOCAL ocautare
		
		lcNumeProc = ""
		llAllInlist = .F.
		lcPrimaColoana = ""
		lcSchema = ""
		
		
		WITH this
			.filtru_ora = ""
			.filtru_vfp = ""
			IF .Value = 0
				RETURN 
			ENDIF 
			PRIVATE pnbuton,pcselect,pcfiltru,pcordine,oCautare
			STORE "" TO oCautare
			pnbuton=1
			lcselect=[select ]+.campuri_selectate+[ from ]+gcS+[.]+.tabela
			lcFiltruNom = .filtru_nom
			
			lnPos1 = AT('&',lcFiltruNom)
			lnPos2 = AT('&',lcFiltruNom,2)
			IF lnPos1 * lnPos2 > 0
				lcItem = SUBSTR(lcFiltruNom, lnPos1, lnPos2 - lnPos1 + 1)
				lcFiltruOriginal = STRTRAN(lcFiltruNom, lcItem, '***')
				lcItem = STRTRAN(lcItem, '&', '')
				lcFiltruTemp = [(] + &lcItem+ [)]
				lcFiltruOriginal = STRTRAN(lcFiltruOriginal, '***', lcFiltruTemp)
			ELSE	
				lcFiltruOriginal = .filtru_nom
			ENDIF 	
			
			lcfiltru = "1=2"
			lcordine = .ordine_nom
			oCautare = cauta_alfa(lcselect, lcfiltru, lcSchema,lcordine, .campuri_afisate, .titlu, .campuri_headere, lcNumeProc, llAllInList,lcFiltruOriginal, lcPrimaColoana)
			IF pnbuton=1
				lcval = "oCautare."+.camp_tabela
				.nvaloare = &lcval
				.filtru_ora = [ AND ]+ALLTRIM(.camp_filtru)+[=]+ALLTRIM(STR(.nvaloare))
				.filtru_vfp = .filtru_ora
				.cTraducere = " SI " + ALLTRIM(.camp_filtru)+[=]+ALLTRIM(STR(.nvaloare))
			ELSE
				.Value = 0		
				.nvaloare = 0
				.filtru_ora = ""
				.filtru_vfp = ""
				.cTraducere = ""		
			ENDIF 
			RELEASE oCautare
		ENDWITH 
	ENDPROC

ENDDEFINE

DEFINE CLASS ck_filtru_numar AS _checkbox OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="checkbox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*p: camp_nume
		*p: cintre
		*p: criteriu1
		*p: criteriu2
		*p: ctraducere
		*p: cvaloare1
		*p: cvaloare2
		*p: filtru
		*p: filtru_vfp
		*p: mask
		*p: nrzec
		*p: tip
	*</DefinedPropArrayMethod>

	*<PropValue>
		Alignment = 0
		camp_nume = 
		cintre = 
		criteriu1 = 1
		criteriu2 = 2
		ctraducere = 
		cvaloare1 = 
		cvaloare2 = 
		filtru = 
		filtru_vfp = 
		mask = 
		Name = "ck_filtru_numar"
		nrzec = 0
		tip = N
		_memberdata = <VFPData>

		</VFPData>
	*</PropValue>
	
	PROCEDURE InteractiveChange
		WITH THIS
			.filtru = ""
			.filtru_vfp = ""
			IF .VALUE = 0
				RETURN
			ENDIF
			PRIVATE pcValoare1, pcValoare2, pcIntre, pnCriteriu, pnCriteriu2, pcFiltru, pcFiltruVFP && variabile pe care le completeaza forma frm_filtru_text
			pnCriteriu = .criteriu1
			pnCriteriu2 = .criteriu2
			pcValoare1 = .cvaloare1
			pcValoare2 = .cvaloare2
			pcFiltruVFP = ""
			pcFiltru = ""
			pcIntre = .cIntre
		
			IF TYPE('.mask') == 'N'
				.mask = ALLTRIM(STR(.mask))
			ENDIF
		
			DO FORM frm_filtru_numar WITH .camp_nume, .CAPTION, .criteriu1, .criteriu2, .tip, .mask, .nrzec TO .filtru
			IF .filtru == ""
				.VALUE = 0
				.criteriu1 = 1
				.criteriu2 = 1
				.cvaloare1 = ""
				.cvaloare2 = ""
				.filtru_vfp = ""
				.cIntre = ""
			ELSE
				.cvaloare1 = pcValoare1
				.cvaloare2 = pcValoare2
				.criteriu1 = pnCriteriu
				.criteriu2 = pnCriteriu2
				.filtru_vfp = pcFiltruVFP
				.cIntre = pcIntre
			ENDIF
		
			IF .filtru == ""
				lcTraducere = ""
			ELSE
				IF INLIST(.tip, "D", "T")
					lcSemn1 = IIF(.criteriu1 = 1, [>=], [>])
					lcSemn2 = IIF(.criteriu2 = 1, [<=], [<])
				ELSE
					DO CASE
						CASE .criteriu1 = 1
							lcSemn1 = [>=]
						CASE .criteriu1 = 2
							lcSemn1 = [<=]
						CASE .criteriu1 = 3
							lcSemn1 = [=]
						CASE .criteriu1 = 4
							lcSemn1 = [<>]
						CASE .criteriu1 = 5
							lcSemn1 = [>]
						CASE .criteriu1 = 6
							lcSemn1 = [<]
					ENDCASE
					DO CASE
						CASE .criteriu2 = 1
							lcSemn2 = [>=]
						CASE .criteriu2 = 2
							lcSemn2 = [<=]
						CASE .criteriu2 = 3
							lcSemn2 = [=]
						CASE .criteriu2 = 4
							lcSemn2 = [<>]
						CASE .criteriu2 = 5
							lcSemn2 = [>]
						CASE .criteriu2 = 6
							lcSemn2 = [<]
					ENDCASE
				ENDIF
		
				lcTraducere = STRTRAN(.CAPTION, "\<", "") + " " +lcSemn1 + ALLTRIM(TRANSFORM(.cvaloare1)) + [ ] + pcIntre + [ ] + STRTRAN(.CAPTION, "\<", "") + " " + lcSemn2 + ALLTRIM(TRANSFORM(.cvaloare2))
		
				lcTraducere = STRTRAN(STRTRAN(lcTraducere, 'OR', 'SAU'), 'AND', 'SI')
			ENDIF
			.cTraducere =  lcTraducere
		ENDWITH
		
	ENDPROC

ENDDEFINE

DEFINE CLASS ck_filtru_text AS _checkbox OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="checkbox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*p: camp_nume
		*p: cintre
		*p: criteriu
		*p: criteriu2
		*p: ctraducere
		*p: cvaloare1
		*p: cvaloare2
		*p: filtru
		*p: filtru_vfp
	*</DefinedPropArrayMethod>

	*<PropValue>
		Alignment = 0
		camp_nume = 
		cintre = 
		criteriu = 1
		criteriu2 = 1
		ctraducere = 
		cvaloare1 = 
		cvaloare2 = 
		filtru = 
		filtru_vfp = 
		Name = "ck_filtru_text"
		_memberdata = <VFPData>

		</VFPData>
	*</PropValue>
	
	PROCEDURE InteractiveChange
		WITH THIS
			.filtru = ""
			.filtru_vfp = ""
			IF .VALUE = 0
				RETURN
			ENDIF
		
			PRIVATE pcValoare1, pcValoare2, pcIntre, pnCriteriu, pnCriteriu2, pcFiltru, pcFiltruVFP && variabile pe care le completeaza forma frm_filtru_text
			pcValoare1 = .cValoare1
			pcValoare2 = .cValoare2
			pnCriteriu = .criteriu
			pnCriteriu2 = .criteriu2
			pcIntre = .cIntre
			pcFiltruVFP = ""
			pcFiltru = ""
		
		
			DO FORM frm_filtru_text WITH .camp_nume,.CAPTION,.criteriu,.criteriu2 TO .filtru
		
			IF .filtru == ""
				.VALUE = 0
				.cValoare1 = ""
				.cValoare2 = ""
				.criteriu = 1
				.criteriu2 = 1
				.cIntre = ""
				.filtru_vfp = ""
			ELSE
				.cValoare1 = pcValoare1
				.cValoare2 = pcValoare2
				.criteriu = pnCriteriu
				.criteriu2 = pnCriteriu2
				.cIntre = pcIntre
				.filtru_vfp = pcFiltruVFP
			ENDIF
		
		&& TRADUCERE
			lcTraducere = ""
			IF !EMPTY(.filtru)
				lcCriteriu = ' '				
				lcCriteriu2 = ' '
				lcCIntre = ""			
				DO CASE
					CASE .criteriu= 1
						lcCriteriu = 'incepe cu... '
					CASE .criteriu= 2
						lcCriteriu = 'este... '
					CASE .criteriu= 3
						lcCriteriu = 'nu este... '
					CASE .criteriu= 4
						lcCriteriu = 'contine... '
					CASE .criteriu= 5
						lcCriteriu = 'nu contine... '
					CASE .criteriu= 6
						lcCriteriu = 'nu are valori '
					CASE .criteriu= 7
						lcCriteriu = 'are valori '
				ENDCASE
		
				DO CASE
					CASE .criteriu2= 1
						lcCriteriu2 = 'incepe cu... '
					CASE .criteriu2= 2
						lcCriteriu2 = 'este... '
					CASE .criteriu2= 3
						lcCriteriu2 = 'nu este... '
					CASE .criteriu2= 4
						lcCriteriu2 = 'contine... '
					CASE .criteriu2= 5
						lcCriteriu2 = 'nu contine... '
					CASE lnCriteriu2 = 6
						lcCriteriu2 = 'nu are valori '
					CASE .criteriu2= 7
						lcCriteriu2 = 'are valori '
				ENDCASE
		
				DO CASE
					CASE ALLTRIM(UPPER(.cIntre)) = 'OR'
						lcCIntre = 'SAU'
					CASE ALLTRIM(UPPER(.cIntre)) = 'AND'
						lcCIntre = 'SI'
				ENDCASE
		
				IF !EMPTY(.cIntre)
					lcTraducere = STRTRAN(.CAPTION, "\<", "") + " " + lcCriteriu + ['] + .cValoare1+ [' ] + lcCIntre + " " + lcCriteriu2 + ['] + .cValoare2 + [']
				ELSE
					lcTraducere = STRTRAN(.CAPTION, "\<", "") + " " + lcCriteriu + ['] + .cValoare1+ [']
				ENDIF
			ENDIF && !EMPTY(.filtru)
		
			.cTraducere = lcTraducere
		
		ENDWITH
		
	ENDPROC

ENDDEFINE

DEFINE CLASS ck_simplu AS _checkbox OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="checkbox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<DefinedPropArrayMethod>
		*p: filtru
		*p: filtru_vfp
	*</DefinedPropArrayMethod>

	*<PropValue>
		Alignment = 0
		filtru = 
		filtru_vfp = 
		Name = "ck_simplu"
	*</PropValue>

ENDDEFINE

DEFINE CLASS criteriu_numar AS _cbbase OF "_cb_base.vcx" 
 	*< CLASSDATA: Baseclass="combobox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<PropValue>
		BorderStyle = 0
		BoundColumn = 2
		BoundTo = .T.
		ColumnCount = 2
		ColumnLines = .F.
		ColumnWidths = "72,0"
		FontItalic = .T.
		FontSize = 10
		Name = "criteriu_numar"
		RowSource = "> = ,1,< = ,2, = ,3, # ,4, > ,5, < ,6"
		RowSourceType = 1
		SpecialEffect = 2
		ToolTipText = "Selectati criteriul de comparare"
		Width = 55
	*</PropValue>

ENDDEFINE

DEFINE CLASS criteriu_text AS _cbbase OF "_cb_base.vcx" 
 	*< CLASSDATA: Baseclass="combobox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<PropValue>
		BorderStyle = 0
		BoundColumn = 2
		BoundTo = .T.
		ColumnCount = 2
		ColumnLines = .F.
		ColumnWidths = "72,0"
		FontItalic = .T.
		Name = "criteriu"
		RowSource = "incepe cu...,1,este...,2,nu este...,3,contine...,4,nu contine...,5,nu are valori,6,are valori,7"
		RowSourceType = 1
		SpecialEffect = 2
		ToolTipText = "Selectati criteriul de comparare"
	*</PropValue>

ENDDEFINE

DEFINE CLASS ct_clb_cautare AS _container OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="img_cautare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_tx_cautare" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_activeaza
		*m: do_apeleaza
		*m: do_dezactiveaza
		*m: do_schimba_explicatia		&& Schimba caption-ul de la label1.
		*p: cconditie		&& Conditia pentru care se apeleaza procedura din cprocedura.
		*p: clista_parametri		&& Lista parametri pentru procedura din cparametri ( separati prin virgula ).
		*p: cprocedura		&& Numele procedurii care se apeleaza.
		*p: ctooltip
		*p: cvaloare_intoarsa		&& Numele variabilei/obiectului in care se va intoarce rezultatul in cazul in care cprocedura este o functie.
		*p: cvar_afisata		&& Control source-ul pentru textfield.
		*p: lactiv		&& .T. daca se pot face modificari.
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderWidth = 0
		cconditie = 2=2
		clista_parametri = 
		cprocedura = 
		ctooltip = 
		cvaloare_intoarsa = 
		cvar_afisata = 
		Height = 31
		lactiv = .T.
		Name = "ct_clb_cautare"
		Width = 351
		_memberdata = <VFPData>
			<memberdata name="cconditie" type="Property" favorites="True"/>
			<memberdata name="clista_parametri" type="Property" favorites="True"/>
			<memberdata name="cprocedura" type="Property" favorites="True"/>
			<memberdata name="cvar_afisata" type="Property" favorites="True"/>
			<memberdata name="cvaloare_intoarsa" type="Property" favorites="True"/>
		</VFPData>
	*</PropValue>

	ADD OBJECT 'clb_tx_cautare' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 1, ;
		Name = "clb_tx_cautare", ;
		TabIndex = 2, ;
		Top = 1, ;
		Width = 314, ;
		TEXT_SIMPLU1.Left = 126, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.ReadOnly = .T., ;
		TEXT_SIMPLU1.ToolTipText = "Pentru modificare apasati DEL sau butonul din dreapta ", ;
		TEXT_SIMPLU1.Top = 3, ;
		LB_SIMPLU1.Left = 6, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'img_cautare' AS _image WITH ;
		Height = 20, ;
		Left = 326, ;
		Name = "img_cautare", ;
		Picture = ..\grafice\alege.bmp, ;
		Stretch = 1, ;
		Top = 5, ;
		Width = 20
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="image" />
	
	PROCEDURE do_activeaza
		This.lactiv = .T.
		This.img_cautare.Visible = .T.
		This.clb_tx_cautare.text_simplu1.ToolTipText = This.ctooltip
		This.clb_tx_cautare.text_simplu1.Refresh()
	ENDPROC

	PROCEDURE do_apeleaza
		Local loObject
		lcListaParametri = Iif(Type('This.clista_parametri')='N',Alltrim(Str(This.clista_parametri)),Alltrim(This.clista_parametri))
		lcApelProcedura = This.cprocedura + Iif(!Empty(lcListaParametri),[(]+lcListaParametri+[)],[])
		lcValoareIntoarsa = This.cvaloare_intoarsa
		If Empty(lcValoareIntoarsa)
			&lcApelProcedura
		Else
			&lcValoareIntoarsa = &lcApelProcedura
		Endif
		This.clb_tx_cautare.text_simplu1.Refresh()
	ENDPROC

	PROCEDURE do_dezactiveaza
		This.lactiv = .F.
		This.img_cautare.Visible = .F.
		This.ctooltip = This.clb_tx_cautare.text_simplu1.ToolTipText
		This.clb_tx_cautare.text_simplu1.ToolTipText = []
		This.clb_tx_cautare.text_simplu1.Refresh()
	ENDPROC

	PROCEDURE do_schimba_explicatia		&& Schimba caption-ul de la label1.
		Lparameters tcExplicatie
		This.clb_tx_cautare.lb_SIMPLU1.Caption = Alltrim(tcExplicatie)
		This.img_cautare.ToolTipText=[Alegeti ]+Alltrim(Lower(tcExplicatie))
	ENDPROC

	PROCEDURE Init
		This.clb_tx_cautare.text_simplu1.ControlSource=This.cvar_afisata
		This.img_cautare.ToolTipText=[Alegeti ]+Alltrim(Lower(This.clb_tx_cautare.lb_SIMPLU1.Caption))
	ENDPROC

	PROCEDURE clb_tx_cautare.TEXT_SIMPLU1.DblClick
		*!*	modificare migrare v 1.0	>	v 2.0
		*!*	lcConditie = This.Parent.Parent.cconditie
		*!*	If (&lcConditie) And This.Parent.Parent.lactiv
		If This.Parent.Parent.lactiv
		*!*	modificare migrare v 1.0	>	v 2.0	^
			This.Parent.Parent.do_apeleaza()
		Endif
	ENDPROC

	PROCEDURE clb_tx_cautare.TEXT_SIMPLU1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		lcConditie = This.Parent.Parent.cconditie
		If ((Inlist(nKeyCode,9,13) And nShiftAltCtrl=0 And &lcConditie) Or (nKeyCode = 7 And nShiftAltCtrl = 0)) ;
				And This.Parent.Parent.lactiv
			Nodefault
			This.Parent.Parent.do_apeleaza()
		Endif
	ENDPROC

	PROCEDURE img_cautare.Click
		If This.Parent.lactiv
			This.Parent.do_apeleaza()
		Endif
		
	ENDPROC

	PROCEDURE img_cautare.MouseEnter
		Lparameters nButton, nShift, nXCoord, nYCoord
		This.MousePointer = 15
	ENDPROC

	PROCEDURE img_cautare.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		This.MousePointer = 0
	ENDPROC

ENDDEFINE

DEFINE CLASS ct_clb_cautare_var AS _container OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="shape_cautare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="img_cautare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_cautare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_cautare" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_activeaza
		*m: do_apeleaza
		*m: do_dezactiveaza
		*m: do_schimba_explicatia		&& Schimba caption-ul de la label1.
		*p: cconditie		&& Conditia pentru care se apeleaza procedura din cprocedura.
		*p: clista_parametri		&& Lista parametri pentru procedura din cparametri ( separati prin virgula ).
		*p: cprocedura		&& Numele procedurii care se apeleaza.
		*p: ctooltip
		*p: cvaloare_intoarsa		&& Numele variabilei/obiectului in care se va intoarce rezultatul in cazul in care cprocedura este o functie.
		*p: cvar_afisata		&& Control source-ul pentru textfield.
		*p: lactiv		&& .T. daca se pot face modificari.
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderWidth = 0
		cconditie = 2=2
		clista_parametri = 
		cprocedura = 
		ctooltip = 
		cvaloare_intoarsa = 
		cvar_afisata = 
		Height = 31
		lactiv = .T.
		Name = "ct_clb_cautare_var"
		Width = 354
		_memberdata = <VFPData>
			<memberdata name="cconditie" type="Property" favorites="True"/>
			<memberdata name="clista_parametri" type="Property" favorites="True"/>
			<memberdata name="cprocedura" type="Property" favorites="True"/>
			<memberdata name="cvar_afisata" type="Property" favorites="True"/>
			<memberdata name="cvaloare_intoarsa" type="Property" favorites="True"/>
		</VFPData>
	*</PropValue>

	ADD OBJECT 'img_cautare' AS _image WITH ;
		Height = 20, ;
		Left = 326, ;
		Name = "img_cautare", ;
		Picture = ..\grafice\alege.bmp, ;
		Stretch = 1, ;
		Top = 5, ;
		Width = 20, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="image" />

	ADD OBJECT 'lb_cautare' AS _lbbase WITH ;
		Left = 6, ;
		Name = "lb_cautare", ;
		Top = 8, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'shape_cautare' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 29, ;
		Left = 1, ;
		Name = "shape_cautare", ;
		Top = 1, ;
		Width = 312, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'tx_cautare' AS _txbase WITH ;
		Format = "!K", ;
		Height = 23, ;
		Left = 125, ;
		Name = "tx_cautare", ;
		ReadOnly = .T., ;
		ToolTipText = "Pentru modificare apasati DEL sau butonul din dreapta", ;
		Top = 4, ;
		Width = 184, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />
	
	PROCEDURE do_activeaza
		This.lactiv = .T.
		This.img_cautare.Visible = .T.
		This.tx_cautare.ToolTipText = This.ctooltip
	ENDPROC

	PROCEDURE do_apeleaza
		Local loObject
		lcListaParametri = Iif(Type('This.clista_parametri')='N',Alltrim(Str(This.clista_parametri)),Alltrim(This.clista_parametri))
		lcApelProcedura = This.cprocedura + Iif(!Empty(lcListaParametri),[(]+lcListaParametri+[)],[])
		lcValoareIntoarsa = This.cvaloare_intoarsa
		If Empty(lcValoareIntoarsa)
			&lcApelProcedura
		Else
			&lcValoareIntoarsa = &lcApelProcedura
		Endif
		This.tx_cautare.Refresh()
		
	ENDPROC

	PROCEDURE do_dezactiveaza
		This.lactiv = .F.
		This.img_cautare.Visible = .F.
		This.ctooltip = This.tx_cautare.ToolTipText
		This.tx_cautare.ToolTipText = []
	ENDPROC

	PROCEDURE do_schimba_explicatia		&& Schimba caption-ul de la label1.
		Lparameters tcExplicatie
		This.lb_cautare.Caption = Alltrim(tcExplicatie)
		This.img_cautare.ToolTipText=[Alegeti ]+Alltrim(Lower(tcExplicatie))
	ENDPROC

	PROCEDURE Init
		Lparameters tnMarime
		Local lnMarime
		*!*		-1	-	dimensiunile setate de utilizator
		*!*		0	-
		*!*		1	-
		If Empty(tnMarime)
			lnMarime = -1
		Else
			lnMarime = tnMarime
		Endif
		Do Case
		Case lnMarime = 0
			This.shape_cautare.Width = 284
			This.tx_caUTARE.Width = 96
			This.img_cautare.Left = 296
			This.Width = 324
		Case lnMarime = 1
			This.shape_cautare.Width = 314
			This.tx_caUTARE.Left = 126
			This.img_cautare.Left = 326
			This.Width = 354
		Endcase
		This.tx_caUTARE.ControlSource=This.cvar_afisata
		This.img_cautare.ToolTipText=[Alegeti ]+Alltrim(Lower(This.lb_cautare.Caption))
	ENDPROC

	PROCEDURE img_cautare.Click
		If This.Parent.lactiv
			This.Parent.do_apeleaza()
		Endif
		
	ENDPROC

	PROCEDURE img_cautare.MouseEnter
		Lparameters nButton, nShift, nXCoord, nYCoord
		This.MousePointer = 15
	ENDPROC

	PROCEDURE img_cautare.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		This.MousePointer = 0
	ENDPROC

	PROCEDURE tx_cautare.DblClick
		*!*	modificare migrare v 1.0	>	v 2.0
		*!*	lcConditie = This.Parent.Parent.cconditie
		*!*	If (&lcConditie) And This.Parent.Parent.lactiv
		If This.Parent.lactiv
		*!*	modificare migrare v 1.0	>	v 2.0	^
			This.Parent.do_apeleaza()
		Endif
	ENDPROC

	PROCEDURE tx_cautare.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		lcConditie = This.Parent.cconditie
		If ((Inlist(nKeyCode,9,13) And nShiftAltCtrl=0 And &lcConditie) Or (nKeyCode = 7 And nShiftAltCtrl = 0)) ;
				And This.Parent.lactiv
			Nodefault
			This.Parent.do_apeleaza()
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS ct_opt_cautare AS _container OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="opt_cautare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_cautare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Criteriu" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_apeleaza
		*m: do_reset
		*m: do_schimba_explicatia		&& Schimba caption-ul de la label1.
		*p: cconditie		&& Conditia pentru care se apeleaza procedura din cprocedura.
		*p: clista_parametri		&& Lista parametri pentru procedura din cparametri ( separati prin virgula ).
		*p: cprocedura		&& Numele procedurii care se apeleaza.
		*p: cvaloare_intoarsa		&& Numele variabilei/obiectului in care se va intoarce rezultatul in cazul in care cprocedura este o functie.
		*p: cvarfiltru		&& Numele variabilei care va fi folosita in filtru.
		*p: cvar_afisata		&& Control source-ul pentru textfield.
		*p: ntip		&& 1 - fara criteriu; 2 - poate alege criteriul
		*p: nvaloarecriteriu
		*p: value		&& Specifies the current state of a control.
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	*<PropValue>
		cconditie = 
		clista_parametri = 
		cprocedura = 
		cvaloare_intoarsa = 
		cvarfiltru = 
		cvar_afisata = 
		Height = 71
		Name = "ct_opt_cautare"
		ntip = 1
		nvaloarecriteriu = 1
		value = 1
		Width = 290
		_memberdata = <VFPData>
			<memberdata name="cconditie" type="Property" favorites="True"/>
			<memberdata name="clista_parametri" type="Property" favorites="True"/>
			<memberdata name="cprocedura" type="Property" favorites="True"/>
			<memberdata name="cvar_afisata" type="Property" favorites="True"/>
			<memberdata name="cvaloare_intoarsa" type="Property" favorites="True"/>
			<memberdata name="value" type="Property" favorites="True"/>
			<memberdata name="cvarfiltru" type="Property" favorites="True"/>
		</VFPData>
	*</PropValue>

	ADD OBJECT 'Criteriu' AS criteriu_text WITH ;
		ControlSource = "", ;
		Enabled = .F., ;
		Left = 19, ;
		Name = "Criteriu", ;
		ReadOnly = .F., ;
		RowSource = "este...,1,nu este...,2", ;
		Top = 42, ;
		Value = 1
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'lb_explicatie' AS lb_simplu WITH ;
		AutoSize = .F., ;
		Caption = "Explicatie cautare", ;
		Height = 17, ;
		Left = 6, ;
		Name = "lb_explicatie", ;
		Top = 5, ;
		Width = 282, ;
		ZOrderSet = 2
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'opt_cautare' AS _optiongrup WITH ;
		AutoSize = .F., ;
		BorderStyle = 0, ;
		Height = 46, ;
		Left = 0, ;
		Name = "opt_cautare", ;
		Top = 21, ;
		Width = 285, ;
		ZOrderSet = 0, ;
		OPTION1.AutoSize = .T., ;
		OPTION1.Caption = "Toate inregistrarile", ;
		OPTION1.Left = 5, ;
		OPTION1.Name = "OPTION1", ;
		OPTION1.Top = 5, ;
		OPTION2.AutoSize = .T., ;
		OPTION2.Caption = "", ;
		OPTION2.Height = 17, ;
		OPTION2.Left = 5, ;
		OPTION2.Name = "OPTION2", ;
		OPTION2.Top = 24, ;
		OPTION2.Width = 18
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'tx_cautare' AS _textbox WITH ;
		Enabled = .F., ;
		Height = 23, ;
		Left = 121, ;
		Name = "tx_cautare", ;
		TabIndex = 3, ;
		TabStop = .F., ;
		Top = 42, ;
		Width = 162, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE do_apeleaza
		Local loObject
		This.tx_CAUTARE.Enabled = .T.
		This.tx_CAUTARE.ReadOnly = .T.
		This.crITERIU.Enabled = .T.
		lcListaParametri = Iif(Type('This.clista_parametri')='N',Alltrim(Str(This.clista_parametri)),Alltrim(This.clista_parametri))
		lcApelProcedura = This.cprocedura + Iif(!Empty(lcListaParametri),[(]+lcListaParametri+[)],[])
		lcValoareIntoarsa = This.cvaloare_intoarsa
		If Empty(lcValoareIntoarsa)
			&lcApelProcedura
		Else
			&lcValoareIntoarsa = &lcApelProcedura
		Endif
		
	ENDPROC

	PROCEDURE do_reset
		This.tx_CAUTARE.ReadOnly = .F.
		This.tx_CAUTARE.Enabled = .F.
		This.crITERIU.Enabled = .F.
		This.crITERIU.Value = 1
		lcValoareAfisata = This.cvar_afisata
		&lcValoareAfisata = Null
		lcValoareFiltru = This.cvarfiltru
		&lcValoareFiltru = Null
		This.Refresh()
		
	ENDPROC

	PROCEDURE do_schimba_explicatia		&& Schimba caption-ul de la label1.
		Lparameters tcExplicatie
		This.lb_EXPLICATIE.Caption= Alltrim(tcExplicatie)
	ENDPROC

	PROCEDURE Init
		This.tx_cautare.ControlSource=This.cvar_afisata
		If This.ntip = 1
			This.tx_cautare.Width = This.tx_cautare.Width + This.criteriu.Width
			This.tx_cautare.Left = This.criteriu.Left
			This.criteriu.Visible = .F.
		Endif
		If Empty(This.cvarfiltru)
			This.cvarfiltru = This.cvar_afisata
		Endif
	ENDPROC

	PROCEDURE Criteriu.InteractiveChange
		This.Parent.nvaloarecriteriu = This.Value
	ENDPROC

	PROCEDURE opt_cautare.Click
		This.Parent.Value=This.Value
		If This.Value = 2
			This.Parent.do_apeleaza()
		Else
			This.Parent.do_reset()
		Endif
	ENDPROC

	PROCEDURE opt_cautare.ProgrammaticChange
		This.Parent.Value=This.Value
		If This.Value = 2
			This.Parent.do_apeleaza()
		Else
			This.Parent.do_reset()
		Endif
	ENDPROC

	PROCEDURE tx_cautare.DblClick
		If This.Parent.opT_CAUTARE.Value = 2
			This.Parent.do_apeleaza()
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS ct_perioada AS _container OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_optiongrup1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_textbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_textbox2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Caut_anluna1" UniqueID="" Timestamp="" />

	*<PropValue>
		Height = 50
		Name = "ct_perioada"
		Width = 266
	*</PropValue>

	ADD OBJECT '_optiongrup1' AS _optiongrup WITH ;
		AutoSize = .T., ;
		BorderStyle = 0, ;
		Height = 49, ;
		Left = 0, ;
		Name = "_optiongrup1", ;
		TabIndex = 3, ;
		Top = 0, ;
		Width = 109, ;
		ZOrderSet = 7, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "O singura luna", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "O perioada", ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 27
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_textbox1' AS _textbox WITH ;
		Alignment = 3, ;
		Format = "RK", ;
		Height = 23, ;
		InputMask = "99/9999", ;
		Left = 108, ;
		Name = "_textbox1", ;
		TabIndex = 14, ;
		Top = 23, ;
		Visible = .F., ;
		Width = 78, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_textbox2' AS _textbox WITH ;
		Alignment = 3, ;
		Format = "RK", ;
		Height = 23, ;
		InputMask = "99/9999", ;
		Left = 191, ;
		Name = "_textbox2", ;
		TabIndex = 15, ;
		Top = 23, ;
		Visible = .F., ;
		Width = 68, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'Caut_anluna1' AS caut_anluna WITH ;
		Left = 108, ;
		Name = "Caut_anluna1", ;
		TabIndex = 13, ;
		Top = 2, ;
		ZOrderSet = 10, ;
		cboan.Name = "cboan", ;
		cboluna.Name = "cboluna"
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />
	
	PROCEDURE _optiongrup1.Valid
		This.caut_anluna1.Visible = Iif(This.Value=1,.T.,.F.)
		
		This._textbox1.Visible = Iif(This.Value=2,.T.,.F.)
		This._textbox2.Visible = Iif(This.Value=2,.T.,.F.)
		If This.Value=1
			This.caut_anluna1.SetFocus
		Else
			This._textbox1.SetFocus
			If Empty(This._textbox1.Value)
				This._textbox1.Value = Padl(gnLuna,2,'0') + Padl(gnAn,4,'0')
			Endif
			If Empty(This._textbox2.Value)
				This._textbox2.Value = This._textbox1.Value
			Endif
		Endif
	ENDPROC

	PROCEDURE _textbox1.LostFocus
		If Empty(Thisform._textbox2.Value)
			Thisform._textbox2.Value=This.Value
		Endif
	ENDPROC

	PROCEDURE _textbox1.Valid
		If !Empty(This.Value)
			lcLuna=Substr(Alltrim(This.Value),1,2)
			lcAn=Substr(Alltrim(This.Value),3)
			If Empty(lcAn) Or Len(lcAn)<4
				lcAn=Alltrim(Str(Year(Date())))
				This.Value=Padl(lcLuna,2,'0')+lcAn
			Endif
			If Type("DATE(VAL(lcAn),VAL(lcLuna),1)")!="D"
				aMESSAGEBOX("Data invalida!",0+16,"Eroare")
				Return 0
			Endif
		Endif
	ENDPROC

	PROCEDURE _textbox2.LostFocus
		If Empty(Thisform._textbox1.Value)
			Thisform._textbox1.Value=This.Value
		Endif
	ENDPROC

	PROCEDURE _textbox2.Valid
		If !Empty(This.Value)
			lcLuna=Substr(Alltrim(This.Value),1,2)
			lcAn=Substr(Alltrim(This.Value),3)
			If Empty(lcAn) Or Len(lcAn)<4
				lcAn=Alltrim(Str(Year(Date())))
				This.Value=Padl(lcLuna,2,'0')+lcAn
			Endif
			If Type("DATE(VAL(lcAn),VAL(lcLuna),1)")!="D"
				aMESSAGEBOX("Data invalida!",0+16,"Eroare")
				Return 0
			Endif
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_caut_luna AS _frmbase OF "..\..\..\roagest\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Clb_an_luna1" UniqueID="" Timestamp="" />

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 63
		Name = "frm_caut_luna"
		Width = 360
		_shape1.Name = "_shape1"
		_shape2.Left = 360
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 330
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 0
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'Clb_an_luna1' AS clb_an_luna WITH ;
		Height = 29, ;
		Left = 4, ;
		Name = "Clb_an_luna1", ;
		Top = 32, ;
		Width = 351, ;
		LB_SIMPLU1.AutoSize = .F., ;
		LB_SIMPLU1.Height = 17, ;
		LB_SIMPLU1.Left = 8, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 7, ;
		LB_SIMPLU1.Width = 192, ;
		cb1.Left = 211, ;
		cb1.Name = "cb1", ;
		cb1.Top = 2, ;
		cb2.Left = 273, ;
		cb2.Name = "cb2", ;
		cb2.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE Init
		LPARAMETERS tcTitlu, tcLabelText
		
		IF !EMPTY(tcTitlu) AND TYPE('tcTitlu') = 'C'
			this.lb_TITLU_ALB_B121.Caption = tcTitlu
		ENDIF 
		
		IF !EMPTY(tcLabelText) AND TYPE('tcLabelText') = 'C'
			this.clb_an_luna1.lb_SIMPLU1.Caption = tcLabelText
		ENDIF 
	ENDPROC

	PROCEDURE Clb_an_luna1.cb1.Valid
		IF TYPE('poLuna') = 'O'
			poLuna.nLuna = INT(VAL(this.Value))
			poLuna.nAn = INT(VAL(this.Parent.cb2.Value))
		ENDIF 	
	ENDPROC

	PROCEDURE Clb_an_luna1.cb2.Valid
		IF TYPE('poLuna') = 'O'
			poLuna.nAn = INT(VAL(this.Value))
			poLuna.nLuna = INT(VAL(this.Parent.cb1.Value))
		ENDIF 	
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_data AS _frmbase OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="txt_data" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 71
		Name = "frm_data"
		Width = 247
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 241
		_shape2.Height = 29
		_shape2.Left = 184
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 66
		Lb_titlu_alb_b121.Caption = "Data"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 4
		BUT_TERMIN1.Left = 217
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Top = 1
		Gridsort1.Left = 132
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 5
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 186, ;
		Name = "But_renunt1", ;
		TabIndex = 3, ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'txt_data' AS textbox WITH ;
		Alignment = 3, ;
		ControlSource = "pdData", ;
		Height = 23, ;
		Left = 59, ;
		Name = "txt_data", ;
		TabIndex = 1, ;
		Top = 39, ;
		Width = 132
		*< END OBJECT: BaseClass="textbox" />

ENDDEFINE

DEFINE CLASS frm_filtru_luna AS formtermin OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Text2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: makef_ora
		*m: makef_vfp
		*p: camp_nume
		*p: filtru
		*p: filtru_vfp
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		filtru = 
		filtru_vfp = 
		Height = 131
		Name = "frm_filtru_luna"
		ScrollBars = 0
		Width = 263
		_shape1.Name = "_shape1"
		_shape2.Left = 228
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 232
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'Text1' AS textbox WITH ;
		Alignment = 1, ;
		Format = "RK", ;
		Height = 25, ;
		InputMask = "99/9999", ;
		Left = 62, ;
		Name = "Text1", ;
		TabIndex = 1, ;
		ToolTipText = "", ;
		Top = 47, ;
		Value = , ;
		Width = 191
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Text2' AS textbox WITH ;
		Alignment = 1, ;
		Format = "RK", ;
		Height = 25, ;
		InputMask = "99/9999", ;
		Left = 62, ;
		Name = "Text2", ;
		TabIndex = 2, ;
		ToolTipText = "", ;
		Top = 96, ;
		Value = , ;
		Width = 191
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE Destroy
		With This
			Local lcLuna1, lcLuna2, lcSemn1, lcSemn2, lcFiltru, lcListaCampuri, lcCamp
			lcListaCampuri = ""
			lcCamp = ""
			lcLuna1 = .text1.Value
			lcLuna2 = .text2.Value
			If Empty(lcLuna1) AND EMPTY(lcLuna2)
				.filtru = ""
				.filtru_vfp = ""
				Return
			Endif
			pcValoare1 = SUBSTR(lcLuna1,1,2)+"/"+SUBSTR(lcLuna1,3)
			pcValoare2 = SUBSTR(lcLuna2,1,2)+"/"+SUBSTR(lcLuna2,3)
			
			thisform.makef_ora(lcLuna1,lcLuna2)
			thisform.makef_vfp(lcLuna1,lcLuna2)
			pcFiltru = .filtru
			pcFiltruVFP = .filtru_vfp
		ENDWITH
	ENDPROC

	PROCEDURE Init
		LPARAMETERS lcCampNume,lcTitlu,lnCriteriu,lnCriteriu2
		
		DODEFAULT()
		lctitlu=STRTRAN(lcTitlu,'\<','')
		WITH this
			.camp_nume = lcCampNume
			.Lb_titlu_alb_b121.Caption = UPPER(lcTitlu)
			.text1.ToolTipText='Introduceti expresia cu care se compara ' + lower(lcTitlu)
			.text2.ToolTipText='Introduceti expresia cu care se compara ' + lower(lcTitlu)
			IF EMPTY(lccampnume)
				.text1.Enabled = .F.
				.criteriu.Enabled = .F.
				.text2.Enabled = .F.
				.criteriu2.Enabled = .F.
			ENDIF 
		ENDWITH 
	ENDPROC

	PROCEDURE makef_ora
		Lparameters lcLuna1,lcLuna2
		Local llCampuri,lcListaCampuri,lcFiltru
		With Thisform
			lcFiltru = [nume_camp_cautat between ]+Alltrim(Str(Val(Substr(lcLuna1,1,2))+Val(Substr(lcLuna1,3))*12))+[ and ]+;
				ALLTRIM(Str(Val(Substr(lcLuna2,1,2))+Val(Substr(lcLuna2,3))*12))+[ ]
			llCampuri=.F.
			lcListaCampuri=.camp_nume
			Do While !Empty(lcListaCampuri)
				If Occurs(',',lcListaCampuri)>0
					lcCamp=Substr(lcListaCampuri,1,At(',',lcListaCampuri,1)-1)
					lcListaCampuri=Substr(lcListaCampuri,At(',',lcListaCampuri,1)+1)
					llCampuri=.T.
				Else
					lcCamp=lcListaCampuri
					lcListaCampuri=""
				Endif
				.filtru = .filtru + [conditie_logica(] + Strtran(lcFiltru,"nume_camp_cautat",Upper(lcCamp)) + [)]
			Enddo
			If llCampuri
				.filtru = Strtran([ AND (] + Strtran(.filtru,"conditie_logica"," OR ",2) + [)],"conditie_logica","")
			Else
				.filtru = Strtran(.filtru,"conditie_logica"," AND ")
			Endif
		Endwith
	ENDPROC

	PROCEDURE makef_vfp
		Lparameters lcLuna1,lcLuna2
		Local llCampuri,lcListaCampuri,lcFiltru
		With Thisform
			lcFiltru = [nume_camp_cautat>=]+Alltrim(Str(Val(Substr(lcLuna1,1,2))+Val(Substr(lcLuna1,3))*12))+[ and nume_camp_cautat<=]+;
				ALLTRIM(Str(Val(Substr(lcLuna2,1,2))+Val(Substr(lcLuna2,3))*12))+[ ]
			llCampuri=.F.
			lcListaCampuri=.camp_nume
			Do While !Empty(lcListaCampuri)
				If Occurs(',',lcListaCampuri)>0
					lcCamp=Substr(lcListaCampuri,1,At(',',lcListaCampuri,1)-1)
					lcListaCampuri=Substr(lcListaCampuri,At(',',lcListaCampuri,1)+1)
					llCampuri=.T.
				Else
					lcCamp=lcListaCampuri
					lcListaCampuri=""
				Endif
				.filtru_vfp = .filtru_vfp + [conditie_logica(] + Strtran(lcFiltru,"nume_camp_cautat",Upper(lcCamp)) + [)]
			Enddo
			If llCampuri
				.filtru_vfp = Strtran([ AND (] + Strtran(.filtru_vfp,"conditie_logica"," OR ",2) + [)],"conditie_logica","")
			Else
				.filtru_vfp = Strtran(.filtru_vfp,"conditie_logica"," AND ")
			Endif
		Endwith
		
	ENDPROC

	PROCEDURE Unload
		RETURN this.filtru 
	ENDPROC

	PROCEDURE Text1.LostFocus
		thisform.text2.Value=this.Value 
	ENDPROC

	PROCEDURE Text1.Valid
		IF !empty(this.value)
			lcLuna=SUBSTR(ALLTRIM(this.Value),1,2)
			lcAn=SUBSTR(ALLTRIM(this.Value),3)
			IF EMPTY(lcAn) OR LEN(lcAn)<4
				lcAn=ALLTRIM(STR(YEAR(DATE())))
				this.value=PADL(lcLuna,2,'0')+lcAn
			ENDIF
			IF TYPE("DATE(VAL(lcAn),VAL(lcLuna),1)")!="D"
				aMESSAGEBOX("Data invalida!",0+16,"Eroare")
				RETURN 0
			ENDIF
		ENDIF
	ENDPROC

	PROCEDURE Text2.Valid
		IF !empty(this.value)
			lcLuna=SUBSTR(ALLTRIM(this.Value),1,2)
			lcAn=SUBSTR(ALLTRIM(this.Value),3)
			IF EMPTY(lcAn) OR LEN(lcAn)<4
				lcAn=ALLTRIM(STR(YEAR(DATE())))
				this.value=PADL(lcLuna,2,'0')+lcAn
			ENDIF
			IF TYPE("DATE(VAL(lcAn),VAL(lcLuna),1)")!="D"
				aMESSAGEBOX("Data invalida!",0+16,"Eroare")
				RETURN 0
			ENDIF
		ENDIF
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_filtru_numar AS formtermin OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Criteriu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Criteriu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Grup_optiuni_filtru_numar1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text2" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: makef_ora
		*m: makef_vfp
		*p: camp_nume
		*p: filtru
		*p: filtru_vfp
		*p: nrzec
		*p: tip
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		filtru = 
		filtru_vfp = 
		Height = 131
		Name = "frm_filtru_numar"
		nrzec = 0
		ScrollBars = 0
		tip = 
		Width = 298
		_shape1.Name = "_shape1"
		_shape2.Left = 265
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 267
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'Criteriu1' AS criteriu_numar WITH ;
		Left = 26, ;
		Name = "Criteriu1", ;
		TabIndex = 5, ;
		Top = 42
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'Criteriu2' AS criteriu_numar WITH ;
		Left = 26, ;
		Name = "Criteriu2", ;
		Top = 96
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'Grup_optiuni_filtru_numar1' AS grup_optiuni_filtru_numar WITH ;
		Left = 91, ;
		Name = "Grup_optiuni_filtru_numar1", ;
		Top = 69, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.Left = 66, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'Text1' AS _textbox WITH ;
		Alignment = 1, ;
		Format = "K", ;
		InputMask = "999 999 999 999", ;
		Left = 82, ;
		Name = "Text1", ;
		TabIndex = 1, ;
		Top = 43, ;
		Value = 0, ;
		Width = 191
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'Text2' AS _textbox WITH ;
		Alignment = 1, ;
		Format = "K", ;
		InputMask = "999 999 999 999", ;
		Left = 82, ;
		Name = "Text2", ;
		TabIndex = 2, ;
		Top = 97, ;
		Value = 0, ;
		Width = 191
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE Destroy
		Local lcNumar1, lcNumar2, lnCriteriu1, lnCriteriu2, lcIntre, lnNrZec, lcNumarVFP1, lcNumarVFP2
		
		With Thisform
			
			Do Case
			Case .Grup_optiuni_filtru_numar1.Value = 1
				lcIntre = [ AND ]
			Case .Grup_optiuni_filtru_numar1.Value = 2
				lcIntre = [ OR ]
			Endcase
			lnCriteriu1 = .criteriu1.Value
			lnCriteriu2 = .criteriu2.Value
			DO case
			CASE .tip='N'
				lnNrZec=Val(Alltrim(.nrZec))
				lcNumar1 = Alltrim(Str(.Text1.Value,MAX(20,Len(Str(.Text1.Value))),lnNrZec))
				lcNumar2 = Alltrim(Str(.Text2.Value,MAX(20,Len(Str(.Text2.Value))),lnNrZec))
				lcNumarVFP1 =lcNumar1
				lcNumarVFP2 = lcNumar2
			CASE LEFT(.tip,1)='D'
				lcNumar1=Alltrim(Dtos(.Text1.Value))
				lcNumar2=Alltrim(Dtos(.Text2.Value))
				lcNumarVFP1=Alltrim(Dtoc(.Text1.Value))
				lcNumarVFP2=Alltrim(Dtoc(.Text2.Value))
			CASE .tip='T'
			IF !EMPTY(.Text1.Value)
				lcNumar1=Alltrim(TTOC(.Text1.Value,1))
				lcNumarVFP1=Alltrim(TTOC(.Text1.Value,1))
			ENDIF 
			IF !EMPTY(.Text2.Value)
				lcNumar2=Alltrim(TTOC(.Text2.Value,1))
				lcNumarVFP2=Alltrim(TTOC(.Text2.Value,1))	
			ENDIF 
			ENDCASE 
			If Empty(lcNumar1) And Empty(lcNumar2)
				.filtru = ""
				.filtru_vfp = ""
				Return
			ENDIF
		
			Thisform.makef_ora(lcNumar1,lcNumar2,lnCriteriu1,lnCriteriu2)
			Thisform.makef_vfp(lcNumarVFP1,lcNumarVFP2,lnCriteriu1,lnCriteriu2)
			pcFiltru = .filtru
			pcFiltruVFP = .filtru_vfp
		
			If Type("pcValoare1") = "C" && variabila privata folosita in ck_filtru_text pt a initializa proprietatea cValoare1
				pcValoare1 = lcNumarVFP1
			Endif
			If Type("pcValoare2") = "C" && variabila privata folosita in ck_filtru_text pt a initializa proprietatea cValoare2
				pcValoare2 = lcNumarVFP2
			Endif
			If Type("pcIntre") = "C" && variabila privata folosita in ck_filtru_text pt a initializa proprietatea cIntre
				pcIntre = lcIntre
			Endif
			If Type("pnCriteriu")="N"
				pnCriteriu = lnCriteriu1
			ENDIF
		
			If Type("pnCriteriu2")="N"
				pnCriteriu2 = lnCriteriu2
			Endif
		Endwith
	ENDPROC

	PROCEDURE Init
		LPARAMETERS lcCampNume,lcTitlu,lnCriteriu1,lnCriteriu2,lcTip,lcMask,lnNrZec
		
		DODEFAULT()
		
		lctitlu=STRTRAN(lcTitlu,'\<','')
		WITH this
			.tip = lcTip
			IF EMPTY(lcTip)
				.tip='N'
			ENDIF
			.criteriu1.value = lnCriteriu1
			.criteriu2.value = lnCriteriu2
			.camp_nume = lcCampNume
			.Lb_titlu_alb_b121.Caption = UPPER(lcTitlu)
			.nrZec = ALLTRIM(STR(lnNrZec))
		*	.text1.ToolTipText='Introduceti expresia cu care se compara ' + lower(lcTitlu)
			IF EMPTY(lccampnume)
				.text1.Enabled = .F.
				.text2.Enabled = .F.
				.criteriu1.Enabled = .F.
				.criteriu2.Enabled = .F.
			ENDIF
			IF !EMPTY(lcMask)
				.text1.inputmask=lcMask
				.text2.inputmask=lcMask
			ENDIF
			IF LEFT(.tip,1)='D' && D, D1 (fara nvl())
				.Grup_optiuni_filtru_numar1.Visible=.F.
				.text1.inputmask=""
				.text1.value={}
				.criteriu1.RowSource="> = ,1, > ,2"
				.criteriu1.value=1
				.text2.inputmask=""
				.text2.value={}
				.criteriu2.RowSource="< = ,1, < ,2"
				.criteriu2.value=1
			ENDIF
			IF .tip='T'
				.Grup_optiuni_filtru_numar1.Visible=.F.
				.text1.inputmask=""
				.text1.value={// : :}
				.criteriu1.RowSource="> = ,1, > ,2"
				.criteriu1.value=1
				.text2.inputmask=""
				.text2.value={// : :}
				.criteriu2.RowSource="< = ,1, < ,2"
				.criteriu2.value=1
			ENDIF
		ENDWITH 
	ENDPROC

	PROCEDURE makef_ora
		Lparameters lcNumar1,lcNumar2,lnCriteriu1,lnCriteriu2
		Local llCampuri,lcListaCampuri,lcFiltru
		lcFiltru=""
		
		With Thisform
			If .tip=='N'
				*!*			lcNumar1=Alltrim(.text1.Value)
				*!*			lcNumar2=Alltrim(.text2.Value)
				*!*			If lcNumar1="0" And lcNumar2="0"
				*!*				.filtru = ""
				*!*				Return
				*!*			Endif
				Do Case
					Case lnCriteriu1 = 1
						lcSemn1 = [>=]
					Case lnCriteriu1 = 2
						lcSemn1 = [<=]
					Case lnCriteriu1 = 3
						lcSemn1 = [=]
					Case lnCriteriu1 = 4
						lcSemn1 = [<>]
					Case lnCriteriu1 = 5
						lcSemn1 = [>]
					Case lnCriteriu1 = 6
						lcSemn1 = [<]
				Endcase
				Do Case
					Case lnCriteriu2 = 1
						lcSemn2 = [>=]
					Case lnCriteriu2 = 2
						lcSemn2 = [<=]
					Case lnCriteriu2 = 3
						lcSemn2 = [=]
					Case lnCriteriu2 = 4
						lcSemn2 = [<>]
					Case lnCriteriu2 = 5
						lcSemn2 = [>]
					Case lnCriteriu2 = 6
						lcSemn2 = [<]
				Endcase
				If This.Grup_optiuni_filtru_numar1.Value = 1
					lcFiltru = [nume_camp_cautat] + lcSemn1 + lcNumar1 + [ AND nume_camp_cautat ] + lcSemn2 + lcNumar2
				Else
					lcFiltru = [nume_camp_cautat ] + lcSemn1 + lcNumar1 + [ OR nume_camp_cautat ] + lcSemn2 + lcNumar2
				Endif
			Else
				*!*			lcNumar1 = Dtos(.text1.Value)
				*!*			lcNumar2 = Dtos(.text2.Value)
				*!*			If Empty(lcNumar1) And Empty(lcNumar2)
				*!*				.filtru = ""
				*!*				Return
				*!*			Endif
				If .tip = 'T'
					pcDataEmpty = [1900-01-01 00:00:00]
				Else
					pcDataEmpty = [1900-01-01]
				Endif
				If Empty(lcNumar1)
					lcNumar1 = pcDataEmpty
				Endif
				If Empty(lcNumar2)
					lcNumar2 = pcDataEmpty
				Endif
		
				Do Case
					Case lnCriteriu1 = 1
						If .tip = 'T'
							lcNumar1 = ['] + lcNumar1 + [','YYYYMMDDHH24:MI:SS']	&& >=
						Else
							lcNumar1 = ['] + lcNumar1 + [ 00:00:00','YYYY-MM-DD HH24:MI:SS']	&& >=
						Endif
					Case lnCriteriu1 = 2
						If .tip = 'T'
							lcNumar1 = ['] + lcNumar1 + [','YYYYMMDDHH24:MI:SS']	&& >=
						Else
							lcNumar1 = ['] + lcNumar1 + [','YYYY-MM-DD']						&& >
						Endif
				Endcase
		
				Do Case
					Case lnCriteriu2 = 1
						If .tip = 'T'
							lcNumar2 = ['] + lcNumar2 + [','YYYYMMDDHH24:MI:SS']	&& <=
						Else
							lcNumar2 = ['] + lcNumar2 + [ 23:59:59','YYYY-MM-DD HH24:MI:SS']	&& <=
						Endif
					Case lnCriteriu2 = 2
						If .tip = 'T'
							lcNumar2 = ['] + lcNumar2 + [','YYYYMMDDHH24:MI:SS']	&& <=
						Else
							lcNumar2 = ['] + lcNumar2 + [','YYYY-MM-DD']						&& <
						Endif
				Endcase
				If .Grup_optiuni_filtru_numar1.Value = 1
					If .tip = 'T'
						lcFiltru = [NVL(nume_camp_cautat,to_date('] + pcDataEmpty + [','YYYY-MM-DD HH24:MI:SS')) between to_date(] + lcNumar1 + [) AND to_date(] + lcNumar2 + [)]
					ELSE
						IF .tip = 'D1'
							lcFiltru = [nume_camp_cautat between to_date(] + lcNumar1 + [) AND to_date(] + lcNumar2 + [)]
						ELSE 
							lcFiltru = [NVL(nume_camp_cautat,to_date('] + pcDataEmpty + [','YYYY-MM-DD')) between to_date(] + lcNumar1 + [) AND to_date(] + lcNumar2 + [)]
						ENDIF 	
					Endif
				Else
					If .tip = 'T'
						lcFiltru = [NVL(nume_camp_cautat,to_date('] + pcDataEmpty + [','YYYY-MM-DD HH24:MI:SS')) between to_date(] + lcNumar1 + [) OR to_date(] + lcNumar2 + [)]
					ELSE
						IF .tip = 'D1'
							lcFiltru = [nume_camp_cautat between to_date(] + lcNumar1 + [) OR to_date(] + lcNumar2 + [)]
						ELSE 
							lcFiltru = [NVL(nume_camp_cautat,to_date('] + pcDataEmpty + [','YYYY-MM-DD')) between to_date(] + lcNumar1 + [) OR to_date(] + lcNumar2 + [)]
						ENDIF 	
					Endif
		
				Endif
			Endif
			llCampuri=.F.
			lcListaCampuri=.camp_nume
			Do While !Empty(lcListaCampuri)
				If Occurs(',',lcListaCampuri)>0
					lcCamp=Substr(lcListaCampuri,1,At(',',lcListaCampuri,1)-1)
					lcListaCampuri=Substr(lcListaCampuri,At(',',lcListaCampuri,1)+1)
					llCampuri=.T.
				Else
					lcCamp=lcListaCampuri
					lcListaCampuri=""
				Endif
				.filtru = .filtru + [conditie_logica(] + Strtran(lcFiltru,"nume_camp_cautat",Upper(lcCamp)) + [)]
			Enddo
			If llCampuri
				.filtru = Strtran([ AND (] + Strtran(.filtru,"conditie_logica"," OR ",2) + [)],"conditie_logica","")
			Else
				.filtru = Strtran(.filtru,"conditie_logica"," AND ")
			Endif
		Endwith
		
	ENDPROC

	PROCEDURE makef_vfp
		Lparameters lcNumar1,lcNumar2,lnCriteriu1,lnCriteriu2
		Local llCampuri,lcListaCampuri,lcFiltru
		lcFiltru=""
		With Thisform
			If .tip='N'
		*!*			lcNumar1=Alltrim(.text1.Value)
		*!*			lcNumar2=Alltrim(.text2.Value)
		*!*			If (lcNumar1="0" And lcNumar2="0")
		*!*				.filtru_vfp = ""
		*!*				Return
		*!*			Endif
				Do Case
				Case lnCriteriu1 = 1
					lcSemn1 = [>=]
				Case lnCriteriu1 = 2
					lcSemn1 = [<=]
				Case lnCriteriu1 = 3
					lcSemn1 = [=]
				Case lnCriteriu1 = 4
					lcSemn1 = [<>]
				Case lnCriteriu1 = 5
					lcSemn1 = [>]
				Case lnCriteriu1 = 6
					lcSemn1 = [<]
				Endcase
				Do Case
				Case lnCriteriu2 = 1
					lcSemn2 = [>=]
				Case lnCriteriu2 = 2
					lcSemn2 = [<=]
				Case lnCriteriu2 = 3
					lcSemn2 = [=]
				Case lnCriteriu2 = 4
					lcSemn2 = [<>]
				Case lnCriteriu2 = 5
					lcSemn2 = [>]
				Case lnCriteriu2 = 6
					lcSemn2 = [<]
				Endcase
				If .Grup_optiuni_filtru_numar1.Value = 1
					lcFiltru = [nume_camp_cautat] + lcSemn1 + lcNumar1 + [ AND nume_camp_cautat ] + lcSemn2 + lcNumar2
				Else
					lcFiltru = [nume_camp_cautat ] + lcSemn1 + lcNumar1 + [ OR nume_camp_cautat ] + lcSemn2 + lcNumar2
				Endif
			Else
		*!*			lcNumar1 = Dtos(.text1.Value)
		*!*			lcNumar2 = Dtos(.text2.Value)
		*!*			If Empty(lcNumar1) And Empty(lcNumar2)
		*!*				.filtru_vfp = ""
		*!*				Return
		*!*			Endif
				Do Case
				Case lnCriteriu1 = 1
					lcSemn1=[>=]
				Case lnCriteriu1 = 2
					lcSemn1=[>]
				Endcase
				Do Case
				Case lnCriteriu2 = 1
					lcSemn2=[<=]
				Case lnCriteriu2 = 2
					lcSemn2=[<]
				Endcase
				If .Grup_optiuni_filtru_numar1.Value = 1
					lcFiltru = [nume_camp_cautat] + lcSemn1 +[CTOD('] +lcNumar1 + [') AND nume_camp_cautat ] + lcSemn2 +[CTOD(']+lcNumar2+[')]
				Else
					lcFiltru = [nume_camp_cautat ] + lcSemn1 +[CTOD(']+lcNumar1 + [') OR nume_camp_cautat ] + lcSemn2 + [CTOD(']+lcNumar2+[')]
				Endif
			Endif
			llCampuri=.F.
			lcListaCampuri=.camp_nume
			Do While !Empty(lcListaCampuri)
				If Occurs(',',lcListaCampuri)>0
					lcCamp=Substr(lcListaCampuri,1,At(',',lcListaCampuri,1)-1)
					lcListaCampuri=Substr(lcListaCampuri,At(',',lcListaCampuri,1)+1)
					llCampuri=.T.
				Else
					lcCamp=lcListaCampuri
					lcListaCampuri=""
				Endif
				.filtru_vfp = .filtru_vfp + [conditie_logica(] + Strtran(lcFiltru,"nume_camp_cautat",Upper(lcCamp)) + [)]
			Enddo
			If llCampuri
				.filtru_vfp = Strtran([ AND (] + Strtran(.filtru_vfp,"conditie_logica"," OR ",2) + [)],"conditie_logica","")
			Else
				.filtru_vfp = Strtran(.filtru_vfp,"conditie_logica"," AND ")
			Endif
		Endwith
		
	ENDPROC

	PROCEDURE Unload
		RETURN this.filtru 
	ENDPROC

	PROCEDURE Criteriu1.InteractiveChange
		thisform.text1.SetFocus 
	ENDPROC

	PROCEDURE Criteriu2.InteractiveChange
		thisform.text2.SetFocus 
	ENDPROC

	PROCEDURE Text1.LostFocus
		thisform.text2.Value=this.Value 
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_filtru_text AS formtermin OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Criteriu" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Criteriu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Grup_optiuni_filtru" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text2" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: makef_ora
		*m: makef_vfp
		*p: camp_nume
		*p: filtru
		*p: filtru_vfp
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		filtru = 
		filtru_vfp = 
		Height = 115
		Name = "frm_filtru_text"
		ScrollBars = 0
		Width = 320
		_shape1.Name = "_shape1"
		_shape2.Left = 286
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 290
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'Criteriu' AS criteriu_text WITH ;
		Left = 10, ;
		Name = "Criteriu", ;
		Top = 62
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'Criteriu2' AS criteriu_text WITH ;
		Left = 10, ;
		Name = "Criteriu2", ;
		TabIndex = 6, ;
		Top = 120
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'Grup_optiuni_filtru' AS grup_optiuni_filtru WITH ;
		Left = 94, ;
		Name = "Grup_optiuni_filtru", ;
		TabIndex = 7, ;
		Top = 90, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.Left = 66, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option3.Left = 134, ;
		Option3.Name = "Option3", ;
		Option3.Top = 5
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'Text' AS _textbox WITH ;
		Format = "!KT", ;
		Height = 25, ;
		Left = 110, ;
		Name = "Text", ;
		TabIndex = 1, ;
		ToolTipText = "", ;
		Top = 62, ;
		Width = 198
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'Text2' AS _textbox WITH ;
		Format = "!KT", ;
		Height = 25, ;
		Left = 110, ;
		Name = "Text2", ;
		TabIndex = 2, ;
		Top = 120, ;
		Width = 198
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE Destroy
		Do Case
		Case Thisform.grup_optiuni_filtru.Value = 1
			lcIntre = ''
		Case Thisform.grup_optiuni_filtru.Value = 2
			lcIntre = [ AND ]
		Otherwise
			lcIntre = [ OR ]
		Endcase
		
		If Type("pcIntre") = "C" && variabila privata folosita in ck_filtru_text pt a initializa proprietatea cIntre
			pcIntre = lcIntre
		Endif
		
		With This
			Local lnCriteriu,lnCriteriu2, lcNume, lcNume2
			lnCriteriu = .criteriu.Value
			lnCriteriu2 = .criteriu2.Value
		
			lcNume = Alltrim(STRTRAN(.Text.Value,['],['']))
			lcNume2 = Alltrim(STRTRAN(.text2.Value,['],['']))
		
			If Type("pcValoare1") = "C" && variabila privata folosita in ck_filtru_text pt a initializa proprietatea cValoare1
				pcValoare1 = lcNume
			Endif
			If Type("pcValoare2") = "C" && variabila privata folosita in ck_filtru_text pt a initializa proprietatea cValoare2
				pcValoare2 = lcNume2
			Endif
			If Type("pnCriteriu") = "N"
				pnCriteriu = lnCriteriu
			Endif
			If Type("pnCriteriu2") = "N"
				pnCriteriu2 = lnCriteriu2
			Endif
		
			If Empty(lcNume) And Empty(lcNume2) AND lnCriteriu<=5
				.filtru = ""
				.filtru_vfp = ""
				Return
			Endif
		
			Thisform.makef_ora(lcNume,lcNume2,lcIntre,lnCriteriu,lnCriteriu2)
			Thisform.makef_vfp(lcNume,lcNume2,lcIntre,lnCriteriu,lnCriteriu2)
			pcFiltru = .filtru
			pcFiltruVFP = .filtru_vfp
		Endwith
		*!*		Do Case
		*!*		Case lnCriteriu=1
		*!*			lcFiltru = [nume_camp_cautat LIKE '] + Upper(Alltrim(lcNume)) + [%']
		*!*		Case lnCriteriu=2
		*!*			lcFiltru = [nume_camp_cautat ='] + Upper(Alltrim(lcNume)) + [']
		*!*		Case lnCriteriu=3
		*!*			lcFiltru = [nume_camp_cautat !='] + Upper(Alltrim(lcNume)) + [']
		*!*		Case lnCriteriu=4
		*!*			lcFiltru = [nume_camp_cautat LIKE '%] + Upper(Alltrim(lcNume)) + [%']
		*!*		Case lnCriteriu=5
		*!*			lcFiltru = [nume_camp_cautat NOT LIKE '%] + Upper(Alltrim(lcNume)) + [%']
		*!*		Endcase
		*!*		If !Empty(lcIntre)
		*!*			Do Case
		*!*			Case lnCriteriu2=1
		*!*				lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat LIKE '] + Upper(Alltrim(lcNume2)) + [%']
		*!*			Case lnCriteriu2=2
		*!*				lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat ='] + Upper(Alltrim(lcNume2)) + [']
		*!*			Case lnCriteriu2=3
		*!*				lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat !='] + Upper(Alltrim(lcNume2)) + [']
		*!*			Case lnCriteriu2=4
		*!*				lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat LIKE '%] + Upper(Alltrim(lcNume2)) + [%']
		*!*			Case lnCriteriu2=5
		*!*				lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat NOT LIKE '%] + Upper(Alltrim(lcNume2)) + [%']
		*!*			Endcase
		*!*		Endif
		
		*!*		llCampuri=.F.
		*!*		lcListaCampuri=.camp_nume
		*!*		DO WHILE !EMPTY(lcListaCampuri)
		*!*			IF OCCURS(',',lcListaCampuri)>0
		*!*				lcCamp=SUBSTR(lcListaCampuri,1,AT(',',lcListaCampuri,1)-1)
		*!*				lcListaCampuri=SUBSTR(lcListaCampuri,AT(',',lcListaCampuri,1)+1)
		*!*				llCampuri=.T.
		*!*			ELSE
		*!*				lcCamp=lcListaCampuri
		*!*				lcListaCampuri=""
		*!*			ENDIF
		*!*			.filtru = .filtru + [conditie_logica(] + STRTRAN(lcFiltru,"nume_camp_cautat",UPPER(lcCamp)) + [)]
		*!*		ENDDO
		
		*!*		IF llCampuri
		*!*			.filtru = STRTRAN([ AND (] + STRTRAN(.filtru,"conditie_logica"," OR ",2) + [)],"conditie_logica","")
		*!*		ELSE
		*!*			.filtru = STRTRAN(.filtru,"conditie_logica"," AND ")
		*!*		ENDIF
	ENDPROC

	PROCEDURE Init
		Lparameters lcCampNume,lcTitlu,lnCriteriu,lnCriteriu2
		
		DoDefault()
		lcTitlu=Strtran(lcTitlu,'\<','')
		With Thisform
			.criteriu.Value = lnCriteriu
			If lnCriteriu>5
				.Text.ReadOnly=.T.
			Endif
			.criteriu2.Value = lnCriteriu2
			If lnCriteriu2>5
				.Text2.ReadOnly=.T.
			Endif
			.camp_nume = lcCampNume
			.Lb_titlu_alb_b121.Caption = UPPER(lcTitlu)
			.Text.ToolTipText='Introduceti expresia cu care se compara ' + Lower(lcTitlu)
			.text2.ToolTipText='Introduceti expresia cu care se compara ' + Lower(lcTitlu)
			If Empty(lcCampNume)
				.Text.Enabled = .F.
				.criteriu.Enabled = .F.
				.text2.Enabled = .F.
				.criteriu2.Enabled = .F.
			Endif
		Endwith
	ENDPROC

	PROCEDURE makef_ora
		Lparameters lcNume,lcNume2,lcIntre,lnCriteriu,lnCriteriu2
		Local llCampuri,lcListaCampuri,lcFiltru
		lcFiltru=""
		With This
			Do Case
			Case lnCriteriu=1
				lcFiltru = [nume_camp_cautat LIKE '] + Upper(Alltrim(lcNume)) + [%']
			Case lnCriteriu=2
				lcFiltru = [nume_camp_cautat ='] + Upper(Alltrim(lcNume)) + [']
			Case lnCriteriu=3
				lcFiltru = [nume_camp_cautat !='] + Upper(Alltrim(lcNume)) + [']
			Case lnCriteriu=4
				lcFiltru = [nume_camp_cautat LIKE '%] + Upper(Alltrim(lcNume)) + [%']
			Case lnCriteriu=5
				lcFiltru = [nume_camp_cautat NOT LIKE '%] + Upper(Alltrim(lcNume)) + [%']
			Case lnCriteriu=6
				lcFiltru = [nume_camp_cautat is null]
			Case lnCriteriu=7
				lcFiltru = [nume_camp_cautat is not null]
			Endcase
			If !Empty(lcIntre)
				Do Case
				Case lnCriteriu2=1
					lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat LIKE '] + Upper(Alltrim(lcNume2)) + [%']
				Case lnCriteriu2=2
					lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat ='] + Upper(Alltrim(lcNume2)) + [']
				Case lnCriteriu2=3
					lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat !='] + Upper(Alltrim(lcNume2)) + [']
				Case lnCriteriu2=4
					lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat LIKE '%] + Upper(Alltrim(lcNume2)) + [%']
				Case lnCriteriu2=5
					lcFiltru = lcFiltru + [ ] + Upper(Alltrim(lcIntre)) + [ nume_camp_cautat NOT LIKE '%] + Upper(Alltrim(lcNume2)) + [%']
				Case lnCriteriu=6
					lcFiltru = [nume_camp_cautat is null]
				Case lnCriteriu=7
					lcFiltru = [nume_camp_cautat is not null]
				Endcase
			Endif
			llCampuri=.F.
			lcListaCampuri=.camp_nume
			Do While !Empty(lcListaCampuri)
				If Occurs(',',lcListaCampuri)>0
					lcCamp=Substr(lcListaCampuri,1,At(',',lcListaCampuri,1)-1)
					lcListaCampuri=Substr(lcListaCampuri,At(',',lcListaCampuri,1)+1)
					llCampuri=.T.
				Else
					lcCamp=lcListaCampuri
					lcListaCampuri=""
				Endif
				.filtru = .filtru + [conditie_logica(] + Strtran(lcFiltru,"nume_camp_cautat",Upper(lcCamp)) + [)]
			Enddo
			If llCampuri
				.filtru = Strtran([ AND (] + Strtran(.filtru,"conditie_logica"," OR ",2) + [)],"conditie_logica","")
			Else
				.filtru = Strtran(.filtru,"conditie_logica"," AND ")
			Endif
		Endwith
	ENDPROC

	PROCEDURE makef_vfp
		Lparameters lcNume,lcNume2,lcIntre,lnCriteriu,lnCriteriu2
		Local llCampuri,lcListaCampuri,lcFiltru
		lcFiltru=""
		With This
			Do Case
			Case lnCriteriu = 1
				lcFiltru = "LIKE([" + Upper(lcNume) + "*],UPPER(nume_camp_cautat))"
			Case lnCriteriu = 2
				lcFiltru = "UPPER(nume_camp_cautat)=[" + Upper(lcNume) + "]"
			Case lnCriteriu = 3
				lcFiltru = "UPPER(nume_camp_cautat)<>[" + Upper(lcNume) + "]"
			Case lnCriteriu = 4
				lcFiltru = "LIKE([*" + Upper(lcNume) + "*],UPPER(nume_camp_cautat))"
			Case lnCriteriu = 5
		*.filtru = "upper(" + .camp_nume + ") NOT LIKE %" + UPPER(lcNume) + "%"
				lcFiltru = "!LIKE([*" + Upper(lcNume) + "*],UPPER(nume_camp_cautat))"
			Case lnCriteriu=6
				lcFiltru = [EMPTY(nume_camp_cautat)]
			Case lnCriteriu=7
				lcFiltru = [!EMPTY(nume_camp_cautat)]
			Endcase
			If !Empty(lcIntre)
				Do Case
				Case lnCriteriu2 = 1
					lcFiltru = lcFiltru + " " + Upper(Alltrim(lcIntre)) + " LIKE([" + Upper(lcNume2) + "*],UPPER(nume_camp_cautat))"
				Case lnCriteriu2 = 2
					lcFiltru = lcFiltru + " " + Upper(Alltrim(lcIntre)) + " UPPER(nume_camp_cautat)=[" + Upper(lcNume2) + "]"
				Case lnCriteriu2 = 3
					lcFiltru = lcFiltru + " " + Upper(Alltrim(lcIntre)) + " UPPER(nume_camp_cautat)<>[" + Upper(lcNume2) + "]"
				Case lnCriteriu2 = 4
					lcFiltru = lcFiltru + " " + Upper(Alltrim(lcIntre)) + " LIKE([*" + Upper(lcNume2) + "*],UPPER(nume_camp_cautat))"
				Case lnCriteriu2 = 5
					lcFiltru = lcFiltru + " " + Upper(Alltrim(lcIntre)) + " !LIKE([*" + Upper(lcNume2) + "*],UPPER(nume_camp_cautat))"
				Case lnCriteriu=6
					lcFiltru = [EMPTY(nume_camp_cautat)]
				Case lnCriteriu=7
					lcFiltru = [!EMPTY(nume_camp_cautat)]
				Endcase
			Endif
			llCampuri=.F.
			lcListaCampuri=.camp_nume
			Do While !Empty(lcListaCampuri)
				If Occurs(',',lcListaCampuri)>0
					lcCamp=Substr(lcListaCampuri,1,At(',',lcListaCampuri,1)-1)
					lcListaCampuri=Substr(lcListaCampuri,At(',',lcListaCampuri,1)+1)
					llCampuri=.T.
				Else
					lcCamp=lcListaCampuri
					lcListaCampuri=""
				Endif
				.filtru_vfp = .filtru_vfp + [conditie_logica(] + Strtran(lcFiltru,"nume_camp_cautat",Upper(lcCamp)) + [)]
			Enddo
		
			If llCampuri
				.filtru_vfp = Strtran([ AND (] + Strtran(.filtru_vfp,"conditie_logica"," OR ",2) + [)],"conditie_logica","")
			Else
				.filtru_vfp = Strtran(.filtru_vfp,"conditie_logica"," AND ")
			Endif
		Endwith
	ENDPROC

	PROCEDURE Unload
		RETURN this.filtru 
	ENDPROC

	PROCEDURE Criteriu.InteractiveChange
		If This.Value>5
			Thisform.Text.Value=""
			Thisform.Text.ReadOnly=.T.
		Else
			Thisform.Text.ReadOnly=.F.
			Thisform.Text.SetFocus
		Endif
	ENDPROC

	PROCEDURE Criteriu2.InteractiveChange
		If This.Value>5
			Thisform.Text2.Value=""
			Thisform.Text2.ReadOnly=.T.
		Else
			Thisform.Text2.ReadOnly=.F.
			Thisform.Text2.SetFocus
		Endif
	ENDPROC

	PROCEDURE Grup_optiuni_filtru.InteractiveChange
		IF this.Value # 1
			thisform.Height = 155
		ELSE 
			thisform.Height = 115
		ENDIF 
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_perioada AS _frmbase OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_optiongrup1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_textbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_textbox2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_image1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_image2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Caut_anluna1" UniqueID="" Timestamp="" />

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 106
		Name = "frm_perioada"
		Width = 375
		_shape1.Name = "_shape1"
		_shape2.Left = 340
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 6
		BUT_TERMIN1.Left = 343
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 5
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_image1' AS _image WITH ;
		Height = 20, ;
		Left = 112, ;
		Name = "_image1", ;
		Picture = ..\..\gestiuni\grafice\sg.ico, ;
		Top = 49, ;
		Width = 30
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="image" />

	ADD OBJECT '_image2' AS _image WITH ;
		Height = 20, ;
		Left = 112, ;
		Name = "_image2", ;
		Picture = ..\..\gestiuni\grafice\sg.ico, ;
		Top = 72, ;
		Visible = .F., ;
		Width = 30
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="image" />

	ADD OBJECT '_optiongrup1' AS _optiongrup WITH ;
		AutoSize = .T., ;
		Height = 46, ;
		Left = 3, ;
		Name = "_optiongrup1", ;
		TabIndex = 1, ;
		Top = 48, ;
		Width = 109, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "O singurã lunã", ;
		Option1.FontCharSet = 238, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "O perioadã", ;
		Option2.FontCharSet = 238, ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_textbox1' AS _textbox WITH ;
		Alignment = 3, ;
		Format = "k", ;
		Left = 144, ;
		Name = "_textbox1", ;
		TabIndex = 3, ;
		Top = 72, ;
		Value = {}, ;
		Visible = .F.
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_textbox2' AS _textbox WITH ;
		Alignment = 3, ;
		Format = "k", ;
		Left = 264, ;
		Name = "_textbox2", ;
		TabIndex = 4, ;
		Top = 72, ;
		Value = {}, ;
		Visible = .F.
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'Caut_anluna1' AS caut_anluna WITH ;
		Left = 144, ;
		Name = "Caut_anluna1", ;
		Top = 48, ;
		cboan.Name = "cboan", ;
		cboluna.Name = "cboluna"
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />
	
	PROCEDURE inainte_de_do_termin
		
		
		pcondper = IIF(thisform._optiongrup1.Value=1,ALLTRIM(STR(thisform.caut_anluna1.nan))+;
					PADL(ALLTRIM(STR(thisform.caut_anluna1.nluna)),2,'0'),DTOS(thisform._textbox1.Value)+'_'+DTOS(thisform._textbox2.Value))
		DODEFAULT()			
	ENDPROC

	PROCEDURE _optiongrup1.Valid
		thisform.caut_anluna1.Visible = IIF(this.Value=1,.t.,.f.)
		thisform._image1.Visible = IIF(this.Value=1,.t.,.f.)
		thisform._image2.Visible = IIF(this.Value=2,.t.,.f.)
		thisform._textbox1.Visible = IIF(this.Value=2,.t.,.f.)
		thisform._textbox2.Visible = IIF(this.Value=2,.t.,.f.)
		IF this.Value=1
			thisform.caut_anluna1.SetFocus 
		ELSE 
			thisform._textbox1.SetFocus 
		ENDIF 		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_perioada_luni AS _frmbase OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_optiongrup1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_textbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_textbox2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_image1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_image2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Caut_anluna1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: lmodificaluna
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 106
		lmodificaluna = .T.
		Name = "frm_perioada_luni"
		Width = 375
		_shape1.Name = "_shape1"
		_shape2.Height = 29
		_shape2.Left = 338
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 38
		Lb_titlu_alb_b121.Caption = "Alegeþi luna"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 6
		BUT_TERMIN1.Left = 343
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 5
		BUT_TERMIN1.Top = 1
		Gridsort1.Left = 34
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 42
	*</PropValue>

	ADD OBJECT '_image1' AS _image WITH ;
		Height = 20, ;
		Left = 143, ;
		Name = "_image1", ;
		Picture = ..\grafice\sg.ico, ;
		Stretch = 1, ;
		Top = 44, ;
		Width = 30
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="image" />

	ADD OBJECT '_image2' AS _image WITH ;
		Height = 20, ;
		Left = 143, ;
		Name = "_image2", ;
		Picture = ..\grafice\sg.ico, ;
		Stretch = 1, ;
		Top = 68, ;
		Visible = .F., ;
		Width = 30
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="image" />

	ADD OBJECT '_optiongrup1' AS _optiongrup WITH ;
		AutoSize = .T., ;
		Height = 46, ;
		Left = 33, ;
		Name = "_optiongrup1", ;
		TabIndex = 1, ;
		Top = 43, ;
		Width = 109, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "O singurã lunã", ;
		Option1.FontCharSet = 238, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "O perioadã", ;
		Option2.FontCharSet = 238, ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_textbox1' AS _textbox WITH ;
		Alignment = 3, ;
		Format = "RK", ;
		Height = 23, ;
		InputMask = "99/9999", ;
		Left = 175, ;
		Name = "_textbox1", ;
		TabIndex = 3, ;
		Top = 67, ;
		Visible = .F., ;
		Width = 78
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_textbox2' AS _textbox WITH ;
		Alignment = 3, ;
		Format = "RK", ;
		Height = 23, ;
		InputMask = "99/9999", ;
		Left = 269, ;
		Name = "_textbox2", ;
		TabIndex = 4, ;
		Top = 67, ;
		Visible = .F., ;
		Width = 68
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'Caut_anluna1' AS caut_anluna WITH ;
		Left = 175, ;
		Name = "Caut_anluna1", ;
		TabIndex = 2, ;
		Top = 43, ;
		cboan.Name = "cboan", ;
		cboluna.Name = "cboluna"
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />
	
	PROCEDURE inainte_de_do_termin
		If Thisform._optiongrup1.Value=1
			pcondper=Padl(Alltrim(Str(Thisform.caut_anluna1.nluna)),2,'0')+Alltrim(Str(Thisform.caut_anluna1.nan))
		Else
			If Empty(Thisform._textbox1.Value)
				aMessagebox("Nu ati completat luna initiala!",0+48,"Atentie")
				Thisform._textbox1.SetFocus
				Return .F.
			Endif
			If Empty(Thisform._textbox2.Value)
				aMessagebox("Nu ati completat luna initiala!",0+48,"Atentie")
				Thisform._textbox2.SetFocus
				Return .F.
			Endif
			pcondper=Thisform._textbox1.Value+'_'+Thisform._textbox2.Value
		Endif
		DoDefault()
	ENDPROC

	PROCEDURE Init
		Lparameters tlModificaLuna,tlTip
		Local lcLuna,lcAn
		This.lmodificaluna = tlModificaLuna
		If !This.lmodificaluna
			Thisform._image1.Visible=.F.
			Thisform.caut_anluna1.Enabled=.F.
		Endif
		lcLuna=Padl(Alltrim(Str(gnLuna)),2,'0')
		lcAn=Alltrim(Str(gnAn))
		Thisform._textbox1.Value=lcLuna+lcAn
		Thisform._textbox2.Value=lcLuna+lcAn
		Thisform._optiongrup1.Value = Iif(Empty(tlTip),1,Iif(tlTip=1,2,1))
	ENDPROC

	PROCEDURE _optiongrup1.InteractiveChange
		Thisform.caut_anluna1.Visible = Iif(This.Value=1,.T.,.F.)
		If Thisform.lmodificaluna
			Thisform._image1.Visible = Iif(This.Value=1,.T.,.F.)
		Endif
		Thisform._image2.Visible = Iif(This.Value=2,.T.,.F.)
		Thisform._textbox1.Visible = Iif(This.Value=2,.T.,.F.)
		Thisform._textbox2.Visible = Iif(This.Value=2,.T.,.F.)
	ENDPROC

	PROCEDURE _optiongrup1.ProgrammaticChange
		This.InteractiveChange()
		
	ENDPROC

	PROCEDURE _optiongrup1.Valid
		If This.Value=1
			Thisform.caut_anluna1.SetFocus
		Else
			Thisform._textbox1.SetFocus
		Endif
	ENDPROC

	PROCEDURE _textbox1.LostFocus
		If Empty(Thisform._textbox2.Value)
			Thisform._textbox2.Value=This.Value
		Endif
	ENDPROC

	PROCEDURE _textbox1.Valid
		IF !empty(this.value)
			lcLuna=SUBSTR(ALLTRIM(this.Value),1,2)
			lcAn=SUBSTR(ALLTRIM(this.Value),3)
			IF EMPTY(lcAn) OR LEN(lcAn)<4
				lcAn=ALLTRIM(STR(YEAR(DATE())))
				this.value=PADL(lcLuna,2,'0')+lcAn
			ENDIF
			IF TYPE("DATE(VAL(lcAn),VAL(lcLuna),1)")!="D"
				aMESSAGEBOX("Data invalida!",0+16,"Eroare")
				RETURN 0
			ENDIF
		ENDIF
	ENDPROC

	PROCEDURE _textbox2.LostFocus
		If Empty(Thisform._textbox1.Value)
			Thisform._textbox1.Value=This.Value
		Endif
	ENDPROC

	PROCEDURE _textbox2.Valid
		IF !empty(this.value)
			lcLuna=SUBSTR(ALLTRIM(this.Value),1,2)
			lcAn=SUBSTR(ALLTRIM(this.Value),3)
			IF EMPTY(lcAn) OR LEN(lcAn)<4
				lcAn=ALLTRIM(STR(YEAR(DATE())))
				this.value=PADL(lcLuna,2,'0')+lcAn
			ENDIF
			IF TYPE("DATE(VAL(lcAn),VAL(lcLuna),1)")!="D"
				aMESSAGEBOX("Data invalida!",0+16,"Eroare")
				RETURN 0
			ENDIF
		ENDIF
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_perioada_zzllaaaa AS _frmbase OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="lbPerioada" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_txDataf" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_txDatai" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: pddataf
		*p: pddatai
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 94
		Name = "frm_perioada_zzllaaaa"
		pddataf = {}
		pddatai = {}
		Width = 205
		_shape1.Left = -59
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape2.Height = 29
		_shape2.Left = 144
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 61
		Lb_titlu_alb_b121.Caption = "Alegeþi perioada"
		Lb_titlu_alb_b121.Left = 6
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 5
		BUT_TERMIN1.Left = 174
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 3
		BUT_TERMIN1.Top = 1
		Gridsort1.Left = 144
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 7
	*</PropValue>

	ADD OBJECT '_txDataf' AS _textbox WITH ;
		ControlSource = "thisform.pddataf", ;
		DisabledForeColor = 0,0,0, ;
		ForeColor = 0,0,0, ;
		Format = "k", ;
		Height = 22, ;
		Left = 97, ;
		Name = "_txDataf", ;
		TabIndex = 2, ;
		Top = 58, ;
		Width = 80, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_txDatai' AS _textbox WITH ;
		ControlSource = "thisform.pddatai", ;
		DisabledForeColor = 0,0,0, ;
		ForeColor = 0,0,0, ;
		Format = "k", ;
		Height = 22, ;
		Left = 13, ;
		Name = "_txDatai", ;
		TabIndex = 1, ;
		Top = 58, ;
		Width = 80, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 145, ;
		Name = "But_renunt1", ;
		TabIndex = 4, ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'lbPerioada' AS label WITH ;
		Alignment = 2, ;
		BackColor = 255,255,255, ;
		Caption = "Perioada", ;
		Comment = "*:OnResize=LT", ;
		Height = 17, ;
		Left = 13, ;
		Name = "lbPerioada", ;
		TabIndex = 6, ;
		Top = 36, ;
		Width = 63, ;
		ZOrderSet = 16
		*< END OBJECT: BaseClass="label" />
	
	PROCEDURE inainte_de_do_termin
		pdDataI = THISFORM.pdDataI
		pdDataF = THISFORM.pdDataF
		
		
		DO CASE
			CASE EMPTY(THISFORM.pdDataI)
				AMESSAGEBOX("Nu ati completat data initiala!",0+48,"Atentie")
				THISFORM._txDatai.SETFOCUS()
				RETURN .F.
			CASE EMPTY(THISFORM.pdDataF)
				AMESSAGEBOX("Nu ati completat data finala!",0+48,"Atentie")
				THISFORM._txDataf.SETFOCUS()
				RETURN .F.
			CASE THISFORM.pdDataI > THISFORM.pdDataF
				AMESSAGEBOX("Data finala trebuie sa fie mai mare decat data initiala !",0+48,"Atentie")
				THISFORM._txDataf.SETFOCUS()
				RETURN .F.
		ENDCASE 	
		
		RETURN .T.	
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		
		LOCAL lcData1 
		lcData1 = '01/'+ALLTRIM(STR(gnLuna))+'/'+ALLTRIM(STR(gnAn))
		thisform.pddatai = CTOD(lcData1)
		thisform.pddataf = ULTIMAZI(STR(gnAn), STR(gnLuna))
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_sel_cont AS formtermin OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Shape2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cboCont" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblCont" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblAcont" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Optiongroup1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label9" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: go
		*p: calias
		*p: nfel_cont
		*p: ocont
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		calias = 
		DoCreate = .T.
		Height = 122
		Name = "frm_sel_cont"
		nfel_cont = 0
		ocont = .NULL.
		ScrollBars = 0
		Width = 205
		_shape1.Name = "_shape1"
		_shape2.Height = 29
		_shape2.Left = 142
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 67
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 174
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Visible = .F.
	*</PropValue>

	ADD OBJECT 'cboCont' AS combobox WITH ;
		ColumnCount = 2, ;
		ColumnLines = .F., ;
		ColumnWidths = "40,40", ;
		Height = 24, ;
		Left = 12, ;
		Name = "cboCont", ;
		RowSourceType = 6, ;
		Style = 2, ;
		TabIndex = 1, ;
		Top = 60, ;
		Width = 84, ;
		ZOrderSet = 4
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'Label9' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Contul este considerat de:", ;
		FontBold = .F., ;
		Height = 17, ;
		Left = 10, ;
		Name = "Label9", ;
		TabIndex = 14, ;
		Top = 129, ;
		Width = 146, ;
		ZOrderSet = 10
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblAcont' AS label WITH ;
		BackStyle = 0, ;
		Caption = " ", ;
		FontItalic = .T., ;
		FontSize = 10, ;
		ForeColor = 0,0,128, ;
		Height = 18, ;
		Left = 146, ;
		Name = "lblAcont", ;
		TabIndex = 5, ;
		Top = 65, ;
		Width = 40, ;
		ZOrderSet = 6
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblCont' AS label WITH ;
		BackStyle = 0, ;
		Caption = " ", ;
		FontItalic = .T., ;
		FontSize = 10, ;
		ForeColor = 0,0,128, ;
		Height = 18, ;
		Left = 111, ;
		Name = "lblCont", ;
		TabIndex = 4, ;
		Top = 65, ;
		Width = 30, ;
		ZOrderSet = 5
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Optiongroup1' AS optiongroup WITH ;
		BackStyle = 0, ;
		ButtonCount = 2, ;
		ControlSource = "pnTipCont", ;
		Height = 26, ;
		Left = 35, ;
		Name = "Optiongroup1", ;
		TabIndex = 8, ;
		Top = 152, ;
		Value = 1, ;
		Width = 120, ;
		ZOrderSet = 8, ;
		Option1.AutoSize = .T., ;
		Option1.BackStyle = 0, ;
		Option1.Caption = "Activ", ;
		Option1.ControlSource = "", ;
		Option1.Height = 17, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.TabStop = .F., ;
		Option1.Top = 5, ;
		Option1.Value = 1, ;
		Option1.Width = 42, ;
		Option2.AutoSize = .T., ;
		Option2.BackStyle = 0, ;
		Option2.Caption = "Pasiv", ;
		Option2.ControlSource = "", ;
		Option2.Height = 17, ;
		Option2.Left = 60, ;
		Option2.Name = "Option2", ;
		Option2.TabStop = .F., ;
		Option2.Top = 5, ;
		Option2.Value = 0, ;
		Option2.Width = 48
		*< END OBJECT: BaseClass="optiongroup" />

	ADD OBJECT 'Renunt1' AS but_renunt WITH ;
		Left = 144, ;
		Name = "Renunt1", ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Shape2' AS shape WITH ;
		BackColor = 236,233,216, ;
		BackStyle = 0, ;
		BorderColor = 181,210,225, ;
		Height = 80, ;
		Left = 6, ;
		Name = "Shape2", ;
		Top = 36, ;
		Width = 191, ;
		ZOrderSet = 0
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'Shape3' AS shape WITH ;
		BackColor = 236,233,216, ;
		BackStyle = 0, ;
		BorderColor = 181,210,225, ;
		Height = 60, ;
		Left = 6, ;
		Name = "Shape3", ;
		Top = 124, ;
		Width = 191, ;
		ZOrderSet = 0
		*< END OBJECT: BaseClass="shape" />
	
	PROCEDURE go
		lcAlias = (Thisform.calias)
		IF !EMPTY(lcAlias)
			SELECT (lcAlias)
			With Thisform.ocont
				.cont = cont
				IF ISNULL(acont)
					.acont = ''
				ELSE 
					.acont=acont
				ENDIF 
			ENDWITH
			IF TYPE(lcAlias + '.fel_cont') # 'U'
				this.opTIONGROUP1.value = &lcAlias..fel_cont + 1
				this.nfel_cont = &lcAlias..fel_cont
			ENDIF 
		ENDIF 
		
		With Thisform.ocont
			Thisform.lblCont.Caption=.cont
			Thisform.lblAcont.Caption=.acont
			If !Empty(.cont) 
				Thisform.but_termin1.visible = .T.
			ELSE 
				Thisform.but_termin1.visible =.F.	
			ENDIF
		ENDWITH 
	ENDPROC

	PROCEDURE cboCont.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		thisform.go()
	ENDPROC

	PROCEDURE cboCont.Valid
		thisform.Go()
	ENDPROC

	PROCEDURE Optiongroup1.Valid
		IF TYPE('eactiv') # 'U'
			IF this.Value = 2
				eActiv = .f.
			ELSE 
				eActiv = .t.
			ENDIF 
		ENDIF 
		thisform.nfel_cont = this.Value - 1
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_sel_curs AS frm_termin_renunt OF "_frm_child.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Clb_curs1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_curs2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_valuta" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: lnorelease
		*p: ncurs1
		*p: ncurs2
		*p: nid_valuta
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 2
		DoCreate = .T.
		Height = 159
		lnorelease = .F.
		Name = "frm_sel_curs"
		ncurs1 = 0
		ncurs2 = 0
		nid_valuta = 0
		Width = 306
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE2.Left = 232
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		LB_TITLU_ALB_B121.Caption = "Cursul valutar"
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 6
		BUT_TERMIN1.Left = 273
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 4
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
		But_renunt1.Left = 244
		But_renunt1.Name = "But_renunt1"
		But_renunt1.TabIndex = 5
		But_renunt1.Top = 1
	*</PropValue>

	ADD OBJECT 'Clb_curs1' AS clb_tx_simplu WITH ;
		Left = 7, ;
		Name = "Clb_curs1", ;
		TabIndex = 1, ;
		Top = 47, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.ControlSource = "thisform.ncurs1", ;
		Text_simplu1.InputMask = (get_mask(6,gnPcurs)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Curs B.N.R.", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_curs2' AS clb_tx_simplu WITH ;
		Left = 7, ;
		Name = "Clb_curs2", ;
		TabIndex = 2, ;
		Top = 79, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.ControlSource = "thisform.ncurs2", ;
		Text_simplu1.InputMask = (get_mask(6,gnPcurs)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Cursul vamii", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_valuta' AS clb_tx_simplu WITH ;
		Left = 7, ;
		Name = "Clb_valuta", ;
		TabIndex = 3, ;
		Top = 111, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "Valuta", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE do_termin
		IF this.lnorelease
			this.Hide 
		ELSE 
			DODEFAULT()
		ENDIF 
	ENDPROC

	PROCEDURE inainte_de_do_termin
		IF EMPTY(this.clb_valuta.text_simplu1.Value) 
			aMESSAGEBOX('Completati numele valutei', 0, 'Atentie')
			llRet = .f.
		ELSE 
			llRet = .t.
		ENDIF 
		
		RETURN llRet
	ENDPROC

	PROCEDURE Init
		PARAMETERS tlRelease
		thisform.lNoRelease = tlRelease
	ENDPROC

	PROCEDURE Clb_curs1.Text_simplu1.Valid
		IF thisform.ncurs2 = 0
			thisform.ncurs2 = thisform.ncurs1
			thisform.clb_curs2.Refresh 
		ENDIF 
	ENDPROC

	PROCEDURE Clb_valuta.Text_simplu1.GotFocus
		pcselect = ['select nume_val,id_valuta from ] + gcs + [.nom_valute where 2=2']
		pcfiltru = [1=2]
		pcschema = ['']
		pcorder = [nume_val]
		pccoloane = [nume_val]
		pcTitlu = [Alegeti Valuta] 
		pcTitluColoane = [Valuta]
		locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,'')
		this.Value = locauta.nume_val
		thisform.nid_valuta = locauta.id_valuta
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_sel_luna AS ffergen OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Seip1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblTitlu" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cboLuna" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblLuna" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblAn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="CMDTERMIN1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_termin
		*m: go
		*p: calias
		*p: oluna
	*</DefinedPropArrayMethod>

	*<PropValue>
		AutoCenter = .T.
		BackColor = 255,255,255
		calias = 
		DoCreate = .T.
		Height = 129
		Name = "frm_sel_luna"
		oluna = .NULL.
		TitleBar = 0
		Width = 240
	*</PropValue>

	ADD OBJECT 'cboLuna' AS combobox WITH ;
		ColumnCount = 2, ;
		Height = 24, ;
		Left = 24, ;
		Name = "cboLuna", ;
		RowSourceType = 6, ;
		Style = 2, ;
		TabIndex = 1, ;
		Top = 67, ;
		Width = 72, ;
		ZOrderSet = 3
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'CMDTERMIN1' AS but_termin WITH ;
		Enabled = .F., ;
		Left = 209, ;
		Name = "CMDTERMIN1", ;
		TabIndex = 2, ;
		Top = 1, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'lblAn' AS label WITH ;
		BackStyle = 0, ;
		Caption = " ", ;
		FontItalic = .T., ;
		FontSize = 10, ;
		ForeColor = 0,0,128, ;
		Height = 17, ;
		Left = 160, ;
		Name = "lblAn", ;
		TabIndex = 5, ;
		Top = 71, ;
		Width = 40
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblLuna' AS label WITH ;
		BackStyle = 0, ;
		Caption = " ", ;
		FontItalic = .T., ;
		FontSize = 10, ;
		ForeColor = 0,0,128, ;
		Height = 17, ;
		Left = 125, ;
		Name = "lblLuna", ;
		TabIndex = 4, ;
		Top = 71, ;
		Width = 27
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblTitlu' AS label WITH ;
		BackStyle = 0, ;
		Caption = "Selectati anul si luna de inceput:", ;
		Height = 13, ;
		Left = 24, ;
		Name = "lblTitlu", ;
		TabIndex = 3, ;
		Top = 38, ;
		Width = 192, ;
		ZOrderSet = 2
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Seip1' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 90, ;
		Left = 12, ;
		Name = "Seip1", ;
		Top = 33, ;
		Width = 216, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />
	
	PROCEDURE Destroy
		*luna_an=thisform.oluna 
		loluna=thisform.oluna 
	ENDPROC

	PROCEDURE do_termin
	ENDPROC

	PROCEDURE go
		Select(Thisform.calias)
		With Thisform.oluna
			.nl=nl
			.an=an
		
			Thisform.lblLuna.Caption=.nl
			Thisform.lblAn.Caption=.an
			If !Empty(.nl) And !Empty(.an)
				Thisform.cmdtermin1.Enabled=.T.
			ELSE 
				Thisform.cmdtermin1.Enabled=.F.	
			Endif
		Endwith
		
	ENDPROC

	PROCEDURE cboLuna.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		 thisform.go()
	ENDPROC

	PROCEDURE cboLuna.Valid
		 thisform.Go()
	ENDPROC

	PROCEDURE CMDTERMIN1.Click
		thisform.Release()
	ENDPROC

ENDDEFINE

DEFINE CLASS grup_optiuni_filtru AS _optiongrup OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="optiongroup" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<PropValue>
		BorderStyle = 0
		ButtonCount = 3
		Height = 27
		Name = "grup_optiuni_filtru"
		Width = 193
		Option1.Caption = ""
		Option1.ForeColor = 128,128,128
		Option1.Left = 5
		Option1.Name = "Option1"
		Option1.Top = 5
		Option1.Width = 43
		Option2.Caption = "si"
		Option2.FontItalic = .T.
		Option2.Left = 66
		Option2.Name = "Option2"
		Option2.Top = 5
		Option2.Width = 58
		Option3.BackStyle = 0
		Option3.Caption = "sau"
		Option3.FontItalic = .T.
		Option3.Height = 17
		Option3.Left = 134
		Option3.Name = "Option3"
		Option3.Top = 5
		Option3.Width = 54
	*</PropValue>

ENDDEFINE

DEFINE CLASS grup_optiuni_filtru_numar AS _optiongrup OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="optiongroup" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<PropValue>
		AutoSize = .F.
		BorderStyle = 0
		ButtonCount = 2
		Height = 27
		Name = "grup_optiuni_filtru_numar"
		Width = 125
		Option1.Caption = "si"
		Option1.FontItalic = .T.
		Option1.Left = 5
		Option1.Name = "Option1"
		Option1.Top = 5
		Option1.Width = 61
		Option2.Caption = "sau"
		Option2.FontItalic = .T.
		Option2.Left = 66
		Option2.Name = "Option2"
		Option2.Top = 5
		Option2.Width = 54
	*</PropValue>

ENDDEFINE
