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

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

ENDDEFINE

DEFINE CLASS frm_termin_renunt1 AS frm_termin_renunt OF "..\comun\clase\_frm_child.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Op_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_luna_intre1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_txbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkConturiCorespondente" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_optiongrup1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Check1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkDocumenteSold" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkLucrari" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: acont
		*p: acontexp
		*p: ccont
		*p: ccursoracont
		*p: ccursorcont
		*p: id_part
		*p: tip_sold
	*</DefinedPropArrayMethod>

	*<PropValue>
		acont = 
		acontexp = 
		BorderStyle = 1
		ccont = 
		ccursoracont = 
		ccursorcont = 
		DoCreate = .T.
		Height = 245
		id_part = 0
		Name = "Frm_termin_renunt1"
		tip_sold = 0
		Width = 500
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 500
		_shape2.Height = 29
		_shape2.Left = 438
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 62
		Lb_titlu_alb_b121.Caption = "Fisa cont"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 13
		BUT_TERMIN1.Left = 469
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 11
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
		But_renunt1.Left = 440
		But_renunt1.Name = "But_renunt1"
		But_renunt1.TabIndex = 12
		But_renunt1.Top = 1
	*</PropValue>

	ADD OBJECT '_optiongrup1' AS _optiongrup WITH ;
		AutoSize = .F., ;
		ButtonCount = 2, ;
		ControlSource = "pnOptiune", ;
		Height = 46, ;
		Left = 236, ;
		Name = "_optiongrup1", ;
		TabIndex = 6, ;
		Top = 136, ;
		Width = 256, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Rulaje precedente ptr. prima luna", ;
		Option1.FontSize = 10, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Sold precedent ptr. prima luna", ;
		Option2.FontSize = 10, ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_txbase1' AS _txbase WITH ;
		ControlSource = "thisform.acontexp", ;
		Height = 23, ;
		Left = 144, ;
		Name = "_txbase1", ;
		ReadOnly = .T., ;
		TabIndex = 2, ;
		Top = 38, ;
		Width = 348
		*< END OBJECT: ClassLib="..\comun\clase\_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'Check1' AS checkbox WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Export in Excel", ;
		ControlSource = "plExcel", ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 376, ;
		Name = "Check1", ;
		TabIndex = 10, ;
		Top = 192, ;
		Width = 108
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'chkConturiCorespondente' AS checkbox WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Defalcare pe conturi corespondente", ;
		ControlSource = "xrec.conturicorespondente", ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 12, ;
		Name = "chkConturiCorespondente", ;
		TabIndex = 7, ;
		Top = 192, ;
		Width = 223
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'chkDocumenteSold' AS checkbox WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Se afiseaza soldul pe documente", ;
		ControlSource = "xrec.documentesold", ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 12, ;
		Name = "chkDocumenteSold", ;
		TabIndex = 9, ;
		Top = 207, ;
		Visible = .F., ;
		Width = 211
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'chkLucrari' AS checkbox WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Defalcare pe lucrari", ;
		ControlSource = "xrec.lucrari", ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 12, ;
		Name = "chkLucrari", ;
		TabIndex = 8, ;
		Top = 223, ;
		Width = 130
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'Clb_luna_intre1' AS clb_luna_intre WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_luna_intre1", ;
		TabIndex = 4, ;
		Top = 101, ;
		Width = 480, ;
		tx_n1.Left = 212, ;
		tx_n1.Name = "tx_n1", ;
		tx_n1.SpecialEffect = 1, ;
		tx_n1.Top = 3, ;
		Lb_simplu1.Caption = "Perioada de referinta", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		tx_n2.Left = 327, ;
		tx_n2.Name = "tx_n2", ;
		tx_n2.SpecialEffect = 1, ;
		tx_n2.Top = 3
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 1, ;
		Top = 37, ;
		Width = 124, ;
		Text_simplu1.BorderStyle = 1, ;
		Text_simplu1.ControlSource = "thisform.ccont", ;
		Text_simplu1.DisabledBackColor = 255,255,255, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 61, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.SpecialEffect = 1, ;
		Text_simplu1.TabIndex = 2, ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 59, ;
		Lb_simplu1.Caption = "Cont", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.TabIndex = 1
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu2' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 145, ;
		Name = "Clb_tx_simplu2", ;
		TabIndex = 3, ;
		Top = 69, ;
		Width = 347, ;
		Text_simplu1.DisabledBackColor = 255,255,255, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 71, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 271, ;
		Lb_simplu1.Caption = "Partener", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Op_tx_simplu1' AS op_tx_simplu WITH ;
		Height = 51, ;
		Left = 12, ;
		Name = "Op_tx_simplu1", ;
		TabIndex = 5, ;
		TabStop = .F., ;
		Top = 134, ;
		Width = 215, ;
		Lb_simplu1.Caption = "Contul este considerat", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		_optiongrup1.Left = 142, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.Option1.Caption = "Activ", ;
		_optiongrup1.Option1.Left = 5, ;
		_optiongrup1.Option1.Name = "Option1", ;
		_optiongrup1.Option1.Top = 5, ;
		_optiongrup1.Option2.Caption = "Pasiv", ;
		_optiongrup1.Option2.Left = 5, ;
		_optiongrup1.Option2.Name = "Option2", ;
		_optiongrup1.Option2.Top = 24, ;
		_optiongrup1.Top = 3
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE Destroy
		*!*	lcCursorAcont = ALLTRIM(thisform.cCursorAcont) 
		*!*	lcCursorCont = ALLTRIM(thisform.cCursorCont) 
		*!*	modificare v 2.0.125
		*!*	If thisform.check1.Value#0
		*!*		plexcel = .t.
		*!*	EndIf
		*!*	modificare v 2.0.125	^
		*!*	IF USED(lcCursorCont)
		*!*		USE IN (lcCursorCont)
		*!*	ENDIF 	
		
		*!*	IF USED(lcCursorAcont)
		*!*		USE IN (lcCursorAcont)
		*!*	ENDIF 
	ENDPROC

	PROCEDURE chkConturiCorespondente.Valid
		Local llVisible
		llVisible = (This.Value = .F.)
		
		xrec.DocumenteSold = .F.
		Thisform.chkDocumenteSold.Refresh()
		Thisform.chkDocumenteSold.Visible = m.llVisible
	ENDPROC

	PROCEDURE Clb_luna_intre1.LostFocus
		
		lcdatai = this.tx_n1.Value 
		lcdataf = this.tx_n2.Value 
		
		IF !EMPTY(lcdatai) AND !EMPTY(lcdataf)
			xrec.lunai = ALLTRIM(STR(VAL(LEFT(lcdatai,2))))
			xrec.lunaf = ALLTRIM(STR(VAL(LEFT(lcdataf,2))))
			xrec.ani = RIGHT(lcdatai,4)
			xrec.anf = RIGHT(lcdataf,4)
			IF VAL(xrec.ani)*12+VAL(xrec.lunai)>VAL(xrec.anf)*12+VAL(xrec.lunaf)
				aMESSAGEBOX('Luna initiala nu poate fi mai mare decat cea finala!',16,'Atentie!')
				RETURN 
			ENDIF 
			IF VAL(xrec.anf)*12+VAL(xrec.lunaf)>gnan*12+gnluna
				aMESSAGEBOX('Nu puteti selecta ca perioada finala o luna mai mare decat luna curenta!',16,'Atentie!')
				RETURN 
			ENDIF 		
		ENDIF 	
		
	ENDPROC

	PROCEDURE Clb_tx_simplu1.Text_simplu1.GotFocus
		*!* 28.02.2012
		*!* marius.mutu
		*!* la alegerea contului, nu mai apar toate inregistrarile.
		*!* daca doresc toate conturile apas renunt sau terminat fara cautare
		
		*!* 11.07.2018
		*!* marius.mutu
		*!* salvez denumirea contului
		
		oCont = caut_cont(,,.F.) && fara toate inregistrarile
		This.Value = oCont.Cont
		Thisform.cCont = oCont.Cont
		xrec.cont=thisform.ccont
		xrec.acont=NVL(thisform.acont,'')
		xrec.dencont = Alltrim(oCont.explicatie)
		
		Thisform.tip_sold=oCont.tip_sold
		Thisform.acont=Nvl(oCont.acont,'')
		If Thisform.acont<>''
			Thisform.acontexp=Alltrim(Thisform.acont) +'-'+ Alltrim(oCont.explicatie)
		Else
			Thisform.acontexp=''+ Alltrim(oCont.explicatie)
		Endif
		Thisform._txbase1.Refresh
		If !Empty(Thisform.cCont)
			Do Case
				Case  Upper(Alltrim(Thisform.tip_sold))='A'
					Thisform.op_tx_simplu1._optiongrup1.Value=1
					xrec.Activ = 'A'
				Case Upper(Alltrim(Thisform.tip_sold))='P'
					Thisform.op_tx_simplu1._optiongrup1.Value=2
					xrec.Activ = 'P'
				Otherwise
					Thisform.op_tx_simplu1._optiongrup1.Value=1
					xrec.Activ = 'A'
			Endcase
		Endif
		Thisform.op_tx_simplu1.Refresh
		
	ENDPROC

	PROCEDURE Clb_tx_simplu1.Text_simplu1.Valid
		If !Empty(Thisform.acont)
			xrec.acont = Alltrim(Thisform.acont)
		Endif
		
		
		
		*!*	Local lcCont, lnSucces, lcCursorCont, lcCursorAcont
		*!*	lcCursorCont = ""
		*!*	lcCursorAcont = ""
		*!*	lnSucces = 1
		*!*	If Alltrim(This.Value) = "<TOATE INREGISTRARILE>"
		*!*		lcCont = ""
		*!*	Else
		*!*		lcCont = Alltrim(This.Value)
		*!*	Endif
		
		*!*	*!*	IF EMPTY(lcCont)
		*!*	*!*		lnSucces = -1
		*!*	*!*	ELSE
		*!*	lcCursorCont = update_plcont(lcCont, gnAn) && updateserver.prg
		*!*	If Empty(lcCursorCont)
		*!*		lnSucces = -1
		*!*	Else
		*!*		Thisform.cCursorcont = Alltrim(lcCursorCont)
		
		*!*		Select (lcCursorCont)
		*!*		If Reccount() = 0
		*!*			aMESSAGEBOX('Contul ' + lcCont + ' nu este introdus in planul de conturi!',16,'Atentie!')
		*!*			lnSucces = -1
		*!*		Endif
		
		*!*		Thisform.cb_tx_simplu1._cbbase1.RowSource=''
		*!*		lcCursorAcont = update_plAcont(lcCont, gnAn) && updateserver.prg
		*!*		Thisform.cCursorAcont = Alltrim(lcCursorAcont)
		*!*	Endif
		*!*	*!*	ENDIF
		
		*!*	If lnSucces = -1
		*!*		Return
		*!*	Endif
		
		*!*	xrec.Cont = lcCont
		*!*	If !Empty(lcCont)
		*!*		Select (lcCursorCont)
		*!*		Go Top
		
		
		
		*!*		Do Case
		*!*		Case  Upper(Alltrim(thisform.tip_sold))='A'
		*!*			Thisform.op_tx_simplu1._optiongrup1.Value=1
		*!*			xrec.Activ = 'A'
		*!*		Case Upper(Alltrim(tip_sold))='P'
		*!*			Thisform.op_tx_simplu1._optiongrup1.Value=2
		*!*			xrec.Activ = 'P'
		*!*		Otherwise
		*!*			Thisform.op_tx_simplu1._optiongrup1.Value=1
		*!*			xrec.Activ = 'A'
		*!*		Endcase
		******************** 25.02.09
		
		********************* 25.02.09
		
		
		
		*!*		Thisform.op_tx_simplu1.Visible= .T.
		*!*		Thisform.op_tx_simplu1.Refresh
		*!*	Else
		*!*		Thisform.op_tx_simplu1.Visible= .F.
		*!*	Endif
		
		*!*	With Thisform.cb_tx_simplu1._cbbase1
		*!*		.RowSourceType= 2
		*!*		.RowSource = lcCursorAcont + '.denumire,acont'
		*!*		.BoundColumn=2
		*!*		.BoundTo = .T.
		*!*		Select (lcCursorAcont)
		*!*		Locate For Alltrim(acont) = '-1'
		*!*		If Found()
		*!*			.Value = acont
		*!*			.Refresh
		*!*		Endif
		
		*!*	Endwith
		
		
		
	ENDPROC

	PROCEDURE Clb_tx_simplu2.Text_simplu1.GotFocus
		* 10.01.2022
		* nu mai arat partenerii inactivi
		
		LOCAL lcCont, llToate , llInactiv, llNou
		llToate = .F.
		llNou = .F.
		llInactiv = .F. && arat si partenerii inactivi (pote sunt proveniti din parteneri unificati)
		
		If Thisform.cCont = "<TOATE INREGISTRARILE>"
			lcCont = ""
			llToate = .F.
		Else
			lcCont = Thisform.cCont
			llToate = .T.
		ENDIF
		
		oPart = caut_parteneri(lcCont, "Caut partener", m.llToate, m.llNou, m.llInactiv)
		
		This.Value = oPart.denumire
		Thisform.id_part=oPart.id_part
		If !Empty(Thisform.id_part)
			xrec.id_part = Alltrim(Str(Thisform.id_part))
			xrec.numepart = Upper(Alltrim(oPart.denumire))
		Endif
		
	ENDPROC

	PROCEDURE Op_tx_simplu1.LostFocus
		IF this._optiongrup1.Value = 1
			xrec.activ = 'A'
		ELSE 
			xrec.activ = 'P'
		ENDIF 		
	ENDPROC

	PROCEDURE _txbase1.Valid
		
		
	ENDPROC

ENDDEFINE
