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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Shape1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Line1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Line2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Line3" UniqueID="" Timestamp="" />

	*<PropValue>
		BackColor = 255,255,255
		Height = 20
		Name = "ct"
		Width = 52
	*</PropValue>

	ADD OBJECT 'Line1' AS line WITH ;
		BorderColor = 128,128,128, ;
		BorderStyle = 2, ;
		Height = 36, ;
		Left = 12, ;
		Name = "Line1", ;
		Top = -9, ;
		Width = 0
		*< END OBJECT: BaseClass="line" />

	ADD OBJECT 'Line2' AS line WITH ;
		BorderColor = 128,128,128, ;
		BorderStyle = 2, ;
		Height = 36, ;
		Left = 25, ;
		Name = "Line2", ;
		Top = -9, ;
		Width = 0
		*< END OBJECT: BaseClass="line" />

	ADD OBJECT 'Line3' AS line WITH ;
		BorderColor = 128,128,128, ;
		BorderStyle = 2, ;
		Height = 36, ;
		Left = 38, ;
		Name = "Line3", ;
		Top = -9, ;
		Width = 0
		*< END OBJECT: BaseClass="line" />

	ADD OBJECT 'Shape1' AS shape WITH ;
		BackStyle = 0, ;
		Height = 23, ;
		Left = 0, ;
		Name = "Shape1", ;
		Top = 0, ;
		Width = 53
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'Text1' AS _textbox WITH ;
		BackStyle = 1, ;
		BorderStyle = 0, ;
		Format = "K", ;
		Height = 21, ;
		Left = 1, ;
		Name = "Text1", ;
		SpecialEffect = 1, ;
		TabIndex = 1, ;
		Top = 1, ;
		Width = 13
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'Text2' AS _textbox WITH ;
		BackStyle = 1, ;
		BorderStyle = 0, ;
		Format = "K", ;
		Height = 21, ;
		Left = 13, ;
		Name = "Text2", ;
		SpecialEffect = 1, ;
		TabIndex = 2, ;
		Top = 1, ;
		Width = 13
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'Text3' AS _textbox WITH ;
		BackStyle = 1, ;
		BorderStyle = 0, ;
		Format = "K", ;
		Height = 21, ;
		Left = 25, ;
		Name = "Text3", ;
		SpecialEffect = 1, ;
		TabIndex = 3, ;
		Top = 1, ;
		Width = 13
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'Text4' AS _textbox WITH ;
		BackStyle = 1, ;
		BorderStyle = 0, ;
		Format = "K", ;
		Height = 21, ;
		Left = 38, ;
		Name = "Text4", ;
		SpecialEffect = 1, ;
		TabIndex = 4, ;
		Top = 1, ;
		Width = 13
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE LostFocus
		FOR i=1 TO 4
			lcb = [this.text] + ALLTRIM(STR(i)) + [.resetToDefault('backColor')]
			lcf = [this.text] + ALLTRIM(STR(i)) + [.resetToDefault('ForeColor')]
			&lcb
			&lcf
		ENDFOR 
	ENDPROC

	PROCEDURE Text1.DblClick
		FOR i = 1 TO 4
			lcb = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.BackColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedBackColor]
			&lcb
			lcf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ForeColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedForeColor]
			&lcf
		ENDFOR 
		
	ENDPROC

	PROCEDURE Text1.InteractiveChange
		FOR i = 1 TO 4
			lcb = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ResetToDefault('backColor')]
			&lcb
			lcf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ResetToDefault('ForeColor')]
			&lcf
			lcd = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.format = 'K']
			&lcd
		ENDFOR 
		this.Valid 
	ENDPROC

	PROCEDURE Text1.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 7
			FOR i = 1 TO 4
				lcIf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.BackColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedBackColor]
				IF &lcIf
					lcAction = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.value = '']
					&lcAction
				ENDIF 
			ENDFOR 
		ENDIF 
		this.InteractiveChange 
	ENDPROC

	PROCEDURE Text2.DblClick
		FOR i = 1 TO 4
			lcb = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.BackColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedBackColor]
			&lcb
			lcf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ForeColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedForeColor]
			&lcf
		ENDFOR 
		this.Parent.text1.SetFocus 
	ENDPROC

	PROCEDURE Text2.InteractiveChange
		FOR i = 1 TO 4
			lcb = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ResetToDefault('backColor')]
			&lcb
			lcf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ResetToDefault('ForeColor')]
			&lcf
			lcd = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.format = 'K']
			&lcd
		ENDFOR 
		this.Valid 
	ENDPROC

	PROCEDURE Text2.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 7
			FOR i = 1 TO 4
				lcIf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.BackColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedBackColor]
				IF &lcIf
					lcAction = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.value = '']
					&lcAction
				ENDIF 
			ENDFOR 
		ENDIF 
	ENDPROC

	PROCEDURE Text3.DblClick
		FOR i = 1 TO 4
			lcb = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.BackColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedBackColor]
			&lcb
			lcf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ForeColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedForeColor]
			&lcf
		ENDFOR 
		this.Parent.text1.SetFocus 
	ENDPROC

	PROCEDURE Text3.InteractiveChange
		FOR i = 1 TO 4
			lcb = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ResetToDefault('backColor')]
			&lcb
			lcf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ResetToDefault('ForeColor')]
			&lcf
			lcd = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.format = 'K']
			&lcd
		ENDFOR 
		this.Valid 
	ENDPROC

	PROCEDURE Text3.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 7
			FOR i = 1 TO 4
				lcIf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.BackColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedBackColor]
				IF &lcIf
					lcAction = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.value = '']
					&lcAction
				ENDIF 
			ENDFOR 
		ENDIF 
	ENDPROC

	PROCEDURE Text4.DblClick
		FOR i = 1 TO 4
			lcb = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.BackColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedBackColor]
			&lcb
			lcf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ForeColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedForeColor]
			&lcf
		ENDFOR 
		this.Parent.text1.SetFocus 
	ENDPROC

	PROCEDURE Text4.InteractiveChange
		FOR i = 1 TO 4
			lcb = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ResetToDefault('backColor')]
			&lcb
			lcf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.ResetToDefault('ForeColor')]
			&lcf
			lcd = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.format = 'K']
			&lcd
		ENDFOR 
		this.Valid 
	ENDPROC

	PROCEDURE Text4.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 7
			FOR i = 1 TO 4
				lcIf = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.BackColor = THIS.Parent.text] + ALLTRIM(STR(i)) + [.SelectedBackColor]
				IF &lcIf
					lcAction = [THIS.Parent.TEXT] + ALLTRIM(STR(i)) + [.value = '']
					&lcAction
				ENDIF 
			ENDFOR 
		ENDIF 
	ENDPROC

ENDDEFINE

DEFINE CLASS ct_adaos AS container 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="lbBaza_adaos" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbTva_adaos" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbProc_adaos" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txBaza_adaos" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txTva_adaos" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txProc_adaos" UniqueID="" Timestamp="" />

	#INCLUDE "c:\program files\microsoft visual foxpro 8\foxpro.h"
	*<DefinedPropArrayMethod>
		*p: baza_adaos
		*p: proc_adaos
		*p: tva_adaos
	*</DefinedPropArrayMethod>

	*<PropValue>
		BackColor = 255,255,255
		baza_adaos = 0
		BorderWidth = 0
		Height = 80
		Name = "ct_adaos"
		proc_adaos = 0
		tva_adaos = 0
		Width = 246
	*</PropValue>

	ADD OBJECT 'lbBaza_adaos' AS _lbbase WITH ;
		AutoSize = .T., ;
		Caption = "Valoare adaos (bază):", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 4, ;
		Name = "lbBaza_adaos", ;
		TabIndex = 4, ;
		Top = 9, ;
		Width = 129
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'lbProc_adaos' AS lb_simplu WITH ;
		AutoSize = .T., ;
		Caption = "Procent adaos:", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 4, ;
		Name = "lbProc_adaos", ;
		TabIndex = 6, ;
		Top = 55, ;
		Width = 90
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbTva_adaos' AS _lbbase WITH ;
		AutoSize = .T., ;
		Caption = "TVA adaos:", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 4, ;
		Name = "lbTva_adaos", ;
		TabIndex = 5, ;
		Top = 32, ;
		Visible = .F., ;
		Width = 70
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'txBaza_adaos' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		ControlSource = "this.parent.baza_adaos", ;
		FontCharSet = 238, ;
		FontName = "Arial", ;
		Height = 23, ;
		InputMask = (get_mask(12,gnPc)), ;
		Left = 126, ;
		Name = "txBaza_adaos", ;
		ReadOnly = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 1, ;
		Top = 7, ;
		Width = 114
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'txProc_adaos' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		ControlSource = "this.parent.proc_adaos", ;
		FontCharSet = 238, ;
		FontName = "Arial", ;
		Height = 23, ;
		InputMask = (get_mask(12,2)), ;
		Left = 126, ;
		Name = "txProc_adaos", ;
		SpecialEffect = 1, ;
		TabIndex = 3, ;
		Top = 53, ;
		Width = 114
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'txTva_adaos' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		ControlSource = "this.parent.tva_adaos", ;
		FontCharSet = 238, ;
		FontName = "Arial", ;
		Height = 23, ;
		InputMask = (get_mask(12,gnPc)), ;
		Left = 126, ;
		Name = "txTva_adaos", ;
		ReadOnly = .T., ;
		SpecialEffect = 1, ;
		TabIndex = 2, ;
		Top = 30, ;
		Visible = .F., ;
		Width = 114
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

ENDDEFINE

DEFINE CLASS ct_cont_analitic AS container 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="acont" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: ccont_assign
		*p: ccont
	*</DefinedPropArrayMethod>

	*<PropValue>
		BackColor = 255,255,255
		BackStyle = 1
		BorderColor = 128,128,128
		BorderWidth = 1
		ccont = 
		Height = 30
		Name = "ct_cont_analitic"
		Width = 340
	*</PropValue>

	ADD OBJECT 'acont' AS combobox WITH ;
		Height = 24, ;
		Left = 75, ;
		Name = "acont", ;
		Style = 2, ;
		Top = 3, ;
		Width = 264
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'Label1' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Cont analitic", ;
		Height = 17, ;
		Left = 4, ;
		Name = "Label1", ;
		Top = 7, ;
		Width = 70
		*< END OBJECT: BaseClass="label" />
	
	PROCEDURE ccont_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		THIS.cCont = m.vNewVal
		LOCAL lcCont
		lcCont = this.ccont 
		IF !EMPTY(lcCont)
			SELECT acont+' - '+denumire as den,cont,acont ;
				FROM plcontana ;
				WHERE LEFT(ALLTRIM(cont),4)=Left(lcCont,4) ;
				INTO ARRAY laContAnalitic ;
				ORDER BY acont
		ENDIF 
		
		
		
		IF USED("cursor_acont")
			USE IN cursor_acont
		ENDIF 
		CREATE CURSOR cursor_acont (den C(70), cont c(4), acont c(4))
		SELECT cursor_acont 
		APPEND BLANK 
		replace den WITH "< TOATE ANALITICELE >", cont WITH this.Ccont 
		
		IF TYPE("laContAnalitic") != "U"
			APPEND FROM ARRAY laContAnalitic
			RELEASE laContAnalitic
		ENDIF 
		
		THIS.acont.RowSourceType = 2 
		THIS.acont.RowSource = "cursor_acont"
	ENDPROC

	PROCEDURE Destroy
		IF USED("cursor_acont")
			USE IN cursor_acont
		ENDIF 
	ENDPROC

ENDDEFINE

