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

	*<PropValue>
		Name = "cus_odata_contract"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		
		lcActiune = Alltrim(This.cActiune)
		
		If Inlist(lcActiune, "UPDATE",'INSERT') And Type('toRec') != "O"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE') And Type('tnId') != "N"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE')
			lcId = Alltrim(Str(tnId))
		
		Endif
		If Inlist(lcActiune, "UPDATE",'INSERT')
			lcvariabila = NVL(UPPER(ALLTRIM(torec.variabila)),"")
			lcDescriere = NVL(UPPER(ALLTRIM(torec.descriere)),"")
			lcValoare = NVL(UPPER(ALLTRIM(torec.valoare)),"")	
			lcTabela = NVL(UPPER(ALLTRIM(torec.tabela)),"")	
			lcCamp_id = NVL(UPPER(ALLTRIM(torec.camp_id)),"")		
			lnDinSchema = Alltrim(Str(torec.dinschema))
		
		
		Endif
		
		
		Do Case
			Case lcActiune = "INSERT"
		
				lcSql = [INSERT INTO sal_contract (variabila,descriere,valoare,tabela,camp_id,dinschema) VALUES ('] + lcvariabila + [','] + lcDescriere + ;
				[','] + lcValoare + [','] + lcTabela + [','] + lcCamp_id + [',] + lnDinSchema + [)] 
			
		
			Case lcActiune = "UPDATE"
		
				lcSql = [UPDATE sal_contract SET variabila = '] + lcvariabila + ;
				[',descriere = '] + lcDescriere + [',valoare = '] + lcValoare + ;
				[',tabela = '] + lcTabela + [',camp_id = '] + lcCamp_id + [',dinschema = ] + lnDinSchema + [ where id_contract = ] + lcId
		
			Case lcActiune = "DELETE"
			
				lcSql = [UPDATE sal_contract set sters = 1 where id_contract = ] + lcId
		Endcase
		
		This.csql = lcSql
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_campdoc 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="Ct_grid_search1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_grid_search1.But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_grid_search1.But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_grid_search1.But_nou1" UniqueID="" Timestamp="" />

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 387
		Name = "frm_campdoc"
		Width = 522
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 521
		_shape2.Height = 29
		_shape2.Left = 490
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 31
		Lb_titlu_alb_b121.Caption = "CONFIGURARE CÂMPURI DOCUMENTE"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 489
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		GRIDSORT1.Name = "GRIDSORT1"
		But_renunt1.Anchor = 9
		But_renunt1.Left = 458
		But_renunt1.Name = "But_renunt1"
		But_renunt1.Top = 1
		But_renunt1.Visible = .F.
	*</PropValue>

	ADD OBJECT 'Ct_grid_search1' AS ct_grid_search WITH ;
		Anchor = 15, ;
		cnumecursor = sal_v_contract, ;
		Height = 346, ;
		Left = 7, ;
		Name = "Ct_grid_search1", ;
		Top = 36, ;
		Width = 504, ;
		_GRID1.Height = 281, ;
		_GRID1.Left = 6, ;
		_GRID1.Name = "_GRID1", ;
		_GRID1.Top = 62, ;
		_GRID1.Width = 491, ;
		Titlu.Name = "Titlu", ;
		Cb_tx_cautare1.Criteriu.Name = "Criteriu", ;
		Cb_tx_cautare1.Left = 31, ;
		Cb_tx_cautare1.Name = "Cb_tx_cautare1", ;
		Cb_tx_cautare1.Text.Name = "Text", ;
		Cb_tx_cautare1.Top = 31
		*< END OBJECT: ClassLib="ferestre_cere_date.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_grid_search1.But_modifica1' AS but_modifica WITH ;
		Anchor = 9, ;
		caction = do_modifica, ;
		Left = 437, ;
		Name = "But_modifica1", ;
		Top = 31, ;
		Visible = .T., ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ct_grid_search1.But_nou1' AS but_nou WITH ;
		Anchor = 9, ;
		Left = 408, ;
		Name = "But_nou1", ;
		Top = 31, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ct_grid_search1.But_sterge1' AS but_sterge WITH ;
		Anchor = 9, ;
		caction = do_sterge, ;
		Left = 465, ;
		Name = "But_sterge1", ;
		Top = 31, ;
		Visible = .T., ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />
	
	PROCEDURE do_adauga
		Private pniesire
		pniesire=0
		Select sal_v_contract
		Scatter Name loRec Blank
		
		Do Adauga_Modifica_Inregistrare With "campdoc",loRec,,"INSERT",,"addcon"
		If pniesire=1
			This.ct_grid_search1.initializare(.t.)
		Endif
	ENDPROC

	PROCEDURE do_modifica
		Private pniesire
		pniesire=0
		Select sal_v_contract
		Scatter Name loRec 
		
		Do Adauga_Modifica_Inregistrare With "campdoc",loRec,lorec.id_contract,"UPDATE",,"addcon"
		If pniesire=1
			This.ct_grid_search1.initializare(.t.)
		Endif
	ENDPROC

	PROCEDURE do_sterge
		Select sal_v_contract
		Scatter Name lorec
		Do sterge_inregistrare With 'campdoc',lorec.id_contract
		This.ct_grid_search1.initializare(.T.)
		Release lorec
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		 
		this.ct_GRID_SEARCH1.initializare(.t.)
	ENDPROC

	PROCEDURE _shape1.DblClick
		
		IF thisform.WindowState= 2
			thisform.WindowState = 0
		ELSE 
			thisform.WindowState= 2
		ENDIF 		
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_campdoc_nou 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_tx_simplu4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cus_odata_campdoc1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: nid
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 229
		Name = "frm_campdoc_nou"
		nid = 0
		orec = 
		Width = 373
		_shape1.Name = "_shape1"
		_shape2.Height = 29
		_shape2.Left = 312
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 62
		Lb_titlu_alb_b121.Caption = "Configurare câmp document"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 9
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 7
		Gridsort1.Height = 17
		Gridsort1.Left = 228
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 204
		Gridsort1.Width = 36
		But_renunt1.Name = "But_renunt1"
		But_renunt1.TabIndex = 8
	*</PropValue>

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 2, ;
		Top = 73, ;
		Width = 348, ;
		TEXT_SIMPLU1.ControlSource = "porec.descriere", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.Left = 101, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 235, ;
		LB_SIMPLU1.Caption = "Descriere :", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu2' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_tx_simplu2", ;
		TabIndex = 3, ;
		Top = 101, ;
		Width = 348, ;
		TEXT_SIMPLU1.ControlSource = "porec.valoare", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.Left = 101, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 235, ;
		LB_SIMPLU1.Caption = "Valoare :", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu3' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_tx_simplu3", ;
		TabIndex = 4, ;
		Top = 129, ;
		Width = 348, ;
		TEXT_SIMPLU1.ControlSource = "porec.tabela", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.Left = 101, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 235, ;
		LB_SIMPLU1.Caption = "Tabel :", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu4' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_tx_simplu4", ;
		TabIndex = 1, ;
		Top = 45, ;
		Width = 348, ;
		Text_simplu1.ControlSource = "porec.variabila", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 235, ;
		Lb_simplu1.Caption = "Reper :", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu5' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_tx_simplu5", ;
		TabIndex = 5, ;
		Top = 157, ;
		Width = 348, ;
		Text_simplu1.ControlSource = "porec.camp_id", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 235, ;
		Lb_simplu1.Caption = "Camp_ID :", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu6' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_tx_simplu6", ;
		TabIndex = 6, ;
		Top = 185, ;
		Width = 147, ;
		Text_simplu1.ControlSource = "porec.dinschema", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 43, ;
		Lb_simplu1.Caption = "Din Schema :", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cus_odata_campdoc1' AS cus_odata_campdoc WITH ;
		Left = 182, ;
		Name = "Cus_odata_campdoc1", ;
		Top = 202
		*< END OBJECT: ClassLib="configurare_doc.vcx" BaseClass="custom" />
	
	PROCEDURE inainte_de_do_termin
		Local PLRETURN,lcActiune
		This.but_TERMIN1.SetFocus()
		lcActiune = This.cus_odata_campdoc1.cactiune
		lcVariabila = Strtran(porec.variabila,[ ],[])
		Do Case
			Case gnIdProgram = 75 And ;
					NOT ((Substr(lcVariabila,1,1) = [N] And Type(Substr(lcVariabila,2,1)) = "N") Or ;
					(Substr(lcVariabila,1,2) = [SS] And Type(Substr(lcVariabila,3,1)) = "N"))
				amessagebox("Campul 'REPER' poate incepe doar cu N sau SS!",48,"Atentie")
				Thisform.clb_tx_simplu4.teXT_SIMPLU1.SetFocus()
				PLRETURN = .F.
			Case gnIdProgram = 4 And ;
					NOT ((Substr(lcVariabila,1,1) = [N] And Type(Substr(lcVariabila,2,1)) = "N") Or ;
					(Substr(lcVariabila,1,1) = [S] And Type(Substr(lcVariabila,2,1)) = "N"))
				amessagebox("Campul 'REPER' poate incepe doar cu N sau S!",48,"Atentie")
				Thisform.clb_tx_simplu4.teXT_SIMPLU1.SetFocus()
				PLRETURN = .F.
			Case !INLIST(gnIdProgram,4,75) And ;
					NOT (Substr(lcVariabila,1,1) = [N] And Type(Substr(lcVariabila,2,1)) = "N")
				amessagebox("Campul 'REPER' poate incepe doar cu N!",48,"Atentie")
				Thisform.clb_tx_simplu4.teXT_SIMPLU1.SetFocus()
				PLRETURN = .F.
			Otherwise
				PLRETURN=This.cus_odata_campdoc1.salvare(This.OREC,This.NID)
		Endcase
		Return PLRETURN
		
	ENDPROC

	PROCEDURE Init
		Lparameters toRec, tnId, tcActiune
		
		DoDefault()
		
		This.orec= toRec
		This.nid = tnId
		This.cus_odata_campdoc1.cactiune = tcActiune
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_configurare_doc 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="sh_pas2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_grid_search1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie_pas2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="sh_pas3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="sh_pas4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ed_descriere" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nume_fisier" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_cale_fisier" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_executa1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_tip_operatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_pas1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_pas2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_pas3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_pas4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie_pas3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie_pas4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_document" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: afiseaza_grid
		*m: afiseaza_pas
		*m: do_alege_calefisier
		*m: do_alege_document
		*m: do_alege_tip_operatie
		*m: do_deschide_document
		*m: do_selecteaza_document
		*p: ccale_fisier
		*p: cdescriere
		*p: cnume_fisier
		*p: cultimacale
		*p: nid_entitate
		*p: nid_referinta
		*p: ntip
	*</DefinedPropArrayMethod>

	*<PropValue>
		ccale_fisier = 
		cdescriere = 
		cnume_fisier = 
		cultimacale = C:\
		DoCreate = .T.
		Height = 417
		Name = "frm_configurare_doc"
		nid_entitate = 
		nid_referinta = 
		ntip = 
		Width = 800
		WindowState = 2
		_shape1.Anchor = 11
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 800
		_shape1.ZOrderSet = 6
		_shape2.Anchor = 9
		_shape2.Height = 29
		_shape2.Left = 729
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 72
		_shape2.ZOrderSet = 7
		Lb_titlu_alb_b121.Caption = "Configurare documente"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 11
		Lb_titlu_alb_b121.ZOrderSet = 8
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 767
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 10
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 9
		Gridsort1.Left = 5
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 42
	*</PropValue>

	ADD OBJECT 'But_reset1' AS but_reset WITH ;
		Anchor = 9, ;
		Left = 735, ;
		Name = "But_reset1", ;
		TabIndex = 14, ;
		Top = 1, ;
		ZOrderSet = 17
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Clb_nume_fisier' AS clb_tx_simplu WITH ;
		Anchor = 9, ;
		BorderColor = 127,157,185, ;
		Left = 434, ;
		Name = "Clb_nume_fisier", ;
		TabIndex = 6, ;
		Top = 173, ;
		Width = 314, ;
		ZOrderSet = 11, ;
		Text_simplu1.ControlSource = "Thisform.cnume_fisier", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 98, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 213, ;
		Lb_simplu1.Caption = "Nume fișier", ;
		Lb_simplu1.FontCharSet = 238, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cmd_executa1' AS cmd_executa WITH ;
		Anchor = 9, ;
		Caption = "Înca\<rcă", ;
		FontCharSet = 238, ;
		Left = 682, ;
		Name = "Cmd_executa1", ;
		TabIndex = 9, ;
		Top = 328, ;
		ZOrderSet = 13
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ct_cale_fisier' AS ct_clb_cautare_var WITH ;
		Anchor = 9, ;
		cconditie = EMPTY(NVL(Thisform.ccale_fisier,[])), ;
		cprocedura = Thisform.do_alege_calefisier, ;
		cvar_afisata = Thisform.ccale_fisier, ;
		Left = 433, ;
		Name = "Ct_cale_fisier", ;
		TabIndex = 8, ;
		Top = 277, ;
		ZOrderSet = 12, ;
		shape_cautare.BorderColor = 127,157,185, ;
		shape_cautare.Name = "shape_cautare", ;
		img_cautare.Name = "img_cautare", ;
		lb_cautare.Caption = "Cale fișier", ;
		lb_cautare.FontCharSet = 238, ;
		lb_cautare.Name = "lb_cautare", ;
		tx_cautare.FontName = "Arial Narrow", ;
		tx_cautare.Height = 23, ;
		tx_cautare.Left = 75, ;
		tx_cautare.Name = "tx_cautare", ;
		tx_cautare.Top = 4, ;
		tx_cautare.Width = 234
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_grid_search1' AS ct_grid_search WITH ;
		Anchor = 15, ;
		Height = 300, ;
		Left = 7, ;
		Name = "Ct_grid_search1", ;
		TabIndex = 3, ;
		Top = 109, ;
		Width = 420, ;
		ZOrderSet = 1, ;
		_GRID1.Anchor = 15, ;
		_GRID1.Height = 228, ;
		_GRID1.Left = 12, ;
		_GRID1.Name = "_GRID1", ;
		_GRID1.Top = 60, ;
		_GRID1.Width = 389, ;
		Titlu.Name = "Titlu", ;
		Titlu.Visible = .F., ;
		Cb_tx_cautare1.Anchor = 3, ;
		Cb_tx_cautare1.criteriu.Name = "criteriu", ;
		Cb_tx_cautare1.Left = 73, ;
		Cb_tx_cautare1.Name = "Cb_tx_cautare1", ;
		Cb_tx_cautare1.Text.Name = "Text", ;
		Cb_tx_cautare1.Top = 31
		*< END OBJECT: ClassLib="ferestre_cere_date.vcx" BaseClass="container" />

	ADD OBJECT 'ed_descriere' AS ed_tx_simplu WITH ;
		Anchor = 9, ;
		BorderColor = 127,157,185, ;
		Left = 434, ;
		Name = "ed_descriere", ;
		TabIndex = 7, ;
		Top = 201, ;
		Width = 314, ;
		ZOrderSet = 10, ;
		_edbase1.ControlSource = "Thisform.cdescriere", ;
		_edbase1.Format = "!K", ;
		_edbase1.Name = "_edbase1", ;
		_lbbase1.Caption = "Descriere", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'lb_explicatie_pas2' AS lb_simplu WITH ;
		Anchor = 11, ;
		Caption = '  Faceți dublu-click în coloana "descriere" corespunzătoare fișierului pe care doriți să-l modificați.', ;
		FontCharSet = 238, ;
		Height = 47, ;
		Left = 192, ;
		Name = "lb_explicatie_pas2", ;
		TabIndex = 5, ;
		Top = 93, ;
		Width = 207, ;
		WordWrap = .T., ;
		ZOrderSet = 2
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_explicatie_pas3' AS lb_simplu WITH ;
		Anchor = 9, ;
		AutoSize = .F., ;
		Caption = "   Modificați fișierul în Word, după care salvați-l pe calculatorul dumneavoastră și închideți-l.", ;
		FontCharSet = 238, ;
		Height = 32, ;
		Left = 468, ;
		Name = "lb_explicatie_pas3", ;
		TabIndex = 4, ;
		Top = 48, ;
		Width = 312, ;
		WordWrap = .T., ;
		ZOrderSet = 20
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_explicatie_pas4' AS lb_simplu WITH ;
		Anchor = 9, ;
		AutoSize = .F., ;
		Caption = "   Completați datele necesare și alegeți fișierul pe care doriți să-l încărcați în baza de date.", ;
		FontCharSet = 238, ;
		Height = 32, ;
		Left = 468, ;
		Name = "lb_explicatie_pas4", ;
		TabIndex = 5, ;
		Top = 96, ;
		Width = 300, ;
		WordWrap = .T., ;
		ZOrderSet = 21
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_pas1' AS lb_titlu_negru_b12 WITH ;
		Caption = "1", ;
		FontSize = 30, ;
		Left = 19, ;
		Name = "lb_pas1", ;
		TabIndex = 12, ;
		Top = 40, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_pas2' AS lb_titlu_negru_b12 WITH ;
		Caption = "2", ;
		FontSize = 30, ;
		Left = 23, ;
		Name = "lb_pas2", ;
		TabIndex = 13, ;
		Top = 89, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_pas3' AS lb_titlu_negru_b12 WITH ;
		Anchor = 9, ;
		Caption = "3", ;
		FontSize = 30, ;
		Left = 438, ;
		Name = "lb_pas3", ;
		TabIndex = 15, ;
		Top = 40, ;
		ZOrderSet = 18
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_pas4' AS lb_titlu_negru_b12 WITH ;
		Anchor = 9, ;
		Caption = "4", ;
		FontSize = 30, ;
		Left = 438, ;
		Name = "lb_pas4", ;
		TabIndex = 16, ;
		Top = 89, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'opt_document' AS _optiongrup WITH ;
		AutoSize = .F., ;
		BorderStyle = 0, ;
		Height = 46, ;
		Left = 58, ;
		Name = "opt_document", ;
		TabIndex = 2, ;
		Top = 90, ;
		Value = 0, ;
		Width = 136, ;
		ZOrderSet = 22, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Document nou", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option1.Value = 0, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Document existent :", ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'opt_tip_operatie' AS _optiongrup WITH ;
		Anchor = 11, ;
		AutoSize = .F., ;
		Height = 46, ;
		Left = 8, ;
		Name = "opt_tip_operatie", ;
		TabIndex = 1, ;
		Top = 41, ;
		Value = 0, ;
		Width = 412, ;
		ZOrderSet = 14, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Modifică și salvează", ;
		Option1.FontCharSet = 238, ;
		Option1.FontName = "Arial", ;
		Option1.Left = 50, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option1.Value = 0, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Salvează", ;
		Option2.FontCharSet = 238, ;
		Option2.Left = 50, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'sh_pas2' AS _shape WITH ;
		Anchor = 15, ;
		BackStyle = 0, ;
		BorderColor = 209,209,191, ;
		Curvature = 10, ;
		Height = 312, ;
		Left = 8, ;
		Name = "sh_pas2", ;
		Top = 90, ;
		Width = 412, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'sh_pas3' AS _shape WITH ;
		Anchor = 9, ;
		BackStyle = 0, ;
		BorderColor = 209,209,191, ;
		Curvature = 10, ;
		Height = 46, ;
		Left = 424, ;
		Name = "sh_pas3", ;
		Top = 41, ;
		Width = 368, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'sh_pas4' AS _shape WITH ;
		Anchor = 13, ;
		BackStyle = 0, ;
		BorderColor = 209,209,191, ;
		Curvature = 10, ;
		Height = 312, ;
		Left = 424, ;
		Name = "sh_pas4", ;
		Top = 90, ;
		Width = 368, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />
	
	PROCEDURE afiseaza_grid
		Lparameters tlAfiseaza
		With Thisform.ct_grid_search1
			.cb_tx_cautare1.Text.Enabled = tlAfiseaza
			.cb_tx_cautare1.criteriu.Enabled = tlAfiseaza
			._GRID1.Visible = tlAfiseaza
			If tlAfiseaza
				.cb_tx_cautare1.criteriu.Value = [1]
				.cb_tx_cautare1.Text.Value = [%]
				.do_cauta()
				._Grid1.Autofit()
			Else
				.cb_tx_cautare1.Text.Value = []
			Endif
		Endwith
	ENDPROC

	PROCEDURE afiseaza_pas
		Lparameters tnPas,tlAfiseaza
		Do Case
			Case tnPas = 1
				With Thisform.opt_tip_operatie
					.Value = Iif(tlAfiseaza,0,.Value)
					.Option1.Enabled = tlAfiseaza
					.Option2.Enabled = tlAfiseaza
				Endwith
				Thisform.lb_pas1.Enabled = tlAfiseaza
				If tlAfiseaza
					Thisform.nid_referinta = Null
					Thisform.nid_entitate = Null
					Thisform.ntip = Null
					Thisform.cdescriere = []
					Thisform.ccale_fisier = []
					Thisform.cnume_fisier = []
					Thisform.Refresh()
				Endif
			Case tnPas = 2
				With Thisform.opt_document
					If tlAfiseaza
						.Value = 0
					Endif
					.Option1.Enabled = Iif(Thisform.opt_tip_operatie.Value=1,.F.,tlAfiseaza)
					.Option2.Enabled = Iif(Thisform.opt_tip_operatie.Value=1,.F.,tlAfiseaza)
				Endwith
				Thisform.lb_explicatie_pas2.Visible = .F.
				Thisform.afiseaza_grid(.F.)
				Thisform.lb_pas2.Enabled = tlAfiseaza
			Case tnPas = 3
				Thisform.lb_pas3.Enabled = tlAfiseaza
				Thisform.lb_explicatie_pas3.Enabled = tlAfiseaza
			Case tnPas = 4
				Thisform.lb_pas4.Enabled = tlAfiseaza
				Thisform.lb_explicatie_pas4.Enabled = tlAfiseaza
				Thisform.cmd_executa1.Enabled = tlAfiseaza
				Thisform.clb_nume_fisier.text_simplu1.ReadOnly = IIF(Thisform.opt_document.Value=1,!tlAfiseaza,.T.)
				Thisform.clb_nume_fisier.lb_simplu1.Enabled = IIF(Thisform.opt_document.Value=1,tlAfiseaza,.F.)
				Thisform.ed_descriere._edbase1.ReadOnly = IIF(Thisform.opt_document.Value=1,!tlAfiseaza,.T.)
				Thisform.ed_descriere._lbbase1.Enabled = IIF(Thisform.opt_document.Value=1,tlAfiseaza,.F.)
				Thisform.ct_cale_fisier.lb_cautare.Enabled = tlAfiseaza
				If tlAfiseaza
					Thisform.ct_cale_fisier.do_activeaza()
				Else
					Thisform.ct_cale_fisier.do_dezactiveaza()
				Endif
		Endcase
	ENDPROC

	PROCEDURE do_alege_calefisier
		Local lcCaleFisier, lcNumeFisier
		lcCaleFisier = Getfile([],[Nume fisier],[Alege],0,[Cautare fisier])
		If !Empty(lcCaleFisier)
			lcNumeFisier = Juststem(lcCaleFisier)
			Thisform.ccale_fisier = lcCaleFisier
			If Thisform.opt_document.Value = 1
				Do Case
					Case Empty(Nvl(Thisform.cnume_fisier,[]))
						Thisform.cnume_fisier = Justfname(lcCaleFisier)
					Case Juststem(Upper(Thisform.cnume_fisier)) <> Juststem(Upper(lcNumeFisier))
						If amessagebox("Doriti sa schimbati numele care va fi scris in baza de date din " + Juststem(Upper(Thisform.cnume_fisier)) + ;
							" in " + Juststem(Upper(lcNumeFisier)) + "?",4+32,"Confirmare redenumire")=6
							Thisform.cnume_fisier = Justfname(lcCaleFisier)
						Endif
					Otherwise
						lcNumeFisier = []
				Endcase
			Endif
			Thisform.Refresh()
		Endif
		
	ENDPROC

	PROCEDURE do_alege_document
		Local lnValoare
		lnValoare = Thisform.opt_document.Value
		Do Case
			Case lnValoare = 1
				&&	gnIdProgram : 4 - ROARES; 75 - ROASALSPEC
				Thisform.nid_entitate = IIF(gnIdProgram=75,1,5)
				Thisform.ntip = 2
				Thisform.afiseaza_pas(2,.F.)
				Thisform.afiseaza_pas(3,.F.)
				Thisform.afiseaza_pas(4,.T.)
				Thisform.afiseaza_grid(.F.)
				Thisform.lb_explicatie_pas2.Visible = .F.
			Case lnValoare = 2
				Thisform.afiseaza_pas(4,.F.)
				Thisform.afiseaza_grid(.T.)
				Thisform.lb_explicatie_pas2.Visible = .T.
			Otherwise
				lnValoare = 0
		Endcase
	ENDPROC

	PROCEDURE do_alege_tip_operatie
		Thisform.afiseaza_pas(1,.F.)
		Thisform.afiseaza_pas(2,.T.)
		If Thisform.opt_tip_operatie.Value = 1
			Thisform.opt_document.Value = 2
			Thisform.lb_explicatie_pas2.Caption = [  Faceți dublu-click în coloana "descriere" corespunzătoare fișierului pe care doriți să-l modificați.]
		Else
			Thisform.lb_explicatie_pas2.Caption = [  Faceți dublu-click în coloana "descriere" corespunzătoare fișierului pe care doriți să-l salvați.]
		Endif
		
	ENDPROC

	PROCEDURE do_deschide_document
		Thisform.afiseaza_pas(3,.T.)
		Thisform.afiseaza_pas(4,.T.)
	ENDPROC

	PROCEDURE do_executa
		Do Case
			Case Empty(Nvl(Thisform.cdescriere,[]))
				amessagebox("Nu ati completat descrierea!",48,"Atentie")
				Thisform.ed_descriere._edbase1.SetFocus()
			Case Empty(Nvl(Thisform.ccale_fisier,[]))
				amessagebox("Nu ati ales fisierul!",48,"Atentie")
				Thisform.ct_cale_fisier.tx_cautare.SetFocus()
			Case Empty(Nvl(Thisform.cnume_fisier,[]))
				amessagebox("Nu ati completat numele fisierului!",48,"Atentie")
				Thisform.clb_nume_fisier.text_simplu1.SetFocus()
			Case Empty(Justext(Thisform.cnume_fisier))
				amessagebox("Nu ati completat extensia fisierului! ( De exemplu : " + Alltrim(Justfname(Thisform.cnume_fisier)) + ".doc )",48,"Atentie")
				Thisform.clb_nume_fisier.text_simplu1.SetFocus()
			Case !File(Thisform.ccale_fisier)					&&	modificare	ROARES v 2.0.4
				amessagebox("Fisierul ales nu a fost gasit!",48,"Atentie")
				Thisform.ct_cale_fisier.tx_cautare.SetFocus()
			Otherwise
				If template_adauga(Thisform.opt_document.Value,Thisform.ntip,Thisform.nid_entitate,Thisform.nid_referinta,Thisform.cdescriere,;
						Thisform.cnume_fisier,Thisform.ccale_fisier)
					Thisform.cultimacale = Justpath(Thisform.ccale_fisier)
					Thisform.do_reset()
				Endif
		Endcase
		
	ENDPROC

	PROCEDURE do_reset
		Thisform.afiseaza_pas(1,.T.)
		Thisform.afiseaza_pas(2,.F.)
		Thisform.afiseaza_pas(3,.F.)
		Thisform.afiseaza_pas(4,.F.)
	ENDPROC

	PROCEDURE do_selecteaza_document
		Local lcCursor,lcCaleFisier,loRec
		lcCursor = Thisform.ct_grid_search1.cnumecursor
		If Used(lcCursor)
			If Reccount(lcCursor)>0
				Select (lcCursor)
				Thisform.nid_referinta = id_referinta
				Thisform.nid_entitate = id_entitate
				Thisform.cnume_fisier = Alltrim(nume_fisier)
				Thisform.cdescriere = Alltrim(descriere)
				Thisform.ntip = tip
				If Thisform.opt_tip_operatie.Value = 1
					loRec = template_citeste(Thisform.nid_referinta)
					If !Isnull(loRec)
						Thisform.ccale_fisier = Addbs(gcTempPath) + Thisform.cnume_fisier
						Strtofile(loRec.fisier,Thisform.ccale_fisier)
						open_default_app(Thisform.ccale_fisier)
						Thisform.afiseaza_pas(2,.F.)
						Thisform.afiseaza_pas(3,.T.)
						Thisform.afiseaza_pas(4,.T.)
					Else
						amessagebox("Fisierul nu a fost citit din baza de date!",16,"Eroare")
					Endif
				Else
					lcCaleFisier = Thisform.cultimacale + "\" + Thisform.cnume_fisier
					If File(lcCaleFisier)
						Thisform.ccale_fisier = lcCaleFisier
					Else
						lcCaleFisier = gcAppPath + "Date_" + gcAppName + "\" + Thisform.cnume_fisier
						If File(lcCaleFisier)
							Thisform.ccale_fisier = lcCaleFisier
						Endif
					Endif
					Thisform.afiseaza_pas(2,.F.)
					Thisform.afiseaza_pas(4,.T.)
				Endif
				Thisform.Refresh()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local llReturn, lcNumeCursor
		llReturn = .T.
		If !Empty(Nvl(Thisform.cdescriere,[])) Or !Empty(Nvl(Thisform.ccale_fisier,[])) Or !Empty(Nvl(Thisform.cnume_fisier,[]))
			If amessagebox("Sunteti sigur ca doriti sa inchideti fereastra fara sa salvati?",4+32,"Configurare documente") = 7
				llReturn = .F.
			Endif
		Endif
		If llReturn
			lcNumeCursor = Thisform.ct_grid_search1.cnumecursor
			If Used(lcNumeCursor)
				Use In (lcNumeCursor)
			Endif
		Endif
		Return llReturn
	ENDPROC

	PROCEDURE Init
		DoDefault()
		Local lcView
		If gnIdProgram = 75
			lcView = [sal_vdocumente_ss]		&&	75 - ROASALSPEC
		Else
			lcView = [sal_vdocumente_ru]		&&	4 - ROARES
		Endif
		With Thisform.ct_grid_search1
			._GRID1.Visible = .F.
			.cSchema = ['id_entitate n(10),id_referinta n(10),tip n(1),descriere_m c(250),descriere c(250),nume_fisier c(100)']
			.cSelect = ['select id_entitate,id_referinta,tip,descriere_m,descriere,nume_fisier from ] + lcView + [ where 1=2']
			.cTitlu_coloane = 'Descriere,Nume fisier'
			.cNume_coloane = 'descriere_m;nume_fisier'
			.cFiltruOriginal = [2=2]
			.cOrder = 'descriere_m'
			.cNumecursor = [crsdocs]
			.initializare()
		Endwith
		Thisform.do_reset()
		
	ENDPROC

	PROCEDURE Ct_grid_search1.initializare
		PARAMETERS tlNumerotare
		DODEFAULT(tlNumerotare)
		Bindevent(This._GRID1.Column1.Text1,[DblClick],Thisform,[do_selecteaza_document],1)
	ENDPROC

	PROCEDURE opt_document.InteractiveChange
		Thisform.do_alege_document()
	ENDPROC

	PROCEDURE opt_document.ProgrammaticChange
		Thisform.do_alege_document()
	ENDPROC

	PROCEDURE opt_tip_operatie.InteractiveChange
		Thisform.do_alege_tip_operatie()
	ENDPROC

ENDDEFINE
