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

	*<PropValue>
		Height = 293
		Name = "ct"
		Width = 651
	*</PropValue>

ENDDEFINE

DEFINE CLASS ct_atasamente AS ct OF "ferestre_atasamente.vcx" 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_shape1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column3.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column3.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column5.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column5.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_edit1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_attach1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_attach2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label1" UniqueID="" Timestamp="" />

	*<PropValue>
		Height = 479
		Name = "ct_atasamente"
		Width = 795
	*</PropValue>

	ADD OBJECT '_shape1' AS _shape WITH ;
		Height = 479, ;
		Left = 0, ;
		Name = "_shape1", ;
		SpecialEffect = 0, ;
		Top = 0, ;
		Width = 795, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'But_attach1' AS but_attach WITH ;
		Anchor = 9, ;
		caction = do_upload, ;
		cpicturedown = uparrow.bmp, ;
		cpictureup = uparrow.bmp, ;
		Height = 27, ;
		Left = 674, ;
		Name = "But_attach1", ;
		Picture = ..\grafice\uparrow.bmp, ;
		ToolTipText = "Salveaza document pe server", ;
		Top = 2, ;
		Width = 30, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_attach2' AS but_attach WITH ;
		Anchor = 9, ;
		caction = do_download, ;
		cpicturedown = downarrow.bmp, ;
		cpictureup = downarrow.bmp, ;
		Height = 27, ;
		Left = 704, ;
		Name = "But_attach2", ;
		Picture = ..\grafice\downarrow.bmp, ;
		ToolTipText = "Descarca document", ;
		Top = 2, ;
		Width = 30, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_edit1' AS but_sterge WITH ;
		Anchor = 9, ;
		caction = do_open, ;
		cpicturedown = eye_jos.bmp, ;
		cpictureup = eye_sus.bmp, ;
		Left = 734, ;
		Name = "But_edit1", ;
		Picture = ..\grafice\eye_sus.bmp, ;
		TabIndex = 2, ;
		ToolTipText = "Vizualizeaza document", ;
		Top = 2, ;
		Visible = .T., ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Anchor = 9, ;
		caction = inainte_de_do_sterge_atasament, ;
		Left = 763, ;
		Name = "But_sterge1", ;
		TabIndex = 2, ;
		ToolTipText = "Sterge document", ;
		Top = 2, ;
		Visible = .T., ;
		ZOrderSet = 2
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grid_linkuri' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 5, ;
		DeleteMark = .F., ;
		GridLineColor = 192,192,192, ;
		Height = 448, ;
		HighlightStyle = 2, ;
		Left = 0, ;
		Name = "grid_linkuri", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordMark = .F., ;
		RecordSource = "crsAtasamente", ;
		Top = 30, ;
		Width = 794, ;
		ZOrderSet = 1, ;
		Column1.ControlSource = "recno()", ;
		Column1.FontName = "Arial", ;
		Column1.Name = "Column1", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 44, ;
		Column2.ColumnOrder = 3, ;
		Column2.ControlSource = "descriere", ;
		Column2.FontName = "Arial", ;
		Column2.Name = "Column2", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 253, ;
		Column3.ColumnOrder = 2, ;
		Column3.ControlSource = "nume_fisier", ;
		Column3.FontName = "Arial", ;
		Column3.Name = "Column3", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 289, ;
		Column4.ControlSource = "utilizator", ;
		Column4.FontName = "Arial", ;
		Column4.Name = "Column4", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 88, ;
		Column5.ControlSource = "dataora", ;
		Column5.FontName = "Arial", ;
		Column5.Name = "Column5", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 93
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grid_linkuri.Column1.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. crt.", ;
		FontName = "Arial", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column1.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_linkuri.Column2.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Descriere", ;
		FontName = "Arial", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column2.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_linkuri.Column3.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Fisier", ;
		FontName = "Arial", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column3.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_linkuri.Column4.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Utilzator", ;
		FontName = "Arial", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column4.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_linkuri.Column5.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Dataora", ;
		FontName = "Arial", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column5.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Label1' AS label WITH ;
		Caption = "Documente atasate la contract", ;
		FontSize = 10, ;
		Height = 17, ;
		Left = 7, ;
		Name = "Label1", ;
		Top = 7, ;
		Width = 169, ;
		ZOrderSet = 6
		*< END OBJECT: BaseClass="label" />
	
	PROCEDURE grid_linkuri.Column2.Text1.DblClick
		*thisform.inainte_de_do_modifica()
		this.Parent.Parent.Parent.but_edit1.Click 
	ENDPROC

	PROCEDURE grid_linkuri.Column3.Text1.DblClick
		*thisform.do_open()
		this.Parent.Parent.Parent.but_edit1.Click 
		
	ENDPROC

	PROCEDURE grid_linkuri.Column3.Text1.RightClick
		x = xmenu('Descarca document;Vizualizeaza document')
		Do Case
			Case x = 1
				*thisform.do_download()
				this.Parent.Parent.Parent.buT_ATTACH2.Click 
			Case x = 2
				*thisform.do_open()
				this.Parent.Parent.Parent.but_edit1.Click 
		Endcase
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_atas_nou 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="Label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtDescriere" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtNume_fisier" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdOpen" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Command3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_proiect" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_contract" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_contract
		*m: do_cauta_proiect
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 156
		Name = "frm_atas_nou"
		Width = 681
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 804
		_shape2.Height = 29
		_shape2.Left = 619
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 61
		Lb_titlu_alb_b121.Caption = "Atasare document"
		Lb_titlu_alb_b121.Left = 6
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 10
		BUT_TERMIN1.Left = 650
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 7
		BUT_TERMIN1.Top = 1
		Gridsort1.Left = 132
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 12
	*</PropValue>

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

	ADD OBJECT 'cmdOpen' AS commandbutton WITH ;
		Caption = "", ;
		Enabled = .F., ;
		Height = 22, ;
		Left = 645, ;
		Name = "cmdOpen", ;
		Picture = ..\grafice\open.bmp, ;
		TabIndex = 9, ;
		ToolTipText = "Deschideti fisierul", ;
		Top = 39, ;
		Width = 27
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'Command3' AS commandbutton WITH ;
		Caption = "...", ;
		Height = 22, ;
		Left = 616, ;
		Name = "Command3", ;
		TabIndex = 6, ;
		ToolTipText = "Alegeti fisierul", ;
		Top = 39, ;
		Width = 29
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'Ct_contract' AS ct_clb_cautare_var WITH ;
		cprocedura = Thisform.do_cauta_contract, ;
		ctooltip = Contract, ;
		cvar_afisata = polink.contract, ;
		Left = 6, ;
		Name = "Ct_contract", ;
		TabIndex = 4, ;
		Top = 119, ;
		shape_cautare.Name = "shape_cautare", ;
		img_cautare.Name = "img_cautare", ;
		lb_cautare.Caption = "Contract", ;
		lb_cautare.Name = "lb_cautare", ;
		tx_cautare.Name = "tx_cautare"
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_proiect' AS ct_clb_cautare_var WITH ;
		cprocedura = Thisform.do_cauta_proiect, ;
		ctooltip = Proiect, ;
		cvar_afisata = polink.proiect, ;
		Left = 6, ;
		Name = "Ct_proiect", ;
		TabIndex = 3, ;
		Top = 91, ;
		Visible = .F., ;
		shape_cautare.Name = "shape_cautare", ;
		img_cautare.Name = "img_cautare", ;
		lb_cautare.Caption = "Proiect", ;
		lb_cautare.Name = "lb_cautare", ;
		tx_cautare.Name = "tx_cautare"
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Label1' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Descriere", ;
		Height = 17, ;
		Left = 6, ;
		Name = "Label1", ;
		TabIndex = 11, ;
		Top = 68, ;
		Width = 56
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label2' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Fisier", ;
		Height = 17, ;
		Left = 6, ;
		Name = "Label2", ;
		TabIndex = 5, ;
		Top = 42, ;
		Width = 33
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'txtDescriere' AS textbox WITH ;
		ControlSource = "poLink.descriere", ;
		Format = "!k", ;
		Height = 23, ;
		Left = 77, ;
		Name = "txtDescriere", ;
		TabIndex = 2, ;
		Top = 65, ;
		Width = 535
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtNume_fisier' AS textbox WITH ;
		ControlSource = "poLink.nume_fisier", ;
		Enabled = .F., ;
		Format = "!k", ;
		Height = 23, ;
		Left = 77, ;
		Name = "txtNume_fisier", ;
		TabIndex = 1, ;
		Top = 39, ;
		Width = 535
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE do_cauta_contract
		Local lcSelect,lcFiltru,lcSchema,lcOrder,lccoloane,lcTitlu,lcTitluColoane, lcNumeProc, llToateIreg, lcFiltruOriginal
		Local locauta
		
		*pcselect = [select id_proiect,SUBSTR(denumire,0,250) as denumire,SUBSTR(descriere,0,250) as descriere,client from con_vproiecte]
		lcSelect = [select id_ctr, denumire, contract from vcontracte]
		
		lcFiltru = [1=2]
		lcSchema = [id_ctr n(8), denumire c(100), contract c(100)]
		lcOrder = [denumire]
		lccoloane = [denumire, contract]
		lcTitlu = [Alegeti contractul]
		lcTitluColoane = [Partener, Contract]
		lcFiltruOriginal = []
		locauta = cauta_alfa(lcSelect,lcFiltru,lcSchema,lcOrder,lccoloane,lcTitlu,lcTitluColoane, lcNumeProc, llToateIreg, lcFiltruOriginal)
		*!*		Parameters tcselect,tcfiltru,tcschema,tcorder,tccoloana,tcTitlu,tcTitluColoana,tcNume_Proc,tl_AllInList,tcFiltruOriginal
		If buton # 2
			polink.contract = ALLTRIM(locauta.denumire) + ' ' + ALLTRIM(loCauta.contract)
			polink.id_ctr = locauta.id_ctr
		ELSE 
			polink.contract = []
			polink.id_ctr = null
		Endif
		This.Refresh
	ENDPROC

	PROCEDURE do_cauta_proiect
		Local lcSelect,lcFiltru,lcSchema,lcOrder,lccoloane,lcTitlu,lcTitluColoane, lcNumeProc, llToateIreg, lcFiltruOriginal
		Local locauta
		lcSelect = [select id_proiect,SUBSTR(denumire,0,250) as denumire,SUBSTR(descriere,0,250) as descriere,client ]+;
			[ from con_vproiecte]
		lcFiltru = [1=2]
		lcSchema = [id_proiect n(10),denumire v(250),descriere v(250),client v(70)]
		lcOrder = [indicativ]
		lccoloane = [denumire,descriere,client]
		lcTitlu = [Alegeti proiectul]
		lcTitluColoane = [Denumire,Descriere,Client]
		lcFiltruOriginal = []
		lcNumeProc = []
		llToateIreg=.F.
		locauta = cauta_alfa(lcSelect,lcFiltru,lcSchema,lcOrder,lccoloane,lcTitlu,lcTitluColoane, lcNumeProc, llToateIreg, lcFiltruOriginal)
		*!*		Parameters tcselect,tcfiltru,tcschema,tcorder,tccoloana,tcTitlu,tcTitluColoana,tcNume_Proc,tl_AllInList,tcFiltruOriginal
		If buton # 2
			polink.proiect = locauta.denumire
			polink.id_proiect = locauta.id_proiect
		Else
			polink.proiect = goRegistratura.proiect
			polink.id_proiect = goRegistratura.id_proiect
		Endif
		This.Refresh()
		
	ENDPROC

	PROCEDURE Show
		Lparameters nStyle
		If Upper(Alltrim(gcNumeProgram)) = "ROAREGISTRATURA"
			Thisform.ct_proiect.Visible = .T.
			Thisform.ct_contract.Visible = .T.
		Else
			Thisform.Height = 90
		Endif
		
		
	ENDPROC

	PROCEDURE cmdOpen.Click
		PRIVATE oWord
		LOCAL lcDocument
		
		lcDocument = pcLink
		
		IF EMPTY(lcDocument)
			aMESSAGEBOX("Alegeti fisierul pe care doriti sa-l deschideti! "+lcDocument,16,"Eroare")
			RETURN
		ENDIF 
		
		IF !FILE(lcDocument)
			aMESSAGEBOX("Nu exista fisierul "+lcDocument,16,"Eroare")
			RETURN
		ENDIF
		
		open_default_app(lcDocument)
		
		
	ENDPROC

	PROCEDURE Command3.Click
		LOCAL lcFisier
		
		pcLink = GETFILE("*","Alegeti fisierul")
		lcFisier = JUSTFNAME(pcLink)
		thisform.txtNume_fisier.Value = lcFisier
		thisform.txtNume_fisier.SetFocus 
		
		thisform.cmdOpen.Enabled = .T. 
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_dg 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="_shape3" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: blocheaza_campuri
		*m: deblocheaza_campuri
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 0
		DoCreate = .T.
		Height = 282
		Name = "frm_dg"
		Width = 417
		WindowType = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 1000
		_shape1.ZOrderSet = 1
		_shape2.Left = 1000
		_shape2.Name = "_shape2"
		_shape2.Visible = .F.
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.FontBold = .F.
		Lb_titlu_alb_b121.FontSize = 9
		Lb_titlu_alb_b121.ForeColor = 0,0,0
		Lb_titlu_alb_b121.Left = 8
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.Top = 6
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1000
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_shape3' AS _shape WITH ;
		Anchor = 11, ;
		BackColor = 197,214,254, ;
		BorderColor = 197,214,254, ;
		Height = 24, ;
		Left = -1, ;
		Name = "_shape3", ;
		Top = -2, ;
		Width = 804, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />
	
	PROCEDURE Activate
		DoDefault()
		
		If Upper(Alltrim(gcNumeProgram)) <> "ROALUCRARI"
			This.Left = 202
			This.Width = _Screen.Width - 206
			This.Top = IIF(TYPE("oprinc")="O",oprinc.pagefr1.Top,goFundal._pgfrmbase1.Top) + 34 + 55
			This.Height = _Screen.Height - This.Top - 2
		Endif
		
		
		
	ENDPROC

	PROCEDURE blocheaza_campuri
	ENDPROC

	PROCEDURE deblocheaza_campuri
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_viz_atasamente AS frm_dg OF "ferestre_atasamente.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grid_linkuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column3.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column3.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column5.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_linkuri.Column5.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_edit1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_attach1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_attach2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_download
		*m: do_open
		*m: do_upload
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		cgridsortlist = grid_linkuri
		DoCreate = .T.
		Height = 330
		Name = "frm_viz_atasamente"
		Width = 633
		_shape3.Name = "_shape3"
		_shape1.Name = "_shape1"
		_shape2.Height = 29
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 91
		Lb_titlu_alb_b121.Caption = "Documente atasate"
		Lb_titlu_alb_b121.Left = 6
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Gridsort1.Left = 168
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 12
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 604
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = -2
		BUT_TERMIN1.Visible = .F.
	*</PropValue>

	ADD OBJECT 'But_attach1' AS but_attach WITH ;
		Anchor = 9, ;
		caction = do_upload, ;
		cpicturedown = uparrow.bmp, ;
		cpictureup = uparrow.bmp, ;
		Enabled = .F., ;
		Height = 31, ;
		Left = 456, ;
		Name = "But_attach1", ;
		Picture = ..\grafice\uparrow.bmp, ;
		ToolTipText = "Salveaza document pe server", ;
		Top = -7, ;
		Width = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_attach2' AS but_attach WITH ;
		Anchor = 9, ;
		caction = do_download, ;
		cpicturedown = downarrow.bmp, ;
		cpictureup = downarrow.bmp, ;
		Left = 486, ;
		Name = "But_attach2", ;
		Picture = ..\grafice\downarrow.bmp, ;
		ToolTipText = "Descarca document", ;
		Top = -3
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_edit1' AS but_sterge WITH ;
		Anchor = 9, ;
		caction = do_open, ;
		cpicturedown = eye_jos.bmp, ;
		cpictureup = eye_sus.bmp, ;
		Left = 516, ;
		Name = "But_edit1", ;
		Picture = ..\grafice\eye_sus.bmp, ;
		TabIndex = 2, ;
		ToolTipText = "Vizualizeaza document", ;
		Top = -2, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		Anchor = 9, ;
		Enabled = .F., ;
		Left = 542, ;
		Name = "But_modifica1", ;
		ToolTipText = "Modifica descriere", ;
		Top = -2, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Anchor = 9, ;
		Enabled = .F., ;
		Left = 574, ;
		Name = "But_sterge1", ;
		TabIndex = 2, ;
		ToolTipText = "Sterge document", ;
		Top = -2, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grid_linkuri' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 5, ;
		DeleteMark = .F., ;
		GridLineColor = 192,192,192, ;
		Height = 280, ;
		HighlightStyle = 2, ;
		Left = 6, ;
		Name = "grid_linkuri", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordMark = .F., ;
		RecordSource = "crsAtasamente", ;
		Top = 33, ;
		Width = 614, ;
		Column1.ControlSource = "recno()", ;
		Column1.Name = "Column1", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 44, ;
		Column2.ColumnOrder = 3, ;
		Column2.ControlSource = "descriere", ;
		Column2.Name = "Column2", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 269, ;
		Column3.ColumnOrder = 2, ;
		Column3.ControlSource = "nume_fisier", ;
		Column3.Name = "Column3", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 303, ;
		Column4.ControlSource = "utilizator", ;
		Column4.Name = "Column4", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 88, ;
		Column5.ControlSource = "dataora", ;
		Column5.Name = "Column5", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 79
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grid_linkuri.Column1.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. crt.", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column1.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_linkuri.Column2.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Descriere", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column2.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_linkuri.Column3.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Fisier", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column3.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_linkuri.Column4.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Utilzator", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column4.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_linkuri.Column5.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Dataora", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_linkuri.Column5.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE blocheaza_campuri
		this.but_attach1.Enabled = .F.
		*this.but_attach2.Enabled = .F.
		this.but_sterge1.Enabled = .F.
		THIS.BUT_MODIFICA1.Enabled = .F.
		
		
		
	ENDPROC

	PROCEDURE deblocheaza_campuri
		this.but_attach1.Enabled = .T.
		*this.but_attach2.Enabled = .T.
		this.but_sterge1.Enabled = .T.
		THIS.BUT_MODIFICA1.Enabled = .T.
		
	ENDPROC

	PROCEDURE do_download
		Lparameters tcFisSalvat
		
		Private poLink
		Store '' To poLink
		Local lcSchema, lcSelect, lcOrder, lcFiltru, lcFiltruOriginal, llAfiseaza, lcgroup, lcFiltruOriginal
		Local lcTabel, lcFisSalvat, lnIdAtas, lcFisier
		
		lcTabel = Thisform.grid_linkuri.RecordSource
		
		Select (lcTabel)
		If Reccount() >0
			If Pcount() = 0 Or Type('tcFisSalvat') <> 'C'
				lcDir = Getdir('c:\',"Director","Directorul unde doriti sa salvati fisierul",64)
				If Empty(lcDir)
					Return
				Endif
				If !Empty(nume_fisier)
					lcFisSalvat = Addbs(lcDir)+Alltrim(nume_fisier)
				Endif
			Else
				lcFisSalvat = tcFisSalvat
			Endif
			If !Empty(lcFisSalvat)
		
				lnIdAtas = id_atas
				lcSchema = [fisier w ]
				lcSelect = [select fisier from atas_atasamente where id_atas = ] + Alltrim(Str(lnIdAtas))
				lcOrder = []
				lcgroup = []
				lcFiltru = []
				lcFiltruOriginal = []
				llModParam = .T.
				llAfiseaza = .F.
		
				gencursor('poLink','cRegFisierTemp', lcSelect, lcFiltru, lcSchema, lcOrder, llAfiseaza,  lcgroup, llModParam, lcFiltruOriginal)
				poLink.ca_baza1.afisare()
				If Used('cRegFisierTemp')
					lcFisier = fisier
					Use In (Select('cRegFisierTemp'))
		
					Strtofile(lcFisier, lcFisSalvat)
					open_default_app(lcFisSalvat)
		
				Endif
		
		
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_open
		Local lcTabel, lcFisSalvat
		
		lcTabel = Thisform.grid_linkuri.RecordSource
		Select (lcTabel)
		If Reccount() >0
			IF !EMPTY(NVL(nume_fisier,'')) 
				lcFisSalvat = Addbs(gcTempPath)+ALLTRIM(nume_fisier)
				this.do_download(lcFisSalvat)
			ENDIF 
		Endif
		
	ENDPROC

	PROCEDURE do_upload
		Local lcTabelLinkuri
		lcTabelLinkuri = Thisform.grid_linkuri.RecordSource
		
		DO upload WITH (lcTabelLinkuri) IN oproceduri_atasamente.prg
		
		Thisform.grid_linkuri.Refresh
		
		
	ENDPROC

	PROCEDURE inainte_de_do_modifica
		Local lcTabelLinkuri
		lcTabelLinkuri = Thisform.grid_linkuri.RecordSource
		
		DO modifica_atasament WITH (lcTabelLinkuri) IN oproceduri_atasamente.prg
		
		Thisform.grid_linkuri.Refresh
	ENDPROC

	PROCEDURE inainte_de_do_sterge
		Local lcTabelLinkuri, lnRaspuns, lnInreg
		lcTabelLinkuri = Thisform.grid_linkuri.RecordSource
		Store 0 To lnRaspuns, lnInreg
		
		Select (lcTabelLinkuri)
		lnRec = Recno()
		Count For !Deleted() To lnInreg
		
		If lnInreg > 0
			lnRaspuns = amessagebox('Doriti sa stergeti documentul?',4+32,"Confirmare stergere")
			If lnRaspuns = 7 && 7 = No ; 6 = Yes
				Return
			Endif
		
			Select (lcTabelLinkuri)
			Goto lnRec
			pcId_atas = Alltrim(Str(id_atas))
		*!* V 2.0.1
			lcSql = [update atas_referinte set sters = 1, dataoras = SYSDATE, id_utils = ] + Alltrim(Str(gnIdUtil)) + ;
				[ WHERE id_atas = ] + pcId_atas
			Do Case
			Case Upper(Alltrim(gcNumeProgram)) = "ROAREGISTRATURA"
				lcSql = lcSql + [ and id_program = 70 and id_entitate=]+Alltrim(Str(goRegistratura.id_reg))
			Case Upper(Alltrim(gcNumeProgram)) = "ROACONTRACTE"
				lcSql = lcSql + [ and id_program = 21 and id_entitate=]+Alltrim(Str(goContract.id_ctr))
			Case Upper(Alltrim(gcNumeProgram)) = "ROALUCRARI"
				lcSql = lcSql + [ and id_program = 13 and id_entitate=]+Alltrim(Str(crsProiecte.id_proiect))		
			Endcase
		
			lnSucces = goExecutor.oExecute(lcSql)
		
			If lnSucces < 0
				aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
				Return
			Endif
		
			Select (lcTabelLinkuri)
			Delete
		
			Thisform.grid_linkuri.SetFocus()
			Thisform.but_attach1.SetFocus()
			Select (lcTabelLinkuri)
			Locate
			Thisform.grid_linkuri.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		If Upper(Alltrim(gcNumeProgram)) = "ROALUCRARI" && in RoaLucrari, arat fereastra pe click-dr la lista proiectelor
			THIS.But_sterge1.Enabled = .T.
			this.but_MODIFICA1.Enabled = .T.
			this.buT_TERMIN1.Visible = .T. 
		ENDIF 
		
	ENDPROC

	PROCEDURE grid_linkuri.Column2.Text1.DblClick
		thisform.inainte_de_do_modifica()
	ENDPROC

	PROCEDURE grid_linkuri.Column3.Text1.DblClick
		thisform.do_open()
		
	ENDPROC

	PROCEDURE grid_linkuri.Column3.Text1.RightClick
		x = xmenu('Descarca document;Vizualizeaza document;' + IIF(THISFORM.BUT_MODIFICA1.Enabled, 'Modifica descriere', '\Modifica descriere'))
		Do Case
			Case x = 1
				thisform.do_download()
			Case x = 2
				thisform.do_open()
			Case x = 3
				thisform.inainte_de_do_modifica()
		Endcase
		
	ENDPROC

ENDDEFINE