DEFINE CLASS ct_discount AS container 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Combogrid3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbBaza_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbTva_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbProc_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txBaza_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txTva_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txProc_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="CotaTVA" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="LbTva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie_tva" UniqueID="" Timestamp="" />

	#INCLUDE "c:\program files\microsoft visual foxpro 8\foxpro.h"
	*<DefinedPropArrayMethod>
		*p: baza_discount
		*p: nid_jtva_coloana
		*p: nid_tva
		*p: pntva
		*p: proc_discount
		*p: tva_discount
	*</DefinedPropArrayMethod>

	*<PropValue>
		BackColor = 255,255,255
		baza_discount = 0
		BorderWidth = 0
		Height = 122
		Name = "ct_discount"
		nid_jtva_coloana = 0
		nid_tva = 0
		proc_discount = 0
		tva_discount = 0
		Width = 315
	*</PropValue>

	ADD OBJECT 'Combogrid3' AS _cbbase WITH ;
		BorderColor = 64,0,64, ;
		BorderStyle = 0, ;
		Height = 20, ;
		Left = 2, ;
		Name = "Combogrid3", ;
		RowSource = "Fara discount,Discount global,Discount distribuit", ;
		RowSourceType = 1, ;
		SpecialEffect = 2, ;
		TabIndex = 1, ;
		TabStop = .F., ;
		Top = 3, ;
		Value = 1, ;
		Width = 281
		*< END OBJECT: ClassLib="_cb_base.vcx" BaseClass="combobox" />

	ADD OBJECT 'CotaTVA' AS combobox WITH ;
		BorderColor = 128,128,128, ;
		BorderStyle = 1, ;
		BoundColumn = 1, ;
		ColumnCount = 3, ;
		ColumnLines = .F., ;
		ColumnWidths = "10,200,0", ;
		ControlSource = "", ;
		Height = 24, ;
		InputMask = "", ;
		Left = 245, ;
		Name = "CotaTVA", ;
		RowSource = "crsjtax.cota_tva,denumire,id_jtva_coloana", ;
		RowSourceType = 6, ;
		SpecialEffect = 1, ;
		Style = 2, ;
		TabStop = .F., ;
		Top = 50, ;
		Visible = .F., ;
		Width = 68
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'lb_explicatie_tva' AS lb_simplu WITH ;
		AutoSize = .F., ;
		Caption = "", ;
		FontItalic = .T., ;
		Height = 18, ;
		Left = 1, ;
		Name = "lb_explicatie_tva", ;
		Top = 101, ;
		Visible = .F., ;
		Width = 311
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbBaza_discount' AS lb_simplu WITH ;
		AutoSize = .T., ;
		Caption = "Valoare discount (bază):", ;
		ForeColor = 7,118,177, ;
		Left = 5, ;
		Name = "lbBaza_discount", ;
		TabIndex = 5, ;
		Top = 28, ;
		Visible = .F., ;
		Width = 143
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbProc_discount' AS lb_simplu WITH ;
		AutoSize = .T., ;
		Caption = "Procent discount:", ;
		ForeColor = 7,118,177, ;
		Left = 5, ;
		Name = "lbProc_discount", ;
		TabIndex = 7, ;
		Top = 76, ;
		Visible = .F., ;
		Width = 104
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'LbTva' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "TVA %", ;
		Height = 17, ;
		Left = 263, ;
		Name = "LbTva", ;
		TabIndex = 21, ;
		Top = 32, ;
		Visible = .F., ;
		Width = 37
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lbTva_discount' AS lb_simplu WITH ;
		AutoSize = .T., ;
		Caption = "TVA discount:", ;
		ForeColor = 7,118,177, ;
		Left = 5, ;
		Name = "lbTva_discount", ;
		TabIndex = 6, ;
		Top = 53, ;
		Visible = .F., ;
		Width = 84
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'txBaza_discount' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		BorderStyle = 1, ;
		ControlSource = "this.parent.baza_discount", ;
		Format = "r", ;
		InputMask = (get_mask(12,gnPC)), ;
		Left = 141, ;
		Name = "txBaza_discount", ;
		TabIndex = 2, ;
		TabStop = .F., ;
		Top = 28, ;
		Visible = .F., ;
		Width = 100
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'txProc_discount' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		BorderStyle = 1, ;
		ControlSource = "this.parent.proc_discount", ;
		InputMask = "9999.9999", ;
		Left = 141, ;
		Name = "txProc_discount", ;
		TabIndex = 4, ;
		TabStop = .F., ;
		Top = 74, ;
		Visible = .F., ;
		Width = 100
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'txTva_discount' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		BorderStyle = 1, ;
		ControlSource = "this.parent.tva_discount", ;
		Format = "r", ;
		InputMask = (get_mask(12,gnPC)), ;
		Left = 141, ;
		Name = "txTva_discount", ;
		TabIndex = 3, ;
		TabStop = .F., ;
		Top = 51, ;
		Visible = .F., ;
		Width = 100
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />
	
	PROCEDURE Combogrid3.Valid
		Do Case
			Case This.Value=1
				This.Parent.txBaza_discount.Visible = .F.
				This.Parent.lbBaza_discount.Visible = .F.
		
				This.Parent.txTva_discount.Visible = .F.
				This.Parent.lbTva_discount.Visible = .F.
		
				This.Parent.txProc_discount.Visible = .F.
				This.Parent.lbProc_discount.Visible = .F.
				
				this.Parent.cotaTVA.Visible = .f.
				this.Parent.lbTva.Visible = .f.
				this.Parent.lb_explicatie_tva.Visible = .F.
				
				this.Parent.baza_discount = 0
				this.Parent.tva_discount = 0
				this.Parent.proc_discount = 0
				
			Case This.Value=2
				This.Parent.txBaza_discount.Visible = .T.
				This.Parent.lbBaza_discount.Visible = .T.
		
				This.Parent.txTva_discount.Visible = .T.
				This.Parent.lbTva_discount.Visible = .T.
		
				This.Parent.txProc_discount.Visible = .T.
				This.Parent.lbProc_discount.Visible = .T.
				This.Parent.txProc_discount.READONLY = .T.
				
				this.Parent.cotaTVA.Visible = .t.
				this.Parent.lbTva.Visible = .t.
				this.Parent.lb_explicatie_tva.Visible = .T.
		
				this.Parent.proc_discount = 0
				
			Case This.Value=3
				This.Parent.txBaza_discount.Visible = .F.
				This.Parent.lbBaza_discount.Visible = .F.
		
				This.Parent.txTva_discount.Visible = .F.
				This.Parent.lbTva_discount.Visible = .F.
		
				This.Parent.txProc_discount.Visible = .T.
				This.Parent.lbProc_discount.Visible = .T.
				
				this.Parent.cotaTVA.Visible = .f.
				this.Parent.lbTva.Visible = .f.
				this.Parent.lb_explicatie_tva.Visible = .F.
				
				this.Parent.baza_discount = 0
				this.Parent.tva_discount = 0
				This.Parent.txProc_discount.ReadOnly=.F.
		
		ENDCASE
		this.Parent.Refresh 
		
		
	ENDPROC

	PROCEDURE CotaTVA.Valid
		*!*	modificare	2.2.4	:	am inlocuit jtva_coloane cu crsjtax
		This.Parent.pntva = (crsjtax.cota_tva+100)/100
		This.Parent.lb_explicatie_tva.Caption = Alltrim(Upper(crsjtax.denumire))
		this.parent.nid_jtva_coloana = crsjtax.id_jtva_coloana
		this.Parent.nid_tva = crsjtax.id_tva
		This.Parent.txBaza_discount.Valid
		
	ENDPROC

	PROCEDURE txBaza_discount.Valid
		WITH this.Parent
			.tva_discount = ROUND(.baza_discount * (.pntva - 1), gnPc)
			.refresh 
		ENDWITH 
	ENDPROC

	PROCEDURE txTva_discount.Valid
		this.Parent.Refresh 
		
	ENDPROC

ENDDEFINE

DEFINE CLASS ct_factura AS container 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="lbBaza" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbTva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txBaza" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txTva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbExplic" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txTotal" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbTotal" UniqueID="" Timestamp="" />

	#INCLUDE "c:\program files\microsoft visual foxpro 8\foxpro.h"
	*<DefinedPropArrayMethod>
		*p: totctva
		*p: totftva
		*p: tva
	*</DefinedPropArrayMethod>

	*<PropValue>
		BackColor = 255,255,255
		BorderWidth = 0
		Height = 75
		Name = "ct_factura"
		totctva = 0
		totftva = 0
		tva = 0
		Width = 238
	*</PropValue>

	ADD OBJECT 'lbBaza' AS lb_simplu WITH ;
		AutoSize = .T., ;
		Caption = "Total (bază):", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 59, ;
		Name = "lbBaza", ;
		TabIndex = 4, ;
		Top = 29, ;
		Width = 74
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbExplic' AS lb_simplu WITH ;
		AutoSize = .T., ;
		Caption = "din care:", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 9, ;
		Name = "lbExplic", ;
		TabIndex = 6, ;
		Top = 29, ;
		Width = 52
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbTotal' AS lb_simplu WITH ;
		AutoSize = .T., ;
		Caption = "TOTAL FACTURĂ", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 7, ;
		Name = "lbTotal", ;
		TabIndex = 7, ;
		Top = 6, ;
		Width = 106, ;
		WordWrap = .F.
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbTva' AS lb_simplu WITH ;
		AutoSize = .T., ;
		Caption = "TVA:", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 59, ;
		Name = "lbTva", ;
		TabIndex = 5, ;
		Top = 52, ;
		Width = 31
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'txBaza' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		BorderStyle = 1, ;
		ControlSource = "this.parent.totftva", ;
		DisabledBackColor = 255,255,255, ;
		Format = "r", ;
		InputMask = (get_mask(12,gnPC)), ;
		Left = 130, ;
		Name = "txBaza", ;
		ReadOnly = .T., ;
		TabIndex = 2, ;
		TabStop = .F., ;
		Top = 27, ;
		Width = 105
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'txTotal' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		BorderStyle = 1, ;
		ControlSource = "this.parent.totctva", ;
		DisabledBackColor = 255,255,255, ;
		Format = "r", ;
		InputMask = (get_mask(12,gnPC)), ;
		Left = 130, ;
		Name = "txTotal", ;
		ReadOnly = .T., ;
		TabIndex = 1, ;
		TabStop = .F., ;
		Top = 4, ;
		Width = 105
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'txTva' AS _txbase WITH ;
		Alignment = 1, ;
		BorderColor = 64,0,64, ;
		BorderStyle = 1, ;
		ControlSource = "this.parent.tva", ;
		DisabledBackColor = 255,255,255, ;
		Format = "r", ;
		InputMask = (get_mask(12,gnPC)), ;
		Left = 130, ;
		Name = "txTva", ;
		ReadOnly = .T., ;
		TabIndex = 3, ;
		TabStop = .F., ;
		Top = 50, ;
		Width = 105
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

ENDDEFINE

