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

	#INCLUDE "..\..\program files\microsoft visual foxpro 8\foxpro.h"
	*<DefinedPropArrayMethod>
		*p: cschema
	*</DefinedPropArrayMethod>

	*<PropValue>
		cschema = 
		Name = "cus_odata_cote"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		
		lcActiune = Alltrim(This.cActiune)
		lcs = this.cschema 
		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')
			lcnume = Nvl(STRTRAN(Alltrim(Upper(toRec.descriere)),['],['']),"")
			lcLuna = ALLTRIM(STR(toRec.luna))
			lcAn = ALLTRIM(STR(toRec.an))
			lcProcent = ALLTRIM(STR(toRec.procent))
			lcproc = ALLTRIM(STR(toRec.proc_tva,5,2))
			
		Endif
		
		
		Do Case
			Case lcActiune = "INSERT"
		
				lcSql = [INSERT INTO ] + lcS + [.cote_tva (descriere,procent,proc_tva,an,luna) VALUES ('] +;
						lcnume + [',] + lcProcent + [,] + lcproc + [,] + lcan + [,] + lcluna + [)]
		
			Case lcActiune = "UPDATE"
		
				lcSql = [UPDATE ] + lcS + [.cote_tva SET descriere = '] + lcnume + ;
						[', procent = ] + lcprocent + [,proc_tva = ] + lcproc + [, an = ] + lcan + [, luna = ] + lcluna +;
						[ where id_proc_tva = ] + lcId 
		
		
			Case lcActiune = "DELETE"
			
				lcSql = [delete from ] + lcS + [.cote_tva where id_proc_tva=] + lcId
			
		Endcase
		
		This.csql = lcSql
		
	ENDPROC

ENDDEFINE

DEFINE CLASS cus_odata_exceptii AS _cusodatabase OF "..\libs\_cus_odata_base.vcx" 
 	*< CLASSDATA: Baseclass="custom" Timestamp="" Scale="Pixels" Uniqueid="" />

	#INCLUDE "..\..\program files\microsoft visual foxpro 8\foxpro.h"
	*<DefinedPropArrayMethod>
		*p: cschema
	*</DefinedPropArrayMethod>

	*<PropValue>
		cschema = 
		Name = "cus_odata_exceptii"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		
		lcActiune = Alltrim(This.cActiune)
		lcs = this.cschema 
		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')
			lcCont = Nvl(STRTRAN(Alltrim(Upper(toRec.cont)),['],['']),"")
			lcContC = Nvl(STRTRAN(Alltrim(Upper(toRec.cont_c)),['],['']),"")
			lcDebit = ALLTRIM(STR(toRec.debit))
			lcInvers = '1'
			
		Endif
		
		
		Do Case
			Case lcActiune = "INSERT"
		
				lcSql = [INSERT INTO ] + lcS + [.exceptii_ireg (cont,cont_c,debit,invers) VALUES ('] +;
						lcCont + [','] + lcContC + [',] + lcDebit + [,] + lcInvers + [)]
		
			Case lcActiune = "UPDATE"
		
				lcSql = [UPDATE ] + lcS + [.exceptii_ireg SET cont = '] + lccont + ;
						[', cont_c = '] + lcContC + [',debit = ] + lcDebit + [, invers = ] + lcInvers +;
						[ where id_exceptii = ] + lcId 
		
		
			Case lcActiune = "DELETE"
			
				lcSql = [delete from ] + lcS + [.exceptii_ireg where id_exceptii = ] + lcId
		Endcase
		
		This.csql = lcSql
		
	ENDPROC

ENDDEFINE

DEFINE CLASS cus_odata_optiuni AS _cusodatabase OF "..\libs\_cus_odata_base.vcx" 
 	*< CLASSDATA: Baseclass="custom" Timestamp="" Scale="Pixels" Uniqueid="" />

	#INCLUDE "..\..\program files\microsoft visual foxpro 8\foxpro.h"
	*<DefinedPropArrayMethod>
		*p: cschema
	*</DefinedPropArrayMethod>

	*<PropValue>
		cschema = 
		Name = "cus_odata_optiuni"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		
		lcActiune = Alltrim(This.cActiune)
		lcs = this.cschema 
		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",'DELETE')
			lcId = Alltrim(Str(tnId))
		Endif
		
		If Inlist(lcActiune, "UPDATE",'INSERT')
			lcnume = Nvl(STRTRAN(Alltrim(Upper(toRec.varname)),['],['']),"")
			lctip = Nvl(STRTRAN(Alltrim(Upper(toRec.vartype)),['],['']),"")
			lcval = Nvl(STRTRAN(Alltrim(Upper(toRec.varvalue)),['],['']),"")
			lcdesc = Nvl(STRTRAN(Alltrim(Upper(toRec.vardesc)),['],['']),"")
		
			
		Endif
		
		
		Do Case
			Case lcActiune = "INSERT"
		
				lcSql = [INSERT INTO ] + lcS + [.optiuni (varname,vartype,varvalue,vardesc) VALUES ('] +;
						lcnume + [','] + lctip + [','] + lcval + [','] + lcdesc + [')]
		
			Case lcActiune = "UPDATE"
		
				lcSql = [UPDATE ] + lcS + [.optiuni SET varname = '] + lcnume + ;
						[', vartype = '] + lctip + [',varvalue = '] + lcval + [', vardesc = '] + lcdesc + ;
						[' where id_optiuni = ] + lcId 
		
			Case lcActiune = "DELETE"
			
				lcSql = [delete from ] + lcS + [.optiuni where id_optiuni=] + lcId
			
		Endcase
		
		This.csql = lcSql
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_cote_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="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cus_odata_cote1" UniqueID="" Timestamp="" />

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

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 165
		Name = "frm_cote_nou"
		Width = 314
		_shape1.Name = "_shape1"
		_shape2.Height = 29
		_shape2.Left = 252
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 76
		Lb_titlu_alb_b121.Caption = "Cote tva"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 7
		BUT_TERMIN1.Left = 283
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 5
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 1, ;
		Top = 44, ;
		Text_simplu1.ControlSource = "porec.descriere", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		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 ;
		Left = 15, ;
		Name = "Clb_tx_simplu2", ;
		TabIndex = 2, ;
		Top = 72, ;
		Text_simplu1.ControlSource = "porec.procent", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Procent", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu3' AS clb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Clb_tx_simplu3", ;
		TabIndex = 3, ;
		Top = 100, ;
		Text_simplu1.ControlSource = "porec.luna", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Luna", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu6' AS clb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Clb_tx_simplu6", ;
		TabIndex = 4, ;
		Top = 128, ;
		Text_simplu1.ControlSource = "porec.an", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "An", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cus_odata_cote1' AS cus_odata_cote WITH ;
		Left = 120, ;
		Name = "Cus_odata_cote1", ;
		Top = 26
		*< END OBJECT: ClassLib="ooptiuni.vcx" BaseClass="custom" />
	
	PROCEDURE inainte_de_do_termin
		LOCAL PLRETURN
		
		lccontrol = UPPER(this.ActiveControl.BaseClass )
		IF   INLIST(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.Activecontrol.controlsource
			&lcval=thisform.ActiveControl.value
		ENDIF 	
		
		
		Do Case
		Case Empty(porec.descriere)
			aMessagebox('Nu ati completat descrierea cotei de tva!',0+48,"Atentie")
			This.clb_tx_simplu1.SetFocus()
			plreturn=.F.
		
		*!*	Case Empty(porec.procent)
		*!*		Messagebox('Nu ati completat procentul de tva!',0+48,"Atentie")
		*!*		This.clb_tx_simplu2.SetFocus()
		*!*		plreturn=.F.
		
		Case Empty(porec.luna)
			aMessagebox('Nu ati completat luna!',0+48,"Atentie")
			This.clb_tx_simplu3.SetFocus()
			plreturn=.F.
		
		Case Empty(porec.an)
			aMessagebox('Nu ati completat anul!',0+48,"Atentie")
			This.clb_tx_simplu6.SetFocus()
			plreturn=.F.
			
		OTHERWISE
			this.cus_odata_cote1.cschema=this.cschema 
			PLRETURN=This.cus_odata_cote1.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_cote1.cactiune = tcActiune
	ENDPROC

	PROCEDURE Clb_tx_simplu2.Text_simplu1.Valid
		
		porec.proc_tva = (100+this.value)/100
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_cote_tva 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="grid_cot" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_cot.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_cot.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_cot.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_cot.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_cot.Column3.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_cot.Column3.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_cot.Column4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_cot.Column4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nom_cot" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: cschema
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		cschema = CONTAFIN_ORACLE
		DoCreate = .T.
		Height = 351
		Name = "frm_cote_tva"
		Width = 524
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 522
		_shape2.Height = 29
		_shape2.Left = 402
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 120
		Lb_titlu_alb_b121.Caption = "COTE TVA"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 494
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

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

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

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Left = 299, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 2, ;
		Top = 52
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grid_cot' AS _grid WITH ;
		ColumnCount = 4, ;
		DeleteMark = .F., ;
		Height = 264, ;
		Left = 5, ;
		Name = "grid_cot", ;
		Panel = 1, ;
		RecordSource = "v_cote_tva", ;
		RowHeight = 23, ;
		Top = 84, ;
		Width = 513, ;
		Column1.ControlSource = "descriere", ;
		Column1.Name = "Column1", ;
		Column1.Width = 305, ;
		Column2.ControlSource = "procent", ;
		Column2.Name = "Column2", ;
		Column2.Width = 66, ;
		Column3.ControlSource = "luna", ;
		Column3.Name = "Column3", ;
		Column3.Width = 43, ;
		Column4.ControlSource = "an", ;
		Column4.Name = "Column4", ;
		Column4.Width = 64
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="grid" />

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

	ADD OBJECT 'grid_cot.Column1.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_cot.Column2.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Procent %", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_cot.Column2.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_cot.Column3.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Luna", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_cot.Column3.Text1' AS textbox WITH ;
		Height = 23, ;
		Left = 31, ;
		Name = "Text1", ;
		Top = 35, ;
		Width = 100
		*< END OBJECT: BaseClass="textbox" />

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

	ADD OBJECT 'grid_cot.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 'lb_nom_cot' AS clb_tx_simplu WITH ;
		Left = 8, ;
		Name = "lb_nom_cot", ;
		TabIndex = 1, ;
		Top = 52, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Nume", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE actualizeaza_grid1
		LPARAMETERS pcFiltru
		LOCAL lcFiltru
		lcFiltru=pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru=pcot.ca_baza1.cfiltru
		ENDIF
		save_grid_tag(thisform.grid_cot)
		pcot.ca_baza1.cfiltru=lcFiltru
		pcot.ca_baza1.afisare()
		restore_grid_tag(thisform.grid_cot)
		IF RECCOUNT('v_cote_tva')>0
			thisform.grid_cot.SetFocus()
		ELSE
			thisform.lb_nom_cot.SetFocus()
		ENDIF
		
	ENDPROC

	PROCEDURE do_adauga
		SELECT v_cote_tva
		SCATTER NAME loRec BLANK 
		PRIVATE lcot,poRec
		lcot=''
		poRec = loRec
		DO Adauga_Modifica_Inregistrare WITH "cote",loRec,,"INSERT",.t.,'lcot'
		lcot.cschema = this.cschema 
		lcot.show(1)
		RELEASE lcot,poRec
		this.actualizeaza_grid1()
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		lcFiltru=[]
		lcNume = STRTRAN(Upper(Alltrim(This.lb_nom_cot.text_simplu1.value)),['],[''])
		If !Empty(lcNume)
			lcFiltru=[descriere like ']+lcNume+[%' and an=]+pcAn
		ELSE 
			lcFiltru = [an=]+pcAn	
		Endif
		This.MousePointer= 11
		This.LockScreen=.T.
		Thisform.actualizeaza_grid1(lcFiltru)
		IF RECCOUNT()=0
			aMESSAGEBOX("Cautarea nu a intors rezultate!",0+64,"Info cautare")
		ENDIF
		This.LockScreen=.F.
		This.MousePointer= 0
	ENDPROC

	PROCEDURE do_modifica
		Select v_cote_tva
		Scatter Name loRec
		PRIVATE lcot,poRec
		lcot = ''
		poRec = loRec
		Do Adauga_Modifica_Inregistrare With "cote",loRec,loRec.Id_proc_tva,"UPDATE",.t.,'lcot'
		lcot.cschema = this.cschema 
		lcot.show(1)
		RELEASE lcot,poRec
		thisform.actualizeaza_grid1()
	ENDPROC

	PROCEDURE do_sterge
		SELECT v_cote_tva
		SCATTER NAME lorec MEMO 
		PRIVATE lcot 
		lcot = ''
		Do STERGE_INREGISTRARE With "cote",loRec.id_proc_tva,.t.,'lcot'
		lcot.cschema = this.cschema 
		lcot.salvare(,loRec.id_proc_tva)
		RELEASE lcot
		
		this.actualizeaza_grid1()
		
		
	ENDPROC

	PROCEDURE Unload
		IF USED('v_cote_tva')
			USE IN v_cote_tva
		ENDIF
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_exceptii_ireg 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="grid_ex" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column3.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column3.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column5.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_ex.Column5.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nom_ex" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: cschema
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		cschema = CONTAFIN_ORACLE
		DoCreate = .T.
		Height = 351
		Name = "frm_exceptii_ireg"
		Width = 463
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 466
		_shape2.Height = 29
		_shape2.Left = 346
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 120
		Lb_titlu_alb_b121.Caption = "EXCEPTII"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 433
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

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

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

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Left = 299, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 2, ;
		Top = 52
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grid_ex' AS _grid WITH ;
		ColumnCount = 5, ;
		DeleteMark = .F., ;
		Height = 264, ;
		Left = 4, ;
		Name = "grid_ex", ;
		Panel = 1, ;
		RecordSource = "v_exceptii_ireg", ;
		RowHeight = 23, ;
		Top = 84, ;
		Width = 456, ;
		Column1.ControlSource = "cont", ;
		Column1.Name = "Column1", ;
		Column1.Width = 124, ;
		Column2.ControlSource = "cont_c", ;
		Column2.Name = "Column2", ;
		Column2.Width = 119, ;
		Column3.ControlSource = "iif(debit=0,'DEBIT','CREDIT')", ;
		Column3.Name = "Column3", ;
		Column3.Width = 179, ;
		Column4.ControlSource = "invers", ;
		Column4.Name = "Column4", ;
		Column4.Visible = .F., ;
		Column4.Width = 59, ;
		Column5.ControlSource = "id_set", ;
		Column5.Name = "Column5", ;
		Column5.Visible = .F., ;
		Column5.Width = 70
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="grid" />

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

	ADD OBJECT 'grid_ex.Column1.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_ex.Column2.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cont_corespondent", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_ex.Column2.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_ex.Column3.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pozitie cont", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_ex.Column3.Text1' AS textbox WITH ;
		Height = 23, ;
		Left = 31, ;
		Name = "Text1", ;
		Top = 35, ;
		Width = 100
		*< END OBJECT: BaseClass="textbox" />

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

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

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

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

	ADD OBJECT 'lb_nom_ex' AS clb_tx_simplu WITH ;
		Left = 8, ;
		Name = "lb_nom_ex", ;
		TabIndex = 1, ;
		Top = 52, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Cont", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE actualizeaza_grid1
		LPARAMETERS pcFiltru
		LOCAL lcFiltru
		lcFiltru=pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru=pex.ca_baza1.cfiltru
		ENDIF
		save_grid_tag(thisform.grid_ex)
		pex.ca_baza1.cfiltru=lcFiltru
		pex.ca_baza1.afisare()
		restore_grid_tag(thisform.grid_ex)
		IF RECCOUNT('v_exceptii_ireg')>0
			thisform.grid_ex.SetFocus()
		ELSE
			thisform.lb_nom_ex.SetFocus()
		ENDIF
		
	ENDPROC

	PROCEDURE do_adauga
		SELECT v_exceptii_ireg
		SCATTER NAME loRec BLANK 
		PRIVATE lex,poRec
		
		lex=''
		poRec = loRec
		DO Adauga_Modifica_Inregistrare WITH "exceptii",loRec,,"INSERT",.t.,'lex'
		lex.cschema = this.cschema 
		lex.show(1)
		RELEASE lex,poRec
		this.actualizeaza_grid1()
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		lcFiltru=[]
		lcNume = STRTRAN(Upper(Alltrim(This.lb_nom_ex.text_simplu1.value)),['],[''])
		If !Empty(lcNume)
			lcFiltru=[cont like ']+lcNume+[%']
		ELSE 
			lcFiltru = [2=2]	
		Endif
		This.MousePointer= 11
		This.LockScreen=.T.
		Thisform.actualizeaza_grid1(lcFiltru)
		IF RECCOUNT()=0
			aMESSAGEBOX("Cautarea nu a intors rezultate!",0+64,"Info cautare")
		ENDIF
		This.LockScreen=.F.
		This.MousePointer= 0
	ENDPROC

	PROCEDURE do_modifica
		Select v_exceptii_ireg
		Scatter Name loRec
		PRIVATE lex,poRec
		lex = ''
		poRec = loRec
		Do Adauga_Modifica_Inregistrare With "exceptii",loRec,loRec.Id_exceptii,"UPDATE",.t.,'lex'
		lex.cschema = this.cschema 
		lex.show(1)
		RELEASE lex,poRec
		thisform.actualizeaza_grid1()
	ENDPROC

	PROCEDURE do_sterge
		SELECT v_exceptii_ireg
		SCATTER NAME lorec MEMO 
		PRIVATE lex 
		lex = ''
		Do STERGE_INREGISTRARE With "exceptii",loRec.id_exceptii,.t.,'lex'
		lex.cschema = this.cschema 
		lex.salvare(,loRec.id_exceptii)
		RELEASE lex
		
		this.actualizeaza_grid1()
		
		
	ENDPROC

	PROCEDURE Unload
		IF USED('v_exceptii_ireg')
			USE IN v_exceptii_ireg
		ENDIF
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_exceptii_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="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cus_odata_exceptii1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_tx_simplu1" UniqueID="" Timestamp="" />

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

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 133
		Name = "frm_exceptii_nou"
		Width = 314
		_shape1.Name = "_shape1"
		_shape2.Height = 29
		_shape2.Left = 252
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 76
		Lb_titlu_alb_b121.Caption = "Exceptii"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 6
		BUT_TERMIN1.Left = 283
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 4
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

	ADD OBJECT 'Cb_tx_simplu1' AS cb_tx_simplu WITH ;
		Height = 29, ;
		Left = 15, ;
		Name = "Cb_tx_simplu1", ;
		TabIndex = 3, ;
		Top = 102, ;
		Width = 290, ;
		_cbbase1.BoundTo = .T., ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "DEBIT,CREDIT", ;
		_cbbase1.RowSourceType = 1, ;
		_lbbase1.Caption = "Pozitie", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 1, ;
		Top = 44, ;
		Text_simplu1.ControlSource = "porec.cont", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Cont", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu2' AS clb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Clb_tx_simplu2", ;
		TabIndex = 2, ;
		Top = 72, ;
		Text_simplu1.ControlSource = "porec.cont_c", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Corespondent", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cus_odata_exceptii1' AS cus_odata_exceptii WITH ;
		Left = 168, ;
		Name = "Cus_odata_exceptii1", ;
		Top = 33
		*< END OBJECT: ClassLib="ooptiuni.vcx" BaseClass="custom" />
	
	PROCEDURE inainte_de_do_termin
		LOCAL PLRETURN
		
		porec.debit = IIF(this.cb_tx_simplu1._CBBASE1.Value="DEBIT",0,1)
		lccontrol = UPPER(this.ActiveControl.BaseClass )
		IF   INLIST(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.Activecontrol.controlsource
			&lcval=thisform.ActiveControl.value
		ENDIF 	
		
		
		Do Case
		Case Empty(porec.cont)
			aMessagebox('Nu ati completat contul!',0+48,"Atentie")
			This.clb_tx_simplu1.SetFocus()
			plreturn=.F.
		
		Case Empty(porec.cont_c)
			aMessagebox('Nu ati completat contul corespondent!',0+48,"Atentie")
			This.clb_tx_simplu2.SetFocus()
			plreturn=.F.
		
		*!*	Case Empty(porec.debit)
		*!*		Messagebox('Nu ati completat pozitia contului!',0+48,"Atentie")
		*!*		This.clb_tx_simplu3.SetFocus()
		*!*		plreturn=.F.
			
		OTHERWISE
		
			lcCont = ALLTRIM(porec.cont)
			lcContC = ALLTRIM(porec.cont_c)
			lcSql = [select * from ] + gcS + [.plcont where cont=]+lcCont
			lcCursor = [cur_cont]
			lnSucces = goExecutor.oExecute(lcSql,lcCursor)
			goExecutor.oReset()															&&Verific contu in plcont
			
			IF RECCOUNT('cur_cont')=0
				aMESSAGEBOX('Contul '+lcCont+' nu este definit in planul de conturi!',0,'Eroare')
				PLRETURN=.f.
				USE IN cur_cont
				RETURN PLRETURN
			ENDIF 
			IF USED('cur_cont')
				USE IN cur_cont
			ENDIF 
			
			lcSql = [select * from ] + gcS + [.plcont where cont=]+lcContC
			lcCursor = [cur_cont_c]
			lnSucces = goExecutor.oExecute(lcSql,lcCursor)
			goExecutor.oReset()															&&Verific contul corespondent
			IF RECCOUNT('cur_cont_c')=0
				aMESSAGEBOX('Contul '+lcContC+' nu este definit in planul de conturi!',0,'Eroare')
				PLRETURN=.f.
				USE IN cur_cont_c
				RETURN PLRETURN
			ENDIF 	
			IF USED('cur_cont_c')
				USE IN cur_cont_c
			ENDIF 
			this.cus_odata_exceptii1.cschema=this.cschema 
			PLRETURN=This.cus_odata_exceptii1.salvare(This.OREC,This.NID)
		ENDCASE 
		
		Return PLRETURN
		
	ENDPROC

	PROCEDURE Init
		LPARAMETERS toRec, tnId, tcActiune
		
		DODEFAULT()
		IF porec.debit=0
			this.cb_tx_simplu1._cBBASE1.DisplayValue='DEBIT'
		ELSE 
			this.cb_tx_simplu1._cBBASE1.DisplayValue='CREDIT'
		ENDIF 		
		this.orec= toRec
		this.nid = tnId
		this.cus_odata_exceptii1.cactiune = tcActiune
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_optiuni 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="grid_opt" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_opt.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_opt.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_opt.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_opt.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_opt.Column3.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_opt.Column3.Edit1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_opt.Column4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_opt.Column4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nom_opt" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: cschema
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		cschema = CONTAFIN_ORACLE
		DoCreate = .T.
		Height = 351
		Name = "frm_optiuni"
		Width = 524
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 522
		_shape2.Height = 29
		_shape2.Left = 402
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 120
		Lb_titlu_alb_b121.Caption = "OPTIUNI"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 494
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

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

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

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Left = 299, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 2, ;
		Top = 52
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grid_opt' AS _grid WITH ;
		ColumnCount = 4, ;
		DeleteMark = .F., ;
		Height = 264, ;
		Left = 5, ;
		Name = "grid_opt", ;
		Panel = 1, ;
		RecordSource = "v_optiuni", ;
		RowHeight = 23, ;
		Top = 84, ;
		Width = 513, ;
		Column1.ControlSource = "varname", ;
		Column1.Name = "Column1", ;
		Column1.Width = 106, ;
		Column2.ControlSource = "vartype", ;
		Column2.Name = "Column2", ;
		Column2.Width = 70, ;
		Column3.ControlSource = "varvalue", ;
		Column3.Name = "Column3", ;
		Column3.Sparse = .F., ;
		Column3.Width = 157, ;
		Column4.ControlSource = "vardesc", ;
		Column4.Name = "Column4", ;
		Column4.Width = 145
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="grid" />

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

	ADD OBJECT 'grid_opt.Column1.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_opt.Column2.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tip data", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_opt.Column2.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_opt.Column3.Edit1' AS editbox WITH ;
		Height = 53, ;
		Left = 94, ;
		Name = "Edit1", ;
		Top = 23, ;
		Width = 100
		*< END OBJECT: BaseClass="editbox" />

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

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

	ADD OBJECT 'grid_opt.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 'lb_nom_opt' AS clb_tx_simplu WITH ;
		Left = 8, ;
		Name = "lb_nom_opt", ;
		TabIndex = 1, ;
		Top = 52, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Nume", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE actualizeaza_grid1
		LPARAMETERS pcFiltru
		LOCAL lcFiltru
		lcFiltru=pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru=popt.ca_baza1.cfiltru
		ENDIF
		save_grid_tag(thisform.grid_opt)
		popt.ca_baza1.cfiltru=lcFiltru
		popt.ca_baza1.afisare()
		restore_grid_tag(thisform.grid_opt)
		IF RECCOUNT('v_optiuni')>0
			thisform.grid_opt.SetFocus()
		ELSE
			thisform.lb_nom_opt.SetFocus()
		ENDIF
		
	ENDPROC

	PROCEDURE do_adauga
		SELECT v_optiuni
		SCATTER NAME loRec MEMO BLANK 
		PRIVATE lopt,poRec
		lopt=''
		poRec = loRec
		DO Adauga_Modifica_Inregistrare WITH "optiuni",loRec,,"INSERT",.t.,'lopt'
		lopt.cschema = this.cschema 
		lopt.show(1)
		RELEASE lopt,poRec
		this.actualizeaza_grid1()
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		lcFiltru=[]
		lcNume = STRTRAN(Upper(Alltrim(This.lb_nom_opt.text_simplu1.value)),['],[''])
		If !Empty(lcNume)
			lcFiltru=[varname like ']+lcNume+[%']
		ELSE 
			lcFiltru = [2=2]	
		Endif
		This.MousePointer= 11
		This.LockScreen=.T.
		Thisform.actualizeaza_grid1(lcFiltru)
		IF RECCOUNT()=0
			aMESSAGEBOX("Cautarea nu a intors rezultate!",0+64,"Info cautare")
		ENDIF
		This.LockScreen=.F.
		This.MousePointer= 0
	ENDPROC

	PROCEDURE do_modifica
		Select v_optiuni
		Scatter Name loRec MEMO 
		PRIVATE lopt,poRec
		lopt = ''
		poRec = loRec
		Do Adauga_Modifica_Inregistrare With "optiuni",loRec,loRec.Id_optiuni,"UPDATE",.t.,'lopt'
		lopt.cschema = this.cschema 
		lopt.show(1)
		RELEASE lopt,poRec
		thisform.actualizeaza_grid1()
	ENDPROC

	PROCEDURE do_sterge
		SELECT v_optiuni
		SCATTER NAME lorec MEMO 
		PRIVATE lopt 
		lopt = ''
		Do STERGE_INREGISTRARE With "optiuni",loRec.id_optiuni,.t.,'lopt'
		lopt.cschema = this.cschema 
		lopt.salvare(,loRec.id_optiuni)
		RELEASE lopt
		
		this.actualizeaza_grid1()
		
		
	ENDPROC

	PROCEDURE Unload
		IF USED('v_optiuni')
			USE IN v_optiuni
		ENDIF
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_optiuni_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="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cus_odata_optiuni1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_tx_simplu1" UniqueID="" Timestamp="" />

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

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 165
		Name = "frm_optiuni_nou"
		Width = 314
		_shape1.Name = "_shape1"
		_shape2.Height = 29
		_shape2.Left = 252
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 76
		Lb_titlu_alb_b121.Caption = "Optiuni"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 7
		BUT_TERMIN1.Left = 283
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 5
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

	ADD OBJECT 'Cb_tx_simplu1' AS cb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Cb_tx_simplu1", ;
		TabIndex = 2, ;
		Top = 72, ;
		_cbbase1.ControlSource = "porec.vartype", ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "CHARACTER,CURRENCY,NUMERIC,DATETIME,DATE,LOGICAL", ;
		_cbbase1.RowSourceType = 1, ;
		_lbbase1.Caption = "Tip data", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 1, ;
		Top = 44, ;
		Text_simplu1.ControlSource = "porec.varname", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Nume", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu3' AS clb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Clb_tx_simplu3", ;
		TabIndex = 3, ;
		Top = 100, ;
		Text_simplu1.ControlSource = "porec.varvalue", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Valoare", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu6' AS clb_tx_simplu WITH ;
		Left = 15, ;
		Name = "Clb_tx_simplu6", ;
		TabIndex = 4, ;
		Top = 128, ;
		Text_simplu1.ControlSource = "porec.vardesc", ;
		Text_simplu1.Format = "!K", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Descriere", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cus_odata_optiuni1' AS cus_odata_optiuni WITH ;
		Left = 144, ;
		Name = "Cus_odata_optiuni1", ;
		Top = 24
		*< END OBJECT: ClassLib="ooptiuni.vcx" BaseClass="custom" />
	
	PROCEDURE inainte_de_do_termin
		LOCAL PLRETURN
		
		lccontrol = UPPER(this.ActiveControl.BaseClass )
		IF   INLIST(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.Activecontrol.controlsource
			&lcval=thisform.ActiveControl.value
		ENDIF 	
		
		
		Do Case
		Case Empty(porec.varname)
			aMessagebox('Nu ati completat denumirea variabilei!',0+48,"Atentie")
			This.clb_tx_simplu1.SetFocus()
			plreturn=.F.
		
		Case Empty(porec.vartype)
			aMessagebox('Nu ati completat tipul de data!',0+48,"Atentie")
			This.CB_tx_simplu1.SetFocus()
			plreturn=.F.
		
		Case Empty(porec.varvalue)
			aMessagebox('Nu ati completat valoarea variabilei!',0+48,"Atentie")
			This.clb_tx_simplu5.SetFocus()
			plreturn=.F.
		
		OTHERWISE
			this.cus_odata_optiuni1.cschema=this.cschema 
			PLRETURN=This.cus_odata_optiuni1.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_optiuni1.cactiune = tcActiune
	ENDPROC

ENDDEFINE
