*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="rap_lista_inventar.scx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS dataenvironment AS dataenvironment 
 	*< CLASSDATA: Baseclass="dataenvironment" Timestamp="" Scale="" Uniqueid="" ClassIcon="1" />

	*<PropValue>
		DataSource = .NULL.
		Height = 0
		Left = 0
		Name = "Dataenvironment"
		Top = 0
		Width = 0
	*</PropValue>

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Shape2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Shape4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Shape1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtFiltru3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtFiltru2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label9" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtFiltru" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="edt_titlu" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtData" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cboGrupare2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cboGrupare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cboModel" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtFiltru4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_cautare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_cautare2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_cautare3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label8" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="optOrdonare" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_gestiune
		*m: do_cauta_responsabil
		*m: do_cauta_sectie
		*p: ccont		&& Filtru dupa cont
		*p: ccursor		&& Numele cursorului cu lista de imobilizari. Daca este completat se face selectie din cursor in loc de baza de date
		*p: ctitlu
		*p: ddata_inv
		*p: nfiscala
		*p: ntip
		*p: ogestiune
		*p: oresponsabil
		*p: orezult
		*p: osectie
		*p: pcvalue_txt
		*p: pcvalue_txt2
		*p: pcvalue_txt3
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		ccont = 
		ccursor = 
		ctitlu = 
		DataSession = 1
		ddata_inv = 
		DoCreate = .T.
		Height = 430
		Name = "Frm_termin_renunt12"
		nfiscala = 0
		ntip = 0
		ogestiune = .NULL.
		oresponsabil = .NULL.
		orezult = 
		osectie = .NULL.
		pcvalue_txt = 
		pcvalue_txt2 = 
		pcvalue_txt3 = 
		Width = 371
		_memberdata = <VFPData>
			<memberdata name="ogestiune" display="oGestiune"/>
			<memberdata name="osectie" display="oSectie"/>
			<memberdata name="oresponsabil" display="oResponsabil"/>
			<memberdata name="ccursor" display="cCursor"/>
			<memberdata name="ccont" display="cCont"/>
		</VFPData>
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 516
		_SHAPE1.ZOrderSet = 1
		_SHAPE2.Height = 29
		_SHAPE2.Left = 306
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 66
		_SHAPE2.ZOrderSet = 3
		LB_TITLU_ALB_B121.Caption = "Alegeti parametri raportului"
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 15
		LB_TITLU_ALB_B121.ZOrderSet = 4
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Left = 341
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 14
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 5
		GRIDSORT1.Left = 9
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 24
	*</PropValue>

	ADD OBJECT 'But_cautare1' AS but_cautare WITH ;
		caction = do_cauta_gestiune, ;
		Left = 331, ;
		Name = "But_cautare1", ;
		TabIndex = 7, ;
		TabStop = .F., ;
		Top = 243
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_cautare2' AS but_cautare WITH ;
		caction = do_cauta_sectie, ;
		Left = 331, ;
		Name = "But_cautare2", ;
		TabIndex = 9, ;
		TabStop = .F., ;
		Top = 275
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_cautare3' AS but_cautare WITH ;
		caction = do_cauta_responsabil, ;
		Left = 331, ;
		Name = "But_cautare3", ;
		TabIndex = 11, ;
		TabStop = .F., ;
		Top = 305
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 8, ;
		Left = 308, ;
		Name = "But_listare1", ;
		TabIndex = 25, ;
		Top = 1
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cboGrupare' AS combobox WITH ;
		FontSize = 10, ;
		Height = 24, ;
		Left = 27, ;
		Name = "cboGrupare", ;
		RowSource = "crsGrupare1.criteriu", ;
		RowSourceType = 2, ;
		Style = 2, ;
		TabIndex = 4, ;
		Top = 162, ;
		Value = Gestiune, ;
		Width = 204, ;
		ZOrderSet = 13
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'cboGrupare2' AS combobox WITH ;
		FontSize = 10, ;
		Height = 24, ;
		Left = 27, ;
		Name = "cboGrupare2", ;
		RowSource = "crsGrupare2.criteriu", ;
		RowSourceType = 2, ;
		Style = 2, ;
		TabIndex = 5, ;
		Top = 192, ;
		Value = Cont, ;
		Width = 204, ;
		ZOrderSet = 13
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'cboModel' AS combobox WITH ;
		FontSize = 10, ;
		Height = 24, ;
		Left = 12, ;
		Name = "cboModel", ;
		RowSource = "Model 1,Model 2", ;
		RowSourceType = 1, ;
		Style = 2, ;
		TabIndex = 2, ;
		Top = 85, ;
		Value = Model 1, ;
		Width = 132, ;
		ZOrderSet = 14
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'edt_titlu' AS ed_tx_simplu WITH ;
		Height = 33, ;
		Left = 7, ;
		Name = "edt_titlu", ;
		TabIndex = 1, ;
		Top = 46, ;
		Width = 360, ;
		ZOrderSet = 10, ;
		_edbase1.ControlSource = "thisform.ctitlu", ;
		_edbase1.FontSize = 10, ;
		_edbase1.Format = "k", ;
		_edbase1.Height = 27, ;
		_edbase1.Left = 89, ;
		_edbase1.Name = "_edbase1", ;
		_edbase1.TabIndex = 1, ;
		_edbase1.Top = 3, ;
		_edbase1.Width = 266, ;
		_lbbase1.Caption = "Titlu raport", ;
		_lbbase1.FontSize = 10, ;
		_lbbase1.Left = 11, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.TabIndex = 2, ;
		_lbbase1.Top = 7
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Label1' AS label WITH ;
		Alignment = 2, ;
		AutoSize = .T., ;
		BackColor = 255,255,255, ;
		Caption = "Grupat dupa", ;
		Comment = "*:OnResize=LT", ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 15, ;
		Name = "Label1", ;
		TabIndex = 18, ;
		Top = 146, ;
		Width = 73, ;
		ZOrderSet = 11
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label2' AS label WITH ;
		Alignment = 2, ;
		AutoSize = .T., ;
		BackColor = 255,255,255, ;
		Caption = "Selectie", ;
		Comment = "*:OnResize=LT", ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 15, ;
		Name = "Label2", ;
		TabIndex = 16, ;
		Top = 227, ;
		Width = 49, ;
		ZOrderSet = 11
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label3' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "I", ;
		FontBold = .T., ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 13, ;
		Name = "Label3", ;
		TabIndex = 22, ;
		Top = 167, ;
		Width = 6
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label4' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "II", ;
		FontBold = .T., ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 13, ;
		Name = "Label4", ;
		TabIndex = 24, ;
		Top = 197, ;
		Width = 10
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label5' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Gestiune", ;
		FontBold = .F., ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 24, ;
		Name = "Label5", ;
		TabIndex = 19, ;
		Top = 252, ;
		Width = 54
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label6' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Sectie", ;
		FontBold = .F., ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 24, ;
		Name = "Label6", ;
		TabIndex = 23, ;
		Top = 281, ;
		Width = 39
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label7' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Responsabil", ;
		FontBold = .F., ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 24, ;
		Name = "Label7", ;
		TabIndex = 21, ;
		Top = 311, ;
		Width = 73
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label8' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Cont", ;
		FontBold = .F., ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 24, ;
		Name = "Label8", ;
		TabIndex = 20, ;
		Top = 338, ;
		Width = 29
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label9' AS label WITH ;
		Alignment = 2, ;
		AutoSize = .T., ;
		BackColor = 255,255,255, ;
		Caption = "Ordonat dupa", ;
		Comment = "*:OnResize=LT", ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 15, ;
		Name = "Label9", ;
		TabIndex = 17, ;
		Top = 369, ;
		Width = 80, ;
		ZOrderSet = 11
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'optOrdonare' AS _optiongrup WITH ;
		AutoSize = .F., ;
		ButtonCount = 3, ;
		Height = 28, ;
		Left = 18, ;
		Name = "optOrdonare", ;
		TabIndex = 13, ;
		Top = 388, ;
		Width = 343, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Nr. inventar", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Denumire", ;
		Option2.Left = 92, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Data PIF", ;
		Option3.Height = 17, ;
		Option3.Left = 174, ;
		Option3.Name = "Option3", ;
		Option3.Top = 5, ;
		Option3.Width = 65
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'Shape1' AS shape WITH ;
		BackStyle = 0, ;
		Height = 68, ;
		Left = 7, ;
		Name = "Shape1", ;
		Top = 156, ;
		Width = 360, ;
		ZOrderSet = 2
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'Shape2' AS shape WITH ;
		BackStyle = 0, ;
		Height = 38, ;
		Left = 7, ;
		Name = "Shape2", ;
		Top = 78, ;
		Width = 360, ;
		ZOrderSet = 0
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'Shape3' AS shape WITH ;
		BackStyle = 0, ;
		Height = 126, ;
		Left = 7, ;
		Name = "Shape3", ;
		Top = 237, ;
		Width = 360, ;
		ZOrderSet = 2
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'Shape4' AS shape WITH ;
		BackStyle = 0, ;
		Height = 41, ;
		Left = 7, ;
		Name = "Shape4", ;
		Top = 379, ;
		Width = 360, ;
		ZOrderSet = 2
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'txtData' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 7, ;
		Name = "txtData", ;
		TabIndex = 3, ;
		Top = 115, ;
		Width = 360, ;
		ZOrderSet = 12, ;
		TEXT_SIMPLU1.ControlSource = "thisform.ddata_inv", ;
		TEXT_SIMPLU1.FontSize = 10, ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.Left = 131, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 224, ;
		LB_SIMPLU1.Caption = "Data inventariere", ;
		LB_SIMPLU1.FontSize = 10, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'txtFiltru' AS _textbox WITH ;
		ControlSource = "thisform.pcvalue_txt", ;
		DisabledForeColor = 0,0,0, ;
		Enabled = .F., ;
		FontItalic = .T., ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Height = 22, ;
		Left = 109, ;
		Name = "txtFiltru", ;
		TabIndex = 6, ;
		TabStop = .F., ;
		Top = 246, ;
		Width = 215, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtFiltru2' AS _textbox WITH ;
		ControlSource = "thisform.pcvalue_txt2", ;
		DisabledForeColor = 0,0,0, ;
		Enabled = .F., ;
		FontItalic = .T., ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Height = 22, ;
		Left = 109, ;
		Name = "txtFiltru2", ;
		TabIndex = 8, ;
		TabStop = .F., ;
		Top = 278, ;
		Width = 215, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtFiltru3' AS _textbox WITH ;
		ControlSource = "thisform.pcvalue_txt3", ;
		DisabledForeColor = 0,0,0, ;
		Enabled = .F., ;
		FontItalic = .T., ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Height = 22, ;
		Left = 109, ;
		Name = "txtFiltru3", ;
		TabIndex = 10, ;
		TabStop = .F., ;
		Top = 308, ;
		Width = 215, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtFiltru4' AS _textbox WITH ;
		ControlSource = "thisform.cCont", ;
		DisabledForeColor = 0,0,0, ;
		Enabled = .T., ;
		FontItalic = .T., ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Format = "K", ;
		Height = 22, ;
		Left = 109, ;
		Name = "txtFiltru4", ;
		TabIndex = 12, ;
		TabStop = .F., ;
		Top = 336, ;
		Width = 66, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE Destroy
		USE IN (SELECT('crsGrupare1'))
		USE IN (SELECT('crsGrupare2'))
		USE IN (SELECT('crsFiltru'))
	ENDPROC

	PROCEDURE do_cauta
		LPARAMETERS tcOptiune
		
		Private locauta
		Store [] To locauta
		lcOptiune = UPPER(tcOptiune)
		
		Do Case
			Case lcOptiune = 'GESTIUNE'
				loCauta = caut_gestiune()
				This.pcvalue_txt = locauta.nume_gestiune
				This.oGestiune = locauta
			Case lcOptiune = 'SECTIE'
				loCauta = caut_sectie()
				This.pcvalue_txt2 = locauta.sectie
				This.oSectie = locauta
			Case lcOptiune = 'RESPONSABIL'
				locauta = caut_responsabil()
				This.pcvalue_txt3 = locauta.nume
				This.oResponsabil = locauta
		Endcase
		
		THIS.txtFiltru.Refresh()
		THIS.txtFiltru2.Refresh()
		THIS.txtFiltru3.Refresh()
	ENDPROC

	PROCEDURE do_cauta_gestiune
		This.do_cauta('GESTIUNE')
	ENDPROC

	PROCEDURE do_cauta_responsabil
		This.do_cauta('RESPONSABIL')
	ENDPROC

	PROCEDURE do_cauta_sectie
		This.do_cauta('SECTIE')
	ENDPROC

	PROCEDURE do_listare
		*!* 26.01.2011
		*!*	marius.mutu
		*!*	filtrare concomitenta dupa gestiune, sectie, responsabil
		
		Private pcGrup1, pcHeaderGrup1, pcGrup2, pcHeaderGrup2, pcDataOra
		Local lcCursor, lcGrupare2, lcRaport, lcSel, llExperimental, llSucces
		Local llUsed
		Local lcOrdonare
		*:Global pcCond, pdData, pdDataF, pdDataI, pnFiscala
		pcGrup1 = "EOF()"
		pcHeaderGrup1 = ""
		pcGrup2 = "EOF()"
		pcHeaderGrup2 = ""
		
		Private pcTitlu, pcSubtitlu
		pcTitlu = ""
		pcSubtitlu = ""
		
		Private pnIdGestiune, pnIdSectie, pnIdResponsabil, pcCont, pnTip
		pnIdGestiune = 0
		pnIdSectie = 0
		pnIdResponsabil = 0
		pcCont = ""
		
		Local lcSelect, lcFiltru, lcOrder, loGestiune, loSectie, loResponsabil, lcFiltruOriginal, lcGrupare
		Store "" To  lcSelect, lcFiltru, lcOrder, lcFiltruOriginal, lcGrupare
		
		lcOrdonare = IIF(this.optOrdonare.Value = 1, 'nrinv1', IIF(this.optOrdonare.Value = 2, 'denumire', 'datapif1'))
		
		loGestiune = This.oGestiune
		loSectie = This.oSectie
		loResponsabil = This.oResponsabil
		
		pnTip = This.nTip
		lcFiltruOriginal = [id_tip_imobilizare=?pnTip and iesit_din_gest=0]
		
		lcGrupare = Upper(Alltrim(This.cboGrupare.Value))
		lcGrupare2 = Upper(Alltrim(This.cboGrupare2.Value))
		
		Do Case
			Case lcGrupare = 'GESTIUNE'
				pcGrup1 = [gestiune]
				lcOrder = lcOrder + [,gestiune]
				pcHeaderGrup1 = [Gestiune : ]
			Case lcGrupare = 'RESPONSABIL'
				pcGrup1 = [responsabil]
				lcOrder = lcOrder + [,responsabil]
				pcHeaderGrup1 = [Responsabil : ]
			Case lcGrupare = 'SECTIE'
				pcGrup1 = [sectie]
				lcOrder = lcOrder + [,sectie]
				pcHeaderGrup1 = [Sectia : ]
			Case lcGrupare = 'CONT'
				pcGrup1 = [cont]
				lcOrder = lcOrder + [,cont,acont]
				pcHeaderGrup1 = [Cont : ]
		Endcase
		
		Do Case
			Case lcGrupare2 = 'GESTIUNE'
				pcGrup2 = [gestiune]
				lcOrder = lcOrder + [,gestiune]
				pcHeaderGrup2 = [Gestiune : ]
			Case lcGrupare2 = 'RESPONSABIL'
				pcGrup2 = [responsabil]
				lcOrder = lcOrder + [,responsabil]
				pcHeaderGrup2 = [Responsabil : ]
			Case lcGrupare2 = 'SECTIE'
				pcGrup2 = [sectie]
				lcOrder = lcOrder + [,sectie]
				pcHeaderGrup2 = [Sectia : ]
			Case lcGrupare2 = 'CONT'
				pcGrup2 = [cont]
				lcOrder = lcOrder + [,cont,acont]
				pcHeaderGrup2 = [Cont : ]
		Endcase
		
		*!* 26.01.2011
		If Type('loGestiune') = 'O' And Type('loGestiune.id_gestiune') = 'N' And !Empty(loGestiune.id_gestiune)
			pnIdGestiune = loGestiune.id_gestiune
			lcFiltruOriginal = lcFiltruOriginal + [ and id_gestiune = ?pnIdGestiune]
			pcSubtitlu = pcSubtitlu + ' Gestiune "' + Alltrim(This.pcvalue_txt) + '"'
		Endif
		
		If Type('loSectie') = 'O' And Type('loSectie.id_sectie') = 'N' And !Empty(loSectie.id_sectie)
			pnIdSectie = loSectie.id_sectie
			lcFiltruOriginal = lcFiltruOriginal + [ and id_sectie = ?pnIdSectie]
			pcSubtitlu = pcSubtitlu + ' Sectie "' + Alltrim(This.pcvalue_txt2) + '"'
		Endif
		
		If Type('loResponsabil') = 'O' And Type('loResponsabil.id_responsabil') = 'N' And !Empty(loResponsabil.id_responsabil)
			pnIdResponsabil = loResponsabil.id_responsabil
			lcFiltruOriginal = lcFiltruOriginal + [ and id_responsabil = ?pnIdResponsabil]
			pcSubtitlu = pcSubtitlu + ' Responsabil "' + Alltrim(This.pcvalue_txt3) + '"'
		Endif
		*!* 26.01.2011 ^
		pcCont = ALLTRIM(NVL(this.cCont, ''))
		If !EMPTY(m.pcCont)
			lcFiltruOriginal = lcFiltruOriginal + [ and cont = ?pcCont]
			pcSubtitlu = pcSubtitlu + ' Cont "' + m.pcCont + '"'
		ENDIF
		
		IF LEFT(m.lcOrder,1) = ','
			lcOrder = Substr(lcOrder, 2)
		ENDIF 	
		
		pdDataI = Date(gnAn, gnLuna, 1)
		pdDataF = pdDataI
		pcCond = [1=1]
		pnFiscala = Thisform.nFiscala
		lcCursor = 'crslista'
		
		llExperimental = .T. && 25.11.2021 llExperimental = (goApp.nExperimental = 1)
		lcFiltru = [id_tip_imobilizare = ?pnTip and iesit_din_gest=0] + ;
			Iif(!Empty(m.pnIdGestiune), [ and id_gestiune = ] + Alltrim(Str(m.pnIdGestiune)), []) + ;
			Iif(!Empty(m.pnIdSectie), [ and id_sectie = ] + Alltrim(Str(m.pnIdSectie)), []) + ;
			Iif(!Empty(m.pnIdResponsabil), [ and id_responsabil = ] + Alltrim(Str(m.pnIdResponsabil )), []) + ;
			Iif(!Empty(m.pcCont), [ and cont = ?pcCont], []) + ;	
			m.gcCondSucursala
		
		llUsed = Used(m.lcCursor)
		Do Case
			Case !Empty(This.cCursor) And Used(This.cCursor)
				lcCursor = This.cCursor
				llSucces = .T.
			Case  m.llExperimental
				* EXPERIMENTAL SELECTIE DIN IMOB_VSITUATIE_LUNARA IN LOC DE PACK_IMOB.CALCUL_SITUATIE_LUNARA()
				* Setez luna pentru view
				llSucces = goExecutor.oExecuta('begin pack_imob.setlunacurenta(?pdDataI); end;')
				If m.llSucces
					lcSel = [SELECT * FROM ] + Iif(m.pnFiscala = 0, [imob_vsituatie_lunara], [imobf_vsituatie_lunara]) + [ WHERE ] + m.lcFiltru
					llSucces = goExecutor.oExecuta(m.lcSel, m.lcCursor)
				Endif
			Otherwise
				lcSel = [{call pack_imob.CALCUL_SITUATIE_LUNARA(?pdDataI,?pdDataF,?pcCond,?pnFiscala,?gnIdSucursala)}]
				llSucces = goExecutor.oExecuta(lcSel, lcCursor)
		Endcase
		If !m.llSucces
			Return .F.
		Endif
		
		pcTitlu = Thisform.ctitlu
		pdData = This.ddata_inv
		
		*!* 19.01.2008
		*1* era indexat cursorul si se strica ordinea
		lcOrder = lcOrder + IIF(!EMPTY(m.lcOrder), ',', '') + m.lcOrdonare
		*!* 19.01.2008 ^
		Select *, Dtos(data_pif) As datapif1, Str(nr_inventar) As nrinv1 From (m.lcCursor) With (Buffering = .T.) Where &lcFiltruOriginal Into Cursor crs_rap Order By &lcOrder
		
		If !m.llUsed
			Use In (Select(m.lcCursor))
		Endif
		
		If Reccount('crs_rap') > 0
			pcDataOra = get_Ora(2)
			Select crs_rap
			Thisform.AlwaysOnTop = .F.
			lcRaport = Iif(Upper(This.cboModel.Value) = "MODEL 1", "NOTA_INV_M1.FRX", "NOTA_INV_M2.frx")
			*	Report Format &lcRaport To Printer Prompt Noconsole Preview
			goExport.export2frx([crs_rap], m.lcRaport, , , , , , .T.)
		
			Thisform.AlwaysOnTop = .T.
		Else
			aMessagebox("Nu exista inregistrari pentru listare!", 48, "Atentie")
		Endif
		Use In (SELECT('crs_rap'))
		
		
		 
	ENDPROC

	PROCEDURE Init
		Parameters tnTip, tnFiscala, tcCursor
		* tcCursor: (optional) numele cursorului cu lista de imobilizari. Daca este completat, fac selectie din cursor in loc de baza de date
		* tcCursor este completat daca este apelat din frm_lista.do_listare
		Thisform.ntip = m.tnTip
		This.nfiscala = m.tnFiscala
		this.cCursor = m.tcCursor
		DoDefault()
		
	ENDPROC

	PROCEDURE Load
		CREATE CURSOR crsGrupare1 (criteriu c(20))
		CREATE CURSOR crsGrupare2 (criteriu c(20))
		CREATE CURSOR crsFiltru (criteriu c(20))
		
		INSERT INTO crsGrupare1 (criteriu) VALUES (SPACE(20))
		INSERT INTO crsGrupare1 (criteriu) VALUES ('Gestiune')
		INSERT INTO crsGrupare1 (criteriu) VALUES ('Sectie')
		INSERT INTO crsGrupare1 (criteriu) VALUES ('Responsabil')
		INSERT INTO crsGrupare1 (criteriu) VALUES ('Cont')
		
		
		INSERT INTO crsGrupare2 (criteriu) VALUES (SPACE(20))
		INSERT INTO crsGrupare2 (criteriu) VALUES ('Gestiune')
		INSERT INTO crsGrupare2 (criteriu) VALUES ('Sectie')
		INSERT INTO crsGrupare2 (criteriu) VALUES ('Responsabil')
		INSERT INTO crsGrupare2 (criteriu) VALUES ('Cont')
		
		
		INSERT INTO crsFiltru (criteriu) VALUES (SPACE(20))
		INSERT INTO crsFiltru (criteriu) VALUES ('Gestiune')
		INSERT INTO crsFiltru (criteriu) VALUES ('Sectie')
		INSERT INTO crsFiltru (criteriu) VALUES ('Responsabil')
		
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		this.ctitlu="LISTA INVENTARIERE IMOBILIZARI "+IIF(this.nTip=1,"CORPORALE","NECORPORALE")
		this.ddata_inv = GOMONTH(DATE(gnAn, gnLuna, 1),1)-1
		THIS.edt_titlu.Refresh()
		this.txtData.Refresh()
		
	ENDPROC

	PROCEDURE cboGrupare.Init
		THIS.Value = "Gestiune"
	ENDPROC

	PROCEDURE cboGrupare2.Init
		THIS.Value = "Cont"
	ENDPROC

	PROCEDURE cboModel.Init
		this.Value = "Model 1"
	ENDPROC

ENDDEFINE