DEFINE CLASS ct_grid_order AS _container OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_GRID1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Titlu" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_tx_cautare1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: actualizeaza_grid
		*m: corderby_assign
		*m: do_cauta
		*m: initializare
		*m: ordoneaza_grid
		*p: casc
		*p: cfiltru
		*p: cfiltruoriginal
		*p: cgroup
		*p: cmask
		*p: cnrcoloane_check
		*p: cnumecursor
		*p: cnume_coloane
		*p: corder
		*p: cproc_adauga
		*p: cproc_modifica
		*p: cschema
		*p: cselect
		*p: ctitlu
		*p: ctitlu_coloane
		*p: lmodparam
		*p: ocursor
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderWidth = 0
		casc = ASC
		cfiltru = 
		cfiltruoriginal = 
		cgroup = 
		cmask = 
		cnrcoloane_check = 
		cnumecursor = cursor_curent
		cnume_coloane = 
		corder = 
		cproc_adauga = 
		cproc_modifica = 
		cschema = 
		cselect = 
		ctitlu = 
		ctitlu_coloane = 
		Height = 418
		Name = "ct_grid_order"
		ocursor = 
		Width = 325
	*</PropValue>

	ADD OBJECT '_GRID1' AS _grid WITH ;
		Anchor = 15, ;
		DeleteMark = .F., ;
		Height = 348, ;
		HighlightStyle = 1, ;
		Left = 6, ;
		Name = "_GRID1", ;
		RecordMark = .F., ;
		RecordSource = "cursor_curent", ;
		TabIndex = 2, ;
		Top = 62, ;
		Width = 310, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="grid" />

	ADD OBJECT 'Cb_tx_cautare1' AS cb_tx_cautare WITH ;
		Anchor = 10, ;
		Left = 7, ;
		Name = "Cb_tx_cautare1", ;
		TabIndex = 1, ;
		Top = 31, ;
		ZOrderSet = 3, ;
		Text.Anchor = 130, ;
		Text.Format = "!", ;
		Text.Name = "Text", ;
		Text.TabIndex = 2, ;
		Criteriu.Anchor = 2, ;
		Criteriu.Name = "Criteriu", ;
		Criteriu.TabIndex = 1
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Titlu' AS lb_simplu WITH ;
		Anchor = 3, ;
		AutoSize = .T., ;
		Caption = "TITLU", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 9, ;
		Name = "Titlu", ;
		TabIndex = 3, ;
		Tag = "", ;
		Top = 9, ;
		Width = 35, ;
		WordWrap = .F., ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />
	
	PROCEDURE actualizeaza_grid
		LPARAMETERS pcFiltru
		LOCAL lcFiltru
		
		lcCursor = this.cnumecursor 
		*!*	lcFiltru=pcFiltru
		*!*	IF EMPTY(lcFiltru)
		*!*		lcFiltru = FILTER(lcCursor)
		*!*	ENDIF
		
		lcFiltru=pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru=IIF(!EMPTY(this.cfiltru),this.cfiltru,[1=1])
		ENDIF
		this.cfiltru = lcfiltru
		
		
		SELECT (lcCursor)
		SET FILTER TO &lcFiltru
		LOCATE 
		
		DO nrord WITH lcCursor
		
		this._GRID1.SetFocus 
		this._GRID1.AutoFit  
		
		
		
		
	ENDPROC

	PROCEDURE corderby_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		
		IF THIS.corder = m.vNewVal
			lcASC = IIF(this.casc = 'ASC','DESC','ASC')
		ELSE
			lcASC = 'ASC'
		ENDIF 
		THIS.cOrder = m.vNewVal
		this.cAsc = lcAsc
		IF TYPE(this.corder) # 'C'
			this.cb_tx_cautare1.text.Enabled = .f.
		ELSE 
			this.cb_tx_cautare1.text.Enabled = .t.
		ENDIF 
		this.ordoneaza_grid()
		
	ENDPROC

	PROCEDURE do_cauta
		Private lcfiltru,lcval1
		lcfiltru=''
		
		LOCAL lcColoana
		lcColoana = ALLTRIM(this.cOrder) 
		IF EMPTY(lcColoana) OR OCCURS([,],lcColoana)>0
			aMessagebox("Selectati o coloana!",0+48,"Atentie")
			This.cb_tx_cautare1.critERIU.SetFocus()
			RETURN 
		ENDIF 
		
		With This.cb_tx_cautare1
			lcval1=Strtran(Alltrim(Upper(.Text.Value)),['],[''])
		*!*		Do Case
		*!*		Case .criteriu.Value = "1" And !Empty(.Text.Value)
		*!*			lcfiltru = Alltrim(Upper(lcColoana)) + [ LIKE '] + lcval1 + [%']
		*!*		Case .criteriu.Value = "2" And !Empty(.Text.Value)
		*!*			lcfiltru = Alltrim(Upper(lcColoana)) + [ ='] + lcval1 + [']
		*!*		Case .criteriu.Value = "3" And !Empty(.Text.Value)
		*!*			lcfiltru = Alltrim(Upper(lcColoana)) + [ !='] + lcval1 + [']
		*!*		Case .criteriu.Value = "4" And !Empty(.Text.Value)
		*!*			lcfiltru = Alltrim(Upper(lcColoana)) + [ LIKE '%] + lcval1 + [%']
		*!*		Case .criteriu.Value = "5" And !Empty(.Text.Value)
		*!*			lcfiltru = Alltrim(Upper(lcColoana)) + [ NOT LIKE '%] + lcval1 + [%']
		*!*		Case .criteriu.Value = "6"
		*!*			lcfiltru = [2=2]
		*!*		ENDCASE
		
			IF .criteriu.Value = "1" AND UPPER(lcval1) = [%]
				.criteriu.Value = "6"
			ENDIF 
			
			DO CASE 
				CASE .criteriu.Value = "1"
					lcfiltru = "LIKE([" + UPPER(lcval1) + "*]," + [upper(] + lcColoana + [))]
				CASE .criteriu.Value = "2"
					lcfiltru = [upper(] + lcColoana + ")=[" + lcval1 + "]"
				CASE .criteriu.Value = "3"
					lcfiltru = [upper(] + lcColoana + ")<>[" + lcval1 + "]" 
				CASE .criteriu.Value = "4"
					lcfiltru = "LIKE([*" + lcval1 + "*]," + [upper(] + lcColoana + [))]
				CASE .criteriu.Value = "5"
					lcfiltru = "!LIKE([*" + lcval1 + "*]," + [upper(] + lcColoana + [))]
				Case .criteriu.Value = "6"
					lcfiltru = [2=2]	
			ENDCASE 
		Endwith
		
		
		
		If Empty(lcfiltru)
			aMessagebox("Alegeti un criteriu!",0+48,"Atentie")
			This.cb_tx_cautare1.criteriu.SetFocus()
			Return
		Endif
		
		IF !EMPTY(This.cfiltruoriginal)
			lcfiltru = This.cfiltruoriginal + [ and ] + lcfiltru
		ENDIF 
		
		This.actualizeaza_grid(lcfiltru)
		
		
		SELECT (this.cnumecursor)
		Go Top
		If (Reccount(this.cnumecursor)=0)
			aMessagebox("Nu exista rezultate!",0+48,"Atentie")
			This.cb_tx_cautare1.critERIU.SetFocus()
		ELSE
			GO TOP
			lcFirstInList = &lcColoana
			IF (Reccount(this.cnumecursor)>1 AND ALLTRIM(lcFirstInList)=='<TOATE INREGISTRARILE>')
				GOTO 2
			ENDIF 
			This._GRID1.SetFocus()
		ENDIF
	ENDPROC

	PROCEDURE initializare
		PARAMETERS tlNumerotare
		
		llNrOrd = tlNumerotare
		
		*** CREEZ CURSORUL INITIAL
		
		lcTitlu = This.cTitlu
		lcTitluColoane = This.cTitlu_coloane
		lcNumeColoane = This.cNume_coloane
		lcMask = ALLTRIM(This.cMask)
		lcSql = This.cSelect
		lcFiltru = Iif(!Empty(This.cFiltru),This.cFiltru + [ AND ] + This.cFiltruOriginal,This.cFiltruOriginal)
		lcFiltruOriginal = This.cFiltruOriginal
		lcSchema = This.cSchema
		lcOrder = This.cOrder
		llAfisare = .F.
		lcNumeCursor = This.cNumecursor
		lcNrColoane_check = ALLTRIM(this.cnrcoloane_check)
		lcGroup = ALLTRIM(this.cgroup)
		
		&& testez daca am de-a face cu coloane de tip checkbox
		llCuCheck =IIF(EMPTY(lcNrColoane_check),.f.,.t.)
		
		This.titlu.Caption = lcTitlu
		IF USED(lcNumeCursor)
			USE IN &lcNumeCursor
		ENDIF 
		
		lnSucces = goExecutor.oExecute(lcSql,lcNumeCursor)
		
		IF lnSucces < 0
			aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare")
			RETURN 
		ENDIF 
		
		*!*	IF !EMPTY(lcFiltru)
		*!*		SELECT (lcNumeCursor)
		*!*		SET FILTER TO &lcFiltru
		*!*	ENDIF 
		
		*SELECT (lcNumeCursor)
		
		If Right(lcTitluColoane,1) # ','
			lcTitluColoane = lcTitluColoane + ','
		Endif
		If Left(lcTitluColoane,1) # ','
			lcTitluColoane = ',' + lcTitluColoane
		Endif
		
		If Right(lcNumeColoane ,1) # ';'
			lcNumeColoane = lcNumeColoane + ';'
		Endif
		If Left(lcNumeColoane ,1) # ';'
			lcNumeColoane = ';' + lcNumeColoane
		Endif
		
		If Right(lcSchema ,1) # ','
			lcSchema = lcSchema + ','
		Endif
		If Left(lcSchema,1) # ','
			lcSchema = ',' + lcSchema
		ENDIF
		
		If Right(lcMask,1) # ';' && am virgula in get_mask
			lcMask = lcMask + ';'
		Endif
		If Left(lcMask,1) # ';'
			lcMask = ';' + lcMask
		ENDIF
		
		IF llNrOrd && mai adaug o coloana la inceput
			lcTitluColoane = ',' + lcTitluColoane
			lcNumeColoane = ';' + lcNumeColoane
			lcSchema = ',' + lcSchema
			lcMask = ';[0]=' + lcMask
		ENDIF 
		
		lnNrCols = Occurs(",",lcTitluColoane) - 1
		
		This._GRID1.RecordSource = lcNumeCursor
		This._GRID1.ColumnCount = lnNrCols
		
		SELECT (lcNumeCursor)
		For i=1 To lnNrCols
			*	this._grid1.AddColumn(i)
			
			IF llNrOrd AND i = 1
				lcHeader = [this._grid1.column1.hEADER1.Caption = 'Nr.']
				&lcHeader
				this._GRID1.coLUMN1.ControlSource = ''
				LOOP
			ENDIF 
			
			lcTitluCol = Strextract(lcTitluColoane,[,],[,],i)
			lcControlCol = Strextract(lcNumeColoane,[;],[;],i)
			lcHeader = [this._grid1.column] + Alltrim(Str(i))+ [.hEADER1.Caption = '] + lcTitluCol + [']
			&lcHeader
			lcControlSource = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.ControlSource = '] + lcControlCol + [']
			&lcControlSource
			lcMaskCol = Strextract(lcMask,[;],[;],i)
			lcMaskCol = ALLTRIM(STREXTRACT(lcMaskCol,']='))
			IF !EMPTY(lcMaskCol)
				lcInputmask = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.InputMask = '] + EVALUATE(lcMaskCol) + [']
				&lcInputmask
			ENDIF 
			lcSchemaCol = Strextract(lcSchema,[,],[,],i)
			
			IF TYPE(lcControlCol) = 'N'
				IF EMPTY(lcMaskCol) && nu e configurat 
					IF !EMPTY(lcSchemaCol)
						lcSch = STREXTRACT(lcSchemaCol,'(',')',1)
						lnInt = IIF([,] $ lcSch,VAL(STREXTRACT(lcSch,[],[,])),VAL(lcSch))
						lnZec = IIF([,] $ lcSch,VAL(STREXTRACT(lcSch,[,])),0)
					ELSE 
						lnInt = 12
						lnZec = gnPA
					ENDIF 
					lcInputmask = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.InputMask = '] + get_mask(lnInt,lnZec) + [']
					&lcInputmask
				ENDIF 
				lcAlignment = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.Alignment = 1]
				&lcAlignment
				IF llCuCheck  
					&& daca nr coloanei curente este in lista cNrColoane_check, atunci 		
					&& controlul curent al coloanei va fi un checkbox
					lcVerific = 'INLIST(' + IIF(llNrOrd,ALLTRIM(STR(i-1)),ALLTRIM(STR(i))) + ',' +lcNrColoane_check + ')'
					lcEste = &lcVerific
					IF lcEste
						lcAdaugCheck = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.AddObject('Check1',]+;
							['Checkbox')]	
						&lcAdaugCheck	
						lcControlCurent = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.CurrentControl = 'Check1']
						&lcControlCurent	
						lcRemText = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.RemoveObject('Text1')]
						&lcRemText
						lcSparse = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Sparse = .f.]
						&lcSparse
						lcWidth = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.width = 30]
						&lcWidth 
						lcCaption = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Check1.caption = ''] 
						&lcCaption
						lcReadOnly = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.ReadOnly = .f.] 
						&lcReadOnly
						lcAli = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Alignment = 2] 
						&lcAli
						lcReadOnly_ch = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Check1.ReadOnly = .f.]				
						&lcReadOnly_ch
						lcControlSource = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.ControlSource = '] + lcControlCol + [']
						&lcControlSource				
						lcVisible = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Check1.visible = .t.] 
						&lcVisible								
						
					ENDIF
				ENDIF	
			ELSE 
				lcAlignment = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.Alignment = 0]
				&lcAlignment
			ENDIF 
		Endfor
		
		* Replace default headers with custom one
		i = 0
		For Each loColumn In This._GRID1.Columns
			i = i + 1
			With loColumn
				If !Empty(loColumn.ControlSource)
		
					* Save default caption, color and font
		
					lcOldCaption   = loColumn.Header1.Caption
					lcOldFontName = loColumn.Header1.FontName
					lnOldForeColor = loColumn.Header1.ForeColor
					llOldFontUnderline = loColumn.Header1.FontUnderline
		
					* Name Header Obj after ControlSource
		
					lcControlSrc = loColumn.ControlSource
					lnControlSrc = Rat(".", lcControlSrc) + 1
					lcControlSrc = Substr(lcControlSrc, lnControlSrc)
					
					* Metoda dupa care se face ordonarea relativa la grid
					lcMethodName = 'parent.corderby_assign'
					lcPropColOrder = 'parent.cOrder'
					lcPropSensOrder = 'parent.cAsc'
					* Remove old and create new header
		
					.RemoveObject("Header1")
					.AddObject("grh"+ALLTRIM(STR(i)), ;
						"PSHeader", ;
						lcOldCaption, lcOldFontName,lnOldForeColor,llOldFontUnderline,lcMethodName,lcControlSrc)
		
					If Upper(Alltrim(lcControlSrc)) = Upper(Alltrim(lcOrder))
						lcCuloare = [locolumn.grh] + ALLTRIM(STR(i)) + [.forecolor = RGB(0,0,255)]
						&lcCuloare
						lcUnderline = [locolumn.grh] + ALLTRIM(STR(i)) + [.FontUnderline = .t.]
						&lcUnderline
					Endif
				Endif
			Endwith
		ENDFOR
		
		IF llNrOrd
			DO nrord WITH lcNumeCursor
			this._GRID1.coLUMN1.ControlSource = [nrcrt()]
			THIS._GRID1.COLUMN1.inputmask = '999'
			this._griD1.LockColumns = 1
		ENDIF 	
		
		this.cfiltru = IIF(!EMPTY(lcFiltruOriginal),lcFiltruOriginal,[1=1])
		this.ordoneaza_grid
		This._GRID1.AutoFit
		*this.actualizeaza_grid(lcFiltru)
		
	ENDPROC

	PROCEDURE ordoneaza_grid
		lcCursor = This.cnumecursor
		lcOrder = This.corder + [ ] + This.Casc
		*lcFiltru = FILTER(lcCursor)
		lcFiltru = This.cfiltru
		If Empty(lcFiltru)
			lcFiltru = [1=1]
		Endif
		
		save_grid(This._grid1)
		Select * From (lcCursor) Into Cursor tTemp
		Use In (lcCursor)
		Select * From tTemp Into Cursor (lcCursor) Order By &lcOrder Readwrite
		Select (lcCursor)
		Set Filter To &lcFiltru
		Use In tTemp
		restore_grid(This._grid1)
		This._grid1.SetFocus
		
	ENDPROC

	PROCEDURE Resize
		*!*	this._GRID1.Width = this.Width - 15
		*!*	this._GRID1.Height = this.Height - this._griD1.Top - 5
		
	ENDPROC

	PROCEDURE Cb_tx_cautare1.Criteriu.Init
		this.Value = "1"
	ENDPROC

	PROCEDURE Cb_tx_cautare1.Text.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 13
			NODEFAULT 
			this.parent.Parent.do_cauta()
		ENDIF 
	ENDPROC

ENDDEFINE

