*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="ferestre_flux.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS frm_compensari 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="grdCompensari" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cNract.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cNract.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cDataact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cDataact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cSuma.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cSuma.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cScd.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cScd.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cScc.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cScc.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cPartd.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cPartd.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cPartc.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cPartc.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cPereched.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cPereched.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cPerechec.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cPerechec.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cAles.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cAles.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cAles.Check1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cExplicatia.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cExplicatia.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cExplicatia4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cExplicatia4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cExplicatia5.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdCompensari.cExplicatia5.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: totaluri
		*p: noldvalue
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 3
		DoCreate = .T.
		Height = 593
		Name = "frm_compensari"
		noldvalue = 0
		Width = 699
		_SHAPE1.Anchor = 10
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 750
		_SHAPE2.Anchor = 9
		_SHAPE2.Height = 29
		_SHAPE2.Left = 636
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 63
		LB_TITLU_ALB_B121.Caption = "COMPENSARI"
		LB_TITLU_ALB_B121.Height = 21
		LB_TITLU_ALB_B121.Left = 6
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.Top = 6
		LB_TITLU_ALB_B121.Width = 108
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 669
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		GRIDSORT1.Left = 528
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 8
	*</PropValue>

	ADD OBJECT 'But_excel2' AS but_excel WITH ;
		Anchor = 9, ;
		Left = 639, ;
		Name = "But_excel2", ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdCompensari' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 13, ;
		DeleteMark = .F., ;
		HeaderHeight = 32, ;
		Height = 515, ;
		HighlightStyle = 2, ;
		Left = 7, ;
		Name = "grdCompensari", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "crsCompensari", ;
		Top = 72, ;
		Width = 684, ;
		Column1.ControlSource = "nract", ;
		Column1.Name = "cNract", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 80, ;
		Column2.ControlSource = "TTOD(dataact)", ;
		Column2.Name = "cDataact", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 59, ;
		Column3.ColumnOrder = 5, ;
		Column3.ControlSource = "suma", ;
		Column3.Format = "]", ;
		Column3.InputMask = (get_mask(14,gnPa)), ;
		Column3.Name = "cSuma", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 71, ;
		Column4.ColumnOrder = 3, ;
		Column4.ControlSource = "scd", ;
		Column4.Name = "cScd", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 50, ;
		Column5.ColumnOrder = 4, ;
		Column5.ControlSource = "scc", ;
		Column5.Name = "cScc", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 51, ;
		Column6.ColumnOrder = 7, ;
		Column6.ControlSource = "partd", ;
		Column6.Name = "cPartd", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 150, ;
		Column7.ColumnOrder = 8, ;
		Column7.ControlSource = "partc", ;
		Column7.Name = "cPartc", ;
		Column7.ReadOnly = .T., ;
		Column7.Width = 153, ;
		Column8.ColumnOrder = 9, ;
		Column8.ControlSource = "pereched", ;
		Column8.Name = "cPereched", ;
		Column8.ReadOnly = .T., ;
		Column8.Width = 77, ;
		Column9.ColumnOrder = 10, ;
		Column9.ControlSource = "perechec", ;
		Column9.Name = "cPerechec", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 95, ;
		Column10.ColumnOrder = 6, ;
		Column10.ControlSource = "ales", ;
		Column10.CurrentControl = "Check1", ;
		Column10.Name = "cAles", ;
		Column10.ReadOnly = .F., ;
		Column10.Sparse = .F., ;
		Column10.Width = 28, ;
		Column11.ColumnOrder = 11, ;
		Column11.ControlSource = "explicatia", ;
		Column11.Name = "cExplicatia", ;
		Column11.ReadOnly = .T., ;
		Column11.Width = 157, ;
		Column12.ColumnOrder = 12, ;
		Column12.ControlSource = "explicatia4", ;
		Column12.Name = "cExplicatia4", ;
		Column12.ReadOnly = .T., ;
		Column12.Width = 142, ;
		Column13.ColumnOrder = 13, ;
		Column13.ControlSource = "explicatia5", ;
		Column13.Name = "cExplicatia5", ;
		Column13.ReadOnly = .T., ;
		Column13.Width = 166
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdCompensari.cAles.Check1' AS checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		Height = 17, ;
		Left = 4, ;
		Name = "Check1", ;
		ReadOnly = .F., ;
		Top = 47, ;
		Width = 60
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'grdCompensari.cAles.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Ales", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdCompensari.cDataact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data doc.", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdCompensari.cDataact.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 'grdCompensari.cExplicatia.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Explicatia", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdCompensari.cExplicatia4.Header1' AS header WITH ;
		Alignment = 2, ;
		BackColor = 212,208,200, ;
		Caption = "Explicatia 4", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdCompensari.cExplicatia5.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Explicatia 5", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

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

	ADD OBJECT 'grdCompensari.cNract.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 'grdCompensari.cPartc.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Partener credit", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdCompensari.cPartc.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 'grdCompensari.cPartd.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Partener debit", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdCompensari.cPartd.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 'grdCompensari.cPerechec.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Document incasat", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdCompensari.cPerechec.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 'grdCompensari.cPereched.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Document platit", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdCompensari.cPereched.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 'grdCompensari.cScc.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cont cred.", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdCompensari.cScc.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 'grdCompensari.cScd.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cont deb.", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdCompensari.cScd.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 'grdCompensari.cSuma.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Suma", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdCompensari.cSuma.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 'Gridextra1' AS gridextra WITH ;
		gridexpression = Thisform.grdCompensari, ;
		Left = 675, ;
		Name = "Gridextra1", ;
		Top = 47
		*< END OBJECT: ClassLib="..\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Label1' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Inregistari tip compensare care nu s-au luat in considerare in calculul fluxului de trezorerie", ;
		Height = 17, ;
		Left = 11, ;
		Name = "Label1", ;
		Top = 36, ;
		Width = 493
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Label2' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Bifati inregistrarile de tip compensari care constituie flux de numerar real !", ;
		FontBold = .T., ;
		Height = 17, ;
		Left = 11, ;
		Name = "Label2", ;
		Top = 52, ;
		Width = 424
		*< END OBJECT: BaseClass="label" />
	
	PROCEDURE grid_sort_bind
		* nu sterge
		* am inlocuit cu gridextras
	ENDPROC

	PROCEDURE inainte_de_do_excel
		Do export_excel with this.grdCompensari, this.lb_titlu_alb_b121.Caption
	ENDPROC

	PROCEDURE inainte_de_do_termin
		SELECT crsCompensari
		SET FILTER TO 
		DODEFAULT()
	ENDPROC

	PROCEDURE Init
		DoDefault()
		this.WindowState = 2 
		this.gridextra1.setup()
	ENDPROC

	PROCEDURE totaluri
	ENDPROC

	PROCEDURE grdCompensari.cSuma.Text1.LostFocus
		IF NVL(THIS.VALUE,0) <> NVL(THISFORM.nOldvalue,0)
			thisform.totaluri("suma") 
		ENDIF 
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_conturi_flux 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="grdConturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdConturi.cRand.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdConturi.cRand.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu2" UniqueID="" Timestamp="" />

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 291
		Name = "frm_conturi_flux"
		Width = 186
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE2.Name = "_SHAPE2"
		LB_TITLU_ALB_B121.Caption = ""
		LB_TITLU_ALB_B121.FontSize = 11
		LB_TITLU_ALB_B121.Left = 4
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 5
		LB_TITLU_ALB_B121.Top = 6
		BUT_TERMIN1.Left = 155
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Top = 1
		GRIDSORT1.Left = 4
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 65
	*</PropValue>

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

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

	ADD OBJECT 'grdConturi' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 1, ;
		DeleteMark = .F., ;
		Height = 147, ;
		Left = 6, ;
		Name = "grdConturi", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "cConturiFlux", ;
		ScrollBars = 2, ;
		TabIndex = 1, ;
		Top = 66, ;
		Width = 169, ;
		Column1.ControlSource = "cont", ;
		Column1.Name = "cRand", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 130
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		Alignment = 2, ;
		AutoSize = .F., ;
		Caption = "Conturi participante la Fluxul de Trezorerie", ;
		FontBold = .F., ;
		Height = 31, ;
		Left = 6, ;
		Name = "Lb_simplu1", ;
		TabIndex = 6, ;
		Top = 33, ;
		Width = 174, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu2' AS lb_simplu WITH ;
		Alignment = 0, ;
		AutoSize = .F., ;
		Caption = "Obs.: se iau in calcul toate conturile care au primele trei caractere din lista de conturi participante", ;
		FontBold = .F., ;
		FontSize = 10, ;
		Height = 68, ;
		Left = 4, ;
		Name = "Lb_simplu2", ;
		TabIndex = 7, ;
		Top = 221, ;
		Width = 174, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />
	
	PROCEDURE do_adauga
		Private poCauta
		poCauta = null
		
		lcFiltru = [1=2]
		lcSchema = []
		lcOrder = [cont,acont]
		lcColoane = [cont,explicatie]
		lcTitlu = [Alegeti Contul]
		lcTitluColoane = [Cont,Explicatie]
		lcSelect = [select explicatie, cont, id_plcont from vplcont_used]
		lcFiltruOriginal = [ tip_cont = 0 and inactiv = 0 and an = ] + Alltrim(Str(gnan))
		lcNumeProc = []
		llToateIreg = .F.
		lcPrimaColoana = [cont]
		poCauta = cauta_alfa(lcSelect, lcfiltru, lcschema, lcorder, lccoloane, lcTitlu, lcTitluColoane, lcNumeProc, llToateIreg, lcFiltruOriginal, lcPrimaColoana)
		If !Empty(poCauta.cont)
			lcSql = [begin pack_mg_flux.update_conturi(?poCauta.cont,0); end;]
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces < 0
				aMessageBox(goExecutor.cEroare,0+16,'Eroare')
			Else 	
				Insert into cConturiFlux (cont) values(Left(poCauta.cont,3))
			EndIf 	
		EndIf 	
		
		this.grdConturi.SetFocus()
	ENDPROC

	PROCEDURE do_sterge
		If aMessageBox('Doriti sa stergeti inregistrarea?',4+32,'Conturi') = 6
			pcCont = Alltrim(cConturiFlux.cont)
			lcSql = [begin pack_mg_flux.update_conturi(?pcCont,1); end;]
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces < 0
				aMessageBox(goExecutor.cEroare,0+16,'Eroare')
			Else 	
				Select cConturiFlux
				Delete
			EndIf 	
		EndIf 	
		this.grdConturi.SetFocus()
		this.grdConturi.Refresh()
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_flux 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="_grdrow1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cRand.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cRand.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cPrecedent.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cPrecedent.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cCurent.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cCurent.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: grid_column_bind
		*m: grid_column_lost_focus
		*m: grid_column_when
		*m: totaluri
		*p: cperioada1
		*p: cperioada2
		*p: lprecedent
		*p: noldvalue
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 3
		cperioada1 = 
		cperioada2 = 
		DoCreate = .T.
		Height = 593
		lprecedent = .F.
		Name = "frm_flux"
		noldvalue = 0
		Width = 699
		_SHAPE1.Anchor = 10
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 750
		_SHAPE2.Anchor = 9
		_SHAPE2.Height = 29
		_SHAPE2.Left = 610
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 89
		LB_TITLU_ALB_B121.Caption = "SITUATIA FLUXURILOR DE TREZORERIE - METODA DIRECTA"
		LB_TITLU_ALB_B121.Height = 21
		LB_TITLU_ALB_B121.Left = 6
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.Top = 6
		LB_TITLU_ALB_B121.Width = 456
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 669
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		GRIDSORT1.Left = 528
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 8
	*</PropValue>

	ADD OBJECT '_grdrow1' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 4, ;
		DeleteMark = .F., ;
		Height = 552, ;
		Left = 7, ;
		Name = "_grdrow1", ;
		Panel = 1, ;
		RecordSource = "cFlux", ;
		Top = 35, ;
		Width = 684, ;
		Column1.ControlSource = "rand", ;
		Column1.Name = "cRand", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 41, ;
		Column2.ControlSource = "denumire", ;
		Column2.Name = "cDenumire", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 423, ;
		Column3.ControlSource = "precedent", ;
		Column3.Format = "RK", ;
		Column3.InputMask = (get_mask(14,gnPa)), ;
		Column3.Name = "cPrecedent", ;
		Column3.Width = 97, ;
		Column4.ControlSource = "curent", ;
		Column4.Format = "RK", ;
		Column4.InputMask = (get_mask(14,gnPa)), ;
		Column4.Name = "cCurent", ;
		Column4.Width = 89
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT '_grdrow1.cCurent.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Curent", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT '_grdrow1.cCurent.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT '_grdrow1.cDenumire.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Denumire", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.cPrecedent.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Precedent", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT '_grdrow1.cPrecedent.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT '_grdrow1.cRand.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Rand", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'But_excel1' AS but_excel WITH ;
		Anchor = 9, ;
		Left = 639, ;
		Name = "But_excel1", ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 9, ;
		Left = 610, ;
		Name = "But_listare1", ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />
	
	PROCEDURE grid_column_bind
		Local lnColumnCount, loTextBox, i
		
		lnColumnCount = This._grdrow1.ColumnCount 
		For i = 3 To lnColumnCount
			loTextBox = This._grdrow1.Columns(i).Text1
			Bindevent(loTextBox, "When", This, "grid_column_when")
			Bindevent(loTextBox, "LostFocus", This, "grid_column_lost_focus")
		Endfor
		 
	ENDPROC

	PROCEDURE grid_column_lost_focus
		Local laEvents[1], loTextBox
		
		Aevents( laEvents, 0 )
		loTextBox = laEvents[ 1 ]
		If Vartype( loTextBox ) = 'O'
			If Nvl(loTextBox.Value,0) <> Nvl(Thisform.nOldvalue,0)
				Thisform.totaluri(loTextBox.controlsource)
			Endif
		Endif
		
		
		
		 
	ENDPROC

	PROCEDURE grid_column_when
		Local laEvents[1], loTextBox
		IF INLIST(cflux.tip,0,5) && TITLU, TOTAL
			RETURN .F.
		ENDIF 
		Aevents( laEvents, 0 )
		loTextBox = laEvents[ 1 ]
		If Vartype( loTextBox ) = 'O'
			thisform.nOldvalue = loTextBox.Value 
		Endif 
	ENDPROC

	PROCEDURE inainte_de_do_excel
		thisform.AlwaysOnTop= .F.
		
		LOCAL lctabel , llTip
		lctabel = thisform._grdrow1.RecordSource 
		llTip = !this.lDefalcat && .T. = precedent, curent; .F. = 01/2011, 02/2011...
		SELECT (lcTabel)
		DO lanseaza_excel_flux WITH (lctabel), llTip, this._grdrow1
		
		thisform.AlwaysOnTop = .T.
	ENDPROC

	PROCEDURE inainte_de_do_listare
		Local lcTabel,lnCodOper
		Private pcTitlu, plPrecedent, pcPrecedent, pcCurent, pcDataOra, pcAdministrator, pcIntocmit, pcCalitate
		lnCodOper = 0
		pcTitlu = "SITUATIA FLUXURILOR DE TREZORERIE"
		pcPrecedent = this.cPerioada1 
		pcCurent = this.cPerioada2
		plPrecedent = this.lPrecedent 
		pcAdministrator = []
		pcIntocmit = []
		*!*	pcCalitate = [CALITATE]
		
		&& pcDataora = get_ora(2)
		lcTabel = Thisform._grdrow1.RecordSource
		
		*!* 07.03.2011
		IF gcAppName = 'ROASITFIN'
			*!*	modificare	v 2.0.8
			lcDir = Addbs(Alltrim(gcDirExpBil_tabele)) + Addbs(Alltrim(gofirma.firma))
			If Directory(lcDir)
				lcFisUnitate = lcDir + "Unitate.dbf"
				If File(lcFisUnitate)
					Use (lcFisUnitate) In 0 Alias unitate
					Select unitate
					pcAdministrator = Nvl(adminf,[])
					pcIntocmit = Nvl(intocmitf,[])
					lnCodOper = cod_oper
					Use In unitate
				Endif
			Endif
		ENDIF && gcAppName
		*!* 07.03.2011 ^
		*!*	If !Empty(lnCodOper)
		*!*		lcSql = [select calintoc from sitfin_calIntoc where id=] + Alltrim(Str(lnCodOper))
		*!*		lnSucces = goExecutor.oExecute(lcSql,'crsCalIntoc')
		*!*		If lnSucces < 0
		*!*			amessagebox(goExecutor.cEroare,16,"Eroare")
		*!*		Else
		*!*			If Reccount('crsCalIntoc')>0
		*!*				Select crsCalIntoc
		*!*				pcCalitate = Alltrim(calintoc)
		*!*			Endif
		*!*			Use In crsCalIntoc
		*!*		Endif
		*!*	Endif
		*!*	modificare	v 2.0.8	^
		
		Thisform.AlwaysOnTop = .F.
		goExport.export2frx(lcTabel, [flux_trezorerie_met_dir], .T., , , , , .T.)    
		Thisform.AlwaysOnTop = .T.
		Release pcTitlu, plPrecedent, pcPrecedent, pcCurent, pcDataOra, pcAdministrator, pcIntocmit, pcCalitate
	ENDPROC

	PROCEDURE Init
		Lparameters tlPrecedent, tcPerioada1, tcPerioada2
		
		this.cPerioada1 = Iif(Type('tcPerioada1') = 'C', tcPerioada1, '')
		this.cPerioada2 = Iif(Type('tcPerioada2') = 'C', tcPerioada2, '')
		this.lPrecedent = tlPrecedent
		this.WindowState = 2
		DoDefault()
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		
		Local lcColoana, lnColumnCount, i
		lnColumnCount = This._grdrow1.ColumnCount 
		For i = 3 To lnColumnCount
			lcColoana = this._grdrow1.Columns(i).controlsource
			thisform.totaluri(lcColoana) 
		ENDFOR  
		THIS.but_listare1.Visible = !this.lDefalcat
		this._grdrow1.SetAll("DynamicBackColor", "IIF(INLIST(tip,0,5), RGB(200,200,200), RGB(255,255,255))", "Column")
	ENDPROC

	PROCEDURE totaluri
		Lparameters tcColoana
		Local lcFormula, lcColoana, lcTabel, lnSuma, lnId_ind, lcRand  
		
		If Empty(tcColoana)
			lcColoana = "curent"
		Else
			lcColoana = Alltrim(tcColoana)
		Endif
		*!* 05.05.2011
		lcColoana = SUBSTR(lcColoana, AT('.', lcColoana) + 1) && cflux.curent => curent
			*!* 05.05.2011 ^
		lcTabel = thisform._grdrow1.RecordSource 
		Select * From (lcTabel) WITH (BUFFERING = .T.) Into Cursor cTemp Readwrite NOFILTER 
		
		Select cTemp
		Scan For tip = 5
			lnSuma = 0
			lcFormula = Alltrim(cTemp.formula)
			lcRand = rand
		
			lnSuma = calc_indicatori_randuri(lcFormula, "cTemp",lcColoana)
			Select cTemp
			Replace &lcColoana With lnSuma
			Select (lcTabel)
			Update (lcTabel) Set &lcColoana = lnSuma Where rand = lcRand 
		
			Select cTemp
		Endscan
		Use In cTemp
		
		
		
	ENDPROC

	PROCEDURE _grdrow1.Init
		this.SetAll("DynamicBackColor","IIF(tip=5,RGB(230,244,255),RGB(255,255,255))", "Column")
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_formule 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_randuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_randuri.cRand.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_randuri.cRand.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_randuri.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_randuri.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_formule" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_formule.cTip.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_formule.cTip.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_formule.cComentariu.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_formule.cComentariu.Edit1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="edtDebit" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="edtCredit" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cboTip" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtCont" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtFTotal" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: refresh_edit
		*p: ccont
		*p: ccredit
		*p: cdebit
		*p: ftotal		&& formula total
		*p: leditare
		*p: ltotal
		*p: ntip
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 3
		ccont = 
		ccredit = 
		cdebit = 
		DoCreate = .T.
		ftotal = 
		Height = 501
		leditare = .F.
		ltotal = .F.
		Name = "frm_formule"
		ntip = 1
		Width = 759
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 780
		_shape2.Height = 29
		_shape2.Left = 697
		_shape2.Name = "_shape2"
		_shape2.Top = -1
		_shape2.Width = 63
		Lb_titlu_alb_b121.Caption = "Flux de trezorerie - Formule"
		Lb_titlu_alb_b121.Left = 6
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 11
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 729
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 8
		BUT_TERMIN1.Top = 0
		Gridsort1.Left = 228
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 7
	*</PropValue>

	ADD OBJECT '_label1' AS _label WITH ;
		Anchor = 12, ;
		BackStyle = 0, ;
		Caption = "Debit", ;
		FontBold = .T., ;
		Left = 372, ;
		Name = "_label1", ;
		TabIndex = 12, ;
		Top = 318
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label2' AS _label WITH ;
		Anchor = 12, ;
		BackStyle = 0, ;
		Caption = "Credit", ;
		FontBold = .T., ;
		Left = 372, ;
		Name = "_label2", ;
		TabIndex = 13, ;
		Top = 376
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label3' AS _label WITH ;
		Anchor = 12, ;
		BackStyle = 0, ;
		Caption = "Total", ;
		FontBold = .T., ;
		Left = 372, ;
		Name = "_label3", ;
		TabIndex = 14, ;
		Top = 420
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label4' AS _label WITH ;
		Anchor = 12, ;
		BackStyle = 0, ;
		Caption = "Cont", ;
		FontBold = .T., ;
		Left = 372, ;
		Name = "_label4", ;
		TabIndex = 15, ;
		Top = 275
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label5' AS _label WITH ;
		Anchor = 12, ;
		BackStyle = 0, ;
		Caption = "Tip", ;
		FontBold = .T., ;
		Left = 372, ;
		Name = "_label5", ;
		TabIndex = 16, ;
		Top = 248
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 9, ;
		Left = 698, ;
		Name = "But_listare1", ;
		TabIndex = 9, ;
		Top = 0
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		Anchor = 9, ;
		Left = 669, ;
		Name = "But_modifica1", ;
		TabIndex = 10, ;
		Top = 0
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cboTip' AS _combobox WITH ;
		Anchor = 12, ;
		Enabled = .F., ;
		Height = 24, ;
		Left = 408, ;
		Name = "cboTip", ;
		RowSource = "0 - Titlu,1 - Incasari/plati repartizate conform formulei,2 - Incasari/plati ale caror documente pereche sunt repartizate conform formulei,5 - Totaluri ", ;
		RowSourceType = 1, ;
		TabIndex = 3, ;
		Top = 248, ;
		Width = 347
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="combobox" />

	ADD OBJECT 'edtCredit' AS _editbox WITH ;
		Anchor = 12, ;
		ControlSource = "thisform.cCredit", ;
		Left = 408, ;
		Name = "edtCredit", ;
		ReadOnly = .T., ;
		TabIndex = 6, ;
		Top = 356, ;
		Width = 347
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="editbox" />

	ADD OBJECT 'edtDebit' AS _editbox WITH ;
		Anchor = 12, ;
		ControlSource = "thisform.cDebit", ;
		Height = 53, ;
		Left = 408, ;
		Name = "edtDebit", ;
		ReadOnly = .T., ;
		TabIndex = 5, ;
		Top = 299, ;
		Width = 347
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="editbox" />

	ADD OBJECT 'grid_formule' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 204, ;
		Left = 361, ;
		Name = "grid_formule", ;
		Panel = 1, ;
		RecordSource = "cFluxCopil", ;
		RowHeight = 55, ;
		TabIndex = 2, ;
		Top = 36, ;
		Width = 392, ;
		Column1.ControlSource = "tip", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cTip", ;
		Column1.Width = 31, ;
		Column2.ControlSource = "comentariu", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cComentariu", ;
		Column2.Sparse = .F., ;
		Column2.Width = 326
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grid_formule.cComentariu.Edit1' AS editbox WITH ;
		Height = 53, ;
		Left = 25, ;
		Name = "Edit1", ;
		Top = 35, ;
		Width = 100
		*< END OBJECT: BaseClass="editbox" />

	ADD OBJECT 'grid_formule.cComentariu.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Comentariu", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_formule.cTip.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tip", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_formule.cTip.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_randuri' AS _grdrow WITH ;
		Anchor = 5, ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 455, ;
		Left = 6, ;
		Name = "grid_randuri", ;
		Panel = 1, ;
		RecordSource = "cFluxParinte", ;
		TabIndex = 1, ;
		Top = 36, ;
		Width = 348, ;
		Column1.ControlSource = "rand", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cRand", ;
		Column1.Width = 29, ;
		Column2.ControlSource = "denumire", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDenumire", ;
		Column2.Width = 284
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grid_randuri.cDenumire.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Denumire", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_randuri.cDenumire.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grid_randuri.cRand.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Rand", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_randuri.cRand.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtCont' AS _textbox WITH ;
		Anchor = 12, ;
		ControlSource = "thisform.cCont", ;
		Format = "K", ;
		Height = 23, ;
		InputMask = "9999", ;
		Left = 408, ;
		Name = "txtCont", ;
		ReadOnly = .T., ;
		TabIndex = 4, ;
		Top = 273, ;
		Width = 72
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtFTotal' AS _textbox WITH ;
		Anchor = 12, ;
		ControlSource = "thisform.FTotal", ;
		Format = "!K", ;
		Height = 23, ;
		Left = 408, ;
		Name = "txtFTotal", ;
		ReadOnly = .T., ;
		TabIndex = 7, ;
		Top = 417, ;
		Width = 347
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE do_modifica
		Lparameters tlNuModifica
		&& tlNuModifica - daca se schimba randul fara sa apas salvare, nu salvez modificarile
		Local lcSelect
		lcSelect = Select()
		Private poRec
		poRec = Null
		
		If !This.lEditare
			This.lEditare = .T.
			This.but_modifica1.cpicturedown = 'save_jos.bmp'
			This.but_modifica1.cpictureup = 'save_sus.bmp'
			This.but_modifica1.Picture = This.but_modifica1.cpictureup
			This.cboTip.Enabled = .T.
			This.txtCont.ReadOnly = .F.
			This.edtDebit.ReadOnly = .F.
			This.edtCredit.ReadOnly = .F.
			This.txtFTotal.ReadOnly = .F.
			This.but_modifica1.Refresh()
			This.txtCont.SetFocus()
		Else
			This.lEditare = .F.
			This.but_modifica1.cpicturedown = 'modific_jos.bmp'
			This.but_modifica1.cpictureup = 'modific_sus.bmp'
			This.but_modifica1.Picture = This.but_modifica1.cpictureup
			This.cboTip.Enabled = .F.
			This.txtCont.ReadOnly = .T.
			This.edtDebit.ReadOnly = .T.
			This.edtCredit.ReadOnly = .T.
			This.txtFTotal.ReadOnly = .T.
		
		
			If !tlNuModifica
				Select cFluxCopil
				Scatter Name poRec Memo
				With poRec
					.Tip = This.nTip
					.Cont = Alltrim(This.cCont)
					.Debit = Alltrim(This.cDebit)
					.Credit = Alltrim(This.cCredit)
					.Total = Iif(!Empty(Nvl(This.ftotal,'')), 1, 0)
					.ftotal = Rtrim(Nvl(This.ftotal,''))
					.denumire = Rtrim(cFluxCopil.denumire)
					.Rand = Rtrim(cFluxCopil.Rand)
					.comentariu = FormulaFlux2Comentariu(.Debit,'D',.Tip,.Cont,.Total,.ftotal) + Iif(!Empty(.Credit), " " + FormulaFlux2Comentariu(.Credit,'C',.Tip,.Cont,0,""), "")
					*!*			pnIdRand = cfluxcopil.id_rand
					*!*			pcRand = Alltrim(cfluxcopil.rand)
					*!*			pcDenumire = Alltrim(cfluxcopil.denumire)
					*!*			pcComentariu = Alltrim(cfluxcopil.comentariu)
					*!*			pnModel = cfluxcopil.model
				Endwith
		
				lcSql = [begin pack_mg_flux.update_formule(?.id_rand, ?.rand, ?.denumire, ?.tip, ?.cont, ?.debit, ?.credit, ?.ftotal, ?.total, ?.comentariu, ?.model); end;]
				With poRec
					lnSucces = goExecutor.oExecute(lcSql)
				Endwith
				If lnSucces < 0
					aMessageBox(goExecutor.cEroare, 0+16, 'Eroare')
				Else
					Select cFluxCopil
					Gather Name poRec Memo
					Update cFormule Set Tip = poRec.Tip, Cont = poRec.Cont, Debit = poRec.Debit, Credit = poRec.Credit, ;
						ftotal = poRec.ftotal, comentariu = poRec.comentariu ;
						where id_Rand = poRec.id_Rand
		
				Endif
			Endif
		Endif
		
		Select (lcSelect)
		
	ENDPROC

	PROCEDURE inainte_de_do_listare
		Thisform.AlwaysOnTop = .F.
		*!*	SELECT cFormule
		*!*	REPORT FORM formuleFlux.frx TO PRINTER PROMPT PREVIEW
		goExport.export2frx([cFormule],[formuleFlux])
		Thisform.AlwaysOnTop = .T.
		
	ENDPROC

	PROCEDURE refresh_edit
		With Thisform
			.nTip = cFluxCopil.tip
			.cCont = Alltrim(cFluxCopil.Cont)
			.cDebit = Alltrim(cFluxCopil.debit)
			.cCredit = Alltrim(cFluxCopil.credit)
			.lTotal = Nvl(cFluxCopil.Total,0) = 1
			.FTotal = Alltrim(Nvl(cFluxCopil.ftotal,''))
			
			.cboTip.Refresh()
			.txtCont.Refresh()
			.edtDebit.Refresh()
			.edtCredit.Refresh()
			.txtFTotal.Refresh()
		EndWith
	ENDPROC

	PROCEDURE cboTip.Refresh
		Do Case
			Case Thisform.nTip = 0
				This.ListIndex = 1
			Case Thisform.nTip = 1
				This.ListIndex = 2
			Case Thisform.nTip = 2
				This.ListIndex = 3
			Otherwise
				This.ListIndex = 4
		Endcase
		
		
	ENDPROC

	PROCEDURE cboTip.Valid
		Do case 
			Case this.ListIndex = 1
				thisform.nTip = 0
			Case this.ListIndex = 2
				thisform.nTip = 1
			Case this.ListIndex = 3
				thisform.nTip = 2
			Otherwise 
				thisform.nTip = 5	
		EndCase 
		
	ENDPROC

	PROCEDURE grid_formule.AfterRowColChange
		Lparameters nColIndex
		DoDefault()
		thisform.refresh_edit()
		If thisform.lEditare
			thisform.do_modifica(.T.)
		EndIf 
	ENDPROC

	PROCEDURE grid_randuri.AfterRowColChange
		LPARAMETERS nColIndex
		DoDefault()
		thisform.refresh_edit()
		If thisform.lEditare
			thisform.do_modifica(.T.)
		EndIf 
	ENDPROC

ENDDEFINE