DEFINE CLASS ct_grid_search AS _container OF "_baza.vcx" 
 	*< CLASSDATA: Baseclass="container" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_GRID1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Titlu" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_tx_cautare1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: actualizeaza_grid
		*m: corderby_assign
		*m: do_cauta
		*m: initializare
		*m: schimba_criteriu
		*p: casc
		*p: ccoloanepermise
		*p: cfiltru
		*p: cfiltruoriginal
		*p: cgroup
		*p: cmask
		*p: cnrcoloane_check
		*p: cnumecursor
		*p: cnume_coloane
		*p: corder
		*p: cpicture
		*p: cproc_adauga
		*p: cproc_modifica
		*p: cschema
		*p: cselect
		*p: ctitlu
		*p: ctitlu_coloane
		*p: cwhere
		*p: cwidth_coloane
		*p: lmodparam
		*p: lnumerotare
		*p: lvalid		&& .T. daca se executa metoda Valid de la criteriu.
		*p: npornire
		*p: ocursor
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderWidth = 0
		casc = ASC
		ccoloanepermise = 
		cfiltru = 
		cfiltruoriginal = 
		cgroup = 
		cmask = 
		cnrcoloane_check = 
		cnumecursor = cursor_curent
		cnume_coloane = 
		corder = 
		cpicture = Up
		cproc_adauga = 
		cproc_modifica = 
		cschema = 
		cselect = 
		ctitlu = 
		ctitlu_coloane = 
		cwhere = 
		cwidth_coloane = 
		Height = 418
		lnumerotare = .F.
		lvalid = .T.
		Name = "ct_grid_search"
		npornire = 1
		ocursor = 
		Width = 325
	*</PropValue>

	ADD OBJECT '_GRID1' AS _grid WITH ;
		Anchor = 15, ;
		DeleteMark = .F., ;
		Height = 348, ;
		HighlightBackColor = 10,36,106, ;
		HighlightStyle = 1, ;
		Left = 6, ;
		Name = "_GRID1", ;
		ReadOnly = .F., ;
		RecordMark = .T., ;
		RecordSource = "cursor_curent", ;
		SelectedItemBackColor = 40,60,193, ;
		TabIndex = 2, ;
		Top = 62, ;
		Width = 310, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="grid" />

	ADD OBJECT 'Cb_tx_cautare1' AS cb_tx_cautare WITH ;
		Anchor = 10, ;
		Left = 7, ;
		Name = "Cb_tx_cautare1", ;
		TabIndex = 1, ;
		Top = 31, ;
		ZOrderSet = 3, ;
		Text.Anchor = 130, ;
		Text.Format = "!k", ;
		Text.Name = "Text", ;
		Text.TabIndex = 2, ;
		Criteriu.Anchor = 2, ;
		Criteriu.Name = "Criteriu", ;
		Criteriu.RowSource = "incepe cu...,1,este...,2,nu este...,3,contine...,4,nu contine...,5,toate,6", ;
		Criteriu.TabIndex = 1
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Titlu' AS lb_simplu WITH ;
		Anchor = 3, ;
		AutoSize = .T., ;
		Caption = "TITLU", ;
		ForeColor = 7,118,177, ;
		Height = 18, ;
		Left = 9, ;
		Name = "Titlu", ;
		TabIndex = 3, ;
		Tag = "", ;
		Top = 9, ;
		Width = 35, ;
		WordWrap = .F., ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />
	
	PROCEDURE actualizeaza_grid
		LPARAMETERS pcFiltru
		LOCAL lcFiltru
		poLog.Log('recordsource/tooltiptext inainte de save_grid ' + ALLTRIM(TRANSFORM(This._grid1.RecordSource)) + '/' + ALLTRIM(TRANSFORM(This._grid1.ToolTipText)), PROGRAM())
		
		lcFiltru=pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru=this.ocursor.ca_baza1.cfiltru
		ENDIF
		
		lcOrder = IIF(!EMPTY(this.corder),this.corder + [ ] + this.casc, '')
		save_grid(This._grid1)
		
		poLog.Log('recordsource/tooltiptext dupa save_grid ' + ALLTRIM(TRANSFORM(This._grid1.RecordSource)) + '/' + ALLTRIM(TRANSFORM(This._grid1.ToolTipText)), PROGRAM())		
		
		this.ocursor.ca_baza1.cfiltru = lcfiltru
		this.ocursor.ca_baza1.corder = lcOrder 
		this.ocursor.ca_baza1.afisare()
		poLog.Log('recordsource/tooltiptext inainte de restore_grid ' + ALLTRIM(TRANSFORM(This._grid1.RecordSource)) + '/' + ALLTRIM(TRANSFORM(This._grid1.ToolTipText)), PROGRAM())		
		restore_grid(This._grid1)
		poLog.Log('recordsource/tooltiptext dupa restore_grid ' + ALLTRIM(TRANSFORM(This._grid1.RecordSource)) + '/' + ALLTRIM(TRANSFORM(This._grid1.ToolTipText)), PROGRAM())		
		
	ENDPROC

	PROCEDURE corderby_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		
		IF THIS.corder = m.vNewVal
			lcASC = IIF(this.casc = 'ASC','DESC','ASC')
		ELSE
			lcASC = 'ASC'
		ENDIF 
		THIS.cOrder = m.vNewVal
		this.cAsc = lcAsc
		IF lcAsc = 'ASC'
			this.cPicture = 'Up.bmp'
		ELSE 
			this.cPicture = 'Down.bmp'
		ENDIF 
		If !Inlist(Type(This.corder),'C','T','D','N')
			This.cb_tx_cautare1.Text.Enabled = .F.
		Else
			This.cb_tx_cautare1.Text.Enabled = .T.
		Endif
		this.actualizeaza_grid()
		
	ENDPROC

	PROCEDURE do_cauta
		Private lcfiltru,lcval1
		lcfiltru=''
		LOCAL lcColoana
		lcColoana = ''
		
		Select (This.cnumecursor)
		
		lcColoana = Alltrim(This.cOrder)
		With This.cb_tx_cautare1
			If Inlist(Type(lcColoana),'T','N','D')
				lcval=.Text.Value
				
				Do Case
				Case Type(lcColoana)='T'
					lcval1=[to_date(']+TTOC(lcval,1)+[','YYYYMMDDHH24miss')]
				Case Type(lcColoana)='D'
					lcval1=[to_date(']+DTOS(lcval)+[','YYYYMMDD')]
				Otherwise
					lcval1=IIF(TYPE('lcval')='N',ALLTRIM(STR(lcval,20,4)),ALLTRIM(lcval))
				Endcase
		
				Do Case
				Case At('%',lcval1)<>0
					lcfiltru = [2=2]
				Case .criteriu.Value = "1" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ >= ] + lcval1
				Case .criteriu.Value = "2" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ <= ] + lcval1
				Case .criteriu.Value = "3" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ = ] + lcval1
				Case .criteriu.Value = "4" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ <> ] + lcval1
				Case .criteriu.Value = "5" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ > ] + lcval1
				Case .criteriu.Value = "6" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ < ] + lcval1
				Endcase
		
			Else
				lcval1=Strtran(Alltrim(Upper(.Text.Value)),['],[''])
				Do Case
				Case .criteriu.Value = "1" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ LIKE '] + lcval1 + [%']
				Case .criteriu.Value = "2" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ ='] + lcval1 + [']
				Case .criteriu.Value = "3" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ !='] + lcval1 + [']
				Case .criteriu.Value = "4" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ LIKE '%] + lcval1 + [%']
				Case .criteriu.Value = "5" And !Empty(.Text.Value)
					lcfiltru = Alltrim(Upper(lcColoana)) + [ NOT LIKE '%] + lcval1 + [%']
				Case .criteriu.Value = "6"
					lcfiltru = [2=2]
				Endcase
			Endif
		Endwith
		
		If Empty(lcfiltru)
			aMessagebox("Alegeti un criteriu!",0+48,"Atentie")
			This.cb_tx_cautare1.criteriu.SetFocus()
			Return
		Endif
		
		
		lcfiltru = This.cfiltruoriginal + [ and ] + lcfiltru
		
		This.actualizeaza_grid(lcfiltru)
		*This._GRID1.AutoFit
		
		Select (This.cnumecursor)
		Go Top
		If (Reccount(This.cnumecursor)=0)
			This._GRID1.SetFocus()
			aMessagebox("Nu exista rezultate!",0+48,"Atentie")
			This.cb_tx_cautare1.criteriu.SetFocus()
		Else
			Go Top
			If Type(lcColoana)='C'
				lcFirstInList = &lcColoana
				If (Reccount(This.cnumecursor)>1 And Alltrim(lcFirstInList)=='<TOATE INREGISTRARILE>')
					Goto 2
				Endif
			Endif
			This._GRID1.SetFocus()
		Endif
		
		Return lcfiltru
		
	ENDPROC

	PROCEDURE initializare
		Parameters tlNumerotare,tlPastreazaCriteriu
		
		LOCAL lnPornire 
		llNrOrd = tlNumerotare
		This.lnumerotare = tlNumerotare
		this.cb_tx_cautare1.criteriu.Value = this.nPornire 
		
		*** CREEZ CURSORUL INITIAL
		lcTitlu = Alltrim(This.cTitlu)
		lcTitluColoane = Alltrim(This.cTitlu_coloane)
		lcNumeColoane = Alltrim(This.cNume_coloane)
		lcWidthColoane = Alltrim(This.cWidth_coloane) && 9.11.2008
		
		lcSelect = Alltrim(This.cSelect)
		lcFiltru = Iif(!Empty(This.cFiltru),This.cFiltru + Iif(!Empty(This.cFiltruOriginal),[ AND ] + This.cFiltruOriginal, ''),This.cFiltruOriginal)+Iif(!Empty(This.cwhere),Iif(!Empty(This.cFiltruOriginal),[ AND ],[ ]) +Alltrim(This.cwhere),[])
		lcFiltruOriginal = Alltrim(This.cFiltruOriginal)+Iif(!Empty(This.cwhere),Iif(!Empty(This.cFiltruOriginal),[ AND ],[ ]) +Alltrim(This.cwhere),[])
		lcSchema = Alltrim(This.cSchema)
		lcMask = Alltrim(This.cMask)
		lcOrder = Alltrim(This.cOrder)
		llAfisare = .F.
		lcNumeCursor = This.cNumecursor
		lcNrColoane_check = Alltrim(This.cnrcoloane_check)
		llModParam = This.lmodparam
		lcGroup = Alltrim(This.cgroup)
		
		
		&& testez daca am de-a face cu coloane de tip checkbox
		llCuCheck =Iif(Empty(lcNrColoane_check),.F.,.T.)
		
		This.titlu.Caption = lcTitlu
		
		If Used(lcNumeCursor)
			Use In &lcNumeCursor
		Endif
		
		Private podecabaza
		podecabaza = ''
		
		gencursor('podecabaza',lcNumeCursor,lcSelect,lcFiltru,lcSchema,lcOrder,llAfisare,lcGroup,llModParam)
		podecabaza.ca_baza1.afisare()
		
		This.ocursor = podecabaza
		
		If Right(lcTitluColoane,1) # ','
			lcTitluColoane = lcTitluColoane + ','
		Endif
		If Left(lcTitluColoane,1) # ','
			lcTitluColoane = ',' + lcTitluColoane
		Endif
		If Right(lcNumeColoane ,1) # ';'
			lcNumeColoane = lcNumeColoane + ';'
		Endif
		If Left(lcNumeColoane ,1) # ';'
			lcNumeColoane = ';' + lcNumeColoane
		Endif
		If Right(lcMask,1) # ';' && am virgula in get_mask
			lcMask = lcMask + ';'
		Endif
		If Left(lcMask,1) # ';'
			lcMask = ';' + lcMask
		Endif
		If !Empty(lcWidthColoane) And Right(lcWidthColoane,1) # ';'
			lcWidthColoane = lcWidthColoane + ';'
		Endif
		If !Empty(lcWidthColoane) And Left(lcWidthColoane,1) # ';'
			lcWidthColoane = ';' + lcWidthColoane
		Endif
		
		If llNrOrd && mai adaug o coloana la inceput
			lcTitluColoane = ',' + lcTitluColoane
			lcNumeColoane = ';' + lcNumeColoane
			If !Empty(lcWidthColoane)
				lcWidthColoane = ';20' + lcWidthColoane
			Endif
			lcMask = ';[0]=' + lcMask
		Endif
		
		lnNrCols = Occurs(";",lcNumeColoane) - 1
		
		This._GRID1.RecordSource = lcNumeCursor
		This._GRID1.ColumnCount = lnNrCols
		
		Select (lcNumeCursor)
		
		For i=1 To lnNrCols
		*	this._grid1.AddColumn(i)
			lcTitluCol = Alltrim(Strextract(lcTitluColoane,[,],[,],i))
			lcControlCol = Alltrim(Strextract(lcNumeColoane,[;],[;],i))
			lcWidthCol = Alltrim(Strextract(lcWidthColoane,[;],[;],i))
			If llNrOrd And i = 1
				lcHeader = [this._grid1.column1.hEADER1.Caption = 'Nr.']
				&lcHeader
				This._GRID1.coLUMN1.ControlSource = ''
				If !Empty(lcWidthColoane)
					lcColumnWidth = [this._grID1.column] + Alltrim(Str(i))+ [.width = ] + lcWidthCol
					&lcColumnWidth
				Endif
				Loop
			Endif
		
			lcHeader = [this._grid1.column] + Alltrim(Str(i))+ [.hEADER1.Caption = '] + lcTitluCol + [']
			&lcHeader
			lcControlSource = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.ControlSource = '] + lcControlCol + [']
			&lcControlSource
			lcControlSource = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.ControlSource = '] + lcControlCol + [']
			&lcControlSource
			lcReadOnlyCol = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.ReadOnly = .t.]
			&lcReadOnlyCol
			lcMaskCol = Strextract(lcMask,[;],[;],i)
			lcMaskCol = Alltrim(Strextract(lcMaskCol,']='))
			If !Empty(lcMaskCol)
				lcInputmask = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.InputMask = '] + Evaluate(lcMaskCol) + [']
				&lcInputmask
			Endif
			If !Empty(lcWidthColoane)
				lcColumnWidth = [this._grID1.column] + Alltrim(Str(i))+ [.width = ] + lcWidthCol
				&lcColumnWidth
			Endif
		
			If Type(lcControlCol) = 'N'
				If Empty(lcMaskCol) && dc nu e configurat
					If Inlist(lcControlCol,"cantitate","cant_bax")
						lcInputmask = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.InputMask = '] + get_mask(12,4) + [']
					Else
						lcInputmask = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.InputMask = '] + get_mask(12,gnPA) + [']
					Endif
					&lcInputmask
				Endif
				lcAlignment = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.Alignment = 1]
				&lcAlignment
				If llCuCheck
		&& daca nr coloanei curente este in lista cNrColoane_check, atunci
		&& controlul curent al coloanei va fi un checkbox
					lcVerific = 'INLIST(' + Alltrim(Str(i)) + ',' +lcNrColoane_check + ')'
					lcEste = &lcVerific
					If lcEste
						lcAdaugCheck = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.AddObject('Check1',]+;
							['Checkbox')]
						&lcAdaugCheck
						lcControlCurent = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.CurrentControl = 'Check1']
						&lcControlCurent
						lcRemText = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.RemoveObject('Text1')]
						&lcRemText
						lcSparse = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Sparse = .f.]
						&lcSparse
						lcCaption = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Check1.caption = '']
						&lcCaption
						lcReadOnly = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.ReadOnly = .f.]
						&lcReadOnly
						lcAli = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Alignment = 2]
						&lcAli
						lcReadOnly_ch = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Check1.ReadOnly = .f.]
						&lcReadOnly_ch
						lcControlSource = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.ControlSource = '] + lcControlCol + [']
						&lcControlSource
						lcVisible = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.Check1.visible = .t.]
						&lcVisible
						lcWidth = [this._GRID1.coLUMN] + Alltrim(Str(i)) + [.width = 35]
						&lcWidth
					Endif
				Endif
			Else
				lcAlignment = [this._GRID1.coLUMN] + Alltrim(Str(i))+ [.Alignment = 0]
				&lcAlignment
			Endif
		Endfor
		
		* Replace default headers with custom one
		i=0
		For Each loColumn In This._GRID1.Columns
			i = i + 1
			With loColumn
				If !Empty(loColumn.ControlSource) ;
					AND (EMPTY(This.ccoloanepermise) OR (!EMPTY(This.ccoloanepermise) AND [,]+loColumn.ControlSource+[,]$[,]+This.ccoloanepermise+[,]))
					&&	conditia de pe randul doi am adaugat-o ca sa restrictionez coloanele dupa care se poate face ordonare 
					&&	ROAGEST v 2.1.19
		
		* Save default caption, color and font
		
					lcOldCaption   = loColumn.Header1.Caption
					lcOldFontName = loColumn.Header1.FontName
					lnOldForeColor = loColumn.Header1.ForeColor
					llOldFontUnderline = loColumn.Header1.FontUnderline
		
		* Name Header Obj after ControlSource
		
					lcControlSrc = loColumn.ControlSource
					lnControlSrc = Rat(".", lcControlSrc) + 1
					lcControlSrc = Substr(lcControlSrc, lnControlSrc)
		
		*	Metoda dupa care se face ordonarea relativa la grid
					lcMethodName = 'parent.corderby_assign'
					lcPropColOrder = 'parent.cOrder'
					lcPropSensOrder = 'parent.cAsc'
					llOldWordWrap = .F.
					lcPictureProp = 'parent.cpicture'
		
		* Remove old and create new header
		
					.RemoveObject("Header1")
					.AddObject("grh"+Alltrim(Str(i)), ;
						"PSHeader", ;
						lcOldCaption, lcOldFontName,lnOldForeColor,llOldFontUnderline,lcMethodName,lcControlSrc,llOldWordWrap,lcPictureProp)
		
		
					If Upper(Alltrim(lcControlSrc)) = Upper(Alltrim(lcOrder))
						lcCuloare = [locolumn.grh] + Alltrim(Str(i)) + [.forecolor = RGB(0,0,255)]
						&lcCuloare
						lcUnderline = [locolumn.grh] + Alltrim(Str(i)) + [.FontUnderline = .t.]
						&lcUnderline
					Endif
		
				Endif
			Endwith
		Endfor
		
		If llNrOrd
			This._GRID1.coLUMN1.ControlSource = [recno('] +lcNumeCursor + [')]
			This._GRID1.coLUMN1.InputMask = '99999'
		*This._GRID1.LockColumns = 1
		Endif
		
		This.schimba_criteriu(tlPastreazaCriteriu)
		Bindevent(This,"cOrder",This,"schimba_criteriu",1)
		If Empty(lcWidthColoane)
			This._GRID1.AutoFit
		Endif
		
		
	ENDPROC

	PROCEDURE Resize
		*!*	this._GRID1.Width = this.Width - 15
		*!*	this._GRID1.Height = this.Height - this._griD1.Top - 5
		
	ENDPROC

	PROCEDURE schimba_criteriu
		Lparameters tlPastreazaCriteriu
		Local llPastreazaCriteriu
		llPastreazaCriteriu = Iif(Empty(tlPastreazaCriteriu),.F.,tlPastreazaCriteriu)
		With This.cb_tx_cautare1
			lcValoare = .Text.Value
			Do Case
			Case Type(This.corder)='T'
				.criteriu.RowSource=[> = ,1,< = ,2, = ,3, # ,4, > ,5, < ,6]
				This.lvalid=.F.
				.Text.Enabled=.T.
				.Text.ResetToDefault("InputMask")
				If Type("lcValoare") <> 'T' Or !tlPastreazaCriteriu
					.Text.Value={// : :}
				Endif
			Case Type(This.corder)='D'
				.criteriu.RowSource=[> = ,1,< = ,2, = ,3, # ,4, > ,5, < ,6]
				This.lvalid=.F.
				.Text.Enabled=.T.
				.Text.ResetToDefault("InputMask")
				If Type("lcValoare") <> 'D' Or !tlPastreazaCriteriu
					.Text.Value={//}
				Endif
			Case Type(This.corder)='N'
				.criteriu.RowSource=[> = ,1,< = ,2, = ,3, # ,4, > ,5, < ,6]
				This.lvalid=.F.
				.Text.Enabled=.T.
				.Text.InputMask=get_mask(14,gnPa)
				If Type("lcValoare") <> 'N' Or !tlPastreazaCriteriu
					.Text.Value=0
				Endif
			Otherwise
				.criteriu.RowSource=[incepe cu...,1,este...,2,nu este...,3,contine...,4,nu contine...,5,toate,6]
				This.lvalid=.T.
				.Text.ResetToDefault("InputMask")
				If !tlPastreazaCriteriu
					.Text.Value=[]
				Endif
			Endcase
			.criteriu.Value = ALLTRIM(STR(this.nPornire)) && [1]
			.criteriu.Refresh()
		Endwith
		
	ENDPROC

	PROCEDURE Cb_tx_cautare1.Criteriu.Init
		this.Value = "1"
	ENDPROC

	PROCEDURE Cb_tx_cautare1.Criteriu.Valid
		If This.Parent.Parent.lvalid
			DoDefault()
		Endif
	ENDPROC

	PROCEDURE Cb_tx_cautare1.Text.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 13
			NODEFAULT 
			this.parent.Parent.do_cauta()
		ENDIF 
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_alege_banca 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="grdbanci" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdbanci.cAles.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdbanci.cAles._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdbanci.cBanca.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdbanci.cBanca.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdbanci.cCont.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdbanci.cCont.Text1" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		FontCharSet = 238
		Height = 150
		Name = "frm_alege_banca"
		Width = 430
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 432
		_SHAPE2.Height = 29
		_SHAPE2.Left = 395
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = -1
		_SHAPE2.Width = 37
		LB_TITLU_ALB_B121.Caption = "ALEGEȚI CONTURILE ȘI BĂNCILE"
		LB_TITLU_ALB_B121.FontBold = .T.
		LB_TITLU_ALB_B121.FontCharSet = 238
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 5
		BUT_TERMIN1.Left = 399
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 4
		BUT_TERMIN1.Top = 0
		Gridsort1.Left = 7
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 42
	*</PropValue>

	ADD OBJECT 'grdbanci' AS _grdbase WITH ;
		ColumnCount = 3, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 88, ;
		Left = 20, ;
		Name = "grdbanci", ;
		Panel = 1, ;
		RecordSource = "crsbanci", ;
		ScrollBars = 2, ;
		Top = 43, ;
		Width = 386, ;
		Column1.ControlSource = "ales", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cAles", ;
		Column1.Sparse = .F., ;
		Column1.Width = 26, ;
		Column2.ControlSource = "banca", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cBanca", ;
		Column2.Width = 168, ;
		Column3.ControlSource = "cont", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cCont", ;
		Column3.Width = 158
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdbanci.cAles._checkbox1' AS _checkbox WITH ;
		Alignment = 0, ;
		AutoSize = .F., ;
		Caption = "", ;
		Centered = .T., ;
		Left = 17, ;
		Name = "_checkbox1", ;
		Top = 28
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

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

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

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

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

	ADD OBJECT 'grdbanci.cCont.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE inainte_de_do_termin
		Local llReturn,lnRecno,lnAlese
		Store .T. To llReturn
		Select crsbanci
		lnRecno = Recno()
		Calculate Cnt() For ales = 1 To lnAlese
		If lnAlese = 0
			Go lnRecno
			amessagebox("Trebuie sa alegeti cel putin o banca si un cont!",48,"Atentie")
			Thisform.grdbanci.SetFocus()
			llReturn = .F.
		Endif
		Return llReturn
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_alege_optlistfact 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="ck_optiune1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_optiune2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_optiune3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_optiune4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_optiune5" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		FontCharSet = 238
		Height = 150
		Name = "frm_alege_optlistfact"
		Width = 430
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 432
		_SHAPE2.Height = 29
		_SHAPE2.Left = 395
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = -1
		_SHAPE2.Width = 37
		LB_TITLU_ALB_B121.Caption = "OPȚIUNI DE LISTARE"
		LB_TITLU_ALB_B121.FontBold = .T.
		LB_TITLU_ALB_B121.FontCharSet = 238
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 7
		BUT_TERMIN1.Left = 399
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 6
		BUT_TERMIN1.Top = 0
		Gridsort1.Left = 5
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 33
	*</PropValue>

	ADD OBJECT 'ck_optiune1' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Se imprimă serii/loturi pe factură / aviz.", ;
		ControlSource = "poDate.listare_serii", ;
		Height = 18, ;
		Left = 28, ;
		Name = "ck_optiune1", ;
		TabIndex = 1, ;
		Top = 41, ;
		Width = 244
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_optiune2' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Se imprimă componența seturilor pe factură / aviz / proformă.", ;
		ControlSource = "poDate.listare_componenta_set", ;
		Left = 28, ;
		Name = "ck_optiune2", ;
		TabIndex = 2, ;
		Top = 61, ;
		Width = 371
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_optiune3' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Se imprimă recapitulația.", ;
		ControlSource = "poDate.listare_recapitulatie", ;
		Left = 28, ;
		Name = "ck_optiune3", ;
		TabIndex = 3, ;
		Top = 80, ;
		Width = 163
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_optiune4' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Se imprimă lista de livrare.", ;
		ControlSource = "poDate.listare_lista_livrare", ;
		Left = 28, ;
		Name = "ck_optiune4", ;
		TabIndex = 4, ;
		Top = 99, ;
		Width = 172
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_optiune5' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Se imprimă componența seturilor pe lista de livrare.", ;
		ControlSource = "poDate.listare_componenta_set_ll", ;
		Left = 28, ;
		Name = "ck_optiune5", ;
		TabIndex = 5, ;
		Top = 118, ;
		Width = 315
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />
	
	PROCEDURE Init
		DoDefault()
		lnHeight = Thisform.Height
		If poDate.listare_lista_livrare	<> 0
			If poDate.listare_componenta_set_ll = 0
				Thisform.ck_optiune5.Visible = .F.
				lnHeight = lnHeight - Thisform.ck_optiune5.Height
			Endif
			If poDate.listare_componenta_set = 0 And poDate.listare_recapitulatie = 0
				If poDate.listare_serii = 0
					Thisform.ck_optiune5.Top = thisform.ck_optiune2.top
					Thisform.ck_optiune4.Top = Thisform.ck_optiune1.Top
				Else
					Thisform.ck_optiune5.Top = thisform.ck_optiune3.top
					Thisform.ck_optiune4.Top = Thisform.ck_optiune2.Top
				Endif
			Else
				If poDate.listare_serii = 0
					Thisform.ck_optiune5.Top = thisform.ck_optiune4.top
					Thisform.ck_optiune4.Top = Thisform.ck_optiune3.Top
				Endif
			Endif
		Else
			Thisform.ck_optiune4.Visible = .F.
			Thisform.ck_optiune5.Visible = .F.
			lnHeight = lnHeight - Thisform.ck_optiune4.Height * 2
		Endif
		
		If poDate.listare_componenta_set = 0 And poDate.listare_recapitulatie = 0
			Thisform.ck_optiune2.Visible = .F.
			Thisform.ck_optiune3.Visible = .F.
			lnHeight = lnHeight - Thisform.ck_optiune2.Height * 2
		Else
			If poDate.listare_serii = 0
				Thisform.ck_optiune3.Top = Thisform.ck_optiune2.Top
				Thisform.ck_optiune2.Top = Thisform.ck_optiune1.Top
			Endif
		Endif
		
		If poDate.listare_serii = 0
			Thisform.ck_optiune1.Visible = .F.
			lnHeight = lnHeight - Thisform.ck_optiune1.Height
		Endif
		
		Thisform.Height = lnHeight
		Thisform.Refresh()
	ENDPROC

	PROCEDURE ck_optiune4.InteractiveChange
		If This.Value = 0
			Thisform.ck_optiune5.Value = 0
			Thisform.ck_optiune5.Enabled = .F.
		Else
			Thisform.ck_optiune5.Enabled = .T.
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_alte_date 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="_shape4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="shpTipFactura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_delegat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_masina" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_agent" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ed_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_incasat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_incasat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nrchit" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie_chit" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_dataora_exp" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkPOS" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkDetaliat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdModificaBon" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="LB_SIMPLU1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_adresa_facturare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_casa" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cboTipFactura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblTipFactura" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: actualizeaza_tipincasare
		*m: do_aloca_nr_bon
		*m: do_aloca_nr_pos
		*m: do_cauta_adresa
		*m: do_cauta_agent
		*m: do_cauta_delegat
		*m: do_cauta_masina
		*m: do_modifica_bon		&& modifica seria bonuri fiscale
		*m: do_modifica_pos
		*p: nid
		*p: nnrbon		&& numar bon fiscal
		*p: nrezultatserii
		*p: orec
		*p: tdataora_exp
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 3
		Caption = "Form"
		DoCreate = .T.
		Height = 299
		lactiv3 = .T.
		Name = "frm_alte_date"
		nnrbon = 0
		nrezultatserii = 0
		tdataora_exp = {}
		Width = 405
		_memberdata = <VFPData>
			<memberdata name="nrezultatserii" display="nRezultatSerii"/>
		</VFPData>
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 407
		_shape1.ZOrderSet = 3
		_shape2.Height = 29
		_shape2.Left = 343
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 64
		_shape2.ZOrderSet = 4
		Lb_titlu_alb_b121.Caption = "DETALII DELEGAT / MAȘINA"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 18
		Lb_titlu_alb_b121.ZOrderSet = 5
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Left = 375
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 10
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 6
		GRIDSORT1.Left = 41
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 29
	*</PropValue>

	ADD OBJECT '_checkbox1' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 0, ;
		AutoSize = .T., ;
		Caption = "Listare detaliata", ;
		ControlSource = "poDate.nListareDetaliata", ;
		Left = 53, ;
		Name = "_checkbox1", ;
		TabIndex = 7, ;
		ToolTipText = "Se listeaza articolele detaliat pe factura sau se cumuleaza cantitatea pe articole", ;
		Top = 253, ;
		ZOrderSet = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT '_shape3' AS _shape WITH ;
		Anchor = 0, ;
		BackColor = 255,255,255, ;
		Height = 138, ;
		Left = 19, ;
		Name = "_shape3", ;
		Top = 306, ;
		Visible = .F., ;
		Width = 371, ;
		ZOrderSet = 2
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_shape4' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 25, ;
		Left = 178, ;
		Name = "_shape4", ;
		Top = 250, ;
		Width = 218, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="..\..\..\roagest\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		Left = 11, ;
		Name = "But_modifica1", ;
		TabIndex = 13, ;
		TabStop = .F., ;
		Top = 59, ;
		Visible = .T., ;
		ZOrderSet = 18
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

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

	ADD OBJECT 'Cb_casa' AS cb_tx_simplu WITH ;
		Anchor = 0, ;
		Left = 36, ;
		Name = "Cb_casa", ;
		TabIndex = 17, ;
		Top = 404, ;
		Visible = .F., ;
		Width = 314, ;
		ZOrderSet = 25, ;
		_CBBASE1.Left = 126, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.Top = 3, ;
		_LBBASE1.Caption = "Casa", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'cboTipFactura' AS _combobox WITH ;
		BoundColumn = 2, ;
		BoundTo = .T., ;
		ColumnCount = 1, ;
		ColumnLines = .F., ;
		ColumnWidths = "150", ;
		ControlSource = "poDate.tip_saft", ;
		Height = 24, ;
		Left = 250, ;
		Name = "cboTipFactura", ;
		RowSource = "select tip_saftname, cod from saft_tip_facturi into cursor cTipFacturaX", ;
		RowSourceType = 3, ;
		TabIndex = 8, ;
		Top = 250, ;
		Width = 142, ;
		ZOrderSet = 26
		*< END OBJECT: ClassLib="..\..\..\roagest\comun\clase\_baza.vcx" BaseClass="combobox" />

	ADD OBJECT 'chkDetaliat' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 0, ;
		Caption = "Detaliat", ;
		ControlSource = "poDate.nBonDetaliat", ;
		Left = 323, ;
		Name = "chkDetaliat", ;
		TabIndex = 21, ;
		ToolTipText = 'Se listeaza articolele detaliat pe bonul fiscal sau "Contravaloare factura ..."', ;
		Top = 356, ;
		ZOrderSet = 20
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'chkPOS' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 0, ;
		Caption = "POS", ;
		ControlSource = "poDate.nIncasatPos", ;
		Left = 272, ;
		Name = "chkPOS", ;
		TabIndex = 19, ;
		ToolTipText = "Incasare bon fiscal prin CARD la POS", ;
		Top = 356, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'clb_adresa_facturare' AS ct_clb_cautare WITH ;
		Anchor = 0, ;
		cconditie = 1=2, ;
		cprocedura = thisform.do_cauta_adresa, ;
		cvar_afisata = poDate.adresa_facturare, ;
		Height = 31, ;
		Left = 44, ;
		Name = "clb_adresa_facturare", ;
		TabIndex = 5, ;
		Top = 193, ;
		Width = 350, ;
		ZOrderSet = 23, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Adresa facturare", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Left = 133, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Width = 177
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_dataora_exp' AS clb_tx_simplu WITH ;
		Anchor = 0, ;
		Left = 45, ;
		Name = "Clb_dataora_exp", ;
		TabIndex = 6, ;
		Top = 222, ;
		Width = 314, ;
		ZOrderSet = 17, ;
		Text_simplu1.ControlSource = "poDate.dataora_exp", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 133, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 177, ;
		Lb_simplu1.Caption = "Data și ora expedierii", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_incasat' AS clb_tx_simplu WITH ;
		Anchor = 0, ;
		Left = 36, ;
		Name = "Clb_incasat", ;
		TabIndex = 16, ;
		Top = 376, ;
		Visible = .F., ;
		Width = 314, ;
		ZOrderSet = 13, ;
		Text_simplu1.ControlSource = "poDate.incasat", ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Lb_simplu1.Caption = "Încasat", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_nrchit' AS clb_tx_simplu WITH ;
		Anchor = 0, ;
		Height = 29, ;
		Left = 36, ;
		Name = "Clb_nrchit", ;
		TabIndex = 15, ;
		Top = 348, ;
		Visible = .F., ;
		Width = 232, ;
		ZOrderSet = 15, ;
		Text_simplu1.ControlSource = "poDate.nr_incasare", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = (get_mask(14,0)), ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 101, ;
		Lb_simplu1.Caption = "Nr. chitanta", ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_serie_chit' AS clb_serie_act WITH ;
		Anchor = 0, ;
		cvariabila = serie_chit, ;
		cvariabiladoc = nr_incasare, ;
		Left = 36, ;
		Name = "Clb_serie_chit", ;
		nid_tipdoc = 16, ;
		pcobj = poDate, ;
		TabIndex = 12, ;
		Top = 320, ;
		Visible = .F., ;
		Width = 314, ;
		ZOrderSet = 16, ;
		Text_simplu1.ControlSource = "poDate.serie_act", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.TabIndex = 2, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.TabIndex = 1, ;
		_lbbase1.Caption = "Serie chitanta", ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.TabIndex = 3
		*< END OBJECT: ClassLib="serii_numere.vcx" BaseClass="container" />

	ADD OBJECT 'cmdModificaBon' AS but_modifica WITH ;
		Anchor = 0, ;
		caction = do_modifica_bon, ;
		Left = 353, ;
		Name = "cmdModificaBon", ;
		TabIndex = 22, ;
		TabStop = .F., ;
		Top = 320, ;
		ZOrderSet = 21
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ct_clb_agent' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		cprocedura = thisform.do_cauta_agent, ;
		cvar_afisata = poDate.nume_agent, ;
		Left = 44, ;
		Name = "Ct_clb_agent", ;
		TabIndex = 1, ;
		Top = 30, ;
		ZOrderSet = 11, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.Lb_simplu1.Caption = "Agent", ;
		CLB_TX_CAUTARE.Lb_simplu1.Name = "Lb_simplu1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.Text_simplu1.Name = "Text_simplu1"
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_delegat' AS ct_clb_cautare WITH ;
		cconditie = ISNULL(poDate.id_delegat), ;
		cprocedura = thisform.do_cauta_delegat, ;
		cvar_afisata = poDate.nume_delegat, ;
		Left = 44, ;
		Name = "Ct_clb_delegat", ;
		TabIndex = 2, ;
		Top = 58, ;
		ZOrderSet = 9, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Delegat", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1"
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_masina' AS ct_clb_cautare WITH ;
		cconditie = empty(NVL(poDate.nrinmat,0)), ;
		cprocedura = thisform.do_cauta_masina, ;
		cvar_afisata = poDate.nrinmat, ;
		Left = 44, ;
		Name = "Ct_clb_masina", ;
		TabIndex = 3, ;
		Top = 86, ;
		ZOrderSet = 10, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Mașina", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1"
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ed_tx_simplu1' AS ed_tx_simplu WITH ;
		Anchor = 10, ;
		Height = 80, ;
		Left = 45, ;
		Name = "Ed_tx_simplu1", ;
		TabIndex = 4, ;
		Top = 115, ;
		Width = 350, ;
		ZOrderSet = 12, ;
		_EDBASE1.Anchor = 10, ;
		_EDBASE1.ControlSource = "poDate.text_aditional", ;
		_EDBASE1.Format = "!", ;
		_EDBASE1.Height = 60, ;
		_EDBASE1.Left = 3, ;
		_EDBASE1.MaxLength = 1000, ;
		_EDBASE1.Name = "_EDBASE1", ;
		_EDBASE1.TabStop = .F., ;
		_EDBASE1.Top = 17, ;
		_EDBASE1.Width = 342, ;
		_LBBASE1.AutoSize = .T., ;
		_LBBASE1.Caption = "Text aditional (max. 1000 caractere)", ;
		_LBBASE1.Height = 18, ;
		_LBBASE1.Left = 8, ;
		_LBBASE1.Name = "_LBBASE1", ;
		_LBBASE1.Top = 1, ;
		_LBBASE1.Width = 210, ;
		_LBBASE1.WordWrap = .F.
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'LB_SIMPLU1' AS lb_simplu WITH ;
		Anchor = 0, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Detalii încasare", ;
		Left = 29, ;
		Name = "LB_SIMPLU1", ;
		TabIndex = 20, ;
		Top = 299, ;
		Visible = .F., ;
		ZOrderSet = 22
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lblTipFactura' AS _label WITH ;
		Caption = "Tip factura", ;
		Height = 18, ;
		Left = 182, ;
		Name = "lblTipFactura", ;
		TabIndex = 14, ;
		Top = 254, ;
		Width = 62, ;
		ZOrderSet = 27
		*< END OBJECT: ClassLib="..\..\..\roagest\comun\clase\_baza.vcx" BaseClass="label" />

	ADD OBJECT 'opt_incasat' AS _optiongrup WITH ;
		Anchor = 0, ;
		AutoSize = .F., ;
		ButtonCount = 4, ;
		Height = 26, ;
		Left = 44, ;
		Name = "opt_incasat", ;
		TabIndex = 9, ;
		Top = 273, ;
		Value = 1, ;
		Width = 352, ;
		ZOrderSet = 14, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Fara încasare", ;
		Option1.FontCharSet = 238, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.TabIndex = 1, ;
		Option1.Top = 6, ;
		Option1.Value = 1, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Chitanta", ;
		Option2.FontCharSet = 238, ;
		Option2.Left = 108, ;
		Option2.Name = "Option2", ;
		Option2.TabIndex = 2, ;
		Option2.Top = 6, ;
		Option2.Value = 0, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Bon fiscal", ;
		Option3.Height = 17, ;
		Option3.Left = 186, ;
		Option3.Name = "Option3", ;
		Option3.TabIndex = 3, ;
		Option3.Top = 6, ;
		Option3.Value = 0, ;
		Option3.Width = 72, ;
		Option4.AutoSize = .T., ;
		Option4.BackStyle = 0, ;
		Option4.Caption = "POS Card", ;
		Option4.Height = 17, ;
		Option4.Left = 274, ;
		Option4.Name = "Option4", ;
		Option4.TabIndex = 4, ;
		Option4.ToolTipText = "Se foloseste la emitere factura incasata prin POS/Card. Este echivalenta cu o incasare prin banca. Nu se listeaza la casa de marcat, spre deosebire de Bon fiscal.", ;
		Option4.Top = 6, ;
		Option4.Width = 73
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'shpTipFactura' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 25, ;
		Left = 45, ;
		Name = "shpTipFactura", ;
		Top = 250, ;
		Width = 134, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="..\..\..\roagest\comun\clase\_baza.vcx" BaseClass="shape" />
	
	PROCEDURE actualizeaza_tipincasare
		*!* 07.01.2014
		*!* marius.mutu
		*!* adaugat optiunea bon fiscal
		poDate.tip_saft = 380 && factura initiala
		Thisform.cboTipFactura.Refresh()
		
		Do Case
			Case This.opt_incasat.Value=1 && Fara incasare
				poGeneratorNumere.dezaloca_numar(16) && dezaloc numar chitanta
				poGeneratorNumere.dezaloca_numar(3) && dezaloc numar bon fiscal	
				poGeneratorNumere.dezaloca_numar(26) && dezaloc numar POS/Card
				
				Thisform.Height = 300
				Thisform.cb_casa.Visible=.F.
				Thisform.clb_serie_chit.Visible = .F.
				Thisform.clb_nrchit.Visible=.F.
				Thisform.clb_incasat.Visible=.F.
				Thisform._shape3.Visible=.F.
				Thisform.lb_simplu1.Visible=.F.
				Thisform.cmdModificaBon.Visible=.F. && modifica nr bon fiscal
				Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
				Thisform.nnrbon = 0
				poDate.nr_incasare = 0
				poDate.incasat = 0
				Thisform.clb_serie_chit.Refresh()
				Thisform.clb_nrchit.Refresh()
				Thisform.clb_incasat.Refresh()
			
				thisform.chkPOS.Value = 0
				thisform.chkDetaliat.Value = 0
				thisform.chkPOS.Visible = .F.		
				thisform.chkDetaliat.Visible = .F.		
				*!*	Case This.Value=2
				*!*		Thisform.cb_casa.Visible=.T.
				*!*		Thisform.clb_nrchit.Visible=.T.
				*!*		Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. bon]
				*!*		Thisform.clb_incasat.Visible=.T.
				*!*		Thisform._shape3.Visible=.T.
				*!*		Thisform.lb_simplu1.Visible=.T.
				*!*		Thisform.lactiv3=.T.
				*!*		Thisform.but_modifica1.Visible=.T.
				*!*		Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
				*!*		Thisform.do_aloca_nr_bon([CLICK])
			Case This.opt_incasat.Value = 2 && chitanta
				poGeneratorNumere.dezaloca_numar(3) && dezaloc numar bon fiscal
				poGeneratorNumere.dezaloca_numar(16) && dezaloc numar chitanta
				poGeneratorNumere.dezaloca_numar(26) && dezaloc numar POS/Card		
				
				If Thisform.nRezultatSerii = 0
					Thisform.nRezultatSerii = poGeneratorNumere.creeaza_cursor_serii(16) && 1 = CU SERIE, 2 = FARA SERIE CU PLAJE, 3 = CU SERIE SI PLAJE
					Thisform.clb_serie_chit.do_initializeaza(Thisform.nRezultatSerii)
					*!*	modificare v 2.0.84
					If !Empty(Nvl(poDate.serie_act,[]))
						*!*	modificare v 2.0.88
						If Thisform.nRezultatSerii <> 1
						*!*	modificare v 2.0.88	^
							Select (Thisform.clb_serie_chit._cbbase1.RowSource)
							Locate For Alltrim(serie) = Alltrim(poDate.serie_act)
							If !Found()
								Go Top
							Endif
							Thisform.clb_serie_chit._cbbase1.Value = Alltrim(serie)
						*!*	modificare v 2.0.88
						Endif
						*!*	modificare v 2.0.88	^
					Endif
					*!*	modificare v 2.0.84	^
				Endif
				Thisform.Height = 450
				Thisform.cb_casa.Visible=.T.
				Thisform.clb_serie_chit.Visible = .T.
				Thisform.clb_nrchit.Visible=.T.
				Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. chitanta]
				Thisform.clb_incasat.Visible=.T.
				Thisform._shape3.Visible=.T.
				Thisform.lb_simplu1.Visible=.T.
				Thisform.cmdModificaBon.Visible=.F. && modifica nr bon fiscal		
				Thisform.clb_nrchit.text_simplu1.ReadOnly = .F.
				Thisform.nnrbon = 0		
				poDate.nr_incasare = 0		
				poDate.incasat = poDate.totalctva
				Thisform.clb_serie_chit.Refresh()
				Thisform.clb_nrchit.Refresh()
				Thisform.clb_incasat.Refresh()
				Thisform.clb_serie_chit.genereazaNumar()
				thisform.chkPOS.Value = 0
				thisform.chkPOS.Visible = .F.		
				thisform.chkDetaliat.Value = 0
				thisform.chkDetaliat.Visible = .F.
								
			Case This.opt_incasat.Value = 3 && Bon fiscal
		
				poGeneratorNumere.dezaloca_numar(3) && dezaloc numar bon fiscal
				poGeneratorNumere.dezaloca_numar(16) && dezaloc numar chitanta
				poGeneratorNumere.dezaloca_numar(26) && dezaloc numar POS/Card		
			
				Thisform.Height = 450
				Thisform.cb_casa.Visible=.T.
				Thisform.clb_serie_chit.Visible = .F.
				Thisform.clb_nrchit.Visible=.T.
				Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. bon]
				Thisform.clb_incasat.Visible=.T.
				Thisform._shape3.Visible=.T.
				Thisform.lb_simplu1.Visible=.T.
				Thisform.cmdModificaBon.Visible=.T. && modifica nr bon fiscal		
				Thisform.clb_nrchit.text_simplu1.ReadOnly = .T.
				Thisform.nnrbon = 0
				poDate.nr_incasare = 0		
				Thisform.do_aloca_nr_bon([CLICK])				
				poDate.incasat = poDate.totalctva
				Thisform.clb_serie_chit.Refresh()
				Thisform.clb_nrchit.Refresh()
				Thisform.clb_incasat.Refresh()
		
				thisform.chkPOS.Value = 0
				thisform.chkPOS.Visible = .T.		
				thisform.chkDetaliat.Value = 0
				thisform.chkDetaliat.Visible = .T.
		
				* Daca initializez vanzari.tip_saft cu cod 751 (factura in scop informativ) in loc de 380 (factura initiala)
				* pentru facturile incasate cu bon fiscal, initializez cu tip 751 ca sa nu apara duplicate in decontul TVA precompletat
				IF TYPE('gnEFactura_tip_saft_bf') = 'N' AND !EMPTY(NVL(m.gnEFactura_tip_saft_bf, 0))
					poDate.tip_saft = m.gnEFactura_tip_saft_bf && 751/380
					Thisform.cboTipFactura.Refresh()
				ENDIF 		
		
			Case This.opt_incasat.Value = 4 && POS/Card
		
				poGeneratorNumere.dezaloca_numar(3) && dezaloc numar bon fiscal
				poGeneratorNumere.dezaloca_numar(16) && dezaloc numar chitanta
				poGeneratorNumere.dezaloca_numar(26) && dezaloc numar POS/Card		
			
				Thisform.Height = 450
				Thisform.cb_casa.Visible=.T.
				Thisform.clb_serie_chit.Visible = .F.
				Thisform.clb_nrchit.Visible=.T.
				Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. bon]
				Thisform.clb_incasat.Visible=.T.
				Thisform._shape3.Visible=.T.
				Thisform.lb_simplu1.Visible=.T.
				Thisform.cmdModificaBon.Visible=.T. && modifica nr bon fiscal		
				Thisform.clb_nrchit.text_simplu1.ReadOnly = .T.
				thisform.cb_casa._lbbase1.Caption = 'Banca POS'		
				Thisform.nnrbon = 0
				poDate.nr_incasare = 0		
				Thisform.do_aloca_nr_pos([CLICK])				
				poDate.incasat = poDate.totalctva
				Thisform.clb_serie_chit.Refresh()
				Thisform.clb_nrchit.Refresh()
				Thisform.clb_incasat.Refresh()
		
				thisform.chkPOS.Value = 1
				thisform.chkPOS.Visible = .F.		
				thisform.chkDetaliat.Value = 0
				thisform.chkDetaliat.Visible = .F.
				
		Endcase
	ENDPROC

	PROCEDURE Destroy
		If Used('v_nom_casa')
			Use In v_nom_casa
		Endif
	ENDPROC

	PROCEDURE do_aloca_nr_bon
		Lparameters tcActiune
		Local lnNumarBon
		Store -1 To lnNumarBon
		
		If Empty(Thisform.nnrbon) Or Upper(tcActiune)='UPDATE'
		*!*		lnNumarBon = aloca_numar_bf()	&&	in oserii_numere.prg
			poGeneratorNumere.creeaza_cursor_serii(3)
			lnNumarBon = poGeneratorNumere.aloca_numar(3)
			If lnNumarBon <> -1
				Thisform.clb_nrchit.text_simplu1.Value = lnNumarBon
				Thisform.nnrbon = lnNumarBon
				poDate.nr_incasare = Thisform.nnrbon
			Endif
		Else
			poDate.nr_incasare = Thisform.nnrbon	
		ENDIF
		Thisform.clb_nrchit.text_simplu1.Refresh()	
	ENDPROC

	PROCEDURE do_aloca_nr_pos
		Lparameters tcActiune
		Local lnNumarBon
		Store -1 To lnNumarBon
		
		If Empty(Thisform.nnrbon) Or Upper(tcActiune)='UPDATE'
			poGeneratorNumere.creeaza_cursor_serii(26)
			lnNumarBon = poGeneratorNumere.aloca_numar(26)
			If lnNumarBon <> -1
				Thisform.clb_nrchit.text_simplu1.Value = lnNumarBon
				Thisform.nnrbon = lnNumarBon
				poDate.nr_incasare = Thisform.nnrbon
			Endif
		Else
			poDate.nr_incasare = Thisform.nnrbon	
		ENDIF
		Thisform.clb_nrchit.text_simplu1.Refresh()	
	ENDPROC

	PROCEDURE do_cauta_adresa
		Local locauta
		locauta = caut_adresa(poDate.id_client)
		IF ISNULL(loCauta)
			RETURN
		ENDIF
		If !Empty(locauta.id_adresa)
			poDate.adresa_facturare = Alltrim(locauta.adresa)
			poDate.id_facturare = locauta.id_adresa
		
			Thisform.clb_adresa_facturare.Refresh()
			Thisform.clb_dataora_exp.SetFocus()
		Else
			poDate.adresa_facturare = []
			poDate.id_facturare = Null
		ENDIF
	ENDPROC

	PROCEDURE do_cauta_agent
		Local loCauta
		loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Agenti??cTipuriParteneri=>]+Alltrim(Str(gnIdTipAgenti))+[??lAdaugCorespondente=>1]))
		If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
			poDate.id_agent = loCauta.id_part
			poDate.nume_agent = Alltrim(loCauta.denumire)
			Thisform.ct_clb_agent.Refresh()
		*!*	modificare ROAFACTURARE	v 2.0.67	^
		*!*		Thisform.ct_clb_delegat.SetFocus()
			If poDate.eProforma = 0
				Thisform.ct_clb_delegat.SetFocus()
			Else
				Thisform.ed_tx_simplu1.SetFocus()
			Endif
		*!*	modificare ROAFACTURARE	v 2.0.67	^
		Else
			poDate.id_agent = Null
			poDate.nume_agent = []
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_delegat
		Local loCauta
		If Inlist(poDate.tip,23,25,27,30,41,-6)
			loCauta=caut_delegati()
		Else
		*!*	modificare	ROAFACTURARE v 2.0.27
		*!*	loCauta=caut_delegati(poDate.id_client)
			loCauta=caut_delegati_hash(poDate.id_client,.T.)
		*!*	modificare	ROAFACTURARE v 2.0.27	^
		Endif
		If !Empty(loCauta.id_responsabil)
			poDate.id_delegat = loCauta.id_responsabil
			poDate.nume_delegat = Alltrim(loCauta.nume)
			poDate.BIdelegat = loCauta.bi
			poDate.CNPdelegat =	loCauta.cnp
		*!*		lcBi = Strtran(loCauta.bi,[ ],[])
		*!*		poDate.serie_bi = Substr(lcBi,1,2)
		*!*		poDate.numar_bi = Alltrim(Substr(lcBi,3))
		*!*		poDate.eliberatde = Alltrim(poDate.eliberatde)
			Thisform.ct_clb_delegat.Refresh()
			Thisform.ct_clb_masina.SetFocus()
		Else
			poDate.id_delegat = Null
			poDate.nume_delegat = []
			poDate.BIdelegat = []
			poDate.CNPdelegat = []
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_masina
		locauta=caut_masina_gs()
		If !Empty(locauta.id_masina)
			poDate.nrinmat = Alltrim(locauta.nrinmat)
			poDate.id_masina = locauta.id_masina
		
			Thisform.ct_clb_masina.Refresh()
			Thisform.ed_tx_simplu1.SetFocus()
		Else
			poDate.nrinmat = []
			poDate.id_masina = Null
		Endif
		
	ENDPROC

	PROCEDURE do_modifica
		If !Empty(Nvl(poDate.id_delegat,0))
			loRec = nom_parteneri_modifica(poDate.id_delegat)
			If !Isnull(loRec)
				poDate.nume_delegat = Alltrim(loRec.denumire)
				poDate.BIdelegat = loRec.reg_comert
				poDate.CNPdelegat = loRec.cod_fiscal
				Thisform.Refresh()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_modifica_bon		&& modifica seria bonuri fiscale
		Private pniesire
		pniesire=0
		DO viz_config_serii_complet WITH 3 IN oserii_numere.prg
		If pniesire=1
		*!*		dezaloca_numar_bf()
			poGeneratorNumere.dezaloca_numar(3)
			Thisform.do_aloca_nr_bon([UPDATE])
		Endif
	ENDPROC

	PROCEDURE do_modifica_pos
		Private pniesire
		pniesire=0
		DO viz_config_serii_complet WITH 26 IN oserii_numere.prg
		If pniesire=1
		*!*		dezaloca_numar_bf()
			poGeneratorNumere.dezaloca_numar(26)
			Thisform.do_aloca_nr_pos([UPDATE])
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		If Type('poGeneratorNumere') = 'O'
			poGeneratorNumere.dezaloca_numar(16)
			poGeneratorNumere.dezaloca_numar(3)
			
			Thisform.nnrbon = 0
			poDate.nr_incasare = 0
			poDate.incasat = 0	
		ENDIF 
		
		If Type('poGeneratorNumere') = 'O' And This.opt_incasat.Value = 2 And Thisform.nRezultatSerii <> 0
			poGeneratorNumere.dezaloca_numar(16)
		Endif
		*!*	modificare ROACONTRACTE v 2.0.38
		If poDate.tip = 2 And poDate.afisare_scadenta = 0 And At([Scadenta la ],poDate.text_aditional) <> 0
			poDate.text_aditional = Strtran(poDate.text_aditional,[Scadenta la ] + Alltrim(Str(poDate.datascad - poDate.dataact)) + [ zile.],[])
		Endif
		*!*	modificare ROACONTRACTE v 2.0.38	^
		Return .T.
	ENDPROC

	PROCEDURE inainte_de_do_termin
		*!* 08.01.2015
		*!* marius.mutu
		*!*	completare poDate.ntip_incasare cu 3 (bon fiscal)
		
		*!* 14.07.2016
		*!* marius.mutu
		*!* nu se cere delegatul la BON FISCAL SI PROFORMA
		
		*!* 22.11.2021
		*!* marius.mutu
		*!*	completare poDate.ntip_incasare cu 4 (POS/Card)
		
		Local plReturn
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		poDate.ntip_incasare = Iif(Thisform.opt_incasat.Value=2, 11, IIF(Thisform.opt_incasat.Value = 3, 2, IIF(Thisform.opt_incasat.Value = 4, 3, 0)))	&&	modificare ROAFACTURARE v 2.0.84
		Do Case
				*!*	Case Empty(poDate.id_agent)
				*!*		amessagebox('Nu ati ales agentul!',0+48,"Atentie")
				*!*		Thisform.ct_clb_agent.SetFocus()
				*!*		plReturn=.F.
			Case Empty(Nvl(poDate.id_delegat,0)) And gcNumeProgram = [ROAFACTURARE] And !(poDate.eProforma = 1 OR poDate.eBonFiscal = 1)	&&  modificare ROAFACTURARE v 2.0.67 : am adaugat poDate.eProforma
				amessagebox('Nu ati ales delegatul!',0+48,"Atentie")
				Thisform.ct_clb_delegat.SetFocus()
				plReturn=.F.
				*!*	modificare	ROAFACTURARE v 2.0.80
			Case Empty(Nvl(poDate.dataora_exp,{})) And poDate.eProforma = 0 And gcNumeProgram = [ROAFACTURARE]
				amessagebox("Nu ati scris data si ora expedierii!",0+48,"Atentie")
				poDate.dataora_exp = This.tdataora_exp
				Thisform.clb_dataora_exp.SetFocus()
				plReturn = .F.
				*!*	modificare	ROAFACTURARE v 2.0.80	^
			Case Thisform.opt_incasat.Value = 2 And poDate.incasat > poDate.totalctva
				amessagebox('Suma incasata nu poate fi mai mare decat valoarea facturii!',0+48,"Atentie")
				Thisform.clb_incasat.SetFocus()
				*!*	Case Empty(poDate.id_masina)
				*!*		amessagebox('Nu ati ales masina!',0+48,"Atentie")
				*!*		Thisform.ct_clb_masina.SetFocus()
				*!*		plReturn=.F.
				*!*	modificare ROAFACTURARE v 2.0.84
			Case Ttod(poDate.dataora_exp)<poDate.dataact
				amessagebox('Data expedierii nu poate fi mai mica decat data documentului!',0+48,"Atentie")
				Thisform.clb_dataora_exp.SetFocus()
				*!*	modificare ROAFACTURARE v 2.0.84	^
			Otherwise
				plReturn=.T.
		ENDCASE
		IF m.plReturn
			IF poDate.nIncasatPos = 1
				poDate.incasatCARD = poDate.incasat && incasat card
				poDate.incasat = 0 && incasat numerar
			ENDIF 
		ENDIF 
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		DoDefault()
		Thisform.tdataora_exp = poDate.dataora_exp
		*!*	modificare ROAFACTURARE	v 2.0.67
		If poDate.eProforma = 0
			*!*	modificare ROAFACTURARE	v 2.0.67	^
			If Empty(Nvl(poDate.id_delegat,0)) And Empty(Nvl(poDate.id_masina,0))
				poDate.id_delegat = 0
				poDate.id_masina = 0
		
				*!* 09.06.2008
				*!* la avizele de transfer intre subunitati nu am client, dar am corespondenta gestiune - partener (trebuie sa fie completata)
				*!*	modificare ROAFACTURARE v 2.0.66 : am adaugat poDate.cnpdelegat
				If Inlist(poDate.tip,23,25,27,30,41)
					lcSql = [begin ] + gcS + [.pack_facturare.cauta_date_ultima_factura_tip(?poDate.tip,] + ;
						[?gnIdSucursala,?@poDate.id_delegat,?@poDate.nume_delegat,?@poDate.BIdelegat, ?@poDate.cnpdelegat, ?@poDate.id_masina,?@poDate.nrinmat); end;]
				Else
		
					lcSql = [begin ] + gcS + [.pack_facturare.cauta_date_ultima_factura(?poDate.id_client,] + ;
						[?gnIdSucursala,?@poDate.id_delegat,?@poDate.nume_delegat,?@poDate.BIdelegat, ?@poDate.cnpdelegat, ?@poDate.id_masina,?@poDate.nrinmat); end;]
				Endif
				*!* 09.06.2008 ^
				lnSucces = goExecutor.oExecute(lcSql)
				If lnSucces < 0
					amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
					poDate.id_delegat = Null
					poDate.nume_delegat = []
					poDate.BIdelegat = []
					poDate.cnpdelegat = []
					poDate.id_masina = Null
					poDate.nrinmat = []
				Endif
			Endif
			*!*	modificare 01.08
			If gcNumeProgram = [ROAGEST] Or !Between(poDate.tip,1,4)
				Thisform.opt_incasat.Visible = .F.
				Thisform.Height = 275
				Thisform.AutoCenter = .T.
				Thisform.Refresh()
			Else
				Thisform.Height = 300
				Thisform.AutoCenter = .T.
				Thisform.Refresh()
		
				If poDate.incasat <> 0
					Thisform.opt_incasat.Value = 2
				Endif
		
				If Used('v_nom_casa')
					Use In v_nom_casa
				Endif
				lcSql=[select id_part,nume from ] + gcS + [.vcoresp_tip_part where tip_partener='CASA LEI']
				lnSucces=goExecutor.oExecute(lcSql,[v_nom_casa])
				If lnSucces < 0
					poGeneratorNumere.dezaloca_numar(5)		&&	factura
					amessagebox(goExecutor.cEroare,0+16,'Eroare')
					Return
				Else
					Thisform.cb_casa._cBBASE1.RowSource = [v_nom_casa.nume,id_part]
					Thisform.cb_casa._cBBASE1.RowSourceType = 6
					If !Empty(gnid_part_casa)
						Select v_nom_casa
						Locate For id_part = gnid_part_casa
						If Found()
							poDate.id_casa = gnid_part_casa
							Thisform.cb_casa._cBBASE1.Value = Alltrim(nume)
						Endif
					Endif
				Endif
			Endif
			*!*	modificare 01.08	^
			*!*	modificare ROAFACTURARE	v 2.0.46
			If This.opt_incasat.Value = 2
				poDate.incasat = poDate.totalctva
			Endif
			*!*	modificare ROAFACTURARE	v 2.0.46	^
			*!*	modificare ROAFACTURARE	v 2.0.67
			*!*	modificare ROACONTRACTE v 2.0.38
			IF poDate.tip = 2 AND poDate.afisare_scadenta = 0 AND AT([Scadenta la ],poDate.text_aditional) = 0
				poDate.text_aditional = [Scadenta la ] + ALLTRIM(STR(poDate.datascad - poDate.dataact)) + [ zile.] + poDate.text_aditional
			ENDIF
			*!*	modificare ROACONTRACTE v 2.0.38	^	
		Else
			lnDif = Thisform.opt_incasat.Top - (Thisform._checkbox1.Top + Thisform._checkbox1.Height + 5)
			Thisform.ed_tx_simplu1.Top = Thisform.ct_clb_delegat.Top + 1
			Thisform.lb_titlu_alb_b121.Caption = [DATE SUPLIMENTARE]
			Thisform.opt_incasat.Visible = .F.
			Thisform.RemoveObject('ct_clb_delegat')
			Thisform.RemoveObject('ct_clb_masina')
			Thisform.RemoveObject('clb_serie_chit')			&&	modificare ROAFACTURARE v 2.0.80
			Thisform.RemoveObject('clb_nrchit')
			Thisform.RemoveObject('clb_incasat')
			Thisform.RemoveObject('cb_casa')
			Thisform.RemoveObject('lb_simplu1')
			Thisform.RemoveObject('_shape3')
			Thisform.RemoveObject('chkPOS')
			Thisform.RemoveObject('chkDetaliat')
			Thisform.Height = Thisform._checkbox1.Top + Thisform._checkbox1.Height + lnDif
			Thisform.AutoCenter = .T.
			Thisform.Refresh()
		Endif
		*!*	modificare ROAFACTURARE	v 2.0.67	^
	ENDPROC

	PROCEDURE Load
		IF !USED('saft_tip_facturi')
			update_saft_tip_facturi()
		ENDIF 
		
	ENDPROC

	PROCEDURE Cb_casa._CBBASE1.InteractiveChange
		poDate.id_casa = v_nom_casa.id_part
	ENDPROC

	PROCEDURE chkPOS.Valid
		IF this.Value = 0
			thisform.cb_casa._lbbase1.Caption = 'Casa'
		ELSE
			thisform.cb_casa._lbbase1.Caption = 'Banca POS'
		ENDIF 
		thisform.cb_casa._lbbase1.Refresh()
	ENDPROC

	PROCEDURE Clb_nrchit.Text_simplu1.GotFocus
		If Thisform.opt_incasat.Value = 2 && chitanta
			Thisform.clb_serie_chit.genereazaNumar()
		ENDIF 	
	ENDPROC

	PROCEDURE Clb_serie_chit._cbbase1.InteractiveChange
		This.Parent.genereazaNumar()
	ENDPROC

	PROCEDURE cmdModificaBon.Click
		Do Case
			Case Thisform.opt_incasat.Value = 3
				Thisform.do_modifica_bon
			Case Thisform.opt_incasat.Value = 4
				Thisform.do_modifica_pos
		Endcase
		
		
	ENDPROC

	PROCEDURE opt_incasat.Click
		Thisform.actualizeaza_tipincasare()
		
		*!*	Do Case
		*!*		Case This.Value=1 && Fara incasare
		*!*			Thisform.Height = 275
		*!*			Thisform.cb_casa.Visible=.F.
		*!*			Thisform.clb_serie_chit.Visible = .F.
		*!*			Thisform.clb_nrchit.Visible=.F.
		*!*			Thisform.clb_incasat.Visible=.F.
		*!*			Thisform._shape3.Visible=.F.
		*!*			Thisform.lb_simplu1.Visible=.F.
		*!*			Thisform.cmdModificaBon.Visible=.F. && modifica nr bon fiscal
		*!*			Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
		*!*			poDate.nr_incasare = 0
		*!*			poDate.incasat = 0
		*!*			Thisform.clb_serie_chit.Refresh()
		*!*			Thisform.clb_nrchit.Refresh()
		*!*			Thisform.clb_incasat.Refresh()
		*!*			poGeneratorNumere.dezaloca_numar(16)
		*!*			thisform.chkPOS.Value = 0
		*!*			thisform.chkDetaliat.Value = 0
		*!*			thisform.chkPOS.Visible = .F.		
		*!*			thisform.chkDetaliat.Visible = .F.		
		*!*			*!*	Case This.Value=2
		*!*			*!*		Thisform.cb_casa.Visible=.T.
		*!*			*!*		Thisform.clb_nrchit.Visible=.T.
		*!*			*!*		Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. bon]
		*!*			*!*		Thisform.clb_incasat.Visible=.T.
		*!*			*!*		Thisform._shape3.Visible=.T.
		*!*			*!*		Thisform.lb_simplu1.Visible=.T.
		*!*			*!*		Thisform.lactiv3=.T.
		*!*			*!*		Thisform.but_modifica1.Visible=.T.
		*!*			*!*		Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
		*!*			*!*		Thisform.do_aloca_nr_bon([CLICK])
		*!*		Case This.Value = 2 && chitanta
		*!*			If Thisform.nRezultatSerii = 0
		*!*				Thisform.nRezultatSerii = poGeneratorNumere.creeaza_cursor_serii(16)
		*!*				Thisform.clb_serie_chit.do_initializeaza(Thisform.nRezultatSerii)
		*!*				*!*	modificare v 2.0.84
		*!*				If !Empty(Nvl(poDate.serie_act,[]))
		*!*					*!*	modificare v 2.0.88
		*!*					If Thisform.nRezultatSerii <> 1
		*!*					*!*	modificare v 2.0.88	^
		*!*						Select (Thisform.clb_serie_chit._cbbase1.RowSource)
		*!*						Locate For Alltrim(serie) = Alltrim(poDate.serie_act)
		*!*						If !Found()
		*!*							Go Top
		*!*						Endif
		*!*						Thisform.clb_serie_chit._cbbase1.Value = Alltrim(serie)
		*!*					*!*	modificare v 2.0.88
		*!*					Endif
		*!*					*!*	modificare v 2.0.88	^
		*!*				Endif
		*!*				*!*	modificare v 2.0.84	^
		*!*			Endif
		*!*			Thisform.Height = 435
		*!*			Thisform.cb_casa.Visible=.T.
		*!*			Thisform.clb_serie_chit.Visible = .T.
		*!*			Thisform.clb_nrchit.Visible=.T.
		*!*			Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. chitanță]
		*!*			Thisform.clb_incasat.Visible=.T.
		*!*			Thisform._shape3.Visible=.T.
		*!*			Thisform.lb_simplu1.Visible=.T.
		*!*			Thisform.cmdModificaBon.Visible=.F. && modifica nr bon fiscal		
		*!*			Thisform.clb_nrchit.text_simplu1.ReadOnly = .F.
		*!*			poDate.incasat = poDate.totalctva
		*!*			Thisform.clb_serie_chit.Refresh()
		*!*			Thisform.clb_nrchit.Refresh()
		*!*			Thisform.clb_incasat.Refresh()
		*!*			Thisform.clb_serie_chit.genereazaNumar()
		*!*			thisform.chkPOS.Value = 0
		*!*			thisform.chkPOS.Visible = .F.		
		*!*			thisform.chkDetaliat.Value = 0
		*!*			thisform.chkDetaliat.Visible = .F.
		*!*							
		*!*		Case This.Value = 3 && Bon fiscal
		
		*!*			Thisform.Height = 435
		*!*			Thisform.cb_casa.Visible=.T.
		*!*			Thisform.clb_serie_chit.Visible = .F.
		*!*			Thisform.clb_nrchit.Visible=.T.
		*!*			Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. bon]
		*!*			Thisform.clb_incasat.Visible=.T.
		*!*			Thisform._shape3.Visible=.T.
		*!*			Thisform.lb_simplu1.Visible=.T.
		*!*			Thisform.cmdModificaBon.Visible=.T. && modifica nr bon fiscal		
		*!*			Thisform.clb_nrchit.text_simplu1.ReadOnly = .T.
		*!*			Thisform.do_aloca_nr_bon([CLICK])				
		*!*			poDate.incasat = poDate.totalctva
		*!*			Thisform.clb_serie_chit.Refresh()
		*!*			Thisform.clb_nrchit.Refresh()
		*!*			Thisform.clb_incasat.Refresh()
		*!*			poGeneratorNumere.dezaloca_numar(16)				
		*!*			thisform.chkPOS.Value = 0
		*!*			thisform.chkPOS.Visible = .T.		
		*!*			thisform.chkDetaliat.Value = 0
		*!*			thisform.chkDetaliat.Visible = .T.
		*!*	Endcase
	ENDPROC

	PROCEDURE opt_incasat.ProgrammaticChange
		Thisform.actualizeaza_tipincasare()
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_cere_titlu 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="Clb_tx_simplu1" UniqueID="" Timestamp="" />

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 95
		Name = "frm_cere_titlu"
		Width = 375
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE2.Height = 29
		_SHAPE2.Left = 344
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 32
		LB_TITLU_ALB_B121.Caption = ""
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 3
		BUT_TERMIN1.Left = 345
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 15, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 1, ;
		Top = 43, ;
		Width = 346, ;
		TEXT_SIMPLU1.Left = 154, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		LB_SIMPLU1.Caption = "Titlu", ;
		LB_SIMPLU1.FontSize = 12, ;
		LB_SIMPLU1.Left = 8, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 5
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE Init
		PARAMETERS tcTitlu, tcControlSource
		DODEFAULT()
		
		IF PCOUNT()>0 AND TYPE('tcTitlu') = 'C'
			this.clb_tx_simplu1.lb_simplu1.Caption = tcTitlu
		ENDIF 
		
		IF PCOUNT()>1 AND TYPE('tcControlSource') = 'C'
			this.clb_tx_simplu1.text_simplu1.ControlSource = tcControlSource
		ENDIF 
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_optiuni_listare_fa 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="sp_nr_copii" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nr_copii" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_tip_listare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_pauza" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="img" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: verifica_afisare_optiuni
		*p: lmultiple
		*p: nnrcopii
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 185
		Name = "frm_optiuni_listare_fa"
		nnrcopii = 1
		Width = 230
		_memberdata = <VFPData>
			<memberdata name="nnrcopii" display="nNrCopii"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 228
		_shape2.Height = 29
		_shape2.Left = 165
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 64
		Lb_titlu_alb_b121.Caption = "Optiuni listare"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 6
		BUT_TERMIN1.Left = 197
		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 = 167, ;
		Name = "But_renunt1", ;
		TabIndex = 5, ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'ck_pauza' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Pauza dupa fiecare serie", ;
		Left = 29, ;
		Name = "ck_pauza", ;
		TabIndex = 3, ;
		Top = 156
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_tip_listare' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Listeaza toate copiile o data pentru fiecare exemplar", ;
		Height = 32, ;
		Left = 29, ;
		Name = "ck_tip_listare", ;
		TabIndex = 2, ;
		Top = 118, ;
		Width = 172, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'img' AS _image WITH ;
		Height = 45, ;
		Left = 60, ;
		Name = "img", ;
		Picture = ..\grafice\listare\listaref_1.bmp, ;
		Top = 67, ;
		Width = 109
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="image" />

	ADD OBJECT 'lb_nr_copii' AS _lbbase WITH ;
		Caption = "Nr.copii", ;
		Left = 30, ;
		Name = "lb_nr_copii", ;
		TabIndex = 7, ;
		Top = 40
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'sp_nr_copii' AS _spinner WITH ;
		ControlSource = "Thisform.nNrCopii", ;
		Height = 24, ;
		KeyboardHighValue = 9999, ;
		KeyboardLowValue = 1, ;
		Left = 129, ;
		Name = "sp_nr_copii", ;
		SpinnerHighValue = 9999.00, ;
		SpinnerLowValue =   1.00, ;
		TabIndex = 1, ;
		Top = 36, ;
		Value = 1, ;
		Width = 84
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="spinner" />
	
	PROCEDURE Destroy
		If Thisform.lmultiple
			Unbindevents(Thisform,"nNrCopii",Thisform,"verifica_afisare_optiuni")
		Endif
	ENDPROC

	PROCEDURE Init
		Lparameters tlMultiple
		DoDefault()
		Thisform.lmultiple = tlMultiple
		Thisform.verifica_afisare_optiuni()
		If Thisform.lmultiple
			Bindevent(Thisform,"nNrCopii",Thisform,"verifica_afisare_optiuni",1)
		Endif
	ENDPROC

	PROCEDURE verifica_afisare_optiuni
		If This.lmultiple And Thisform.nNrCopii = 1
			Thisform.img.Visible = .F.
			Thisform.ck_tip_listare.Visible = .F.
			Thisform.ck_tip_listare.Value = 0
			Thisform.ck_pauza.Visible = .F.
			Thisform.ck_pauza.Value = 0
			Thisform.Height = 70
			Thisform.AutoCenter = .T.
		Else
			If !Thisform.img.Visible
				Thisform.img.Visible = .T.
				Thisform.ck_tip_listare.Visible = .T.
				Thisform.ck_tip_listare.Value = 0
				Thisform.ck_pauza.Visible = .T.
				Thisform.ck_pauza.Value = 0
				Thisform.Height = 185
				Thisform.AutoCenter = .T.
			Endif
		Endif
		Thisform.Refresh()
	ENDPROC

	PROCEDURE ck_tip_listare.Click
		If This.Value = 1
			Thisform.img.Picture = [listaref_2.bmp]
		Else
			Thisform.img.Picture = [listaref_1.bmp]
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS gridb AS grid 
 	*< CLASSDATA: Baseclass="grid" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Column1.Text1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: gasestecol
		*m: headerclick
		*m: iesire
		*m: treaba
		*p: listaord
		*p: ordine
	*</DefinedPropArrayMethod>

	*<PropValue>
		BackColor = 255,255,255
		ColumnCount = 1
		DeleteMark = .F.
		GridLineColor = 0,0,0
		GridLineWidth = 1
		Height = 200
		listaord = 0,0
		Name = "gridb"
		ordine = 0
		Panel = 1
		ReadOnly = .T.
		RecordMark = .T.
		Width = 125
		Column1.BackColor = 255,255,255
		Column1.Name = "Column1"
		Column1.ReadOnly = .T.
		Column1.Width = 105
	*</PropValue>

	ADD OBJECT 'Column1.Header1' AS header WITH ;
		BackColor = 255,255,255, ;
		Caption = "Header1", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'Column1.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE gasestecol
		Parameters ii
		
		For j=1 To This.ColumnCount
			Nn=Alltrim(Str(j))
			z='this.column'+Nn+'.columnorder=ii'
			If &z
				Return nn
			Endif
		Next j
		RETURN '0'
		
	ENDPROC

	PROCEDURE headerclick
		PARAMETERS co
		l=this.listaord
		
		IF INLIST(co,&l)
		this.ordine=co
		this.treaba
		endif
		
	ENDPROC

	PROCEDURE iesire
		PARAMETERS Y
	ENDPROC

	PROCEDURE Init
		Local z,l,n
		l=This.listaord
		
		
		For i=1 To This.ColumnCount
			If Inlist(i,&l)
			n=this.gasestecol(i) &&gaseste coloana cu ordinea i
					zz='this.column'+N+'.header1.forecolor=RGB(0,0,255)'
					&zz
			Endif
		Next i
		This.treaba
		
	ENDPROC

	PROCEDURE treaba
		
		
		If This.ordine<>0
			This.SetAll('fontunderline',.F.,'header')
			n=this.gasestecol(this.ordine)
			z='this.column'+N+'.header1.fontunderline=.t.'
			&z
		
			d=UPPER(This.RecordSource)
			z='c=ALLTRIM(this.column'+N+'.controlsource)'
			&z
			c=UPPER(STRTRAN(c,'.',''))
			c=STRTRAN(c,d,'')
			Select &d
			Set Order To Tag &c
			GO top
			This.Refresh
		Endif
		
	ENDPROC

	PROCEDURE Column1.Header1.Click
		this.Parent.Parent.headerclick(this.Parent.ColumnOrder)
		
	ENDPROC

	PROCEDURE Column1.Text1.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		do case
			case nkeycode=13 
				THIS.PARENT.Parent.IESIRE(1)
			case nkeycode=9
				THIS.PARENT.Parent.IESIRE(-1)
		endcase
	ENDPROC

ENDDEFINE
