*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="ofacturare.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS clb_tx_sume_valuta 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="tx_suma_val" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_suma_nat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nume_val" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nume_nat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatii" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_activeaza
		*m: do_actualizeaza_lbnat
		*m: do_actualizeaza_lbval
		*m: do_dezactiveaza
		*p: cmonedanationala
		*p: levidentiat		&& Daca e .T., atunci caracterele din campul care poate fi editat vor fi ingrosate.
		*p: nsumanatold
		*p: nsumavalold
		*p: pcobj
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	*<PropValue>
		BackStyle = 0
		cmonedanationala = RON
		Height = 28
		levidentiat = .F.
		Name = "clb_tx_sume_valuta"
		nsumanatold = 0
		nsumavalold = 0
		pcobj = 
		Width = 324
		_memberdata = <VFPData>
			<memberdata name="do_actualizeaza_lbnat" type="Method" favorites="True"/>
			<memberdata name="do_actualizeaza_lbval" type="Method" favorites="True"/>
			<memberdata name="cmonedanationala" type="Property" favorites="True"/>
			<memberdata name="do_activeaza" type="Method" favorites="True"/>
			<memberdata name="do_dezactiveaza" type="Method" favorites="True"/>
			<memberdata name="levidentiat" type="Property" favorites="True"/>
			<memberdata name="nsumanatold" type="property" display="nSumaNatOld"/>
		</VFPData>
	*</PropValue>

	ADD OBJECT 'lb_explicatie' AS _lbbase WITH ;
		FontName = "Arial Narrow", ;
		Left = 4, ;
		Name = "lb_explicatie", ;
		Top = 4
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'lb_explicatii' AS _lbbase WITH ;
		Caption = "(...)", ;
		FontName = "Arial Narrow", ;
		Left = 120, ;
		Name = "lb_explicatii", ;
		Top = 4, ;
		Visible = .F.
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'lb_nume_nat' AS _lbbase WITH ;
		Caption = "Label", ;
		FontName = "Arial Narrow", ;
		Left = 298, ;
		Name = "lb_nume_nat", ;
		Top = 4
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'lb_nume_val' AS _lbbase WITH ;
		Caption = "Label", ;
		FontName = "Arial Narrow", ;
		Left = 203, ;
		Name = "lb_nume_val", ;
		Top = 4
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'tx_suma_nat' AS _txbase WITH ;
		Alignment = 1, ;
		FontName = "Arial Narrow", ;
		Format = "!K", ;
		Height = 23, ;
		InputMask = (get_mask(14,gnPPretV)), ;
		Left = 238, ;
		Name = "tx_suma_nat", ;
		ReadOnly = .T., ;
		TabStop = .F., ;
		Top = 2, ;
		Width = 59
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'tx_suma_val' AS _txbase WITH ;
		Alignment = 1, ;
		FontName = "Arial Narrow", ;
		Format = "!K", ;
		Height = 23, ;
		InputMask = (get_mask(14,gnPVal)), ;
		Left = 141, ;
		Name = "tx_suma_val", ;
		ReadOnly = .T., ;
		TabStop = .F., ;
		Top = 2, ;
		Width = 60
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />
	
	PROCEDURE do_activeaza
		Lparameters tnTip
		**	fara parametru	-	sunt activate ambele textbox-uri
		**	1				-	e activata suma_nat
		**	2				-	e activata suma_val
		Do Case
		Case Empty(tnTip)
			With This.tx_suma_nat
				.ReadOnly = .F.
				.TabStop = .T.
				.FontBold = This.levidentiat
			Endwith
			If Type('this.tx_suma_val') <> 'U'
				With This.tx_suma_val
					.ReadOnly = .F.
					.TabStop = .T.
					.FontBold = This.levidentiat
				Endwith
			Endif
		Case tnTip = 1
			With This.tx_suma_nat
				.ReadOnly = .F.
				.TabStop = .T.
				.FontBold = This.levidentiat
			Endwith
		Case tnTip = 2 And Type('this.tx_suma_val') <> 'U'
			With This.tx_suma_val
				.ReadOnly = .F.
				.TabStop = .T.
				.FontBold = This.levidentiat
			Endwith
		Endcase
		This.TabStop = .T.
	ENDPROC

	PROCEDURE do_actualizeaza_lbnat
		Lparameters tcNumeNat
		If !Empty(tcNumeVal)
			This.lb_nume_nat.Caption=Alltrim(tcNumeNat)
		Endif
	ENDPROC

	PROCEDURE do_actualizeaza_lbval
		Lparameters tcNumeVal
		If Empty(tcNumeVal)
			This.RemoveObject('lb_nume_val')
			This.RemoveObject('tx_suma_val')
		Else
			This.lb_nume_val.Caption=Alltrim(tcNumeVal)
		Endif
	ENDPROC

	PROCEDURE do_dezactiveaza
		Lparameters tnTip
		**	fara parametru	-	sunt dezactivate ambele textbox-uri
		**	1				-	e dezactivata suma_nat
		**	2				-	e dezactivata suma_val
		Do Case
		Case Empty(tnTip)
			With This.tx_suma_nat
				.ReadOnly = .T.
				.TabStop = .F.
				.FontBold = .F.
			Endwith
			If Type('this.tx_suma_val') <> 'U'
				With This.tx_suma_val
					.ReadOnly = .T.
					.TabStop = .F.
					.FontBold = .F.
				Endwith
			Endif
		Case tnTip = 1
			With This.tx_suma_nat
				.ReadOnly = .T.
				.TabStop = .F.
				.FontBold = .F.
			Endwith
		Case tnTip = 2 And Type('this.tx_suma_val') <> 'U'
			With This.tx_suma_val
				.ReadOnly = .T.
				.TabStop = .F.
				.FontBold = .F.
			Endwith
		Endcase
	ENDPROC

	PROCEDURE Init
		This.lb_nume_nat.Caption=Alltrim(This.cmonedanationala)
		
	ENDPROC

	PROCEDURE tx_suma_nat.When
		this.Parent.nSumaNatOld = this.Value 
	ENDPROC

	PROCEDURE tx_suma_val.When
		this.Parent.nSumaValOld = this.Value 
	ENDPROC

ENDDEFINE

DEFINE CLASS clb_tx_sume_valuta1501 AS _container OF "..\comun\clase\_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="tx_suma_val" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_suma_nat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nume_val" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nume_nat" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_activeaza
		*m: do_actualizeaza_lbnat
		*m: do_actualizeaza_lbval
		*m: do_dezactiveaza
		*p: cmonedanationala
		*p: pcobj
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	*<PropValue>
		BackStyle = 0
		cmonedanationala = RON
		Height = 50
		Name = "clb_tx_sume_valuta"
		pcobj = 
		Width = 290
		_memberdata = <VFPData>
			<memberdata name="do_actualizeaza_lbnat" type="Method" favorites="True"/>
			<memberdata name="do_actualizeaza_lbval" type="Method" favorites="True"/>
			<memberdata name="cmonedanationala" type="Property" favorites="True"/>
			<memberdata name="do_activeaza" type="Method" favorites="True"/>
			<memberdata name="do_dezactiveaza" type="Method" favorites="True"/>
		</VFPData>
	*</PropValue>

	ADD OBJECT 'lb_explicatie' AS _lbbase WITH ;
		Left = 8, ;
		Name = "lb_explicatie", ;
		Top = 4
		*< END OBJECT: ClassLib="..\comun\clase\_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'lb_nume_nat' AS _lbbase WITH ;
		Left = 244, ;
		Name = "lb_nume_nat", ;
		Top = 25
		*< END OBJECT: ClassLib="..\comun\clase\_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'lb_nume_val' AS _lbbase WITH ;
		Left = 101, ;
		Name = "lb_nume_val", ;
		Top = 25
		*< END OBJECT: ClassLib="..\comun\clase\_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'tx_suma_nat' AS _txbase WITH ;
		Alignment = 1, ;
		Format = "!K", ;
		Height = 23, ;
		InputMask = (get_mask(14,gnPa)), ;
		Left = 148, ;
		Name = "tx_suma_nat", ;
		ReadOnly = .T., ;
		TabStop = .F., ;
		Top = 22, ;
		Width = 91
		*< END OBJECT: ClassLib="..\comun\clase\_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'tx_suma_val' AS _txbase WITH ;
		Alignment = 1, ;
		Format = "!K", ;
		Height = 23, ;
		InputMask = (get_mask(14,gnPVal)), ;
		Left = 6, ;
		Name = "tx_suma_val", ;
		ReadOnly = .T., ;
		TabStop = .F., ;
		Top = 22, ;
		Width = 91
		*< END OBJECT: ClassLib="..\comun\clase\_tx_base.vcx" BaseClass="textbox" />
	
	PROCEDURE do_activeaza
		Lparameters tnTip
		**	fara parametru	-	sunt activate ambele textbox-uri
		**	1				-	e activata suma_nat
		**	2				-	e activata suma_val
		Do Case
		Case Empty(tnTip)
			With This.tx_suma_nat
				.ReadOnly = .F.
				.TabStop = .T.
			Endwith
			If Type('this.tx_suma_val') <> 'U'
				With This.tx_suma_val
					.ReadOnly = .F.
					.TabStop = .T.
				Endwith
			Endif
		Case tnTip = 1
			With This.tx_suma_nat
				.ReadOnly = .F.
				.TabStop = .T.
			Endwith
		Case tnTip = 2 And Type('this.tx_suma_val') <> 'U'
			With This.tx_suma_val
				.ReadOnly = .F.
				.TabStop = .T.
			Endwith
		Endcase
		This.TabStop = .T.
	ENDPROC

	PROCEDURE do_actualizeaza_lbnat
		Lparameters tcNumeNat
		If !Empty(tcNumeVal)
			This.lb_nume_nat.Caption=Alltrim(tcNumeNat)
		Endif
	ENDPROC

	PROCEDURE do_actualizeaza_lbval
		Lparameters tcNumeVal
		If Empty(tcNumeVal)
			This.RemoveObject('lb_nume_val')
			This.RemoveObject('tx_suma_val')
		Else
			This.lb_nume_val.Caption=Alltrim(tcNumeVal)
		Endif
	ENDPROC

	PROCEDURE do_dezactiveaza
		Lparameters tnTip
		**	fara parametru	-	sunt dezactivate ambele textbox-uri
		**	1				-	e dezactivata suma_nat
		**	2				-	e dezactivata suma_val
		Do Case
		Case Empty(tnTip)
			With This.tx_suma_nat
				.ReadOnly = .T.
				.TabStop = .F.
			Endwith
			If Type('this.tx_suma_val') <> 'U'
				With This.tx_suma_val
					.ReadOnly = .T.
					.TabStop = .F.
				Endwith
			Endif
		Case tnTip = 1
			With This.tx_suma_nat
				.ReadOnly = .T.
				.TabStop = .F.
			Endwith
		Case tnTip = 2 And Type('this.tx_suma_val') <> 'U'
			With This.tx_suma_val
				.ReadOnly = .T.
				.TabStop = .F.
			Endwith
		Endcase
	ENDPROC

	PROCEDURE Init
		This.lb_nume_nat.Caption=Alltrim(This.cmonedanationala)
		
	ENDPROC

ENDDEFINE

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

	*<PropValue>
		Name = "cus_odata_nomrute"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		
		lcActiune = Alltrim(This.cActiune)
		
		If Inlist(lcActiune, "UPDATE",'INSERT') And Type('toRec') != "O"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE') And Type('tnId') != "N"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE')
			lcId = Alltrim(Str(tnId))
		Endif
		
		If Inlist(lcActiune, "UPDATE",'INSERT')
			lcRuta = NVL(STRTRAN(ALLTRIM(UPPER(torec.ruta)),['],['']),"")
			lcidagent = NVL(ALLTRIM(STR(torec.id_agent)),'null')
			lciddelegat = NVL(ALLTRIM(STR(torec.id_delegat)),'null')
			lcidmasina = NVL(ALLTRIM(STR(torec.id_masina)),'null')
			If lcidmasina  = '0'
				lcidmasina = 'null'
			EndIf 
			If lcidagent = '0'
				lcidagent = 'null'
			EndIf 
			If lciddelegat = '0'
				lciddelegat = 'null'
			EndIf 	
			
		Endif
		
		
		Do Case
			Case lcActiune = "INSERT"
		
				lcSql = [INSERT INTO ] + gcS + [.FACT_NOM_RUTE( ruta,id_agent,id_delegat,id_masina) VALUES (]+;
					[']+ lcruta + [',]+lcidagent +[,]+lciddelegat +[,]+lcidmasina +[)]
				
			Case lcActiune = "UPDATE"
		
				lcSql = [UPDATE ] + gcS + [.FACT_NOM_RUTE SET ]  +;
				 [ ruta = '] + lcruta + [' ,id_agent=] +lcidagent +[,id_delegat=]+lciddelegat +[,id_masina=]+ lcidmasina+ ;
				  [ where id_ruta = ] + lcId
		
			Case lcActiune = "DELETE"
			
		*!*			lcSql = [update ] +gcS +[.sal_nom_cm set sters=1 where id_nomore=]+lcid
				lcSql = [update FACT_NOM_RUTE set sters = 1 where  id_ruta = ] + lcId
		Endcase
		
		This.csql = lcSql
		
	ENDPROC

ENDDEFINE

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

	*<PropValue>
		Name = "cus_odata_rute"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		
		lcActiune = Alltrim(This.cActiune)
		
		If Inlist(lcActiune, "UPDATE",'INSERT') And Type('toRec') != "O"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE') And Type('tnId') != "N"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE')
			lcId = Alltrim(Str(tnId))
		Endif
		
		If Inlist(lcActiune, "UPDATE",'INSERT')
		
			lcidGestiune = NVL(ALLTRIM(STR(torec.id_gestiune)),'null')
			lcidRuta = NVL(ALLTRIM(STR(torec.id_ruta)),'null')
			lcOrdine = NVL(ALLTRIM(STR(torec.ordine)),'0')
		
			
		Endif
		
		
		Do Case
			Case lcActiune = "INSERT"
		
				lcSql = [INSERT INTO ] + gcS + [.fact_nom_rutegest( id_ruta,id_gestiune,ordine) VALUES (]+;
					 lcidruta + [,] + lcidGestiune + [,]+lcOrdine+[)]
				
			Case lcActiune = "UPDATE"
		
				lcSql = [UPDATE ] + gcS + [.fact_nom_rutegest SET id_ruta = ] + lcidruta +;
				 [,id_gestiune= ] + lcidGestiune +[,ordine = ]+lcOrdine +;
				  [ where id_rutagest = ] + lcId
		
			Case lcActiune = "DELETE"
			
		*!*			lcSql = [update ] +gcS +[.sal_nom_cm set sters=1 where id_nomore=]+lcid
				lcSql = [update fact_nom_rutegest set sters = 1 where  id_rutagest = ] + lcId
		Endcase
		
		This.csql = lcSql
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_articol_compus AS _frmbase OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_articol" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_um" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_cantitate" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_cantitate.lb_explicatii" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ed_tx_explicatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_pretftva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_pretctva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount_unitar" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tva_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discountctva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalfdiscount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_pret_diminuat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalcdiscount" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_calculeaza_preturi
		*m: do_calculeaza_totaluri
		*p: nid
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 370
		Name = "frm_articol_compus"
		Width = 646
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 648
		_shape1.ZOrderSet = 1
		_shape2.Height = 29
		_shape2.Left = 580
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "ADĂUGARE ARTICOL"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 17
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 616
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 15
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Left = 48
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 349
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Height = 27, ;
		Left = 584, ;
		Name = "But_renunt1", ;
		TabIndex = 16, ;
		Top = 1, ;
		Width = 30, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'clb_articol' AS clb_tx_simplu WITH ;
		Height = 87, ;
		Left = 6, ;
		Name = "clb_articol", ;
		TabIndex = 1, ;
		Top = 50, ;
		Width = 290, ;
		ZOrderSet = 7, ;
		Text_simplu1.ControlSource = "poArticolCompus.denumire", ;
		Text_simplu1.FontBold = .T., ;
		Text_simplu1.FontName = "Arial Narrow", ;
		Text_simplu1.Height = 81, ;
		Text_simplu1.Left = 66, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 220, ;
		Lb_simplu1.Caption = "Articol", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_cantitate' AS clb_tx_simplu WITH ;
		Left = 303, ;
		Name = "clb_cantitate", ;
		TabIndex = 5, ;
		Top = 34, ;
		Width = 290, ;
		ZOrderSet = 10, ;
		Text_simplu1.Alignment = 1, ;
		Text_simplu1.ControlSource = "poArticolCompus.cantitate", ;
		Text_simplu1.InputMask = (get_mask(14,gnPCant)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Cantitate", ;
		Lb_simplu1.FontName = "Arial Narrow", ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_cantitate.lb_explicatii' AS lb_simplu WITH ;
		Caption = "(1)", ;
		FontName = "Arial Narrow", ;
		Height = 18, ;
		Left = 82, ;
		Name = "lb_explicatii", ;
		Top = 5, ;
		Width = 13
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'Clb_discount_unitar' AS clb_tx_sume_valuta WITH ;
		Left = 303, ;
		Name = "Clb_discount_unitar", ;
		TabIndex = 10, ;
		TabStop = .F., ;
		Top = 170, ;
		ZOrderSet = 15, ;
		tx_suma_val.ControlSource = "poArticolCompus.vdiscountftva", ;
		tx_suma_val.Name = "tx_suma_val", ;
		lb_explicatie.Caption = "Discount unitar fără TVA", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticolCompus.discountftva", ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Caption = "(5)", ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discountctva' AS clb_tx_sume_valuta WITH ;
		Left = 303, ;
		Name = "Clb_discountctva", ;
		TabIndex = 12, ;
		TabStop = .F., ;
		Top = 224, ;
		ZOrderSet = 17, ;
		tx_suma_val.ControlSource = "poArticolCompus.vdiscountctva", ;
		tx_suma_val.Name = "tx_suma_val", ;
		lb_explicatie.Caption = "Discount unitar cu TVA", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticolCompus.discountctva", ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Caption = "(7)", ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_pret_diminuat' AS clb_tx_sume_valuta WITH ;
		Height = 50, ;
		Left = 303, ;
		Name = "Clb_pret_diminuat", ;
		TabIndex = 13, ;
		TabStop = .F., ;
		Top = 251, ;
		Visible = .F., ;
		Width = 324, ;
		ZOrderSet = 20, ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 141, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 24, ;
		lb_explicatie.Caption = "Preț unitar diminuat fără TVA", ;
		lb_explicatie.FontBold = .T., ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 6, ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.Left = 238, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 24, ;
		lb_nume_val.Left = 203, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 28, ;
		lb_nume_nat.Left = 300, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 27, ;
		lb_explicatii.FontBold = .T., ;
		lb_explicatii.Left = 241, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_pretctva' AS clb_tx_sume_valuta WITH ;
		Left = 303, ;
		Name = "Clb_pretctva", ;
		TabIndex = 8, ;
		TabStop = .F., ;
		Top = 116, ;
		ZOrderSet = 14, ;
		tx_suma_val.ControlSource = "poArticolCompus.vpretctva", ;
		tx_suma_val.Name = "tx_suma_val", ;
		lb_explicatie.Caption = "Preț cu TVA", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticolCompus.pretctva", ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Caption = "(4)", ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_pretftva' AS clb_tx_sume_valuta WITH ;
		Left = 303, ;
		Name = "Clb_pretftva", ;
		TabIndex = 6, ;
		TabStop = .F., ;
		Top = 62, ;
		ZOrderSet = 12, ;
		tx_suma_val.ControlSource = "poArticolCompus.vpretftva", ;
		tx_suma_val.Name = "tx_suma_val", ;
		lb_explicatie.Caption = "Preț fără TVA", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticolCompus.pretftva", ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Caption = "(2)", ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_serie' AS clb_tx_simplu WITH ;
		Left = 6, ;
		Name = "Clb_serie", ;
		TabIndex = 2, ;
		Top = 136, ;
		Width = 290, ;
		ZOrderSet = 22, ;
		Text_simplu1.ControlSource = "poArticolCompus.serie", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Serie", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalcdiscount' AS clb_tx_sume_valuta WITH ;
		Height = 50, ;
		Left = 303, ;
		Name = "Clb_totalcdiscount", ;
		TabIndex = 14, ;
		TabStop = .F., ;
		Top = 300, ;
		Width = 324, ;
		ZOrderSet = 19, ;
		tx_suma_val.ControlSource = "poArticolCompus.vvaldiminuatctva", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 141, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 24, ;
		lb_explicatie.Caption = "Total cu TVA cu discount", ;
		lb_explicatie.FontBold = .T., ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 6, ;
		tx_suma_nat.ControlSource = "poArticolCompus.valdiminuatctva", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 238, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 24, ;
		lb_nume_val.Left = 203, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 27, ;
		lb_nume_nat.Left = 300, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 27, ;
		lb_explicatii.FontBold = .T., ;
		lb_explicatii.Left = 242, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalfdiscount' AS clb_tx_sume_valuta WITH ;
		Left = 303, ;
		Name = "Clb_totalfdiscount", ;
		TabIndex = 9, ;
		TabStop = .F., ;
		Top = 143, ;
		Width = 324, ;
		ZOrderSet = 18, ;
		tx_suma_val.ControlSource = "poArticolCompus.vvalctva", ;
		tx_suma_val.Name = "tx_suma_val", ;
		lb_explicatie.Caption = "Total cu TVA fără discount", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticolCompus.valctva", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Name = "lb_explicatii"
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tva' AS clb_tx_sume_valuta WITH ;
		Left = 303, ;
		Name = "Clb_tva", ;
		TabIndex = 7, ;
		TabStop = .F., ;
		Top = 89, ;
		ZOrderSet = 13, ;
		tx_suma_val.ControlSource = "poArticolCompus.vtva", ;
		tx_suma_val.Name = "tx_suma_val", ;
		lb_explicatie.Caption = "TVA", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticolCompus.tva", ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Caption = "(3)", ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tva_discount' AS clb_tx_sume_valuta WITH ;
		Left = 303, ;
		Name = "Clb_tva_discount", ;
		TabIndex = 11, ;
		TabStop = .F., ;
		Top = 197, ;
		ZOrderSet = 16, ;
		tx_suma_val.ControlSource = "poArticolCompus.vdiscounttva", ;
		tx_suma_val.Name = "tx_suma_val", ;
		lb_explicatie.Caption = "TVA discount", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticolCompus.discounttva", ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Caption = "(6)", ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'clb_um' AS clb_tx_simplu WITH ;
		Left = 6, ;
		Name = "clb_um", ;
		TabIndex = 3, ;
		Top = 164, ;
		Width = 290, ;
		ZOrderSet = 9, ;
		Text_simplu1.ControlSource = "poArticolCompus.um", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "U.M.", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ed_tx_explicatie' AS ed_tx_simplu WITH ;
		Height = 145, ;
		Left = 6, ;
		Name = "Ed_tx_explicatie", ;
		TabIndex = 4, ;
		Top = 192, ;
		Width = 290, ;
		ZOrderSet = 23, ;
		_EDBASE1.ControlSource = "poArticolCompus.explicatie", ;
		_EDBASE1.Format = "!", ;
		_EDBASE1.Height = 140, ;
		_EDBASE1.Left = 61, ;
		_EDBASE1.MaxLength = 240, ;
		_EDBASE1.Name = "_EDBASE1", ;
		_EDBASE1.Top = 2, ;
		_EDBASE1.Width = 227, ;
		_lbbase1.Caption = "Explicație", ;
		_lbbase1.Left = 4, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE do_calculeaza_preturi
		If poArticolCompus.cantitate <> 0
			poArticolCompus.vpretftva = Round(poArticolCompus.vvalftva / poArticolCompus.cantitate,gnPVal)
		*!*	modificare	v 2.0.46
		*!*		poArticolCompus.vtva = Round(poArticolCompus.vvaltva / poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vpretctva = Round(poArticolCompus.vvalctva / poArticolCompus.cantitate,gnPc)
			poArticolCompus.vtva = Round(poArticolCompus.vpretftva * (poArticolCompus.proc_tvav-1),gnPVal)
			poArticolCompus.vpretctva = poArticolCompus.vpretftva + poArticolCompus.vtva
		*!*	modificare	v 2.0.46	^
		
			poArticolCompus.vdiscountftva = Round(poArticolCompus.vvaldiscountftva / poArticolCompus.cantitate,gnPVal)
			poArticolCompus.vdiscountctva = Round(poArticolCompus.vvaldiscountctva / poArticolCompus.cantitate,gnPVal)
		*!*	modificare	v 2.0.56
		*!*		poArticolCompus.vdiscounttva = poArticolCompus.vvaldiscountctva-poArticolCompus.vvaldiscountftva
			poArticolCompus.vdiscounttva = poArticolCompus.vdiscountctva - poArticolCompus.vdiscountftva
		*!*	modificare	v 2.0.56	^
		
			poArticolCompus.pretftva = Round(poArticolCompus.valftva / poArticolCompus.cantitate,gnPPretV)
		*!*	modificare	v 2.0.46
		*!*		poArticolCompus.tva = Round(poArticolCompus.valtva / poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.pretctva = Round(poArticolCompus.valctva  / poArticolCompus.cantitate,gnPc)
			poArticolCompus.tva = Round(poArticolCompus.pretftva * (poArticolCompus.proc_tvav-1),gnPPretV)
			poArticolCompus.pretctva = poArticolCompus.pretftva + poArticolCompus.tva
		*!*	modificare	v 2.0.46	^
		
			poArticolCompus.discountftva = Round(poArticolCompus.valdiscountftva / poArticolCompus.cantitate,gnPPretV)
			poArticolCompus.discountctva = Round(poArticolCompus.valdiscountctva / poArticolCompus.cantitate,gnPPretV)
		*!*	modificare	v 2.0.56
		*!*		poArticolCompus.discounttva = poArticolCompus.valdiscountctva-poArticolCompus.valdiscountftva
			poArticolCompus.discounttva = poArticolCompus.discountctva - poArticolCompus.discountftva
		*!*	modificare	v 2.0.56	^
		Else
			poArticolCompus.pretftva = 0
			poArticolCompus.tva = 0
			poArticolCompus.pretctva = 0
		
			poArticolCompus.discountftva = 0
			poArticolCompus.discountctva = 0
			poArticolCompus.discounttva = 0
		
			poArticolCompus.vpretftva = 0
			poArticolCompus.vtva = 0
			poArticolCompus.vpretctva = 0
		
			poArticolCompus.vdiscountftva = 0
			poArticolCompus.vdiscountctva = 0
			poArticolCompus.vdiscounttva = 0
		Endif
		Thisform.clb_DISCOUNTCTVA.Refresh()
		Thisform.clb_DISCOUNT_UNITAR.Refresh()
		Thisform.clb_PRETCTVA.Refresh()
		Thisform.clb_PRETFTVA.Refresh()
		Thisform.clb_PRET_DIMINUAT.Refresh()
		Thisform.clb_TOTALCDISCOUNT.Refresh()
		Thisform.clb_TOTALFDISCOUNT.Refresh()
		Thisform.clb_tVA.Refresh()
		Thisform.clb_tVA_DISCOUNT.Refresh()
		
	ENDPROC

	PROCEDURE do_calculeaza_totaluri
		Lparameters tnValoare,tnTip
		Do Case
		Case tnTip = 1				&&	s-a modificat pretul fara tva in lei
			poArticolCompus.pretftva = tnValoare
			poArticolCompus.tva = Round(tnValoare * (poArticolCompus.proc_tvav - 1),gnPPretV)
		Case tnTip = 2				&&	s-a modificat pretul fara tva in valuta
			poArticolCompus.vpretftva = tnValoare
			poArticolCompus.vtva = Round(tnValoare * (poArticolCompus.proc_tvav - 1), gnPVal)
			poArticolCompus.vpretctva = poArticolCompus.vpretftva + poArticolCompus.vtva
		
			poArticolCompus.pretftva = Round(poArticolCompus.vpretftva * poArticolCompus.Curs / poArticolCompus.multiplicator, gnPPretV)
			poArticolCompus.tva = Round(poArticolCompus.pretftva * (poArticolCompus.proc_tvav - 1),gnPPretV)
			Thisform.clb_pretftva.tx_SUMA_NAT.Refresh()
		Endcase
		
		poArticolCompus.pretctva = poArticolCompus.pretftva + poArticolCompus.tva
		
		*!*	modificare	v 2.0.56
		*!*	If poArticolCompus.cu_tva = 0
		*!*		poArticolCompus.vvalftva = Round(poArticolCompus.vpretftva * poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vvaltva = Round(Round(poArticolCompus.vpretftva * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*		poArticolCompus.vvalctva = poArticolCompus.vvalftva + poArticolCompus.vvaltva
		*!*		poArticolCompus.vvaldiminuatftva = Round((poArticolCompus.vpretftva - poArticolCompus.vdiscountftva) * poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vvaldiminuattva = Round(Round((poArticolCompus.vpretftva - poArticolCompus.vdiscountftva) * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*		poArticolCompus.vvaldiminuatctva = poArticolCompus.vvaldiminuatftva + poArticolCompus.vvaldiminuattva
		*!*		poArticolCompus.vvaldiscountftva = Round(poArticolCompus.vdiscountftva * poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vvaldiscounttva = Round(Round(poArticolCompus.vdiscountftva * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*		poArticolCompus.vvaldiscountctva = poArticolCompus.vvaldiscountftva + poArticolCompus.vvaldiscounttva
		*!*		If poDate.in_valuta = 0
		*!*			poArticolCompus.valftva = Round(poArticolCompus.pretftva * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valtva = Round(Round(poArticolCompus.pretftva * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*			poArticolCompus.valctva = poArticolCompus.valftva + poArticolCompus.valtva
		*!*			poArticolCompus.valdiscountftva = Round(poArticolCompus.discountftva * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiscounttva = Round(Round(poArticolCompus.discountftva * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*			poArticolCompus.valdiscountctva = poArticolCompus.valdiscountftva + poArticolCompus.valdiscounttva
		*!*			poArticolCompus.valdiminuatftva = Round((poArticolCompus.pretftva - poArticolCompus.discountftva) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiminuattva = Round(Round((poArticolCompus.pretftva - poArticolCompus.discountftva) * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*			poArticolCompus.valdiminuatctva = poArticolCompus.valdiminuatftva + poArticolCompus.valdiminuattva
		*!*		Else
		*!*			poArticolCompus.valftva = Round(Round(poArticolCompus.vpretftva * poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valtva = Round(Round(Round(poArticolCompus.vpretftva * poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*			poArticolCompus.valctva = poArticolCompus.valftva + poArticolCompus.valtva
		*!*			poArticolCompus.valdiscountftva = Round(Round(poArticolCompus.vdiscountftva * poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiscounttva = Round(Round(Round(poArticolCompus.vdiscountftva * poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*			poArticolCompus.valdiscountctva = poArticolCompus.valdiscountftva + poArticolCompus.valdiscounttva
		*!*			poArticolCompus.valdiminuatftva = Round((Round(poArticolCompus.vpretftva* poArticolCompus.Curs,gnPc) - Round(poArticolCompus.vdiscountftva * poArticolCompus.Curs,gnPc)) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiminuattva = Round(Round((Round(poArticolCompus.vpretftva* poArticolCompus.Curs,gnPc) - Round(poArticolCompus.vdiscountftva * poArticolCompus.Curs,gnPc)) * poArticolCompus.cantitate, gnPc) * (poArticolCompus.proc_tvav - 1), gnPc)
		*!*			poArticolCompus.valdiminuatctva = poArticolCompus.valdiminuatftva + poArticolCompus.valdiminuattva
		*!*		Endif
		*!*	Else
		*!*		poArticolCompus.vvalftva = Round(poArticolCompus.vpretftva * poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vvalctva = Round(poArticolCompus.vpretctva * poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vvaltva = poArticolCompus.vvalctva - poArticolCompus.vvalftva
		*!*		poArticolCompus.vvaldiscountftva = Round(poArticolCompus.vdiscountftva * poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vvaldiscountctva = Round(poArticolCompus.vdiscountctva * poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vvaldiscounttva = poArticolCompus.vvaldiscountctva - poArticolCompus.vvaldiscountftva
		*!*		poArticolCompus.vvaldiminuatctva = Round((poArticolCompus.vpretctva - poArticolCompus.vdiscountctva) * poArticolCompus.cantitate,gnPc)
		*!*		poArticolCompus.vvaldiminuatftva = Round(Round((poArticolCompus.vpretctva - poArticolCompus.vdiscountctva) / poArticolCompus.proc_tvav,gnPc) * poArticolCompus.cantitate, gnPc)
		*!*		poArticolCompus.vvaldiminuattva = poArticolCompus.vvaldiminuatctva - poArticolCompus.vvaldiminuatftva
		*!*		If poDate.in_valuta = 0
		*!*			poArticolCompus.valftva = Round(poArticolCompus.pretftva * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valctva = Round(poArticolCompus.pretctva * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valtva = poArticolCompus.valctva - poArticolCompus.valftva
		*!*			poArticolCompus.valdiscountftva = Round(poArticolCompus.discountftva * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiscountctva = Round(poArticolCompus.discountctva * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiscounttva = poArticolCompus.valdiscountctva - poArticolCompus.valdiscountftva
		*!*			poArticolCompus.valdiminuatctva = Round((poArticolCompus.pretctva - poArticolCompus.discountctva) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiminuatftva = Round(Round((poArticolCompus.pretctva - poArticolCompus.discountctva) / poArticolCompus.proc_tvav,gnPc) * poArticolCompus.cantitate, gnPc)
		*!*			poArticolCompus.valdiminuattva = poArticolCompus.valdiminuatctva - poArticolCompus.valdiminuatftva
		*!*		Else
		*!*			poArticolCompus.valftva = Round(Round(poArticolCompus.vpretftva * poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valctva = Round(Round(poArticolCompus.vpretctva * poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valtva = poArticolCompus.valctva - poArticolCompus.valftva
		*!*			poArticolCompus.valdiscountftva = Round(Round(poArticolCompus.vdiscountftva * poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiscountctva = Round(Round(poArticolCompus.vdiscountctva * poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiscounttva = poArticolCompus.valdiscountctva - poArticolCompus.valdiscountftva
		*!*			poArticolCompus.valdiminuatctva = Round(Round((poArticolCompus.vpretctva - poArticolCompus.vdiscountctva)*poArticolCompus.Curs,gnPc) * poArticolCompus.cantitate,gnPc)
		*!*			poArticolCompus.valdiminuatftva = Round(Round(Round((poArticolCompus.vpretctva - poArticolCompus.vdiscountctva) * poArticolCompus.Curs,gnPc) / poArticolCompus.proc_tvav,gnPc) * poArticolCompus.cantitate, gnPc)
		*!*			poArticolCompus.valdiminuattva = poArticolCompus.valdiminuatctva - poArticolCompus.valdiminuatftva
		*!*		Endif
		*!*	EndIf
		poArticolCompus = calculeaza_totaluri(poArticolCompus)
		*!*	modificare	v 2.0.56	^
		Thisform.clb_DISCOUNTCTVA.Refresh()
		Thisform.clb_DISCOUNT_UNITAR.Refresh()
		Thisform.clb_PRETCTVA.Refresh()
		Thisform.clb_PRET_DIMINUAT.Refresh()
		Thisform.clb_TOTALCDISCOUNT.Refresh()
		Thisform.clb_TOTALFDISCOUNT.Refresh()
		Thisform.clb_tVA.Refresh()
		Thisform.clb_tVA_DISCOUNT.Refresh()
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local plReturn
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		
		Do Case
		Case Empty(Nvl(poArticolCompus.denumire,[]))
			amessagebox("Nu ati completat denumirea articolului compus!",0+48,"Atentie")
			Thisform.clb_articol.SetFocus()
			plReturn = .F.
		Case poArticolCompus.cantitate=0
			amessagebox("Cantitatea nu poate fi 0!",0+48,"Atentie")
			Thisform.clb_cantitate.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.56
		Case poArticolCompus.cantitate=0
			amessagebox("Cantitatea nu poate fi pozitiva!",0+48,"Atentie")
			Thisform.clb_cantitate.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.56	^
		Otherwise
			plReturn = .T.
		Endcase
		
		Return plReturn
	ENDPROC

	PROCEDURE Init
		DoDefault()
		
		*!*	modificare	v 2.0.46
		*!*	Thisform.clb_pretftva.do_activeaza(Iif(Empty(poDate.nume_valuta),1,2))
		If poDate.tip <> 4
			Thisform.clb_pretftva.do_activeaza(Iif(Empty(poDate.nume_valuta),1,2))
		Endif
		*!*	modificare	v 2.0.46	^
		Thisform.clb_discountctva.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_discount_unitar.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_tva_discount.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_pretftva.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_pretctva.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_tva.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_totalcdiscount.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_totalfdiscount.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_pret_diminuat.do_actualizeaza_lbval(poDate.nume_valuta)
	ENDPROC

	PROCEDURE clb_cantitate.Text_simplu1.InteractiveChange
		lcval=This.ControlSource
		&lcval=This.Value
		Thisform.do_calculeaza_preturi()
	ENDPROC

	PROCEDURE Clb_discountctva.tx_suma_nat.InteractiveChange
		Thisform.do_calculeaza_discount(This.value,2)
	ENDPROC

	PROCEDURE Clb_discountctva.tx_suma_val.InteractiveChange
		Thisform.do_calculeaza_discount(This.value,3)
	ENDPROC

	PROCEDURE Clb_pretftva.tx_suma_nat.InteractiveChange
		Thisform.do_calculeaza_totaluri(This.Value,1)
	ENDPROC

	PROCEDURE Clb_pretftva.tx_suma_val.InteractiveChange
		Thisform.do_calculeaza_totaluri(This.Value,2)
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_articol_factura 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_procent_adaos" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_articol" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_codmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_um" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_cantitate" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_cantitate.lb_explicatii" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_procent_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_pretftva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_pretctva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount_unitar" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tva_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discountctva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalfdiscount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalcdiscount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_pret_diminuat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_contract" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_explicatie_Tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ed_tx_explicatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cb_explicatie_saft" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_calculeaza_adaos
		*m: do_calculeaza_discount
		*m: do_calculeaza_pretctva
		*m: do_calculeaza_pretftva
		*m: do_calculeaza_totaluri
		*m: updateexplicatiesaft
		*p: larata		&& .T. - daca forma este ascunsa si trebuie apelata metoda show
		*p: lcuadaos
		*p: lmodpretctva		&& .T. daca pretul cu tva este modificabil
		*p: lmodpretftva		&& .T. daca pretul fara TVA este modificabil
		*p: ncantitatemax
		*p: nid
		*p: nidjtvacoloana_initial
		*p: nnivelmodificare		&& - 1 daca utilizatorul are voie sa modifice toate datele ; 0 daca are voie sa modifice doar nr. de telefon
		*p: nprocent
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		Caption = "Form"
		DoCreate = .T.
		Height = 450
		larata = .T.
		lcuadaos = .T.
		lmodpretctva = .F.
		lmodpretftva = .F.
		Name = "frm_articol_factura"
		ncantitatemax = 0
		nidjtvacoloana_initial = 0
		nnivelmodificare = -1
		nprocent = 0
		Width = 800
		_memberdata = <VFPData>
			<memberdata name="updateexplicatiesaft" display="UpdateExplicatieSaft"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 800
		_shape1.ZOrderSet = 1
		_shape2.Height = 29
		_shape2.Left = 732
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "ADĂUGARE ARTICOL"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 23
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 766
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 21
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Height = 27, ;
		Left = 734, ;
		Name = "But_renunt1", ;
		TabIndex = 22, ;
		Top = 1, ;
		Width = 30, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cb_contract' AS cb_tx_simplu WITH ;
		Height = 29, ;
		Left = 6, ;
		Name = "Cb_contract", ;
		TabIndex = 6, ;
		TabStop = .F., ;
		Top = 313, ;
		Width = 290, ;
		ZOrderSet = 21, ;
		_CBBASE1.ColumnCount = 2, ;
		_CBBASE1.ColumnLines = .F., ;
		_CBBASE1.ColumnWidths = "400,15", ;
		_CBBASE1.Height = 23, ;
		_CBBASE1.Left = 86, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSourceType = 2, ;
		_CBBASE1.Top = 3, ;
		_CBBASE1.Width = 192, ;
		_LBBASE1.Caption = "Contract", ;
		_LBBASE1.Left = 5, ;
		_LBBASE1.Name = "_LBBASE1", ;
		_LBBASE1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'cb_explicatie_saft' AS cb_tx_simplu WITH ;
		Height = 29, ;
		Left = 303, ;
		Name = "cb_explicatie_saft", ;
		TabIndex = 12, ;
		TabStop = .F., ;
		Top = 149, ;
		Visible = .F., ;
		Width = 491, ;
		ZOrderSet = 21, ;
		_cbbase1.BoundColumn = 3, ;
		_cbbase1.BoundTo = .T., ;
		_cbbase1.ColumnCount = 2, ;
		_cbbase1.ColumnLines = .F., ;
		_cbbase1.ColumnWidths = "500,50", ;
		_cbbase1.ControlSource = "poArticol.taxcode", ;
		_cbbase1.Height = 23, ;
		_cbbase1.Left = 141, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "select taxname, procent_taxa, taxcode from saft_taxtable where tva_livrari = 1 and procent_taxa = poArticol.proc_tvav*100-100 order by taxcode into cursor crsTaxTableX", ;
		_cbbase1.RowSourceType = 3, ;
		_cbbase1.Top = 3, ;
		_cbbase1.Width = 300, ;
		_lbbase1.Caption = "Taxa SAFT", ;
		_lbbase1.Left = 5, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cb_explicatie_Tva' AS cb_tx_simplu WITH ;
		Height = 29, ;
		Left = 303, ;
		Name = "Cb_explicatie_Tva", ;
		TabIndex = 11, ;
		TabStop = .F., ;
		Top = 121, ;
		Width = 491, ;
		ZOrderSet = 21, ;
		_cbbase1.ColumnCount = 2, ;
		_cbbase1.ColumnLines = .F., ;
		_cbbase1.ColumnWidths = "400,15", ;
		_cbbase1.Height = 23, ;
		_cbbase1.Left = 142, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "jtva_coloane.denumire,cota_tva,id_jtva_coloana", ;
		_cbbase1.RowSourceType = 6, ;
		_cbbase1.Top = 3, ;
		_cbbase1.Width = 300, ;
		_lbbase1.Caption = "Explicație TVA", ;
		_lbbase1.Left = 5, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_articol' AS clb_tx_simplu WITH ;
		Left = 6, ;
		Name = "clb_articol", ;
		TabIndex = 2, ;
		TabStop = .F., ;
		Top = 68, ;
		ZOrderSet = 7, ;
		Text_simplu1.ControlSource = "poArticol.denumire", ;
		Text_simplu1.FontBold = .T., ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "Articol", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_cantitate' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 303, ;
		Name = "clb_cantitate", ;
		TabIndex = 8, ;
		Top = 39, ;
		Width = 491, ;
		ZOrderSet = 10, ;
		Text_simplu1.Alignment = 1, ;
		Text_simplu1.ControlSource = "poArticol.cantitate", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = (get_mask(14,gnPcant)), ;
		Text_simplu1.Left = 197, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 151, ;
		Lb_simplu1.Caption = "Cantitate", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_cantitate.lb_explicatii' AS lb_simplu WITH ;
		Caption = "(1)", ;
		Height = 18, ;
		Left = 175, ;
		Name = "lb_explicatii", ;
		Top = 5, ;
		Width = 17
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'clb_codmat' AS clb_tx_simplu WITH ;
		Left = 6, ;
		Name = "clb_codmat", ;
		TabIndex = 1, ;
		TabStop = .F., ;
		Top = 40, ;
		ZOrderSet = 8, ;
		Text_simplu1.ControlSource = "poArticol.codmat", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "Cod material", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discount_unitar' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 303, ;
		Name = "Clb_discount_unitar", ;
		TabIndex = 16, ;
		Top = 259, ;
		Width = 491, ;
		ZOrderSet = 15, ;
		tx_suma_val.ControlSource = "poArticol.discount_unitar_val", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 198, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 2, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "Discount unitar fără TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticol.discount_unitar", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.Left = 347, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 2, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 300, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 4, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 447, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 4, ;
		lb_explicatii.Caption = "(5)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 175, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4, ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discountctva' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 303, ;
		Name = "Clb_discountctva", ;
		TabIndex = 18, ;
		TabStop = .F., ;
		Top = 313, ;
		Width = 491, ;
		ZOrderSet = 17, ;
		tx_suma_val.ControlSource = "poArticol.discount_unitar_ctva_val", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 199, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 2, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "Discount unitar cu TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticol.discount_unitar_ctva", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.Left = 348, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 2, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 301, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 4, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 448, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 4, ;
		lb_explicatii.Caption = "(7)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 175, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_pret_diminuat' AS clb_tx_sume_valuta WITH ;
		Height = 50, ;
		Left = 303, ;
		Name = "Clb_pret_diminuat", ;
		TabIndex = 19, ;
		Top = 340, ;
		Width = 491, ;
		ZOrderSet = 20, ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 198, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 24, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "Preț unitar diminuat fără TVA", ;
		lb_explicatie.FontBold = .T., ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 6, ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.Left = 347, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 24, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 300, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 28, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 447, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 27, ;
		lb_explicatii.FontBold = .T., ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 241, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4, ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_pretctva' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 303, ;
		levidentiat = .T., ;
		Name = "Clb_pretctva", ;
		TabIndex = 13, ;
		Top = 177, ;
		Width = 491, ;
		ZOrderSet = 14, ;
		tx_suma_val.ControlSource = "poArticol.pretctva_val", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 198, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 2, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "Preț cu TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticol.pretctva", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.Left = 347, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 2, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 300, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 4, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 447, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 4, ;
		lb_explicatii.Caption = "(4)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 175, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_pretftva' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 303, ;
		levidentiat = .T., ;
		Name = "Clb_pretftva", ;
		TabIndex = 9, ;
		Top = 67, ;
		Width = 491, ;
		ZOrderSet = 12, ;
		tx_suma_val.ControlSource = "poArticol.pretftva_val", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 197, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 2, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "Preț fără TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticol.pretftva", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.Height = 23, ;
		tx_suma_nat.Left = 346, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 2, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 299, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 4, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 446, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 4, ;
		lb_explicatii.Caption = "(2)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 175, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4, ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_procent_adaos' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 6, ;
		Name = "Clb_procent_adaos", ;
		TabIndex = 7, ;
		Top = 341, ;
		Width = 290, ;
		ZOrderSet = 0, ;
		Text_simplu1.Alignment = 1, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "99 999.99", ;
		Text_simplu1.Left = 87, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Value = 0, ;
		Text_simplu1.Width = 141, ;
		Lb_simplu1.Caption = "Procent adaos", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_procent_discount' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 303, ;
		Name = "Clb_procent_discount", ;
		TabIndex = 15, ;
		Top = 231, ;
		Width = 491, ;
		ZOrderSet = 11, ;
		Text_simplu1.Alignment = 1, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "99 999.99", ;
		Text_simplu1.Left = 200, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Value = 0, ;
		Text_simplu1.Width = 141, ;
		Lb_simplu1.Caption = "Procent discount", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_serie' AS clb_tx_simplu WITH ;
		Left = 6, ;
		Name = "Clb_serie", ;
		TabIndex = 3, ;
		Top = 96, ;
		Width = 290, ;
		ZOrderSet = 22, ;
		Text_simplu1.Alignment = 1, ;
		Text_simplu1.ControlSource = "poArticol.serie", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Serie", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalcdiscount' AS clb_tx_sume_valuta WITH ;
		Height = 50, ;
		Left = 303, ;
		Name = "Clb_totalcdiscount", ;
		TabIndex = 20, ;
		Top = 389, ;
		Width = 491, ;
		ZOrderSet = 19, ;
		tx_suma_val.ControlSource = "poArticol.vvaldiminuatctva", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 198, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 24, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "Total cu TVA cu discount", ;
		lb_explicatie.FontBold = .T., ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 6, ;
		tx_suma_nat.ControlSource = "poArticol.valdiminuatctva", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 347, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 24, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 300, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 27, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 447, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 27, ;
		lb_explicatii.FontBold = .T., ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 242, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4, ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalfdiscount' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 303, ;
		Name = "Clb_totalfdiscount", ;
		TabIndex = 14, ;
		Top = 204, ;
		Width = 491, ;
		ZOrderSet = 18, ;
		tx_suma_val.ControlSource = "poArticol.vvalctva", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 198, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 2, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "Total cu TVA fără discount", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticol.valctva", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 347, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 2, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 300, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 4, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 447, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 4, ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 175, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tva' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 303, ;
		Name = "Clb_tva", ;
		TabIndex = 10, ;
		Top = 94, ;
		Width = 491, ;
		ZOrderSet = 13, ;
		tx_suma_val.ControlSource = "poArticol.tva_val", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 197, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 2, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticol.tva", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.Left = 346, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 2, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 299, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 4, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 446, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 4, ;
		lb_explicatii.Caption = "(3)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 175, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tva_discount' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 303, ;
		Name = "Clb_tva_discount", ;
		TabIndex = 17, ;
		TabStop = .F., ;
		Top = 286, ;
		Width = 491, ;
		ZOrderSet = 16, ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 199, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 2, ;
		tx_suma_val.Width = 95, ;
		lb_explicatie.Caption = "TVA discount", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.Left = 348, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 2, ;
		tx_suma_nat.Width = 95, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 301, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 4, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 448, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 4, ;
		lb_explicatii.Caption = "(6)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 175, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'clb_um' AS clb_tx_simplu WITH ;
		Left = 6, ;
		Name = "clb_um", ;
		TabIndex = 4, ;
		TabStop = .F., ;
		Top = 124, ;
		Width = 290, ;
		ZOrderSet = 9, ;
		Text_simplu1.Alignment = 1, ;
		Text_simplu1.ControlSource = "poArticol.um", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "U.M.", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ed_tx_explicatie' AS ed_tx_simplu WITH ;
		Height = 162, ;
		Left = 6, ;
		Name = "Ed_tx_explicatie", ;
		TabIndex = 5, ;
		Top = 152, ;
		Width = 290, ;
		ZOrderSet = 23, ;
		_EDBASE1.ControlSource = "poArticol.explicatie", ;
		_EDBASE1.Format = "!", ;
		_EDBASE1.Height = 131, ;
		_EDBASE1.Left = 61, ;
		_EDBASE1.MaxLength = 500, ;
		_EDBASE1.Name = "_EDBASE1", ;
		_EDBASE1.Top = 2, ;
		_EDBASE1.Width = 227, ;
		_lbbase1.Caption = "Explicație", ;
		_lbbase1.Left = 4, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE do_calculeaza_adaos
		Lparameters tnValoare,tnTip
		If Thisform.lcuadaos
			Do Case
				Case tnTip = 1
					If poArticol.tip_valuta = 0
						poArticol.pretftva = Round(poArticol.pret_achizitie * (1+tnValoare/100),gnPPretV)
						Thisform.clb_pretftva.Refresh()
						Thisform.do_calculeaza_pretctva(poArticol.pretftva,3)
					Else
						poArticol.pretftva_val = Round(poArticol.pret_achizitie * (1+tnValoare/100) / poArticol.Curs * poArticol.multiplicator, gnPVal)
						Thisform.clb_pretftva.Refresh()
						Thisform.do_calculeaza_pretctva(poArticol.pretftva_val,4)
					Endif
				Case tnTip = 2		&&	s-a modificat pretul
					lnProcent = Iif(poArticol.pret_achizitie<>0,Round((poArticol.pretftva/poArticol.pret_achizitie-1)*100,2),0)
					Thisform.clb_procent_ADAOS.texT_SIMPLU1.Value = lnProcent
					Thisform.clb_procent_ADAOS.Refresh()
			Endcase
		Endif
	ENDPROC

	PROCEDURE do_calculeaza_discount
		Lparameters tnValoare,tnTip
		
		If poArticol.preturi_cu_tva = 0
			Do Case
			Case tnTip = 1				&&	s-a modificat procentul
				lnProcent = tnValoare
		*!*			If poArticol.tip_valuta = 0
		*!*				poArticol.discount_unitar = Round(poArticol.pretftva * lnProcent / 100, gnPc)
		*!*			Else
		*!*				poArticol.discount_unitar_val = Round(poArticol.pretftva_val * lnProcent / 100, gnPc)
		*!*				poArticol.discount_unitar = Round(poArticol.discount_unitar_val * poArticol.Curs, gnPc)
		*!*			Endif
				If poArticol.tip_valuta = 0
					poArticol.discount_unitar = Round(poArticol.pretftva * lnProcent / 100, gnPPretV)
					lnProcent = IIF(poArticol.pretftva<>0,Round(poArticol.discount_unitar / poArticol.pretftva * 100 , 2),0)
				Else
					poArticol.discount_unitar_val = Round(poArticol.pretftva_val * lnProcent / 100, gnPVal)
					poArticol.discount_unitar = Round(poArticol.discount_unitar_val * poArticol.Curs / poArticol.multiplicator, gnPPretV)
					lnProcent = IIF(poArticol.pretftva_val<>0,Round(poArticol.discount_unitar_val / poArticol.pretftva_val * 100 , 2),0)
				Endif
				Thisform.nprocent = lnProcent
				Thisform.clb_discount_unitar.Refresh()
			Case tnTip = 2				&&	s-a modificat discount-ul in lei
				poArticol.discount_unitar = tnValoare
				lnProcent = IIF(poArticol.pretftva<>0,Round(poArticol.discount_unitar / poArticol.pretftva * 100 , 2),0)
				Thisform.nprocent = lnProcent
				Thisform.clb_procent_discount.teXT_SIMPLU1.Value = lnProcent
				Thisform.clb_procent_discount.Refresh()
			Case tnTip = 3				&&	s-a modificat discount-ul in valuta
				poArticol.discount_unitar_val = tnValoare
				lnProcent = IIF(poArticol.pretftva_val<>0,Round(poArticol.discount_unitar_val / poArticol.pretftva_val * 100 , 2),0)
				poArticol.discount_unitar = Round(poArticol.discount_unitar_val * poArticol.Curs / poArticol.multiplicator,gnPPretV)
				Thisform.nprocent = lnProcent
				Thisform.clb_procent_discount.teXT_SIMPLU1.Value = lnProcent
				Thisform.clb_procent_discount.Refresh()
				Thisform.clb_discount_unitar.tx_suma_nat.Refresh()
			Endcase
		
			lnDiscountTva = Round(poArticol.discount_unitar * (poArticol.proc_tvav-1), gnPPretV)
			poArticol.discount_unitar_ctva = lnDiscountTva + poArticol.discount_unitar
			Thisform.clb_tva_discount.tx_suma_nat.Value = lnDiscountTva
		
			If poArticol.tip_valuta = 1
				lnDiscountTva_val = Round(poArticol.discount_unitar_val * (poArticol.proc_tvav-1), gnPVal)
				poArticol.discount_unitar_ctva_val = lnDiscountTva_val + poArticol.discount_unitar_val
				Thisform.clb_tva_discount.tx_suma_val.Value = lnDiscountTva_val
				Thisform.clb_pret_diminuat.tx_suma_val.Value = poArticol.pretftva_val - poArticol.discount_unitar_val
			Endif
			Thisform.clb_pret_diminuat.tx_suma_nat.Value = poArticol.pretftva - poArticol.discount_unitar
		
			Thisform.clb_discountctva.Refresh()
		Else
			Do Case
			Case tnTip = 1				&&	s-a modificat procentul
				lnProcent = tnValoare
		*!*			poArticol.discount_unitar_ctva	= Round(poArticol.pretctva * lnProcent / 100, gnPc)
		*!*			poArticol.discount_unitar_ctva_val = Round(poArticol.pretctva_val * lnProcent / 100, gnPc)
				If poArticol.tip_valuta = 0
					poArticol.discount_unitar_ctva	= Round(poArticol.pretctva * lnProcent / 100, gnPPretV)
					lnProcent = IIF(poArticol.pretctva<>0,Round(poArticol.discount_unitar_ctva / poArticol.pretctva * 100 , 2),0)
				Else
					poArticol.discount_unitar_ctva_val = Round(poArticol.pretctva_val * lnProcent / 100, gnPVal)
					poArticol.discount_unitar_ctva = Round(poArticol.discount_unitar_ctva_val * poArticol.Curs / poArticol.multiplicator, gnPPretV)
					lnProcent = IIF(poArticol.pretctva_val<>0,Round(poArticol.discount_unitar_ctva_val / poArticol.pretctva_val * 100 , 2),0)
				Endif
				Thisform.nprocent = lnProcent
				Thisform.clb_discountctva.Refresh()
			Case tnTip = 2				&&	s-a modificat discount-ul in lei
				poArticol.discount_unitar_ctva = tnValoare
				lnProcent = IIF(poArticol.pretctva<>0,Round(poArticol.discount_unitar_ctva / poArticol.pretctva * 100 , 2),0)
				Thisform.nprocent = lnProcent
				Thisform.clb_procent_discount.teXT_SIMPLU1.Value = lnProcent
				Thisform.clb_procent_discount.Refresh()
			Case tnTip = 3				&&	s-a modificat discount-ul in valuta
				poArticol.discount_unitar_ctva_val = tnValoare
				lnProcent = IIF(poArticol.pretctva_val<>0,Round(poArticol.discount_unitar_ctva_val / poArticol.pretctva_val * 100 , 2),0)
				poArticol.discount_unitar_ctva = Round(poArticol.discount_unitar_ctva_val * poArticol.Curs / poArticol.multiplicator,gnPPretV)
				Thisform.nprocent = lnProcent
				Thisform.clb_procent_discount.teXT_SIMPLU1.Value = lnProcent
				Thisform.clb_procent_discount.Refresh()
				Thisform.clb_discountctva.tx_suma_nat.Refresh()
			Endcase
		
			poArticol.discount_unitar = IIF(poArticol.proc_tvav<>0,Round(poArticol.discount_unitar_ctva / poArticol.proc_tvav , gnPPretV),0)
			Thisform.clb_tva_discount.tx_suma_nat.Value = poArticol.discount_unitar_ctva - poArticol.discount_unitar
		
			If poArticol.tip_valuta = 1
				poArticol.discount_unitar_val = IIF(poArticol.proc_tvav<>0,Round(poArticol.discount_unitar_ctva_val / poArticol.proc_tvav , gnPVal),0)
				Thisform.clb_tva_discount.tx_suma_val.Value = poArticol.discount_unitar_ctva_val - poArticol.discount_unitar_val
				Thisform.clb_pret_diminuat.tx_suma_val.Value = poArticol.pretctva_val - poArticol.discount_unitar_ctva_val
			Endif
		
			Thisform.clb_pret_diminuat.tx_suma_nat.Value = poArticol.pretctva - poArticol.discount_unitar_ctva
		
			Thisform.clb_discount_unitar.Refresh()
		Endif
		
		Thisform.clb_tva_discount.Refresh()
		Thisform.clb_pret_diminuat.Refresh()
		Thisform.do_calculeaza_totaluri()
		
	ENDPROC

	PROCEDURE do_calculeaza_pretctva
		Lparameters tnValoare,tnTip
		Do Case
			Case Inlist(tnTip,1,3)				&&	s-a modificat pretul fara tva in lei
				poArticol.pretftva = tnValoare
				poArticol.tva = Round(tnValoare * (poArticol.proc_tvav - 1),gnPPretV)
			Case Inlist(tnTip,2,4)				&&	s-a modificat pretul fara tva in valuta ; 4 : modificare v 2.0.90
				poArticol.pretftva_val = tnValoare
				poArticol.tva_val = Round(tnValoare * (poArticol.proc_tvav - 1), gnPVal)
				poArticol.pretctva_val = poArticol.pretftva_val + poArticol.tva_val
		
				poArticol.pretftva = Round(poArticol.pretftva_val * poArticol.Curs / poArticol.multiplicator, gnPPretV)
				poArticol.tva = Round(poArticol.pretftva * (poArticol.proc_tvav - 1),gnPPretV)
				Thisform.clb_pretftva.tx_SUMA_NAT.Refresh()
		Endcase
		
		poArticol.pretctva = poArticol.pretftva + poArticol.tva
		Thisform.clb_tva.Refresh()
		Thisform.clb_pretctva.Refresh()
		If !Inlist(tnTip,3,4)
			Thisform.do_calculeaza_adaos(0,2)
		Endif
		Thisform.do_calculeaza_discount(Thisform.clb_procent_discount.text_simplu1.Value,1)
		
	ENDPROC

	PROCEDURE do_calculeaza_pretftva
		Lparameters tnValoare,tnTip
		
		Do Case
		Case InList(tnTip,1,3)			&&	s-a modificat pretul cu tva in lei
			poArticol.pretctva = tnValoare
			poArticol.pretftva = Round(tnValoare / poArticol.proc_tvav,gnPPretV)
		
		Case tnTip = 2				&&	s-a modificat pretul cu tva in valuta
			poArticol.pretctva_val = tnValoare
			poArticol.pretftva_val = Round(tnValoare / poArticol.proc_tvav, gnPVal)
			poArticol.tva_val = poArticol.pretctva_val - poArticol.pretftva_val
		
			poArticol.pretctva = Round(poArticol.pretctva_val * poArticol.Curs / poArticol.multiplicator,gnPPretV)
			poArticol.pretftva = Round(poArticol.pretctva / poArticol.proc_tvav, gnPPretV)
			thisform.clb_pretctva.tx_SUMA_NAT.Refresh()
		Endcase
		
		poArticol.tva = poArticol.pretctva - poArticol.pretftva
		Thisform.clb_tva.Refresh()
		Thisform.clb_pretftva.Refresh()
		*!*	modificare	v 2.0.4
		*!*	thisform.do_calculeaza_adaos(0,2)
		If tnTip <> 3
			Thisform.do_calculeaza_adaos(0,2)
		Endif
		*!*	modificare	v 2.0.4	^
		Thisform.do_calculeaza_discount(Thisform.clb_procent_discount.text_simplu1.Value,1)
		*!*	Lparameters tnValoare,tnTip
		*!*	Do Case
		*!*	Case tnTip = 1				&&	s-a modificat procentul
		*!*		lnProcent = 1 + tnValoare / 100
		*!*		poArticol.pretftva = Round(poArticol.pret_achizitie * lnProcent, gnPc)
		*!*		poArticol.tva = Round(tnValoare * (poArticol.proc_tvav - 1),gnPc)
		*!*		lnProcent = Iif(poArticol.pretftva<>0,Round(poArticol.pret_achizitie / poArticol.pretftva * 100 , 2),0)
		*!*		Thisform.nprocent_adaos = lnProcent
		*!*		Thisform.clb_procent_adaos.Refresh()
		*!*		Thisform.clb_pretftva.Refresh()
		*!*	Case tnTip = 2				&&	s-a modificat pretul fara tva in lei
		*!*		poArticol.pretftva = tnValoare
		*!*		poArticol.tva = Round(tnValoare * (poArticol.proc_tvav - 1),gnPc)
		*!*		lnProcent = Iif(poArticol.pretftva<>0,Round(poArticol.pret_achizitie / poArticol.pretftva * 100 , 2),0)
		*!*		Thisform.nprocent_adaos = lnProcent
		*!*		Thisform.clb_procent_adaos.Refresh()
		*!*	Case tnTip = 3				&&	s-a modificat pretul fara tva in valuta
		*!*		poArticol.pretftva_val = tnValoare
		*!*		poArticol.tva_val = Round(tnValoare * (poArticol.proc_tvav - 1), gnPc)
		*!*		poArticol.pretctva_val = poArticol.pretftva_val + poArticol.tva_val
		
		*!*		poArticol.pretftva = Round(poArticol.pretftva_val * poArticol.Curs, gnPc)
		*!*		poArticol.tva = Round(poArticol.pretftva * (poArticol.proc_tvav - 1),gnPc)
		
		*!*		lnProcent = Iif(poArticol.pretftva_val<>0,Round(poArticol.discount_unitar_val / poArticol.pretftva_val * 100 , gnPc),0)
		*!*		Thisform.nprocent = lnProcent
		*!*		Thisform.nprocent_adaos = lnProcent
		*!*		Thisform.clb_procent_adaos.Refresh()
		*!*	Endcase
		
		*!*	poArticol.pretctva = poArticol.pretftva + poArticol.tva
		*!*	Thisform.clb_tva.Refresh()
		*!*	Thisform.clb_pretctva.Refresh()
		*!*	Thisform.do_calculeaza_discount(Thisform.clb_procent_discount.text_simplu1.Value,1)
	ENDPROC

	PROCEDURE do_calculeaza_totaluri
		*!*	modificare	v 2.0.56 : am mutat-o in calculeaza_totaluri ( oproceduri_facturare.prg )
		*!*	*!* v 2.0.15 calcul valoare tva din valoare cu tva daca preturi_cu_tva = 1
		*!*	Local lnProcTvav_19_119
		*!*	lnProcTvav_19_119 = (poArticol.proc_tvav - 1)/poArticol.proc_tvav
		*!*	*!* v 2.0.15 ^
		
		*!*	If poArticol.preturi_cu_tva = 0
		*!*		poArticol.vvalftva = Round(poArticol.Pretftva_val * poArticol.cantitate,gnPc)
		*!*		poArticol.vvaltva = Round(Round(poArticol.Pretftva_val * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*		poArticol.vvalctva = poArticol.vvalftva + poArticol.vvaltva
		
		*!*		poArticol.vvaldiminuatftva = Round((poArticol.Pretftva_val - poArticol.discount_unitar_val) * poArticol.cantitate,gnPc)
		*!*		poArticol.vvaldiminuattva = Round(Round((poArticol.Pretftva_val - poArticol.discount_unitar_val) * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*		poArticol.vvaldiminuatctva = poArticol.vvaldiminuatftva + poArticol.vvaldiminuattva
		
		*!*		poArticol.vvaldiscountftva = Round(poArticol.discount_unitar_val * poArticol.cantitate,gnPc)
		*!*		poArticol.vvaldiscounttva = Round(Round(poArticol.discount_unitar_val * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*		poArticol.vvaldiscountctva = poArticol.vvaldiscountftva + poArticol.vvaldiscounttva
		
		*!*		If poDate.in_valuta = 0
		*!*			poArticol.valftva = Round(poArticol.Pretftva * poArticol.cantitate,gnPc)
		*!*			poArticol.valtva = Round(Round(poArticol.Pretftva * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*			poArticol.valctva = poArticol.valftva + poArticol.valtva
		
		*!*			poArticol.valdiscountftva = Round(poArticol.discount_unitar * poArticol.cantitate,gnPc)
		*!*			poArticol.valdiscounttva = Round(Round(poArticol.discount_unitar * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*			poArticol.valdiscountctva = poArticol.valdiscountftva + poArticol.valdiscounttva
		
		*!*			poArticol.valdiminuatftva = Round((poArticol.Pretftva - poArticol.discount_unitar) * poArticol.cantitate,gnPc)
		*!*			poArticol.valdiminuattva = Round(Round((poArticol.Pretftva - poArticol.discount_unitar) * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*			poArticol.valdiminuatctva = poArticol.valdiminuatftva + poArticol.valdiminuattva
		
		*!*		Else
		*!*			poArticol.valftva = Round(Round(poArticol.Pretftva_val * poArticol.Curs,gnPc) * poArticol.cantitate,gnPc)
		*!*			poArticol.valtva = Round(Round(Round(poArticol.Pretftva_val * poArticol.Curs,gnPc) * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*			poArticol.valctva = poArticol.valftva + poArticol.valtva
		
		*!*			poArticol.valdiscountftva = Round(Round(poArticol.discount_unitar_val * poArticol.Curs,gnPc) * poArticol.cantitate,gnPc)
		*!*			poArticol.valdiscounttva = Round(Round(Round(poArticol.discount_unitar_val * poArticol.Curs,gnPc) * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*			poArticol.valdiscountctva = poArticol.valdiscountftva + poArticol.valdiscounttva
		
		*!*			poArticol.valdiminuatftva = Round((Round(poArticol.Pretftva_val* poArticol.Curs,gnPc) - ROUND(poArticol.discount_unitar_val* poArticol.Curs,gnPc)) * poArticol.cantitate,gnPc)
		*!*			poArticol.valdiminuattva = Round(Round((Round(poArticol.Pretftva_val* poArticol.Curs,gnPc) - ROUND(poArticol.discount_unitar_val* poArticol.Curs,gnPc)) * poArticol.cantitate, gnPc) * (poArticol.proc_tvav - 1), gnPc)
		*!*			poArticol.valdiminuatctva = poArticol.valdiminuatftva + poArticol.valdiminuattva
		*!*		Endif
		
		*!*	Else
		*!*		*!* v 2.0.15 calcul valoare tva din valoare cu tva daca preturi_cu_tva = 1
		*!*		poArticol.vvalctva = Round(poArticol.Pretctva_val * poArticol.cantitate, gnPVal)
		*!*		*!*		poArticol.vvalftva = Round(poArticol.Pretftva_val * poArticol.cantitate, gnPVal)
		*!*		*!*		poArticol.vvaltva = poArticol.vvalctva - poArticol.vvalftva
		*!*		poArticol.vvaltva = Round(poArticol.vvalctva * m.lnProcTvav_19_119, gnPVal)
		*!*		poArticol.vvalftva = poArticol.vvalctva - poArticol.vvaltva
		
		*!*		poArticol.vvaldiscountctva = Round(poArticol.discount_unitar_ctva_val * poArticol.cantitate, gnPVal)
		*!*		*!*		poArticol.vvaldiscountftva = Round(poArticol.discount_unitar_val * poArticol.cantitate, gnPVal)
		*!*		*!*		poArticol.vvaldiscounttva = poArticol.vvaldiscountctva - poArticol.vvaldiscountftva
		*!*		poArticol.vvaldiscounttva =  Round(poArticol.vvaldiscountctva * m.lnProcTvav_19_119, gnPVal)
		*!*		poArticol.vvaldiscountftva = poArticol.vvaldiscountctva - poArticol.vvaldiscounttva
		
		
		*!*		poArticol.vvaldiminuatctva = Round((poArticol.Pretctva_val - poArticol.discount_unitar_ctva) * poArticol.cantitate, gnPVal)
		*!*		*!*		poArticol.vvaldiminuatftva = Round(Round((poArticol.Pretctva_val - poArticol.discount_unitar_ctva) / poArticol.proc_tvav, gnPVal) * poArticol.cantitate, gnPVal)
		*!*		*!*		poArticol.vvaldiminuattva = poArticol.vvaldiminuatctva - poArticol.vvaldiminuatftva
		*!*		poArticol.vvaldiminuattva = Round(poArticol.vvaldiminuatctva  * m.lnProcTvav_19_119, gnPVal)
		*!*		poArticol.vvaldiminuatftva = poArticol.vvaldiminuatctva - poArticol.vvaldiminuattva
		
		*!*		If poDate.in_valuta = 0
		*!*			poArticol.valctva = Round(poArticol.Pretctva * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valftva = Round(poArticol.Pretftva * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valtva = poArticol.valctva - poArticol.valftva
		*!*			poArticol.valtva = Round(poArticol.valctva * m.lnProcTvav_19_119, gnPc)
		*!*			poArticol.valftva = poArticol.valctva - poArticol.valtva
		
		*!*			poArticol.valdiscountctva = Round(poArticol.discount_unitar_ctva * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valdiscountftva = Round(poArticol.discount_unitar * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valdiscounttva = poArticol.valdiscountctva - poArticol.valdiscountftva
		*!*			poArticol.valdiscounttva = Round(poArticol.valdiscountctva * m.lnProcTvav_19_119, gnPc)
		*!*			poArticol.valdiscountftva = poArticol.valdiscountctva - poArticol.valdiscounttva
		
		*!*			poArticol.valdiminuatctva = Round((poArticol.Pretctva - poArticol.discount_unitar_ctva) * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valdiminuatftva = Round(Round((poArticol.Pretctva - poArticol.discount_unitar_ctva) / poArticol.proc_tvav,gnPc) * poArticol.cantitate, gnPc)
		*!*			*!*			poArticol.valdiminuattva = poArticol.valdiminuatctva - poArticol.valdiminuatftva
		*!*			poArticol.valdiminuattva = Round(poArticol.valdiminuatctva * m.lnProcTvav_19_119, gnPc)
		*!*			poArticol.valdiminuatftva = poArticol.valdiminuatctva - poArticol.valdiminuattva
		*!*		Else
		*!*			poArticol.valctva = Round(Round(poArticol.Pretctva_val * poArticol.Curs,gnPc) * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valftva = Round(Round(poArticol.Pretftva_val * poArticol.Curs,gnPc) * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valtva = poArticol.valctva - poArticol.valftva
		*!*			poArticol.valtva = Round(poArticol.valctva * m.lnProcTvav_19_119, gnPc)
		*!*			poArticol.valftva = poArticol.valctva - poArticol.valtva
		
		*!*			poArticol.valdiscountctva = Round(Round(poArticol.discount_unitar_ctva_val * poArticol.Curs,gnPc) * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valdiscountftva = Round(Round(poArticol.discount_unitar_val * poArticol.Curs,gnPc) * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valdiscounttva = poArticol.valdiscountctva - poArticol.valdiscountftva
		*!*			poArticol.valdiscounttva = Round(poArticol.valdiscountctva * m.lnProcTvav_19_119, gnPc)
		*!*			poArticol.valdiscountftva = poArticol.valdiscountctva - poArticol.valdiscounttva
		
		*!*			poArticol.valdiminuatctva = Round((Round(poArticol.Pretctva_val*poArticol.Curs,gnPc) - Round(poArticol.discount_unitar_ctva_val*poArticol.Curs,gnPc)) * poArticol.cantitate,gnPc)
		*!*			*!*			poArticol.valdiminuatftva = Round(Round((Round(poArticol.Pretctva_val*poArticol.Curs,gnPc) - ROUND(poArticol.discount_unitar_ctva_val*poArticol.Curs,gnPc)) / poArticol.proc_tvav,gnPc) * poArticol.cantitate, gnPc)
		*!*			*!*			poArticol.valdiminuattva = poArticol.valdiminuatctva - poArticol.valdiminuatftva
		*!*			poArticol.valdiminuattva = Round(poArticol.valdiminuatctva * m.lnProcTvav_19_119, gnPc)
		*!*			poArticol.valdiminuatftva = poArticol.valdiminuatctva - poArticol.valdiminuattva
		*!*		Endif
		*!*		*!* v 2.0.15 ^
		*!*	Endif
		poArticol = calculeaza_totaluri(poArticol)	&&	in oproceduri_facturare.prg
		*!*	modificare	v 2.0.56	^
		thisform.clb_totalcdiscount.Refresh()
		thisform.clb_totalfdiscount.Refresh()
	ENDPROC

	PROCEDURE inainte_de_do_termin
		*!*	15.01.2024
		*!*	daca stocul nu conteaza (negestionabil, optiuni: facturare fara stoc / nu se scade stocul), nu mai verific cantitatea
		
		Local plReturn
		Local lccontrol, lcval, llFacturareFaraStoc, llGestionabil, llScadereStoc, llStoculConteaza
		
		*:Global pnProcentDiscountMem
		If !Thisform.larata
			lccontrol = Upper(This.ActiveControl.BaseClass )
			If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
				lcval=This.ActiveControl.ControlSource
				&lcval=Thisform.ActiveControl.Value
			Endif
		Endif
		
		
		llFacturareFaraStoc = (Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1)
		llGestionabil = (poArticol.gestionabil = 1)
		llScadereStoc = (Type('gnScadereStoc') = 'N' And m.gnScadereStoc  = 1)
		
		llStoculConteaza = !(llFacturareFaraStoc or !m.llGestionabil or !m.llScadereStoc)
				
		Do Case
			Case Empty(poArticol.id_jtva_coloana)
				amessagebox("Nu ati ales explicatia TVA!",48,"Atentie")
				Thisform.cb_explicatie_Tva.SetFocus()
				plReturn = .F.
		*!* v 2.0.15 - se pot factura articole cu pret 0
		*!*	Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 0 And poArticol.pretftva = 0
		*!*		amessagebox("Pretul fara TVA nu poate fi 0!",48,"Atentie")
		*!*		Thisform.clb_pretftva.tx_suma_nat.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 1 And poArticol.pretftva_val = 0
		*!*		amessagebox("Pretul fara TVA nu poate fi 0!",48,"Atentie")
		*!*		Thisform.clb_pretftva.tx_suma_val.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 0 And poArticol.pretctva = 0
		*!*		amessagebox("Pretul cu TVA nu poate fi 0!",48,"Atentie")
		*!*		Thisform.clb_pretctva.tx_suma_nat.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 1 And poArticol.pretctva_val = 0
		*!*		amessagebox("Pretul cu TVA nu poate fi 0!",48,"Atentie")
		*!*		Thisform.clb_pretctva.tx_suma_val.SetFocus()
		*!*		plReturn = .F.
		*!* v 2.0.15 ^
			Case Abs(poArticol.cantitate)>Abs(Thisform.ncantitatemax) And Inlist(poDate.tip,4,21,23,28,42,47) And poArticol.gestionabil = 1	AND m.llStoculConteaza &&	am scos tipul 3
		&&	modificare v 2.0.93 : am adaugat 47
				amessagebox("Cantitatea nu poate fi mai mare decat "+Alltrim(Str(Thisform.ncantitatemax))+" !",48,"Atentie")
				Thisform.clb_cantitate.SetFocus()
				plReturn = .F.
		*!* v 2.0.15 - se poate factura doar discount
		*!*	Case poArticol.tip_valuta=0 And poArticol.preturi_cu_tva = 0 And poArticol.discount_unitar>poArticol.pretftva
		*!*		amessagebox("Discountul nu poate fi mai mare decat pretul!",0+48,"Atentie")
		*!*		Thisform.clb_discount_unitar.tx_suma_nat.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.tip_valuta=1 And poArticol.preturi_cu_tva = 0 And poArticol.discount_unitar_val > poArticol.pretftva_val
		*!*		amessagebox("Discountul nu poate fi mai mare decat pretul!",0+48,"Atentie")
		*!*		Thisform.clb_discount_unitar.tx_suma_val.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.tip_valuta=0 And poArticol.preturi_cu_tva = 1 And poArticol.discount_unitar_ctva >poArticol.pretctva
		*!*		amessagebox("Discountul nu poate fi mai mare decat pretul!",0+48,"Atentie")
		*!*		Thisform.clb_discountctva.tx_suma_nat.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.tip_valuta=1 And poArticol.preturi_cu_tva = 1 And poArticol.discount_unitar_ctva_val>poArticol.pretctva_val
		*!*		amessagebox("Discountul nu poate fi mai mare decat pretul!",0+48,"Atentie")
		*!*		Thisform.clb_discountctva.tx_suma_val.SetFocus()
		*!*		plReturn = .F.
		*!* v 2.0.15 ^
		*!*	modificare	v 2.0.56
			Case poArticol.cantitate > 0 And Inlist(poDate.tip,8,9) AND m.llStoculConteaza
				amessagebox("Cantitatea nu poate fi mai mare decat 0!",0+48,"Atentie")
				Thisform.clb_cantitate.SetFocus()
				plReturn = .F.
			Case Abs(poArticol.cantitate)>Abs(Thisform.ncantitatemax) And Inlist(poDate.tip,8,9)
				amessagebox("Nu se poate returna mai mult decat a fost facturat!",48,"Atentie")
				Thisform.clb_cantitate.SetFocus()
				plReturn = .F.
		*!*	modificare	v 2.0.56	^
			Case poArticol.cantitate=0
				amessagebox("Cantitatea nu poate fi 0!",0+48,"Atentie")
				Thisform.clb_cantitate.SetFocus()
				plReturn = .F.
			Otherwise
		*!*	modificare	v 2.0.44
				Do Case
					Case  poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 0 And poArticol.pretftva = 0
						If amessagebox("Pretul fara TVA este 0. Doriti sa continuati?",4+32,"Atentie") = 7
							Thisform.clb_pretftva.tx_suma_nat.SetFocus()
							plReturn = .F.
						Else
							plReturn = .T.
						Endif
					Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 1 And poArticol.pretftva_val = 0
						If amessagebox("Pretul fara TVA este 0. Doriti sa continuati?",4+32,"Atentie") = 7
							Thisform.clb_pretftva.tx_suma_val.SetFocus()
							plReturn = .F.
						Else
							plReturn = .T.
						Endif
					Case poArticol.preturi_cu_tva = 1 And poArticol.tip_valuta = 0 And poArticol.pretctva = 0
						If amessagebox("Pretul cu TVA este 0. Doriti sa continuati?",4+32,"Atentie") = 7
							Thisform.clb_pretctva.tx_suma_nat.SetFocus()
							plReturn = .F.
						Else
							plReturn = .T.
						Endif
					Case poArticol.preturi_cu_tva = 1 And poArticol.tip_valuta = 1 And poArticol.pretctva_val = 0
						If amessagebox("Pretul cu TVA este 0. Doriti sa continuati?",4+32,"Atentie") = 7
							Thisform.clb_pretctva.tx_suma_val.SetFocus()
							plReturn = .F.
						Else
							plReturn = .T.
						Endif
					Otherwise
						plReturn = .T.
				Endcase
		*!*	modificare	v 2.0.67
				If Nvl(gnMemProcDisc,0) = 1 And plReturn
					pnProcentDiscountMem = Int(Thisform.clb_procent_discount.text_simplu1.Value)
				Endif
		*!*	modificare	v 2.0.67	^
		*!*	plReturn = .T.
		*!*	modificare	v 2.0.44	^
		Endcase
		
		If Thisform.larata And !plReturn
			Thisform.larata = !Thisform.larata
		Endif
		
		Return plReturn
		 
	ENDPROC

	PROCEDURE Init
		*!* 05.01.2017
		*!* marius.mutu
		*!* daca articolul nu are aleasa cota de TVA (ex: politica preturi din stoc sau tva ales la facturare), 
		*!* ma pozitionez pe cota tva 24/20/19 in functie de anul curent
		*!*	#4363
		
		*!* 08.01.2018
		*!* marius.mutu
		*!* daca articolul nu are aleasa cota de TVA (ex: politica preturi din stoc sau tva ales la facturare), 
		*!* ma pozitionez pe cota tva 24/20/19 in functie de anul curent
		
		
		Lparameters tnCantitate,tlAscunde
		Thisform.ncantitatemax = tnCantitate
		Thisform.larata = tlAscunde
		DoDefault()
		
		*!*	modificare	v 2.0.55
		*!*	If Nvl(gnScadereStoc,0) = 1
		If Nvl(gnScadereStoc,0) = 1 and poArticol.gestionabil = 1
		*!*	modificare	v 2.0.55	^
			Thisform.clb_serie.text_simplu1.ReadOnly = .T.
			Thisform.clb_serie.TabStop = .F.
		Else
			Thisform.clb_procent_adaos.Visible = .F.
			Thisform.lcuadaos = .F.
		Endif
		
		*!*	modificare	v 2.0.74
		Thisform.nidjtvacoloana_initial = poArticol.id_jtva_coloana
		Select jtva_coloane
		If !Isnull(poArticol.proc_tvav)
			Set Filter To cota_tva = poArticol.proc_tvav * 100 - 100
			If Nvl(poArticol.proc_tvav,0) * 100 - 100 = 0
				Locate For id_jtva_coloana = 8
				If !Found()
					Go Top
				Endif
			Else
				Go Top
			Endif
			poArticol.id_jtva_coloana = id_jtva_coloana
		Else
			Set Filter To
			lnProcTVAStandard = GetProcTvaStandard()
			LOCATE FOR cota_tva = m.lnProcTVAStandard
			IF !FOUND()
				Go TOP 
			ENDIF 	
			poArticol.proc_tvav = (cota_tva + 100)/100
			poArticol.id_jtva_coloana = id_jtva_coloana
		EndIf
		Thisform.cb_explicatie_Tva._cbbase1.Requery()
		Thisform.cb_explicatie_Tva._cbbase1.Value = denumire
		Thisform.cb_explicatie_Tva._cbbase1.Requery()
		*!*	modificare	v 2.0.74	^
		
		IF m.gl406
			This.cb_explicatie_saft.Visible = .T.
			Thisform.UpdateExplicatieSAFT() 
		ENDIF 	
		
		If poArticol.tip_valuta = 0
			poArticol.nume_val = []
			If poArticol.preturi_cu_tva = 0
				Thisform.do_calculeaza_discount(poArticol.discount_unitar,2)
			Else
				Thisform.do_calculeaza_discount(poArticol.discount_unitar_ctva,2)
			Endif
			lnTip = 1
		Else
			If poArticol.preturi_cu_tva = 0
				Thisform.do_calculeaza_discount(poArticol.discount_unitar_val,3)
			Else
				Thisform.do_calculeaza_discount(poArticol.discount_unitar_ctva_val,2)
			Endif
			lnTip = 2
		Endif
		
		*!*	modificare	v 2.0.74	: am mutat bucata de cod inainte de calcularea discountului
		*!*	*!*	modificare	v 2.0.46
		*!*	Thisform.nidjtvacoloana_initial = poArticol.id_jtva_coloana
		*!*	Select jtva_coloane
		*!*	If !Isnull(poArticol.proc_tvav)
		*!*		Set Filter To cota_tva = poArticol.proc_tvav * 100 - 100
		*!*		If Nvl(poArticol.proc_tvav,0) * 100 - 100 = 0
		*!*			Locate For id_jtva_coloana = 8
		*!*			If !Found()
		*!*				Go Top
		*!*			Endif
		*!*		Else
		*!*			Go Top
		*!*		Endif
		*!*		poArticol.id_jtva_coloana = id_jtva_coloana
		*!*	Else
		*!*		Set Filter To
		*!*		Go Top
		*!*		poArticol.proc_tvav = (cota_tva + 100)/100
		*!*		poArticol.id_jtva_coloana = id_jtva_coloana
		*!*	EndIf
		*!*	*!*	modificare	v 2.0.40 : # 1985
		*!*	Thisform.cb_explicatie_Tva._cbbase1.Requery()
		*!*	*!*	modificare	v 2.0.40 : # 1985	^
		*!*	Thisform.cb_explicatie_Tva._cbbase1.Value = denumire
		*!*	Thisform.cb_explicatie_Tva._cbbase1.Requery()
		*!*	*!*	modificare	v 2.0.46	^
		*!*	modificare	v 2.0.74	^
		
		*!*	modificare v 2.0.4
		*!*	If Iif(Type('poArticol.modificabil')<>'U',poArticol.modificabil,0) = 1
		*!*	modificare	v 2.0.30 : am adaugat 41
		*!*	modificare  v 2.0.44 : am adaugat 42
		*!*	If Inlist(poDate.tip,1,3,5,21,22,23,25,28,29,41,42)
		If Inlist(poDate.tip,1,5,10,22,23,25,29,41)		&&	modificare v 2.0.56 : am adaugat 10
		*!*	modificare v 2.0.4	^
			If poArticol.preturi_cu_tva = 0
				Thisform.lmodpretftva = .T.
				Thisform.clb_pretftva.do_activeaza(lnTip)
			Else
				Thisform.lmodpretctva = .T.
		*!*	modificare	v 2.0.4
		*!*			Thisform.RemoveObject('clb_procent_adaos')
		*!*			thisform.lcuadaos = .F.
		*!*	modificare	v 2.0.4	^
				Thisform.clb_pretctva.do_activeaza(lnTip)
			Endif
		Else
			Thisform.clb_procent_adaos.Visible = .F.
			Thisform.lcuadaos = .F.
			If poArticol.preturi_cu_tva = 0 And ;
					((poArticol.pretftva = 0 And lnTip = 1) Or (poArticol.pretftva_val = 0 And lnTip = 2))
				Thisform.lmodpretftva = .T.
				Thisform.clb_pretftva.do_activeaza(lnTip)
			Else
				If poArticol.preturi_cu_tva = 1 And ;
						((poArticol.pretctva = 0 And lnTip = 1) Or (poArticol.pretctva_val = 0 And lnTip = 2))
					Thisform.lmodpretctva = .T.
					Thisform.clb_pretctva.do_activeaza(lnTip)
				Endif
			Endif
		Endif
		
		If poArticol.preturi_cu_tva = 0
			Thisform.clb_discount_unitar.do_activeaza(lnTip)
			Thisform.clb_totalfdiscount.lb_explicatii.Caption = []
			Thisform.clb_totalcdiscount.lb_explicatii.Caption = []
			Thisform.clb_pret_diminuat.lb_explicatii.Caption = [(2) - (5)]
		Else
			Thisform.clb_discountctva.do_activeaza(lnTip)
			Thisform.clb_totalfdiscount.lb_explicatii.Caption = [(1) * (4)]
			Thisform.clb_totalcdiscount.lb_explicatii.Caption = [(1) * ( (4) - (7) )]
			With Thisform.clb_pret_diminuat
				.lb_explicatie.Caption = [Pret unitar diminuat cu TVA]
				.lb_explicatii.Caption = [(4) - (7)]
			Endwith
		Endif
		
		*!*	modificare	v 2.0.19
		*!*	If (poDate.tip=2 And pnTipFacturare=3) Or INLIST(poDate.tip,4,23)
		*!*	modificare	v 2.0.67
		*!*	If (poDate.tip=2 And pnTipFacturare=3) Or poDate.tip = 4
		If (poDate.tip=2 And poArticol.opt_facturare=3) Or poDate.tip = 4
		*!*	modificare	v 2.0.67	^
		*!*	modificare	v 2.0.19	^
			Thisform.clb_discount_unitar.do_dezactiveaza()
			Thisform.clb_discountctva.do_dezactiveaza()
			With Thisform.clb_procent_discount.text_simplu1
				.ReadOnly = .T.
				.TabStop = .F.
			Endwith
		*!*	modificare	v 2.0.67
		Else
			If poArticol.discount_unitar_val = 0 And poArticol.discount_unitar = 0 AND Nvl(gnMemProcDisc,0) = 1
				Thisform.clb_procent_discount.text_simplu1.Value = pnProcentDiscountMem
			Endif
		*!*	modificare	v 2.0.67	^
		Endif
		
		*!*	modificare	v 2.0.46
		*!*	Select jtva_coloane
		*!*	If !Isnull(poArticol.proc_tvav)
		*!*		Set Filter To cota_tva = poArticol.proc_tvav * 100 - 100
		*!*		If Nvl(poArticol.proc_tvav,0) * 100 - 100 = 0
		*!*			Locate For id_jtva_coloana = 8
		*!*			If !Found()
		*!*				Go Top
		*!*			Endif
		*!*		Else
		*!*			Go Top
		*!*		Endif
		*!*		poArticol.id_jtva_coloana = id_jtva_coloana
		*!*	*!*		Thisform.cb_explicatie_Tva._cbbase1.Value = denumire
		*!*	*!*		Thisform.cb_explicatie_Tva._cbbase1.Requery()
		*!*	Else
		*!*		Set Filter To
		*!*		Go Top
		*!*		poArticol.proc_tvav = (cota_tva + 100)/100
		*!*		poArticol.id_jtva_coloana = id_jtva_coloana
		*!*	*!*		Thisform.cb_explicatie_Tva._cbbase1.Value = denumire
		*!*	*!*		Thisform.cb_explicatie_Tva._cbbase1.Requery()
		*!*	Endif
		*!*	*!*	modificare	v 2.0.40 : # 1985
		*!*	Thisform.cb_explicatie_Tva._cbbase1.Requery()
		*!*	*!*	modificare	v 2.0.40 : # 1985	^
		*!*	Thisform.cb_explicatie_Tva._cbbase1.Value = jtva_coloane.denumire
		*!*	Thisform.cb_explicatie_Tva._cbbase1.Requery()
		*!*	Thisform.nidjtvacoloana_initial = poArticol.id_jtva_coloana
		*!*	modificare	v 2.0.46	^
		
		*!*	modificare	v 2.0.67
		If !Used('crsCtrTemp') Or !Isnull(poArticol.id_ctr)
			Thisform.RemoveObject('cb_contract')
		Else
			If Reccount('crsCtrTemp') = 1
				Thisform.cb_contract.Enabled = .F.
			Endif
			Thisform.cb_contract._cbbase1.RowSource=[crsCtrTemp.contract,id_ctr]
			Select crsCtrTemp
			Locate For INLIST(opt_facturare,4,0)
			If !Found()
				Go Top
			Endif
			Thisform.cb_contract._cbbase1.Value = Alltrim(contract)
			poArticol.id_ctr = id_ctr
		Endif
		*!*	modificare	v 2.0.67	^
		
		*!*	modificare v 2.0.56
		If !Thisform.clb_procent_adaos.Visible
			Thisform.RemoveObject('clb_procent_adaos')
		Endif
		*!*	modificare v 2.0.56	^
		Thisform.clb_discountctva.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_discount_unitar.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_tva_discount.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_pretftva.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_pretctva.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_tva.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_totalcdiscount.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_totalfdiscount.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_pret_diminuat.do_actualizeaza_lbval(poArticol.nume_val)
		If !Thisform.larata
			Thisform.clb_cantitate.SetFocus()
		EndIf
	ENDPROC

	PROCEDURE updateexplicatiesaft
		* Daca nu este activata SAFT 406 nu fac nimic
		Local lcSelect, ldDataAct, llFurnizorRTVAI, lnIdJtva
		IF !m.gl406
			RETURN
		ENDIF
		 
		lcSelect = SELECT()
		This.cb_explicatie_saft._cbbase1.Requery()
		
		ldDataAct = poDate.dataact
		lnIdJtva = poArticol.id_jtva_coloana
		llFurnizorRTVAI = .F.
		
		poArticol.taxcode = GetTaxCode(m.gnAn, m.gnLuna, m.ldDataAct, m.lnIdJtva, m.llFurnizorRTVAI)
		this.cb_explicatie_saft._cbbase1.Refresh()
		SELECT (m.lcSelect) 
	ENDPROC

	PROCEDURE Cb_contract._CBBASE1.InteractiveChange
		Select crsCtrTemp
		poArticol.id_ctr = id_ctr
	ENDPROC

	PROCEDURE Cb_explicatie_Tva._cbbase1.InteractiveChange
		*!*	Select jtva_coloane
		*!*	poArticol.id_jtva_coloana = id_jtva_coloana
		*!*	If Iif(Type('poArticol.modificabil')<>'U',poArticol.modificabil,0)=1
		*!*		poArticol.proc_tvav = (cota_tva + 100) / 100
		*!*	Endif
		*!*	If Empty(Thisform.nidjtvacoloana_initial)
		*!*		poArticol.proc_tvav = (cota_tva + 100) / 100
		*!*		Thisform.do_calculeaza_discount(Thisform.clb_procent_discount.text_simplu1.Value,1)
		*!*	Endif
		Select jtva_coloane
		poArticol.id_jtva_coloana = id_jtva_coloana
		If Iif(Type('poArticol.modificabil')<>'U',poArticol.modificabil,0)=1
			poArticol.proc_tvav = (cota_tva + 100) / 100
		Endif
		If Empty(Thisform.nidjtvacoloana_initial)
			poArticol.proc_tvav = (cota_tva + 100) / 100
			Do Case
		*!*	modificare ROAFACTURARE	v 2.0.77
		*!*		Case Thisform.clb_pretftva.tx_suma_nat.ReadOnly = .F.
		*!*			Thisform.do_calculeaza_pretctva(Thisform.clb_pretftva.tx_suma_nat.Value,1)
		*!*		Case Thisform.clb_pretftva.tx_suma_val.ReadOnly = .F.
		*!*			Thisform.do_calculeaza_pretctva(Thisform.clb_pretftva.tx_suma_val.Value,2)
		*!*		Case Thisform.clb_pretctva.tx_suma_nat.ReadOnly = .F.
		*!*			Thisform.do_calculeaza_pretftva(Thisform.clb_pretctva.tx_suma_nat.value,1)
		*!*		Case Thisform.clb_pretctva.tx_suma_val.ReadOnly = .F.
		*!*			Thisform.do_calculeaza_pretftva(Thisform.clb_pretctva.tx_suma_val.value,2)
		*!*	modificare ROAFACTURARE	v 2.0.77	^
			Case Iif(Type("Thisform.clb_pretftva.tx_suma_nat.ReadOnly")<>"U",Thisform.clb_pretftva.tx_suma_nat.ReadOnly,.T.) = .F.
				Thisform.do_calculeaza_pretctva(Thisform.clb_pretftva.tx_suma_nat.Value,1)
			Case Iif(Type("Thisform.clb_pretftva.tx_suma_val.ReadOnly")<>"U",Thisform.clb_pretftva.tx_suma_val.ReadOnly,.T.) = .F.
				Thisform.do_calculeaza_pretctva(Thisform.clb_pretftva.tx_suma_val.Value,2)
			Case Iif(Type("Thisform.clb_pretctva.tx_suma_nat.ReadOnly")<>"U",Thisform.clb_pretctva.tx_suma_nat.ReadOnly,.T.) = .F.
				Thisform.do_calculeaza_pretftva(Thisform.clb_pretctva.tx_suma_nat.Value,1)
			Case Iif(Type("Thisform.clb_pretctva.tx_suma_val.ReadOnly")<>"U",Thisform.clb_pretctva.tx_suma_val.ReadOnly,.T.) = .F.
				Thisform.do_calculeaza_pretftva(Thisform.clb_pretctva.tx_suma_val.Value,2)
			Otherwise
				Thisform.do_calculeaza_discount(Thisform.clb_procent_discount.text_simplu1.Value,1)
			Endcase
		ENDIF
		
		Thisform.UpdateExplicatieSaft()
	ENDPROC

	PROCEDURE clb_cantitate.Text_simplu1.InteractiveChange
		lcval=This.ControlSource
		&lcval=This.Value
		Thisform.do_calculeaza_totaluri()
	ENDPROC

	PROCEDURE Clb_discountctva.tx_suma_nat.Valid
		IF this.Value <> this.Parent.nSumaNatOld
			Thisform.do_calculeaza_discount(This.value,2)
		ENDIF 	
	ENDPROC

	PROCEDURE Clb_discountctva.tx_suma_val.Valid
		IF this.Value <> this.Parent.nSumaValOld
			Thisform.do_calculeaza_discount(This.value,3)
		ENDIF 	
	ENDPROC

	PROCEDURE Clb_discount_unitar.tx_suma_nat.Valid
		IF this.Value <> this.Parent.nSumaNatOld
			Thisform.do_calculeaza_discount(This.value,2)
		ENDIF 	
	ENDPROC

	PROCEDURE Clb_discount_unitar.tx_suma_val.Valid
		IF this.Value <> this.Parent.nSumaValOld
			Thisform.do_calculeaza_discount(This.value,3)
		ENDIF 	
	ENDPROC

	PROCEDURE Clb_pretctva.tx_suma_nat.InteractiveChange
		Thisform.do_calculeaza_pretftva(This.Value,1)
	ENDPROC

	PROCEDURE Clb_pretctva.tx_suma_val.InteractiveChange
		Thisform.do_calculeaza_pretftva(This.Value,2)
	ENDPROC

	PROCEDURE Clb_pretftva.tx_suma_nat.InteractiveChange
		Thisform.do_calculeaza_pretctva(This.Value,1)
	ENDPROC

	PROCEDURE Clb_pretftva.tx_suma_val.InteractiveChange
		Thisform.do_calculeaza_pretctva(This.Value,2)
	ENDPROC

	PROCEDURE Clb_procent_adaos.Text_simplu1.InteractiveChange
		Thisform.do_calculeaza_adaos(this.Value,1)
	ENDPROC

	PROCEDURE Clb_procent_discount.Text_simplu1.InteractiveChange
		Thisform.do_calculeaza_discount(This.Value,1)
		
	ENDPROC

	PROCEDURE Clb_procent_discount.Text_simplu1.LostFocus
		This.Value = Thisform.nprocent
	ENDPROC

	PROCEDURE Clb_procent_discount.Text_simplu1.ProgrammaticChange
		This.InteractiveChange()
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_articol_factura_rate 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_den_rata" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_nr_rata" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_data_scadenta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_pretftva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_pretctva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_explicatie_Tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cb_explicatie_saft" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_calculeaza_rata
		*m: updateexplicatiesaft
		*p: nid
		*p: nnivelmodificare		&& - 1 daca utilizatorul are voie sa modifice toate datele ; 0 daca are voie sa modifice doar nr. de telefon
		*p: npretmax
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 275
		Name = "frm_articol_factura_rate"
		nnivelmodificare = -1
		npretmax = 0
		Width = 395
		_memberdata = <VFPData>
			<memberdata name="updateexplicatiesaft" display="UpdateExplicatieSAFT"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 400
		_shape2.Height = 29
		_shape2.Left = 326
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		Lb_titlu_alb_b121.Caption = "ADĂUGARE RATĂ"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 10
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 363
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 8
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Height = 27, ;
		Left = 331, ;
		Name = "But_renunt1", ;
		TabIndex = 9, ;
		Top = 1, ;
		Width = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cb_explicatie_saft' AS cb_tx_simplu WITH ;
		Height = 29, ;
		Left = 13, ;
		Name = "cb_explicatie_saft", ;
		TabIndex = 12, ;
		TabStop = .F., ;
		Top = 210, ;
		Visible = .F., ;
		Width = 371, ;
		ZOrderSet = 21, ;
		_cbbase1.BoundColumn = 3, ;
		_cbbase1.BoundTo = .T., ;
		_cbbase1.ColumnCount = 2, ;
		_cbbase1.ColumnLines = .F., ;
		_cbbase1.ColumnWidths = "500,50", ;
		_cbbase1.ControlSource = "poArticol.taxcode", ;
		_cbbase1.Height = 23, ;
		_cbbase1.Left = 120, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "select taxname, procent_taxa, taxcode from saft_taxtable where tva_livrari = 1 and procent_taxa = poArticol.proc_tvav*100-100 order by taxcode into cursor crsTaxTableX", ;
		_cbbase1.RowSourceType = 3, ;
		_cbbase1.Top = 3, ;
		_cbbase1.Width = 245, ;
		_lbbase1.Caption = "Taxa SAFT", ;
		_lbbase1.Left = 5, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cb_explicatie_Tva' AS cb_tx_simplu WITH ;
		Height = 29, ;
		Left = 13, ;
		Name = "Cb_explicatie_Tva", ;
		TabIndex = 6, ;
		TabStop = .F., ;
		Top = 182, ;
		Width = 371, ;
		_cbbase1.ColumnCount = 2, ;
		_cbbase1.ColumnLines = .F., ;
		_cbbase1.ColumnWidths = "400,15", ;
		_cbbase1.FontName = "Arial", ;
		_cbbase1.Left = 120, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "jtva_coloane.denumire,cota_tva,id_jtva_coloana", ;
		_cbbase1.RowSourceType = 6, ;
		_cbbase1.Width = 245, ;
		_lbbase1.Caption = "Explicație TVA", ;
		_lbbase1.FontName = "Arial", ;
		_lbbase1.Left = 4, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_data_scadenta' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 13, ;
		Name = "clb_data_scadenta", ;
		TabIndex = 3, ;
		TabStop = .F., ;
		Top = 100, ;
		Width = 371, ;
		TEXT_SIMPLU1.Alignment = 1, ;
		TEXT_SIMPLU1.Left = 120, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.ReadOnly = .T., ;
		TEXT_SIMPLU1.Value = {}, ;
		TEXT_SIMPLU1.Width = 120, ;
		LB_SIMPLU1.Caption = "Data scadență", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_den_rata' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 13, ;
		Name = "clb_den_rata", ;
		TabIndex = 2, ;
		TabStop = .F., ;
		Top = 72, ;
		Width = 371, ;
		Text_simplu1.ControlSource = "poArticol.denumire", ;
		Text_simplu1.FontBold = .T., ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 120, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 245, ;
		Lb_simplu1.Caption = "Denumire rată", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_nr_rata' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 13, ;
		Name = "clb_nr_rata", ;
		TabIndex = 1, ;
		TabStop = .F., ;
		Top = 44, ;
		Width = 371, ;
		TEXT_SIMPLU1.ControlSource = "poArticol.nr_rata", ;
		TEXT_SIMPLU1.InputMask = (get_mask(14,0)), ;
		TEXT_SIMPLU1.Left = 120, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.ReadOnly = .T., ;
		TEXT_SIMPLU1.Width = 120, ;
		LB_SIMPLU1.Caption = "Nr. rată", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_pretctva' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 13, ;
		Name = "Clb_pretctva", ;
		TabIndex = 7, ;
		Top = 238, ;
		Width = 371, ;
		tx_suma_val.ControlSource = "poArticol.pretctva_val", ;
		tx_suma_val.FontName = "Arial", ;
		tx_suma_val.Left = 120, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Width = 80, ;
		lb_explicatie.Caption = "Rata cu TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 6, ;
		tx_suma_nat.ControlSource = "poArticol.pretctva", ;
		tx_suma_nat.FontName = "Arial", ;
		tx_suma_nat.Left = 250, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Width = 80, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 204, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 334, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Caption = "(3)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 100, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_pretftva' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 13, ;
		Name = "Clb_pretftva", ;
		TabIndex = 4, ;
		Top = 128, ;
		Width = 371, ;
		tx_suma_val.ControlSource = "poArticol.pretftva_val", ;
		tx_suma_val.FontName = "Arial", ;
		tx_suma_val.Left = 120, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 1, ;
		tx_suma_val.Width = 80, ;
		lb_explicatie.Caption = "Rata fără TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		tx_suma_nat.ControlSource = "poArticol.pretftva", ;
		tx_suma_nat.FontName = "Arial", ;
		tx_suma_nat.Height = 23, ;
		tx_suma_nat.Left = 250, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 1, ;
		tx_suma_nat.Width = 80, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 204, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 4, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 334, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 4, ;
		lb_explicatii.Caption = "(1)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 100, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4, ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tva' AS clb_tx_sume_valuta WITH ;
		Height = 28, ;
		Left = 13, ;
		Name = "Clb_tva", ;
		TabIndex = 5, ;
		Top = 155, ;
		Width = 371, ;
		tx_suma_val.ControlSource = "poArticol.tva_val", ;
		tx_suma_val.FontName = "Arial", ;
		tx_suma_val.Left = 120, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Width = 80, ;
		lb_explicatie.Caption = "TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 6, ;
		tx_suma_nat.ControlSource = "poArticol.tva", ;
		tx_suma_nat.FontName = "Arial", ;
		tx_suma_nat.Left = 250, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Width = 80, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 204, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 334, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_explicatii.Caption = "(2)", ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 100, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4, ;
		lb_explicatii.Visible = .T.
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />
	
	PROCEDURE do_calculeaza_rata
		Lparameters tnValoare,tnTip
		If poArticol.preturi_cu_tva = 0
			Do Case
			Case tnTip = 1
				poArticol.pretftva = tnValoare
			Case tnTip = 2
				poArticol.pretftva_val = tnValoare
				poArticol.tva_val = Round(poArticol.pretftva_val *(poArticol.proc_tvav - 1),gnPVal)
				poArticol.pretctva_val = poArticol.pretftva_val + poArticol.tva_val
				poArticol.pretftva = Round(poArticol.pretftva_val * poArticol.Curs / poArticol.multiplicator,gnPPretV)
				Thisform.clb_pretftva.tx_SUMA_NAT.Refresh()
			Endcase
			poArticol.tva = Round(poArticol.pretftva * (poArticol.proc_tvav - 1),gnPPretV)
			poArticol.pretctva = poArticol.pretftva + poArticol.tva
		
			Thisform.clb_pretctva.Refresh()
		Else
			Do Case
			Case tnTip = 1
				poArticol.pretctva = tnValoare
			Case tnTip = 2
				poArticol.pretctva_val = tnValoare
				poArticol.pretftva_val = Round(poArticol.pretctva_val / poArticol.proc_tvav, gnPVal)
				poArticol.tva_val = poArticol.pretctva_val - poArticol.pretftva_val
				poArticol.pretctva = Round(poArticol.pretctva_val * poArticol.Curs / poArticol.multiplicator , gnPPretV)
			Endcase
			poArticol.pretftva = Round(poArticol.pretctva / poArticol.proc_tvav, gnPPretV)
			poArticol.tva = poArticol.pretctva - poArticol.pretftva
			Thisform.clb_pretftva.Refresh()
		Endif
		Thisform.clb_tva.Refresh()
		
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local plReturn
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		
		Do Case
		Case poArticol.tip_valuta=0 And poArticol.preturi_cu_tva = 0 and poArticol.pretftva <= 0
			amessagebox("Rata trebuie sa fie mai mare decat 0!",0+48,"Atentie")
			Thisform.clb_pretftva.tx_suma_nat.SetFocus()
			plReturn = .F.
		Case poArticol.tip_valuta=1 And poArticol.preturi_cu_tva = 0 And poArticol.pretftva_val <= 0
			amessagebox("Rata trebuie sa fie mai mare decat 0!",0+48,"Atentie")
			Thisform.clb_pretftva.tx_suma_val.SetFocus()
			plReturn = .F.
		Case poArticol.tip_valuta=0 And poArticol.preturi_cu_tva = 1 And poArticol.pretctva <= 0
			amessagebox("Rata trebuie sa fie mai mare decat 0!",0+48,"Atentie")
			Thisform.clb_pretctva.tx_suma_nat.SetFocus()
			plReturn = .F.
		Case poArticol.tip_valuta=1 And poArticol.preturi_cu_tva = 1 And poArticol.pretctva_val <= 0
			amessagebox("Rata trebuie sa fie mai mare decat 0!",0+48,"Atentie")
			Thisform.clb_pretctva.tx_suma_val.SetFocus()
			plReturn = .F.
		Case poArticol.tip_valuta=0 And poArticol.preturi_cu_tva = 0 and poArticol.pretftva > thisform.npretmax
			amessagebox("Rata nu poate fi mai mare decat "+Alltrim(Str(Thisform.npretmax,14,gnPPretV))+" !",0+48,"Atentie")
			Thisform.clb_pretftva.tx_suma_nat.SetFocus()
			plReturn = .F.
		Case poArticol.tip_valuta=1 And poArticol.preturi_cu_tva = 0 And poArticol.pretftva_val > thisform.npretmax
			amessagebox("Rata nu poate fi mai mare decat "+Alltrim(Str(Thisform.npretmax,14,gnPVal))+" !",0+48,"Atentie")
			Thisform.clb_pretftva.tx_suma_val.SetFocus()
			plReturn = .F.
		Case poArticol.tip_valuta=0 And poArticol.preturi_cu_tva = 1 And poArticol.pretctva > thisform.npretmax
			amessagebox("Rata nu poate fi mai mare decat "+Alltrim(Str(Thisform.npretmax,14,gnPPretV))+" !",0+48,"Atentie")
			Thisform.clb_pretctva.tx_suma_nat.SetFocus()
			plReturn = .F.
		Case poArticol.tip_valuta=1 And poArticol.preturi_cu_tva = 1 And poArticol.pretctva_val > thisform.npretmax
			amessagebox("Rata nu poate fi mai mare decat "+Alltrim(Str(Thisform.npretmax,14,gnPVal))+" !",0+48,"Atentie")
			Thisform.clb_pretctva.tx_suma_val.SetFocus()
			plReturn = .F.
		Otherwise
			plReturn = .T.
		Endcase
		
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		Lparameters tnCantitate
		If poArticol.preturi_cu_tva = 0
			If poArticol.tip_valuta = 0
				Thisform.npretmax = poArticol.pretftva
			Else
				Thisform.npretmax = poArticol.pretftva_val
			Endif
		Else
			If poArticol.tip_valuta = 0
				Thisform.npretmax = poArticol.pretctva
			Else
				Thisform.npretmax = poArticol.pretctva_val
			Endif
		Endif
		
		DoDefault()
		
		If poArticol.tip_valuta = 0
			poArticol.nume_val = []
			lnTip = 1
		Else
			lnTip = 2
		Endif
		
		Thisform.clb_pretftva.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_pretctva.do_actualizeaza_lbval(poArticol.nume_val)
		Thisform.clb_tva.do_actualizeaza_lbval(poArticol.nume_val)
		
		If poArticol.preturi_cu_tva = 0
			Thisform.clb_pretftva.do_activeaza(lnTip)
		Else
			Thisform.clb_pretctva.do_activeaza(lnTip)
		Endif
		
		Select jtva_coloane
		Set Filter To cota_tva = poArticol.proc_tvav * 100 - 100
		If poArticol.proc_tvav * 100 - 100 = 0
			Locate For id_jtva_coloana = 8
			If !Found()
				Go Top
			Endif
		Else
			Go Top
		Endif
		Thisform.cb_explicatie_Tva._cbbase1.Value = denumire
		poArticol.id_jtva_coloana = id_jtva_coloana
		
		IF m.gl406
			This.cb_explicatie_saft.Visible = .T.
			Thisform.UpdateExplicatieSAFT() 
		ENDIF 	
		
		*!*	modificare	v 2.0.67
		Thisform.clb_data_scadenta.teXT_SIMPLU1.Value = Iif(Type('poArticol.data_scadenta')='T',Ttod(poArticol.data_scadenta),poArticol.data_scadenta)
		Thisform.clb_data_scadenta.Refresh()
		*!*	modificare	v 2.0.67	^
		
	ENDPROC

	PROCEDURE updateexplicatiesaft
		* Daca nu este activata SAFT 406 nu fac nimic
		Local lcSelect, ldDataAct, llFurnizorRTVAI, lnIdJtva
		IF !m.gl406
			RETURN
		ENDIF
		 
		lcSelect = SELECT()
		This.cb_explicatie_saft._cbbase1.Requery()
		
		ldDataAct = poDate.dataact
		lnIdJtva = poArticol.id_jtva_coloana
		llFurnizorRTVAI = .F.
		
		poArticol.taxcode = GetTaxCode(m.gnAn, m.gnLuna, m.ldDataAct, m.lnIdJtva, m.llFurnizorRTVAI)
		this.cb_explicatie_saft._cbbase1.Refresh()
		SELECT (m.lcSelect) 
	ENDPROC

	PROCEDURE Cb_explicatie_Tva._cbbase1.InteractiveChange
		Select jtva_coloane
		poArticol.id_jtva_coloana = id_jtva_coloana
	ENDPROC

	PROCEDURE Clb_pretctva.tx_suma_nat.InteractiveChange
		thisform.do_calculeaza_rata(this.Value,1)
	ENDPROC

	PROCEDURE Clb_pretctva.tx_suma_val.InteractiveChange
		Thisform.do_calculeaza_rata(This.Value,2)
	ENDPROC

	PROCEDURE Clb_pretftva.tx_suma_nat.InteractiveChange
		Thisform.do_calculeaza_rata(this.Value,1)
	ENDPROC

	PROCEDURE Clb_pretftva.tx_suma_val.InteractiveChange
		Thisform.do_calculeaza_rata(this.Value,2)
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_articol_gest_factura AS frm_articol_factura OF "ofacturare.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Lb_gestiuni" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_tx_articol" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cGestiune.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cGestiune.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cCont.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cCont.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cSerie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cSerie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cPret.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cPret.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cPretv.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cPretv.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cClientRez.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cClientRez.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cNrord_rez.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cNrord_rez.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cPretvctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cPretvctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cDataIn.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cDataIn.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cPretd.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cPretd.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cNume_val.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cNume_val.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cLot.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_gestiuni.cLot.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: lretur		&& Articolul este returnat pe factura de vanzare normala, nu pe factura de retur
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grd_gestiuni
		DoCreate = .T.
		Height = 510
		lretur = .F.
		Name = "frm_articol_gest_factura"
		Width = 835
		_memberdata = <VFPData>
			<memberdata name="lretur" display="lRetur"/>
		</VFPData>
		Clb_procent_adaos.Lb_simplu1.Name = "Lb_simplu1"
		Clb_procent_adaos.Left = 338
		Clb_procent_adaos.Name = "Clb_procent_adaos"
		Clb_procent_adaos.TabIndex = 8
		Clb_procent_adaos.Text_simplu1.Left = 141
		Clb_procent_adaos.Text_simplu1.Name = "Text_simplu1"
		Clb_procent_adaos.Text_simplu1.Width = 164
		Clb_procent_adaos.Top = 101
		Clb_procent_adaos.Width = 420
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 835
		_shape2.Left = 766
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 23
		Gridsort1.Left = 9
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 29
		BUT_TERMIN1.Left = 805
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 20
		BUT_TERMIN1.Top = 1
		But_renunt1.Left = 772
		But_renunt1.Name = "But_renunt1"
		But_renunt1.TabIndex = 21
		But_renunt1.Top = 1
		clb_articol.Height = 58
		clb_articol.Lb_simplu1.Name = "Lb_simplu1"
		clb_articol.Left = 13
		clb_articol.Name = "clb_articol"
		clb_articol.TabIndex = 2
		clb_articol.Text_simplu1.Height = 53
		clb_articol.Text_simplu1.Left = 79
		clb_articol.Text_simplu1.Name = "Text_simplu1"
		clb_articol.Text_simplu1.Top = 3
		clb_articol.Text_simplu1.Width = 216
		clb_articol.Top = 71
		clb_articol.Width = 299
		clb_codmat.Height = 29
		clb_codmat.Lb_simplu1.Name = "Lb_simplu1"
		clb_codmat.Left = 13
		clb_codmat.Name = "clb_codmat"
		clb_codmat.TabIndex = 1
		clb_codmat.Text_simplu1.Height = 23
		clb_codmat.Text_simplu1.Left = 78
		clb_codmat.Text_simplu1.Name = "Text_simplu1"
		clb_codmat.Text_simplu1.Top = 3
		clb_codmat.Text_simplu1.Width = 216
		clb_codmat.Top = 43
		clb_codmat.Width = 299
		clb_um.Height = 29
		clb_um.Lb_simplu1.Name = "Lb_simplu1"
		clb_um.Left = 13
		clb_um.Name = "clb_um"
		clb_um.TabIndex = 3
		clb_um.Text_simplu1.Height = 23
		clb_um.Text_simplu1.Left = 133
		clb_um.Text_simplu1.Name = "Text_simplu1"
		clb_um.Text_simplu1.Top = 3
		clb_um.Text_simplu1.Width = 162
		clb_um.Top = 128
		clb_um.Width = 299
		clb_cantitate.Height = 29
		clb_cantitate.lb_explicatii.Left = 120
		clb_cantitate.lb_explicatii.Name = "lb_explicatii"
		clb_cantitate.lb_explicatii.Top = 5
		clb_cantitate.Lb_simplu1.Left = 4
		clb_cantitate.Lb_simplu1.Name = "Lb_simplu1"
		clb_cantitate.Lb_simplu1.Top = 6
		clb_cantitate.Left = 338
		clb_cantitate.Name = "clb_cantitate"
		clb_cantitate.TabIndex = 7
		clb_cantitate.Text_simplu1.Height = 23
		clb_cantitate.Text_simplu1.Left = 141
		clb_cantitate.Text_simplu1.Name = "Text_simplu1"
		clb_cantitate.Text_simplu1.Top = 3
		clb_cantitate.Text_simplu1.Width = 164
		clb_cantitate.Top = 73
		clb_cantitate.Width = 420
		Clb_procent_discount.Anchor = 1
		Clb_procent_discount.Lb_simplu1.Name = "Lb_simplu1"
		Clb_procent_discount.Left = 338
		Clb_procent_discount.Name = "Clb_procent_discount"
		Clb_procent_discount.TabIndex = 14
		Clb_procent_discount.Text_simplu1.Left = 141
		Clb_procent_discount.Text_simplu1.Name = "Text_simplu1"
		Clb_procent_discount.Top = 293
		Clb_pretftva.Anchor = 1
		Clb_pretftva.lb_explicatie.Name = "lb_explicatie"
		Clb_pretftva.lb_explicatii.Name = "lb_explicatii"
		Clb_pretftva.lb_nume_nat.Name = "lb_nume_nat"
		Clb_pretftva.lb_nume_val.Name = "lb_nume_val"
		Clb_pretftva.Left = 338
		Clb_pretftva.Name = "Clb_pretftva"
		Clb_pretftva.TabIndex = 9
		Clb_pretftva.Top = 129
		Clb_pretftva.tx_suma_nat.Name = "tx_suma_nat"
		Clb_pretftva.tx_suma_val.Name = "tx_suma_val"
		Clb_pretftva.Width = 491
		Clb_tva.Anchor = 1
		Clb_tva.lb_explicatie.Name = "lb_explicatie"
		Clb_tva.lb_explicatii.Name = "lb_explicatii"
		Clb_tva.lb_nume_nat.Name = "lb_nume_nat"
		Clb_tva.lb_nume_val.Name = "lb_nume_val"
		Clb_tva.Left = 338
		Clb_tva.Name = "Clb_tva"
		Clb_tva.TabIndex = 10
		Clb_tva.Top = 156
		Clb_tva.tx_suma_nat.Name = "tx_suma_nat"
		Clb_tva.tx_suma_val.Name = "tx_suma_val"
		Clb_tva.Width = 491
		Clb_pretctva.Anchor = 1
		Clb_pretctva.lb_explicatie.Name = "lb_explicatie"
		Clb_pretctva.lb_explicatii.Name = "lb_explicatii"
		Clb_pretctva.lb_nume_nat.Name = "lb_nume_nat"
		Clb_pretctva.lb_nume_val.Name = "lb_nume_val"
		Clb_pretctva.Left = 338
		Clb_pretctva.Name = "Clb_pretctva"
		Clb_pretctva.TabIndex = 12
		Clb_pretctva.Top = 239
		Clb_pretctva.tx_suma_nat.Name = "tx_suma_nat"
		Clb_pretctva.tx_suma_val.Name = "tx_suma_val"
		Clb_discount_unitar.Anchor = 1
		Clb_discount_unitar.lb_explicatie.Name = "lb_explicatie"
		Clb_discount_unitar.lb_explicatii.Name = "lb_explicatii"
		Clb_discount_unitar.lb_nume_nat.Name = "lb_nume_nat"
		Clb_discount_unitar.lb_nume_val.Name = "lb_nume_val"
		Clb_discount_unitar.Left = 338
		Clb_discount_unitar.Name = "Clb_discount_unitar"
		Clb_discount_unitar.TabIndex = 15
		Clb_discount_unitar.Top = 321
		Clb_discount_unitar.tx_suma_nat.Name = "tx_suma_nat"
		Clb_discount_unitar.tx_suma_val.Name = "tx_suma_val"
		Clb_tva_discount.Anchor = 1
		Clb_tva_discount.lb_explicatie.Name = "lb_explicatie"
		Clb_tva_discount.lb_explicatii.Name = "lb_explicatii"
		Clb_tva_discount.lb_nume_nat.Name = "lb_nume_nat"
		Clb_tva_discount.lb_nume_val.Name = "lb_nume_val"
		Clb_tva_discount.Left = 338
		Clb_tva_discount.Name = "Clb_tva_discount"
		Clb_tva_discount.TabIndex = 16
		Clb_tva_discount.Top = 348
		Clb_tva_discount.tx_suma_nat.Name = "tx_suma_nat"
		Clb_tva_discount.tx_suma_val.Name = "tx_suma_val"
		Clb_discountctva.Anchor = 1
		Clb_discountctva.lb_explicatie.Name = "lb_explicatie"
		Clb_discountctva.lb_explicatii.Name = "lb_explicatii"
		Clb_discountctva.lb_nume_nat.Name = "lb_nume_nat"
		Clb_discountctva.lb_nume_val.Name = "lb_nume_val"
		Clb_discountctva.Left = 338
		Clb_discountctva.Name = "Clb_discountctva"
		Clb_discountctva.TabIndex = 17
		Clb_discountctva.Top = 375
		Clb_discountctva.tx_suma_nat.Name = "tx_suma_nat"
		Clb_discountctva.tx_suma_val.Name = "tx_suma_val"
		Clb_totalfdiscount.Anchor = 1
		Clb_totalfdiscount.lb_explicatie.Name = "lb_explicatie"
		Clb_totalfdiscount.lb_explicatii.Name = "lb_explicatii"
		Clb_totalfdiscount.lb_nume_nat.Name = "lb_nume_nat"
		Clb_totalfdiscount.lb_nume_val.Name = "lb_nume_val"
		Clb_totalfdiscount.Left = 338
		Clb_totalfdiscount.Name = "Clb_totalfdiscount"
		Clb_totalfdiscount.TabIndex = 13
		Clb_totalfdiscount.Top = 266
		Clb_totalfdiscount.tx_suma_nat.Name = "tx_suma_nat"
		Clb_totalfdiscount.tx_suma_val.Name = "tx_suma_val"
		Clb_totalcdiscount.Anchor = 1
		Clb_totalcdiscount.lb_explicatie.Name = "lb_explicatie"
		Clb_totalcdiscount.lb_explicatii.Name = "lb_explicatii"
		Clb_totalcdiscount.lb_nume_nat.Left = 444
		Clb_totalcdiscount.lb_nume_nat.Name = "lb_nume_nat"
		Clb_totalcdiscount.lb_nume_nat.Top = 27
		Clb_totalcdiscount.lb_nume_val.Name = "lb_nume_val"
		Clb_totalcdiscount.Left = 338
		Clb_totalcdiscount.Name = "Clb_totalcdiscount"
		Clb_totalcdiscount.TabIndex = 19
		Clb_totalcdiscount.Top = 451
		Clb_totalcdiscount.tx_suma_nat.Name = "tx_suma_nat"
		Clb_totalcdiscount.tx_suma_val.Name = "tx_suma_val"
		Clb_totalcdiscount.Width = 491
		Clb_pret_diminuat.Anchor = 1
		Clb_pret_diminuat.lb_explicatie.Name = "lb_explicatie"
		Clb_pret_diminuat.lb_explicatii.Name = "lb_explicatii"
		Clb_pret_diminuat.lb_nume_nat.Left = 447
		Clb_pret_diminuat.lb_nume_nat.Name = "lb_nume_nat"
		Clb_pret_diminuat.lb_nume_nat.Top = 27
		Clb_pret_diminuat.lb_nume_val.Name = "lb_nume_val"
		Clb_pret_diminuat.Left = 338
		Clb_pret_diminuat.Name = "Clb_pret_diminuat"
		Clb_pret_diminuat.TabIndex = 18
		Clb_pret_diminuat.Top = 402
		Clb_pret_diminuat.tx_suma_nat.Name = "tx_suma_nat"
		Clb_pret_diminuat.tx_suma_val.Name = "tx_suma_val"
		Clb_pret_diminuat.Width = 491
		cb_explicatie_saft.Left = 338
		cb_explicatie_saft.Name = "cb_explicatie_saft"
		cb_explicatie_saft.Top = 211
		cb_explicatie_saft._cbbase1.Name = "_cbbase1"
		cb_explicatie_saft._lbbase1.Name = "_lbbase1"
		Cb_explicatie_Tva.Anchor = 1
		Cb_explicatie_Tva.Left = 338
		Cb_explicatie_Tva.Name = "Cb_explicatie_Tva"
		Cb_explicatie_Tva.TabIndex = 11
		Cb_explicatie_Tva.Top = 183
		Cb_explicatie_Tva._cbbase1.Name = "_cbbase1"
		Cb_explicatie_Tva._lbbase1.Name = "_lbbase1"
		Clb_serie.Anchor = 1
		Clb_serie.Lb_simplu1.Name = "Lb_simplu1"
		Clb_serie.Left = 336
		Clb_serie.Name = "Clb_serie"
		Clb_serie.TabIndex = 22
		Clb_serie.Text_simplu1.Height = 23
		Clb_serie.Text_simplu1.Left = 141
		Clb_serie.Text_simplu1.Name = "Text_simplu1"
		Clb_serie.Text_simplu1.Top = 3
		Clb_serie.Text_simplu1.Width = 272
		Clb_serie.Top = 552
		Clb_serie.Visible = .F.
		Clb_serie.Width = 420
		Ed_tx_explicatie.Height = 110
		Ed_tx_explicatie.Left = 13
		Ed_tx_explicatie.Name = "Ed_tx_explicatie"
		Ed_tx_explicatie.TabIndex = 4
		Ed_tx_explicatie.Top = 156
		Ed_tx_explicatie.Width = 299
		Ed_tx_explicatie._EDBASE1.Height = 106
		Ed_tx_explicatie._EDBASE1.Left = 69
		Ed_tx_explicatie._EDBASE1.Name = "_EDBASE1"
		Ed_tx_explicatie._EDBASE1.Top = 2
		Ed_tx_explicatie._EDBASE1.Width = 227
		Ed_tx_explicatie._lbbase1.Name = "_lbbase1"
		Cb_contract.Left = 338
		Cb_contract.Name = "Cb_contract"
		Cb_contract.Top = 45
		Cb_contract.Width = 420
		Cb_contract._cbbase1.Height = 23
		Cb_contract._cbbase1.Left = 141
		Cb_contract._cbbase1.Name = "_cbbase1"
		Cb_contract._cbbase1.Top = 3
		Cb_contract._cbbase1.Width = 274
		Cb_contract._lbbase1.Name = "_lbbase1"
	*</PropValue>

	ADD OBJECT 'Cb_tx_articol' AS cb_tx_cautare WITH ;
		Height = 27, ;
		Left = 52, ;
		Name = "Cb_tx_articol", ;
		TabIndex = 5, ;
		Top = 287, ;
		Width = 266, ;
		Text.Format = "!", ;
		Text.Height = 25, ;
		Text.Left = 103, ;
		Text.Name = "Text", ;
		Text.TabIndex = 2, ;
		Text.Top = 1, ;
		Text.Width = 163, ;
		criteriu.Name = "criteriu", ;
		criteriu.TabIndex = 1
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'grd_gestiuni' AS _grdrow WITH ;
		ColumnCount = 13, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		HeaderHeight = 36, ;
		Height = 185, ;
		Left = 7, ;
		Name = "grd_gestiuni", ;
		Panel = 1, ;
		Partition = 0, ;
		RecordSource = "crsgestarticol", ;
		RowHeight = 19, ;
		TabIndex = 6, ;
		ToolTipText = "Pentru a selecta mai multe stocuri cu serii diferite, apasati SPACE pe fiecare dintre ele.", ;
		Top = 319, ;
		Width = 324, ;
		Column1.ControlSource = "nume_gestiune", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cGestiune", ;
		Column1.Width = 79, ;
		Column2.ColumnOrder = 3, ;
		Column2.ControlSource = "cantitate", ;
		Column2.FontBold = .T., ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.InputMask = (get_mask(14,gnPcant)), ;
		Column2.Name = "cCantitate", ;
		Column2.Width = 54, ;
		Column3.ColumnOrder = 6, ;
		Column3.ControlSource = "cont", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cCont", ;
		Column3.Width = 36, ;
		Column4.ColumnOrder = 8, ;
		Column4.ControlSource = "serie", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.Name = "cSerie", ;
		Column5.ColumnOrder = 2, ;
		Column5.ControlSource = "pret", ;
		Column5.FontSize = 10, ;
		Column5.InputMask = (get_mask(14,gnPPret)), ;
		Column5.Name = "cPret", ;
		Column5.Width = 63, ;
		Column6.ColumnOrder = 4, ;
		Column6.ControlSource = "pretv", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.InputMask = (get_mask(14,gnPPretV)), ;
		Column6.Name = "cPretv", ;
		Column6.Width = 54, ;
		Column7.ColumnOrder = 12, ;
		Column7.ControlSource = "part_rez", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.Name = "cClientRez", ;
		Column7.Width = 86, ;
		Column8.ColumnOrder = 13, ;
		Column8.ControlSource = "nrord_rez", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.Name = "cNrord_rez", ;
		Column9.ColumnOrder = 5, ;
		Column9.ControlSource = "pretvctva", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.InputMask = (get_mask(14,gnPPretV)), ;
		Column9.Name = "cPretvctva", ;
		Column9.Width = 58, ;
		Column10.ColumnOrder = 9, ;
		Column10.ControlSource = "TTOD(datain)", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.Name = "cDataIn", ;
		Column10.Width = 73, ;
		Column11.ColumnOrder = 10, ;
		Column11.ControlSource = "pretd", ;
		Column11.FontName = "Arial", ;
		Column11.FontSize = 10, ;
		Column11.InputMask = (get_mask(14,gnPPretval)), ;
		Column11.Name = "cPretd", ;
		Column11.Width = 61, ;
		Column12.ColumnOrder = 11, ;
		Column12.ControlSource = "nume_val", ;
		Column12.FontName = "Arial", ;
		Column12.FontSize = 10, ;
		Column12.Name = "cNume_val", ;
		Column12.Width = 59, ;
		Column13.ColumnOrder = 7, ;
		Column13.ControlSource = "lot", ;
		Column13.FontSize = 10, ;
		Column13.Name = "cLot", ;
		Column13.ReadOnly = .T., ;
		Column13.Width = 91
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grd_gestiuni.cCantitate.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cantitate", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cCantitate.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontBold = .T., ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cClientRez.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Client rez.", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cClientRez.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

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

	ADD OBJECT 'grd_gestiuni.cCont.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cDataIn.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data intrarii in stoc", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cDataIn.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cGestiune.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Gestiune", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cGestiune.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cLot.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Lot", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_gestiuni.cNrord_rez.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Lucrare rez.", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cNrord_rez.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cNume_val.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valuta ach.", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cNume_val.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cPret.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret achizitie", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cPret.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cPretd.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret ach. in valuta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cPretd.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cPretv.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vanz. fara TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cPretv.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cPretvctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vanz. cu TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cPretvctva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_gestiuni.cSerie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_gestiuni.cSerie.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridextra1' AS gridextra WITH ;
		gridexpression = Thisform.grd_gestiuni, ;
		Left = 336, ;
		Name = "Gridextra1", ;
		productname = ROA, ;
		Top = 480
		*< END OBJECT: ClassLib="..\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Lb_gestiuni' AS lb_simplu WITH ;
		Caption = "Alegeti gestiunea din care doriti sa scoateti acest articol", ;
		Left = 13, ;
		Name = "Lb_gestiuni", ;
		TabIndex = 24, ;
		Top = 270
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		Caption = "Seria", ;
		FontItalic = .T., ;
		Left = 13, ;
		Name = "Lb_simplu1", ;
		TabIndex = 25, ;
		Top = 292
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />
	
	PROCEDURE do_executa
		*!*	modificare	v 2.0.46
		Select crsgestarticol
		If !Empty(Nvl(serie,[]))
			lnDif = Mod(ales+1,2)
			lnCantitate = cantitate
			Replace ales With lnDif
			If lnDif = 1 And Thisform.nselectate = 0
				poArticol.cantitate = 0
				Thisform.clb_cantitate.text_simplu1.ReadOnly = .T.
			Else
				If lnDif = 0 And Thisform.nselectate = 1
					Thisform.clb_cantitate.text_simplu1.ReadOnly = .F.
				Endif
			Endif
			Thisform.nselectate = Thisform.nselectate + Iif(lnDif = 0,-1,1)
			poArticol.cantitate = poArticol.cantitate + Iif(lnDif = 0,-1,1) * lnCantitate
			Thisform.clb_cantitate.Refresh()
		EndIf
		*!*	modificare	v 2.0.46	^
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local plReturn
		If !Thisform.larata
			lccontrol = Upper(This.ActiveControl.BaseClass )
			If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
				lcval=This.ActiveControl.ControlSource
				&lcval=Thisform.ActiveControl.Value
			Endif
		Endif
		
		Select crsgestarticol
		lnCantitate = cantitate
		lcNumeGest = Alltrim(nume_gestiune)
		
		Do Case
		Case Empty(poArticol.id_jtva_coloana)
			amessagebox("Nu ati ales explicatia TVA!",48,"Atentie")
			Thisform.cb_explicatie_Tva.SetFocus()
			plReturn = .F.
		*!* v 2.0.15 - se pot factura articole cu pret 0
		*!*	Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 0 And poArticol.pretftva = 0
		*!*		amessagebox("Pretul fara TVA nu poate fi 0!",48,"Atentie")
		*!*		Thisform.clb_pretftva.tx_suma_nat.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 1 And poArticol.pretftva_val = 0
		*!*		amessagebox("Pretul fara TVA nu poate fi 0!",48,"Atentie")
		*!*		Thisform.clb_pretftva.tx_suma_val.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 0 And poArticol.pretctva = 0
		*!*		amessagebox("Pretul cu TVA nu poate fi 0!",48,"Atentie")
		*!*		Thisform.clb_pretctva.tx_suma_nat.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 1 And poArticol.pretctva_val = 0
		*!*		amessagebox("Pretul cu TVA nu poate fi 0!",48,"Atentie")
		*!*		Thisform.clb_pretctva.tx_suma_val.SetFocus()
		*!*		plReturn = .F.
		*!* v 2.0.15 ^
		Case poArticol.cantitate=0
			amessagebox("Cantitatea nu poate fi 0!",0+48,"Atentie")
			Thisform.clb_cantitate.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.56
		*!*	modificare	v 2.0.46
		*!*	*!*	modificare	v 2.0.40
		*!*	*!*	Case poArticol.cantitate>lnCantitate
		*!*	Case poArticol.cantitate>lnCantitate And poDate.tip <> 41
		*!*	*!*	modificare	v 2.0.40	^
		*!*	Case poArticol.cantitate>lnCantitate And Thisform.nselectate = 0 And poDate.tip <> 41
		*!*	modificare	v 2.0.46	^
		Case poArticol.cantitate>lnCantitate And Thisform.nselectate = 0 And !(InList(poDate.tip,8,9,41) OR this.lRetur)
		*!*	modificare	v 2.0.56	^
			amessagebox("Cantitatea nu poate fi mai mare decat stocul gestiunii "+lcNumeGest+" !",0+48,"Atentie")
			Thisform.clb_cantitate.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.40
		Case Abs(poArticol.cantitate)>Abs(lnCantitate) And poDate.tip = 41
			amessagebox("Cantitatea returnata nu poate fi mai mare decat stocul gestiunii "+lcNumeGest+" !",0+48,"Atentie")
			Thisform.clb_cantitate.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.40	^
		Case Abs(poArticol.cantitate)>Thisform.ncantitatemax And Inlist(poDate.tip,4,21,23,28,42,47)	&&	am scos tipul 3
			&&	modificare v 2.0.93 : am adaugat 47
			amessagebox("Cantitatea nu poate fi mai mare decat "+Alltrim(Str(Thisform.ncantitatemax))+" !",48,"Atentie")
			Thisform.clb_cantitate.SetFocus()
			plReturn = .F.
		*!* v 2.0.15 - se poate factura doar discount
		*!*	Case poArticol.tip_valuta=0 And poArticol.preturi_cu_tva = 0 And poArticol.discount_unitar>poArticol.pretftva
		*!*		aMessagebox("Discountul nu poate fi mai mare decat pretul!",0+48,"Atentie")
		*!*		Thisform.clb_discount_unitar.tx_suma_nat.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.tip_valuta=1 And poArticol.preturi_cu_tva = 0 And poArticol.discount_unitar_val > poArticol.pretftva_val
		*!*		aMessagebox("Discountul nu poate fi mai mare decat pretul!",0+48,"Atentie")
		*!*		Thisform.clb_discount_unitar.tx_suma_val.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.tip_valuta=0 And poArticol.preturi_cu_tva = 1 And poArticol.discount_unitar_ctva >poArticol.pretctva
		*!*		aMessagebox("Discountul nu poate fi mai mare decat pretul!",0+48,"Atentie")
		*!*		Thisform.clb_discountctva.tx_suma_nat.SetFocus()
		*!*		plReturn = .F.
		*!*	Case poArticol.tip_valuta=1 And poArticol.preturi_cu_tva = 1 And poArticol.discount_unitar_ctva_val>poArticol.pretctva_val
		*!*		aMessagebox("Discountul nu poate fi mai mare decat pretul!",0+48,"Atentie")
		*!*		Thisform.clb_discountctva.tx_suma_val.SetFocus()
		*!*		plReturn = .F.
		*!* v 2.0.15
		*!*	modificare	v 2.0.56
		Case poArticol.cantitate > 0 and (InList(poDate.tip,8,9) OR this.lRetur)	&&	retururi
			amessagebox("Cantitatea trebuie sa fie negativa!",48,"Atentie")
			thisform.clb_cantitate.SetFocus()
			plReturn = .F.
		Case Abs(poArticol.cantitate)>Abs(lnCantitate) and (InList(poDate.tip,8,9) OR this.lRetur)
			amessagebox("Cantitatea returnata nu poate fi mai mare decat cea facturata initial din gestiunea "+lcNumeGest+" !",0+48,"Atentie")
			Thisform.clb_cantitate.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.56	^
		Otherwise
		*!*	modificare	v 2.0.44
			Do Case
			Case  poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 0 And poArticol.pretftva = 0
				If amessagebox("Pretul fara TVA este 0. Doriti sa continuati?",4+32,"Atentie") = 7
					Thisform.clb_pretftva.tx_suma_nat.SetFocus()
					plReturn = .F.
				Else
					plReturn = .T.
				Endif
			Case poArticol.preturi_cu_tva = 0 And poArticol.tip_valuta = 1 And poArticol.pretftva_val = 0
				If amessagebox("Pretul fara TVA este 0. Doriti sa continuati?",4+32,"Atentie") = 7
					Thisform.clb_pretftva.tx_suma_val.SetFocus()
					plReturn = .F.
				Else
					plReturn = .T.
				Endif
			Case poArticol.preturi_cu_tva = 1 And poArticol.tip_valuta = 0 And poArticol.pretctva = 0
				If amessagebox("Pretul cu TVA este 0. Doriti sa continuati?",4+32,"Atentie") = 7
					Thisform.clb_pretctva.tx_suma_nat.SetFocus()
					plReturn = .F.
				Else
					plReturn = .T.
				Endif
			Case poArticol.preturi_cu_tva = 1 And poArticol.tip_valuta = 1 And poArticol.pretctva_val = 0
				If amessagebox("Pretul cu TVA este 0. Doriti sa continuati?",4+32,"Atentie") = 7
					Thisform.clb_pretctva.tx_suma_val.SetFocus()
					plReturn = .F.
				Else
					plReturn = .T.
				Endif
			Otherwise
				plReturn = .T.
			Endcase
		*!*	plReturn = .T.
		*!*	modificare	v 2.0.44	^
			*!*	modificare	v 2.0.67
			If Nvl(gnMemProcDisc,0) = 1 And plReturn
				pnProcentDiscountMem = INT(Thisform.clb_procent_discount.text_simplu1.Value)
			Endif
			*!*	modificare	v 2.0.67	^
		Endcase
		
		If Thisform.larata And !plReturn
			Thisform.larata = !Thisform.larata
		Endif
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		Lparameters tnCantitate, tlAscunde, tlRetur
		this.lRetur = tlRetur
		DoDefault(tnCantitate,tlAscunde)
		With This.grd_gestiuni
		*!*	modificare	v 2.0.46
			lcSetAll = "IIF(ales=0,"+;
				Iif(.nRgbrow = 1,;
					"Iif(Recno() = this.nRecno,Rgb("+.cRGB_Row+"),Rgb("+.cRGB_Grid+"))",;
					"Rgb(255,255,255)")+;
				",Rgb(157,206,255))"
			.SetAll("DynamicBackColor",lcSetAll,"Column")
		*!*	modificare	v 2.0.46	^
			.nRecno = 1
			.Refresh
		Endwith
		If !Thisform.larata
			Thisform.grd_gestiuni.SetFocus()
		ENDIF
		this.gridextra1.setup()
	ENDPROC

	PROCEDURE KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		lcControl = Upper(Alltrim(Thisform.ActiveControl.Name))
		If Inlist(nKeyCode,9,13) And lcControl = 'GRD_GESTIUNI'
			Nodefault
		*!*		If Iif(Type('poArticol.modificabil')<>'U',poArticol.modificabil,0) = 1
		*!*			Do Case
		*!*			Case Type('thisform.clb_procent_adaos')<>'U'
		*!*				This.clb_procent_adaos.SetFocus()
		*!*			Case poArticol.preturi_cu_tva = 0
		*!*				This.clb_pretftva.SetFocus()
		*!*			Otherwise
		*!*				This.clb_pretctva.SetFocus()
		*!*			Endcase
		*!*		Else
		*!*			This.clb_procent_discount.SetFocus()
		*!*		Endif
			This.clb_cantitate.SetFocus()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
		
	ENDPROC

	PROCEDURE Cb_tx_articol.Init
		This.do_initializeaza_ct()
		
	ENDPROC

	PROCEDURE Cb_tx_articol.Text.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If Inlist(nKeyCode,9,13) And nShiftAltCtrl = 0
			Nodefault
			With This.Parent
				lcFiltru = []
				lcValoare = Strtran(Strtran(Alltrim(Upper(.Text.Value)),['],['']),[%],[*])
				Do Case
				Case .criteriu.Value = "1" And !Empty(lcValoare)
					lcFiltru = [ LIKE('] + lcValoare + [*',NVL(serie,''))]
				Case .criteriu.Value = "2" And !Empty(lcValoare)
					lcFiltru = [ NVL(serie,'') = '] + lcValoare + [']
				Case .criteriu.Value = "3" And !Empty(lcValoare)
					lcFiltru = [ NVL(serie,'') != '] + lcValoare + [']
				Case .criteriu.Value = "4" And !Empty(lcValoare)
					lcFiltru = [ LIKE('*] + lcValoare + [*',NVL(serie,''))]
				Case .criteriu.Value = "5" And !Empty(lcValoare)
					lcFiltru = [ !LIKE('*] + lcValoare + [*',NVL(serie,''))]
				Case .criteriu.Value = "6" Or Empty(lcValoare)
					lcFiltru = []
				Endcase
			Endwith
			Select crsgestarticol
			Set Filter To &lcFiltru
			Go Top
			Thisform.grd_gestiuni.SetFocus()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
		
	ENDPROC

	PROCEDURE grd_gestiuni.AfterRowColChange
		*!* 24.02.2015
		*!* marius.mutu
		*!* se completeaza preturile pentru un articol retur, din selectia din rulaj, in loc de lista de preturi
		
		Lparameters nColIndex
		DoDefault(nColIndex)
		If This.RowColChange <> 2
			Select crsgestarticol
			poArticol.pret_achizitie = Pret
			poArticol.lot = Nvl(lot,[])
			poArticol.serie = Nvl(serie,[])
			poArticol.id_gestiune = id_gestiune
			poArticol.Cont = Alltrim(Cont)
		
			poArticol.id_lucrare_rez = id_lucrare_rez
			poArticol.id_part_rez = id_part_rez
			poArticol.pretv_orig = pretv
		
			poArticol.id_valuta_d = Nvl(id_valuta,0)	&&	modificare v 2.0.84 : am pus 0 in loc de -99
			poArticol.pretd = pretd
		
			* cantitate,Cont,serie,Pret,nume_gestiune,datain,pretv,pretvctva,part_rez,id_part_rez,nrord_rez,id_lucrare_rez,pretd,id_valuta,nume_val
			* daca articolul se returneaza in cadrul unei facturi de vanzare normale (nu factura de retur tip=8,9)
			* completez pretul din stoc, in loc de lista de preturi la intrarea in formular
			If Thisform.lRetur
				poArticol.pretftva = pretv
				poArticol.tva = Iif(Isnull(poArticol.proc_tvav),0,Round(poArticol.pretftva * (poArticol.proc_tvav - 1),gnPPretV))
		
				poArticol.pretctva= poArticol.pretftva + poArticol.tva
				poArticol.pretftva_val = pretd
				poArticol.tva_val = Iif(Isnull(poArticol.proc_tvav),0,Round(poArticol.pretftva_val * (poArticol.proc_tvav - 1),gnPVal))
				poArticol.pretctva_val = poArticol.pretftva_val + poArticol.tva_val
		
				poArticol.cantitate = (-1) * cantitate
			Endif
		Endif
		
		
	ENDPROC

	PROCEDURE grd_gestiuni.cCantitate.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cClientRez.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cCont.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cDataIn.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cGestiune.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cNrord_rez.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cPret.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cPretv.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cPretvctva.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE grd_gestiuni.cSerie.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32 And nShiftAltCtrl = 0
			Nodefault
			Thisform.do_executa()
		Else
			DoDefault(nKeyCode,nShiftAltCtrl)
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_articole_compuse 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="grd_factura_set" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cValdiminuatctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cValdiminuatctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cPretctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cPretctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cDiscountCTva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cDiscountCTva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cPretFtva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cPretFtva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cVpretftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cVpretftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cVdiscountftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cVdiscountftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cVvaldiminuatftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura_set.cVvaldiminuatftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_urmator1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_precedent1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_articolelista" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtArticole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtArticoleLista" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cValdiminuatctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cValdiminuatctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDiscountCTva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDiscountCTva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretFtva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretFtva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cSerie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cSerie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVpretftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVpretftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVdiscountftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVdiscountftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVvaldiminuatftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVvaldiminuatftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cProc_tvav.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cProc_tvav.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_listare_set" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_selecteaza_rand
		*p: nid
		*p: nid_ctr
		*p: nproc_tvav_set		&& -1 = nu a fost selectat niciun articol pentru adaugare de set
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grd_factura_set,grd_factura
		DoCreate = .T.
		Height = 450
		lactiv3 = .T.
		Name = "frm_articole_compuse"
		nid = 1
		nid_ctr = -99
		nproc_tvav_set = -1
		Width = 781
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 780
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 712
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		Lb_titlu_alb_b121.Caption = 'ARTICOLE COMPUSE ( Pentru selectare : dublu click / apăsați SPACE în coloana "Articol" )'
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 9
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 748
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 7
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		Gridsort1.Left = 744
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 36
	*</PropValue>

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		Left = 729, ;
		Name = "But_modifica1", ;
		TabIndex = 12, ;
		Top = 36, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_precedent1' AS but_precedent WITH ;
		Anchor = 8, ;
		Left = 376, ;
		Name = "But_precedent1", ;
		TabIndex = 6, ;
		Top = 170
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 716, ;
		Name = "But_renunt1", ;
		TabIndex = 8, ;
		Top = 1, ;
		Width = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_urmator1' AS but_urmator WITH ;
		Anchor = 8, ;
		Left = 376, ;
		Name = "But_urmator1", ;
		TabIndex = 3, ;
		Top = 133
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'ck_listare_set' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Se listează componența seturilor și pe factură / aviz.", ;
		ControlSource = "poDate.listare_componenta_set", ;
		Left = 418, ;
		Name = "ck_listare_set", ;
		TabIndex = 13, ;
		Top = 425, ;
		Visible = .F.
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'grd_factura' AS _grdrow WITH ;
		Anchor = 13, ;
		ColumnCount = 11, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		HeaderHeight = 34, ;
		Height = 348, ;
		Left = 11, ;
		Name = "grd_factura", ;
		Panel = 1, ;
		RecordSource = "crsfactura", ;
		TabIndex = 2, ;
		Top = 73, ;
		Width = 360, ;
		Column1.ColumnOrder = 1, ;
		Column1.ControlSource = "denumire", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cDenumire", ;
		Column1.ReadOnly = .T., ;
		Column1.ToolTipText = "Faceti dublu-click sau apasati SPACE pentru selectare", ;
		Column1.Width = 115, ;
		Column2.ColumnOrder = 9, ;
		Column2.ControlSource = "valdiminuatctva", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.InputMask = (get_mask(14,gnPc)), ;
		Column2.Name = "cValdiminuatctva", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 51, ;
		Column3.ColumnOrder = 6, ;
		Column3.ControlSource = "pretctva", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.InputMask = (get_mask(14,gnPPretV)), ;
		Column3.Name = "cPretctva", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 45, ;
		Column4.ColumnOrder = 3, ;
		Column4.ControlSource = "cantitate", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.InputMask = (get_mask(14,gnPcant)), ;
		Column4.Name = "cCantitate", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 37, ;
		Column5.ColumnOrder = 7, ;
		Column5.ControlSource = "discountctva", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.InputMask = (get_mask(14,gnPPretV)), ;
		Column5.Name = "cDiscountCTva", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 62, ;
		Column6.ColumnOrder = 4, ;
		Column6.ControlSource = "pretftva", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.InputMask = (get_mask(14,gnPPretV)), ;
		Column6.Name = "cPretFtva", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 49, ;
		Column7.ColumnOrder = 2, ;
		Column7.ControlSource = "serie", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cSerie", ;
		Column8.ColumnOrder = 5, ;
		Column8.ControlSource = "vpretftva", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.InputMask = (get_mask(14,gnPVal)), ;
		Column8.Name = "cVpretftva", ;
		Column9.ColumnOrder = 8, ;
		Column9.ControlSource = "vdiscountftva", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.InputMask = (get_mask(14,gnPVal)), ;
		Column9.Name = "cVdiscountftva", ;
		Column10.ControlSource = "vvaldiminuatftva", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.InputMask = (get_mask(14,gnPVal)), ;
		Column10.Name = "cVvaldiminuatftva", ;
		Column11.ControlSource = "proc_tvav", ;
		Column11.FontName = "Arial Narrow", ;
		Column11.InputMask = (get_mask(5,2)), ;
		Column11.Name = "cProc_tvav", ;
		Column11.Width = 51
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

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

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

	ADD OBJECT 'grd_factura.cDiscountCTva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount unitar cu TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cPretctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar cu TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cPretFtva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar fara TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cProc_tvav.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Proc.TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cProc_tvav.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 'grd_factura.cSerie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cSerie.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 'grd_factura.cValdiminuatctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cVdiscountftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount unitar in valuta fara TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cVdiscountftva.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 'grd_factura.cVpretftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar fara TVA in valuta", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cVpretftva.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 'grd_factura.cVvaldiminuatftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare in valuta fara TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cVvaldiminuatftva.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 'grd_factura_set' AS _grdrow WITH ;
		Anchor = 13, ;
		ColumnCount = 9, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		HeaderHeight = 34, ;
		Height = 348, ;
		Left = 414, ;
		Name = "grd_factura_set", ;
		Panel = 1, ;
		RecordSource = "crsfacturaset", ;
		TabIndex = 4, ;
		Top = 73, ;
		Width = 360, ;
		Column1.ColumnOrder = 1, ;
		Column1.ControlSource = "denumire", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cDenumire", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 115, ;
		Column2.ColumnOrder = 8, ;
		Column2.ControlSource = "valdiminuatctva", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.InputMask = (get_mask(14,gnPc)), ;
		Column2.Name = "cValdiminuatctva", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 51, ;
		Column3.ColumnOrder = 5, ;
		Column3.ControlSource = "pretctva", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.InputMask = (get_mask(14,gnPPretV)), ;
		Column3.Name = "cPretctva", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 45, ;
		Column4.ColumnOrder = 2, ;
		Column4.ControlSource = "cantitate", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.InputMask = (get_mask(14,gnPcant)), ;
		Column4.Name = "cCantitate", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 37, ;
		Column5.ColumnOrder = 6, ;
		Column5.ControlSource = "discountctva", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.InputMask = (get_mask(14,gnPPretV)), ;
		Column5.Name = "cDiscountCTva", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 62, ;
		Column6.ColumnOrder = 3, ;
		Column6.ControlSource = "pretftva", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.InputMask = (get_mask(14,gnPPretV)), ;
		Column6.Name = "cPretFtva", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 49, ;
		Column7.ColumnOrder = 4, ;
		Column7.ControlSource = "vpretftva", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.InputMask = (get_mask(14,gnPVal)), ;
		Column7.Name = "cVpretftva", ;
		Column8.ColumnOrder = 7, ;
		Column8.ControlSource = "vdiscountftva", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.InputMask = (get_mask(14,gnPVal)), ;
		Column8.Name = "cVdiscountftva", ;
		Column9.ControlSource = "vvaldiminuatftva", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.InputMask = (get_mask(14,gnPVal)), ;
		Column9.Name = "cVvaldiminuatftva"
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

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

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

	ADD OBJECT 'grd_factura_set.cDiscountCTva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount unitar cu TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura_set.cPretctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar cu TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura_set.cPretFtva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar fara TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

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

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

	ADD OBJECT 'grd_factura_set.cVdiscountftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount unitar in valuta fara TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura_set.cVdiscountftva.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 'grd_factura_set.cVpretftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar fara TVA in valuta", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura_set.cVpretftva.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 'grd_factura_set.cVvaldiminuatftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare in valuta fara TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura_set.cVvaldiminuatftva.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 'lb_articole' AS lb_simplu WITH ;
		Caption = "Articole", ;
		Left = 22, ;
		Name = "lb_articole", ;
		TabIndex = 10, ;
		Top = 42
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_articolelista' AS lb_simplu WITH ;
		Anchor = 8, ;
		Caption = "Articole compuse", ;
		Left = 427, ;
		Name = "lb_articolelista", ;
		TabIndex = 11, ;
		Top = 42
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'txtArticole' AS textbox WITH ;
		Format = "!k", ;
		Height = 23, ;
		Left = 72, ;
		Name = "txtArticole", ;
		TabIndex = 1, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 39, ;
		Width = 168
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtArticoleLista' AS textbox WITH ;
		Anchor = 8, ;
		Format = "!k", ;
		Height = 23, ;
		Left = 523, ;
		Name = "txtArticoleLista", ;
		TabIndex = 5, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 39, ;
		Width = 168
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE do_adauga
		If Reccount('crsfactura')>0
			Local lnNrInreg,lnSemn
			Select crsfactura
			lnRecno = Recno()
			Calculate Cnt() For id_set_fact = Thisform.nid To lnNrInreg
			If lnNrInreg>0
				Private poArticolCompus,pofrmdetartcomp
		
				Select crsfactura
				Scatter Name poArticolCompus Blank MEMO
		
		*!*	modificare	v 2.0.56	:	am adaugat id_temp
		*!*	modificare	v 2.0.67	:	am adaugat numar_contract
				With poArticolCompus
					Calculate Min(id_temp),Max(um),Max(proc_tvav),Min(id_jtva_coloana),Max(gestionabil),;
						Sum(valftva),Sum(valtva),Sum(valctva),;
						Sum(valdiscountftva),Sum(valdiscounttva),Sum(valdiscountctva),;
						Sum(valdiminuatftva),Sum(valdiminuattva),Sum(valdiminuatctva),;
						Sum(vvalftva),Sum(vvaltva),Sum(vvalctva),;
						Sum(vdiscountftva),Sum(vdiscountctva),;
						Sum(vvaldiscountftva),Sum(vvaldiscounttva),Sum(vvaldiscountctva),;
						Sum(vvaldiminuatftva),Sum(vvaldiminuattva),Sum(vvaldiminuatctva),MAX(numar_contract) ;
						FOR id_set_fact = Thisform.nid ;
						TO .id_temp,.um,.proc_tvav,.id_jtva_coloana,.gestionabil,;
						.valftva,.valtva,.valctva,;
						.valdiscountftva,.valdiscounttva,.valdiscountctva,;
						.valdiminuatftva,.valdiminuattva,.valdiminuatctva,;
						.vvalftva,.vvaltva,.vvalctva,;
						.vdiscountftva,.vdiscountctva,;
						.vvaldiscountftva,.vvaldiscounttva,.vvaldiscountctva,;
						.vvaldiminuatftva,.vvaldiminuattva,.vvaldiminuatctva,.numar_contract
				Endwith
		
				poArticolCompus.id_ctr = thisform.nid_ctr 	&&	modificare v 2.0.67
				poArticolCompus.id_set_fact = Thisform.nid
		*!*	modificare	v 2.0.56
		*!*		poArticolCompus.cantitate = 1
				If InList(poDate.tip,8,9)
					lnSemn = (-1)
				Else
					lnSemn = 1
				EndIf
				poArticolCompus.cantitate = 1 * lnSemn
		*!*	modificare	v 2.0.56	^
				poArticolCompus.cu_tva = 0
				If poDate.in_valuta = 1
					poArticolCompus.id_valuta = poDate.id_valuta
					poArticolCompus.Curs = poDate.Curs
					poArticolCompus.multiplicator = poDate.multiplicator
				Endif
		
				AddProperty(poArticolCompus,'pretftva',lnSemn*poArticolCompus.valftva)
				AddProperty(poArticolCompus,'tva',lnSemn*poArticolCompus.valtva)
				AddProperty(poArticolCompus,'pretctva',lnSemn*poArticolCompus.valctva)
		
				AddProperty(poArticolCompus,'vpretftva',lnSemn*poArticolCompus.vvalftva)
				AddProperty(poArticolCompus,'vtva',lnSemn*poArticolCompus.vvaltva)
				AddProperty(poArticolCompus,'vpretctva',lnSemn*poArticolCompus.vvalctva)
				
				AddProperty(poArticolCompus,'discountftva',lnSemn*poArticolCompus.valdiscountftva)
				AddProperty(poArticolCompus,'discountctva',lnSemn*poArticolCompus.valdiscountctva)
				AddProperty(poArticolCompus,'discounttva',poArticolCompus.valdiscountctva-poArticolCompus.valdiscountftva)
		
				AddProperty(poArticolCompus,'vdiscountftva',lnSemn*poArticolCompus.vvaldiscountftva)
				AddProperty(poArticolCompus,'vdiscountctva',lnSemn*poArticolCompus.vvaldiscountctva)
				AddProperty(poArticolCompus,'vdiscounttva',poArticolCompus.vvaldiscountctva-poArticolCompus.vvaldiscountftva)
		
				pofrmdetartcomp = Createobject('frm_articol_compus')
				pofrmdetartcomp.Show(1)
				If gnButon = 1
					Select crsfacturaset
					Append Blank
					Gather Name poArticolCompus MEMO
					Thisform.nid = Thisform.nid + 1
					*!*	modificare	v 2.0.56
					Thisform.nproc_tvav_set = - 1
					Thisform.nid_ctr = -99		&&	modificare	v 2.0.67
					Thisform.nselectate = 0
					*!*	modificare	v 2.0.56	^
					Thisform.grd_factura_set.Refresh()
				Endif
				Release poArticolCompus
			Else
				amessagebox("Nu ati selectat articolele!",48,"Atentie")
			Endif
		
			Select crsfactura
			Go lnRecno
		Endif
		Thisform.grd_factura.SetFocus()
	ENDPROC

	PROCEDURE do_modifica
		If Reccount('crsfacturaset') > 0
			Private poArticolCompus,pofrmdetartcomp
			Select crsfacturaset
			Scatter Name poArticolCompus MEMO
		
		*!*		MESSAGEBOX(TYPE('poArticolCompus.pretftva'),0,'pretftva')
		*!*		MESSAGEBOX(TYPE('poArticolCompus.tva'),0,'tva')
		*!*		MESSAGEBOX(TYPE('poArticolCompus.pretctva'),0,'pretctva')
		
		*!*		MESSAGEBOX(TYPE('poArticolCompus.discountftva'),0,'discountftva')
		*!*		MESSAGEBOX(TYPE('poArticolCompus.discountctva'),0,'discountctva')
		*!*		MESSAGEBOX(TYPE('poArticolCompus.discounttva'),0,'discounttva')
		
		
		*!*		MESSAGEBOX(TYPE('poArticolCompus.vpretftva'),0,'vpretftva')
		*!*		MESSAGEBOX(TYPE('poArticolCompus.vtva'),0,'vtva')
		*!*		MESSAGEBOX(TYPE('poArticolCompus.vpretctva'),0,'vpretctva')
		
		*!*		MESSAGEBOX(TYPE('poArticolCompus.vdiscountftva'),0,'vdiscountftva')
		*!*		MESSAGEBOX(TYPE('poArticolCompus.vdiscountctva'),0,'vdiscountctva')
		*!*		MESSAGEBOX(TYPE('poArticolCompus.vdiscounttva'),0,'vdiscounttva')
		
			AddProperty(poArticolCompus,'tva',poArticolCompus.pretctva-poArticolCompus.pretftva)
			AddProperty(poArticolCompus,'discounttva',poArticolCompus.discountctva-poArticolCompus.discountftva)
		
			AddProperty(poArticolCompus,'vtva',poArticolCompus.vpretctva-poArticolCompus.vpretftva)
			AddProperty(poArticolCompus,'vdiscounttva',poArticolCompus.vdiscountctva-poArticolCompus.vdiscountftva)
		
			pofrmdetartcomp = Createobject('frm_articol_compus')
			pofrmdetartcomp.Show(1)
			If gnButon = 1
				Select crsfacturaset
				Gather Name poArticolCompus MEMO
				Thisform.grd_factura_set.Refresh()
			Endif
			Release poArticolCompus
		Else
			amessagebox("Nu ati selectat articolele!",48,"Atentie")
		Endif
		
	ENDPROC

	PROCEDURE do_precedent
		Thisform.do_sterge()
	ENDPROC

	PROCEDURE do_selecteaza_rand
		Local lnProcTvav
		Select crsfactura
		lnProcTvav = proc_tvav
		lnIdCtr = id_ctr
		If id_set_fact = 0
		*!*	modificare	v 2.0.67
			Do Case
			Case Nvl(Thisform.nid_ctr,-1) <> Nvl(lnIdCtr,-1) AND thisform.nid_ctr <> -99
				amessagebox("Acest articol nu poate fi adaugat pentru ca apartine unui contract diferit de restul articolelor din set!",48,"Atentie")
		*!*	modificare	v 2.0.67	^
		*!*	modificare	v 2.0.56
			Case Thisform.nproc_tvav_set <> - 1 And Thisform.nproc_tvav_set <> lnProcTvav
				amessagebox("Acest articol nu poate fi adaugat pentru ca are cota de TVA diferita de restul articolelor din set!",48,"Atentie")
			Otherwise
				Thisform.nproc_tvav_set = lnProcTvav
				Thisform.nid_ctr = NVL(lnIdCtr,-1)		&&	modificare	v 2.0.67
				Thisform.nselectate = Thisform.nselectate + 1
		*!*	modificare	v 2.0.56	^
				Replace id_set_fact With Thisform.nid
		*!*	modificare	v 2.0.56
			Endcase
		*!*	modificare	v 2.0.56	^
		Else
			If id_set_fact = Thisform.nid
				Replace id_set_fact With 0
		*!*	modificare	v 2.0.56
				Thisform.nselectate = Thisform.nselectate - 1
				If Thisform.nselectate = 0
					Thisform.nproc_tvav_set = -1
					Thisform.nid_ctr = -99		&&	modificare	v 2.0.67
				Endif
		*!*	modificare	v 2.0.56	^
			Endif
		Endif
	ENDPROC

	PROCEDURE do_sterge
		If Reccount('crsfacturaset')>0
			save_grid_tag(Thisform.grd_factura_set)
			Select crsfacturaset
			lnId = id_set_fact
			Select * From crsfacturaset Where id_set_fact <> lnId Into Cursor crsfacturaset readwrite
			Select crsfactura
			Replace id_set_fact With 0 For id_set_fact = lnId
			restore_grid_tag(Thisform.grd_factura_set)
			Thisform.grd_factura_set.Refresh()
			Thisform.grd_factura.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_urmator
		Thisform.do_adauga()
		
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		Select crsfactura
		Replace id_set_fact With 0 All
		If Used('crsfacturaset')
			Use In crsfacturaset
		Endif
		Return .T.
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Select crsfactura
		Replace id_set_fact With 0 For id_set_fact = Thisform.nid
		llReturn = recalculeaza_pret_vanzare_compus()
		If llReturn
			If Reccount('crsfacturaset') = 0
				Use In crsfacturaset
		*!*	modificare	v 2.0.46
			Else
				Select crsfacturaset
				Replace valftva With Round(Pretftva*cantitate,gnPc),;
					valtva With Round(Round(Pretftva*cantitate,gnPc)*(proc_tvav-1),gnPc),;
					vvalftva With Iif(poDate.in_valuta=0,0,Round(vpretftva*cantitate,gnPVal)),;
					vvaltva With Iif(poDate.in_valuta=0,0,Round(Round(vPretftva*cantitate,gnPVal)*(proc_tvav-1),gnPVal))
		*!*				vvaltva With Iif(poDate.in_valuta=0,0,Round(Round(Pretftva*cantitate,gnPVal)*(proc_tvav-1),gnPVal))	&&	modificare	v 2.1.6
		*!*	modificare	v 2.0.46	^
			Endif
		Endif
		Return llReturn
	ENDPROC

	PROCEDURE Init
		DoDefault()
		This.grd_factura.SetAll("DynamicBackColor",;
			"IIF(id_set_fact=0,RGB(255,255,255),IIF(id_set_fact=Thisform.nid,RGB(107,182,255),RGB(231,227,231)))",;
			"Column")
	ENDPROC

	PROCEDURE KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		lcControl = Upper(Alltrim(Thisform.ActiveControl.Name))
		
		Do Case
		Case (nKeyCode >=33 And nKeyCode <=122) And (lcControl = 'GRD_FACTURA')
			Nodefault
			With This.txtArticole
				.Value = Alltrim(.Value) + Chr(nKeyCode)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		
		Case (nKeyCode >=33 And nKeyCode <=122) And (lcControl = 'GRD_FACTURA_SET')
			Nodefault
			With This.txtArticoleLista
				.Value = Alltrim(.Value) + Chr(nKeyCode)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		
		Case (nKeyCode = 127) And (lcControl <> 'GRD_FACTURA') && backspace
			Nodefault
			With This.txtArticole
				.Value = Left(Alltrim(.Value),Len(Alltrim(.Value))-1)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		
		Case (nKeyCode = 127) And (lcControl <> 'GRD_FACTURA_SET') && backspace
			Nodefault
			With This.txtArticoleLista
				.Value = Left(Alltrim(.Value),Len(Alltrim(.Value))-1)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		
		Case nKeyCode = 13 And lcControl = 'GRD_FACTURA'
			Nodefault
			Thisform.but_urmator1.SetFocus()
		Case nKeyCode = 13 And lcControl = 'BUT_URMATOR1'
			Nodefault
			Thisform.do_urmator()
		Case nKeyCode = 13 And lcControl = 'GRD_FACTURA_SET'
			Nodefault
			Thisform.txtArticole.SetFocus()
		Case nKeyCode = 7 And lcControl = 'GRD_FACTURA_SET'
			Nodefault
			Thisform.do_sterge()
		Case lcControl = 'TXTARTICOLELISTA' And nKeyCode = 13
			lcArticolCautat = Alltrim(Thisform.txtArticoleLista.Value)
			If Used('crsfacturaset')
				Select crsfacturaset
				Locate For Substr(Alltrim(denumire),1,Len(lcArticolCautat)) = lcArticolCautat
				Thisform.GRD_FACTURA_SET.SetFocus()
			Endif
		Case lcControl = 'TXTARTICOLE' And nKeyCode = 13
			lcArticolCautat = Alltrim(Thisform.txtArticole.Value)
			If Used('crsfactura')
				Select crsfactura
				Locate For Substr(Alltrim(denumire),1,Len(lcArticolCautat)) = lcArticolCautat
				Thisform.GRD_FACTURA.SetFocus()
			Endif
		Case nKeyCode=27 And nShiftAltCtrl=0
			Nodefault
			If aMessagebox("Sunteti sigur ca doriti sa inchideti fereastra?",4+32+256,"Confirmare")==6
				This.do_renunt()
			Endif
		Case nKeyCode=6 And nShiftAltCtrl=2
			Nodefault
			This.do_termin()
		Endcase
		
	ENDPROC

	PROCEDURE grd_factura.cDenumire.Text1.DblClick
		Thisform.do_selecteaza_rand()
		
	ENDPROC

	PROCEDURE grd_factura.cDenumire.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If nKeyCode = 32
			Thisform.do_selecteaza_rand()
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_avizare_lucrare 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="grd_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cArticol.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cArticol.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCodmat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCodmat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPret.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPret.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPreturi_cu_tva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPreturi_cu_tva._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cNume_gestiune.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cNume_gestiune.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCant_com.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCant_com.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCant_ramasa.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCant_ramasa.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCant_stoc.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCant_stoc.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPretctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPretctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCant_disp.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCant_disp.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_cursuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cb_gestiuni_dest" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_gestiuni_dest" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_baza" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cCurs.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cCurs.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cNume_val.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cNume_val.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cMultiplicator.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cMultiplicator.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtArticole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_codmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtCodmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ct_codmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ct_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_explicatie_Tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_reset1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_calculeaza_cant_disp
		*m: do_calculeaza_totaluri
		*m: do_creeaza_filtru
		*m: do_scrie_articole
		*m: do_scrie_factura
		*p: cfiltru
		*p: cmesaj_cantitate
		*p: cnewvalue
		*p: coldvalue
		*p: nbazafdiscount
		*p: nbazafdiscountval
		*p: nbazaron
		*p: nbazaval
		*p: ncantitate_init		&& Se retine cantitatea initiala din campul "Cantitate repartizata" in momentul in care intra pe coloana.
		*p: ncritcod
		*p: ncritdenumire
		*p: ndiscfactron
		*p: ndiscfactval
		*p: ndiscron
		*p: ndiscval
		*p: nid
		*p: nid_jtva_coloana
		*p: nnrinregvizibile		&& Numarul de inregistrari vizibile in gridul cu elementele facturii.
		*p: nproc_tvav
		*p: ntotalron
		*p: ntotalval
		*p: ntvaron
		*p: ntvaval
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		cfiltru = 
		cgridsortlist = grd_articole
		cmesaj_cantitate = .F.
		cnewvalue = 
		coldvalue = 
		DoCreate = .T.
		Height = 586
		Name = "frm_avizare_lucrare"
		nbazafdiscount = 0
		nbazafdiscountval = 0
		nbazaron = 0
		nbazaval = 0
		ncantitate_init = 0
		ncritcod = 2
		ncritdenumire = 2
		ndiscfactron = 0
		ndiscfactval = 0
		ndiscron = 0
		ndiscval = 0
		nid_jtva_coloana = 
		nnrinregvizibile = 0
		nproc_tvav = 0
		ntotalron = 0
		ntotalval = 0
		ntvaron = 0
		ntvaval = 0
		Width = 781
		WindowState = 2
		_memberdata = <VFPData>
			<memberdata name="ncritdenumire" display="nCritDenumire"/>
			<memberdata name="ncritcod" display="nCritCod"/>
		</VFPData>
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 780
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 682
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 97
		Lb_titlu_alb_b121.Caption = "TRANSFER ÎNTRE SUBUNITĂȚI PE BAZĂ DE LUCRARE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 8
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 748
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 6
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		Gridsort1.Left = 744
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 36
	*</PropValue>

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

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 716, ;
		Name = "But_renunt1", ;
		TabIndex = 7, ;
		Top = 1, ;
		Width = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_reset1' AS but_reset WITH ;
		Left = 321, ;
		Name = "But_reset1", ;
		Top = 34
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cb_explicatie_Tva' AS cb_tx_simplu WITH ;
		Height = 29, ;
		Left = 423, ;
		Name = "Cb_explicatie_Tva", ;
		TabIndex = 10, ;
		TabStop = .F., ;
		Top = 61, ;
		Width = 324, ;
		ZOrderSet = 21, ;
		_cbbase1.ColumnCount = 2, ;
		_cbbase1.ColumnLines = .F., ;
		_cbbase1.ColumnWidths = "200,15", ;
		_cbbase1.FontName = "Arial Narrow", ;
		_cbbase1.Height = 23, ;
		_cbbase1.Left = 112, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "jtva_coloane.denumire,cota_tva,id_jtva_coloana", ;
		_cbbase1.RowSourceType = 6, ;
		_cbbase1.Top = 3, ;
		_cbbase1.Width = 208, ;
		_lbbase1.Caption = "Explicație TVA", ;
		_lbbase1.FontName = "Arial Narrow", ;
		_lbbase1.Left = 5, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'cb_gestiuni_dest' AS combobox WITH ;
		ColumnCount = 1, ;
		ColumnLines = .F., ;
		ColumnWidths = "200,65,65", ;
		Height = 24, ;
		Left = 528, ;
		Name = "cb_gestiuni_dest", ;
		RowSourceType = 2, ;
		Style = 2, ;
		TabIndex = 14, ;
		Top = 36, ;
		Width = 220
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'Clb_total_baza' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 30, ;
		Left = 193, ;
		Name = "Clb_total_baza", ;
		TabIndex = 18, ;
		Top = 516, ;
		Width = 315, ;
		tx_suma_val.ControlSource = "thisform.nbazaval", ;
		tx_suma_val.Left = 136, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 4, ;
		lb_explicatie.Caption = "Total (bază)", ;
		lb_explicatie.Left = 6, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 7, ;
		tx_suma_nat.ControlSource = "thisform.nbazaron", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 228, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 4, ;
		lb_nume_val.Left = 200, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 7, ;
		lb_nume_nat.Left = 288, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 7, ;
		lb_explicatii.Left = 92, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 7
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total_factura' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 59, ;
		Left = 507, ;
		Name = "Clb_total_factura", ;
		TabIndex = 17, ;
		Top = 516, ;
		Width = 266, ;
		tx_suma_val.ControlSource = "thisform.ntotalval", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 81, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 20, ;
		lb_explicatie.Caption = "TOTAL FACTURĂ", ;
		lb_explicatie.FontBold = .T., ;
		lb_explicatie.Left = 5, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 4, ;
		tx_suma_nat.ControlSource = "thisform.ntotalron", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 173, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 20, ;
		lb_nume_val.FontBold = .T., ;
		lb_nume_val.Left = 145, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 23, ;
		lb_nume_nat.FontBold = .T., ;
		lb_nume_nat.Left = 233, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 23, ;
		lb_explicatii.Name = "lb_explicatii"
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total_tva' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 30, ;
		Left = 193, ;
		Name = "Clb_total_tva", ;
		TabIndex = 16, ;
		Top = 545, ;
		Width = 315, ;
		tx_suma_val.ControlSource = "thisform.ntvaval", ;
		tx_suma_val.Left = 136, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 4, ;
		lb_explicatie.Caption = "TVA", ;
		lb_explicatie.Left = 6, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 7, ;
		tx_suma_nat.ControlSource = "thisform.ntvaron", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 228, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 4, ;
		lb_nume_val.Left = 200, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 7, ;
		lb_nume_nat.Left = 288, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 7, ;
		lb_explicatii.Left = 92, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 7
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'ct_articole' AS criteriu_text WITH ;
		FontName = "Arial Narrow", ;
		Height = 24, ;
		Left = 80, ;
		Name = "ct_articole", ;
		TabIndex = 3, ;
		Top = 61, ;
		Value = 1, ;
		Width = 84
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'ct_codmat' AS criteriu_text WITH ;
		FontName = "Arial Narrow", ;
		Height = 24, ;
		Left = 80, ;
		Name = "ct_codmat", ;
		TabIndex = 1, ;
		Top = 35, ;
		Width = 84
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'grd_articole' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 11, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 384, ;
		HighlightStyle = 2, ;
		Left = 22, ;
		Name = "grd_articole", ;
		Panel = 1, ;
		ReadOnly = .F., ;
		RecordSource = "crsarticole", ;
		SelectedItemBackColor = 0,0,255, ;
		TabIndex = 5, ;
		Top = 96, ;
		Width = 734, ;
		Column1.ColumnOrder = 2, ;
		Column1.ControlSource = "denumire", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cArticol", ;
		Column1.ReadOnly = .F., ;
		Column1.Width = 187, ;
		Column2.ColumnOrder = 1, ;
		Column2.ControlSource = "codmat", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cCodmat", ;
		Column2.ReadOnly = .F., ;
		Column2.Width = 59, ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "pret", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.InputMask = (get_mask(14,gnPPretV)), ;
		Column3.Name = "cPret", ;
		Column3.ReadOnly = .F., ;
		Column3.Width = 53, ;
		Column4.ColumnOrder = 9, ;
		Column4.ControlSource = "cantitate", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.InputMask = (get_mask(14,gnPcant)), ;
		Column4.Name = "cCantitate", ;
		Column4.ReadOnly = .F., ;
		Column4.Width = 71, ;
		Column5.ColumnOrder = 4, ;
		Column5.ControlSource = "preturi_cu_tva", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Name = "cPreturi_cu_tva", ;
		Column5.ReadOnly = .T., ;
		Column5.Sparse = .F., ;
		Column5.Width = 39, ;
		Column6.ColumnOrder = 6, ;
		Column6.ControlSource = "nume_gestiune", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Name = "cNume_gestiune", ;
		Column6.ReadOnly = .F., ;
		Column6.Width = 89, ;
		Column7.ColumnOrder = 7, ;
		Column7.ControlSource = "cant_com", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.InputMask = (get_mask(14,gnPcant)), ;
		Column7.Name = "cCant_com", ;
		Column7.ReadOnly = .F., ;
		Column7.Width = 63, ;
		Column8.ColumnOrder = 8, ;
		Column8.ControlSource = "cant_ramasa", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.InputMask = (get_mask(14,gnPcant)), ;
		Column8.Name = "cCant_ramasa", ;
		Column8.ReadOnly = .F., ;
		Column8.Width = 64, ;
		Column9.ColumnOrder = 5, ;
		Column9.ControlSource = "cant_stoc", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.InputMask = (get_mask(14,gnPcant)), ;
		Column9.Name = "cCant_stoc", ;
		Column9.ReadOnly = .F., ;
		Column9.Width = 63, ;
		Column10.ColumnOrder = 10, ;
		Column10.ControlSource = "pretctva", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.InputMask = (get_mask(14,gnPa)), ;
		Column10.Name = "cPretctva", ;
		Column10.ReadOnly = .F., ;
		Column10.Visible = .F., ;
		Column10.Width = 65, ;
		Column11.ControlSource = "cant_disp", ;
		Column11.FontName = "Arial Narrow", ;
		Column11.Name = "cCant_disp", ;
		Column11.ReadOnly = .F., ;
		Column11.Width = 67
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

	ADD OBJECT 'grd_articole.cCant_com.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cant.comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cCant_disp.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cant.disp.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cCant_ramasa.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cant.ramasa", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cCant_stoc.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cant.stoc", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cCantitate.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cant. repartizata", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cCodmat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod material", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cNume_gestiune.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Gestiune dest.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

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

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

	ADD OBJECT 'grd_articole.cPretctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret cu TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_articole.cPretctva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,0,255, ;
		Visible = .F.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_articole.cPreturi_cu_tva._checkbox1' AS _checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial Narrow", ;
		Left = 23, ;
		Name = "_checkbox1", ;
		ReadOnly = .T., ;
		Top = 32
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'grd_articole.cPreturi_cu_tva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cu TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_cursuri' AS _grdrow WITH ;
		Anchor = 6, ;
		ColumnCount = 3, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 77, ;
		Left = 10, ;
		Name = "grd_cursuri", ;
		Panel = 1, ;
		RecordSource = "crscursuri", ;
		ScrollBars = 2, ;
		TabIndex = 31, ;
		TabStop = .F., ;
		Top = 503, ;
		Width = 177, ;
		ZOrderSet = 13, ;
		Column1.ColumnOrder = 3, ;
		Column1.ControlSource = "curs", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.InputMask = (get_mask(14,gnPCurs)), ;
		Column1.Name = "cCurs", ;
		Column1.Width = 38, ;
		Column2.ColumnOrder = 2, ;
		Column2.ControlSource = "nume_val", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cNume_val", ;
		Column2.Width = 56, ;
		Column3.ColumnOrder = 1, ;
		Column3.ControlSource = "multiplicator", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.InputMask = (get_mask(10,0)), ;
		Column3.Name = "cMultiplicator", ;
		Column3.Width = 49
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

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

	ADD OBJECT 'grd_cursuri.cMultiplicator.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 'grd_cursuri.cNume_val.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valuta", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'Lb_articole' AS lb_simplu WITH ;
		Caption = "Articol", ;
		FontName = "Arial Narrow", ;
		Left = 23, ;
		Name = "Lb_articole", ;
		TabIndex = 11, ;
		Top = 65
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_codmat' AS lb_simplu WITH ;
		Caption = "Cod material", ;
		FontName = "Arial Narrow", ;
		Left = 23, ;
		Name = "lb_codmat", ;
		TabIndex = 12, ;
		Top = 38
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_cursuri' AS lb_simplu WITH ;
		Anchor = 6, ;
		Caption = "Curs valutar", ;
		Left = 15, ;
		Name = "lb_cursuri", ;
		TabIndex = 10, ;
		Top = 485
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_gestiuni_dest' AS lb_simplu WITH ;
		Caption = "Gestiune destinație", ;
		FontName = "Arial Narrow", ;
		Left = 427, ;
		Name = "lb_gestiuni_dest", ;
		TabIndex = 9, ;
		Top = 39
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'txtArticole' AS textbox WITH ;
		FontName = "Arial Narrow", ;
		Format = "!k", ;
		Height = 23, ;
		Left = 168, ;
		Name = "txtArticole", ;
		TabIndex = 4, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 62, ;
		Width = 144
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtCodmat' AS textbox WITH ;
		FontName = "Arial Narrow", ;
		Format = "!k", ;
		Height = 23, ;
		Left = 168, ;
		Name = "txtCodmat", ;
		TabIndex = 2, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 36, ;
		Width = 120
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE Destroy
		If Used('crsarticole')
			Use In crsarticole
		Endif
	ENDPROC

	PROCEDURE do_calculeaza_cant_disp
		Lparameters tnCantitateNoua,tnIdArticol,tcCont
		Select crsarticole
		Thisform.LockScreen = .T.
		lnRecno = Recno()
		Replace cant_disp With cant_disp+Thisform.ncantitate_init-tnCantitateNoua ;
			for id_articol = tnIdArticol And Nvl(Cont,'XXXX') = Nvl(tcCont,'XXXX')
		Go (lnRecno)
		Thisform.LockScreen = .F.
	ENDPROC

	PROCEDURE do_calculeaza_totaluri
		Select Sum(Iif(preturi_cu_tva = 0,;
			Round(Round(Pret,gnPPretV)*Nvl(cantitate,0),gnPc),;
			ROUND(Round(Round(Pret,gnPPretV)/proc_tvav,gnPPretV)*Nvl(cantitate,0),gnPc))) As baza,;
			Sum(Iif(preturi_cu_tva = 0,;
			Round(Round(Round(Pret,gnPPretV)*Nvl(cantitate,0),gnPc)*(proc_tvav-1),gnPc),;
			ROUND(Round(Pret,gnPPretV)*Nvl(cantitate,0),gnPc)-;
			Round(Round(Round(Pret,gnPPretV)/proc_tvav,gnPPretV)*Nvl(cantitate,0),gnPc))) As tva ;
			From crsarticole  WITH (BUFFERING = .T.) ;
			Into Cursor crstotalurifact
		
		Select crstotalurifact
		Thisform.nbazaron = Nvl(baza,0)
		Thisform.ntvaron = Nvl(tva,0)
		Thisform.ntotalron = Nvl(baza,0) + Nvl(tva,0)
		
		Thisform.clb_total_baza.Refresh()
		Thisform.clb_total_tva.Refresh()
		Thisform.clb_total_factura.Refresh()
		
		If Used('crstotalurifact')
			Use In crstotalurifact
		Endif
		
	ENDPROC

	PROCEDURE do_cauta
		lcFiltru = Thisform.do_creeaza_filtru(Thisform.ct_articole,[denumire],Alltrim(Strtran(Thisform.txtArticole.Value,['],[''])))
		lcFiltru = lcFiltru + [ AND ] + Thisform.do_creeaza_filtru(Thisform.ct_codmat,[codmat],Alltrim(Strtran(Thisform.txtcodmat.Value,['],[''])))
		Thisform.cfiltru = lcFiltru
		Select crsarticole
		Set Filter To &lcFiltru
		Go Top
		Thisform.grd_articole.SetFocus()
	ENDPROC

	PROCEDURE do_creeaza_filtru
		Lparameters toCriteriu,tcNumeCamp,tcValoare
		Local lnCriteriu,lcFiltru
		lnCriteriu = toCriteriu.Value
		Do Case
		Case lnCriteriu = 1
			lcFiltru = "LIKE('" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu = 2
			lcFiltru = "UPPER(Nvl("+Alltrim(tcNumeCamp)+",''))='" + Upper(Strtran(tcValoare,['],[''])) + "'"
		Case lnCriteriu = 3
			lcFiltru = "UPPER(Nvl("+Alltrim(tcNumeCamp)+",''))<>'" + Upper(Strtran(tcValoare,['],[''])) + "'"
		Case lnCriteriu = 4
			lcFiltru = "LIKE('*" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu = 5
			lcFiltru = "!LIKE('*" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu=6
			lcFiltru = "EMPTY(Nvl("+Alltrim(tcNumeCamp)+",''))"
		Case lnCriteriu=7
			lcFiltru = "!EMPTY(Nvl("+Alltrim(tcNumeCamp)+",''))"
		Endcase
		Return lcFiltru
	ENDPROC

	PROCEDURE do_listare
		If Reccount('crsarticole')>0
			Thisform.AlwaysOnTop = .F.
			goExport.export2frx([crsarticole],[lista_aviz_lucrare])	&&	, , , , , , .T.)
			Thisform.AlwaysOnTop = .T.
		Endif
	ENDPROC

	PROCEDURE do_reset
		*!*	modificare	v 2.0.56
		Local lcCriteriuCod, lcCriteriuDenumire
		lcCriteriuCod = goExport.citesteSetareRegistru("CRITCOD")
		If !Empty(lcCriteriuCod) And Type('VAL(lcCriteriuCod)') = 'N'
			Thisform.ncritcod = Val(lcCriteriuCod)
		Endif
		Thisform.ct_codmat.Value = Thisform.ncritcod
		
		lcCriteriuDenumire = goExport.citesteSetareRegistru("CRITDENUMIRE")
		If !Empty(lcCriteriuDenumire) And Type('VAL(lcCriteriuDenumire)') = 'N'
			Thisform.ncritDenumire = Val(lcCriteriuDenumire)
		Endif
		Thisform.ct_articole.Value = Thisform.ncritDenumire
		
		*!*	Thisform.ct_codmat.Value = 2
		*!*	modificare	v 2.0.56	^
		Thisform.txtCodmat.Value = []
		*Thisform.ct_articole.Value = 1
		Thisform.txtArticole.Value = []
		Thisform.cfiltru = []
		Select crsarticole
		Set Filter To
		Go Top
		Thisform.grd_articole.SetFocus()
		
	ENDPROC

	PROCEDURE do_scrie_articole
		Local llReturn,lcSql,lnSucces
		llReturn = .T.
		If Thisform.do_deschide_tranzactie()
			lcSql = gcS + [.pack_facturare.initializeaza_date_factura(to_date('] + Dtoc(poDate.dataireg,1)+[','YYYYMMDD'),] + ;
				Alltrim(Str(poDate.id_fdoc)) + [,to_date('] + Dtoc(poDate.dataact,1) + [','YYYYMMDD'),] + ;
				[NULL,'] + Alltrim(Nvl(poDate.serie_act,[])) + [',] + ;
				Alltrim(Str(poDate.nract,14,0)) + [,] + Alltrim(Str(poDate.id_client)) + [,] + Alltrim(Str(poDate.id_lucrare)) + [,] + ;
				Iif(IsNull(poDate.id_sectie),[NULL],Alltrim(Str(poDate.id_sectie))) + [,] + ;
				Iif(IsNull(poDate.id_venchelt),[NULL],Alltrim(Str(poDate.id_venchelt))) + [,] + ;		&&	modificare	v 2.0.46
				Iif(IsNull(poDate.id_responsabil),[NULL],Alltrim(Str(poDate.id_responsabil))) + [,] + ;
				IIF(EMPTY(nvl(poDate.explicatia4,[])),[NULL],['] + OracleSpecialCharacters(ALLTRIM(poDate.explicatia4))+[']) + [,] + ;		&&	modificare	ROACONTRACTE v 2.0.42
				[NULL,'] + Alltrim(Nvl(poDate.listaid,'')) + [','] + Alltrim(Nvl(poDate.descriere,'')) + [',] + ;
				Alltrim(Str(poDate.Tip)) + [,] + Alltrim(Str(poDate.id_set)) + [,] + ;
				[to_date('] + Dtoc(poDate.zi_curs,1) + [','YYYYMMDD'),] + Alltrim(Str(poDate.id_valuta)) + [,] + ;
				Alltrim(Str(poDate.in_valuta)) + [,] + ;
				alltrim(str(poDate.tva_incasare)) + [,] + ;
				Iif(IsNull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [,] + Alltrim(Str(gnIdUtil)) + [);]
			lcSql = [begin ] + lcSql + [ end;]
		
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces<0
				amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				llReturn = .F.
			Else
				Private poArt
				lcSql = []
		*!*	modificare	v 2.0.23
		*!*			Select crsarticole
		*!*			Scan for cantitate <> 0
		*!*	modificare	v 2.0.56
		*!*			Dimension laStructura(1,18)
		*!*			Afields(laStructura,[crsarticole])
		*!*			Create Cursor crsarticoleord From Array laStructura
				copiaza_structura_cursor([crsarticole],[crsarticoleord])
		*!*	modificare	v 2.0.56	^
				Release laStructura
				Insert Into crsarticoleord Select * From crsarticole Where cantitate <> 0 Order By id_comanda,id_comanda_element
				Select crsarticoleord
				Scan
		*!*	modificare	v 2.0.23	^
					Scatter Name poArt MEMO
					lcSql = lcSql + gcS + [.pack_facturare.adauga_articol_lucrare_pret(] + Alltrim(Str(poArt.id_comanda)) + [,] + ;
						Alltrim(Str(poArt.id_articol)) + [,] + Alltrim(Str(poArt.id_pol)) + [,] + ;
						Alltrim(Str(poArt.cantitate,18,gnPCant)) + [,] + ;
						Alltrim(Nvl(poArt.Cont,'')) + [,] + Alltrim(Str(poArt.Curs,18,gnPCurs)) + [,] + ;
						ALLTRIM(STR(poArt.multiplicator,10)) + [,] + ;
						Alltrim(Nvl(Str(thisform.nid_jtva_coloana),[NULL])) + [,] + Alltrim(Str(poArt.id_gestiune)) + [,] + ;
						Alltrim(Str(gnIdUtil)) + [,]+Alltrim(Str(poart.pret,20,4))+[);]
					lcSql = [begin ] + lcSql + [ end;]
						lnSucces = goExecutor.oExecute(lcSql)
						If lnSucces < 0
							amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
							llReturn = .F.
							Exit
						Else
							lcSql = []
						Endif
				Endscan
		*!*	modificare	v 2.0.23
				If Used('crsarticoleord')
					Use In crsarticoleord
				Endif
		*!*	modificare	v 2.0.23	^
				If !Empty(lcSql) And llReturn
					lcSql = [begin ] + lcSql + [ end;]
					lnSucces = goExecutor.oExecute(lcSql)
					If lnSucces < 0
						amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
						llReturn = .F.
					Endif
				Endif
			Endif
		Else
			llReturn = .F.
		Endif
		If !llReturn
			Thisform.do_inchide_tranzactie(2)
		Endif
		Release poArt
		Return llReturn
	ENDPROC

	PROCEDURE do_scrie_factura
		*!*		emitere avize / facturi
		Private pnDiscount, pnParametruAditional, pcSirDifAcont, pcSirDifPart
		Local llReturn,lnSucces,lnCantitateRamasa,lcSql,lnIdSerie
		pcSirDifAcont = []
		pcSirDifPart = []
		lcCursorVerificare = [crsact]
		lcCursorFinal = [actactan]
		llReturn = .T.
		pnDiscount = Thisform.ndiscfactron
		*!*	facturare pe baza de comanda / avize pe baza de comanda
		Select crsarticole
		*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
		*!*	modificare v 2.0.90
		*!*	lcSql = [{call ] + gcS + [.pack_facturare.scrie_avize_lucrare(] + Alltrim(Str(pnDiscount,18,gnPc)) + [,] + ;
		*!*		Alltrim(Str(poDate.discount_evidentiat)) + [,] + ;
		*!*		Iif(Inlist(poDate.rezultat_serii,1,3),Alltrim(Str(poGeneratorNumere.getIdSerie(6))),[NULL]) + [,?@poDate.nid_vanzare)}]
		lnIdSerie = IIF(Inlist(poDate.rezultat_serii,1,3),poGeneratorNumere.getIdSerie(6),Null)
		lcSql = [{call ] + gcS + [.pack_facturare.scrie_avize_lucrare(] + Alltrim(Str(pnDiscount,18,gnPC)) + [,] + ;
			Alltrim(Str(poDate.discount_evidentiat)) + [,] + ;
			Iif(Isnull(lnIdSerie),[NULL],Alltrim(Str(lnIdSerie))) + [,?@poDate.nid_vanzare)}]
		*!*	modificare v 2.0.90	^
		If Thisform.do_scrie_articole()
			lnSucces = goExecutor.oExecute(lcSql,lcCursorVerificare)
			If lnSucces<0
				amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				llReturn = .F.
			Else
				gnButon = 1
				If Reccount(lcCursorVerificare)>0
					Select a.*,a.suma As totftva, a.suma As tottva, Ttod(a.dataactt) As dataact, ;
						Ttod(a.datairegt) As dataireg, Ttod(a.datascadt) As datascad, ;
						0 As pozitie_1, 0 As pozitie_2 From (lcCursorVerificare) a Into Cursor (lcCursorFinal) Readwrite
					Use In (lcCursorVerificare)
					Select (lcCursorFinal)
					Do Form verificare With .T.,.T.
					If gnButon = 1
						Select (lcCursorFinal)
						Scan For Nvl(ascd,'') <> Nvl(ascd1,'') Or Nvl(ascc,'') <> Nvl(ascc1,'') Or ;
								NVL(id_partd,0) <> Nvl(id_partd1,0) Or Nvl(id_partc,0) <> Nvl(id_partc1,0)
							If Nvl(ascd,'') <> Nvl(ascd1,'') Or Nvl(ascc,'') <> Nvl(ascc1,'')
								pcSirDifAcont = pcSirDifAcont + Alltrim(Str(id_act)) + [|] + Alltrim(Nvl(ascd,'')) + [|] + Alltrim(Nvl(ascc,'')) + [;]
							Endif
							If Nvl(id_partd,0) <> Nvl(id_partd1,0) Or Nvl(id_partc,0) <> Nvl(id_partc1,0)
								If (Like([41*],scd) And Nvl(id_partd,0) <> Nvl(id_partd1,0)) ;
										Or (Like([41*],scc) And Nvl(id_partc,0) <> Nvl(id_partc1,0))
									amessagebox("Nu puteti modifica clientul!",48,"Atentie")
									Return .F.
								Else
									pcSirDifPart = pcSirDifPart + Alltrim(Str(id_act)) + [|] + Alltrim(Str(Nvl(id_partd,0))) + [|] + Alltrim(Str(Nvl(id_partc,0))) + [;]
								Endif
							Endif
						Endscan
						lnReturn = 1
		*!*	modificare	v 2.0.58
		*!*					lcSql = [begin ] + gcS + [.pack_facturare.finalizeaza_scriere_verificare(?pnDiscount,NULL,] + ;
		*!*						[NULL,NULL,NULL,?pcSirDifAcont,?pcSirDifPart,0,); end;]
		*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
						lcSql = [begin ] + gcS + [.pack_facturare.finalizeaza_scriere_verificare(] + Alltrim(Str(pnDiscount,20,gnPc)) + [,] + ;
							[NULL,NULL,SYSDATE,NULL,NULL,'] + Alltrim(pcSirDifAcont) + [','] + Alltrim(pcSirDifPart) + [',] + ;
							[0,?@poDate.nid_vanzare); end;]
		*!*	modificare	v 2.0.58	^
						lnSucces = goExecutor.oExecute(lcSql)
						If lnSucces<0 And lnReturn = 1
							amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
							gnButon = 2
							llReturn = .F.
						Endif
					Endif
					Use In (lcCursorFinal)
				Endif
				If gnButon <> 1
					llReturn = .F.
				Endif
			Endif
			If llReturn
				llReturn = Thisform.do_inchide_tranzactie(1)
			Else
				Thisform.do_inchide_tranzactie(2)
			Endif
		Else
			llReturn = .F.
		Endif
		Return llReturn
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local plReturn,llContinuare,lcMesajEroare, lcMesaj2,lcMesaj3
		Store .F. To plReturn
		Store .T. To llContinuare
		Store '' To lcMesajEroare, lcMesaj2,lcMesaj3
		
		
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		
		If Used('crsver')
			Use In crsver
		Endif
		
		lnTotalFactura = Thisform.ntotalron
		poDate.totalctva = lnTotalFactura
		
		Select Count(*) As nr From crsarticole Where cantitate > 0 Into Cursor crsver
		Select crsver
		lnNr = nr
		If lnNr = 0
			amessagebox("Nu exista cantitati pentru avizat!",48,"Atentie")
			llContinuare = .F.
			plReturn = .F.
		Endif
		
		If Used('crsver')
			Use In crsver
		Endif
		
		If lnTotalFactura = 0 And llContinuare
			If amessagebox("Avizul are totalul 0. Doriti sa continuati?",4+48+256,"Confirmare") = 7
				llContinuare = .F.
				plReturn = .F.
				Thisform.grd_articole.SetFocus()
			Endif
		Endif
		
		If llContinuare
		*!*	modificare	v 2.0.19	:	am inlocuit sum(cant_com) cu sum(cant_ramasa)
			Select Distinct id_articol,cant_stoc,denumire,codmat,Sum(cantitate) As cantitate,Sum(cant_ramasa) As cant_com ;
				From crsarticole With (Buffering = .T.) ;
				GROUP By id_articol,cant_stoc,denumire,codmat ;
				Into Cursor crsver
			Select crsver
			Scan
				If cantitate > cant_stoc and cantitate <> 0 	&&	modificare v 2.0.65
					If Empty(lcMesajEroare)
						lcMesajEroare = 'A fost avizata o cantitate mai mare decat este in stoc din: '+CRLF+CRLF
					Endif
					lcMesajEroare = lcMesajEroare + Chr(9) + Alltrim(Nvl(codmat,[]))+' '+Alltrim(denumire) + CRLF
					llContinuare = .F.
					plReturn = .F.
				Endif
				If cantitate<cant_com And cant_stoc>cantitate
					If Empty(lcMesaj2)
						lcMesaj2= 'Exista cantitatea necesara in stoc dar cantitatea avizata este diferita de cea ramasa la: '+CRLF+CRLF
					Endif
					lcMesaj2 = lcMesaj2 + Chr(9) + Alltrim(Nvl(codmat,[])) +' '+Alltrim(denumire) + CRLF
				Endif
				If cantitate>cant_com
					If Empty(lcMesaj3)
						lcMesaj3= 'Cantitatea avizata este mai mare decat cantitatea ramasa la: '+CRLF+CRLF
					Endif
					lcMesaj3 = lcMesaj3 + Chr(9) + Alltrim(Nvl(codmat,[])) +' '+Alltrim(denumire) + CRLF
				Endif
				Select crsver
			Endscan
			If !Empty(lcMesajEroare)
				amessagebox(lcMesajEroare,16,'Eroare avizare')
			Else
				If !Empty(lcMesaj2)
					lcMesaj2 = lcMesaj2+CRLF+ 'Continuati?'
					If amessagebox(lcMesaj2,4+48,'Atentie') = 7
						llContinuare = .F.
						plReturn = .F.
					Endif
				Endif
				If !Empty(lcMesaj3) and llContinuare
					lcMesaj3 = lcMesaj3+CRLF+ 'Continuati?'
					If amessagebox(lcMesaj3,4+48,'Atentie') = 7
						llContinuare = .F.
						plReturn = .F.
					Endif
				Endif
			Endif
			If Used('crsver')
				Use In crsver
			Endif
			If llContinuare
				plReturn = Thisform.do_scrie_factura()
			Endif
		Endif
		
		Return plReturn
	ENDPROC

	PROCEDURE Init
		*!* 14.07.2016
		*!* marius.mutu
		*!* criteriu initial articole
		
		Local lcTipDoc
		Local lcCriteriuCod, lcCriteriuDenumire, lcFiltru
		*:Global gcAcces
		lcTipDoc = [factura]
		*!*	modificare	v 2.0.56
		lcCriteriuCod = goExport.citesteSetareRegistru("CRITCOD")
		If !Empty(lcCriteriuCod) And Type('VAL(lcCriteriuCod)') = 'N'
			Thisform.ncritcod = Val(lcCriteriuCod)
		Endif
		Thisform.ct_codmat.Value = Thisform.ncritcod
		*!*	modificare	v 2.0.56	^
		
		lcCriteriuDenumire = goExport.citesteSetareRegistru("CRITDENUMIRE")
		If !Empty(lcCriteriuDenumire) And Type('VAL(lcCriteriuDenumire)') = 'N'
			Thisform.ncritDenumire = Val(lcCriteriuDenumire)
		Endif
		Thisform.ct_articole.Value = Thisform.ncritDenumire
		
		*!*	modificare	v 2.0.26
		gcAcces = [2;]
		*!*	modificare	v 2.0.26	^
		DoDefault()
		If !Used('crsgestiunidest') Or (Used('crsgestiunidest') And Reccount('crsgestiunidest') = 2 )
			Thisform.RemoveObject('lb_gestiuni_dest')
			Thisform.RemoveObject('cb_gestiuni_dest')
		Else
			Thisform.cb_gestiuni_dest.RowSource = [crsgestiunidest.nume_gestiune,id_gestiune]
			Select crsgestiunidest
			Go Top
			Thisform.cb_gestiuni_dest.Value = Alltrim(nume_gestiune)
		Endif
		
		If !Used('crscursuri') Or Reccount('crscursuri') = 0
			Thisform.RemoveObject('lb_cursuri')
			Thisform.RemoveObject('grd_cursuri')
		Endif
		
		lcTipDoc = [aviz]
		This.cmesaj_cantitate = [A fost avizata intreaga cantitate comandata pentru acest articol!]
		
		Thisform.clb_total_factura.lb_explicatie.Caption = [TOTAL AVIZE]
		Thisform.clb_total_baza.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_total_factura.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_total_tva.do_actualizeaza_lbval(poDate.nume_valuta)
		
		Thisform.grd_articole.cCantitate.DynamicForeColor = "IIF(cantitate<cant_ramasa,Rgb(255,0,0),Rgb(0,0,0))"
		Thisform.grd_articole.cCantitate.DynamicBackColor = "RGB(193,237,255)"
		Thisform.grd_articole.cCantitate.ReadOnly = .F.
		Thisform.grd_articole.cpretctva.ReadOnly = .F.
		Thisform.grd_articole.cpret.ReadOnly = .F.
		
		
		Select crsarticole
		Calculate Max(proc_tvav) To Thisform.nproc_tvav
		Go Top
		Select jtva_coloane
		lcFiltru = [cota_tva=] + Alltrim(Str(Thisform.nproc_tvav, 8, 2)) + [*100-100]
		Set Filter To &lcFiltru
		If Nvl(Thisform.nproc_tvav, 0) * 100 - 100 = 0
			Locate For id_jtva_coloana = 8
			If !Found()
				Go Top
			Endif
		Else
			Go Top
		Endif
		Thisform.nid_jtva_coloana = id_jtva_coloana
		Thisform.cb_explicatie_Tva._cbbase1.Value = denumire
		Thisform.cb_explicatie_Tva._cbbase1.Requery()
		
		Thisform.do_calculeaza_totaluri()
	ENDPROC

	PROCEDURE KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		lcControl = Upper(Alltrim(Thisform.ActiveControl.Name))
		
		Do Case
		Case Inlist(nKeyCode,9,13) And (lcControl = 'PROCENT')
			Thisform.do_calculeaza_discount(Thisform.ActiveControl.Value)
		*!*	Case (nKeyCode >=33 And nKeyCode <=122) And (lcControl = 'GRD_ARTICOLE')
		Case (nKeyCode >=33 And nKeyCode <=122) And (!InList(lcControl,'GRD_ARTICOLE','CCANTITATE','CPRETCTVA','TXTCODMAT'))
			Nodefault
			With This.txtArticole
				.Value = Alltrim(.Value) + Chr(nKeyCode)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		Case (nKeyCode = 127) And (!InList(lcControl,'GRD_ARTICOLE','CCANTITATE','CPRETCTVA','TXTCODMAT')) && backspace
			Nodefault
			With This.txtArticole
				.Value = Left(Alltrim(.Value),Len(Alltrim(.Value))-1)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		Case InList(lcControl,'TXTARTICOLE','TXTCODMAT') And nKeyCode = 13
			Nodefault
			If Used('crsarticole')
		*!*	modificare	v 2.0.26
					Thisform.do_cauta()
		*!*			Select crsarticole
		*!*			lnRecno = Recno()
		*!*			lcFiltru = Thisform.do_creeaza_filtru(Thisform.ct_articole,[denumire],Alltrim(Strtran(Thisform.txtArticole.Value,['],[''])))
		*!*			lcFiltru = lcFiltru + [ AND ] + Thisform.do_creeaza_filtru(Thisform.ct_codmat,[codmat],Alltrim(Strtran(Thisform.txtcodmat.Value,['],[''])))
		*!*			Locate for &lcFiltru
		*!*			If Found()
		*!*				Thisform.grd_articole.SetFocus()
		*!*			Else
		*!*				amessagebox("Articolul nu a fost gasit!",48,"Atentie")
		*!*				Go lnRecno
		*!*				Thisform.txtArticole.SetFocus()
		*!*			Endif
		*!*	modificare	v 2.0.26	^
			Endif
		Case nKeyCode=27 And nShiftAltCtrl=0
			Nodefault
			If amessagebox("Sunteti sigur ca doriti sa inchideti fereastra?",4+32+256,"Confirmare")==6
				This.do_renunt()
			Endif
		Case nKeyCode=6 And nShiftAltCtrl=2
			Nodefault
			This.do_termin()
		Endcase
		
	ENDPROC

	PROCEDURE Cb_explicatie_Tva._cbbase1.InteractiveChange
		Select jtva_coloane
		Thisform.nid_jtva_coloana = id_jtva_coloana
	ENDPROC

	PROCEDURE cb_gestiuni_dest.InteractiveChange
		Select crsgestiunidest
		lcFiltru = Iif(id_gestiune=-9999,[.T.],[id_gestiune = ] + Alltrim(Str(id_gestiune)))
		save_grid_tag(Thisform.grd_articole)
		Select crsarticole
		Set Filter To &lcFiltru
		Go Top
		restore_grid_tag(Thisform.grd_articole)
		Thisform.txtArticole.SetFocus()
		
	ENDPROC

	PROCEDURE ct_articole.InteractiveChange
		With Thisform.txtArticole
			If This.Value>5
				.Value=""
				.ReadOnly=.T.
			Else
				.ReadOnly=.F.
				.SetFocus()
			Endif
		Endwith
	ENDPROC

	PROCEDURE ct_codmat.InteractiveChange
		With Thisform.txtcodmat
			If This.Value>5
				.Value=""
				.ReadOnly=.T.
			Else
				.ReadOnly=.F.
				.SetFocus()
			Endif
		Endwith
		
	ENDPROC

	PROCEDURE grd_articole.cCantitate.Text1.GotFocus
		*!*	modificare	v 2.0.25
		Thisform.ncantitate_init = This.Value
		*!*	modificare	v 2.0.25	^
	ENDPROC

	PROCEDURE grd_articole.cCantitate.Text1.KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		If Inlist(nKeyCode,9,13)
			Nodefault
			Skip In crsarticole
		Endif
		
	ENDPROC

	PROCEDURE grd_articole.cCantitate.Text1.LostFocus
		Thisform.do_calculeaza_totaluri()
		*!*	modificare	v 2.0.25
		If This.Value <> Thisform.ncantitate_init
			Select crsarticole
			Thisform.do_calculeaza_cant_disp(This.Value,id_articol,Cont)
		Endif
		Thisform.ncantitate_init = 0
		*!*	modificare	v 2.0.25	^
	ENDPROC

	PROCEDURE grd_articole.cPret.Text1.LostFocus
		Thisform.do_calculeaza_totaluri()
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_date_aviz AS _frmbase OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nract" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_fdoc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_nume_client" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_responsabil" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_altele" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_politici_preturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie_act" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_lucrare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_gestiune_init" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_venchelt" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_dataireg" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_zi_curs" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_dataact" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_altele
		*m: do_cauta_avize
		*m: do_cauta_client
		*m: do_cauta_comanda
		*m: do_cauta_contract
		*m: do_cauta_fdoc
		*m: do_cauta_gestiune_dest
		*m: do_cauta_gestiune_init
		*m: do_cauta_lucrare
		*m: do_cauta_politica
		*m: do_cauta_responsabil
		*m: do_cauta_sectie
		*m: do_cauta_venchelt
		*p: cgestiune_init		&& Numele gestiunii alese ca gestiune din care se face scaderea din stoc.
		*p: lcopiere		&& Copiere factura/aviz
		*p: nid
		*p: nid_tip
		*p: ntip
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgestiune_init = 
		DoCreate = .T.
		Height = 455
		lcopiere = .F.
		Name = "frm_date_aviz"
		nid_tip = 0
		ntip = 
		Width = 383
		_memberdata = <VFPData>
			<memberdata name="lcopiere" display="lCopiere"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 384
		_shape2.Height = 29
		_shape2.Left = 315
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		Lb_titlu_alb_b121.Caption = "AVIZ DE EXPEDIȚIE"
		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 = 17
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 351
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 15
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		Gridsort1.Left = 360
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 35
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Height = 27, ;
		Left = 319, ;
		Name = "But_renunt1", ;
		TabIndex = 16, ;
		Top = 1, ;
		Width = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Clb_dataact' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_dataact", ;
		TabIndex = 3, ;
		Top = 103, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.dataact", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Data documentului", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_dataireg' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_dataireg", ;
		TabIndex = 1, ;
		Top = 47, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.dataireg", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Dată înregistrare", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_nract' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_nract", ;
		TabIndex = 6, ;
		Top = 187, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.nract", ;
		Text_simplu1.InputMask = (get_mask(14,0)), ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Lb_simplu1.Caption = "Nr. documentului", ;
		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_act' AS clb_serie_act WITH ;
		cvariabila = serie_act, ;
		cvariabiladoc = nract, ;
		Left = 25, ;
		Name = "Clb_serie_act", ;
		nid_tipdoc = 6, ;
		pcobj = poDate, ;
		TabIndex = 5, ;
		Top = 159, ;
		Text_simplu1.ControlSource = "poDate.serie_act", ;
		Text_simplu1.Name = "Text_simplu1", ;
		_cbbase1.Name = "_cbbase1", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="serii_numere.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_zi_curs' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_zi_curs", ;
		TabIndex = 4, ;
		Top = 131, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.zi_curs", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Data cursului valutar", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_altele' AS ct_clb_cautare WITH ;
		cconditie = ISNULL(poDate.listaid) or EMPTY(poDate.listaid), ;
		cprocedura = thisform.do_cauta_altele, ;
		cvar_afisata = poDate.descriere, ;
		Left = 24, ;
		Name = "Ct_clb_altele", ;
		TabIndex = 12, ;
		Top = 354, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Altele", ;
		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_fdoc' AS ct_clb_cautare WITH ;
		cconditie = ISNULL(poDate.id_fdoc) or EMPTY(poDate.id_fdoc), ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = poDate.fdoc, ;
		Left = 24, ;
		Name = "Ct_clb_fdoc", ;
		TabIndex = 2, ;
		Top = 74, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Felul documentului", ;
		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_gestiune_init' AS ct_clb_cautare WITH ;
		cprocedura = thisform.do_cauta_gestiune_init, ;
		cvar_afisata = thisform.cgestiune_init, ;
		Left = 24, ;
		Name = "Ct_clb_gestiune_init", ;
		TabIndex = 14, ;
		ToolTipText = " Daca nu alegeti gestiunea, la scaderea din stoc a unui articol va vor fi aratate stocurile tuturor gestiunilor pe care aveti drepturi.", ;
		Top = 410, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Gestiune sursă", ;
		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_lucrare' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_lucrare,0)), ;
		cprocedura = thisform.do_cauta_lucrare, ;
		cvar_afisata = poDate.nrord, ;
		Left = 24, ;
		Name = "Ct_clb_lucrare", ;
		TabIndex = 8, ;
		Top = 242, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Lucrare", ;
		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_nume_client' AS ct_clb_cautare WITH ;
		cconditie = ISNULL(poDate.id_client) or EMPTY(poDate.id_client), ;
		cprocedura = thisform.do_cauta_client, ;
		cvar_afisata = poDate.nume_client, ;
		Left = 24, ;
		Name = "Ct_clb_nume_client", ;
		TabIndex = 7, ;
		Top = 214, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Nume client", ;
		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_politici_preturi' AS ct_clb_cautare WITH ;
		cconditie = ISNULL(poDate.id_pol) or EMPTY(poDate.id_pol), ;
		cprocedura = thisform.do_cauta_politica, ;
		cvar_afisata = poDate.nume_politica, ;
		Left = 24, ;
		Name = "Ct_clb_politici_preturi", ;
		TabIndex = 13, ;
		Top = 382, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Politica de prețuri", ;
		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_responsabil' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_responsabil,0)), ;
		cprocedura = thisform.do_cauta_responsabil, ;
		cvar_afisata = poDate.responsabil, ;
		Left = 24, ;
		Name = "Ct_clb_responsabil", ;
		TabIndex = 11, ;
		Top = 326, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Responsabil", ;
		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_sectie' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_sectie,0)), ;
		cprocedura = thisform.do_cauta_sectie, ;
		cvar_afisata = poDate.sectie, ;
		Left = 24, ;
		Name = "Ct_clb_sectie", ;
		TabIndex = 9, ;
		Top = 270, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Secție", ;
		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_venchelt' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_venchelt,0)), ;
		cprocedura = thisform.do_cauta_venchelt, ;
		cvar_afisata = poDate.venchelt, ;
		Left = 24, ;
		Name = "Ct_clb_venchelt", ;
		TabIndex = 10, ;
		Top = 298, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Venit / cheltuială", ;
		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" />
	
	PROCEDURE do_cauta_altele
		Do Case
			Case Inlist(Thisform.nid_tip,23,41)
				Thisform.do_cauta_gestiune_dest()
			Case Inlist(Thisform.nid_tip,21,25,28,42,47)		&&	modificare v 2.0.93 : am adaugat 47
				Thisform.do_cauta_comanda()
			Case Thisform.nid_tip = 26
				Thisform.do_cauta_contract()
			Case Thisform.nid_tip = 24 && aviz retur
				Thisform.do_cauta_avize()		
		Endcase
		
	ENDPROC

	PROCEDURE do_cauta_avize
		Local lcXMLAvize
		If Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales clientul!",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
			lcXMLAvize = caut_avize(poDate.id_client) && oproceduri_facturare.prg
			If !Empty(lcXMLAvize)
				Xmltocursor(lcXMLAvize, "crsAvizeTemp")
				Select id_vanzare,id_comanda,;
					Padl(Iif(!Empty(Nvl(serie_act,[])),Alltrim(serie_act)+[ ],[])+Alltrim(Str(numar_act,20)),50,[ ]) As numar_act ;
					From crsAvizeTemp Into Cursor crsAvizeTemp
		
				lcIdVanzare = cursor2lista("crsAvizeTemp", "id_vanzare", ",")
				lcNumar_Act = cursor2lista("crsAvizeTemp", "numar_act", ",")
			
				poDate.listaid = lcIdVanzare
				poDate.descriere = lcNumar_Act
				AddProperty(poDate,"id_comanda_aviz",0)
				Select crsAvizeTemp		
				Locate For Not Empty(ID_COMANDA)
				If Found()
					poDate.id_comanda_aviz=ID_COMANDA
				Endif
				Use In crsAvizeTemp
		
				This.ct_clb_altele.Refresh()
				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
					This.ct_clb_gestiune_init.SetFocus()
				Else
					Thisform.but_TERMIN1.SetFocus()
				Endif
			Endif
		Endif
	ENDPROC

	PROCEDURE do_cauta_client
		Local loCauta
		Do Case
			Case poDate.tip = 23
				loCauta = caut_gestiune_sursa([2,4,5,6,7])		&&	modificare v 2.0.71 : am adaugat 2
				If !Isnull(loCauta) And !Empty(loCauta.id_gestiune)
					poDate.id_client = loCauta.id_gestiune
					poDate.nume_client = loCauta.nume_gestiune
		
					poDate.listaid = []
					poDate.descriere = []
				Endif
			*!*	modificare	v 2.0.16
			Case poDate.tip = 41
				loCauta = caut_gestiune_sursa([2,4,5,6,7])
				If !Isnull(loCauta) And !Empty(loCauta.id_gestiune)
					poDate.id_client = loCauta.id_gestiune
					poDate.nume_client = loCauta.nume_gestiune
		
					poDate.listaid = []
					poDate.descriere = []
				Endif
			*!*	modificare	v 2.0.16	^
			Case poDate.tip = 25
				loCauta = caut_gestiune_dest()
				If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_gestiune,0))
					poDate.id_client = loCauta.id_gestiune
					poDate.nume_client = loCauta.nume_gestiune
		
					poDateGestiuneDest.id_gestiune = loCauta.id_gestiune
					poDateGestiuneDest.id_tipgest = loCauta.id_tipgest
					poDateGestiuneDest.Cont = Nvl(loCauta.Cont,[XXXX])
					poDateGestiuneDest.acont = Nvl(loCauta.acont,[XXXX])
		
					lcSql = [begin ] + gcS + [.pack_facturare.cauta_date_comanda_gest(?poDate.id_client,?gnIdSucursala,] + ;
						[?poDate.dataact,?@poDate.listaid,?@poDate.descriere); end;]
					lnSucces = goExecutor.oExecute(lcSql)
					If lnSucces < 0
						amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
						poDate.listaid = []
						poDate.descriere = []
					Endif
		
				Endif
			Otherwise
				&&	modificare v 2.0.93 : am adaugat 47
				loHash = GetHash([cTitlu=>Clienti??cCont=>]+Iif(INLIST(poDate.tip,42,47),[357],Iif(Inlist(poDate.tip,28,29),[461],Alltrim(gcCont411)))+[??lAdaugCorespondente=>1??lVerificaANAF=>1])
				loHash.SetValue('dDataDoc', Iif(Type('poDate.dataact') = 'D', poDate.dataact, {}))
				loCauta = CautPartenerContabilitate(loHash)
				If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
					poDate.id_client = loCauta.id_part
					poDate.nume_client = loCauta.denumire
		
					If Inlist(poDate.tip,21,28,42,47)			&&	modificare v 2.0.93 : am adaugat 47
						lcSql = [begin ] + gcS + [.pack_facturare.cauta_date_comanda(?poDate.id_client,?gnIdSucursala,] + ;
							[?poDate.dataact,?@poDate.listaid,?@poDate.descriere); end;]
						lnSucces = goExecutor.oExecute(lcSql)
						If lnSucces < 0
							amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
							poDate.listaid = []
							poDate.descriere = []
						Endif
					Else
						poDate.listaid = []
						poDate.descriere = []
					Endif
		
				Endif
		Endcase
		
		*!*	modificare v 2.0.70
		If Type('thisform.ct_clb_altele.visible')<>'U'
			This.ct_clb_altele.Refresh()
		Endif
		*!*	modificare v 2.0.70	^
		This.ct_clb_nume_client.Refresh()
		This.ct_clb_lucrare.SetFocus()
	ENDPROC

	PROCEDURE do_cauta_comanda
		Local loCauta
		If Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales " + Iif(poDate.tip = 25,[gestiunea destinatie],[clientul]) + " !",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
			If poDate.tip = 25
				loCauta = caut_comanda_gestiune(poDate.id_client)
			Else
				loCauta = caut_comanda_client(poDate.id_client)
			Endif
			If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_comanda,0))
				poDate.listaid = loCauta.id_comanda
				poDate.descriere = ALLTRIM(loCauta.nr_comanda)
				This.ct_clb_altele.Refresh()
				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
					This.ct_clb_gestiune_init.SetFocus()
				Else
					This.buT_TERMIN1.SetFocus()
				Endif
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_contract
		Local loCauta
		If Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales clientul!",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
		*!*	modificare v 2.0.67
		*!*		loCauta = caut_contract_facturare(poDate.id_client)
		*!*		If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_ctr,0))
		*!*			poDate.listaid = loCauta.id_ctr
		*!*			poDate.descriere = loCauta.contract
		*!*	*!*			If Inlist(loCauta.opt_facturare,3,4) And !Empty(loCauta.scadenta_incasare)
		*!*	*!*				poDate.datascad = poDate.dataact + loCauta.scadenta_incasare
		*!*	*!*				This.clb_data_scadenta.Refresh()
		*!*	*!*	*!*			Else
		*!*	*!*	*!*				poDate.datascad	= Iif(gnScadentaAutomata=0,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
		*!*	*!*			Endif
		*!*			This.ct_clb_altele.Refresh()
		*!*	*!*	modificare	v 2.0.41
		*!*			If Inlist(loCauta.opt_facturare,3,4)
		*!*				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'
		*!*					Thisform.ct_clb_gestiune_init.Visible = .T.
		*!*					Thisform.ct_clb_gestiune_init.SetFocus()
		*!*				Else
		*!*					Thisform.but_termin1.SetFocus()
		*!*				Endif
		*!*			Else
		*!*				poDate.id_gestiune_init = Null
		*!*				Thisform.cgestiune_init = []
		*!*	*!*				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'
		*!*	*!*					Thisform.ct_clb_gestiune_init.Refresh()
		*!*	*!*					Thisform.ct_clb_gestiune_init.Visible = .F.
		*!*	*!*				Endif
		*!*	*!*				Thisform.but_termin1.SetFocus()
		*!*				amessagebox("Acest contract este in rate si nu se poate emite aviz pentru el!",48,"Atentie")
		*!*			Endif
		*!*	*!*	modificare	v 2.0.41	^
		*!*	*!*			This.buT_TERMIN1.SetFocus()
		*!*		Endif
			lcXMLContracte = caut_contract_facturare(poDate.id_client,[3,4])
			If !Empty(lcXMLContracte) And gnButon = 1
				Xmltocursor(lcXMLContracte, "crsCtrTemp")
				poDate.listaid = cursor2lista("crsCtrTemp", "id_ctr", ",")
				poDate.descriere = cursor2lista("crsCtrTemp", "contract", ",")
				This.ct_clb_altele.Refresh()
				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'
					Thisform.ct_clb_gestiune_init.Visible = .T.
					Thisform.ct_clb_gestiune_init.SetFocus()
				Else
					Thisform.but_termin1.SetFocus()
				Endif
		*!*			Use In crsCtrTemp
			Endif
		*!*	modificare v 2.0.67	^
		Endif
	ENDPROC

	PROCEDURE do_cauta_fdoc
		Local loCauta
		loCauta = caut_fdoc()
		If !Isnull(loCauta) And !Empty(loCauta.fel_document)
			poDate.id_fdoc = loCauta.id_fdoc
			poDate.fdoc = loCauta.fel_document
		
			This.ct_clb_fdoc.Refresh()
			This.clb_dataact.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_gestiune_dest
		Local loCauta
		If Empty(NVL(poDate.id_client,0))
			amessagebox("Nu ati ales gestiunea " + Iif(poDate.tip = 41,"de la care se face returul!","sursa!") ,0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
			If poDate.tip = 41
				loCauta = caut_gestiune_dest(poDate.id_client,[2,4,5,6,7])	&&	modificare v 2.0.71 : am adaugat 2
			Else
				loCauta = caut_gestiune_dest(poDate.id_client)
			Endif
			If !Isnull(loCauta) And !Empty(NVL(loCauta.id_gestiune,0))
				poDate.listaid = loCauta.id_gestiune
				poDate.descriere = loCauta.nume_gestiune
		
				poDateGestiuneDest.id_gestiune = loCauta.id_gestiune
				poDateGestiuneDest.id_tipgest = loCauta.id_tipgest
				poDateGestiuneDest.Cont = Nvl(loCauta.Cont,[XXXX])
				poDateGestiuneDest.acont = Nvl(loCauta.acont,[XXXX])
		
				This.ct_clb_altele.Refresh()
				This.ct_clb_politici_preturi.SetFocus()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_gestiune_init
		loCauta = caut_gestiune(0,gnIdUtil)
		If !Isnull(loCauta) And !Empty(loCauta.id_gestiune)
			poDate.id_gestiune_init = loCauta.id_gestiune
			Thisform.cgestiune_init = loCauta.nume_gestiune
		Else
			poDate.id_gestiune_init = Null
			Thisform.cgestiune_init = []
		Endif
		This.ct_clb_gestiune_init.Refresh()
		This.buT_TERMIN1.SetFocus()
	ENDPROC

	PROCEDURE do_cauta_lucrare
		Local loCauta
		LOCAL llToateIreg, llNou, lcFiltruOriginal
		llToateIreg = .F.
		llNou = .T.
		lcFiltruOriginal = ''
		
		loCauta = caut_lucrare(m.llToateIreg, m.llNou, m.lcFiltruOriginal)
		
		If !Empty(Nvl(loCauta.id_lucrare,0))
			poDate.id_lucrare = loCauta.id_lucrare
			poDate.nrord = loCauta.nrord
		Else
			poDate.id_lucrare = Null
			poDate.nrord = []
		Endif
		This.ct_clb_lucrare.Refresh()
		This.ct_clb_sectie.SetFocus()
		
	ENDPROC

	PROCEDURE do_cauta_politica
		Local loCauta
		loCauta = caut_politici_curente_util()
		If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_pol,0))
			poDate.id_pol = loCauta.id_pol
			poDate.nume_politica = loCauta.nume
		
			This.ct_clb_politici_preturi.SetFocus()
			If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
				This.ct_clb_gestiune_init.SetFocus()
			Else
				This.buT_TERMIN1.SetFocus()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_responsabil
		Local loCauta
		loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Responsabili??cTipuriParteneri=>]+Alltrim(Str(gnIdTipResponsabili))+[??lAdaugCorespondente=>1]))
		If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
			poDate.id_responsabil = loCauta.id_part
			poDate.responsabil = loCauta.denumire
		Else
			poDate.id_responsabil = Null
			poDate.responsabil = []
		Endif
		This.ct_clb_responsabil.Refresh()
		Do Case
		Case Type('Thisform.ct_clb_altele.visible')<>'U'
			This.ct_clb_altele.SetFocus()
		Case Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
			This.ct_clb_gestiune_init.SetFocus()
		Otherwise
			This.buT_TERMIN1.SetFocus()
		Endcase
		
	ENDPROC

	PROCEDURE do_cauta_sectie
		Local loCauta
		LOCAL lnPornire, llDesktop, llToateIreg, llNou, lcFiltruOriginal
		lnPornire = 0
		llDesktop = .F.
		llToateIreg = .F.
		llNou = .T.
		lcFiltruOriginal = ''
		
		loCauta = caut_sectie(lnPornire, llDesktop, m.llToateIreg, m.llNou, m.lcFiltruOriginal)
		If !Empty(Nvl(loCauta.id_sectie,0))
			poDate.id_sectie = loCauta.id_sectie
			poDate.sectie = loCauta.sectie
		Else
			poDate.id_sectie = Null
			poDate.sectie = []
		Endif
		This.ct_clb_sectie.Refresh()
		
		Do Case
		*!*	modificare	v 2.0.46
		Case Type('thisform.ct_clb_venchelt.Visible')<>'U'
			This.ct_clb_venchelt.SetFocus()
		*!*	modificare	v 2.0.46	^
		Case Type('thisform.ct_clb_responsabil.visible') <> 'U'
			This.ct_clb_responsabil.SetFocus()
		Case Type('thisform.ct_clb_altele.visible') <> 'U'
			This.ct_clb_altele.Refresh()
			This.ct_clb_altele.SetFocus()
		Case Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
			This.ct_clb_gestiune_init.SetFocus()
		Otherwise
			This.buT_TERMIN1.SetFocus()
		Endcase
	ENDPROC

	PROCEDURE do_cauta_venchelt
		*!*	modificare	v 2.0.46
		Local loCauta
		LOCAL lnPornire, llDesktop, lnTip, lnId, llToateIreg, llNou, lcFiltruOriginal
		lnPornire = 0
		llDesktop = .F.
		lnTip = 2 && venituri
		lnId = 0
		llToateIreg = .F.
		llNou = .T.
		lcFiltruOriginal = ''
		loCauta = caut_venchelt(m.lnPornire, m.llDesktop, m.lnTip, m.lnId, m.llToateIreg, m.llNou, m.lcFiltruOriginal)
		
		If gnButon = 1
			poDate.id_venchelt = loCauta.id_venchelt
			poDate.venchelt = loCauta.explicatie
		Else
			poDate.id_venchelt = Null
			poDate.venchelt = []
		Endif
		This.ct_clb_venchelt.Refresh()
		Do Case
		Case Type('thisform.ct_clb_responsabil.visible') <> 'U'
			This.ct_clb_responsabil.SetFocus()
		Case Type('thisform.ct_clb_altele.visible') <> 'U'
			This.ct_clb_altele.Refresh()
			This.ct_clb_altele.SetFocus()
		Case Type('Thisform.ct_clb_gestiune_init.visible')<>'U'
			This.ct_clb_gestiune_init.SetFocus()
		Otherwise
			This.buT_TERMIN1.SetFocus()
		EndCase
		*!*	modificare	v 2.0.46	^
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local plReturn,lcFacturi_dublate, llCopiere
		Store .T. To plReturn
		llCopiere = This.lCopiere && copiere factura/aviz
		
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		
		Do Case
		Case Empty(poDate.dataireg)
			amessagebox("Nu ati completat data inregistrarii!",48,"Atentie")
			This.clb_dataireg.SetFocus()
			plReturn = .F.
		Case Empty(poDate.dataact)
			amessagebox("Nu ati completat data documentului!",48,"Atentie")
			This.clb_dataact.SetFocus()
			plReturn = .F.
		Case Isnull(poDate.id_fdoc) Or Empty(poDate.id_fdoc)
			amessagebox("Nu ati ales felul documentului!",48,"Atentie")
			This.ct_clb_fdoc.SetFocus()
			plReturn = .F.
		Case Empty(poDate.nract)
			amessagebox("Nu ati completat numarul documentului!",48,"Atentie")
			This.clb_nract.SetFocus()
			plReturn = .F.
		Case !Between(poDate.dataireg,Date(gnAn,gnLuna,1),Gomonth(Date(gnAn,gnLuna,1),1)-1)
			amessagebox("Data inregistrarii trebuie sa fie din luna "+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))+" !",48,"Atentie")
			This.clb_dataireg.SetFocus()
			plReturn = .F.
		Case poDate.dataact>poDate.dataireg
			amessagebox("Data documentului trebuie sa fie mai mica sau egala cu data inregistrarii!",48,"Atentie")
			This.clb_dataact.SetFocus()
			plReturn = .F.
		Case Empty(Nvl(poDate.descriere,[])) And m.llCopiere
			amessagebox("Nu ati ales avizul de copiat!",48,"Atentie")
			This.ct_clb_altele.SetFocus()
			plReturn = .F.	
			
		Case Empty(Nvl(poDate.listaid,[])) And Inlist(poDate.tip,21,23,25,26,28,41,42,47)			&&	modificare v 2.0.93 : am adaugat 47
			Do Case
			Case INLIST(poDate.tip,21,25,28,42,47)					&&	modificare v 2.0.93 : am adaugat 47
				lcMesaj = [Nu ati ales comanda!]
			Case poDate.tip = 23
				lcMesaj = [Nu ati ales gestiunea destinatie!]
		*!*	modificare	v 2.0.16
			Case poDate.tip = 41
				lcMesaj = [Nu ati ales gestiunea catre care se face returul!]
		*!*	modificare	v 2.0.16	^
			Case poDate.tip = 26
				lcMesaj = [Nu ati ales contractul!]
			Endcase
			amessagebox(lcMesaj,48,"Atentie")
			This.ct_clb_altele.SetFocus()
			plReturn = .F.
		Case Empty(Nvl(poDate.id_pol,0)) And InList(poDate.tip,23,41)
			amessagebox("Nu ati ales politica de preturi!",48,"Atentie")
			This.ct_clb_politici_preturi.SetFocus()
			plReturn = .F.
		Otherwise
		*!*	modificare	v 2.0.46
		*!*		plReturn = .T.
			lcFacturi_dublate = facturi_duplicate('418', 0, poDate.serie_act, poDate.nract, [])
			If !Empty(lcFacturi_dublate)
				lnRaspuns = aMESSAGEBOX(lcFacturi_dublate + Chr(13)+"Doriti sa continuati?",4+32,"Avize dublate")
				If lnRaspuns = 7
					plReturn = .F.
				Endif
			EndIf
		*!*	modificare	v 2.0.46	^
		Endcase
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		Lparameters toFactura
		* toFactura (optional): factura/avizul sursa care se copie
		
		*!*	Valori posibile pentru poDate.tip	:
		*!*		21	-	Aviz catre client pe baza de comanda
		*!*		22	-	Aviz catre client pe baza de lista de preturi
		*!*		23	-	Transfer intre subunitati pe baza de lista de preturi
		*!*		57	- 	Aviz retur
		*!*		25  -   Transfer intre subunitati pe baza de comanda
		*!*		28	-	Aviz catre client debitor pe baza de comanda
		*!*		29	-	Aviz catre client debitor pe baza de lista de preturi
		*!*		41	-	Retur transfer
		*!*		42	-	Aviz catre clienti in custodie pe baza de comanda ( ptr. facturare )
		*!*		47	-	Aviz catre clienti in custodie pe baza de comanda ( ptr. descarcare cu K )
		LOCAL lcTitluFormular, llCopiere
		
		This.lCopiere = (TYPE('toFactura') = 'O') && copiere factura
		llCopiere = This.lCopiere
		
		lnObiecte = 14
		DIMENSION laPozitii(lnObiecte,3)
		*!*		1	-	inaltime
		*!*		2	-	sters
		*!*		3	-	tip	(	1	=	ct_clb_...,	2	=	clb_... )
		DODEFAULT()
		WITH THIS
			*!*	modificare v 2.0.16
			IF poDate.tip = 41
				lcTitluFormular = [RETUR TRANSFER]
			ELSE
				lcTitluFormular = .lb_TITLU_ALB_B121.CAPTION
			ENDIF
			*!*	modificare v 2.0.16	^
			*!*	stochez inaltimea fiecarui container
			*!* containerele trebuie sa aiba TabIndex completat in ordinea in care sunt pe formular
		
			lnOffsetTip1 = .ct_clb_fdoc.HEIGHT - .ct_clb_fdoc.clb_TX_CAUTARE.HEIGHT + 1
			lnOffsetTip2 = 1
		
			FOR i = 1 TO .OBJECTS.COUNT
				WITH .OBJECTS(i)
					IF 'ct_clb_'$LOWER(.NAME) OR 'clb_'$LOWER(.NAME)
						laPozitii(.TABINDEX,1) = .HEIGHT
						laPozitii(.TABINDEX,2) = 0
						laPozitii(.TABINDEX,3) = IIF('ct_clb_'$LOWER(.NAME),1,2)
					ENDIF
				ENDWITH
			ENDFOR
		
			lnHeight = .HEIGHT
			.nid_tip=poDate.tip
			DO CASE
				CASE gnScadereStoc=0 AND poDate.tip = 22
					lnHeight = lnHeight - .ct_clb_responsabil.HEIGHT - .ct_clb_politici_preturi.HEIGHT - .ct_clb_gestiune_init.HEIGHT
					laPozitii(.ct_clb_responsabil.TABINDEX,2)=1
					laPozitii(.ct_clb_gestiune_init.TABINDEX,2)=1
					laPozitii(.ct_clb_politici_preturi.TABINDEX,2)=1
					.REMOVEOBJECT('ct_clb_responsabil')
					.REMOVEOBJECT('ct_clb_gestiune_init')
					.REMOVEOBJECT('ct_clb_politici_preturi')
		
					IF m.llCopiere
						.ct_clb_altele.do_schimba_explicatia([Nr. factura])			
					ELSE
						lnHeight = lnHeight- .ct_clb_altele.Height
						laPozitii(.ct_clb_altele.TabIndex, 2) = 1
						.RemoveObject('ct_clb_altele')			
					ENDIF 	
					
				CASE gnScadereStoc=0 AND INLIST(poDate.tip,21,23,25,26,28,41,42,47, 24)		&&	modificare v 2.0.93 : am adaugat 47
					WITH .ct_clb_altele
						DO CASE
							CASE INLIST(poDate.tip,21,28,42,47)								&&	modificare v 2.0.93 : am adaugat 47
								.do_schimba_explicatia([Nr. comanda])
								laPozitii(THISFORM.ct_clb_politici_preturi.TABINDEX,2)=1
								lnHeight = lnHeight - THISFORM.ct_clb_politici_preturi.HEIGHT
								THISFORM.REMOVEOBJECT('ct_clb_politici_preturi')
							CASE poDate.tip = 23
								THIS.ct_clb_nume_client.do_schimba_explicatia([Gestiune sursa])
								.do_schimba_explicatia([Gestiune destinatie])
								*!*					This.ct_clb_politici_preturi.Top = .Top
								*!*					This.Height = 300
								*!*	modificare	v 2.0.46
								lnHeight = lnHeight - THISFORM.ct_clb_venchelt.HEIGHT
								laPozitii(THISFORM.ct_clb_venchelt.TABINDEX,2)=1
								THISFORM.REMOVEOBJECT('ct_clb_venchelt')
								*!*	modificare	v 2.0.46	^
								*!*	modificare	v 2.0.16
							CASE poDate.tip = 41
								THIS.ct_clb_nume_client.do_schimba_explicatia([Retur de la])
								.do_schimba_explicatia([Retur la])
								*!*	modificare	v 2.0.16	^
								*!*	modificare	v 2.0.46
								lnHeight = lnHeight - THISFORM.ct_clb_venchelt.HEIGHT
								laPozitii(THISFORM.ct_clb_venchelt.TABINDEX,2)=1
								THISFORM.REMOVEOBJECT('ct_clb_venchelt')
								*!*	modificare	v 2.0.46	^
							CASE poDate.tip = 25
								.do_schimba_explicatia([Nr. comanda])
								THIS.ct_clb_nume_client.do_schimba_explicatia([Gestiune destinatie])
								laPozitii(THISFORM.ct_clb_politici_preturi.TABINDEX,2)=1
								lnHeight = lnHeight - THISFORM.ct_clb_politici_preturi.HEIGHT
								THISFORM.REMOVEOBJECT('ct_clb_politici_preturi')
								*!*	modificare	v 2.0.46
								lnHeight = lnHeight - THISFORM.ct_clb_venchelt.HEIGHT
								laPozitii(THISFORM.ct_clb_venchelt.TABINDEX,2)=1
								THISFORM.REMOVEOBJECT('ct_clb_venchelt')
								*!*	modificare	v 2.0.46	^
							CASE poDate.tip = 26
								.do_schimba_explicatia([Nr. contract])
								laPozitii(THISFORM.ct_clb_politici_preturi.TABINDEX,2)=1
								lnHeight = lnHeight - THISFORM.ct_clb_politici_preturi.HEIGHT
								THISFORM.REMOVEOBJECT('ct_clb_politici_preturi')
		
							CASE poDate.tip = 24
								.do_schimba_explicatia([Nr. avize])
								laPozitii(THISFORM.ct_clb_politici_preturi.TABINDEX,2)=1
								lnHeight = lnHeight - THISFORM.ct_clb_politici_preturi.HEIGHT
								THISFORM.REMOVEOBJECT('ct_clb_politici_preturi')
						ENDCASE
					ENDWITH
					laPozitii(.ct_clb_responsabil.TABINDEX,2)=1
					laPozitii(.ct_clb_gestiune_init.TABINDEX,2)=1
					lnHeight = lnHeight - .ct_clb_responsabil.HEIGHT - .ct_clb_gestiune_init.HEIGHT
					.REMOVEOBJECT('ct_clb_responsabil')
					.REMOVEOBJECT('ct_clb_gestiune_init')
				CASE gnScadereStoc=1 AND INLIST(poDate.tip,21,23,25,26,28,41,42,47,24)			&&	modificare v 2.0.93 : am adaugat 47
					WITH .ct_clb_altele
						DO CASE
							CASE INLIST(poDate.tip,21,28,42,47)									&&	modificare v 2.0.93 : am adaugat 47
								.do_schimba_explicatia([Nr. comanda])
								laPozitii(THISFORM.ct_clb_politici_preturi.TABINDEX,2)=1
								lnHeight = lnHeight - THISFORM.ct_clb_politici_preturi.HEIGHT
								THISFORM.REMOVEOBJECT('ct_clb_politici_preturi')
							CASE poDate.tip = 23
								THISFORM.ct_clb_nume_client.do_schimba_explicatia([Gestiune sursa])
								.do_schimba_explicatia([Gestiune destinatie])
								*!*	modificare	v 2.0.46
								lnHeight = lnHeight - THISFORM.ct_clb_venchelt.HEIGHT
								laPozitii(THISFORM.ct_clb_venchelt.TABINDEX,2)=1
								THISFORM.REMOVEOBJECT('ct_clb_venchelt')
								*!*	modificare	v 2.0.46	^
								*!*	modificare	v 2.0.16
							CASE poDate.tip = 41
								THIS.ct_clb_nume_client.do_schimba_explicatia([Retur de la])
								.do_schimba_explicatia([Retur la])
								*!*	modificare	v 2.0.16	^
								*!*	modificare	v 2.0.46
								lnHeight = lnHeight - THISFORM.ct_clb_venchelt.HEIGHT
								laPozitii(THISFORM.ct_clb_venchelt.TABINDEX,2)=1
								THISFORM.REMOVEOBJECT('ct_clb_venchelt')
								*!*	modificare	v 2.0.46	^
							CASE poDate.tip = 25
								.do_schimba_explicatia([Nr. comanda])
								THISFORM.ct_clb_nume_client.do_schimba_explicatia([Gestiune destinatie])
								laPozitii(THISFORM.ct_clb_politici_preturi.TABINDEX,2)=1
								lnHeight = lnHeight - THISFORM.ct_clb_politici_preturi.HEIGHT
								THISFORM.REMOVEOBJECT('ct_clb_politici_preturi')
								*!*	modificare	v 2.0.46
								lnHeight = lnHeight - THISFORM.ct_clb_venchelt.HEIGHT
								laPozitii(THISFORM.ct_clb_venchelt.TABINDEX,2)=1
								THISFORM.REMOVEOBJECT('ct_clb_venchelt')
								*!*	modificare	v 2.0.46	^
							CASE poDate.tip = 26
								.do_schimba_explicatia([Nr. contract])
								laPozitii(THISFORM.ct_clb_politici_preturi.TABINDEX,2)=1
								lnHeight = lnHeight - THISFORM.ct_clb_politici_preturi.HEIGHT
								THISFORM.REMOVEOBJECT('ct_clb_politici_preturi')
							CASE poDate.tip = 24 && aviz retur
								.do_schimba_explicatia([Nr. avize])
								laPozitii(THISFORM.ct_clb_politici_preturi.TABINDEX,2)=1
								lnHeight = lnHeight - THISFORM.ct_clb_politici_preturi.HEIGHT
								THISFORM.REMOVEOBJECT('ct_clb_politici_preturi')
						ENDCASE
					ENDWITH
					*!*	modificare v 2.0.41
					*!*	la restul pot sa aleg deja gestiunea sursa
					IF !INLIST(poDate.tip,21,25,26,28,42,47)				&&	modificare v 2.0.93 : am adaugat 47
						laPozitii(THISFORM.ct_clb_gestiune_init.TABINDEX,2)=1
						lnHeight = lnHeight - THISFORM.ct_clb_gestiune_init.HEIGHT
						THISFORM.REMOVEOBJECT('ct_clb_gestiune_init')
					ENDIF
					*!*	modificare v 2.0.41	^
				OTHERWISE
					*!*	modificare v 2.0.41
					*!*	la restul pot sa aleg deja gestiunea sursa
					IF !INLIST(poDate.tip,22,29)
						laPozitii(THISFORM.ct_clb_gestiune_init.TABINDEX,2)=1
						lnHeight = lnHeight - THISFORM.ct_clb_gestiune_init.HEIGHT
						THISFORM.REMOVEOBJECT('ct_clb_gestiune_init')
					ENDIF
					*!*	modificare v 2.0.41	^
					laPozitii(.ct_clb_politici_preturi.TABINDEX,2)=1
					lnHeight = lnHeight - .ct_clb_politici_preturi.HEIGHT
					.REMOVEOBJECT('ct_clb_politici_preturi')
					IF m.llCopiere
						.ct_clb_altele.do_schimba_explicatia([Nr. aviz])			
					ELSE
						lnHeight = lnHeight- .ct_clb_altele.Height
						laPozitii(.ct_clb_altele.TabIndex, 2) = 1
						.RemoveObject('ct_clb_altele')			
					ENDIF 	
					
			ENDCASE
		
			IF INLIST(poDate.rezultat_serii,1,3)
				.clb_serie_act.do_initializeaza(poDate.rezultat_serii)
				*!*	modificare	v 2.0.46
				*!*			.clb_serie_act.SetFocus()
				IF !EMPTY(poDate.nract)
					.clb_nract.SETFOCUS()
				ELSE
					.clb_serie_act.SETFOCUS()
				ENDIF
				*!*	modificare	v 2.0.46	^
			ELSE
				lnHeight = lnHeight - .clb_serie_act.HEIGHT
				laPozitii(.clb_serie_act.TABINDEX,2)=1
				.REMOVEOBJECT('clb_serie_act')
				.clb_nract.SETFOCUS()
			ENDIF
		
			*!*	modificare v 2.0.16
			.lb_TITLU_ALB_B121.CAPTION = lcTitluFormular
			*!*	modificare v 2.0.16		^
			.HEIGHT = lnHeight
		
			*!*	rearanjare containere
			FOR i = 1 TO lnObiecte
				IF laPozitii(i,2) = 1
					FOR j = 1 TO .OBJECTS.COUNT
						WITH .OBJECTS(j)
							IF ('ct_clb_'$LOWER(.NAME) OR 'clb_'$LOWER(.NAME)) AND .TABINDEX > i
								.TOP = .TOP - laPozitii(i,1) + IIF(laPozitii(i,3)=1,lnOffsetTip1,lnOffsetTip2)
							ENDIF
						ENDWITH
					ENDFOR
				ENDIF
			ENDFOR
		
			.AUTOCENTER = .T.
			.REFRESH()
		ENDWITH
		RELEASE laPozitii
		
	ENDPROC

	PROCEDURE Clb_dataact.Text_simplu1.LostFocus
		poDate.zi_curs = poDate.dataact
		Thisform.clb_zi_curs.Refresh()
	ENDPROC

	PROCEDURE Clb_dataireg.Text_simplu1.LostFocus
		poDate.dataact = poDate.dataireg
		Thisform.clb_dataact.Refresh()
		poDate.zi_curs = poDate.dataact
		Thisform.clb_zi_curs.Refresh()
	ENDPROC

	PROCEDURE Clb_nract.Text_simplu1.LostFocus
		poDate.nract = this.value
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_date_aviz_lucrare 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="Ct_clb_fdoc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_responsabil" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_lucrare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_gestiune" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nract" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie_act" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_furnizor" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nrfactachi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_altele" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_dataireg" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_zi_curs" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_dataact" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_altele
		*m: do_cauta_fdoc
		*m: do_cauta_furnizor
		*m: do_cauta_gestiune
		*m: do_cauta_gestiune_dest
		*m: do_cauta_lucrare
		*m: do_cauta_responsabil
		*m: do_cauta_sectie
		*p: nid
		*p: nid_tip
		*p: ntip
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 428
		Name = "frm_date_aviz_lucrare"
		nid_tip = 0
		ntip = 0
		Width = 383
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 384
		_shape2.Height = 29
		_shape2.Left = 322
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		Lb_titlu_alb_b121.Caption = "AVIZ PE BAZĂ DE LUCRARE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 16
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 354
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 14
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		Gridsort1.Left = 360
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 35
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Height = 27, ;
		Left = 324, ;
		Name = "But_renunt1", ;
		TabIndex = 15, ;
		Top = 1, ;
		Width = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Clb_dataact' AS clb_tx_data WITH ;
		Comment = "1", ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_dataact", ;
		TabIndex = 3, ;
		Top = 104, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.dataact", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Data documentului", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_dataireg' AS clb_tx_data WITH ;
		Comment = "1", ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_dataireg", ;
		TabIndex = 1, ;
		Top = 48, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.dataireg", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Dată înregistrare", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_nract' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_nract", ;
		TabIndex = 6, ;
		Top = 188, ;
		Width = 314, ;
		TEXT_SIMPLU1.ControlSource = "poDate.nract", ;
		TEXT_SIMPLU1.InputMask = (get_mask(14,0)), ;
		TEXT_SIMPLU1.Left = 126, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		Lb_simplu1.Caption = "Nr. documentului", ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_nrfactachi' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_nrfactachi", ;
		TabIndex = 13, ;
		Top = 384, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.nrfactachi", ;
		Text_simplu1.InputMask = (get_mask(14,0)), ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Lb_simplu1.Caption = "Nr. factură achiziție", ;
		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_act' AS clb_serie_act WITH ;
		cvariabila = serie_act, ;
		cvariabiladoc = nract, ;
		Left = 25, ;
		Name = "Clb_serie_act", ;
		nid_tipdoc = 6, ;
		pcobj = poDate, ;
		TabIndex = 5, ;
		Top = 160, ;
		TEXT_SIMPLU1.ControlSource = "poDate.serie_act", ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		_CBBASE1.Name = "_CBBASE1", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="serii_numere.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_zi_curs' AS clb_tx_data WITH ;
		Comment = "1", ;
		Height = 29, ;
		Left = 25, ;
		Name = "Clb_zi_curs", ;
		TabIndex = 4, ;
		Top = 132, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.zi_curs", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Data cursului valutar", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_altele' AS ct_clb_cautare WITH ;
		cconditie = ISNULL(poDate.listaid) or EMPTY(poDate.listaid), ;
		cprocedura = thisform.do_cauta_altele, ;
		cvar_afisata = poDate.descriere, ;
		Left = 24, ;
		Name = "Ct_clb_altele", ;
		TabIndex = 11, ;
		Top = 327, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Gestiune destinație", ;
		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_fdoc' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(poDate.id_fdoc) or ISNULL(poDate.id_fdoc), ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = poDate.fdoc, ;
		Left = 24, ;
		Name = "Ct_clb_fdoc", ;
		TabIndex = 2, ;
		Top = 75, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Felul documentului", ;
		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_furnizor' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_furnizor,0)), ;
		cprocedura = thisform.do_cauta_furnizor, ;
		cvar_afisata = poDate.furnizor, ;
		Left = 24, ;
		Name = "Ct_clb_furnizor", ;
		TabIndex = 12, ;
		Top = 355, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Furnizor", ;
		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_gestiune' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_client,0)), ;
		cprocedura = thisform.do_cauta_gestiune, ;
		cvar_afisata = poDate.nume_client, ;
		Left = 24, ;
		Name = "Ct_clb_gestiune", ;
		TabIndex = 7, ;
		Top = 215, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Gestiune sursă", ;
		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_lucrare' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_lucrare,0)), ;
		cprocedura = thisform.do_cauta_lucrare, ;
		cvar_afisata = poDate.nrord, ;
		Left = 24, ;
		Name = "Ct_clb_lucrare", ;
		TabIndex = 8, ;
		Top = 243, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Lucrare", ;
		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_responsabil' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_responsabil,0)), ;
		cprocedura = thisform.do_cauta_responsabil, ;
		cvar_afisata = poDate.responsabil, ;
		Left = 24, ;
		Name = "Ct_clb_responsabil", ;
		TabIndex = 10, ;
		Top = 299, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Responsabil", ;
		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_sectie' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_sectie,0)), ;
		cprocedura = thisform.do_cauta_sectie, ;
		cvar_afisata = poDate.sectie, ;
		Left = 24, ;
		Name = "Ct_clb_sectie", ;
		TabIndex = 9, ;
		Top = 271, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Secție", ;
		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" />
	
	PROCEDURE do_cauta_altele
		Do Case
		Case Thisform.nid_tip = 30
			Thisform.do_cauta_gestiune_dest()
		Endcase
		
	ENDPROC

	PROCEDURE do_cauta_fdoc
		Local loCauta
		loCauta = caut_fdoc()
		If !Isnull(loCauta) And !Empty(loCauta.fel_document)
			poDate.id_fdoc = loCauta.id_fdoc
			poDate.fdoc = loCauta.fel_document
		
			This.ct_clb_fdoc.Refresh()
			This.clb_dataact.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_furnizor
		Local loCauta
		*!*	loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Alegeti furnizorul??cCont=>401??lAdaugCorespondente=>1]))
		loHash = GetHash([cTitlu=>Alegeti furnizorul??cCont=>401??lVerificaANAF=>1])
		loHash.SetValue('dDataDoc', Iif(Type('poDate.dataact') = 'D', poDate.dataact, {}))
		loCauta = CautPartenerContabilitate(loHash)
		If !Empty(loCauta.id_part) And !Empty(loCauta.denumire) AND !ISNULL(loCauta.id_part)
			poDate.id_furnizor = loCauta.id_part
			poDate.furnizor = Alltrim(loCauta.denumire)
		
		Endif
		
		Thisform.ct_clb_furnizor.Refresh()
		
	ENDPROC

	PROCEDURE do_cauta_gestiune
		Local loCauta
		*!* 09.06.2008
		*!* se pot alege si gestiuni sursa la pret de vanzare (transfer de la pret de vz la pret de vz)
		*!*	modificare v 2.0.71
		*!*	loCauta = caut_gestiune_sursa([4,5,6,7])
		If Thisform.nid_tip = 30
			loCauta = caut_gestiune_sursa([6,7])
		Else
			loCauta = caut_gestiune_sursa([4,5,6,7])
		Endif
		*!*	modificare v 2.0.71	^
		*!* 09.06.2008 ^
		If !Isnull(loCauta) And !Empty(loCauta.id_gestiune)
			poDate.id_client = loCauta.id_gestiune
			poDate.nume_client = loCauta.nume_gestiune
			This.ct_clb_gestiune.Refresh()	
		EndIf
		This.ct_clb_lucrare.setfocus()
		
	ENDPROC

	PROCEDURE do_cauta_gestiune_dest
		Local loCauta
		If Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales gestiunea sursa!",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
		*!*	modificare v 2.0.71
		*!*		loCauta = caut_gestiune_dest(poDate.id_client)
			If Thisform.nid_tip = 30
				loCauta = caut_gestiune_dest(poDate.id_client,[6,7])
			Else
				loCauta = caut_gestiune_dest(poDate.id_client)
			Endif
		*!*	modificare v 2.0.71	^
			If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_gestiune,0))
				poDate.listaid = loCauta.id_gestiune
				poDate.descriere = loCauta.nume_gestiune
		
				poDateGestiuneDest.id_gestiune = loCauta.id_gestiune
				poDateGestiuneDest.id_tipgest = loCauta.id_tipgest
				poDateGestiuneDest.Cont = Nvl(loCauta.Cont,[XXXX])
				poDateGestiuneDest.acont = Nvl(loCauta.acont,[XXXX])
		
				This.ct_clb_altele.Refresh()
				This.ct_clb_furnizor.SetFocus()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_lucrare
		Local loCauta
		LOCAL llToateIreg, llNou, lcFiltruOriginal
		llToateIreg = .F.
		llNou = .T.
		lcFiltruOriginal = ''
		
		loCauta = caut_lucrare(m.llToateIreg, m.llNou, m.lcFiltruOriginal)
		
		If !Empty(Nvl(loCauta.id_lucrare,0))
			poDate.id_lucrare = loCauta.id_lucrare
			poDate.nrord = loCauta.nrord
		
			This.ct_clb_lucrare.Refresh()
		Endif
		This.ct_clb_sectie.SetFocus()
		
	ENDPROC

	PROCEDURE do_cauta_responsabil
		Local loCauta
		loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Responsabili??cTipuriParteneri=>]+Alltrim(Str(gnIdTipResponsabili))+[??lAdaugCorespondente=>1]))
		If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
			poDate.id_responsabil = loCauta.id_part
			poDate.responsabil = loCauta.denumire
		
			This.ct_clb_responsabil.Refresh()
		Endif
		This.buT_TERMIN1.SetFocus()
		
	ENDPROC

	PROCEDURE do_cauta_sectie
		Local loCauta
		LOCAL lnPornire, llDesktop, llToateIreg, llNou, lcFiltruOriginal
		lnPornire = 0
		llDesktop = .F.
		llToateIreg = .F.
		llNou = .T.
		lcFiltruOriginal = ''
		
		loCauta = caut_sectie(lnPornire, llDesktop, m.llToateIreg, m.llNou, m.lcFiltruOriginal)
		
		If !Empty(Nvl(loCauta.id_sectie,0))
			poDate.id_sectie = loCauta.id_sectie
			poDate.sectie = loCauta.sectie
		
			This.ct_clb_sectie.Refresh()
		Endif
		This.ct_clb_responsabil.SetFocus()
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local plReturn
		Store .T. To plReturn
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		
		Do Case
		Case Empty(poDate.dataireg)
			amessagebox("Nu ati completat data inregistrarii!",48,"Atentie")
			This.clb_dataireg.SetFocus()
			plReturn = .F.
		Case Empty(poDate.dataact)
			amessagebox("Nu ati completat data documentului!",48,"Atentie")
			This.clb_dataact.SetFocus()
			plReturn = .F.
		Case Empty(Nvl(poDate.id_fdoc,0))
			amessagebox("Nu ati ales felul documentului!",48,"Atentie")
			This.ct_clb_fdoc.SetFocus()
			plReturn = .F.
		Case Empty(Nvl(poDate.zi_curs,{}))
			amessagebox("Nu ati completat ziua cursului valutar!",48,"Atentie")
			This.clb_zi_curs.SetFocus()
			plReturn = .F.
		Case Empty(poDate.nract)
			amessagebox("Nu ati completat numarul documentului!",48,"Atentie")
			This.clb_nract.SetFocus()
			plReturn = .F.
		Case !Between(poDate.dataireg,Date(gnAn,gnLuna,1),Gomonth(Date(gnAn,gnLuna,1),1)-1)
			amessagebox("Data inregistrarii trebuie sa fie din luna "+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))+" !",48,"Atentie")
			This.clb_dataireg.SetFocus()
			plReturn = .F.
		Case poDate.dataact>poDate.dataireg
			amessagebox("Data documentului trebuie sa fie mai mica sau egala cu data inregistrarii!",48,"Atentie")
			This.clb_dataact.SetFocus()
			plReturn = .F.
		Case Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales gestiunea sursa!",0+48,"Atentie")
			This.ct_clb_gestiune.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.90
		Case Empty(Nvl(poDate.listaid,0)) And This.nTip = 30
			amessagebox("Nu ati ales gestiunea destinatie!",0+48,"Atentie")
			This.ct_clb_altele.SetFocus()
			plReturn = .F.
		Case Empty(Nvl(poDate.id_furnizor,0)) And This.nTip = 30
			amessagebox("Nu ati ales furnizorul!",0+48,"Atentie")
			This.ct_clb_furnizor.SetFocus()
			plReturn = .F.
		Case Empty(Nvl(poDate.nrfactachi,0)) And This.nTip = 30
			amessagebox("Nu ati completat numarul facturii de achizitie!",0+48,"Atentie")
			This.clb_nrfactachi.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.90	^
		Case (Empty(Nvl(poDate.id_lucrare,0)) and this.ntip <> 30)
			amessagebox("Nu ati ales lucrarea!",0+48,"Atentie")
			This.ct_clb_lucrare.SetFocus()
			plReturn = .F.
		Otherwise
			plReturn = .T.
		Endcase
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		DoDefault()
		With Thisform
			lnObiecte = 13
			Dimension laPozitii(lnObiecte,3)
			*!*	stochez inaltimea fiecarui container
			*!* containerele trebuie sa aiba TabIndex completat in ordinea in care sunt pe formular
			lnOffsetTip1 = .ct_clb_fdoc.Height - .ct_clb_fdoc.clb_TX_CAUTARE.Height + 1
			lnOffsetTip2 = 1
		
			For i = 1 To .Objects.Count
				With .Objects(i)
					If 'ct_clb_'$Lower(.Name) Or 'clb_'$Lower(.Name)
						laPozitii(.TabIndex,1) = .Height
						laPozitii(.TabIndex,2) = 0
						laPozitii(.TabIndex,3) = Iif('ct_clb_'$Lower(.Name),1,2)
					Endif
				Endwith
			Endfor
			lnHeight = .Height
			.nid_tip=poDate.tip
			
			If Inlist(poDate.rezultat_serii,1,3)
				.clb_serie_act.do_initializeaza(poDate.rezultat_serii)
				.clb_serie_act.SetFocus()
			Else
				lnHeight = lnHeight - .clb_serie_act.Height
				laPozitii(.clb_serie_act.TabIndex,2)=1
				.RemoveObject('clb_serie_act')
				.clb_nract.SetFocus()
			Endif
		
			*!*	modificare	v 2.0.18
			If .nid_tip = 30 && le pot folosi doar la avizele pe baza de nir
				.lb_titlu_ALB_B121.Caption = [AVIZ PE BAZĂ DE NIR]
			Else
				lnHeight = lnHeight - (.clb_nrfactachi.Height + .ct_clb_furnizor.Height + .ct_clb_altele.Height)
				.RemoveObject('clb_nrfactachi')
				.RemoveObject('ct_clb_furnizor')
				.RemoveObject('ct_clb_altele')
			Endif
			*!*	modificare	v 2.0.18	^
		
			.Height = lnHeight
		
		*!*	rearanjare containere
			For i = 1 To lnObiecte
				If laPozitii(i,2) = 1
					For j = 1 To .Objects.Count
						With .Objects(j)
							If ('ct_clb_'$Lower(.Name) Or 'clb_'$Lower(.Name)) And .TabIndex > i
								.Top = .Top - laPozitii(i,1) + Iif(laPozitii(i,3)=1,lnOffsetTip1,lnOffsetTip2)
							Endif
						Endwith
					Endfor
				Endif
			Endfor
		
			.AutoCenter = .T.
			.Refresh()
		Endwith
		Release laPozitii
	ENDPROC

	PROCEDURE Clb_dataact.Text_simplu1.LostFocus
		poDate.zi_curs = poDate.dataact
		Thisform.clb_zi_curs.Refresh()
	ENDPROC

	PROCEDURE Clb_dataireg.Text_simplu1.LostFocus
		poDate.dataact = poDate.dataireg
		Thisform.clb_dataact.Refresh()
		poDate.zi_curs = poDate.dataact
		Thisform.clb_zi_curs.Refresh()
	ENDPROC

	PROCEDURE Clb_nract.TEXT_SIMPLU1.LostFocus
		poDate.nract = this.value
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_date_aviz_retur AS _frmbase OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

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

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

	*<PropValue>
		DoCreate = .T.
		Height = 130
		Name = "frm_date_aviz_retur"
		nid_tip = 0
		Width = 383
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 384
		_shape2.Height = 29
		_shape2.Left = 315
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		Lb_titlu_alb_b121.Caption = "AVIZ DE RETUR"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 13
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 351
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 11
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		Gridsort1.Left = 360
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 35
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Height = 27, ;
		Left = 319, ;
		Name = "But_renunt1", ;
		TabIndex = 12, ;
		Top = 1, ;
		Width = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Clb_nract_retur' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 32, ;
		Name = "Clb_nract_retur", ;
		TabIndex = 6, ;
		Top = 76, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.nract_retur", ;
		Text_simplu1.InputMask = (get_mask(14,0)), ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Lb_simplu1.Caption = "Nr. documentului", ;
		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_act_retur' AS clb_serie_act WITH ;
		cvariabila = serie_act_retur, ;
		cvariabiladoc = nract_retur, ;
		Left = 32, ;
		Name = "Clb_serie_act_retur", ;
		nid_tipdoc = 6, ;
		pcobj = poDate, ;
		TabIndex = 5, ;
		Top = 48, ;
		Text_simplu1.ControlSource = "poDate.serie_act", ;
		Text_simplu1.Name = "Text_simplu1", ;
		_cbbase1.Name = "_cbbase1", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="serii_numere.vcx" BaseClass="container" />
	
	PROCEDURE inainte_de_do_termin
		Local plReturn
		Store .T. To plReturn
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		
		Do Case
		Case Empty(poDate.nract_retur)
			amessagebox("Nu ati completat numarul documentului!",48,"Atentie")
			This.clb_nract_retur.SetFocus()
			plReturn = .F.
		Otherwise
		*!*	modificare	v 2.0.46
		*!*		plReturn = .T.
			lcFacturi_dublate = facturi_duplicate('418', 0, poDate.serie_act_retur, poDate.nract_retur, [])
			If !Empty(lcFacturi_dublate)
				lnRaspuns = amessagebox(lcFacturi_dublate + Chr(13) + "Doriti sa continuati?",4+32,"Avize dublate")
				If lnRaspuns = 7
					plReturn = .F.
				Endif
			Endif
		*!*	modificare	v 2.0.46	^
		Endcase
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		Lparameters tnRezultatSerii
		DoDefault()
		With This
			If Inlist(tnRezultatSerii,1,3)
				.clb_serie_act_retur.do_initializeaza(tnRezultatSerii)
				.clb_serie_act_retur.SetFocus()
			Else
				.RemoveObject('clb_serie_act_retur')
				.clb_nract_retur.SetFocus()
			Endif
		Endwith
	ENDPROC

	PROCEDURE Clb_nract_retur.Text_simplu1.LostFocus
		poDate.nract = this.value
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_date_dispozitie 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="Ct_clb_delegat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_gestiune" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_delegat
		*m: do_cauta_gestiune
		*p: nid
		*p: nid_tip
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 130
		Name = "frm_date_dispozitie"
		nid_tip = 0
		Width = 383
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 384
		_shape2.Height = 29
		_shape2.Left = 315
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		Lb_titlu_alb_b121.Caption = "DATE DISPOZIȚIE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 5
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 351
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 3
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		Gridsort1.Left = 360
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 35
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Height = 27, ;
		Left = 319, ;
		Name = "But_renunt1", ;
		TabIndex = 4, ;
		Top = 1, ;
		Width = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ct_clb_delegat' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poRec.delegat,[])), ;
		cprocedura = thisform.do_cauta_delegat, ;
		cvar_afisata = poRec.delegat, ;
		Left = 12, ;
		Name = "Ct_clb_delegat", ;
		TabIndex = 1, ;
		Top = 48, ;
		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_gestiune' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poRec.id_gestiune_livr,0)), ;
		cprocedura = thisform.do_cauta_gestiune, ;
		cvar_afisata = poRec.gestiune, ;
		Left = 12, ;
		Name = "Ct_clb_gestiune", ;
		TabIndex = 2, ;
		Top = 76, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Gestiune", ;
		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" />
	
	PROCEDURE do_cauta_delegat
		Local loCauta
		loCauta = caut_delegati()
		If !Isnull(loCauta) And !Empty(loCauta.nume)
			poRec.delegat = loCauta.nume
		
			Thisform.ct_clb_delegat.Refresh()
			Thisform.ct_clb_gestiune.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_gestiune
		Local loCauta
		loCauta = caut_gestiune()
		If !Isnull(loCauta) And !Empty(loCauta.nume_gestiune)
			poRec.id_gestiune_livr = loCauta.id_gestiune
			poRec.gestiune = loCauta.nume_gestiune
		
			Thisform.ct_clb_gestiune.Refresh()
			Thisform.but_TERMIN1.SetFocus()
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local plReturn
		Store .T. To plReturn
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		
		Do Case
		Case Empty(Nvl(poRec.delegat,[]))
			amessagebox("Nu ati ales delegatul!",0+48,"Atentie")
			This.ct_clb_delegat.SetFocus()
			plReturn = .F.
		Case Empty(Nvl(poRec.id_gestiune_livr,0))
			amessagebox("Nu ati ales gestiunea!",0+48,"Atentie")
			This.ct_clb_gestiune.SetFocus()
			plReturn = .F.
		Otherwise
			plReturn = .T.
		Endcase
		Return plReturn
	ENDPROC

	PROCEDURE Init
		DoDefault()
		If !Empty(poRec.delegat)
			Thisform.ct_clb_delegat.do_dezactiveaza
			Thisform.ct_clb_delegat.Enabled = .F.
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_date_factura AS _frmbase OF "_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nract" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_nume_client" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_responsabil" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_altele" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_valuta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie_act" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_lucrare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_gestiune_init" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_venchelt" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ed_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_zi_curs" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_dataireg" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_dataact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_data_scadenta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_fdoc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_fdoc._combobox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_fdoc._label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtSoldLei" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblSoldLei" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtCodFiscal" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblCodFiscal" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_verifica1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_altele
		*m: do_cauta_avize
		*m: do_cauta_client
		*m: do_cauta_comanda
		*m: do_cauta_contract
		*m: do_cauta_factura
		*m: do_cauta_facturi
		*m: do_cauta_fdoc
		*m: do_cauta_gestiune_init
		*m: do_cauta_locatii
		*m: do_cauta_lucrare
		*m: do_cauta_responsabil
		*m: do_cauta_sectie
		*m: do_cauta_valuta
		*m: do_cauta_venchelt
		*m: do_cauta_venit
		*m: do_schimba_tipdoc
		*p: cgestiune_init		&& Numele gestiunii alese ca gestiune sursa.
		*p: lcopiere		&& Copiere factura/aviz
		*p: nid
		*p: nid_tip
		*p: nsoldlei		&& Sold lei client
		*p: nsoldvaluta		&& sold vauta client
		*p: ntip
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		cgestiune_init = 
		DoCreate = .T.
		Height = 536
		lcopiere = .F.
		Name = "frm_date_factura"
		nid_tip = 0
		nsoldlei = 0
		nsoldvaluta = 0
		ntip = 0
		Width = 573
		_memberdata = <VFPData>
			<memberdata name="lcopiere" display="lCopiere"/>
			<memberdata name="nsoldlei" display="nSoldLei"/>
			<memberdata name="nsoldvaluta" display="nSoldValuta"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 574
		_shape2.Height = 29
		_shape2.Left = 504
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 70
		Lb_titlu_alb_b121.Caption = "FACTURARE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 19
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 540
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 17
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 31
		Gridsort1.Left = 367
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 120
	*</PropValue>

	ADD OBJECT '_checkbox1' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "TVA la încasare", ;
		ControlSource = "poDate.tva_incasare", ;
		Left = 336, ;
		Name = "_checkbox1", ;
		TabIndex = 20, ;
		Top = 47
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Height = 27, ;
		Left = 508, ;
		Name = "But_renunt1", ;
		TabIndex = 18, ;
		Top = 1, ;
		Width = 31
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_verifica1' AS but_verifica WITH ;
		Left = 541, ;
		Name = "But_verifica1", ;
		Top = 267
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Clb_data_scadenta' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 8, ;
		Name = "Clb_data_scadenta", ;
		TabIndex = 3, ;
		Top = 98, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.datascad", ;
		Text_simplu1.FontBold = .T., ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Data scadență", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_dataact' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 8, ;
		Name = "Clb_dataact", ;
		TabIndex = 2, ;
		Top = 70, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.dataact", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Data document", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_dataireg' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 8, ;
		Name = "Clb_dataireg", ;
		TabIndex = 1, ;
		Top = 42, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.dataireg", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Data înregistrare", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_nract' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 8, ;
		Name = "Clb_nract", ;
		TabIndex = 8, ;
		Top = 238, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.nract", ;
		Text_simplu1.InputMask = (get_mask(14,0)), ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Lb_simplu1.Caption = "Număr document", ;
		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_act' AS clb_serie_act WITH ;
		cvariabila = serie_act, ;
		cvariabiladoc = nract, ;
		Left = 8, ;
		Name = "Clb_serie_act", ;
		nid_tipdoc = 5, ;
		pcobj = poDate, ;
		TabIndex = 7, ;
		Top = 210, ;
		Text_simplu1.ControlSource = "poDate.serie_act", ;
		Text_simplu1.Name = "Text_simplu1", ;
		_cbbase1.Name = "_cbbase1", ;
		_lbbase1.Caption = "Serie document", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="serii_numere.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_zi_curs' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 8, ;
		Name = "Clb_zi_curs", ;
		TabIndex = 5, ;
		Top = 154, ;
		Width = 314, ;
		Text_simplu1.ControlSource = "poDate.zi_curs", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 150, ;
		Lb_simplu1.Caption = "Data curs valutar", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Cmd_buton1.Left = 280, ;
		Cmd_buton1.Name = "Cmd_buton1", ;
		Cmd_buton1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_altele' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.listaid,'')), ;
		cprocedura = thisform.do_cauta_altele, ;
		cvar_afisata = poDate.descriere, ;
		Left = 7, ;
		Name = "Ct_clb_altele", ;
		TabIndex = 14, ;
		Top = 405, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Altele", ;
		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_fdoc' AS _container WITH ;
		Height = 29, ;
		Left = 8, ;
		Name = "Ct_clb_fdoc", ;
		TabIndex = 6, ;
		Top = 182, ;
		Width = 314
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_fdoc._combobox1' AS _combobox WITH ;
		ColumnWidths = "100,0", ;
		ControlSource = "", ;
		Left = 126, ;
		Name = "_combobox1", ;
		RowSource = "FACTURA,PROFORMA,BON FISCAL", ;
		RowSourceType = 1, ;
		SpecialEffect = 1, ;
		Top = 2, ;
		Value = FACTURA, ;
		Width = 184
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="combobox" />

	ADD OBJECT 'Ct_clb_fdoc._label1' AS _label WITH ;
		Caption = "Tip document", ;
		Left = 8, ;
		Name = "_label1", ;
		Top = 7
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT 'Ct_clb_gestiune_init' AS ct_clb_cautare WITH ;
		cprocedura = thisform.do_cauta_gestiune_init, ;
		cvar_afisata = thisform.cgestiune_init, ;
		Left = 7, ;
		Name = "Ct_clb_gestiune_init", ;
		TabIndex = 15, ;
		ToolTipText = " Daca nu alegeti gestiunea, la scaderea din stoc a unui articol va vor fi aratate stocurile tuturor gestiunilor pe care aveti drepturi.", ;
		Top = 433, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Gestiune sursă", ;
		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_lucrare' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_lucrare,0)), ;
		cprocedura = thisform.do_cauta_lucrare, ;
		cvar_afisata = poDate.nrord, ;
		Left = 7, ;
		Name = "Ct_clb_lucrare", ;
		TabIndex = 10, ;
		Top = 293, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Lucrare", ;
		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_nume_client' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(poDate.id_client) or ISNULL(poDate.id_client), ;
		cprocedura = thisform.do_cauta_client, ;
		cvar_afisata = poDate.nume_client, ;
		Left = 7, ;
		Name = "Ct_clb_nume_client", ;
		TabIndex = 9, ;
		Top = 265, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Nume client", ;
		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_responsabil' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_responsabil,0)), ;
		cprocedura = thisform.do_cauta_responsabil, ;
		cvar_afisata = poDate.responsabil, ;
		Left = 7, ;
		Name = "Ct_clb_responsabil", ;
		TabIndex = 13, ;
		Top = 377, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.LB_SIMPLU1.Caption = "Responsabil", ;
		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_sectie' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_sectie,0)), ;
		cprocedura = thisform.do_cauta_sectie, ;
		cvar_afisata = poDate.sectie, ;
		Left = 7, ;
		Name = "Ct_clb_sectie", ;
		TabIndex = 11, ;
		Top = 321, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Secție", ;
		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_valuta' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_valuta,0)), ;
		cprocedura = thisform.do_cauta_valuta, ;
		cvar_afisata = poDate.nume_valuta, ;
		Left = 7, ;
		Name = "Ct_clb_valuta", ;
		TabIndex = 4, ;
		Top = 125, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Valută", ;
		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_venchelt' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_venchelt,0)), ;
		cprocedura = thisform.do_cauta_venchelt, ;
		cvar_afisata = poDate.venchelt, ;
		Left = 7, ;
		Name = "Ct_clb_venchelt", ;
		TabIndex = 12, ;
		Top = 349, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Venit / cheltuială", ;
		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 ;
		Height = 62, ;
		Left = 8, ;
		Name = "Ed_tx_simplu1", ;
		TabIndex = 16, ;
		Top = 462, ;
		Width = 520, ;
		_EDBASE1.ControlSource = "poDate.explicatia4", ;
		_EDBASE1.Format = "!K", ;
		_EDBASE1.Height = 54, ;
		_EDBASE1.Left = 124, ;
		_EDBASE1.MaxLength = 100, ;
		_EDBASE1.Name = "_EDBASE1", ;
		_EDBASE1.Top = 2, ;
		_EDBASE1.Width = 392, ;
		_lbbase1.AutoSize = .F., ;
		_lbbase1.Caption = "Explicatie Reg. Jurnal (max.100 caractere)", ;
		_lbbase1.Height = 82, ;
		_lbbase1.Left = 4, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6, ;
		_lbbase1.Width = 111, ;
		_lbbase1.WordWrap = .T.
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'lblCodFiscal' AS _label WITH ;
		Anchor = 8, ;
		Caption = "Cod fiscal", ;
		FontBold = .F., ;
		Left = 358, ;
		Name = "lblCodFiscal", ;
		Top = 271
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT 'lblSoldLei' AS _label WITH ;
		Anchor = 8, ;
		Caption = "Sold lei", ;
		FontBold = .T., ;
		ForeColor = 0,0,128, ;
		Left = 358, ;
		Name = "lblSoldLei", ;
		Top = 299
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT 'txtCodFiscal' AS _textbox WITH ;
		Anchor = 8, ;
		ControlSource = "poDate.cod_fiscal", ;
		Enabled = .F., ;
		Height = 23, ;
		Left = 422, ;
		Name = "txtCodFiscal", ;
		ReadOnly = .T., ;
		Top = 269, ;
		Width = 118
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtSoldLei' AS _textbox WITH ;
		Anchor = 8, ;
		ControlSource = "thisform.nSoldLei", ;
		Enabled = .F., ;
		ForeColor = 0,0,128, ;
		Height = 23, ;
		InputMask = "999 999 999.99", ;
		Left = 422, ;
		Name = "txtSoldLei", ;
		ReadOnly = .T., ;
		Top = 297, ;
		Width = 118
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE do_cauta_altele
		Do Case
			Case Thisform.nid_tip=2
				Thisform.do_cauta_contract()
			Case Thisform.nid_tip=3
				Thisform.do_cauta_comanda()
			Case Thisform.nid_tip=4
				Thisform.do_cauta_avize()
				*!*	modificare	v 2.0.46
			Case Thisform.nid_tip=7
				Thisform.do_cauta_factura()
				*!*	modificare	v 2.0.46	^
				*!*	modificare	v 2.0.56
			Case Inlist(Thisform.nid_tip,8,9)
				Thisform.do_cauta_facturi()
				*!*	modificare	v 2.0.56	^
				*!*	modificare	v 2.0.87
			Case Thisform.nid_tip = 45
				Thisform.do_cauta_locatii()
				*!*	modificare	v 2.0.87	^
		Endcase
	ENDPROC

	PROCEDURE do_cauta_avize
		Local lcXMLAvize
		If Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales clientul!",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
			lcXMLAvize = caut_avize(poDate.id_client) && oproceduri_facturare.prg
			If !Empty(lcXMLAvize)
				Xmltocursor(lcXMLAvize, "crsAvizeTemp")
		*!*	modificare	v 2.0.44
				Select id_vanzare,id_comanda,;
					Padl(Iif(!Empty(Nvl(serie_act,[])),Alltrim(serie_act)+[ ],[])+Alltrim(Str(numar_act,20)),50,[ ]) As numar_act ;
					From crsAvizeTemp Into Cursor crsAvizeTemp
		*!*	modificare	v 2.0.44	^
				lcIdVanzare = cursor2lista("crsAvizeTemp", "id_vanzare", ",")
				lcNumar_Act = cursor2lista("crsAvizeTemp", "numar_act", ",")
			
				poDate.listaid = lcIdVanzare
				poDate.descriere = lcNumar_Act
				AddProperty(poDate,"id_comanda_aviz",0)
				Select crsAvizeTemp		
				Locate For Not Empty(ID_COMANDA)
				If Found()
					poDate.id_comanda_aviz=ID_COMANDA
				Endif
				Use In crsAvizeTemp
		
				This.ct_clb_altele.Refresh()
				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
					This.ct_clb_gestiune_init.SetFocus()
				Else
					Thisform.but_TERMIN1.SetFocus()
				Endif
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_client
		Local loCauta
		loHash = GetHash([cTitlu=>Clienti??cCont=>4111??lAdaugCorespondente=>1??lVerificaANAF=>1])
		loHash.SetValue('dDataDoc', Iif(Type('poDate.dataact') = 'D', poDate.dataact, {}))
		loCauta = CautPartenerContabilitate(loHash)
		If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
			If loCauta.id_part <> poDate.id_client
				poDate.listaid = []
				poDate.descriere = []
				poDate.text_aditional = []
			Endif
			poDate.id_client = loCauta.id_part
			poDate.nume_client = loCauta.denumire
			poDate.cod_fiscal = loCauta.cod_fiscal
		
			If poDate.tip = 3
				lcSql = [begin ] + gcS + [.pack_facturare.cauta_date_comanda(?poDate.id_client,?gnIdSucursala,] + ;
					[?poDate.dataact,?@poDate.listaid,?@poDate.descriere); end;]
				lnSucces = goExecutor.oExecute(lcSql)
				If lnSucces < 0
					amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
					poDate.listaid = []
					poDate.descriere = []
					poDate.text_aditional = []
				Endif
			Endif
		
		*!*		If Type('thisform.ct_clb_altele.visible')<>'U'
		*!*			This.ct_clb_altele.Refresh()
		*!*		Endif
		
			* Soldul curent
			loSoldClient = GetSoldClient(poDate.id_client)
			this.nSoldLei = loSoldClient.sold_lei
			this.nSoldValuta = loSoldClient.sold_valuta
			this.txtSoldLei.Refresh()
			
			this.txtCodFiscal.Refresh()
			
			This.ct_clb_nume_client.Refresh()
			This.ct_clb_lucrare.SetFocus()
			
			This.ct_clb_nume_client.clb_TX_CAUTARE.text_SIMPLU1.ToolTipText = 'Id client: ' + TRANSFORM(poDate.id_client)	
		Else
			poDate.listaid = []
			poDate.descriere = []
			poDate.text_aditional = []
		
			This.ct_clb_nume_client.clb_TX_CAUTARE.text_SIMPLU1.ToolTipText = ''
			
			this.nSoldLei = 0
			this.nSoldValuta = 0
			this.txtSoldLei.Refresh()
		Endif
		*!*	modificare v 2.0.70
		If Type('thisform.ct_clb_altele.visible')<>'U'
			This.ct_clb_altele.Refresh()
		ENDIF
		*!*	modificare v 2.0.70 ^
	ENDPROC

	PROCEDURE do_cauta_comanda
		* 12.03.2021
		* folosesc caut_comanda_clienti in loc de caut_comanda_client, 
		* ca sa pot folosi un client diferit fata de comanda (ex: pers. fizica in loc de pers. juridica)
		Local loCauta
		If Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales clientul!",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
			* loCauta = caut_comanda_client(poDate.id_client)
			loCauta = caut_comanda_clienti(poDate.id_client)
			If !Isnull(loCauta) And !Empty(loCauta.id_comanda)
				IF poDate.id_client <> loCauta.id_part
					AMESSAGEBOX('Comanda ' + ALLTRIM(TRANSFORM(loCauta.nr_comanda)) + ' (Client: ' + ALLTRIM(loCauta.nume) + ' Id: ' + ALLTRIM(TRANSFORM(loCauta.id_part)) + ')' + ;
						' nu apartine clientului ales (' + ALLTRIM(poDate.nume_client) + ' Id: ' + ALLTRIM(TRANSFORM(poDate.id_client)) + ')',0+48,_sCREEN.Caption)
				ENDIF 
				poDate.listaid = loCauta.id_comanda
				poDate.descriere = loCauta.nr_comanda
		
				This.ct_clb_altele.Refresh()
				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
					This.ct_clb_gestiune_init.SetFocus()
				Else
					This.but_TERMIN1.SetFocus()
				Endif
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_contract
		Local loCauta,lcXMLContracte
		If Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales clientul!",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
		*!*	modificare v 2.0.67
		*!*		loCauta = caut_contract_facturare(poDate.id_client)
		*!*		If !Isnull(loCauta) And !Empty(loCauta.id_ctr)
		*!*			poDate.listaid = loCauta.id_ctr
		*!*			poDate.descriere = loCauta.contract
		*!*			This.ct_clb_altele.Refresh()
		*!*			If Inlist(loCauta.opt_facturare,3,4)
		*!*				If !Empty(loCauta.scadenta_incasare)
		*!*					poDate.datascad = poDate.dataact + loCauta.scadenta_incasare
		*!*					This.clb_data_scadenta.Refresh()
		*!*				Endif
		*!*	*!*	modificare	v 2.0.41
		*!*				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'
		*!*					Thisform.ct_clb_gestiune_init.Visible = .T.
		*!*					Thisform.ct_clb_gestiune_init.SetFocus()
		*!*				Else
		*!*					Thisform.but_termin1.SetFocus()
		*!*				Endif
		*!*	*!*	modificare	v 2.0.41	^
		*!*			Else
		*!*	*!*				poDate.datascad	= Iif(gnScadentaAutomata=0,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
		*!*	*!*	modificare	v 2.0.41
		*!*				poDate.id_gestiune_init = Null
		*!*				Thisform.cgestiune_init = []
		*!*				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'
		*!*					Thisform.ct_clb_gestiune_init.Refresh()
		*!*					Thisform.ct_clb_gestiune_init.Visible = .F.
		*!*				Endif
		*!*				Thisform.but_termin1.SetFocus()
		*!*			Endif
		*!*	*!*	modificare	v 2.0.41	^
			lcXMLContracte = caut_contract_facturare(poDate.id_client)
			If !Empty(lcXMLContracte) And gnButon = 1
				Xmltocursor(lcXMLContracte, "crsCtrTemp")
				poDate.listaid = cursor2lista("crsCtrTemp", "id_ctr", ",")
				poDate.descriere = cursor2lista("crsCtrTemp", "contract", ",")
				This.ct_clb_altele.Refresh()
				Select crsCtrTemp
				Calculate Min(scadenta_incasare),MAX(afisare_scadenta) For Inlist(opt_facturare,3,4,0) To lnScadentaIncasare,lnAfisareScadenta
				If lnScadentaIncasare <> 0
					poDate.datascad = poDate.dataact + lnScadentaIncasare
					This.clb_data_scadenta.Refresh()
				Endif
				poDate.afisare_scadenta = lnAfisareScadenta		&&	modificare ROACONTRACTE	v 2.0.38
				If Type('Thisform.ct_clb_gestiune_init.visible')<>'U'
					Thisform.ct_clb_gestiune_init.Visible = .T.
					Thisform.ct_clb_gestiune_init.SetFocus()
				Else
					Thisform.but_termin1.SetFocus()
				Endif
		*!*			Use In crsCtrTemp
		*!*	modificare v 2.0.67	^
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_factura
		*!*	modificare	v 2.0.46
		Local loCauta
		If Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales clientul!",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Else
			loCauta = caut_facturi_client(poDate.id_client)
			If !Isnull(loCauta) And !Empty(loCauta.id_fact)
				poDate.descriere = Alltrim(Alltrim(Nvl(loCauta.serie_act,[]))+[ ]+Alltrim(Str(loCauta.nract,14,0)))
				poDate.text_aditional = [INVOICE ] + poDate.descriere
				This.ct_clb_altele.Refresh()
				This.buT_TERMIN1.SetFocus()
			Endif
		EndIf
		*!*	modificare	v 2.0.46	^
	ENDPROC

	PROCEDURE do_cauta_facturi
		*!*	modificare	v 2.0.56
		Local loCauta
		Do Case
		Case Empty(Nvl(poDate.id_client,0))
			amessagebox("Nu ati ales clientul!",0+48,"Atentie")
			This.ct_clb_nume_client.SetFocus()
		Case Empty(Nvl(poDate.id_valuta,0)) And poDate.tip = 9
			amessagebox("Nu ati ales valuta!",0+48,"Atentie")
			This.ct_clb_valuta.SetFocus()
		OTHERWISE
			* 03.07.2020, marius
			* Nu stiu de ce se alegea o singura factura la retur.
			* Era si codul pentru mai multe facturi retur, dar era comentat
			
		*!*		loCauta = caut_facturi_multiple_client(poDate.id_client,poDate.in_valuta,poDate.id_valuta)
		*!*		If gnButon = 1 and !Empty(Nvl(loCauta.id_vanzare,0))
		*!*			poDate.listaid = Alltrim(Str(loCauta.id_vanzare))
		*!*			poDate.descriere = Alltrim(Iif(!Empty(Nvl(loCauta.serie_act,[])),Alltrim(loCauta.serie_act)+[ ],[])+Alltrim(Str(loCauta.numar_act,20,0)))
		
			* pentru mai multe facturi : 
			lcXMLFacturi = caut_facturi_multiple_client(poDate.id_client,poDate.in_valuta,poDate.id_valuta,.T.)
			If !Empty(lcXMLFacturi) and gnButon = 1
				Xmltocursor(lcXMLFacturi, "crsFacturiTemp")	
				Select id_vanzare,;
					Padl(Iif(!Empty(Nvl(serie_act,[])),Alltrim(serie_act)+[ ],[])+Alltrim(Str(numar_act,20,0)),50,[ ]) As numar_act ;
					From crsFacturiTemp Into Cursor crsFacturiTemp
				poDate.listaid = cursor2lista("crsFacturiTemp", "id_vanzare", ",")
				poDate.descriere = cursor2lista("crsFacturiTemp", "numar_act", ",")
				USE IN (SELECT('crsFacturiTemp'))
		
				poDate.text_aditional = Iif(poDate.tip=8,[RETUR FACTURA ],[REFUND INVOICE FOR ]) + poDate.descriere
		
				This.ct_clb_altele.Refresh()
				This.buT_TERMIN1.SetFocus()
			Endif
		Endcase
		*!*	modificare	v 2.0.56	^
		
	ENDPROC

	PROCEDURE do_cauta_fdoc
		Local loCauta
		loCauta = caut_fdoc()
		If !Isnull(loCauta) And !Empty(loCauta.fel_document)
			poDate.id_fdoc = loCauta.id_fdoc
			poDate.fdoc = loCauta.fel_document
		
			This.ct_clb_fdoc.Refresh()
			This.clb_dataact.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_gestiune_init
		loCauta = caut_gestiune(0,gnIdUtil)
		If !Isnull(loCauta) And !Empty(loCauta.id_gestiune)
			poDate.id_gestiune_init = loCauta.id_gestiune
			Thisform.cgestiune_init = loCauta.nume_gestiune
		Else
			poDate.id_gestiune_init = Null
			Thisform.cgestiune_init = []
		Endif
		This.ct_clb_gestiune_init.Refresh()
		*!*	modificare	ROACONTRACTE	v 2.0.42
		*!*	This.buT_TERMIN1.SetFocus()
		Thisform.ed_tx_simplu1._edbase1.SetFocus()
		*!*	modificare	ROACONTRACTE	v 2.0.42	^
		
	ENDPROC

	PROCEDURE do_cauta_locatii
		Local loCauta
		loCauta = caut_locatie_restaurant()
		If !Isnull(loCauta) And !Empty(loCauta.id_rest_locatie)
			poDate.listaid = loCauta.id_rest_locatie
			poDate.descriere = loCauta.locatie
			This.ct_clb_altele.Refresh()
			This.but_TERMIN1.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_cauta_lucrare
		Local loCauta
		LOCAL llToateIreg, llNou, lcFiltruOriginal
		llToateIreg = .F.
		llNou = .T.
		lcFiltruOriginal = ''
		
		loCauta = caut_lucrare(m.llToateIreg, m.llNou, m.lcFiltruOriginal)
		*!*	modificare	v 2.0.46
		*!*	If !Empty(Nvl(loCauta.id_lucrare,0))
		*!*		poDate.id_lucrare = loCauta.id_lucrare
		*!*		poDate.nrord = loCauta.nrord
		
		*!*		This.ct_clb_lucrare.Refresh()
		*!*	Endif
		If gnButon = 1
			poDate.id_lucrare = loCauta.id_lucrare
			poDate.nrord = loCauta.nrord
		Else
			poDate.id_lucrare = Null
			poDate.nrord = []
		Endif
		*!*	modificare	v 2.0.46	^
		This.ct_clb_sectie.SetFocus()
	ENDPROC

	PROCEDURE do_cauta_responsabil
		Local loCauta
		loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Responsabili??cTipuriParteneri=>]+Alltrim(Str(gnIdTipResponsabili))+[??lAdaugCorespondente=>1]))
		If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
			poDate.id_responsabil = loCauta.id_part
			poDate.responsabil = loCauta.denumire
		Else
			poDate.id_responsabil = Null
			poDate.responsabil = []
		Endif
		This.ct_clb_responsabil.Refresh()
		Do Case
		Case Type('thisform.ct_clb_altele.visible')<>'U'
			Thisform.ct_clb_altele.SetFocus()
		Case Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
			This.ct_clb_gestiune_init.SetFocus()
		Otherwise
			This.buT_TERMIN1.SetFocus()
		Endcase
		
	ENDPROC

	PROCEDURE do_cauta_sectie
		Local loCauta
		LOCAL lnPornire, llDesktop, llToateIreg, llNou, lcFiltruOriginal
		lnPornire = 0
		llDesktop = .F.
		llToateIreg = .F.
		llNou = .T.
		lcFiltruOriginal = ''
		
		loCauta = caut_sectie(lnPornire, llDesktop, m.llToateIreg, m.llNou, m.lcFiltruOriginal)
		*!*	modificare	v 2.0.46
		*!*	If !Empty(Nvl(loCauta.id_sectie,0))
		*!*		poDate.id_sectie = loCauta.id_sectie
		*!*		poDate.sectie = loCauta.sectie
		*!*		This.ct_clb_sectie.Refresh()
		*!*	Endif
		If gnButon = 1
			poDate.id_sectie = loCauta.id_sectie
			poDate.sectie = loCauta.sectie
		Else
			poDate.id_sectie = Null
			poDate.sectie = []
		Endif
		This.ct_clb_sectie.Refresh()
		*!*	modificare	v 2.0.46	^
		Do Case
		*!*	modificare	v 2.0.46
		Case Type('thisform.ct_clb_venchelt.visible')<>'U'
			This.ct_clb_venchelt.SetFocus()
		*!*	modificare	v 2.0.46	^
		Case Type('thisform.ct_clb_responsabil.visible')<>'U'
			This.ct_clb_responsabil.SetFocus()
		Case Type('thisform.ct_clb_altele.visible')<>'U'
			This.ct_clb_altele.SetFocus()
		Case Type('Thisform.ct_clb_gestiune_init.visible')<>'U'		&&	modificare v 2.0.41
			This.ct_clb_gestiune_init.SetFocus()
		Otherwise
			This.buT_TERMIN1.SetFocus()
		Endcase
	ENDPROC

	PROCEDURE do_cauta_valuta
		Local loCauta
		loCauta = caut_valuta(1,.F.,.T.)
		If !Isnull(loCauta) And !Empty(loCauta.id_valuta)
			poDate.id_valuta = loCauta.id_valuta
			poDate.nume_valuta = loCauta.nume_val
		
			This.ct_clb_valuta.Refresh()
			If Type('thisform.clb_zi_curs.visible')<>'U'
				This.clb_zi_curs.SetFocus()
			Else
				This.clb_serie_act.SetFocus()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_venchelt
		Local loCauta
		LOCAL lnPornire, llDesktop, lnTip, lnId, llToateIreg, llNou, lcFiltruOriginal
		lnPornire = 0
		llDesktop = .F.
		lnTip = 2 && venituri
		lnId = 0
		llToateIreg = .F.
		llNou = .T.
		lcFiltruOriginal = ''
		loCauta = caut_venchelt(m.lnPornire, m.llDesktop, m.lnTip, m.lnId, m.llToateIreg, m.llNou, m.lcFiltruOriginal)
		
		If gnButon = 1
			poDate.id_venchelt = loCauta.id_venchelt
			poDate.venchelt = loCauta.explicatie
		Else
			poDate.id_venchelt = Null
			poDate.venchelt = []
		Endif
		This.ct_clb_venchelt.Refresh()
		Do Case
		Case Type('thisform.ct_clb_responsabil.visible')<>'U'
			This.ct_clb_responsabil.SetFocus()
		Case Type('thisform.ct_clb_altele.visible')<>'U'
			This.ct_clb_altele.SetFocus()
		Case Type('Thisform.ct_clb_gestiune_init.visible')<>'U'
			This.ct_clb_gestiune_init.SetFocus()
		Otherwise
			This.buT_TERMIN1.SetFocus()
		Endcase
	ENDPROC

	PROCEDURE do_cauta_venit
	ENDPROC

	PROCEDURE do_schimba_tipdoc
		LOCAL lnIdTipDoc, lcTipDoc
		lcTipDoc = UPPER(this.ct_clb_fdoc._combobox1.Value)
		
		lnIdTipDoc = IIF(m.lcTipDoc = 'FACTURA', poDate.nIdTipDocFactura, ;
			IIF(m.lcTipDoc = 'PROFORMA', poDate.nIdTipDocProforma, ;
			IIF(m.lcTipDoc = 'BON FISCAL', poDate.nIdTipDocBonFiscal, ;
			IIF(m.lcTipDoc = 'AVIZ', poDate.nIdTipDocAvizExpeditie, poDate.nIdTipDocFactura))))
		
		
		
		*!*	poDate.nIdTipDocFactura			=	5
		*!*	poDate.nIdTipDocProforma		=	23
		*!*	poDate.nIdTipDocBonFiscal		=	3
		*!*	poDate.nIdTipDocAvizExpeditie	=	6
		
		
		*!*	poDate.eProforma  = IIF(m.lnIdTipDoc = poDate.nIdTipDocProforma, 1, 0)
		*!*	poDate.eBonFiscal  = IIF(m.lnIdTipDoc = poDate.nIdTipDocBonFiscal, 1, 0)
		poDate.initializeaza_setari_document(IIF(m.lnIdTipDoc = poDate.nIdTipDocBonFiscal, -101, IIF(m.lnIdTipDoc = poDate.nIdTipDocProforma, -102, poDate.Tip)))
		
		This.clb_serie_act._cbbase1.LostFocus()
		
		IF poDate.nIdTipDoc = m.lnIdTipDoc
			RETURN
		ENDIF 	
		
		poDate.nract = 0
		poDate.serie_act = ""
		
		poGeneratorNumere.dezaloca_numar(poDate.nIdTipDoc)
		poDate.nIdTipDoc = m.lnIdTipDoc && se initializeaza automat si .eBonFiscal, .eProforma
		poDate.rezultat_serii = poGeneratorNumere.creeaza_cursor_serii(poDate.nIdTipDoc) && 1 = CU SERIE, 2 = FARA SERIE CU PLAJE, 3 = CU SERIE SI PLAJE
		
		*If Inlist(poDate.rezultat_serii,1,3)
		THISFORM.clb_serie_act.nid_tipdoc = m.lnIdTipDoc
		Thisform.clb_serie_act.do_initializeaza(poDate.rezultat_serii)
		*Endif 
		
		thisform.clb_nract.text_simplu1.Refresh()
		thisform.clb_serie_act.Refresh()
		This.clb_serie_act._cbbase1.LostFocus()
	ENDPROC

	PROCEDURE do_verifica
		Local loDate As "empty"
		Local lnOptiune, lnRaspuns, loPartener
		
		lnOptiune = 1
		loPartener = Null
		loDate = Createobject("empty")
		
		AddProperty(loDate, "denumire", poDate.nume_client)
		AddProperty(loDate, "cod_fiscal", poDate.cod_fiscal)
		AddProperty(loDate, "tip_verificare", "ANAF_SERVICIU_WEB")
		
		lnRaspuns = VerificaCodFiscal(loDate, @lnOptiune, @loPartener) 
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local plReturn,lcFacturi_dublate, llCopiere
		Store .T. To plReturn
		llCopiere = This.lCopiere && copiere factura/aviz
		
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.ActiveControl.ControlSource
			&lcval=Thisform.ActiveControl.Value
		Endif
		
		Do Case
			Case Empty(poDate.dataireg)
				amessagebox("Nu ati completat data inregistrarii!",48,"Atentie")
				This.clb_dataireg.SetFocus()
				plReturn = .F.
			Case Empty(poDate.dataact)
				amessagebox("Nu ati completat data documentului!",48,"Atentie")
				This.clb_dataact.SetFocus()
				plReturn = .F.
			Case Empty(poDate.datascad)
				amessagebox("Nu ati completat data scadenta!",48,"Atentie")
				This.clb_data_scadenta.SetFocus()
				plReturn = .F.
			Case Isnull(poDate.id_fdoc) Or Empty(poDate.id_fdoc)
				amessagebox("Nu ati ales felul documentului!",48,"Atentie")
				This.ct_clb_fdoc.SetFocus()
				plReturn = .F.
				*!*	modificare v 2.0.56
			Case poDate.in_valuta = 1 And Empty(Nvl(poDate.zi_curs,{})) And Type('thisform.clb_zi_curs.visible')<>'U'
				*!*	Case poDate.in_valuta = 1 And Empty(Nvl(poDate.zi_curs,{}))
				*!*	modificare v 2.0.56	^
				amessagebox("Nu ati completat ziua cursului valutar!",48,"Atentie")
				This.clb_zi_curs.SetFocus()
				plReturn = .F.
			Case poDate.in_valuta = 1 And Empty(Nvl(poDate.id_valuta,0))
				amessagebox("Nu ati completat valuta!",48,"Atentie")
				This.ct_clb_valuta.SetFocus()
				plReturn = .F.
			Case Empty(poDate.nract)
				amessagebox("Nu ati completat numarul documentului!",48,"Atentie")
				This.clb_nract.SetFocus()
				plReturn = .F.
			Case !Between(poDate.dataireg,Date(gnAn,gnLuna,1),Gomonth(Date(gnAn,gnLuna,1),1)-1)
				amessagebox("Data inregistrarii trebuie sa fie din luna "+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))+" !",48,"Atentie")
				This.clb_dataireg.SetFocus()
				plReturn = .F.
			Case poDate.datascad<poDate.dataact
				amessagebox("Data scadenta trebuie sa fie mai mare sau egala cu data documentului!",48,"Atentie")
				This.clb_data_scadenta.SetFocus()
				plReturn = .F.
			Case poDate.dataact>poDate.dataireg
				amessagebox("Data documentului trebuie sa fie mai mica sau egala cu data inregistrarii!",48,"Atentie")
				This.clb_dataact.SetFocus()
				plReturn = .F.
			Case Empty(poDate.id_client) Or Isnull(poDate.id_client)
				amessagebox("Nu ati ales clientul!",48,"Atentie")
				This.ct_clb_nume_client.SetFocus()
				plReturn = .F.
			Case Empty(Nvl(poDate.descriere,[])) And poDate.tip = 7
				amessagebox("Nu ati ales factura!",48,"Atentie")
				This.ct_clb_altele.SetFocus()
				plReturn = .F.
			Case Empty(Nvl(poDate.descriere,[])) And m.llCopiere
				amessagebox("Nu ati ales factura de copiat!",48,"Atentie")
				This.ct_clb_altele.SetFocus()
				plReturn = .F.
				*!*	modificare	v 2.0.56
			Case Empty(Nvl(poDate.descriere,[])) And Inlist(poDate.tip,8,9)
				amessagebox("Nu ati ales factura/facturile pentru care se face returul!",48,"Atentie")
				This.ct_clb_altele.SetFocus()
				plReturn = .F.
				*!*	modificare	v 2.0.56	^
			Case Empty(Nvl(poDate.listaid,[])) And !Inlist(poDate.tip,1,5,7,8,9,10,48,49)		&&	modificare : am adaugat 10 ( v 2.0.56 ), 48 ( v 2.0.93 ), 49 ( v 2.0.95 )
				Do Case
					Case Inlist(poDate.tip, 2, 6, 52)
						lcMesaj = [Nu ati ales contractul!]
					Case poDate.tip = 3
						lcMesaj = [Nu ati ales comanda!]
					Case poDate.tip = 4
						lcMesaj = [Nu ati ales avizul!]
					Case poDate.tip = 45					&&	modificare v 2.0.87
						lcMesaj = [Nu ati ales locatia!]
				Endcase
				amessagebox(lcMesaj,48,"Atentie")
				This.ct_clb_altele.SetFocus()
				plReturn = .F.
			Otherwise
				*!*	modificare	v 2.0.46
				*!*		plReturn = .T.
				lcFacturi_dublate = facturi_duplicate('4111', 0, poDate.serie_act, poDate.nract, [])
				If !Empty(lcFacturi_dublate)
					lnRaspuns = amessagebox(lcFacturi_dublate + Chr(13)+"Doriti sa continuati?",4+32,"Facturi dublate")
					plReturn = (m.lnRaspuns = 6)
				Endif
				*!*	modificare	v 2.0.46	^
				
				* Daca FACTURA si clientul se numeste "CLIENT"[I DIVERSI]
				* Atentionez ca ar trebui sa se aleaga "BON FISCAL" in loc de "FACTURA"
				IF poDate.nIdTipDoc = poDate.nIdTipDocFactura AND 'CLIENT'$UPPER(NVL(poDate.nume_client,''))
					lnRaspuns = amessagebox('Ati ales clientul ' + ALLTRIM(poDate.nume_client) + ' si Tip document = FACTURA in loc de BON FISCAL' + Chr(13)+"Doriti sa continuati?",4+32,"Bon Fiscal")
					plReturn = (m.lnRaspuns = 6)	
				ENDIF 
		Endcase
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		Lparameters toFactura
		* toFactura (optional): factura sursa care se copie
		
		*!* 03.02.2015
		*!* marius.mutu
		*!*	Tratez si rezultat_serii = 2 FARA SERIE CU PLAJE, sa generez numarul urmator pentru BON FISCAL
		
		*!*	Valori posibile pentru poDate.tip	:
		*!*		1	-	Factura pe baza de lista de preturi
		*!*		2	-	Factura pe baza de contract
		*!*		3	-	Factura pe baza de comanda
		*!*		4	-	Din aviz
		*!*		5	-	Invoice pe baza de lista de preturi
		*!*		6	-	Invoice pe baza de contract
		**		7	-	credit note
		**		8	-	retur factura in lei
		**		9	-	retur factura in valuta
		**		48	-	Din avize ( valoric )
		*!*		52	-	Factura fiscala in valuta pe baza de contract
		
		Local laPozitii[1], lnHeight, lnObiecte, lnOffsetTip1, lnOffsetTip2
		LOCAL i, j, llCopiere
		
		This.lCopiere = (TYPE('toFactura') = 'O') && copiere factura
		llCopiere = This.lCopiere
		
		lnObiecte = 16	&&	ROACONTRACTE v 2.0.42 : 16
		Dimension laPozitii(lnObiecte, 3)
		*!*		1	-	inaltime
		*!*		2	-	sters
		*!*		3	-	tip	(	1	=	ct_clb_...,	2	=	clb_... )
		DoDefault()
		With This
			*!*	stochez inaltimea fiecarui container
			*!* containerele trebuie sa aiba TabIndex completat in ordinea in care sunt pe formular
		
			lnOffsetTip1 = .ct_clb_fdoc.Height - .ct_clb_fdoc._combobox1.Height + 1
			lnOffsetTip2 = 1
		
			For i = 1 To .Objects.Count
				With .Objects(i)
					If 'ct_clb_' $ Lower(.Name) Or 'clb_' $ Lower(.Name) Or 'ed_tx_' $ Lower(.Name)	&&	ROACONTRACTE v 2.0.42 : ed_tx_
						laPozitii(.TabIndex, 1) = .Height
						laPozitii(.TabIndex, 2) = 0
						laPozitii(.TabIndex, 3) = Iif('ct_clb_' $ Lower(.Name), 1, 2)
					Endif
				Endwith
			Endfor
		
			lnHeight = .Height
			.nid_tip = poDate.tip
			Do Case
				Case gnScadereStoc = 0 And Inlist(poDate.tip, 1, 5, 10, 48, 49)	&&	modificare : am adaugat 10 ( v 2.0.56 ), 48 ( v 2.0.93 ), 49 ( v 2.0.95 )
					lnHeight = lnHeight - .ct_clb_responsabil.Height - .ct_clb_gestiune_init.Height
					laPozitii(.ct_clb_gestiune_init.TabIndex, 2) = 1
					laPozitii(.ct_clb_responsabil.TabIndex, 2) = 1
					.RemoveObject('ct_clb_gestiune_init')
					.RemoveObject('ct_clb_responsabil')
					IF m.llCopiere
						.ct_clb_altele.do_schimba_explicatia([Nr. factura])			
					ELSE
						lnHeight = lnHeight- .ct_clb_altele.Height
						laPozitii(.ct_clb_altele.TabIndex, 2) = 1
						.RemoveObject('ct_clb_altele')			
					ENDIF 	
				Case gnScadereStoc = 0
					With .ct_clb_altele
						Do Case
							Case INLIST(poDate.tip, 2, 6, 52) && contract factura lei, invoice, fiscala valuta
								.do_schimba_explicatia([Nr. contract])
							Case poDate.tip = 3
								.do_schimba_explicatia([Nr. comanda])
							Case poDate.tip = 4
								.do_schimba_explicatia([Nr. aviz / avize])
							Case poDate.tip = 7 && credit note
								.do_schimba_explicatia([Nr. factura])
							Case Inlist(poDate.tip, 8, 9) && retur factura
								.do_schimba_explicatia([Nr. facturi])
							Case poDate.tip = 45
								.do_schimba_explicatia([Locatie])
						Endcase
					Endwith
					lnHeight = lnHeight - .ct_clb_responsabil.Height - .ct_clb_gestiune_init.Height
					laPozitii(.ct_clb_responsabil.TabIndex, 2) = 1
					laPozitii(.ct_clb_gestiune_init.TabIndex, 2) = 1
					.RemoveObject('ct_clb_responsabil')
					.RemoveObject('ct_clb_gestiune_init')
				Case gnScadereStoc = 1 And Inlist(poDate.tip, 1, 5, 10)		&&	modificare v 2.0.56 : am adaugat 10
					IF m.llCopiere
						.ct_clb_altele.do_schimba_explicatia([Nr. factura])			
					ELSE
						lnHeight = lnHeight - .ct_clb_altele.Height
						laPozitii(.ct_clb_altele.TabIndex, 2) = 1
						.RemoveObject('ct_clb_altele')			
					ENDIF 	
		
				Otherwise
					With .ct_clb_altele
						Do Case
								*!*	modificare	v 2.0.87
							Case poDate.tip = 45
								.do_schimba_explicatia([Locatie])
								lnHeight = lnHeight - Thisform.ct_clb_gestiune_init.Height
								laPozitii(Thisform.ct_clb_gestiune_init.TabIndex, 2) = 1
								Thisform.RemoveObject('ct_clb_gestiune_init')
								*!*	modificare	v 2.0.87	^
							Case INLIST(poDate.tip, 2, 6, 52) && contract
								.do_schimba_explicatia([Nr. contract])
							Case poDate.tip = 3
								.do_schimba_explicatia([Nr. comanda])
							Case poDate.tip = 4
								.do_schimba_explicatia([Nr. aviz / avize])
								lnHeight = lnHeight - Thisform.ct_clb_responsabil.Height - Thisform.ct_clb_gestiune_init.Height
								laPozitii(Thisform.ct_clb_responsabil.TabIndex, 2) = 1
								laPozitii(Thisform.ct_clb_gestiune_init.TabIndex, 2) = 1
								Thisform.RemoveObject('ct_clb_responsabil')
								Thisform.RemoveObject('ct_clb_gestiune_init')
								*!*	modificare	v 2.0.46
							Case Inlist(poDate.tip, 7) && 7 = credit note
								.do_schimba_explicatia([Nr. factura])
								*!*	modificare	v 2.0.51
								lnHeight = lnHeight - Thisform.ct_clb_responsabil.Height - Thisform.ct_clb_gestiune_init.Height
								*!*	modificare	v 2.0.51	^
								laPozitii(Thisform.ct_clb_responsabil.TabIndex, 2) = 1
								laPozitii(Thisform.ct_clb_gestiune_init.TabIndex, 2) = 1
								Thisform.RemoveObject('ct_clb_responsabil')
								Thisform.RemoveObject('ct_clb_gestiune_init')
								*!*	modificare	v 2.0.46	^
								*!*	modificare	v 2.0.56
							Case Inlist(poDate.tip, 8, 9)
								.do_schimba_explicatia([Nr. facturi])
								lnHeight = lnHeight - Thisform.ct_clb_gestiune_init.Height
								laPozitii(Thisform.ct_clb_gestiune_init.TabIndex, 2) = 1
								Thisform.RemoveObject('ct_clb_gestiune_init')
								*!*	modificare	v 2.0.56	^
								*!*	modificare	v 2.0.93 ; modificare v 2.0.95 : 49
							Case Inlist(poDate.tip, 48, 49)
								lnHeight = lnHeight - Thisform.ct_clb_responsabil.Height - Thisform.ct_clb_altele.Height - Thisform.ct_clb_gestiune_init.Height
								laPozitii(Thisform.ct_clb_gestiune_init.TabIndex, 2) = 1
								laPozitii(Thisform.ct_clb_responsabil.TabIndex, 2) = 1
								laPozitii(Thisform.ct_clb_altele.TabIndex, 2) = 1
								Thisform.RemoveObject('ct_clb_gestiune_init')
								Thisform.RemoveObject('ct_clb_responsabil')
								Thisform.RemoveObject('ct_clb_altele')
								*!*	modificare	v 2.0.93	^
						Endcase
					Endwith
			Endcase
		
			If gnScadentaAutomata = 1
				.clb_data_scadenta.dezactiveaza()
			Endif
		
			*!*	modificare v 2.0.56
			If Inlist(poDate.tip, 8, 9)
				lnHeight = lnHeight - .clb_zi_curs.Height
				laPozitii(.clb_zi_curs.TabIndex, 2) = 1
				.RemoveObject('clb_zi_curs')
			Endif
			*!*	modificare v 2.0.56	^
		
			If poDate.in_valuta = 0
				lnHeight = lnHeight - .ct_clb_valuta.Height
				laPozitii(.ct_clb_valuta.TabIndex, 2) = 1
				.RemoveObject('ct_clb_valuta')
		*!*			.ct_clb_fdoc.SetFocus()
		*!*		Else
		*!*			.ct_clb_valuta.SetFocus()
			Endif
		
			*If Inlist(poDate.rezultat_serii,1,3)
			If Inlist(poDate.rezultat_serii, 1, 2, 3) && Tratez si rezultat_serii = 2 FARA SERIE CU PLAJE, sa generez numarul urmator pentru BON FISCAL
				.clb_serie_act.nid_tipdoc = poDate.nIdTipDoc
				.clb_serie_act.do_initializeaza(poDate.rezultat_serii)
				*!*	modificare	v 2.0.46
				*!*			.clb_serie_act.SetFocus()
		*!*			If !Empty(poDate.nract)
		*!*				.ct_clb_fdoc.SetFocus()
		*!*			Else
		*!*				.ct_clb_fdoc.SetFocus()
		*!*			Endif
				*!*	modificare	v 2.0.46	^
			Else
				lnHeight = lnHeight - .clb_serie_act.Height
				laPozitii(.clb_serie_act.TabIndex, 2) = 1
				.RemoveObject('clb_serie_act')
			Endif
		
			.Height = lnHeight
		
			*!*	rearanjare containere
			For i = 1 To lnObiecte
				If laPozitii(i, 2) = 1
					For j = 1 To .Objects.Count
						With .Objects(j)
							If ('ct_clb_' $ Lower(.Name) Or 'clb_' $ Lower(.Name) Or 'ed_tx_' $ Lower(.Name)) And .TabIndex > i
								&&	ROACONTRACTE v 2.0.42 : ed_tx_
								.Top = .Top - laPozitii(i, 1) + Iif(laPozitii(i, 3) = 1, lnOffsetTip1, lnOffsetTip2)
							Endif
						Endwith
					Endfor
				Endif
			Endfor
		
			.AutoCenter = .T.
			.Refresh()
		ENDWITH
		
		this.txtCodFiscal.Top = this.ct_clb_nume_client.Top + 4
		this.lblCodFiscal.Top  = this.ct_clb_nume_client.Top + 4
		this.but_verifica1.Top = this.ct_clb_nume_client.Top + 2
		
		this.txtSoldLei.Top = this.ct_clb_nume_client.Top + 32
		this.lblSoldLei.Top = this.ct_clb_nume_client.Top + 32
		
		* Soldul curent (daca este o factura pe baza de comanda/contract, se intra deja cu clientul selectat)
		IF TYPE('poDate.id_client') = 'N' AND NVL(poDate.id_client,0) <> 0
			loSoldClient = GetSoldClient(poDate.id_client)
			this.nSoldLei = loSoldClient.sold_lei
			this.nSoldValuta = loSoldClient.sold_valuta
			this.txtSoldLei.Refresh()
			This.ct_clb_nume_client.clb_TX_CAUTARE.text_SIMPLU1.ToolTipText = 'Id client: ' + TRANSFORM(poDate.id_client)
		ENDIF 
		
		DO CASE 
			CASE poDate.in_valuta = 1 and this.ct_clb_valuta.Top < this.ct_clb_fdoc.Top AND EMPTY(NVL(poDate.nume_valuta,''))
				this.ct_clb_valuta.SetFocus()
			OTHERWISE 
				this.ct_clb_fdoc.SetFocus()		
		ENDCASE 
		Release laPozitii
		
	ENDPROC

	PROCEDURE Clb_dataact.Text_simplu1.LostFocus
		*!*	modificare	v 2.2.4	:	daca scadenta nu e automata, atunci poate modifica data scadenta propusa
		*!*	poDate.datascad	= Iif(gnScadentaAutomata=0,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
		poDate.datascad	= Iif(gnZileScadentaFact=-1,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
		*!*	modificare	v 2.2.4	^
		Thisform.clb_data_scadenta.Refresh()
		*!*	modificare	v 2.0.56
		If Type('thisform.clb_zi_curs.visible')<>'U'
		*!*	modificare	v 2.0.56	^
			poDate.zi_curs = poDate.dataact
			Thisform.clb_zi_curs.Refresh()
		*!*	modificare	v 2.0.56
		Endif
		*!*	modificare	v 2.0.56	^
		
	ENDPROC

	PROCEDURE Clb_dataireg.Text_simplu1.LostFocus
		poDate.dataact = poDate.dataireg
		Thisform.clb_dataact.Refresh()
		*!*	modificare	v 2.2.4	:	daca scadenta nu e automata, atunci poate modifica data scadenta propusa
		*!*	poDate.datascad	= Iif(gnScadentaAutomata=0,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
		poDate.datascad	= Iif(gnZileScadentaFact=-1,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
		*!*	modificare	v 2.2.4	^
		Thisform.clb_data_scadenta.Refresh()
		*!*	modificare	v 2.0.56
		If Type('thisform.clb_zi_curs.visible')<>'U'
		*!*	modificare	v 2.0.56	^
			poDate.zi_curs = poDate.dataact
			Thisform.clb_zi_curs.Refresh()
		*!*	modificare	v 2.0.56
		Endif
		*!*	modificare	v 2.0.56	^
	ENDPROC

	PROCEDURE Clb_nract.Text_simplu1.LostFocus
		poDate.nract = this.value
	ENDPROC

	PROCEDURE Clb_serie_act.Text_simplu1.LostFocus
		*!* 03.02.2015
		*!* marius.mutu
		*!* sa se genereze numar din plaja, chiar daca nu exista serie (BON FISCAL)
		IF poDate.rezultat_serii = 2 && CU PLAJE, FARA SERIE
			This.Parent.genereazaNumar()
		ENDIF 
	ENDPROC

	PROCEDURE Ct_clb_fdoc._combobox1.Init
		LOCAL lcTipDoc
		lcTipDoc = IIF(poDate.nIdTipDoc = poDate.nIdTipDocFactura, 'FACTURA', ;
			IIF(poDate.nIdTipDoc = poDate.nIdTipDocProforma, 'PROFORMA', ;
			IIF(poDate.nIdTipDoc = poDate.nIdTipDocBonFiscal, 'BON FISCAL', ;
			IIF(poDate.nIdTipDoc = poDate.nIdTipDocAviz, 'AVIZ', 'FACTURA'))))
		THIS.Value = m.lcTipDoc
		
		
	ENDPROC

	PROCEDURE Ct_clb_fdoc._combobox1.LostFocus
		thisform.do_schimba_tipdoc()
	ENDPROC

	PROCEDURE Ed_tx_simplu1._EDBASE1.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 13 && ENTER
			NODEFAULT 
			thisform.but_terMIN1.SetFocus()
		ENDIF 
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_emitere_dispozitii 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="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cDataora.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cDataora.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cUtilizator.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cUtilizator.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cAltele.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cAltele.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cCod.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cCod.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cNumar_act.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cNumar_act.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cExplicatie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cExplicatie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cClient.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cClient.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cSelectat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cSelectat._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cDiscount.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cDiscount.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cDiscount_evidentiat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cDiscount_evidentiat._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cDelegat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cDelegat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cNume_agent.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cNume_agent.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cNrinmat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cNrinmat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cText_aditional.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cText_aditional.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cTotal_cu_tva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cTotal_cu_tva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cTotal_fara_tva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cTotal_fara_tva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cTotal_tva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cTotal_tva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cData_act.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cData_act.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cSerie_act.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grid_facturi.cSerie_act.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_client" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_explicatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_numar_act" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_utilizator" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_dataora" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_data_act" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_delegat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_agent" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_executa1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_executa2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_executa3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_select_adv1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_serie_act" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: actualizeaza_selectate
		*m: do_listeaza_borderou
		*m: do_listeaza_disp
		*m: do_listeaza_disp_det
		*m: do_select
		*p: cfiltru_initial
		*p: ndetalii
		*p: nvanzari
	*</DefinedPropArrayMethod>

	*<PropValue>
		cbuton2 = but_listare1;cmd_executa1;cmd_executa2;cmd_executa3;
		cfiltru_initial = 
		cgridsortlist = grid_facturi
		DoCreate = .T.
		Height = 576
		Name = "frm_emitere_dispozitii"
		ndetalii = 0
		nvanzari = 0
		Width = 769
		WindowState = 2
		_shape1.Anchor = 11
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 768
		_shape1.ZOrderSet = 1
		_shape2.Anchor = 9
		_shape2.Height = 29
		_shape2.Left = 732
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 37
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "LISTĂ FACTURI ȘI AVIZE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 13
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 735
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 12
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Left = 192
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 6
	*</PropValue>

	ADD OBJECT '_shape3' AS _shape WITH ;
		Anchor = 10, ;
		BackStyle = 0, ;
		Height = 40, ;
		Left = 6, ;
		Name = "_shape3", ;
		Top = 35, ;
		Width = 744, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'Ck_agent' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		camp_nume = nume_agent, ;
		Caption = "Agent", ;
		FontName = "Arial Narrow", ;
		Left = 266, ;
		Name = "Ck_agent", ;
		TabIndex = 7, ;
		Top = 36
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_client' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		camp_nume = client, ;
		Caption = "Partener", ;
		FontName = "Arial Narrow", ;
		Left = 95, ;
		Name = "Ck_client", ;
		TabIndex = 4, ;
		Top = 55
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_data_act' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		camp_nume = data_act, ;
		Caption = "Data act", ;
		Left = 14, ;
		Name = "Ck_data_act", ;
		TabIndex = 1, ;
		tip = D, ;
		Top = 36, ;
		Value = 1, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_dataora' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		camp_nume = dataora, ;
		Caption = "Dataora introducerii", ;
		Left = 381, ;
		Name = "Ck_dataora", ;
		TabIndex = 9, ;
		tip = T, ;
		Top = 36, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_delegat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		camp_nume = delegat, ;
		Caption = "Delegat", ;
		FontName = "Arial Narrow", ;
		Left = 185, ;
		Name = "Ck_delegat", ;
		TabIndex = 6, ;
		Top = 55
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_explicatie' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		camp_nume = explicatie, ;
		Caption = "Explicație", ;
		FontName = "Arial Narrow", ;
		Left = 185, ;
		Name = "Ck_explicatie", ;
		TabIndex = 5, ;
		Top = 36
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_numar_act' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		camp_nume = NUMAR_ACT, ;
		Caption = "Nr. act", ;
		FontName = "Arial Narrow", ;
		Left = 14, ;
		mask = (replicate('9',15)), ;
		Name = "Ck_numar_act", ;
		TabIndex = 2, ;
		Top = 55
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_serie_act' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		camp_nume = serie_act, ;
		Caption = "Serie act", ;
		FontName = "Arial Narrow", ;
		Left = 95, ;
		Name = "Ck_serie_act", ;
		TabIndex = 3, ;
		Top = 36
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_utilizator' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		camp_nume = utilizator, ;
		Caption = "Operator introducere", ;
		FontCharSet = 238, ;
		FontName = "Arial Narrow", ;
		Left = 266, ;
		Name = "Ck_utilizator", ;
		TabIndex = 8, ;
		Top = 55, ;
		ZOrderSet = 13
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Anchor = 8, ;
		Left = 561, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 10, ;
		Top = 41, ;
		ZOrderSet = 12
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_executa1' AS cmd_executa WITH ;
		Anchor = 6, ;
		caction = do_listeaza_disp, ;
		Caption = "\<Listează dispoziții de livrare", ;
		Height = 48, ;
		Left = 156, ;
		Name = "Cmd_executa1", ;
		TabIndex = 17, ;
		Top = 516, ;
		Width = 132, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_executa2' AS cmd_executa WITH ;
		Anchor = 6, ;
		caction = do_listeaza_disp_det, ;
		Caption = "Listează \<dispoziție de livrare detaliată", ;
		Height = 48, ;
		Left = 312, ;
		Name = "Cmd_executa2", ;
		TabIndex = 15, ;
		Top = 516, ;
		Width = 132, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_executa3' AS cmd_executa WITH ;
		Anchor = 6, ;
		caction = do_listeaza_borderou, ;
		Caption = "Listează \<borderou de încasări", ;
		Height = 48, ;
		Left = 468, ;
		Name = "Cmd_executa3", ;
		TabIndex = 16, ;
		Top = 516, ;
		Width = 132, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Anchor = 8, ;
		Left = 657, ;
		Name = "Cmd_reset1", ;
		TabIndex = 14, ;
		Top = 41, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_select_adv1' AS cmd_select_adv WITH ;
		Anchor = 6, ;
		ccoloana = selectat, ;
		cgrid = thisform.grid_facturi, ;
		Height = 48, ;
		Left = 24, ;
		Name = "Cmd_select_adv1", ;
		TabIndex = 18, ;
		Top = 516
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grid_facturi' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 19, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		HeaderHeight = 34, ;
		Height = 417, ;
		HighlightStyle = 2, ;
		Left = 11, ;
		Name = "grid_facturi", ;
		Panel = 1, ;
		RecordSource = "crsFacturi", ;
		TabIndex = 11, ;
		Top = 87, ;
		Width = 744, ;
		ZOrderSet = 6, ;
		Column1.ColumnOrder = 18, ;
		Column1.ControlSource = "dataora", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cDataora", ;
		Column1.Width = 86, ;
		Column2.ColumnOrder = 17, ;
		Column2.ControlSource = "utilizator", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cUtilizator", ;
		Column2.Width = 99, ;
		Column3.ColumnOrder = 9, ;
		Column3.ControlSource = "altele", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cAltele", ;
		Column3.Width = 96, ;
		Column4.ColumnOrder = 19, ;
		Column4.ControlSource = "cod", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Name = "cCod", ;
		Column4.Width = 81, ;
		Column5.ColumnOrder = 5, ;
		Column5.ControlSource = "numar_act", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Name = "cNumar_act", ;
		Column5.Width = 68, ;
		Column6.ColumnOrder = 6, ;
		Column6.ControlSource = "explicatie", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Name = "cExplicatie", ;
		Column6.Width = 119, ;
		Column7.ColumnOrder = 4, ;
		Column7.ControlSource = "client", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cClient", ;
		Column7.Width = 112, ;
		Column8.ColumnOrder = 1, ;
		Column8.ControlSource = "selectat", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "cSelectat", ;
		Column8.Sparse = .F., ;
		Column8.Width = 41, ;
		Column9.ColumnOrder = 10, ;
		Column9.ControlSource = "discount", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.InputMask = (get_mask(14,gnPc)), ;
		Column9.Name = "cDiscount", ;
		Column9.Width = 83, ;
		Column10.ColumnOrder = 16, ;
		Column10.ControlSource = "discount_evidentiat", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.Name = "cDiscount_evidentiat", ;
		Column10.Sparse = .F., ;
		Column10.Width = 86, ;
		Column11.ColumnOrder = 8, ;
		Column11.ControlSource = "delegat", ;
		Column11.FontName = "Arial Narrow", ;
		Column11.Name = "cDelegat", ;
		Column12.ColumnOrder = 7, ;
		Column12.ControlSource = "nume_agent", ;
		Column12.FontName = "Arial Narrow", ;
		Column12.Name = "cNume_agent", ;
		Column12.Width = 67, ;
		Column13.ColumnOrder = 14, ;
		Column13.ControlSource = "nrinmat", ;
		Column13.FontName = "Arial Narrow", ;
		Column13.Name = "cNrinmat", ;
		Column13.Width = 57, ;
		Column14.ColumnOrder = 15, ;
		Column14.ControlSource = "text_aditional", ;
		Column14.FontName = "Arial Narrow", ;
		Column14.Name = "cText_aditional", ;
		Column15.ColumnOrder = 13, ;
		Column15.ControlSource = "total_cu_tva", ;
		Column15.FontName = "Arial Narrow", ;
		Column15.InputMask = (get_mask(14,gnPc)), ;
		Column15.Name = "cTotal_cu_tva", ;
		Column16.ColumnOrder = 11, ;
		Column16.ControlSource = "total_fara_tva", ;
		Column16.FontName = "Arial Narrow", ;
		Column16.InputMask = (get_mask(14,gnPc)), ;
		Column16.Name = "cTotal_fara_tva", ;
		Column16.Width = 88, ;
		Column17.ColumnOrder = 12, ;
		Column17.ControlSource = "total_tva", ;
		Column17.FontName = "Arial Narrow", ;
		Column17.InputMask = (get_mask(14,gnPc)), ;
		Column17.Name = "cTotal_tva", ;
		Column17.Width = 83, ;
		Column18.ColumnOrder = 2, ;
		Column18.ControlSource = "data_act", ;
		Column18.FontName = "Arial Narrow", ;
		Column18.Name = "cData_act", ;
		Column19.ColumnOrder = 3, ;
		Column19.ControlSource = "serie_act", ;
		Column19.FontName = "Arial Narrow", ;
		Column19.Name = "cSerie_act", ;
		Column19.Width = 59
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

	ADD OBJECT 'grid_facturi.cAltele.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 'grid_facturi.cClient.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Partener", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cClient.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 'grid_facturi.cCod.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cCod.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 'grid_facturi.cData_act.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data act", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cData_act.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 'grid_facturi.cDataora.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Dataora introducerii", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cDataora.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 'grid_facturi.cDelegat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Delegat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cDelegat.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 'grid_facturi.cDiscount.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount pe factura", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cDiscount.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 'grid_facturi.cDiscount_evidentiat._checkbox1' AS _checkbox WITH ;
		Alignment = 2, ;
		AutoSize = .F., ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial Narrow", ;
		Left = 49, ;
		Name = "_checkbox1", ;
		Top = 50
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'grid_facturi.cDiscount_evidentiat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount evidentiat pe factura", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grid_facturi.cExplicatie.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 'grid_facturi.cNrinmat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Masina", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cNrinmat.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 'grid_facturi.cNumar_act.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Numar act", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cNumar_act.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 'grid_facturi.cNume_agent.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Agent", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cNume_agent.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 'grid_facturi.cSelectat._checkbox1' AS _checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial Narrow", ;
		Left = 31, ;
		Name = "_checkbox1", ;
		Top = 43
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

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

	ADD OBJECT 'grid_facturi.cSerie_act.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie act", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cSerie_act.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 'grid_facturi.cText_aditional.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Text aditional", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cText_aditional.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 'grid_facturi.cTotal_cu_tva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Total cu TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cTotal_cu_tva.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 'grid_facturi.cTotal_fara_tva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Total fara TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cTotal_fara_tva.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 'grid_facturi.cTotal_tva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Total TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cTotal_tva.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 'grid_facturi.cUtilizator.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Operator introducere", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grid_facturi.cUtilizator.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 actualizeaza_grid1
		Lparameters lcFiltru
		If Empty(lcFiltru)
			lcFiltru = pofacturi.ca_baza1.cfiltru
		Endif
		Thisform.MousePointer = 11
		Thisform.LockScreen = .T.
		Select * From crsfacturi With (Buffering = .T.) Where selectat=1 Into Cursor crstempfacturi Readwrite
		lnSelectate=Reccount('crstempfacturi')
		
		save_grid_tag(Thisform.grid_facturi)
		pofacturi.ca_baza1.cfiltru = lcFiltru
		pofacturi.ca_baza1.afisare()
		lcOrder=pofacturi.ca_baza1.corder
		Insert Into crstempfacturi Select * From crsfacturi Where id_vanzare Not In (Select id_vanzare From crstempfacturi)
		Select crstempfacturi
		If Used('crsfacturi')
			Use In crsfacturi
		Endif
		lcComanda=[Select * From crstempfacturi order by selectat desc,]+lcOrder+[ Into Cursor crsfacturi readwrite]
		&lcComanda
		This.actualizeaza_selectate(lnSelectate)
		If Used('crstempfacturi')
			Use In crstempfacturi
		Endif
		
		restore_grid_tag(Thisform.grid_facturi)
		Thisform.LockScreen = .F.
		Thisform.MousePointer = 0
		If Reccount('crsFacturi')>0
			Thisform.grid_facturi.SetFocus()
		Endif
	ENDPROC

	PROCEDURE actualizeaza_selectate
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		lcFiltru = [sters=0] + gcCondSucursala
		
		If Thisform.ck_data_act.Value=1
			lcFiltru = lcFiltru + Thisform.ck_data_act.filtru
		Endif
		
		If Thisform.ck_dataora.Value=1
			lcFiltru = lcFiltru + Thisform.ck_dataora.filtru
		Endif
		
		If Thisform.ck_numar_act.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_numar_act.filtru
		Endif
		
		If Thisform.ck_serie_act.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_serie_act.filtru
		Endif
		
		If Thisform.ck_utilizator.Value=1
			lcFiltru = lcFiltru + Thisform.ck_utilizator.filtru
		Endif
		
		If Thisform.ck_explicatie.Value=1
			lcFiltru = lcFiltru + Thisform.ck_explicatie.filtru
		Endif
		
		If Thisform.ck_client.Value=1
			lcFiltru = lcFiltru + Thisform.ck_client.filtru
		Endif
		
		If Thisform.ck_agent.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_agent.filtru
		Endif
		
		If Thisform.ck_delegat.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_delegat.filtru
		Endif
		
		* inregistrari sterse
		*!*	Do Case
		*!*	Case Thisform.opt_sterse.Value = 2
		*!*		lcFiltru = lcFiltru + [ and STERS=1]
		*!*	Case Thisform.opt_sterse.Value = 3
		*!*	lcFiltru = lcFiltru + [ and STERS=0]
		*!*	Endcase
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crsFacturi')=0
			aMessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_dataora.SetFocus()
		Else
			Thisform.grid_facturi.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_listeaza_borderou
		If Thisform.lactiv2
			Private pniesire,poRec,pcListaId
			pniesire=0
			If Used('crstemplivrare')
				Use In crstemplivrare
			Endif
			If Used('crstemp')
				Use In crstemp
			Endif
			Select * From crsfacturi Where selectat=1 Order By client Into Cursor crstemplivrare Readwrite
			If Reccount('crstemplivrare')=0
				amessagebox("Selectati cel putin o factura!",0+48,"Atentie")
				Use In crstemplivrare
				Return
			Endif
		
			Select crstemplivrare
			Go Top
			Select Distinct delegat From crstemplivrare Into Cursor crstemp
			If Reccount('crstemp') = 1
				Private pcDataOra, pdData
				pcDataOra = get_ora(2)
				pdData = Ttod(Ctot(pcDataOra))
				Select crstemp
				Scatter Name poRec Blank
				This.AlwaysOnTop=.F.
		*!*		modificare v 2.0.46
		*!*			Local loExport
		*!*			loExport = Createobject("oExportConfig")
		*!*			lnVizualizare = 1
		*!*			loExport.listareUserReport("crstemplivrare","FRX","borderou_incasari",lnVizualizare,"RAPORT")
		*!*			Release loExport
				goExport.export2frx("crstemplivrare","borderou_incasari",.F.,1,"RAPORT")	&&	, , , .T.)
		*!*		modificare v 2.0.46	^
		*!*		Select crstemplivrare
		*!*		Keyboard "{CTRL+F10}"
		*!*		Report Form borderou_incasari To Printer Prompt Preview
				This.AlwaysOnTop=.T.
			Else
				amessagebox("Trebuie sa alegeti facturile pentru un singur delegat!",0+48,"Atentie")
			Endif
			Use In crstemplivrare
			Use In crstemp
			Thisform.grid_facturi.SetFocus()
			Release poRec
		Endif
	ENDPROC

	PROCEDURE do_listeaza_disp
		If Thisform.lactiv2
			Private pniesire,poRec,pcListaId
			pniesire=0
			If Used('crstemplivrare')
				Use In crstemplivrare
			Endif
			If Used('crstemp')
				Use In crstemp
			Endif
			Select * From crsfacturi Where selectat=1 Into Cursor crstemplivrare Readwrite
			If Reccount('crstemplivrare')=0
				amessagebox("Selectati cel putin o factura!",0+48,"Atentie")
				Use In crstemplivrare
				Return
			Endif
		
			Select crstemplivrare
			Scatter Name poRec Blank
			poRec.delegat = []
			AddProperty(poRec,"responsabil",[])
			AddProperty(poRec,"gestiune",[])
			AddProperty(poRec,"id_gestiune_livr",0)
			lnNrDelegati = 0
			pcListaId = []
			Scan
				lcDelegat = Upper(Alltrim(delegat))
				If !Empty(lcDelegat) And poRec.delegat <> lcDelegat
					poRec.delegat = lcDelegat
					lnNrDelegati = lnNrDelegati + 1
				Endif
				pcListaId = pcListaId + Alltrim(Str(id_vanzare)) + [,]
			Endscan
		
			If lnNrDelegati <> 1
				poRec.delegat = []
			Endif
			pcListaId = Substr(pcListaId,1,Len(pcListaId)-1)
			ofrmlivrare=Createobject('frm_date_dispozitie')
			ofrmlivrare.Show(1)
		
			If pniesire=1
				lcSql = [select b.denumire,a.serie,b.um,sum(a.cantitate) as cantitate,d.denumire as responsabil from ] + gcS+ [.vanzari_detalii a ] + ;
					[left join ] + gcS + [.nom_articole b on a.id_articol = b.id_articol ] + ;
					[left join ] + gcS + [.nom_gestiuni c on a.id_gestiune = c.id_gestiune ] + ;
					[left join ] + gcS + [.nom_parteneri d on c.id_responsabil = d.id_part ] + ;
					[where a.sters = 0 and a.id_vanzare in (] + pcListaId + [) and a.id_gestiune = ?poRec.id_gestiune_livr ] + ;
					[group by b.denumire,a.serie,b.um,d.denumire]
				lnSucces = goExecutor.oExecute(lcSql,[crscentralizator])
				If lnSucces<0
					amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				Endif
				If Reccount('crscentralizator')>0
					Private pcDataOra, pcText
					pcText = []
					pcDataOra=get_ora(2)
					Select crscentralizator
					poRec.responsabil = responsabil
					This.AlwaysOnTop=.F.
		*!*	modificare v 2.0.46
		*!*				Local loExport
		*!*				loExport = Createobject("oExportConfig")
		*!*				lnVizualizare = 1
		*!*				loExport.listareUserReport("crscentralizator","FRX","centralizator_livrare",lnVizualizare,"RAPORT")
		*!*				Release loExport
					goExport.export2frx("crscentralizator","centralizator_livrare",.F.,1,"RAPORT")	&&	, , , .T.)
		*!*	modificare v 2.0.46	^
		*!*			Select crscentralizator
		*!*			Keyboard "{CTRL+F10}"
		*!*			Report Form centralizator_livrare To Printer Prompt Preview
					This.AlwaysOnTop=.T.
				Else
					amessagebox("Nu exista articole din gestiunea "+Upper(Alltrim(poRec.gestiune))+" pe facturile selectate!",0+48,"Atentie")
				Endif
		
				If Used('crscentralizator')
					Use In crscentralizator
				Endif
		
			Endif
			Use In crstemplivrare
			Thisform.grid_facturi.SetFocus()
			Release poRec
		Endif
	ENDPROC

	PROCEDURE do_listeaza_disp_det
		If Thisform.lactiv2
			Private pniesire,poRec,pcListaId
			pniesire=0
			If Used('crstemplivrare')
				Use In crstemplivrare
			Endif
			If Used('crstemp')
				Use In crstemp
			Endif
			Select * From crsfacturi Where selectat=1 Into Cursor crstemplivrare Readwrite
			If Reccount('crstemplivrare')=0
				amessagebox("Selectati cel putin o factura!",0+48,"Atentie")
				Use In crstemplivrare
				Return
			Endif
		
			Select crstemplivrare
			Scatter Name poRec Blank
			poRec.delegat = []
			AddProperty(poRec,"responsabil",[])
			AddProperty(poRec,"gestiune",[])
			AddProperty(poRec,"id_gestiune_livr",0)
			lnNrDelegati = 0
			pcListaId = []
			Scan
				lcDelegat = Upper(Alltrim(delegat))
				If !Empty(lcDelegat) And poRec.delegat <> lcDelegat
					poRec.delegat = lcDelegat
					lnNrDelegati = lnNrDelegati + 1
				Endif
				pcListaId = pcListaId + Alltrim(Str(id_vanzare)) + [,]
			Endscan
		
			If lnNrDelegati <> 1
				poRec.delegat = []
			Endif
			pcListaId = Substr(pcListaId,1,Len(pcListaId)-1)
			ofrmlivrare=Createobject('frm_date_dispozitie')
			ofrmlivrare.Show(1)
		
			If pniesire=1
				lcSql = [select a.id_part,c.denumire,c.um,b.serie,sum(b.cantitate) as cantitate,d.denumire as nume_client,] + ;
					[f.denumire as responsabil ] + ;
					[from ] + gcS + [.vanzari a ] + ;
					[left join ] + gcS + [.vanzari_detalii b on a.id_vanzare = b.id_vanzare ] + ;
					[left join ] + gcS + [.nom_articole c on b.id_articol = c.id_articol ] + ;
					[left join ] + gcS + [.nom_parteneri d on a.id_part = d.id_part ] + ;
					[left join ] + gcS + [.nom_gestiuni e on b.id_gestiune = e.id_gestiune ] + ;
					[left join ] + gcS + [.nom_parteneri f on e.id_responsabil = f.id_part ] + ;
					[where a.id_vanzare in (] + pcListaId + [) and b.sters = 0 and b.id_gestiune = ?poRec.id_gestiune_livr ] + ;
					[group by a.id_part,d.denumire,c.denumire,c.um,b.serie,f.denumire order by d.denumire]
				lnSucces = goExecutor.oExecute(lcSql,[crscentralizator])
				If lnSucces<0
					amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				Endif
				If Reccount('crscentralizator')>0
					Private pcDataOra, pcText
					pcText = []
					pcDataOra=get_ora(2)
					This.AlwaysOnTop=.F.
					Select crscentralizator
					poRec.responsabil = responsabil
		*!*	modificare v 2.0.46
		*!*				Local loExport
		*!*				loExport = Createobject("oExportConfig")
		*!*				lnVizualizare = 1
		*!*				loExport.listareUserReport("crscentralizator","FRX","detalii_livrare",lnVizualizare,"RAPORT")
		*!*				Release loExport
					goExport.export2frx("crscentralizator","detalii_livrare",.F.,1,"RAPORT")	&&	, , , .T.)
		*!*	modificare v 2.0.46	^
		*!*			Keyboard "{CTRL+F10}"
		*!*			Report Form detalii_livrare To Printer Prompt Preview
					This.AlwaysOnTop=.T.
				Else
					amessagebox("Nu exista articole din gestiunea "+Upper(Alltrim(poRec.gestiune))+" pe facturile selectate!",0+48,"Atentie")
				Endif
		
				If Used('crscentralizator')
					Use In crscentralizator
				Endif
		
			Endif
			Use In crstemplivrare
			Thisform.grid_facturi.SetFocus()
			Release poRec
		Endif
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		*!*	Thisform.ck_dataora.Value = 1
		*!*	Thisform.ck_dataora.filtru = Thisform.cfiltru_initial
		*!*	Thisform.ck_dataora.SetFocus()
		Thisform.ck_data_act.Value = 1
		Thisform.ck_data_act.filtru = Thisform.cfiltru_initial
		Thisform.ck_data_act.SetFocus()
	ENDPROC

	PROCEDURE do_select
	ENDPROC

	PROCEDURE Init
		If glLunaInchisa
			gcAcces=Strtran(gcAcces,[4;],[])	&&	nu are drept de stergere
			Thisform.but_sterge1.Visible = .F.
		Endif
		DoDefault()
		lcData = Alltrim(Str(gnAn)) + Padl(Alltrim(Str(gnLuna)),2,[0]) + [01]
		*!*	lcFiltruInitial = [ and dataora between ] + ;
		*!*		[(case when months_between(trunc(sysdate),to_date('] + lcData + [ 00:00:00','YYYYMMDD HH24:MI:SS'))<1 ] + ;
		*!*		[then trunc(sysdate) else to_date('] + lcData + [ 00:00:00','YYYYMMDD HH24:MI:SS') end) ] + ;
		*!*		[and least(last_day(to_date('] + lcData + [ 23:59:59','YYYYMMDD HH24:MI:SS')),sysdate) ]
		lcFiltruInitial = [ and data_act between ] + ;
			[(case when months_between(trunc(sysdate),to_date('] + lcData + [','YYYYMMDD'))<1 ] + ;
			[then trunc(sysdate) else to_date('] + lcData + [','YYYYMMDD') end) ] + ;
			[and least(last_day(to_date('] + lcData + [','YYYYMMDD')),sysdate) ]
		Thisform.cfiltru_initial = lcFiltruInitial
		*!*	Thisform.ck_dataora.filtru = lcFiltruInitial
		Thisform.ck_data_act.filtru = lcFiltruInitial
	ENDPROC

	PROCEDURE grid_facturi.Init
		This.SetAll("ReadOnly",.T.,"Column")
		This.cselectat.ReadOnly=.F.
		For i = 1 To This.ColumnCount
			lcColor='this.Columns(' + Alltrim(Str(i)) + ').DynamicBackColor'
			lcControlSource1 = 'this.Columns(' + Alltrim(Str(i)) + ').controlsource'
			lcControlSource = &lcControlSource1
			lcSet = lcColor + [ = "IIF(ISNULL(] + lcControlSource + [),RGB(255,255,225),RGB(255,255,255))"]
			&lcSet
		Endfor
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_facturare_articole 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="Lb_nract" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cArticol.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cArticol.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cGestionabil.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cGestionabil._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCodmat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCodmat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPret.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPret.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPreturi_cu_tva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPreturi_cu_tva._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPret_val.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPret_val.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cNume_val.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cNume_val.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPolitici_preturi.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cPolitici_preturi.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cSerie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cSerie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCodbare.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_articole.cCodbare.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cValdiminuatctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cValdiminuatctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDiscountCTva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDiscountCTva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretFtva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretFtva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cSerie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cSerie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVpretftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVpretftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVdiscountftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVdiscountftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVvaldiminuatftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVvaldiminuatftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.Column11.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.Column11.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cLot.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cLot.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_urmator1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_urmator2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_data_scadenta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtDataScadenta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_articolelista" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtArticoleLista" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cCurs.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cCurs.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cNume_val.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cNume_val.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cMultiplicator.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cMultiplicator.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_cursuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cb_contracte" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_contracte" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cb_politici_preturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_politici_preturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_discountevidentiat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount.Procent" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount.Lb_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_baza" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtArticole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_codmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtCodmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ct_codmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ct_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_urmator_tot1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cArticol.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cArticol.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cGestionabil.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cGestionabil._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cCodmat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cCodmat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cPret.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cPret.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cPreturi_cu_tva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cPreturi_cu_tva._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cPret_val.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cPret_val.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cNume_val.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cNume_val.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cNumar_contract.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cNumar_contract.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cCodbare.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_contracte.cCodbare.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_total_mod" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_retur" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: actualizeaza_total_mod
		*m: do_adauga_articol
		*m: do_adauga_rata
		*m: do_adauga_tot
		*m: do_alege_stoc
		*m: do_calculeaza_discount
		*m: do_calculeaza_totaluri
		*m: do_creeaza_filtru
		*m: do_initializeaza_articol
		*m: do_retur
		*m: do_scrie_articole
		*m: do_scrie_factura
		*m: do_scrie_proforma
		*m: do_urmator2
		*m: do_verifica_articol
		*m: modifica_lista_preturi
		*p: clistaidarticoleretur		&& Lista articole retur id_articol:id_vanzare,id_articol:id_vanzare
		*p: cmesaj_cantitate
		*p: cnewvalue
		*p: coldvalue
		*p: nbazafdiscount
		*p: nbazafdiscountval
		*p: nbazaron
		*p: nbazaval
		*p: ncritcod		&& Criteriul initial de cautare dupa cod material.
		*p: ncritdenumire		&& Criteriul initial de cautare dupa denumire.
		*p: ndiscfactron
		*p: ndiscfactval
		*p: ndiscron
		*p: ndiscval
		*p: nid
		*p: nnrinregvizibile		&& Numarul de inregistrari vizibile in gridul cu elementele facturii.
		*p: nproc_disc_mem		&& Procentul de discount memorat.
		*p: nproc_tvav
		*p: ntotalron
		*p: ntotalval
		*p: ntvaron
		*p: ntvaval
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grd_articole,grd_factura,grd_contracte
		clistaidarticoleretur = 
		cmesaj_cantitate = .F.
		cnewvalue = 
		coldvalue = 
		DoCreate = .T.
		Height = 586
		Name = "frm_facturare_articole"
		nbazafdiscount = 0
		nbazafdiscountval = 0
		nbazaron = 0
		nbazaval = 0
		ncritcod = 2
		ncritdenumire = 2
		ndiscfactron = 0
		ndiscfactval = 0
		ndiscron = 0
		ndiscval = 0
		nnrinregvizibile = 16
		nproc_disc_mem = 0
		nproc_tvav = 0
		ntotalron = 0
		ntotalval = 0
		ntvaron = 0
		ntvaval = 0
		Width = 850
		WindowState = 2
		_memberdata = <VFPData>
			<memberdata name="clistaidarticoleretur" display="cListaIdArticoleRetur"/>
			<memberdata name="ncritdenumire" display="nCritDenumire"/>
			<memberdata name="ncritcod" display="nCritCod"/>
		</VFPData>
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 850
		_shape1.ZOrderSet = 1
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 791
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "FACTURA"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 22
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 821
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 20
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Left = 744
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 36
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 792, ;
		Name = "But_renunt1", ;
		TabIndex = 21, ;
		Top = 1, ;
		Width = 30, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_reset1' AS but_reset WITH ;
		Left = 303, ;
		Name = "But_reset1", ;
		TabIndex = 35, ;
		Top = 295, ;
		ZOrderSet = 32
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_retur' AS but_retur WITH ;
		Anchor = 8, ;
		Left = 343, ;
		Name = "But_retur", ;
		Top = 407, ;
		Visible = .F.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Anchor = 9, ;
		Left = 811, ;
		Name = "But_sterge1", ;
		TabIndex = 14, ;
		Top = 61
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_urmator1' AS but_urmator WITH ;
		Anchor = 8, ;
		caction = do_urmator, ;
		Left = 343, ;
		Name = "But_urmator1", ;
		TabIndex = 10, ;
		Top = 348, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_urmator2' AS but_urmator WITH ;
		Anchor = 8, ;
		caction = do_urmator2, ;
		Left = 343, ;
		Name = "But_urmator2", ;
		TabIndex = 2, ;
		Top = 143, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_urmator_tot1' AS but_urmator_tot WITH ;
		Anchor = 8, ;
		caction = do_adauga_tot, ;
		Left = 343, ;
		Name = "But_urmator_tot1", ;
		Picture = ..\grafice\urmator1_tot.bmp, ;
		TabIndex = 11, ;
		Top = 378, ;
		Visible = .F., ;
		ZOrderSet = 31
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cb_contracte' AS combobox WITH ;
		ColumnCount = 1, ;
		ColumnLines = .F., ;
		ColumnWidths = "200,65,65", ;
		Height = 24, ;
		Left = 69, ;
		Name = "cb_contracte", ;
		RowSourceType = 2, ;
		Style = 2, ;
		TabIndex = 3, ;
		Top = 34, ;
		Width = 220, ;
		ZOrderSet = 15
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'cb_politici_preturi' AS combobox WITH ;
		ColumnCount = 1, ;
		ColumnLines = .F., ;
		ColumnWidths = "200,65,65", ;
		FontSize = 10, ;
		Height = 24, ;
		Left = 115, ;
		Name = "cb_politici_preturi", ;
		RowSourceType = 2, ;
		Style = 2, ;
		TabIndex = 4, ;
		Top = 262, ;
		Width = 220, ;
		ZOrderSet = 15
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'ck_discountevidentiat' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 12, ;
		AutoSize = .F., ;
		Caption = "Se pune in evidenta discount-ul pe articole in notele contabile si pe factura", ;
		ControlSource = "poDate.discount_evidentiat", ;
		Height = 18, ;
		Left = 379, ;
		Name = "ck_discountevidentiat", ;
		TabIndex = 32, ;
		Top = 435, ;
		Width = 447, ;
		WordWrap = .T., ;
		ZOrderSet = 17
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_discount' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 53, ;
		Left = 210, ;
		Name = "Clb_discount", ;
		TabIndex = 15, ;
		Top = 523, ;
		Width = 269, ;
		ZOrderSet = 20, ;
		TX_SUMA_VAL.ControlSource = "thisform.ndiscfactval", ;
		TX_SUMA_VAL.FontName = "Arial", ;
		TX_SUMA_VAL.Left = 25, ;
		TX_SUMA_VAL.Name = "TX_SUMA_VAL", ;
		TX_SUMA_VAL.Top = 27, ;
		TX_SUMA_VAL.Width = 80, ;
		LB_EXPLICATIE.Caption = "Discount pe factura (fara TVA)", ;
		LB_EXPLICATIE.FontCharSet = 1, ;
		LB_EXPLICATIE.FontName = "Arial", ;
		LB_EXPLICATIE.Left = 4, ;
		LB_EXPLICATIE.Name = "LB_EXPLICATIE", ;
		LB_EXPLICATIE.Top = 5, ;
		TX_SUMA_NAT.ControlSource = "thisform.ndiscfactron", ;
		TX_SUMA_NAT.FontName = "Arial", ;
		TX_SUMA_NAT.InputMask = (get_mask(14,gnPc)), ;
		TX_SUMA_NAT.Left = 146, ;
		TX_SUMA_NAT.Name = "TX_SUMA_NAT", ;
		TX_SUMA_NAT.Top = 27, ;
		TX_SUMA_NAT.Width = 80, ;
		LB_NUME_VAL.FontName = "Arial", ;
		LB_NUME_VAL.Left = 109, ;
		LB_NUME_VAL.Name = "LB_NUME_VAL", ;
		LB_NUME_VAL.Top = 30, ;
		LB_NUME_NAT.FontName = "Arial", ;
		LB_NUME_NAT.Left = 230, ;
		LB_NUME_NAT.Name = "LB_NUME_NAT", ;
		LB_NUME_NAT.Top = 30, ;
		lb_explicatii.Left = 151, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 5
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discount.Lb_simplu2' AS lb_simplu WITH ;
		Caption = "%", ;
		Left = 247, ;
		Name = "Lb_simplu2", ;
		TabIndex = 4, ;
		Top = 6
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'Clb_discount.Procent' AS _txbase WITH ;
		Alignment = 3, ;
		Format = "!K", ;
		Height = 23, ;
		InputMask = "9 999.99", ;
		Left = 185, ;
		Name = "Procent", ;
		TabIndex = 1, ;
		Top = 3, ;
		Value = 0, ;
		Width = 57
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'Clb_discount_articole' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 53, ;
		Left = 210, ;
		Name = "Clb_discount_articole", ;
		TabIndex = 34, ;
		Top = 471, ;
		Width = 269, ;
		ZOrderSet = 24, ;
		tx_suma_val.ControlSource = "thisform.ndiscval", ;
		tx_suma_val.FontName = "Arial", ;
		tx_suma_val.Left = 25, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 27, ;
		tx_suma_val.Width = 80, ;
		lb_explicatie.Caption = "Discount articole (fara TVA)", ;
		lb_explicatie.FontCharSet = 1, ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Left = 4, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 6, ;
		tx_suma_nat.ControlSource = "thisform.ndiscron", ;
		tx_suma_nat.FontName = "Arial", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 146, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 27, ;
		tx_suma_nat.Width = 80, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 110, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 30, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 230, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 30, ;
		lb_explicatii.Left = 154, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 6
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total_baza' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 30, ;
		Left = 478, ;
		Name = "Clb_total_baza", ;
		TabIndex = 17, ;
		Top = 471, ;
		Width = 364, ;
		ZOrderSet = 23, ;
		tx_suma_val.ControlSource = "thisform.nbazaval", ;
		tx_suma_val.FontName = "Arial", ;
		tx_suma_val.Left = 115, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 4, ;
		tx_suma_val.Width = 80, ;
		lb_explicatie.Caption = "Total (baza)", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Left = 4, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 7, ;
		tx_suma_nat.ControlSource = "thisform.nbazaron", ;
		tx_suma_nat.FontName = "Arial", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 240, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 4, ;
		tx_suma_nat.Width = 80, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 200, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 7, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 325, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 7, ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 80, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 7
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total_factura' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 47, ;
		Left = 478, ;
		Name = "Clb_total_factura", ;
		TabIndex = 33, ;
		Top = 529, ;
		Width = 364, ;
		ZOrderSet = 22, ;
		tx_suma_val.ControlSource = "thisform.ntotalval", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.FontName = "Arial", ;
		tx_suma_val.Left = 115, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 20, ;
		tx_suma_val.Width = 80, ;
		lb_explicatie.Caption = "TOTAL FACTURA", ;
		lb_explicatie.FontBold = .T., ;
		lb_explicatie.FontCharSet = 1, ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Left = 4, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 4, ;
		tx_suma_nat.ControlSource = "thisform.ntotalron", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.FontName = "Arial", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 240, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 20, ;
		tx_suma_nat.Width = 80, ;
		lb_nume_val.FontBold = .T., ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 200, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 23, ;
		lb_nume_nat.FontBold = .T., ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 325, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 23, ;
		lb_explicatii.FontCharSet = 1, ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 119, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total_tva' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 30, ;
		Left = 478, ;
		Name = "Clb_total_tva", ;
		TabIndex = 18, ;
		Top = 500, ;
		Width = 364, ;
		ZOrderSet = 21, ;
		tx_suma_val.ControlSource = "thisform.ntvaval", ;
		tx_suma_val.FontName = "Arial", ;
		tx_suma_val.Left = 115, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 4, ;
		tx_suma_val.Width = 80, ;
		lb_explicatie.Caption = "TVA", ;
		lb_explicatie.FontName = "Arial", ;
		lb_explicatie.Left = 4, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 7, ;
		tx_suma_nat.ControlSource = "thisform.ntvaron", ;
		tx_suma_nat.FontName = "Arial", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 240, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 4, ;
		tx_suma_nat.Width = 80, ;
		lb_nume_val.FontName = "Arial", ;
		lb_nume_val.Left = 200, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 7, ;
		lb_nume_nat.FontName = "Arial", ;
		lb_nume_nat.Left = 325, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 7, ;
		lb_explicatii.FontName = "Arial", ;
		lb_explicatii.Left = 80, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 7
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'ct_articole' AS criteriu_text WITH ;
		Height = 24, ;
		Left = 66, ;
		Name = "ct_articole", ;
		TabIndex = 7, ;
		Top = 310, ;
		Value = 1, ;
		Width = 84, ;
		ZOrderSet = 30
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'ct_codmat' AS criteriu_text WITH ;
		Height = 24, ;
		Left = 66, ;
		Name = "ct_codmat", ;
		TabIndex = 5, ;
		Top = 286, ;
		Width = 84, ;
		ZOrderSet = 29
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'grd_articole' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 11, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		Height = 130, ;
		HighlightStyle = 1, ;
		Left = 9, ;
		Name = "grd_articole", ;
		Panel = 1, ;
		RecordSource = "crsarticole", ;
		RowHeight = 19, ;
		TabIndex = 9, ;
		Top = 336, ;
		Width = 326, ;
		ZOrderSet = 7, ;
		Column1.ColumnOrder = 2, ;
		Column1.ControlSource = "denumire", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cArticol", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 214, ;
		Column2.ColumnOrder = 5, ;
		Column2.ControlSource = "gestionabil", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cGestionabil", ;
		Column2.ReadOnly = .T., ;
		Column2.Sparse = .F., ;
		Column2.Width = 68, ;
		Column3.ColumnOrder = 1, ;
		Column3.ControlSource = "codmat", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cCodmat", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 71, ;
		Column4.ColumnOrder = 4, ;
		Column4.ControlSource = "pret", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.InputMask = (get_mask(14,gnPPretV)), ;
		Column4.Name = "cPret", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 53, ;
		Column5.ColumnOrder = 6, ;
		Column5.ControlSource = "cantitate", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.InputMask = (get_mask(14,gnPcant)), ;
		Column5.Name = "cCantitate", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 59, ;
		Column6.ColumnOrder = 7, ;
		Column6.ControlSource = "preturi_cu_tva", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.Name = "cPreturi_cu_tva", ;
		Column6.ReadOnly = .T., ;
		Column6.Sparse = .F., ;
		Column6.Width = 62, ;
		Column7.ColumnOrder = 8, ;
		Column7.ControlSource = "pret_val", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.InputMask = (get_mask(14,gnPVal)), ;
		Column7.Name = "cPret_val", ;
		Column7.Width = 83, ;
		Column8.ColumnOrder = 9, ;
		Column8.ControlSource = "nume_val", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.Name = "cNume_val", ;
		Column8.Width = 49, ;
		Column9.ColumnOrder = 11, ;
		Column9.ControlSource = "nume_lista_preturi", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.Name = "cPolitici_preturi", ;
		Column9.Width = 149, ;
		Column10.ColumnOrder = 3, ;
		Column10.ControlSource = "serie", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.Name = "cSerie", ;
		Column10.Width = 98, ;
		Column11.ColumnOrder = 10, ;
		Column11.ControlSource = "codbare", ;
		Column11.FontName = "Arial", ;
		Column11.FontSize = 10, ;
		Column11.Name = "cCodbare", ;
		Column11.Width = 95
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grd_articole.cArticol.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Articol", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_articole.cArticol.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_articole.cCantitate.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cantitate", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_articole.cCantitate.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_articole.cCodbare.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod bare", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_articole.cCodbare.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_articole.cCodmat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod material", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_articole.cCodmat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_articole.cGestionabil._checkbox1' AS _checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Left = 22, ;
		Name = "_checkbox1", ;
		ReadOnly = .T., ;
		Top = 32
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'grd_articole.cGestionabil.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Gestionabil", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_articole.cNume_val.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valuta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cPolitici_preturi.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Politica de preturi", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cPret.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_articole.cPret.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_articole.cPret_val.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret in valuta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_articole.cPreturi_cu_tva._checkbox1' AS _checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Left = 23, ;
		Name = "_checkbox1", ;
		ReadOnly = .T., ;
		Top = 32
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'grd_articole.cPreturi_cu_tva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cu TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_articole.cSerie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_contracte' AS _grdrow WITH ;
		Anchor = 10, ;
		ColumnCount = 10, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		HeaderHeight = 36, ;
		Height = 199, ;
		HighlightStyle = 1, ;
		Left = 9, ;
		Name = "grd_contracte", ;
		Panel = 1, ;
		RecordSource = "crsarticole1", ;
		RowHeight = 19, ;
		TabIndex = 1, ;
		Top = 60, ;
		Width = 326, ;
		ZOrderSet = 33, ;
		Column1.ColumnOrder = 2, ;
		Column1.ControlSource = "denumire", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cArticol", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 253, ;
		Column2.ColumnOrder = 4, ;
		Column2.ControlSource = "gestionabil", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cGestionabil", ;
		Column2.ReadOnly = .T., ;
		Column2.Sparse = .F., ;
		Column2.Width = 65, ;
		Column3.ColumnOrder = 1, ;
		Column3.ControlSource = "codmat", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cCodmat", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 47, ;
		Column4.ColumnOrder = 3, ;
		Column4.ControlSource = "pret", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.InputMask = (get_mask(14,gnPPretV)), ;
		Column4.Name = "cPret", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 53, ;
		Column5.ColumnOrder = 5, ;
		Column5.ControlSource = "cantitate", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.InputMask = (get_mask(14,gnPcant)), ;
		Column5.Name = "cCantitate", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 101, ;
		Column6.ColumnOrder = 6, ;
		Column6.ControlSource = "preturi_cu_tva", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.Name = "cPreturi_cu_tva", ;
		Column6.ReadOnly = .T., ;
		Column6.Sparse = .F., ;
		Column6.Width = 50, ;
		Column7.ColumnOrder = 7, ;
		Column7.ControlSource = "pret_val", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.InputMask = (get_mask(14,gnPVal)), ;
		Column7.Name = "cPret_val", ;
		Column7.Width = 75, ;
		Column8.ColumnOrder = 8, ;
		Column8.ControlSource = "nume_val", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.Name = "cNume_val", ;
		Column8.Width = 44, ;
		Column9.ColumnOrder = 10, ;
		Column9.ControlSource = "numar_contract", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.Name = "cNumar_contract", ;
		Column9.Width = 100, ;
		Column10.ColumnOrder = 9, ;
		Column10.ControlSource = "codbare", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.Name = "cCodbare", ;
		Column10.Width = 74
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grd_contracte.cArticol.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Articol / rata", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_contracte.cArticol.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_contracte.cCantitate.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cantitate contractata", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_contracte.cCantitate.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_contracte.cCodbare.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod bare", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_contracte.cCodbare.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_contracte.cCodmat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod material", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_contracte.cCodmat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_contracte.cGestionabil._checkbox1' AS _checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Left = 22, ;
		Name = "_checkbox1", ;
		ReadOnly = .T., ;
		Top = 32
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'grd_contracte.cGestionabil.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Gestionabil", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_contracte.cNumar_contract.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Contract", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_contracte.cNume_val.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valuta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_contracte.cPret.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_contracte.cPret.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_contracte.cPret_val.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret in valuta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_contracte.cPreturi_cu_tva._checkbox1' AS _checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Left = 23, ;
		Name = "_checkbox1", ;
		ReadOnly = .T., ;
		Top = 32
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'grd_contracte.cPreturi_cu_tva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cu TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_cursuri' AS _grdrow WITH ;
		Anchor = 6, ;
		ColumnCount = 3, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		Height = 77, ;
		Left = 11, ;
		Name = "grd_cursuri", ;
		Panel = 1, ;
		RecordSource = "crscursuri", ;
		RowHeight = 19, ;
		ScrollBars = 2, ;
		TabIndex = 31, ;
		TabStop = .F., ;
		Top = 499, ;
		Width = 177, ;
		ZOrderSet = 13, ;
		Column1.ColumnOrder = 3, ;
		Column1.ControlSource = "curs", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.InputMask = (get_mask(14,gnPCurs)), ;
		Column1.Name = "cCurs", ;
		Column1.Width = 38, ;
		Column2.ColumnOrder = 2, ;
		Column2.ControlSource = "nume_val", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cNume_val", ;
		Column2.Width = 56, ;
		Column3.ColumnOrder = 1, ;
		Column3.ControlSource = "multiplicator", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.InputMask = (get_mask(10,0)), ;
		Column3.Name = "cMultiplicator", ;
		Column3.Width = 49
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grd_cursuri.cCurs.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Curs", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_cursuri.cMultiplicator.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Multiplicator", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_cursuri.cMultiplicator.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_cursuri.cNume_val.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valuta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura' AS _grdrow WITH ;
		Anchor = 13, ;
		ColumnCount = 12, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		HeaderHeight = 38, ;
		Height = 337, ;
		HighlightStyle = 1, ;
		Left = 379, ;
		Name = "grd_factura", ;
		Panel = 1, ;
		RecordSource = "crsfactura", ;
		RowHeight = 19, ;
		TabIndex = 12, ;
		Top = 96, ;
		Width = 464, ;
		ZOrderSet = 8, ;
		Column1.ColumnOrder = 2, ;
		Column1.ControlSource = "denumire", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cDenumire", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 148, ;
		Column2.ColumnOrder = 11, ;
		Column2.ControlSource = "valdiminuatctva", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.InputMask = (get_mask(14,gnPc)), ;
		Column2.Name = "cValdiminuatctva", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 102, ;
		Column3.ColumnOrder = 6, ;
		Column3.ControlSource = "pretctva", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.InputMask = (get_mask(14,gnPPretV)), ;
		Column3.Name = "cPretctva", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 69, ;
		Column4.ColumnOrder = 5, ;
		Column4.ControlSource = "cantitate", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.InputMask = (get_mask(14,gnPcant)), ;
		Column4.Name = "cCantitate", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 73, ;
		Column5.ColumnOrder = 9, ;
		Column5.ControlSource = "discountctva", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.InputMask = (get_mask(14,gnPPretV)), ;
		Column5.Name = "cDiscountCTva", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 86, ;
		Column6.ColumnOrder = 7, ;
		Column6.ControlSource = "pretftva", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.InputMask = (get_mask(14,gnPPretV)), ;
		Column6.Name = "cPretFtva", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 65, ;
		Column7.ColumnOrder = 4, ;
		Column7.ControlSource = "serie", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.Name = "cSerie", ;
		Column7.Width = 64, ;
		Column8.ColumnOrder = 8, ;
		Column8.ControlSource = "vpretftva", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.InputMask = (get_mask(14,gnPVal)), ;
		Column8.Name = "cVpretftva", ;
		Column8.Width = 98, ;
		Column9.ColumnOrder = 10, ;
		Column9.ControlSource = "vdiscountftva", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.InputMask = (get_mask(14,gnPVal)), ;
		Column9.Name = "cVdiscountftva", ;
		Column9.Width = 108, ;
		Column10.ColumnOrder = 12, ;
		Column10.ControlSource = "vvaldiminuatftva", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.InputMask = (get_mask(14,gnPVal)), ;
		Column10.Name = "cVvaldiminuatftva", ;
		Column10.Width = 103, ;
		Column11.ColumnOrder = 1, ;
		Column11.ControlSource = "codmat", ;
		Column11.FontName = "Arial", ;
		Column11.FontSize = 10, ;
		Column11.Name = "Column11", ;
		Column11.Width = 54, ;
		Column12.ColumnOrder = 3, ;
		Column12.ControlSource = "lot", ;
		Column12.FontSize = 10, ;
		Column12.Name = "cLot"
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grd_factura.cCantitate.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cantitate", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cCantitate.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cDenumire.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Articol", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cDiscountCTva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount unitar cu TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cDiscountCTva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cLot.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Lot", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.Column11.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod material", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.Column11.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cPretctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar cu TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cPretctva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cPretFtva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar fara TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cPretFtva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cSerie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cValdiminuatctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cValdiminuatctva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cVdiscountftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount unitar in valuta fara TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cVpretftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar fara TVA in valuta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cVvaldiminuatftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare in valuta fara TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'Gridextra1' AS gridextra WITH ;
		gridexpression = Thisform.grd_contracte, ;
		Height = 17, ;
		Left = 321, ;
		Name = "Gridextra1", ;
		Top = 244, ;
		Width = 26
		*< END OBJECT: ClassLib="..\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Gridextra2' AS gridextra WITH ;
		gridexpression = Thisform.grd_articole, ;
		Height = 17, ;
		Left = 335, ;
		Name = "Gridextra2", ;
		Top = 454, ;
		Width = 25
		*< END OBJECT: ClassLib="..\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Gridextra3' AS gridextra WITH ;
		gridexpression = Thisform.grd_factura, ;
		Height = 17, ;
		Left = 756, ;
		Name = "Gridextra3", ;
		Top = 432, ;
		Width = 24
		*< END OBJECT: ClassLib="..\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Lb_articole' AS lb_simplu WITH ;
		Caption = "Articol", ;
		Left = 9, ;
		Name = "Lb_articole", ;
		TabIndex = 23, ;
		Top = 314, ;
		ZOrderSet = 25
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_articolelista' AS lb_simplu WITH ;
		Anchor = 8, ;
		Caption = "Articole factura", ;
		Left = 382, ;
		Name = "lb_articolelista", ;
		TabIndex = 29, ;
		Top = 67, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_codmat' AS lb_simplu WITH ;
		Caption = "Cod material", ;
		Left = 9, ;
		Name = "lb_codmat", ;
		TabIndex = 25, ;
		Top = 289, ;
		ZOrderSet = 27
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_contracte' AS lb_simplu WITH ;
		Caption = "Contract", ;
		Left = 14, ;
		Name = "lb_contracte", ;
		TabIndex = 26, ;
		Top = 39, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_cursuri' AS lb_simplu WITH ;
		Anchor = 6, ;
		Caption = "Curs valutar (ZZ/LL/AAAA)", ;
		Left = 11, ;
		Name = "lb_cursuri", ;
		TabIndex = 30, ;
		Top = 479, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_data_scadenta' AS lb_simplu WITH ;
		Anchor = 9, ;
		Caption = "Data scadenta", ;
		FontBold = .T., ;
		Left = 661, ;
		Name = "lb_data_scadenta", ;
		TabIndex = 28, ;
		Top = 39, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_nract' AS lb_simplu WITH ;
		AutoSize = .F., ;
		Caption = "Nr. document :", ;
		FontBold = .T., ;
		Height = 17, ;
		Left = 383, ;
		Name = "Lb_nract", ;
		TabIndex = 24, ;
		Top = 38, ;
		Width = 251, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_politici_preturi' AS lb_simplu WITH ;
		Caption = "Politica de preturi", ;
		Left = 9, ;
		Name = "lb_politici_preturi", ;
		TabIndex = 27, ;
		Top = 265, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_total_mod' AS lb_simplu WITH ;
		Alignment = 1, ;
		Anchor = 12, ;
		AutoSize = .F., ;
		Caption = "0.00", ;
		FontBold = .T., ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		Height = 17, ;
		Left = 706, ;
		Name = "lb_total_mod", ;
		TabIndex = 36, ;
		Top = 532, ;
		Visible = .F., ;
		Width = 37
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'txtArticole' AS textbox WITH ;
		FontSize = 10, ;
		Format = "!k", ;
		Height = 23, ;
		Left = 154, ;
		Name = "txtArticole", ;
		TabIndex = 8, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 311, ;
		Width = 145, ;
		ZOrderSet = 26
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtArticoleLista' AS textbox WITH ;
		Anchor = 8, ;
		FontSize = 10, ;
		Format = "!k", ;
		Height = 23, ;
		Left = 478, ;
		Name = "txtArticoleLista", ;
		TabIndex = 13, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 64, ;
		Width = 168, ;
		ZOrderSet = 12
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtCodmat' AS textbox WITH ;
		FontSize = 10, ;
		Format = "!k", ;
		Height = 23, ;
		Left = 154, ;
		Name = "txtCodmat", ;
		TabIndex = 6, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 287, ;
		Width = 145, ;
		ZOrderSet = 28
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtDataScadenta' AS textbox WITH ;
		Anchor = 9, ;
		ControlSource = "poDate.datascad", ;
		Format = "K", ;
		Height = 23, ;
		Left = 759, ;
		Name = "txtDataScadenta", ;
		TabIndex = 19, ;
		Top = 36, ;
		Width = 81, ;
		ZOrderSet = 12
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE actualizeaza_total_mod
		Lparameters tnValoare,tnTip
		Local lnTotal,lnValoare,lnTip
		If Nvl(gnModTotFact,0) = 1
			lnValoare = IIF(EMPTY(tnValoare),0,tnValoare)
			lnTip = IIF(EMPTY(tnTip),0,tnTip)
			lnTotal = Iif(lnTip=1,lnValoare,Thisform.nbazaron) + Iif(lnTip=2,lnValoare,Thisform.ntvaron)
			If lnTotal <> Thisform.ntotalron
				Thisform.clb_total_baza.tx_SUMA_NAT.ForeColor = Rgb(255,0,0)
				Thisform.clb_total_tva.tx_SUMA_NAT.ForeColor = Rgb(255,0,0)
				Thisform.lb_total_mod.ForeColor = Rgb(255,0,0)
				Thisform.lb_total_mod.AutoSize = .F.
				Thisform.lb_total_mod.Caption = Transform(lnTotal,get_mask(14,gnPc))
				Thisform.lb_total_mod.AutoSize = .T.
				Thisform.lb_total_mod.Visible = .T.
			Else
				Thisform.clb_total_baza.tx_SUMA_NAT.ForeColor = Rgb(0,0,0)
				Thisform.clb_total_tva.tx_SUMA_NAT.ForeColor = Rgb(0,0,0)
				Thisform.lb_total_mod.Visible = .F.
			Endif
		Endif
	ENDPROC

	PROCEDURE Destroy
		If Used('crsarticole')
			Use In crsarticole
		ENDIF
		If Used('crsarticole1')
			Use In crsarticole1
		Endif
	ENDPROC

	PROCEDURE do_adauga_articol
		*!* 17.03.2015
		*!* marius.mutu
		*!* daca cantitatea ramasa dupa adaugarea articolului gestionabil este < 0, atunci pun 0 ca sa pot intra pe ramura facturare fara stoc
		
		*!*	05.11.2025
		*!*	marius.mutu
		*!*	pentru articolele negestionabile fara afisarea formularului articol, creez frm_articol_factura ca sa se initializeze toate proprietatile poArticol
		*!* nu se initializa poArticol.taxcode
		
		Lparameters tlImplicit, tlContract, tlRetur
		*	llImplicit = .T.	=>	daca exista o singura linie in stoc, atunci nu mai apare formularul de completare a datelor
		*	tlContract = .T.	=>	provine din gridul cu articole din contract
		*	tlRetur	   = .T. 	=>	se face retur la articolul selectat (trebuie selectat din rulaj in loc de stoc)
		
		Private pnProcentDiscountMem
		Local ofrmadarticol As "frm_articol_factura"
		Local lcSelectActualizare, lcSql, llActualizat, llSucces, lnListaIdOld, lnRecno, lnSucces
		Local lnTotalCantitate, loCauta
		*:Global gnButon, poArtLista
		pnProcentDiscountMem = 0
		
		If Nvl(gnMemProcDisc, 0) = 1
			pnProcentDiscountMem = Thisform.nproc_disc_mem
		Endif
		Local lcCursor, loGrid
		If tlContract
			lcCursor = [crsarticole1]
			loGrid = Thisform.grd_contracte
		Else
			lcCursor = [crsarticole]
			loGrid = Thisform.grd_articole
		ENDIF
		
		If Used(lcCursor) And Reccount(lcCursor) > 0
			Local lnCantitate
			Private poArticol
			Select (lcCursor)
			Scatter Name poArticol MEMO 
			Scatter Name poArtLista MEMO
			lnCantitate = poArticol.cantitate
		
		* FACTURARE ARTICOLE INEXISTENTE IN STOC
		* DOAR DACA ESTE ACTIVA OPTIUNEA RF_FACTURARE_FARA_STOC = 1 SAU VREAU SA RETURNEZ UN ARTICOL
		*!*		If lnCantitate = 0 And ((Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1) OR m.tlRetur)
		*!*			lnCantitate = 999999999
		*!*		Endif
			Thisform.do_initializeaza_articol(@poArticol)
		
		* 8 = Retur lei, 9 = retur valuta sau factura de vanzare normala, dar cu retur de articole, 24 = aviz retur
			If Inlist(poDate.tip, 8, 9, 24)
				lnCantitate = poArticol.cantitate
			Endif
		
			gnButon = 2
		
			If Thisform.do_verifica_articol(tlContract, lnCantitate)
				Do Case
					Case (poArticol.gestionabil = 0 Or gnScadereStoc = 0 Or poDate.tip = 45)	&&	45 = ROARESTAURANT
						* initializez frm_articol_factura, sa se initializeze toate calculele si daca nu arat formularul (adaugare toate articolele)
						ofrmadarticol = Createobject("frm_articol_factura", lnCantitate, tlImplicit)
						If !tlImplicit
							ofrmadarticol.Show(1)
						Else
							poArticol = calculeaza_totaluri(poArticol)
							gnButon = 1
						ENDIF
						Release ofrmadarticol
					OTHERWISE
						lnListaIdOld = poDate.listaid
						IF m.tlRetur
							loCauta = caut_facturi_multiple_client_articol(poDate.id_client, poDate.in_valuta, poDate.id_valuta, .F., poArticol.id_articol)
							If m.gnButon = 1 and !Empty(Nvl(loCauta.id_vanzare, 0))
								poDate.listaid = Alltrim(Str(loCauta.id_vanzare))
								* ID_ARTICOL:ID_VANZARE,ID_ARTICOL:ID_VANZARE
								thisform.cListaIdArticoleRetur = thisform.cListaIdArticoleRetur + IIF(!EMPTY(thisform.cListaIdArticoleRetur), ',', '') + ALLTRIM(STR(poArticol.id_articol)) + ':' + poDate.listaid
							Endif
						ENDIF
						llSucces = Thisform.do_alege_stoc(poArticol.id_articol, lnCantitate, poArticol.denumire, tlImplicit, poArticol.pretftva, poArticol.discount_unitar, loGrid, m.tlRetur)
						poDate.listaid = m.lnListaIdOld
						If !m.llSucces
							Return
						Endif
				Endcase
			Else
				gnButon = 2
			Endif
			If Used('crsCtrTemp')
				Select crsCtrTemp
				Set Filter To
			Endif
		
			If gnButon = 1
		
		
				If Inlist(poDate.tip, 41) &&  retur transfer catre subunitati lista pret
					llActualizat = Thisform.modifica_lista_preturi(poArticol.Id_Pol, poArticol.id_articol, ;
						  IIF(poArticol.tip_valuta = 1, poArticol.pretftva_val, poArticol.pretftva), ;
						  IIF(poArticol.tip_valuta = 1, poArticol.pretctva_val, poArticol.Pretctva), ;
						  IIF(poArticol.tip_valuta = 1, ;
							IIF(poArticol.preturi_cu_tva = 1, poArticol.pretctva_val, poArticol.pretftva_val), ;
							Iif(poArticol.preturi_cu_tva = 1, poArticol.Pretctva, poArticol.pretftva)), ;
						  poArticol.Proc_Tvav, ;
						  IIF(poArticol.tip_valuta = 1, poArtLista.pret_val, poArtLista.Pret))
					If llActualizat
						lcSelectActualizare = Select()
						Select crsarticole
						lnRecno = Recno()
						Replace Pret With Iif(poArticol.preturi_cu_tva = 1, poArticol.Pretctva, poArticol.pretftva), ;
							pret_val With Iif(poArticol.preturi_cu_tva = 1, poArticol.pretctva_val, poArticol.pretftva_val) ;
							FOR id_articol = poArticol.id_articol And Id_Pol = poArticol.Id_Pol
						Go lnRecno
						Select (lcSelectActualizare)
					Endif
				Endif
		
				lcSql = [select codmatf from nom_articole where id_articol = ?poArticol.id_articol]
				lnSucces = goExecutor.oExecute(lcSql, [crscodmatf])
				If lnSucces < 0
					amessagebox(goExecutor.cEroare, 16, "Eroare")
				Else
					If Reccount('crscodmatf') > 0
						Select crscodmatf
						poArticol.codmatf = codmatf
					Endif
					Use In crscodmatf
				Endif
		
				save_grid_tag(Thisform.grd_factura)
				If !Used('crsartselectate')
					Select crsfactura
					Append Blank
					Gather Name poArticol Fields Like pret_achizitie, denumire, cantitate, id_articol, Id_Pol, Cont, id_gestiune, Proc_Tvav, ;
						pretftva, valftva, valtva, valctva, valdiscountftva, valdiscounttva, valdiscountctva, Pretctva, ;
						valdiminuatftva, valdiminuattva, valdiminuatctva, ;
						vvalftva, vvaltva, vvalctva, vvaldiscountftva, vvaldiscounttva, vvaldiscountctva, ;
						vvaldiminuatftva, vvaldiminuattva, vvaldiminuatctva, id_c, lot, serie, explicatie, ;
						id_valuta, gestionabil, tip_valuta, id_jtva_coloana, taxcode, id_lucrare_rez, id_part_rez, pretv_orig, pretd, id_valuta_d, id_ctr, opt_facturare, nume_val MEMO
						
					Replace id_temp With Recno(), codmat With Nvl(poArticol.codmat, Space(50)), codmatf With Nvl(poArticol.codmatf, Space(50)), ;
						um With Nvl(poArticol.um, [ ]), Curs With Nvl(poArticol.Curs, 0), multiplicator With Nvl(poArticol.multiplicator, 1), ;
						cu_tva With poArticol.preturi_cu_tva, codbare With Nvl(poArticol.codbare, Space(50)), ;
						vpretftva With Nvl(poArticol.pretftva_val, 0), vpretctva With Nvl(poArticol.pretctva_val, 0), ;
						discountftva With poArticol.discount_unitar, discountctva With poArticol.discount_unitar_ctva, ;
						vdiscountftva With Nvl(poArticol.discount_unitar_val, 0), vdiscountctva With Nvl(poArticol.discount_unitar_ctva_val, 0)
					If Used('crsCtrTemp')
						Select crsCtrTemp
						Locate For id_ctr = poArticol.id_ctr And text_standard = 1
						If Found()
							poArticol.numar_contract = Alltrim(contract)
							Select crsfactura
							Replace numar_contract With poArticol.numar_contract
						Else
							Select crsfactura
						Endif
					Endif
					If Nvl(gnMemProcDisc, 0) = 1
						Thisform.nproc_disc_mem = pnProcentDiscountMem
					Endif
				Else
					lnTotalCantitate = poArticol.cantitate
					Select crsartselectate
					Scan
						poArticol.pret_achizitie = Pret
						poArticol.serie = Nvl(serie, [])
						poArticol.lot = Nvl(lot, [])				
						poArticol.id_gestiune = id_gestiune
						poArticol.Cont = Alltrim(Cont)
						poArticol.cantitate = cantitate
						poArticol.pretv_orig = pretv
						poArticol.id_lucrare_rez = id_lucrare_rez
						poArticol.id_part_rez = id_part_rez
		
						poArticol.pretd = pretd
						poArticol.id_valuta_d = id_valuta
		
						Select crsfactura
						Append Blank
		
						Gather Name poArticol Fields Like pret_achizitie, denumire, cantitate, id_articol, Id_Pol, ;
							Cont, id_gestiune, Proc_Tvav, pretftva, Pretctva, ;
							id_c, lot, serie, explicatie, ;
							id_valuta, gestionabil, tip_valuta, id_jtva_coloana, taxcode, id_lucrare_rez, id_part_rez, pretv_orig, pretd, id_valuta_d, nume_val, id_ctr, opt_facturare MEMO
							
						Replace id_temp With Recno(), codmat With Nvl(poArticol.codmat, Space(50)), ;
							codbare With Nvl(poArticol.codbare, Space(50)), ;
							codmatf With Nvl(poArticol.codmatf, Space(50)), um With Nvl(poArticol.um, Space(50)), ;
							Curs With Nvl(poArticol.Curs, 0), multiplicator With Nvl(poArticol.multiplicator, 1), ;
							cu_tva With poArticol.preturi_cu_tva, ;
							vpretftva With Nvl(poArticol.pretftva_val, 0), vpretctva With Nvl(poArticol.pretctva_val, 0), ;
							discountftva With poArticol.discount_unitar, discountctva With poArticol.discount_unitar_ctva, ;
							vdiscountftva With Nvl(poArticol.discount_unitar_val, 0), ;
							vdiscountctva With Nvl(poArticol.discount_unitar_ctva_val, 0)
		
						poArticol = calculeaza_totaluri(poArticol)
						Gather Name poArticol Fields Like valftva, valtva, valctva, ;
							valdiscountftva, valdiscounttva, valdiscountctva, ;
							valdiminuatftva, valdiminuattva, valdiminuatctva, ;
							vvalftva, vvaltva, vvalctva, ;
							vvaldiscountftva, vvaldiscounttva, vvaldiscountctva, ;
							vvaldiminuatftva, vvaldiminuattva, vvaldiminuatctva MEMO 
					Endscan
					Use In crsartselectate
					poArticol.cantitate = lnTotalCantitate	&&	imi trebuie mai jos, unde actualizez cantitatea totala
					Select crsfactura
				Endif && !Used('crsartselectate')
		
		
				If poArticol.Proc_Tvav > Thisform.nproc_tvav
					Thisform.nproc_tvav = poArticol.Proc_Tvav
				Endif
		
				If This.nnrinregvizibile < Recno('crsfactura')
					lnRecno = Recno() - This.nnrinregvizibile
					Go lnRecno
				Else
					Go Top
				Endif
		
				restore_grid_tag(Thisform.grd_factura)
		
				Select (lcCursor)
				lnRecno = Recno()
				Do Case
					Case gnScadereStoc = 1 And poDate.tip = 41 && aviz retur transfer catre subunitati lista pret
						Replace cantitate With cantitate + poArticol.cantitate For id_c = poArticol.id_c
						Go lnRecno
					Case (gnScadereStoc = 1 And poDate.tip = 23) Or Inlist(poDate.tip, 3, 4, 21, 25, 28, 42, 47) && 23 aviz transfer catre subunitati din lista, 3 factura pe baza de comenzi, 21 aviz catre clienti din comanda
						Replace cantitate With cantitate - poArticol.cantitate For id_c = poArticol.id_c
						Go lnRecno
					Case Inlist(poDate.tip, 8, 9, 24) && factura retur lei si valuta, aviz retur
						Replace cantitate With cantitate + poArticol.cantitate For id_c = poArticol.id_c
						Go lnRecno
					Case poArticol.gestionabil = 1 And gnScadereStoc = 1 And ;
							(Inlist(poDate.tip, 1, 22, 29) Or (poDate.tip = 2 And poArticol.opt_facturare = 0))
						Replace cantitate With IIF(cantitate - poArticol.cantitate > 0, cantitate - poArticol.cantitate, 0) For id_articol = poArticol.id_articol And gestionabil = 1
						* daca cantitatea ramasa dupa adaugarea articolului gestionabil este < 0, atunci pun 0 ca sa pot intra pe ramura facturare fara stoc
						Go lnRecno
				Endcase
		
				Thisform.do_calculeaza_totaluri()
		
				If poArticol.opt_facturare = 0
					Do Case
						Case !Empty(Thisform.txtCodmat.Value)
							Thisform.txtCodmat.SetFocus()
						Case !Empty(Thisform.txtArticole.Value)
							Thisform.txtArticole.SetFocus()
						Otherwise
							Thisform.grd_articole.SetFocus()
					Endcase
				Else
					Thisform.grd_contracte.SetFocus()
				Endif
			Else
				If poArticol.opt_facturare = 0
					Do Case
						Case !Empty(Thisform.txtCodmat.Value)
							Thisform.txtCodmat.SetFocus()
						Case !Empty(Thisform.txtArticole.Value)
							Thisform.txtArticole.SetFocus()
						Otherwise
							Thisform.grd_articole.SetFocus()
					Endcase
				Else
					Thisform.grd_contracte.SetFocus()
				Endif
			Endif
		
			Release poArticol
		Endif
		Release loGrid, pnProcentDiscountMem
		
	ENDPROC

	PROCEDURE do_adauga_rata
		Private poArticol
		Select crsarticole1
		Scatter Name poArticol MEMO
		Thisform.do_initializeaza_articol(@poArticol)
		Select crsfactura
		Locate For id_rata = poArticol.id_rata
		If Found()
			amessagebox([Aceasta rata a fost deja adaugata pe factura!],48,[Atentie])
		Else
			gnButon = 2
			ofrmadarticol=Createobject("frm_articol_factura_rate")
			ofrmadarticol.Show(1)
			Release ofrmadarticol
		
			If gnButon = 1
				save_grid_tag(Thisform.grd_factura)
				Select crsfactura
				Append Blank
				Gather Name poArticol Fields Like pret_achizitie,cantitate,Id_Pol,Cont,id_gestiune,Proc_Tvav,;
					serie,id_valuta,gestionabil,tip_valuta,id_jtva_coloana,id_lucrare_rez,id_part_rez,pretv_orig,pretd,id_valuta_d,id_rata,;
					data_rata,data_scadenta,nr_rata,id_ctr,opt_facturare,nume_val,taxcode MEMO	&&	modificare ROAFACTURARE v 2.0.77 : nume_val
					
				Replace id_articol With Nvl(poArticol.id_articol,0),id_temp With Recno(),;
					codmat With Nvl(poArticol.codmat,Space(50)),codmatf With Nvl(poArticol.codmatf,Space(50)),;
					codbare With Nvl(poArticol.codbare,Space(50)),um With Nvl(poArticol.um,[ ]),;
					Curs With Nvl(poArticol.Curs,0),multiplicator WITH NVL(poArticol.multiplicator,1),;
					cu_tva With poArticol.preturi_cu_tva,;
					pretftva With poArticol.pretftva,Pretctva With poArticol.Pretctva,;
					valftva With poArticol.pretftva,valtva With poArticol.tva,valctva With poArticol.Pretctva,;
					vpretftva With Nvl(poArticol.pretftva_val,0),vpretctva With Nvl(poArticol.pretctva_val,0),;
					vvalftva With NVL(poArticol.pretftva_val,0),vvaltva With NVL(poArticol.tva_val,0),vvalctva With NVL(poArticol.Pretctva_val,0),;
					discountftva With poArticol.discount_unitar,discountctva With poArticol.discount_unitar_ctva,;
					valdiscountftva WITH poArticol.discount_unitar,valdiscountctva WITH poArticol.discount_unitar_ctva,;
					valdiscounttva WITH poArticol.discount_unitar_ctva - poArticol.discount_unitar,;
					vdiscountftva With Nvl(poArticol.discount_unitar_val,0),vdiscountctva With Nvl(poArticol.discount_unitar_ctva_val,0),;
					vvaldiscountftva WITH NVL(poArticol.discount_unitar_val,0),vvaldiscountctva WITH NVL(poArticol.discount_unitar_ctva_val,0),;
					vvaldiscounttva WITH NVL(poArticol.discount_unitar_ctva_val,0)-NVL(poArticol.discount_unitar_val,0),;
					valdiminuatftva WITH poArticol.pretftva - NVL(poArticol.discount_unitar,0),;
					valdiminuattva WITH (poArticol.pretctva - poArticol.pretftva) - (NVL(poArticol.discount_unitar_ctva,0)-NVL(poArticol.discount_unitar,0)),;
					valdiminuatctva WITH poArticol.pretctva - NVL(poArticol.discount_unitar_ctva,0),;
					vvaldiminuatftva WITH poArticol.pretftva_val - NVL(poArticol.discount_unitar_val,0),;
					vvaldiminuattva WITH (poArticol.pretctva_val - poArticol.pretftva_val) - (NVL(poArticol.discount_unitar_ctva_val,0)-NVL(poArticol.discount_unitar_val,0)),;
					vvaldiminuatctva WITH poArticol.pretctva_val - NVL(poArticol.discount_unitar_ctva_val,0),;
					denumire WITH poArticol.explicatie
				
				Select crsCtrTemp
				Locate For id_ctr = poArticol.id_ctr And text_standard = 1
				If Found()
					poArticol.numar_contract = ALLTRIM(contract)
					Select crsfactura
					Replace numar_contract With poArticol.numar_contract
				Else
					Select crsfactura
				Endif
		
				If poArticol.Proc_Tvav > Thisform.nproc_tvav
					Thisform.nproc_tvav = poArticol.Proc_Tvav
				Endif
		
				poDate.datascad = Iif(Type('poArticol.data_scadenta')='T',Ttod(poArticol.data_scadenta),poArticol.data_scadenta)
				Thisform.txtDataScadenta.Refresh()
		
				If This.nnrinregvizibile < Recno('crsfactura')
					lnRecNo = Recno() - This.nnrinregvizibile
					Go lnRecNo
				Else
					Go Top
				Endif
		
				restore_grid_tag(Thisform.grd_factura)
		
				Thisform.do_calculeaza_totaluri()
			Endif
		Endif
		Thisform.grd_contracte.SetFocus()
		*!*		Thisform.txtDenRata.SetFocus()
		Release poArticol
		
	ENDPROC

	PROCEDURE do_adauga_tot
		Local llGestionabil
		Local lnNrInregistrare, lnRaspuns, lcArticol
		If Used('crsarticole') And Reccount('crsarticole') > 0
			Select crsarticole
			Scan
				lnNrInregistrare = Recno()
				lnRaspuns = 7
				lcArticol = Alltrim(denumire)
				llGestionabil = (Type('crsArticole.gestionabil') = 'N' And Nvl(crsarticole.gestionabil, 0) = 1)
		
				Do While lnRaspuns = 7
					If (cantitate > 0 AND m.llGestionabil) OR (!m.llGestionabil) && adaug toate articolele, chiar si cele cu cantitate negativa (ex: articol discount are cantitate negativa)
						Thisform.do_adauga_articol(.T.)
					Endif
					Select crsarticole
					Go lnNrInregistrare
					If cantitate = 0 Or !m.llGestionabil
						lnRaspuns = 6
					Else
						lnRaspuns = aMessageBox("Nu ati selectat toata cantitatea pentru articolul " + Alltrim(lcArticol) + ". Doriti sa treceti la urmatorul?", 4 + 32, "Confirmare cantitate")
					Endif
				Enddo
				Select crsarticole
				Go lnNrInregistrare
			Endscan
		Else
			aMessageBox("Nu exista articole de adaugat!", 48, "Atentie")
		Endif
	ENDPROC

	PROCEDURE do_alege_stoc
		Lparameters tnIdArticol,tnCantitate,tcNumeArticol,tlImplicit,tnPret,tnDiscount,toGrid, tlRetur
		*	llImplicit	=>	vezi thisform.do_adauga
		*	tnPret		=>	doar pentru retururi : e pretul de vanzare fara TVA
		*	toGrid		=>	gridul din care vine articolul
		*	tlRetur		=>	factura normala cu articol retur (nu factura de retur tip 8,9). se comporta la fel ca factura de retur. se selecteaza din RUL, dar nu stiu factura din care fac retur
		
		Private pnIdArticol
		Local llReturn,lofrmadarticol,lcSql, llFacturareFaraStoc
		llFactuareFaraStoc = .F.
		llReturn = .T.
		
		pnIdArticol = tnIdArticol
		
		If Inlist(poDate.tip,23,41) && 23 transfer catre subunitati din lista, 41 aviz retur transfer catre subunitati din lista
			lcIdGestiune = Alltrim(Str(poDate.id_client))
		Else
			If Isnull(poDate.id_gestiune_init)
				lcIdGestiune = [NULL]
			Else
				lcIdGestiune = Alltrim(Str(poDate.id_gestiune_init))
			Endif
		Endif
		
		*!*	llFacturareFaraStoc = (m.tnCantitate = 999999999 And Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1)
		llFacturareFaraStoc = (m.tnCantitate = 0 And Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1)
		
		If Inlist(poDate.tip,8,9,24) Or m.tlRetur && factura retur lei, factura retur valuta, aviz retur sau factura normala cu retur de articole
			lcSql = [{call pack_facturare.cursor_gestiuni_articol_retur(] + Alltrim(Str(pnIdArticol)) + [,] + ;
				Alltrim(Str(poDate.tip)) + [,] + lcIdGestiune + [,] + ;
				Alltrim(Str(tnPret,20,gnPPretV)) + [,] + Alltrim(Str(tnDiscount,20,gnPPretV)) + [,] + ;
				Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(gnAn)) + [,] + ;
				Alltrim(Str(gnIdUtil)) + [,'] + Alltrim(poDate.listaid) + [',] + ;
				Iif(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [)}]
		Else
			If !m.llFacturareFaraStoc
				lcSql = [{call pack_facturare.cursor_gestiuni_articol(] + Alltrim(Str(pnIdArticol)) + [,] + ;
					Alltrim(Str(poDate.tip)) + [,] + lcIdGestiune + [,] + ;
					Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnIdUtil)) + [,] + ;
					IIF(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [)}]
			Else
		* Selectie articol fara stoc (din stoc anul curent si precedent)
				lcSql = [{call pack_facturare.cursor_gestiuni_articol_stoc0(] + Alltrim(Str(pnIdArticol)) + [,] + ;
					Alltrim(Str(poDate.tip)) + [,] + lcIdGestiune + [,] + ;
					Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnIdUtil)) + [,] + ;
					IIF(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [)}]
			Endif
		Endif
		
		lcCursor = [crsgestarticol]
		lcCursorTemp = [crsgestarticoltemp]
		lnSucces = goExecutor.oExecute(lcSql,lcCursorTemp)
		Do Case
			Case lnSucces < 0
				amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
				toGrid.SetFocus()
				llReturn = .F.
			Case Reccount(lcCursorTemp) = 0
				amessagebox("Articolul "+Alltrim(tcNumeArticol)+" nu este pe stoc!",0+48,"Atentie")
				toGrid.SetFocus()
				llReturn = .F.
			Otherwise
		
				If m.llFacturareFaraStoc
					Update (m.lcCursorTemp) Set datain = Date(Year(Date())+1,1,1) Where Empty(Nvl(datain,{}))
				Endif
		
				copiaza_structura_cursor(lcCursorTemp,lcCursor)
		
				* Arat cantitatile din stoc - cantitatile deja pe factura curenta
				Select Iif(poDate.tip=41,-1,1)*Sum(cantitate) As cantitate,id_articol,id_gestiune,pret_achizitie,serie,lot,Cont, ;
					id_part_rez,id_lucrare_rez,pretv_orig,pretd,id_valuta_d ;
					FROM crsfactura Where id_articol = pnIdArticol ;
					GROUP By id_articol,id_gestiune,pret_achizitie,serie,lot,Cont,id_part_rez,id_lucrare_rez,pretv_orig,pretd,id_valuta_d ;
				INTO CURSOR crsFacturaArticoleTemp
					
		*!*			Select a.ales,a.id_gestiune,a.cantitate - Iif(Inlist(poDate.tip,8,9,24),(-1),1) * Nvl(b.cantitate,0) As cantitate,a.Cont,a.serie,a.lot,a.Pret,a.nume_gestiune,;
		*!*			a.datain,a.pretv,a.pretvctva,a.part_rez,a.id_part_rez,a.nrord_rez,a.id_lucrare_rez,a.pretd,a.id_valuta,a.nume_val ;
		*!*			from (lcCursorTemp) a Left Join ;
		*!*			crsFacturaArticoleTemp b ;
		*!*			ON a.id_gestiune = b.id_gestiune And a.Pret = b.pret_achizitie And a.Cont = b.Cont ;
		*!*			And Nvl(a.serie,'') = Nvl(b.serie,'') ;
		*!*			And Nvl(a.lot,'') = Nvl(b.lot,'') ;			
		*!*			And Nvl(a.id_part_rez,0) = Nvl(b.id_part_rez,0) And Nvl(a.id_lucrare_rez,0) = Nvl(b.id_lucrare_rez,0) ;
		*!*			And a.pretv = b.pretv_orig And a.pretd = b.pretd And Nvl(a.id_valuta,0) = Nvl(b.id_valuta_d,0) ;	&&	modificare v 2.0.84 : am pus 0 in loc de -99 la id_valuta_d
		*!*		Where a.cantitate - Iif(Inlist(poDate.tip,8,9,24),(-1),1) * Nvl(b.cantitate,0) > 0 ;
		*!*			Order By a.datain, a.nume_gestiune,a.serie,a.lot,a.Pret,a.pretd,a.id_valuta,;
		*!*			a.pretv,a.Cont,a.part_rez,a.nrord_rez ;
		*!*			into cursor cArticoleGestTemp2
				
			
		*!*			SELECT (m.lcCursor)
		*!*			APPEND FROM DBF('cArticoleGestTemp2')
		
		*!*			USE IN (SELECT('crsFacturaArticoleTemp2'))	
		
				Insert Into (lcCursor) (ales,id_gestiune,cantitate,Cont,serie,lot, Pret,nume_gestiune,datain,pretv,pretvctva,part_rez,id_part_rez,nrord_rez,id_lucrare_rez,pretd,id_valuta,nume_val) ;
					Select a.ales,a.id_gestiune,a.cantitate - Iif(Inlist(poDate.tip,8,9,24),(-1),1) * Nvl(b.cantitate,0) As cantitate,a.Cont,a.serie,a.lot,a.Pret,a.nume_gestiune,;
					a.datain,a.pretv,a.pretvctva,a.part_rez,a.id_part_rez,a.nrord_rez,a.id_lucrare_rez,a.pretd,a.id_valuta,a.nume_val ;
					from (lcCursorTemp) a Left Join ;
					crsFacturaArticoleTemp b ;
					ON a.id_gestiune = b.id_gestiune And a.Pret = b.pret_achizitie And a.Cont = b.Cont ;
					And Nvl(a.serie,'') = Nvl(b.serie,'') ;
					And Nvl(a.lot,'') = Nvl(b.lot,'') ;			
					And Nvl(a.id_part_rez,0) = Nvl(b.id_part_rez,0) And Nvl(a.id_lucrare_rez,0) = Nvl(b.id_lucrare_rez,0) ;
					And a.pretv = b.pretv_orig And a.pretd = b.pretd And Nvl(a.id_valuta,0) = Nvl(b.id_valuta_d,0) ;	&&	modificare v 2.0.84 : am pus 0 in loc de -99 la id_valuta_d
				Where a.cantitate - Iif(Inlist(poDate.tip,8,9,24),(-1),1) * Nvl(b.cantitate,0) > 0 ;
					Order By a.datain, a.nume_gestiune,a.serie,a.lot,a.Pret,a.pretd,a.id_valuta,;
					a.pretv,a.Cont,a.part_rez,a.nrord_rez		
		
				USE IN (SELECT('crsFacturaArticoleTemp'))			
		
					
				SELECT (m.lcCursor)
				Go Top
				Do Case
					Case Reccount(lcCursor) = 0
						amessagebox("Articolul "+Alltrim(tcNumeArticol)+" nu mai este pe stoc!",0+48,"Atentie")
						toGrid.SetFocus()
						llReturn = .F.
		*!*	modificare v 2.0.44
					Case Reccount(lcCursor) = 1 And tlImplicit
						Local lnNrOptiuniTva
						lnNrOptiuniTva = 0
						Select jtva_coloane
						Calculate Cnt() For (cota_tva + 100)/100 = Nvl(poArticol.proc_tvav,-1) To lnNrOptiuniTva
						Select (lcCursor)	&&	modificare	v 2.2.18	: l-am scos din "if" pentru ca aveam nevoie de el si pe "else"
						If lnNrOptiuniTva = 1
		*!*				Locate For (cota_tva + 100)/100 = poArticol.proc_tvav
		*!*				poArticol.proc_tvav = (cota_tva + 100)/100
		*!*				poArticol.id_jtva_coloana = id_jtva_coloana
		*!*				Select (lcCursor)		&&	modificare	v 2.2.18	:	l-am mutat inaintea "if"-ului
							poArticol.pret_achizitie = Pret
							poArticol.serie = Nvl(serie,[])
							poArticol.lot = Nvl(lot,[])					
							poArticol.id_gestiune = id_gestiune
							poArticol.Cont = Alltrim(Cont)
							poArticol.id_lucrare_rez = id_lucrare_rez
							poArticol.id_part_rez = id_part_rez
							poArticol.pretv_orig = pretv
		*!*	modificare  v 2.0.56
							poArticol.pretd = pretd
							poArticol.id_valuta_d = id_valuta
		*!*	modificare  v 2.0.56	^
							lofrmadarticol=Createobject("frm_articol_gest_factura",tnCantitate,tlImplicit,tlRetur)
							If !lofrmadarticol.inainte_de_do_termin()
								lofrmadarticol.Show(1)
							Else
								lofrmadarticol.Release()
								gnButon = 1
							Endif
						Else
							lofrmadarticol=Createobject("frm_articol_gest_factura",tnCantitate, .F., tlRetur)
							lofrmadarticol.Show(1)
		*!*	modificare	v 2.0.46
							If gnButon = 1
								Select * From (lcCursor) Where ales = 1 Into Cursor crsartselectate
								If Reccount('crsartselectate') = 0
									Use In crsartselectate
								Endif
							Endif
		*!*	modificare	v 2.0.46	^
						Endif
						Release lofrmadarticol
		*!*	modificare v 2.0.44	^
					Otherwise
						lofrmadarticol=Createobject("frm_articol_gest_factura",tnCantitate, .F., tlRetur)
						lofrmadarticol.Show(1)
						Release lofrmadarticol
		*!*	modificare	v 2.0.46
						If gnButon = 1
							Select * From (lcCursor) Where ales = 1 Into Cursor crsartselectate
							If Reccount('crsartselectate') = 0
								Use In crsartselectate
							Endif
						Endif
		*!*	modificare	v 2.0.46	^
				Endcase
		Endcase
		If Used(lcCursor)
			Use In (lcCursor)
		Endif
		If Used(lcCursorTemp)
			Use In (lcCursorTemp)
		Endif
		
		*!*	* Construiesc o lista de articole la care nu am gasit stoc, ca sa le tratez special la finalizarea facturii!!! this.scrie_articole
		*!*	IF m.llReturn
		*!*		If m.llFacturareFaraStoc
		*!*			this.cListaArticoleFaraStoc = this.cListaArticoleFaraStoc + ALLTRIM(STR(tnIdArticol)) + [,]
		*!*		ENDIF
		*!*	ENDIF
		Return llReturn
		
	ENDPROC

	PROCEDURE do_calculeaza_discount
		Lparameters tnProcent
		If tnProcent = 0
			Thisform.ndiscfactron = 0
			Thisform.ndiscfactval = 0
		Else
			If poDate.in_valuta = 1
				Thisform.ndiscfactval = Round(Thisform.nbazafdiscountval * tnProcent / 100,gnPVal)
				Thisform.ndiscfactron = Round(Thisform.ndiscfactval*poDate.Curs/poDate.multiplicator,gnPc)
			Else
				Thisform.ndiscfactron = Round(Thisform.nbazafdiscount * tnProcent / 100,gnPc)
			Endif
		Endif
		*!*	Thisform.clb_discount.Refresh()
		Thisform.do_calculeaza_totaluri()
		
	ENDPROC

	PROCEDURE do_calculeaza_totaluri
		Lparameters tlModificareDiscount
		Local lnTotal,lnTva,lnBaza,lnDisc, lnVTotal,lnVTva,lnVBaza,lnVDisc
		lnTotal = 0
		lnTva = 0
		lnBaza = 0
		lnDisc = 0
		lnVTotal = 0
		lnVTva = 0
		lnVBaza = 0
		lnVDisc = 0
		If poDate.in_valuta = 0
		*!*	modificare	v 2.0.46
		*!*		Select Sum(valdiminuatctva) As Total,Sum(valdiminuatftva) As Baza,;
		*!*			Sum(valdiminuattva) As Tva,;
		*!*			Sum(valdiscountftva) As discount From crsfactura Into Cursor crstotalurifact
		*!*		Select crstotalurifact
		*!*		Thisform.nbazafdiscount = Nvl(Baza,0)
		*!*		lnTotal = Nvl(Total,0)
		*!*		Thisform.nbazaron = Nvl(Baza,0) - Round(Thisform.ndiscfactron, gnPc)
		*!*		Thisform.ndiscron = Nvl(discount,0)
		*!*		Thisform.ntvaron = Nvl(Tva,0) - Round(Thisform.ndiscfactron * (Thisform.nproc_tvav - 1), gnPc)
		*!*		Thisform.ntotalron = lnTotal - Round(Thisform.ndiscfactron * Thisform.nproc_tvav, gnPc)
			If Used('crsfacturaset')
				Select Sum(Nvl(valdiminuatctva,0)) As Total,Sum(Nvl(valdiminuatftva,0)) As Baza,;
					Sum(Nvl(valdiminuattva,0)) As Tva,;
					Sum(Nvl(valdiscountftva,0)) As discount From crsfacturaset ;
					union All ;
					select Nvl(Sum(valdiminuatctva),0) As Total,Nvl(Sum(valdiminuatftva),0) As Baza,;
					Nvl(Sum(valdiminuattva),0) As Tva,;
					Nvl(Sum(valdiscountftva),0) As discount From crsfactura Where Nvl(id_set_fact,0) = 0 ;
					into Cursor crstotalurifact
			Else
				Select Sum(Nvl(valdiminuatctva,0)) As Total,Sum(Nvl(valdiminuatftva,0)) As Baza,;
					Sum(Nvl(valdiminuattva,0)) As Tva,;
					Sum(Nvl(valdiscountftva,0)) As discount From crsfactura Into Cursor crstotalurifact
			Endif
		
			Select crstotalurifact
			Scan
				lnTotal = lnTotal + Nvl(Total,0)
				lnTva = lnTva + Nvl(Tva,0)
				lnBaza = lnBaza + Nvl(Baza,0)
				lnDisc = lnDisc + Nvl(discount,0)
			Endscan
			Thisform.nbazafdiscount = Nvl(lnBaza,0)
			Thisform.nbazaron = Nvl(lnBaza,0) - Round(Thisform.ndiscfactron, gnPc)
			Thisform.ndiscron = Nvl(lnDisc,0)
			Thisform.ntvaron = Nvl(lnTva,0) - Round(Thisform.ndiscfactron * (Thisform.nproc_tvav - 1), gnPc)
			Thisform.ntotalron = lnTotal - Round(Thisform.ndiscfactron * Thisform.nproc_tvav, gnPc)
		*!*	modificare	v 2.0.46	^
			If !Empty(Thisform.ndiscfactron)
				Thisform.clb_discount.procent.Value = Round(Thisform.ndiscfactron * 100 / Thisform.nbazafdiscount,2)
			Else
				Thisform.clb_discount.procent.Value = 0
			Endif
		Else
		*!*	modificare	v 2.0.46
		*!*		Select Sum(vvaldiminuatctva) As Total,Sum(vvaldiminuatftva) As Baza,;
		*!*			Sum(vvaldiminuattva) As Tva,;
		*!*			Sum(vvaldiscountftva) As discount From crsfactura Into Cursor crstotalurifact
		*!*		Select crstotalurifact
		*!*		Thisform.nbazafdiscountval = Nvl(Baza,0)
		*!*		lnTotal = Nvl(Total,0)
		*!*		Thisform.nbazaval = Nvl(Baza,0) - Round(Thisform.ndiscfactval, gnPc)
		*!*		Thisform.ndiscval = Nvl(discount,0)
		*!*		Thisform.ntvaval = Nvl(Tva,0) - Round(Thisform.ndiscfactval * (Thisform.nproc_tvav - 1), gnPc)
		*!*		Thisform.ntotalval = lnTotal - Round(Thisform.ndiscfactval * Thisform.nproc_tvav, gnPc)
			If Used('crsfacturaset')
				Select Sum(Nvl(valdiminuatctva,0)) As Total,Sum(Nvl(valdiminuatftva,0)) As Baza,;
					Sum(Nvl(valdiminuattva,0)) As Tva,;
					Sum(Nvl(valdiscountftva,0)) As discount, ;
					Sum(Nvl(vvaldiminuatctva,0)) As vTotal,Sum(Nvl(vvaldiminuatftva,0)) As vBaza,;
					Sum(Nvl(vvaldiminuattva,0)) As vTva,;
					Sum(Nvl(vvaldiscountftva,0)) As vdiscount ;			
					From crsfacturaset ;
					union All ;
					select Nvl(Sum(valdiminuatctva),0) As Total,Nvl(Sum(valdiminuatftva),0) As Baza,;
					Nvl(Sum(valdiminuattva),0) As Tva,;
					Nvl(Sum(valdiscountftva),0) As discount, ;
					Nvl(Sum(vvaldiminuatctva),0) As vTotal,Nvl(Sum(vvaldiminuatftva),0) As vBaza,;
					Nvl(Sum(vvaldiminuattva),0) As vTva,;
					Nvl(Sum(vvaldiscountftva),0) As vdiscount ;			
					From crsfactura ;
					Where Nvl(id_set_fact,0) = 0 ;
					into Cursor crstotalurifact
			Else
				Select Sum(Nvl(valdiminuatctva,0)) As Total,Sum(Nvl(valdiminuatftva,0)) As Baza,;
					Sum(Nvl(valdiminuattva,0)) As Tva,;
					Sum(Nvl(valdiscountftva,0)) As discount, ;
					Sum(Nvl(vvaldiminuatctva,0)) As vTotal,Sum(Nvl(vvaldiminuatftva,0)) As vBaza,;
					Sum(Nvl(vvaldiminuattva,0)) As vTva,;
					Sum(Nvl(vvaldiscountftva,0)) As vdiscount ;			
					From crsfactura ;
					Into Cursor crstotalurifact
			ENDIF
		
			Select crstotalurifact
			Scan
				lnTotal = lnTotal + Nvl(Total,0)
				lnTva = lnTva + Nvl(Tva,0)
				lnBaza = lnBaza + Nvl(Baza,0)
				lnDisc = lnDisc + Nvl(discount,0)
				
				lnVTotal = lnVTotal + Nvl(vTotal,0)
				lnVTva = lnVTva + Nvl(vTva,0)
				lnVBaza = lnVBaza + Nvl(vBaza,0)
				lnVDisc = lnVDisc + Nvl(vdiscount,0)
				
			Endscan
			Thisform.nbazafdiscountval = Nvl(lnVBaza,0)
			Thisform.nbazaval = Nvl(lnVBaza,0) - Round(Thisform.ndiscfactval, gnPVal)
			Thisform.ndiscval = Nvl(lnVDisc,0)
			Thisform.ntvaval = Nvl(lnVTva,0) - Round(Thisform.ndiscfactval * (Thisform.nproc_tvav - 1), gnPVal)
			Thisform.ntotalval = lnVTotal - Round(Thisform.ndiscfactval * Thisform.nproc_tvav, gnPVal)
		*!*	modificare	v 2.0.46	^
		*!*		Thisform.nbazaron = Round(Thisform.nbazaval*poDate.Curs/poDate.multiplicator,gnPc)
		*!*		Thisform.ndiscron = Round(Thisform.ndiscval*poDate.Curs/poDate.multiplicator,gnPc)
		*!*		Thisform.ntvaron = Round(Thisform.ntvaval*poDate.Curs/poDate.multiplicator,gnPc)
		*!*		Thisform.ntotalron = Round(Thisform.ntotalval*poDate.Curs/poDate.multiplicator,gnPc)
		*!*		Thisform.nbazafdiscount = Round(Thisform.nbazafdiscountval*poDate.Curs/poDate.multiplicator,gnPc)
		
			If !Empty(Thisform.ndiscfactval)
				Thisform.ndiscfactron = Round(Thisform.ndiscfactval * poDate.Curs/poDate.multiplicator,gnPc)
				Thisform.clb_discount.procent.Value = Round(Thisform.ndiscfactval * 100 / Thisform.nbazafdiscountval,2)
			Else
				Thisform.clb_discount.procent.Value = 0
			Endif
		
			Thisform.nbazafdiscount = Nvl(lnBaza,0)
			Thisform.nbazaron = Nvl(lnBaza,0) - Round(Thisform.ndiscfactron, gnPC)
			Thisform.ndiscron =  Nvl(lnDisc,0)
			Thisform.ntvaron = Nvl(lnTva,0) - Round(Thisform.ndiscfactron * (Thisform.nproc_tvav - 1), gnPC)
			Thisform.ntotalron = lnTotal - Round(Thisform.ndiscfactron * Thisform.nproc_tvav, gnPC)
		
		Endif
		
		If tlModificareDiscount
			Thisform.clb_discount.procent.Refresh()
		Else
			Thisform.clb_discount.Refresh()
		Endif
		Thisform.clb_discount_articole.Refresh()
		Thisform.clb_total_baza.Refresh()
		Thisform.clb_total_tva.Refresh()
		Thisform.clb_total_factura.Refresh()
		
		If Used('crstotalurifact')
			Use In crstotalurifact
		Endif
		
	ENDPROC

	PROCEDURE do_cauta
		If Used('crspolitici')
			Select crspolitici
			lcFiltruPol = Iif(id_pol=-9999,[.T.],[id_pol = ] + Alltrim(Str(id_pol)))
		Else
			lcFiltruPol = [2=2]
		EndIf
		lcFiltruArt = Thisform.do_creeaza_filtru(Thisform.ct_articole,[denumire],Alltrim(Strtran(Thisform.txtArticole.Value,['],[''])))
		lcFiltruCodMat = Thisform.do_creeaza_filtru(Thisform.ct_codmat,[codmat],Alltrim(Strtran(Thisform.txtCodmat.Value,['],[''])))
		lcFiltru = lcFiltruPol + [ AND ] + Iif(Empty(lcFiltruArt),[2=2],lcFiltruArt) + [ AND ] + Iif(Empty(lcFiltruCodMat),[2=2],lcFiltruCodMat)
		Select crsarticole
		Set Filter To &lcFiltru
		Locate For &lcFiltru
		If !Found()
			Go Top
		EndIf
		Thisform.grd_articole.Refresh()
	ENDPROC

	PROCEDURE do_creeaza_filtru
		Lparameters toCriteriu,tcNumeCamp,tcValoare
		Local lnCriteriu,lcFiltru
		lnCriteriu = toCriteriu.Value
		Do Case
		Case lnCriteriu = 1 and !Empty(tcValoare)
			lcFiltru = "LIKE('" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu = 2 and !Empty(tcValoare)
			lcFiltru = "UPPER(Nvl("+Alltrim(tcNumeCamp)+",''))='" + Upper(Strtran(tcValoare,['],[''])) + "'"
		Case lnCriteriu = 3 and !Empty(tcValoare)
			lcFiltru = "UPPER(Nvl("+Alltrim(tcNumeCamp)+",''))<>'" + Upper(Strtran(tcValoare,['],[''])) + "'"
		Case lnCriteriu = 4 and !Empty(tcValoare)
			lcFiltru = "LIKE('*" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu = 5 and !Empty(tcValoare)
			lcFiltru = "!LIKE('*" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu=6
			lcFiltru = "EMPTY(Nvl("+Alltrim(tcNumeCamp)+",''))"
		Case lnCriteriu=7
			lcFiltru = "!EMPTY(Nvl("+Alltrim(tcNumeCamp)+",''))"
		Endcase
		Return lcFiltru
	ENDPROC

	PROCEDURE do_initializeaza_articol
		Lparameters toArticol
		toArticol.um = Nvl(toArticol.um,'')
		If Type('toArticol.id_gestiune') = "U"
			AddProperty(toArticol,'id_gestiune',-1000)
		Endif
		If Type('toArticol.cont') = "U"
			AddProperty(toArticol,'cont',[XXXX])
		Endif
		AddProperty(toArticol,'id_temp',0)
		
		If toArticol.preturi_cu_tva = 0
			toArticol.discount_unitar = Nvl(toArticol.discount_unitar,0)
			toArticol.discount_unitar_val = Nvl(toArticol.discount_unitar_val,0)
		*!*	modificare	v 2.0.56
		*!*		AddProperty(toArticol,'discount_unitar_ctva',0)
		*!*		AddProperty(toArticol,'discount_unitar_ctva_val',0)
			AddProperty(toArticol,'discount_unitar_ctva',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.discount_unitar*(toArticol.proc_tvav-1),gnPPretV)+toArticol.discount_unitar))
			AddProperty(toArticol,'discount_unitar_ctva_val',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.discount_unitar_val*(toArticol.proc_tvav-1),gnPVal)+toArticol.discount_unitar_val))
		*!*	modificare	v 2.0.56	^
			AddProperty(toArticol,'pretftva',toArticol.Pret)
			AddProperty(toArticol,'tva',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.Pret * (toArticol.proc_tvav - 1),gnPPretV)))
			AddProperty(toArticol,'pretctva',toArticol.Pret + toArticol.tva)
			AddProperty(toArticol,'pretftva_val',toArticol.pret_val)
			AddProperty(toArticol,'tva_val',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.pret_val * (toArticol.proc_tvav - 1),gnPVal)))
			AddProperty(toArticol,'pretctva_val',toArticol.pret_val + toArticol.tva_val)
		Else
			AddProperty(toArticol,'discount_unitar_ctva',Iif(Isnull(toArticol.proc_tvav),0,Nvl(toArticol.discount_unitar,0)))
			AddProperty(toArticol,'discount_unitar_ctva_val',Iif(Isnull(toArticol.proc_tvav),0,Nvl(toArticol.discount_unitar_val,0)))
		*!*	modificare	v 2.0.56
		*!*		toArticol.discount_unitar = 0
		*!*		toArticol.discount_unitar_val = 0
			toArticol.discount_unitar = Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.discount_unitar/ toArticol.proc_tvav,gnPPretV))
			toArticol.discount_unitar_val = Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.discount_unitar_val/ toArticol.proc_tvav,gnPVal))
		*!*	modificare	v 2.0.56	^
			AddProperty(toArticol,'pretctva',toArticol.Pret)
			AddProperty(toArticol,'pretftva',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.Pret / toArticol.proc_tvav,gnPPretV)))
			AddProperty(toArticol,'tva',toArticol.Pret-toArticol.pretftva)
			AddProperty(toArticol,'pretctva_val',toArticol.pret_val)
			AddProperty(toArticol,'pretftva_val',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.pret_val/toArticol.proc_tvav,gnPVal)))
			AddProperty(toArticol,'tva_val',toArticol.pretctva_val-toArticol.pretftva_val)
		Endif
		AddProperty(toArticol,'valftva',0)
		AddProperty(toArticol,'valtva',0)
		AddProperty(toArticol,'valctva',0)
		AddProperty(toArticol,'valdiscountftva',0)
		AddProperty(toArticol,'valdiscounttva',0)
		AddProperty(toArticol,'valdiscountctva',0)
		AddProperty(toArticol,'valdiminuatftva',0)
		AddProperty(toArticol,'valdiminuattva',0)
		AddProperty(toArticol,'valdiminuatctva',0)
		AddProperty(toArticol,'vvalftva',0)
		AddProperty(toArticol,'vvaltva',0)
		AddProperty(toArticol,'vvalctva',0)
		AddProperty(toArticol,'vvaldiscountftva',0)
		AddProperty(toArticol,'vvaldiscounttva',0)
		AddProperty(toArticol,'vvaldiscountctva',0)
		AddProperty(toArticol,'vvaldiminuatftva',0)
		AddProperty(toArticol,'vvaldiminuattva',0)
		AddProperty(toArticol,'vvaldiminuatctva',0)
		*!*	modificare	v 2.0.46
		*!*	AddProperty(toArticol,'id_jtva_coloana',0)
		*!*	AddProperty(toArticol,'explicatie','')
		If Type('toArticol.id_jtva_coloana') = 'U'
			AddProperty(toArticol,'id_jtva_coloana',0)
		Endif
		If Type('toArticol.taxcode') = 'U'
			AddProperty(toArticol,'taxcode',0)
		Endif
		
		*!*	modificare v 2.0.67
		*!*	AddProperty(toArticol,'explicatie',Iif(poDate.tip=7,[INVOICE ] + poDate.descriere,''))
		If Type('toArticol.explicatie') = 'U'
			AddProperty(toArticol,'explicatie',Iif(poDate.tip=7,[INVOICE ] + poDate.descriere,''))
		Endif
		If Type('toArticol.serie') = 'U'
			AddProperty(toArticol,'serie','')
		Else
			toArticol.serie = Nvl(toArticol.serie,[])
		ENDIF
		If Type('toArticol.lot') = 'U'
			AddProperty(toArticol,'lot','')
		Else
			toArticol.lot = Nvl(toArticol.lot,[])
		Endif
		If Type('toArticol.opt_facturare') = 'U'
			AddProperty(toArticol,'opt_facturare',0)
		Endif
		If Type('toArticol.id_ctr') = 'U'
			AddProperty(toArticol,'id_ctr',Null)
		Endif
		If Type('toArticol.numar_contract') = 'U'
			AddProperty(toArticol,'numar_contract',Null)
		Endif
		*!*	modificare v 2.0.67	^
		AddProperty(toArticol,'codmatf','')
		*!*	modificare	v 2.0.46	^
		If Type('toArticol.pret_achizitie')="U"
			AddProperty(toArticol,'pret_achizitie',0)
		Else
			If Isnull(toArticol.pret_achizitie)
				toArticol.pret_achizitie = 0
			Endif
		Endif
		*!*	modificare v 2.0.19
		AddProperty(toArticol,'id_lucrare_rez',0)
		AddProperty(toArticol,'id_part_rez',0)
		AddProperty(toArticol,'pretv_orig',0)
		*!*	modificare v 2.0.19	^
		*!*	modificare	v 2.0.56
		If Inlist(poDate.tip,8,9,24) && retur lei, retur valuta, aviz retur
			toArticol.cantitate = (-1) * toArticol.cantitate
		Endif
		If Type('toArticol.pretd') = 'U'
			AddProperty(toArticol,'pretd',0.0000)
		Endif
		If Type('toArticol.id_valuta_d') = 'U'
			AddProperty(toArticol,'id_valuta_d',Null)
		Endif
		*!*	modificare	v 2.0.56	^
		*!*	modificare	v 2.0.67
		*!*	modificare	v 2.0.90 : am adaugat 7
		If Inlist(poDate.tip,1,2,5,6,22,23,29,41,7,10) AND !(INLIST(toArticol.opt_facturare,1,2) OR poDate.lCopiere)
			toArticol.cantitate = 0
		Endif
		*!*	modificare	v 2.0.67	^
	ENDPROC

	PROCEDURE do_renunt
		*!*	modificare	19.01.2007
		DODEFAULT()
		*!*	If This.inainte_de_do_renunt()
		*!*		gnButon = 2
		*!*		pnButon = 2
		*!*		Buton = 2
		*!*		pnIesire = 2
		*!*		If !This.lhide
		*!*			This.Release
		*!*		Else
		*!*			This.Hide
		*!*		Endif
		*!*		Sqlrollback(gnHandle)
		*!*		SQLSetprop(gnHandle,"Transactions",1) && tranzactie automata
		*!*	Endif
		*!*	modificare	19.01.2007	^
	ENDPROC

	PROCEDURE do_reset
		*!*	modificare v 2.0.56
		Local lcCriteriuCod
		Local lcCriteriuDenumire
		lcCriteriuCod = goExport.citesteSetareRegistru("CRITCOD")
		If !Empty(lcCriteriuCod) And Type('VAL(lcCriteriuCod)') = 'N'
			Thisform.ncritcod = Val(lcCriteriuCod)
		Endif
		Thisform.ct_codmat.Value = Thisform.ncritcod
		*!*	modificare	v 2.0.56	^
		
		lcCriteriuDenumire = goExport.citesteSetareRegistru("CRITDENUMIRE")
		If !Empty(lcCriteriuDenumire) And Type('VAL(lcCriteriuDenumire)') = 'N'
			Thisform.ncritDenumire = Val(lcCriteriuDenumire)
		Endif
		Thisform.ct_articole.Value = Thisform.ncritDenumire
		
		Thisform.txtCodmat.Value = []
		*Thisform.ct_articole.Value = 1
		Thisform.txtArticole.Value = []
		*!*	modificare	v 2.0.56
		Thisform.do_cauta()
		Thisform.Refresh()
		Thisform.txtCodmat.SetFocus()
		*!*	modificare v 2.0.56	^
		
	ENDPROC

	PROCEDURE do_retur
		Thisform.do_adauga_articol(.F., .F., .T.)
	ENDPROC

	PROCEDURE do_scrie_articole
		Local llReturn,lcSql,lnSucces
		llReturn = .T.
		*!*	pentru lnNrInregistrari > 1 trebuie am mai multe variabile : poArt1,poArt2,poArt3 ca sa pot concatena lcSql
		*!*	lnNrInregistrari = 1	&&	trimite sirul catre server o data pentru lnNrInregistrari
		*!*	lnNrInregCurenta = 0
		
		If Thisform.do_deschide_tranzactie()
		
			* Factura de vanzare pe care am adaugat articole retur
			IF !EMPTY(thisform.cListaIdArticoleRetur)
				poDate.listaid = thisform.cListaIdArticoleRetur
			ENDIF 
			
			lcSql = [pack_facturare.initializeaza_date_factura(] + ;
				[to_date('] + ALLTRIM(NVL(Dtoc(poDate.dataireg,2),[])) + [','YYYYMMDD'),] + ;
				Nvl(Alltrim(Str(poDate.id_fdoc)),[NULL]) + [,to_date('] + ALLTRIM(NVL(Dtoc(poDate.dataact,2),[])) + [','YYYYMMDD'),] + ;
				[to_date('] + ALLTRIM(NVL(Dtoc(poDate.datascad,2),[])) + [','YYYYMMDD'),'] + ALLTRIM(Nvl(poDate.serie_act,[])) + [',] + ;
				Alltrim(Str(poDate.nract,14,0)) + [,] + ;
				Iif(Isnull(poDate.id_client),[NULL],Alltrim(Str(poDate.id_client))) + [,] + ;
				Iif(Isnull(poDate.id_lucrare),[NULL],Alltrim(Str(poDate.id_lucrare))) + [,] + ;
				Iif(Isnull(poDate.id_sectie),[NULL],Alltrim(Str(poDate.id_sectie))) + [,] + ;
				Iif(Isnull(poDate.id_venchelt),[NULL],Alltrim(Str(poDate.id_venchelt))) + [,] + ;		&&	modificare	v 2.0.46
				iif(Isnull(poDate.id_responsabil),[NULL],Alltrim(Str(poDate.id_responsabil))) + [,] + ;
				IIF(EMPTY(nvl(poDate.explicatia4,[])),[NULL],['] + OracleSpecialCharacters(ALLTRIM(poDate.explicatia4))+[']) + [,] + ;		&&	modificare	ROACONTRACTE v 2.0.42
				[NULL,] + Iif(Isnull(poDate.listaid),[NULL],['] + Alltrim(Iif(Type('poDate.listaid')='C',poDate.listaid,Str(poDate.listaid))) + [']) + [,] + ;
				['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.descriere,[]),100))) + [',] + ;
				Alltrim(Str(poDate.Tip)) + [,] + Alltrim(Str(poDate.id_set)) + [,] + ;
				[to_date('] + ALLTRIM(NVL(Dtoc(poDate.zi_curs,2),[])) + [','YYYYMMDD'),] + Alltrim(Str(poDate.id_valuta)) + [,] + ;
				Alltrim(Str(poDate.in_valuta)) + [,] + ;
				alltrim(str(poDate.tva_incasare)) + [,] + ;
				Iif(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [,] + ;
				Alltrim(Str(gnIdUtil)) + [);]
		
			If Inlist(poDate.Tip,23,25,30,41)				&&	transfer intre subunitati pe baza de lista de preturi/comanda
				lcSql = lcSql + [ pack_facturare.initializeaza_date_gestiune(] + Alltrim(Str(poDateGestiuneDest.id_gestiune)) + [,] + ;
					Alltrim(Str(poDateGestiuneDest.id_tipgest)) + [,'] + Alltrim(poDateGestiuneDest.Cont) +[',] + ;
					['] + Alltrim(Nvl(poDateGestiuneDest.acont,[])) + [');]
			Endif
		
			If Inlist(poDate.Tip,23,25)
				If poDateGestiuneDest.Cont = '357'
					loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Partener rezervare??cCont=>357??lAdaugCorespondente=>1]))
					If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
						poDate.id_part_rez = loCauta.id_part
						lcSql = lcSql + [ pack_facturare.initializeaza_part_rez(] + Alltrim(Str(loCauta.id_part)) + [);]
						*!*	modificare	v 2.1.0
						loCauta = caut_contract_activ(-1,poDate.id_part_rez)
						If gnButon = 1
							poDate.text_aditional = [Conform contract nr.] + Alltrim(loCauta.numar) + [ din data de ] + ;
								PADL(Alltrim(Str(Day(loCauta.Data))),2,[0]) + [.] + ;
								PADL(Alltrim(Str(Month(loCauta.Data))),2,[0]) + [.] + ;
								ALLTRIM(Str(Year(loCauta.Data))) + ;
								IIF(!Empty(poDate.text_aditional),Chr(13) + Chr(10) + poDate.text_aditional,[])
						Endif
						*!*	modificare	v 2.1.0	^
					ENDIF
				Endif
			Endif
		*!*	modificare v 2.0.19	^
			lcSql = [begin ] + lcSql + [ end;]
		
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces<0
				amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				llReturn = .F.
			Else
				Private poArt
				lcSql = []
				Select crsfactura
				Scan
		*!*				lnNrInregCurenta = lnNrInregCurenta + 1
					Scatter Name poArt MEMO
		*!*	modificare v 2.0.67
					If Inlist(poArt.opt_facturare,1,2)
						lcSql = lcSql + gcS + [.pack_facturare.adauga_rata_factura(] + Alltrim(Str(poArt.id_rata)) + [,] + ;
							IIF(poArt.cu_tva = 0,;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.pretftva,18,gnPPretV)),Alltrim(Str(poArt.vpretftva,18,gnPVal))),;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.pretctva,18,gnPPretV)),Alltrim(Str(poArt.vpretctva,18,gnPVal)))) + [,] + ;
							Alltrim(Str(poArt.Curs,18,4)) + [,] + ALLTRIM(STR(poArt.multiplicator,10)) + [,] + ;
							Alltrim(Str(poArt.id_jtva_coloana)) + [,] + ;
							['] + OracleSpecialCharacters(Alltrim(poArt.denumire)) + [',] + ;
							alltrim(Str(gnIdUtil)) + [,] + ;
							NVL(ALLTRIM(STR(poArt.taxcode)),[NULL])+ [);]
					Else
		*!*	modificare v 2.0.67	^
		*!* v 2.0.13
		*!*				lcSql = lcSql + gcS + [.pack_facturare.adauga_articol_factura(?poArt.id_temp,?poArt.id_articol,TRIM(NVL(?poArt.serie,'')),] + ;
		*!*					[TRIM(NVL(?poArt.explicatie,'')),?poArt.id_pol,?poArt.id_gestiune,?poArt.pret_achizitie,] + ;
		*!*					IIF(poArt.cu_tva=0,;
		*!*					IIF(poArt.tip_valuta = 0,[?poArt.pretftva],[?poArt.vpretftva]),;
		*!*					IIF(poArt.tip_valuta = 0,[?poArt.pretctva],[?poArt.vpretctva])) + [,] + ;
		*!*					[?poArt.id_valuta,?poArt.cu_tva,?poArt.gestionabil,?poArt.cantitate,] + ;
		*!*					IIF(poArt.cu_tva = 0,;
		*!*					Iif(poArt.tip_valuta = 0,[?poArt.discountftva],[?poArt.vdiscountftva]), ;
		*!*					IIF(poArt.tip_valuta = 0,[?poArt.discountctva],[?poArt.vdiscountctva])) + [,] + ;
		*!*					[TRIM(NVL(?poArt.Cont,'')),?poArt.Curs,?poArt.id_jtva_coloana,?poArt.id_set_fact,?gnIdUtil);]
		*!*	*!*				If lnNrInregCurenta = lnNrInregistrari
		*!*	modificare v 2.0.56 : am adaugat pretd, id_valutad
		*!*	modificare v 2.0.67 : am adaugat id_ctr
		*!*	modificare v 2.2.14 : am pus gnPPretval in loc de gnPVal la poArt.pretd
										
						lcSql = lcSql + [pack_facturare.adauga_articol_factura(] + Alltrim(Str(poArt.id_temp)) + [,] + ;
							Alltrim(Str(poArt.id_articol)) + [,] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArt.serie,[]))) + [',] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArt.explicatie,''))) + [',] + Nvl(Alltrim(Str(poArt.id_pol)),[NULL]) + [,] + ;
							Nvl(Alltrim(Str(poArt.id_gestiune)),[NULL]) + [,] + Alltrim(Str(poArt.pret_achizitie,18,gnPPret)) + [,] + ;
							Alltrim(Str(poArt.pretd,18,gnPPretval)) + [,] + ;
							Iif(Isnull(poArt.id_valuta_d),[NULL],Alltrim(Str(poArt.id_valuta_d))) + [,] + ;
							IIF(poArt.cu_tva=0,;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.pretftva,18,gnPPretV)),Alltrim(Str(poArt.vpretftva,18,gnPVal))),;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.pretctva,18,gnPPretV)),Alltrim(Str(poArt.vpretctva,18,gnPVal)))) + [,] + ;
							Alltrim(Str(poArt.id_valuta)) + [,] + Alltrim(Str(poArt.cu_tva)) + [,] + Alltrim(Str(poArt.gestionabil)) + [,] + ;
							Alltrim(Str(poArt.cantitate,18,gnPCant)) + [,] + ;
							IIF(poArt.cu_tva = 0,;
							Iif(poArt.tip_valuta = 0,Alltrim(Str(poArt.discountftva,18,gnPPretV)),Alltrim(Str(poArt.vdiscountftva,18,gnPVal))), ;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.discountctva,18,gnPPretV)),Alltrim(Str(poArt.vdiscountctva,18,gnPVal)))) + [,] + ;
							['] + Alltrim(Nvl(poArt.Cont,'')) + [',] + Alltrim(Str(poArt.Curs,18,6)) + [,] + ;
							ALLTRIM(STR(poArt.multiplicator,10)) + [,] + Alltrim(Str(poArt.id_jtva_coloana)) + [,] + ;
							Nvl(Alltrim(Str(poArt.id_part_rez)),[NULL]) + [,] + Nvl(Alltrim(Str(poArt.id_lucrare_rez)),[NULL]) + [,] + ;
							Alltrim(Str(poArt.pretv_orig,18,gnPPretV)) + [,] + ;
							Nvl(Alltrim(Str(poArt.id_set_fact)),[NULL]) + [,] + NVL(ALLTRIM(STR(poArt.id_ctr)),[NULL]) + [,] + Alltrim(Str(gnIdUtil)) + [,] + ;
							NVL(ALLTRIM(STR(poArt.taxcode)),[NULL]) + ;
							[,'] + OracleSpecialCharacters(Alltrim(Nvl(poArt.lot,[]))) + ['] + ;
							[);]
		*!* v 2.0.13 ^
		*!*	modificare v 2.0.67
					Endif
		*!*	modificare v 2.0.67	^
					* Pentru articolele fara stoc, dar pe care le vreau facturate, le descarc ca si la programulde restaurant
		*!*				lcSql = [begin ] + ;
		*!*					IIF(Alltrim(Str(poArt.id_articol)) + [,]$this.cListaArticoleFaraStoc, ' pack_Facturare.ntip := pack_facturare.nTipFacturaRestaurant; ', '') + ;
		*!*					lcSql + ;
		*!*					IIF(Alltrim(Str(poArt.id_articol)) + [,]$this.cListaArticoleFaraStoc, ' pack_Facturare.ntip := ' + ALLTRIM(STR(poDate.Tip)) + '; ', '') + ;
		*!*					[ end;]
						
					lcSql = [begin ] + lcSql + [ end;]
						
					lnSucces = goExecutor.oExecute(lcSql)
					If lnSucces < 0
						amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
						llReturn = .F.
						Exit
					Else
		*!*						lnNrInregCurenta = 0
						lcSql = []
					Endif
		*!*				Endif
				Endscan
		
				If Used('crsfacturaset') And llReturn
					Private poArtSet
		*!*				lnNrInregCurenta = lnNrInregCurenta + 1				&&		1
					lcSql = lcSql + gcS + [.pack_facturare.initializeaza_seturi_temp;]
					Select crsfacturaset
					Scan
						Scatter Name poArtSet MEMO
		*!* v 2.0.13
		*!*					lnNrInregCurenta = lnNrInregCurenta + 1			&&		2
		*!*					lcSql = lcSql + gcS + [.pack_facturare.adauga_articol_set(?poArtSet.id_set_fact,] + ;
		*!*						[TRIM(NVL(?poArtSet.denumire,'')),TRIM(NVL(?poArtSet.explicatie,'')),?poArtSet.um,] + ;
		*!*						[TRIM(NVL(?poArtSet.serie,'')),?poArtSet.cantitate,] + ;
		*!*						IIF(poDate.in_valuta=0,[?poArtSet.pretftva],[?poArtSet.vpretftva]) + [);]
		
		*!*	modificare	v 2.0.56 : am adaugat discount_unitar
						lcSql = lcSql + [pack_facturare.adauga_articol_set(] + Alltrim(Str(poArtSet.id_set_fact)) + [,] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArtSet.denumire,''))) + [',] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArtSet.explicatie,''))) + [',] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArtSet.um,''))) + [',] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArtSet.serie,''))) + [',] + ;
							Alltrim(Str(poArtSet.cantitate,18,gnPCant)) + [,] + ;
							IIF(poDate.in_valuta=0,Alltrim(Str(poArtSet.pretftva,18,gnPPretV)),Alltrim(Str(poArtSet.vpretftva,18,gnPVal))) + [,] + ;
							IIF(poDate.in_valuta=0,Alltrim(Str(poArtSet.discountftva,18,gnPPretV)),Alltrim(Str(poArtSet.vdiscountftva,18,gnPVal))) + [);]
		*!* v 2.0.13 ^
		
		*!*					If lnNrInregCurenta >= lnNrInregistrari			&&	daca mai raman inregistrari nescrise din crsfactura
		*!*									&& + operatiie 1 si 2 s-ar putea ca lnNrInregCurenta
		*!*									&& sa fie mai mare decat lnNrInregistrari
						lcSql = [begin ] + lcSql + [ end;]
						lnSucces = goExecutor.oExecute(lcSql)
						If lnSucces < 0
							amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
							llReturn = .F.
							Exit
						Else
		*!*							lnNrInregCurenta = 0
							lcSql = []
						Endif
		*!*					Endif
					Endscan
				Endif
		
				If !Empty(lcSql) And llReturn
					lcSql = [begin ] + lcSql + [ end;]
					lnSucces = goExecutor.oExecute(lcSql)
					If lnSucces < 0
						amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
						llReturn = .F.
					Endif
				Endif
			ENDIF
		
			If poDate.in_valuta = 1 And llReturn
				Thisform.do_calculeaza_totaluri()
		*!*		modificare 04.02.2008
		*!*			poDate.totctvaconv		=	Thisform.ntotalron
		*!*		modificare 04.02.2008	^
				poDate.totftvaconv		=	Thisform.nbazaron
				poDate.tottvaconv		=	Thisform.ntvaron
				poDate.totctvaconv		=	poDate.totftvaconv + poDate.tottvaconv
				* 08.05.2023
				* Nu mai recalculez total factura in lei = valoare totala valuta * curs si apoi aplic diferenta fata de suma(pret lei * cantitate) pe primul articol
				* Pentru ca am modificat calculul de total in lei in formularul de articole si in raport sa fie egal cu suma(pret lei * cantitate) 
				IF .F.
					llReturn = recalculeaza_pret_vanzare_lei([crsfactura],poDate.Curs/poDate.multiplicator) 	&& ofacturare_comun.prg
				ENDIF 
		*!*			If llReturn
		*!*				llReturn = recalculeaza_pret_vanzare_set([crsfacturaset],poDate.Curs) 	&& ofacturare_comun.prg
		*!*			Endif
			Endif
		Else
			llReturn = .F.
		Endif
		If !llReturn
			Thisform.do_inchide_tranzactie(2)
		Endif
		Release poArt,poArtSet
		Return llReturn
	ENDPROC

	PROCEDURE do_scrie_factura
		*!* 05.02.2015
		*!* marius.mutu
		*!*  Pentru poDate.eBonFiscal, hacuiesc Tip = 43 bon fiscal magazin, ca sa apara in vanzari.tip = 43, apoi pun tipul la loc, ca sa nu deranjez alte lucruri
		
		*!* 14.09.2016
		*!* marius.mutu
		*!* scrie_factura_avize - lipseau 2 parametri din apel: v_id_facturare (adresa de facturare), v_listare_detaliata
		
		*!*	26.01.2021
		*!*	salvare proforma in tabelul vanzari in loc de proforme
		
		*!* 22.11.2021
		*!* marius.mutu
		*!* ntip_incasare = 3 POS/Card
		
		*!*		emitere avize / facturi
		Private pnDiscount, pnFacturaRetur, pnParametruAditional, pcSirDifAcont, pcSirDifPart, pnTotalFtva, pnTotalTva
		Local llReturn,lnSucces,lnCantitateRamasa,lcSql, lcListaIncasare, lnTipOriginal, llEproforma
		Store 0 To pnTotalFtva, pnTotalTva		&&	modificare	v 2.0.46
		pcSirDifAcont = []
		pcSirDifPart = []
		lcCursorVerificare = [crsact]
		lcCursorFinal = [actactan]
		pnFacturaRetur = 0
		pnParametruAditional = 0
		llReturn = .T.
		lcListaIncasare = ''
		llEproforma = (poDate.eProforma = 1)
		
		If Inlist(poDate.ntip_incasare, 11, 2, 3) && 11 = CHITANTA, 2 = BON FISCAL, 3 = POS/Card
			Do Case
				Case poDate.ntip_incasare = 11 && chitanta
					If poDate.incasat <> 0
						lcListaIncasare = lcListaIncasare + ['11|] + Alltrim(Str(poDate.incasat,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
				Case poDate.ntip_incasare = 3 && POS/Card
					If poDate.incasatCARD <> 0 && bon fiscal CARD POS
						lcListaIncasare = lcListaIncasare + ['3|] + Alltrim(Str(poDate.incasatCARD,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
				Otherwise && bon fiscal
					If poDate.incasat <> 0 && bon fiscal numerar
						lcListaIncasare = lcListaIncasare + ['2|] + Alltrim(Str(poDate.incasat,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
		
					If poDate.incasatCARD <> 0 && bon fiscal CARD POS
						lcListaIncasare = lcListaIncasare + ['3|] + Alltrim(Str(poDate.incasatCARD,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
		
					If poDate.incasatTichete <> 0 && bon fiscal tichete
						lcListaIncasare = lcListaIncasare + ['5|] + Alltrim(Str(poDate.incasatTichete,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
			Endcase
		
		Else
			lcListaIncasare = [NULL]
		Endif
		
		***************************************************************
		* Hacuiesc Tip = 43 bon fiscal magazin, ca sa apara in vanzari.tip = 43, apoi pun tipul la loc, ca sa nu deranjez alte lucruri
		lnTipOriginal = poDate.Tip
		If (poDate.eBonFiscal = 1)
			poDate.Tip = 43 && bon fiscal magazin
		Endif
		***************************************************************
		
		*!*	modificare	v 2.0.46
		llReturn = Thisform.do_scrie_articole() && se deschide tranzactie manuala
		If m.llReturn
			If (poDate.eBonFiscal = 1)
				poDate.Tip = m.lnTipOriginal
			Endif
		
			*!*	modificare	v 2.0.46	^
			If poDate.in_valuta = 1
				pnDiscount = Thisform.ndiscfactval
			Else
				pnDiscount = Thisform.ndiscfactron
			Endif
			*!*	modificare	v 2.0.46
			pnTotalFtva = Thisform.nbazaron
			pnTotalTva = Thisform.ntvaron
			*!*	modificare	v 2.0.46	^
		
			poDate.text_aditional = Strtran(poDate.text_aditional,Chr(13)+Chr(10),Chr(170),1,100,1)
			Do Case
				Case poDate.eProforma = 1
					* scrie_proforma are aceiasi parametri ca scrie_factura2
					* salveaza doar in vanzari, nu si in contabilitate
					lcSql = [{call pack_facturare.scrie_proforma(] + ;
						Alltrim(Str(pnTotalFtva,18,gnPc)) + [,] + Alltrim(Str(pnTotalTva,18,gnPc)) + [,] + ;	&&	modificare	v 2.0.46
					Alltrim(Str(pnDiscount,18,gnPc)) + [,] + ;
						['] + Alltrim(Nvl(poDate.serie_chit,[])) + [',] + ;
						Alltrim(Str(poDate.nr_incasare)) + [,] + ;
						m.lcListaIncasare + [,] + ;
						IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
						IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
						IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
						IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;
						[to_date('] + Ttoc(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
						IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
						['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional,[]),100))) + [',] + ;
						Alltrim(Str(poDate.discount_evidentiat)) + [,] + ;
						ALLTRIM(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare)}]
				Case poDate.Tip = 4
					*!*	facturare din aviz
					Select crsarticole
					Calculate Sum(cantitate) To lnCantitateRamasa
					If lnCantitateRamasa > 0
						pnFacturaRetur = 7 - amessagebox("Doriti sa se inregistreze si avizul de retur?",4+32,"Confirmare")
						pnParametruAditional = 1
					Else
						pnFacturaRetur = 0
						pnParametruAditional = 0
					Endif
					*!* v 2.0.13
					*!*		lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura_avize(] + ;
					*!*			[?pnDiscount,?poDate.nr_incasare,?poDate.id_casa,?poDate.incasat,?poDate.id_delegat,?poDate.id_masina,] + ;
					*!*			[?poDate.id_agent,?poDate.text_aditional,?poDate.discount_evidentiat,?pnParametruAditional)}]
					*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
					*!*	modificare	v 2.0.80 : am adaugat poDate.serie_chit
					lcSql = [{call pack_facturare.scrie_factura_avize(] + ;
						ALLTRIM(Str(pnDiscount,18,gnPc))+ [,] + ;
						['] + Alltrim(Nvl(poDate.serie_chit,[])) + [',] + ;
						Alltrim(Str(poDate.nr_incasare)) + [,] + ;
						m.lcListaIncasare + [,] + ;
						IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
						IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
						IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
						IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;
						[to_date('] + Ttoc(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
						IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
						['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional,[]),100))) + [',] + ;
						ALLTRIM(Str(poDate.discount_evidentiat)) + [,] + Alltrim(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare)}]
					*!* v 2.0.13 ^
				Case Inlist(poDate.Tip,3,21,25,28,42,47)			&&	modificare v 2.0.93 : am adaugat 47
					*!*	facturare pe baza de comanda / avize pe baza de comanda
					Select crsarticole
					Calculate Sum(cantitate) To lnCantitateRamasa
					If lnCantitateRamasa <> 0
						pnParametruAditional = 7 - amessagebox("Doriti sa se inchida comanda?",4+32,"Confirmare")
					Endif
					*!* v 2.0.13
					*!*		lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura(] + ;
					*!*			[?pnDiscount,?poDate.nr_incasare,?poDate.id_casa,?poDate.incasat,?poDate.id_delegat,?poDate.id_masina,] + ;
					*!*			[?poDate.id_agent,?poDate.text_aditional,?poDate.discount_evidentiat,?pnParametruAditional)}]
					*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
					*!*	modificare	v 2.0.80 : am adaugat serie_chit
					lcSql = [{call pack_facturare.scrie_factura2(] + ;
						Alltrim(Str(pnTotalFtva,18,gnPc)) + [,] + Alltrim(Str(pnTotalTva,18,gnPc)) + [,] + ;	&&	modificare	v 2.0.46
					Alltrim(Str(pnDiscount,18,gnPc)) + [,] + ;
						['] + Alltrim(Nvl(poDate.serie_chit,[])) + [',] + ;
						Alltrim(Str(poDate.nr_incasare)) + [,] + ;
						m.lcListaIncasare + [,] + ;
						IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
						IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
						IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
						IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;
						[to_date('] + Ttoc(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
						IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
						['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional,[]),100))) + [',] + ;
						Alltrim(Str(poDate.discount_evidentiat)) + [,] + ;
						ALLTRIM(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare)}]
					*!* v 2.0.13 ^
				Otherwise
					*!* v 2.0.13
					*!*		lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura(] + ;
					*!*			[?pnDiscount,?poDate.nr_incasare,?poDate.id_casa,?poDate.incasat,?poDate.id_delegat,?poDate.id_masina,] + ;
					*!*			[?poDate.id_agent,?poDate.text_aditional,?poDate.discount_evidentiat,?pnParametruAditional)}]
					*!*	modificare	v 2.0.93
					If poDate.Tip = 48
						pnParametruAditional = poDate.coeficient_k
					Endif
					*!*	modificare	v 2.0.93	^
					*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
					*!*	modificare	v 2.0.80 : am adaugat serie_chit
					lcSql = [{call pack_facturare.scrie_factura2(] + ;
						Alltrim(Str(pnTotalFtva,18,gnPc)) + [,] + Alltrim(Str(pnTotalTva,18,gnPc)) + [,] + ;	&&	modificare	v 2.0.46
					Alltrim(Str(pnDiscount,18,gnPc)) + [,] + ;
						['] + Alltrim(Nvl(poDate.serie_chit,[])) + [',] + ;
						Alltrim(Str(poDate.nr_incasare)) + [,] + ;
						m.lcListaIncasare + [,] + ;
						IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
						IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
						IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
						IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;
						[to_date('] + Ttoc(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
						IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
						['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional,[]),100))) + [',] + ;
						Alltrim(Str(poDate.discount_evidentiat)) + [,] + ;
						ALLTRIM(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare)}]
					*!* v 2.0.13 ^
			Endcase
			*!*	modificare	v 2.0.46
			*!*	If Thisform.do_scrie_articole()
			*!*	modificare	v 2.0.46	^
		
			llReturn = goExecutor.oExecuta(lcSql,lcCursorVerificare)
			If m.llReturn
				If poDate.eProforma = 0
					If Reccount(lcCursorVerificare)>0
						gnButon = 1
						Select a.*,a.suma As totftva, a.suma As tottva, Ttod(a.dataactt) As dataact, ;
							Ttod(a.datairegt) As dataireg, Ttod(a.datascadt) As datascad, ;
							0 As pozitie_1, 0 As pozitie_2 From (lcCursorVerificare) a Into Cursor (lcCursorFinal) Readwrite
						Use In (lcCursorVerificare)
						Select (lcCursorFinal)
						Do Form verificare With .T.,.T.
						If gnButon = 1
							Select (lcCursorFinal)
							Scan For Nvl(ascd,'') <> Nvl(ascd1,'') Or Nvl(ascc,'') <> Nvl(ascc1,'') Or ;
									NVL(id_partd,0) <> Nvl(id_partd1,0) Or Nvl(id_partc,0) <> Nvl(id_partc1,0)
								If Nvl(ascd,'') <> Nvl(ascd1,'') Or Nvl(ascc,'') <> Nvl(ascc1,'')
									pcSirDifAcont = pcSirDifAcont + Alltrim(Str(id_act)) + [|] + Alltrim(Nvl(ascd,'')) + [|] + Alltrim(Nvl(ascc,'')) + [;]
								Endif
								If Nvl(id_partd,0) <> Nvl(id_partd1,0) Or Nvl(id_partc,0) <> Nvl(id_partc1,0)
									If (Like([41*],scd) And Nvl(id_partd,0) <> Nvl(id_partd1,0)) ;
											Or (Like([41*],scc) And Nvl(id_partc,0) <> Nvl(id_partc1,0))
										amessagebox("Nu puteti modifica clientul!",48,"Atentie")
										Return .F.
									Else
										pcSirDifPart = pcSirDifPart + Alltrim(Str(id_act)) + [|] + Alltrim(Str(Nvl(id_partd,0))) + [|] + Alltrim(Str(Nvl(id_partc,0))) + [;]
									Endif
								Endif
							Endscan
							*!*	modificare 20.06
							lnReturn = 1
							If pnFacturaRetur = 1
								lnReturn = completeaza_date_aviz_retur() && IN ofacturare.prg	&&	modificare 13.11.2007
								If lnReturn > 0
									*!* v 2.0.13
									*!*							lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura_avize_retur(] + ;
									*!*								[?pnDiscount,?poDate.id_delegat,?poDate.id_masina,?poDate.id_agent,] + ;
									*!*								[?poDate.discount_evidentiat,?poDate.text_aditional,?poDate.text_aditional_retur,] + ;
									*!*								[?pcSirDifAcont,?pcSirDifPart,?pnParametruAditional,?poDate.serie_act_retur,] + ;
									*!*								[?poDate.nract_retur)}]
									*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare, poDate.nid_vanzare_retur
									lcSql = [{call pack_facturare.scrie_factura_avize_retur(] + ;
										ALLTRIM(Str(pnDiscount,18,gnPc)) + [,] + ;
										IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
										IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
										IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
										IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;
										[to_date('] + Ttoc(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
										IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
										ALLTRIM(Str(poDate.discount_evidentiat)) + [,] + ;
										['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional,[]),100))) + [',] + ;
										['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional_retur,[]),100))) + [',] + ;
										['] + Alltrim(Nvl(pcSirDifAcont,[])) + [','] + ;
										ALLTRIM(Nvl(pcSirDifPart,[])) + [',] + Alltrim(Str(pnParametruAditional)) + [,'] + ;
										ALLTRIM(Nvl(poDate.serie_act_retur,[]))+ [',] + Alltrim(Str(poDate.nract_retur,14,0)) + [,] + ;
										[?@poDate.nid_vanzare,?@poDate.nid_vanzare_retur)}]
									*!* v 2.0.13 ^
									lcCursor = [crsavizretur]
									lnSucces = goExecutor.oExecute(lcSql,lcCursor)
								Else
									gnButon = 2
									llReturn = .F.
								Endif
								*!*	modificare 20.06	^
							Else
								*!* v 2.0.13
								*!*						lcSql = [begin ] + gcS + [.pack_facturare.finalizeaza_scriere_verificare(?pnDiscount,?poDate.id_delegat,] + ;
								*!*							[?poDate.id_masina,?poDate.id_agent,?poDate.text_aditional,?pcSirDifAcont,?pcSirDifPart,?pnParametruAditional); end;]
								*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
								lcSql = [begin pack_facturare.finalizeaza_scriere_verificare(] + ;
									ALLTRIM(Str(pnDiscount,18,gnPc)) + [,] + ;
									IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
									IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
									IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
									IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;
									[to_date('] + Ttoc(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
									IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
									['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional,[]),100))) + [',] + ;
									['] + Alltrim(Nvl(pcSirDifAcont,[])) + [','] + ;
									ALLTRIM(Nvl(pcSirDifPart,[])) + [',] + Alltrim(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare); end;]
								*!* v 2.0.13 ^
								lnSucces = goExecutor.oExecute(lcSql)
							Endif
							If lnSucces<0 And lnReturn = 1
								amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
								gnButon = 2
								llReturn = .F.
							Endif
						Endif
						Use In (lcCursorFinal)
					Else
						Use In (lcCursorVerificare)
						*!*	modificare 20.06
						If pnFacturaRetur = 1
							*!*	modificare v 2.0.58
							lnReturn = completeaza_date_aviz_retur()
							If lnReturn > 0
								*!*	modificare	v 2.0.58	^
								*!* v 2.0.13
								*!*					lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura_avize_retur(] + ;
								*!*						[?pnDiscount,?poDate.id_delegat,?poDate.id_masina,?poDate.id_agent,] + ;
								*!*						[?poDate.discount_evidentiat,?poDate.text_aditional,?poDate.text_aditional_retur,]+;
								*!*						[NULL,NULL,?pnParametruAditional,?@poDate.nract_retur)}]
								*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare, poDate.nid_vanzare_retur
								lcSql = [{call pack_facturare.scrie_factura_avize_retur(] + ;
									ALLTRIM(Str(pnDiscount,18,gnPc)) + [,] + ;
									IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
									IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
									IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
									IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;
									[to_date('] + Ttoc(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
									IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
									ALLTRIM(Str(poDate.discount_evidentiat)) + [,] + ;
									['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional,[]),100))) + [',] + ;
									['] + OracleSpecialCharacters(Alltrim(LEFT(Nvl(poDate.text_aditional_retur,[]),100))) + [',] + ;
									[NULL,NULL,] + Alltrim(Str(pnParametruAditional)) + [,] + Alltrim(Str(poDate.nract_retur,14,0)) + [,] + ;
									[?@poDate.nid_vanzare,?@poDate.nid_vanzare_retur)}]
								*!* v 2.0.13 ^
								lcCursor = [crsavizretur]
								lnSucces = goExecutor.oExecute(lcSql,lcCursor)
								If lnSucces<0
									amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
									gnButon = 2
									llReturn = .F.
								Endif
								*!*	modificare	v 2.0.58
							Else
								gnButon = 2
								llReturn = .F.
							Endif
							*!*	modificare v 2.0.58	^
						Endif
						*!*	modificare 20.06 ^
					Endif && Reccount(lcCursorVerificare)>0
		
		
					If gnButon = 1
						If pnDiscount<> 0
							Select crsfactura
							Append Blank
							*!*	modificare	v 2.0.56 : am adaugat id_temp
							Replace denumire With Replicate('Z',20),cantitate With 1,pretftva With Thisform.nbazafdiscount,vpretftva With Thisform.nbazafdiscountval,;
								discountftva With Thisform.ndiscfactron,valdiscountftva With Thisform.ndiscfactron,valdiscounttva With Round(Thisform.ndiscfactron  * (Thisform.nproc_tvav - 1),gnPc),;
								vdiscountftva With Thisform.ndiscfactval,vvaldiscountftva With Thisform.ndiscfactval,vvaldiscounttva With Round(Thisform.ndiscfactval * (Thisform.nproc_tvav - 1),gnPVal),;
								proc_tvav With Thisform.nproc_tvav,id_temp With 99999
						Endif
					Else
						llReturn = .F.
					Endif
				Endif && eProforma = 0
			Endif && llSucces
		
			If m.llReturn
				llReturn = Thisform.do_inchide_tranzactie(1)
			Else
				Thisform.do_inchide_tranzactie(2)
			Endif
		Endif && llReturn
		
		Return m.llReturn
		
	ENDPROC

	PROCEDURE do_scrie_proforma
		Local llReturn,lcSql,lnSucces
		*!*		emitere avize / facturi
		Private pnDiscount
		Local llReturn,lnSucces,lcSql
		llReturn = .T.
		
		If poDate.in_valuta = 1
			pnDiscount = Thisform.ndiscfactval
		Else
			pnDiscount = Thisform.ndiscfactron
		Endif
		
		poDate.text_aditional = Strtran(poDate.text_aditional,Chr(13)+Chr(10),Chr(170),1,100,1)
		
		If Thisform.do_scrie_articole()
			poDate.id_delegat = Null
			poDate.id_masina = Null
			poDate.id_agent = Null
		
			lcSql = [begin pack_facturare.scrie_proforma_old(] + ;
				ALLTRIM(STR(pnDiscount,18,gnPC)) + [,] + ;
				['] + OracleSpecialCharacters(ALLTRIM(NVL(poDate.text_aditional,''))) + [',] + ;
				ALLTRIM(STR(poDate.discount_evidentiat)) + [,?poDate.nid_proforma,?@poDate.nract); end;]
		
		
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces<0
				amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				llReturn = .F.
			Else
				If pnDiscount<> 0
					Select crsfactura
					Append Blank
					*!*	modificare	v 2.0.56 : am adaugat id_temp
					Replace denumire With Replicate('Z',20),cantitate With 1,pretftva With Thisform.nbazafdiscount,vpretftva With Thisform.nbazafdiscountval,;
						discountftva With Thisform.ndiscfactron,valdiscountftva With Thisform.ndiscfactron,valdiscounttva With Round(Thisform.ndiscfactron  * (Thisform.nproc_tvav - 1),gnPC),;
						vdiscountftva With Thisform.ndiscfactval,vvaldiscountftva With Thisform.ndiscfactval,vvaldiscounttva With Round(Thisform.ndiscfactval * (Thisform.nproc_tvav - 1),gnPVal),;
						proc_tvav With Thisform.nproc_tvav,id_temp with 99999
				Endif
			Endif
			If llReturn
				llReturn = Thisform.do_inchide_tranzactie(1)
			Else
				Thisform.do_inchide_tranzactie(2)
			Endif
		Else
			llReturn = .F.
		Endif
		Return llReturn
	ENDPROC

	PROCEDURE do_sterge
		If Reccount('crsfactura')>0
			Private poArticol
			Select crsfactura
			Scatter Name poArticol MEMO
		*!*	modificare v 2.0.67
			Local lcCursor
			If poArticol.opt_facturare = 0
				lcCursor = [crsarticole]
			Else
				lcCursor = [crsarticole1]
			Endif
		*!*	modificare v 2.0.67	^
			If aMessagebox("Doriti sa stergeti " + Iif(Inlist(poArticol.opt_facturare,1,2),"rata","articolul") + " " + Upper(Alltrim(poArticol.denumire)) + " ?",4+32,"Confirmare stergere") == 6
		*!*	modificare	19.01.2008
		*!*			lcSql = [begin ] + gcS + [.pack_facturare.sterge_articol_factura(?poArticol.id_temp,] + ;
		*!*				[?gnIdUtil); end;]
		*!*			lnSucces = goExecutor.oExecute(lcSql)
		
		*!*			If lnSucces < 0
		*!*				aMessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
		*!*				Thisform.txtArticoleLista.SetFocus()
		*!*				Return
		*!*			Endif
		*!*	modificare	19.01.2008	^
				save_grid_tag(Thisform.grd_factura)
				Update crsfactura Set id_temp = -1 Where id_temp = poArticol.id_temp
				Update crsfactura Set id_temp = id_temp-1 Where id_temp > poArticol.id_temp
				Select * From crsfactura Where id_temp<>-1 Order By id_temp ;
					INTO Cursor crsfactura Readwrite
				restore_grid_tag(Thisform.grd_factura)
		
				Select (lcCursor)
				lnRecNo = Recno()
				Do Case
		*!*	modificare	v 2.0.30
		*!*			Case (gnScadereStoc = 1 And InList(poDate.tip,23,41)) Or Inlist(poDate.tip,3,4,21,25,28)
		*!*				Select crsarticole
		*!*				Replace cantitate With cantitate + poArticol.cantitate For id_c = poArticol.id_c
				Case gnScadereStoc = 1 And poDate.tip = 41
					Select (lcCursor)
					Replace cantitate With cantitate - poArticol.cantitate For id_c = poArticol.id_c
		*!*	modificare	v 2.0.56
		*!*			Case (gnScadereStoc = 1 And poDate.tip = 41) Or Inlist(poDate.tip,3,4,21,25,28,42)
				Case (gnScadereStoc = 1 And poDate.tip = 23) Or Inlist(poDate.tip,3,4,21,25,28,42,47)		&&	modificare v 2.0.93 : am adaugat 47
		*!*	modificare	v 2.0.56	^
					Select (lcCursor)
					Replace cantitate With cantitate + poArticol.cantitate For id_c = poArticol.id_c
		*!*	modificare	v 2.0.30	^
		*!*	modificare v 2.0.56
				Case Inlist(poDate.tip,8,9,24)
					Replace cantitate With cantitate - poArticol.cantitate For id_c = poArticol.id_c
		*!*	modificare v 2.0.56	^
		*!*	modificare v 2.0.67
		*!*			Case poArticol.id_gestiune <> - 1000 And gnScadereStoc = 1 And ;
		*!*					(Inlist(poDate.tip,1,22,29) Or (poDate.tip = 2 And pnTipFacturare = 4))
				Case poArticol.id_gestiune <> - 1000 And gnScadereStoc = 1 And ;
						(Inlist(poDate.tip,1,22,29) Or (poDate.tip = 2 And poArticol.opt_facturare = 0))
		*!*	modificare v 2.0.67	^
					Select (lcCursor)
					Replace cantitate With cantitate + poArticol.cantitate For id_articol = poArticol.id_articol And gestionabil = 1
				Endcase
				If Reccount(lcCursor)<lnRecNo
					Go Top
				Else
					Go lnRecNo
				Endif
		
				Thisform.do_calculeaza_totaluri()
			Endif
			If Reccount('crsfactura')>0
				Thisform.txtArticoleLista.SetFocus()
			Else
		*!*	modificare v 2.0.67
		*!*			Thisform.txtArticole.SetFocus()
				If poArticol.opt_facturare = 0
					Thisform.txtArticole.SetFocus()
				Else
					Thisform.grd_contracte.SetFocus()
				Endif
		*!*	modificare v 2.0.67	^
			Endif
			Release poArticol,lcCursor
		Endif
		
	ENDPROC

	PROCEDURE do_termin
		*!*	modificare	19.01.2007
		DoDefault()
		*!*	If This.inainte_de_do_termin()
		*!*		gnButon = 1
		*!*		pnButon = 1
		*!*		Buton = 1
		*!*		pnIesire = 1
		*!*		If !This.lhide
		*!*			This.Release
		*!*		Else
		*!*			This.Hide
		*!*		Endif
		*!*		Sqlcommit(gnHandle)
		*!*		SQLSetprop(gnHandle,"Transactions",1) && tranzactie automata
		*!*	Endif
		*!*	modificare	19.01.2007	^
	ENDPROC

	PROCEDURE do_urmator
		Thisform.do_adauga_articol()
		
	ENDPROC

	PROCEDURE do_urmator2
		If Used('crsarticole1') And Reccount('crsarticole1')>0
			Select crsarticole1
			If Isnull(id_rata)
				Thisform.do_adauga_articol(.F.,.T.)
			Else
				Thisform.do_adauga_rata()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_verifica_articol
		*!*	modificare	v 2.0.67
		Lparameters tlContract,tnCantitate
		Local llReturn, lcFiltru, llFacturareFaraStoc, lcSelect
		lcSelect = SELECT()
		llReturn = .T.
		
		*!*   nu se face verificarea daca mai exista pe factura, deoarece poate exista cazul in care cantitatea dorita
		*!*  nu poate fi acoperita dintr-o singura gestiune, iar pe formularul de adaugare se poate selecta doar una din care
		*!*	 sa se faca scaderea
		llFacturareFaraStoc = (Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1)
		
		llRetur = Inlist(poDate.tip,8,9,24) 
		
		Do Case
			Case poArticol.gestionabil = 0 Or gnScadereStoc = 1 Or m.llFacturareFaraStoc
				llReturn = .T.
		
			Case (tnCantitate >= 0 And m.llRetur ) Or ;
					(tnCantitate <= 0 And Not (poDate.tip = 2 And poArticol.opt_facturare = 3) And !Inlist(poDate.tip,8,9,24) And poArticol.gestionabil = 1 And gnScadereStoc = 1 And !m.llFacturareFaraStoc)
		* factura retur lei/valuta, aviz retur
				lcMesaj = Alltrim(Thisform.cmesaj_cantitate)
				amessagebox(lcMesaj,0+48,"Atentie")
				llReturn = .F.
		
			Case  !tlContract And Used('crsarticole1') And Used('crsCtrTemp')
				If Used('crsverifart')
					Use In crsverifart
				Endif
				Select id_ctr From crsCtrTemp Where id_ctr Not In ;
					(Select Distinct id_ctr From crsarticole1 Where id_articol = poArticol.id_articol And id_rata Is Null) ;
					INTO Cursor crsverifart
				Select crsverifart
				Do Case
					Case Reccount('crsverifart') = 0
						amessagebox("Articolul "+Alltrim(poArticol.denumire)+" din politica "+Alltrim(poArticol.nume_lista_preturi)+" are pretul fixat prin contract!",0+48,"Atentie")
						llReturn = .F.
					Case Reccount('crsverifart') <> Reccount('crsCtrTemp')
						lcFiltru = []
						Select crsverifart
						Scan
							lcFiltru = lcFiltru + [,] + Alltrim(Str(id_ctr))
						Endscan
						lcFiltru = [INLIST(id_ctr] + lcFiltru + [)]
						Select crsCtrTemp
						Set Filter To &lcFiltru
					Otherwise
						llReturn = .T.
				Endcase
				Use In (SELECT('crsverifart'))
		Endcase
		
		SELECT (m.lcSelect)
		Return llReturn
		*!*	modificare	v 2.0.67	^
		
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		*!*	modificare	19.01.2007
		*!*	Sqlrollback(gnHandle)
		*!*	SQLSetprop(gnHandle,"Transactions",1)
		*!*	*!*	If poDate.tip<21
		*!*	*!*		Do dezaloca_numar_fact In oserii_numere.prg
		*!*	*!*	Else
		*!*	*!*		Do dezaloca_numar_aviz In oserii_numere.prg
		*!*	*!*	Endif
		*!*	modificare	19.01.2007	^
		
		poGeneratorNumere.dezaloca_numar(3) && dezaloc numar bon fiscal
		poGeneratorNumere.dezaloca_numar(16) && dezaloc numar chitanta
		
		Return .T.
	ENDPROC

	PROCEDURE inainte_de_do_termin
		*!*	04.02.2015
		*!*	marius.mutu
		*!*	frm_alte_date - se bifeaza automat incasare cu bon fiscal, daca poDate.eBonFiscal = 1
		
		*!*	05.05.2015
		*!*	marius.mutu
		*!*	frm_alte_date - se bifeaza automat bon fiscal detaliat, daca poDate.eBonFiscal = 1
		*!*	ar trebui in functie de o optiune
		
		*!*	initializare numar bon fiscal cu numar act, in caz ca s-a suprascris de utilizator
		
		Local llContinuare && plReturn
		Store .F. To plReturn
		Store .T. To llContinuare
		If poDate.tip <> 30
			lccontrol = Upper(This.ActiveControl.BaseClass )
			If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
				lcval=This.ActiveControl.ControlSource
				&lcval=Thisform.ActiveControl.Value
			Endif
		Endif
		
		creeaza_backup_cursoare_facturare()
		
		If poDate.in_valuta = 1
			*!*		poDate.totctvaconv		=	Thisform.ntotalron
			*!*		poDate.totftvaconv		=	Thisform.nbazaron
			*!*		poDate.tottvaconv		=	Thisform.ntvaron
			lnTotalFactura = Thisform.ntotalval
			*!*		Do recalculeaza_pret_vanzare_lei With [crsfactura],poDate.Curs In ofacturare_comun.prg
		Else
			lnTotalFactura = Thisform.ntotalron
		Endif
		poDate.totalctva = lnTotalFactura
		
		Do Case
			Case Reccount('crsfactura') = 0
				amessagebox("Nu ati ales articolele " + Iif(poDate.tip<21,[pentru facturare],[]) + "!",48,"Atentie")
				Thisform.grd_articole.SetFocus()
				plReturn = .F.
				*!*	modificare	v 2.0.67
				*!*	modificare ROAFACTURARE v 2.0.71
				*!*	Case Empty(poDate.datascad)
			Case Empty(poDate.datascad) And Between(poDate.tip,1,20)
				*!*	modificare ROAFACTURARE v 2.0.71	^
				amessagebox("Nu ati completat data scadenta!",48,"Atentie")
				Thisform.txtDataScadenta.SetFocus()
				plReturn = .F.
				*!*	modificare ROAFACTURARE v 2.0.71
				*!*	Case poDate.datascad<poDate.dataact
			Case poDate.datascad<poDate.dataact And Between(poDate.tip,1,20)
				*!*	modificare ROAFACTURARE v 2.0.71	^
				amessagebox("Data scadenta trebuie sa fie mai mare sau egala cu data documentului!",48,"Atentie")
				Thisform.txtDataScadenta.SetFocus()
				plReturn = .F.
				*!*	modificare	v 2.0.67	^
			Otherwise
				If lnTotalFactura = 0
					If amessagebox(Iif(poDate.tip<21,[Factura],[Avizul])+" are totalul 0. Doriti sa continuati?",4+48+256,"Confirmare") = 7
						llContinuare = .F.
						plReturn = .F.
						Thisform.grd_factura.SetFocus()
					Endif
				Endif
				*!*	modificare	v 2.0.46
				*!*		If Nvl(gnFactSeturi,0)=1
				*!*	modificare	v 2.0.56
				*!*		If Nvl(gnFactSeturi,0)=1 And poDate.tip <> 7
				If Nvl(gnFactSeturi,0)=1 And poDate.tip <> 7 And llContinuare
					*!*	modificare	v 2.0.56	^
					*!*	modificare	v 2.0.46	^
					llContinuare = facturare_articole_compuse()
					*!*	modificare	v 2.0.67
					If Nvl(gnModTotFact,0) = 0
						*!*	modificare	v 2.0.67	^
						Thisform.do_calculeaza_totaluri()
						poDate.totalctva = Thisform.ntotalron
						*!*	modificare	v 2.0.67
					Endif
					*!*	modificare	v 2.0.67	^
					plReturn = llContinuare
				Endif
				If llContinuare
					gnButon = 1
					*!*	modificare	v 2.0.93
					If poDate.tip = 48
						Private pnCoefK
						pnCoefK = 0
						lnSucces = goExecutor.oFunction2Value([pack_facturare.calculeaza_k()],@pnCoefK)
						If lnSucces < 0
							amessagebox(goExecutor.cEroare,16,"Eroare")
							gnButon = 2
						Else
							If pnCoefK <> 0
								poDate.coeficient_k = pnCoefK
							Endif
						Endif
						Release pnCoefK
						If Nvl(gnCoefKFact,2) <> 0
							Private ofrmdatek
							ofrmdatek = Createobject("frm_seteaza_k")
							ofrmdatek.Show(1)
							Release ofrmdatek
						Endif
					Endif
					*!*	modificare	v 2.0.93	^
					*!*	modificare	v 2.0.67
					*!*			If poDate.eProforma = 1
					*!*	*!*				recalculeaza_pret_vanzare_compus()
					*!*				plReturn = Thisform.do_scrie_proforma()
					*!*			Else
					*!*	modificare	v 2.0.67	^
					If gnButon = 1	&&	modificare	v 2.0.93
						Private ofrmdatesupl
						poDate.dataora_exp = Get_Ora()	&&	modificare ROAFACTURARE v 2.0.80
						If poDate.tip<>30
							ofrmdatesupl = Createobject("frm_alte_date")
							ofrmdatesupl.nnrbon = poDate.nract && in caz ca s-a suprascris schimbat de catre utilizator
							If (poDate.eBonFiscal = 1)
								With ofrmdatesupl
									.opt_incasat.Value = 3 && INCASARE CU BON FISCAL
									.actualizeaza_tipincasare()
									.opt_incasat.option1.TabStop = .F. && sa nu schimb din greseala cu ENTER, se poate schimba cu mouse-ul
									.opt_incasat.option2.TabStop = .F.
									.opt_incasat.option3.TabStop = .F.
								Endwith
								poDate.nBonDetaliat = 1 && ar trebui in functie de o optiune
							Endif
							ofrmdatesupl.Show(1)
						Else
							gnButon = 1
						Endif
					Endif			&&	modificare	v 2.0.93
		
					If gnButon = 2
						plReturn = .F.
						gnButon = 1
		
					Else
		
						plReturn = Thisform.do_scrie_factura()
						*!*				If poDate.eProforma = 1
						*!*					plReturn = Thisform.do_scrie_proforma()
						*!*				Else
						*!*					plReturn = Thisform.do_scrie_factura()
						*!*				Endif
					Endif
				Endif
		Endcase
		
		If plReturn
			sterge_backup_cursoare_facturare()
		Else
			save_grid(Thisform.grd_factura)
			repune_backup_cursoare_facturare()
			*!*	modificare	v 2.0.67
			If Nvl(gnModTotFact,0) = 0
				*!*	modificare	v 2.0.67	^
				Thisform.do_calculeaza_totaluri()
				*!*	modificare	v 2.0.67
			Endif
			*!*	modificare	v 2.0.67	^
			restore_grid(Thisform.grd_factura)
		Endif
		
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		*!*	30.10.2014
		*!*	marius.mutu
		*!*	adaugat grid_extra pentru retinerea dimensiunii coloanelor
		
		*!*	20.02.2015
		*!*	marius.mutu
		*!*	buton retur articole intr-o factura de vanzare pe baza de lista de preturi
		
		*!* 12.03.2021
		*!* marius.mutu
		*!* la proforma se afiseaza but_urmator_tot pentru adaugarea tuturor articolelor, intrucat nu trebuie sa le scad din stoc individual
		
		Local lcTipDoc, lcCriteriuCod
		Local lcCriteriuDenumire, lnAnchor, lnDiferentaTop
		*:Global gcAcces
		gcAcces = [1;2;3;4;]
		DoDefault()
		*!*	modificare	v 2.0.56
		lcCriteriuCod = goExport.citesteSetareRegistru("CRITCOD")
		If !Empty(Nvl(lcCriteriuCod, [])) And Type('VAL(lcCriteriuCod)') = 'N'
			Thisform.ncritcod = Val(lcCriteriuCod)
		Endif
		Thisform.ct_codmat.Value = Thisform.ncritcod
		*!*	modificare	v 2.0.56	^
		
		lcCriteriuDenumire = goExport.citesteSetareRegistru("CRITDENUMIRE")
		If !Empty(lcCriteriuDenumire) And Type('VAL(lcCriteriuDenumire)') = 'N'
			Thisform.ncritDenumire = Val(lcCriteriuDenumire)
		Endif
		Thisform.ct_articole.Value = Thisform.ncritDenumire
		
		lcTipDoc = [factura]
		*!*	modificare	v 2.0.29
		*!*	Thisform.lb_nract.Caption = [Nr. document : ] + Alltrim(Nvl(poDate.serie_act,[])) + [ ] + ;
		*!*		TRANSFORM(poDate.nract,get_mask(14,0))
		
		Local lcExplicatieSupl
		Do Case
			Case poDate.tip = 23
				lcExplicatieSupl = [ * Gestiune destinatie : ] + Alltrim(Nvl(poDate.descriere, []))
			Case poDate.tip = 25
				lcExplicatieSupl = [ * Gestiune destinatie : ] + Alltrim(Nvl(poDate.nume_client, []))
			Case poDate.tip = 41
				lcExplicatieSupl = [ * Retur de la gest. : ] + Alltrim(Nvl(poDate.nume_client, []))
				*!*	modificare	v 2.0.56
			Case Inlist(poDate.tip, 8, 9)
				lcExplicatieSupl = [ * Retur pentru facturile : ] + Alltrim(Nvl(poDate.descriere, []))
				*!*	modificare	v 2.0.56	^
			Case Inlist(poDate.tip, 24)
				lcExplicatieSupl = [ * Retur pentru avizele : ] + Alltrim(Nvl(poDate.descriere, []))		
			Otherwise
				lcExplicatieSupl = []
		Endcase
		
		lcExplicatieSupl = ALLTRIM(LEFT(m.lcExplicatieSupl,100))
		
		Thisform.lb_nract.Caption = [Nr. document : ] + Alltrim(Nvl(poDate.serie_act, [])) + [ ] + ;
			Transform(poDate.nract, get_mask(14, 0)) + lcExplicatieSupl
		*!*	modificare ROAFACTURARE v 2.0.71
		Thisform.lb_nract.AutoSize = .T.
		Thisform.lb_nract.Refresh()
		*!*	modificare ROAFACTURARE v 2.0.71	^
		*!*	modificare	v 2.0.29	^
		*!*	modificare	19.01.2008
		*!*	lnSucces = SQLSetprop(gnHandle,"Transactions",2)
		*!*	If lnSucces < 0
		*!*		amessagebox("Programul nu a reusit sa treaca pe tranzactie manuala! Reintrati in program si incercati din nou!",48,"Atentie")
		*!*		plVizibil = .F.
		*!*	Else
		*!*	modificare	19.01.2008	^
		With This.grd_factura
			This.nNrInregVizibile = Floor((.Height - .HeaderHeight) / .RowHeight)
		Endwith
		
		If !Used('crspolitici') Or (Used('crspolitici') And Reccount('crspolitici') = 2 )
			With Thisform.grd_articole
				lnAnchor = .Anchor
				.Anchor = 0
				.Top = Thisform.txtArticole.Top
				.Height = .Height + 30
				.Anchor = lnAnchor
			Endwith
			*!*		With Thisform.grd_factura
			*!*			lnAnchor = .Anchor
			*!*			.Anchor = 0
			*!*			.Top = Thisform.txtArticole.Top
			*!*			.Height = .Height + 34
			*!*			.Anchor = lnAnchor
			*!*		Endwith
			*!*	modificare	2.0.4
			lnDiferentaTop = Thisform.txtCodmat.Top - Thisform.cb_politici_preturi.Top
			Thisform.txtCodmat.Top = Thisform.txtCodmat.Top - lnDiferentaTop
			Thisform.lb_codmat.Top = Thisform.lb_codmat.Top - lnDiferentaTop
			Thisform.ct_codmat.Top = Thisform.ct_codmat.Top - lnDiferentaTop
			Thisform.txtArticole.Top = Thisform.txtArticole.Top - lnDiferentaTop
			Thisform.lb_articole.Top = Thisform.lb_articole.Top - lnDiferentaTop
			Thisform.ct_articole.Top = Thisform.ct_articole.Top - lnDiferentaTop
			*!*			Thisform.txtArticole.Top = Thisform.cb_politici_preturi.Top
			*!*			Thisform.lb_articole.Top = Thisform.lb_politici_preturi.Top
			*!*	modificare	2.0.4	^
			*!*		Thisform.txtArticoleLista.Top = Thisform.cb_politici_preturi.Top
			*!*		Thisform.lb_articolelista.Top = Thisform.lb_politici_preturi.Top
			*!*	modificare	v 2.0.56
			Thisform.but_reset1.Top = Thisform.but_reset1.Top - lnDiferentaTop
			*!*	modificare	v 2.0.56	^
			Thisform.grd_articole.RemoveObject('cPolitici_preturi')
			Thisform.RemoveObject('lb_politici_preturi')
			Thisform.RemoveObject('cb_politici_preturi')
		Else
			Thisform.cb_politici_preturi.RowSource = [crspolitici.nume_lista_preturi,id_pol]
			Select crspolitici
			Go Top
			Thisform.cb_politici_preturi.Value = Alltrim(nume_lista_preturi)
		Endif
		
		If !Used('crscursuri') Or Reccount('crscursuri') = 0
			Thisform.RemoveObject('lb_cursuri')
			Thisform.RemoveObject('grd_cursuri')
			*!*	modificare v 2.0.56
		Else
			If !Empty(Nvl(poDate.zi_curs, {}))
				Thisform.lb_cursuri.Caption = "Curs valutar " + Iif(!Inlist(poDate.tip, 8, 9), "(" + Dtoc(poDate.zi_curs) + ")", "")
			Else
				Thisform.lb_cursuri.Caption = "Curs valutar"
			Endif
			If Reccount('crscursuri') <= 3
				Thisform.grd_cursuri.ScrollBars = 0
			Endif
			*!*	modificare v 2.0.56	^
		Endif
		
		This.cmesaj_cantitate = [Acest articol nu este pe stoc!]
		Do Case
			CASE poDate.eProforma = 1
				&&	copiere factura / aviz
				This.lb_titlu_alb_b121.Caption = [PROFORMA]
				This.but_urmator_tot1.Visible = .T.
						
			Case poDate.lCopiere
				&&	copiere factura / aviz
				This.lb_titlu_alb_b121.Caption = [COPIERE FACTURA/AVIZ ] + Alltrim(poDate.descriere)
				This.grd_articole.cCantitate.header1.Caption = [Cantitate maxima]
				This.cmesaj_cantitate = [A fost facturata intreaga cantitate pentru acest articol!]
				This.but_urmator_tot1.Visible = .T.
				
			Case Inlist(poDate.tip, 1, 5, 7, 10)		&&	modificare v 2.0.56 : am adaugat 10
				&&	facturare pe baza de lista de preturi
				This.grd_articole.cCantitate.header1.Caption = [Cantitate in stoc]
				This.grd_articole.RemoveObject('cSerie')
				This.cmesaj_cantitate = [Acest articol nu este pe stoc!]
				This.but_retur.Visible = .T. && pot sa fac retur de articole intr-o factura de vanzare
		
			Case Inlist(poDate.tip, 2, 6)
				&&	facturare pe baza de contract
				This.lb_titlu_alb_b121.Caption = [FACTURA PE CTR. ] + Alltrim(poDate.descriere)
				This.grd_articole.RemoveObject('cSerie')
				*!*	modificare v 2.0.67
				*!*		If pnTipFacturare = 3
				*!*	&&	articole de pe contract
				*!*			This.grd_articole.cCantitate.header1.Caption = [Cantitate contractata]
				*!*			This.cmesaj_cantitate = [A fost facturata intreaga cantitate contractata pentru acest articol!]
				*!*		Else
				&&	articole din lista de preturi
				This.grd_articole.cCantitate.header1.Caption = [Cantitate in stoc]
				This.cmesaj_cantitate = [Acest articol nu este pe stoc!]
				*!*		Endif
				*!*	modificare v 2.0.67 ^
			Case poDate.tip = 3
				&&	facturare pe baza de comanda
				This.lb_titlu_alb_b121.Caption = [FACTURA LA COMANDA ] + Alltrim(poDate.descriere)
				This.grd_articole.RemoveObject('cSerie')
				This.grd_articole.cCantitate.header1.Caption = [Cantitate comandata]
				This.cmesaj_cantitate = [A fost facturata intreaga cantitate comandata pentru acest articol!]
				This.but_urmator_tot1.Visible = .T.			&&	modificare v 2.0.44
			Case poDate.tip = 4
				&&	facturare din avize
				This.lb_titlu_alb_b121.Caption = [FACTURA DIN AVIZE]
				This.clb_discount.Visible = .F.
				*!*		With This.clb_discount.texT_SIMPLU1
				*!*			.ReadOnly = .T.
				*!*			.TabStop = .F.
				*!*			.Value = pnTotalDiscountAvize
				*!*		Endwith
				*!*		If pnTotalDiscountAvize > 0
				*!*			With Thisform.lb_explicatii
				*!*				.Caption = [Total discount pe avize (fara TVA): ]+Alltrim(Str(pnTotalDiscountAvize,14,gnPa))
				*!*				.Visible = .T.
				*!*			Endwith
				*!*		Endif
				This.but_urmator_tot1.Visible = .T.			&&	modificare v 2.0.44
				This.cmesaj_cantitate = [A fost facturata intreaga cantitate de pe aviz pentru acest articol!]
			Case Inlist(poDate.tip, 21, 28, 42, 47)			&&	modificare v 2.0.93 : am adaugat 47
				&&	aviz catre clienti din comanda
				*!*		Thisform.RemoveObject('opt_proforma')
				This.grd_articole.RemoveObject('cSerie')
				This.lb_titlu_alb_b121.Caption = [AVIZ DE EXPEDITIE DIN COMANDA]
				This.clb_discount.Visible = .F.
				*!*		This.clb_discount.lb_simplu1.Caption = [Discount pe aviz (fara TVA)]
				lcTipDoc = [aviz]
				This.cmesaj_cantitate = [A fost avizata intreaga cantitate comandata pentru acest articol!]
				This.but_urmator_tot1.Visible = .T.			&&	modificare v 2.0.44
			Case Inlist(poDate.tip, 22, 29)
				&&	aviz catre clienti din lista de preturi
				*!*		Thisform.RemoveObject('opt_proforma')
				This.grd_articole.RemoveObject('cSerie')
				This.lb_titlu_alb_b121.Caption = [AVIZ DE EXPEDITIE DIN LISTA DE PRETURI]
				This.clb_discount.Visible = .F.
				*!*		This.clb_discount.lb_simplu1.Caption = [Discount pe aviz (fara TVA)]
				lcTipDoc = [aviz]
				This.cmesaj_cantitate = [Acest articol nu este pe stoc!]
			Case poDate.tip = 23
				&&	transfer intre subunitati
				*!*		Thisform.RemoveObject('opt_proforma')
				This.grd_articole.RemoveObject('cSerie')
				This.lb_titlu_alb_b121.Caption = [TRANSFER ÎNTRE SUBUNITATI]
				This.clb_discount.Visible = .F.
				*!*		This.clb_discount.lb_simplu1.Caption = [Discount pe aviz (fara TVA)]
				lcTipDoc = [aviz]
				This.cmesaj_cantitate = [Acest articol nu este pe stoc!]
				*!*	modificare	v 2.0.16
			Case poDate.tip = 41
				&&	retur
				*!*		Thisform.RemoveObject('opt_proforma')
				This.grd_articole.RemoveObject('cSerie')
				This.lb_titlu_alb_b121.Caption = [RETUR TRANSFER]
				This.clb_discount.Visible = .F.
				lcTipDoc = [aviz]
				This.cmesaj_cantitate = [Acest articol nu este pe stoc!]
				*!*	modificare	v 2.0.16	^
			Case poDate.tip = 25
				&&	transfer intre subunitati pe baza de comanda
				*!*		Thisform.RemoveObject('opt_proforma')
				This.grd_articole.RemoveObject('cSerie')
				This.lb_titlu_alb_b121.Caption = [TRANSFER ÎNTRE SUBUNITATI PE BAZA DE COMANDA]
				This.clb_discount.Visible = .F.
				*!*		This.clb_discount.lb_simplu1.Caption = [Discount pe aviz (fara TVA)]
				lcTipDoc = [aviz]
				This.cmesaj_cantitate = [A fost avizata intreaga cantitate comandata pentru acest articol!]
				This.but_urmator_tot1.Visible = .T.			&&	modificare v 2.0.44
			Case poDate.tip = 26
				&&	aviz catre clienti pe baza de contract
				*!*		Thisform.RemoveObject('opt_proforma')
				This.grd_articole.RemoveObject('cSerie')
				This.lb_titlu_alb_b121.Caption = [AVIZ DE EXPEDITIE DIN CONTRACTUL ] + Alltrim(poDate.descriere)
				This.clb_discount.Visible = .F.
				*!*		This.clb_discount.lb_simplu1.Caption = [Discount pe aviz (fara TVA)]
				lcTipDoc = [aviz]
				*!*	modificare	v 2.0.67
				*!*		If pnTipFacturare = 3
				*!*	&&	articole de pe contract
				*!*			This.grd_articole.cCantitate.header1.Caption = [Cantitate contractata]
				*!*			This.cmesaj_cantitate = [A fost avizata intreaga cantitate contractata pentru acest articol!]
				*!*		Else
				&&	articole din lista de preturi
				This.grd_articole.cCantitate.header1.Caption = [Cantitate in stoc]
				This.cmesaj_cantitate = [Acest articol nu este pe stoc!]
				*!*		Endif
				*!*	modificare	v 2.0.67	^
				*!*	modificare	v 2.0.56
			Case Inlist(poDate.tip, 8, 9) && factura retur lei/valuta
				*!*		Thisform.RemoveObject('opt_proforma')
				This.grd_articole.cCantitate.header1.Caption = [Cant. max. de returnat]
				This.cmesaj_cantitate = [Nu se mai poate face retur pentru acest articol!]
				This.but_urmator_tot1.Visible = .T.
				*!*	modificare	v 2.0.56	^
			Case Inlist(poDate.tip, 24) && aviz retur
				This.grd_articole.cCantitate.header1.Caption = [Cant. max. de returnat]
				This.cmesaj_cantitate = [Nu se mai poate face retur pentru acest articol!]
				This.but_urmator_tot1.Visible = .T.
				This.grd_articole.RemoveObject('cSerie')
				This.lb_titlu_alb_b121.Caption = [RETUR AVIZ DE EXPEDITIE]	
		Endcase
		
		Thisform.clb_total_factura.lb_explicatie.Caption = [TOTAL ] + Upper(lcTipDoc)
		Thisform.lb_articolelista.Caption = [Articole ] + Alltrim(lcTipDoc)
		Thisform.ck_discountevidentiat.Caption = [Se pune în evidenta discount-ul pe articole ] + ;
			[în notele contabile și pe ] + Alltrim(lcTipDoc)
		
		Thisform.clb_total_baza.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_discount.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_discount_articole.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_total_factura.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_total_tva.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_discount.do_activeaza(1 + poDate.in_valuta)
		*!*	modificare	v 2.0.67
		If Nvl(gnModTotFact, 0) = 1 And !Inlist(poDate.tip, 5, 6, 7, 9, 10)	&&	in afara de facturile in valuta
			Thisform.clb_total_baza.do_activeaza(1)
			Thisform.clb_total_tva.do_activeaza(1)
			Bindevent(Thisform, 'do_calculeaza_totaluri', Thisform, 'actualizeaza_total_mod', 1)
		Endif
		*!*	modificare	v 2.0.67	^
		
		If poDate.in_valuta = 0
			Thisform.grd_factura.RemoveObject([cVpretFtva])
			Thisform.grd_factura.RemoveObject([cVdiscountftva])
			Thisform.grd_factura.RemoveObject([cVvaldiminuatftva])
		Else
			Thisform.grd_factura.RemoveObject([cPretFtva])
			Thisform.grd_factura.RemoveObject([cDiscountctva])
			Thisform.grd_factura.RemoveObject([cPretCtva])
			Thisform.grd_factura.RemoveObject([cValdiminuatctva])
		Endif
		*!*	modificare	19.01.2008
		*!*	Endif
		*!*	modificare	19.01.2008	^
		*!*	modificare	v 2.0.67
		Local lnDiferentaInaltime
		If !Used('crscontracte') Or (Used('crscontracte') And Reccount('crscontracte') = 2 )
			lnDiferentaInaltime = Thisform.grd_contracte.Top - Thisform.cb_contracte.Top
			Thisform.RemoveObject('lb_contracte')
			Thisform.RemoveObject('cb_contracte')
		Else
			Thisform.cb_contracte.RowSource = [crscontracte.numar_contract,id_ctr,data,numar]
			Select crscontracte
			Go Top
			Thisform.cb_contracte.Value = Alltrim(numar_contract)
		Endif
		If !Used('crsarticole1')
			*!*	modificare ROAFACTURARE v 2.0.71
			*!*		Thisform.txtDataScadenta.Enabled = .F.
			Thisform.RemoveObject('txtDataScadenta')
			Thisform.RemoveObject('lb_data_scadenta')
			*!*	modificare ROAFACTURARE v 2.0.71	^
			lnDiferentaInaltime = lnDiferentaInaltime + Thisform.grd_contracte.Height
			lnAnchor = Thisform.grd_articole.Anchor
			Thisform.grd_articole.Anchor = 0
			Thisform.grd_articole.Height = Thisform.grd_articole.Height + lnDiferentaInaltime
			Thisform.grd_articole.Top = Thisform.grd_articole.Top - lnDiferentaInaltime
			Thisform.grd_articole.Anchor = lnAnchor
			Thisform.grd_articole.Refresh()
			Thisform.lb_articole.Top = Thisform.lb_articole.Top - lnDiferentaInaltime
			Thisform.ct_articole.Top = Thisform.ct_articole.Top - lnDiferentaInaltime
			Thisform.txtArticole.Top = Thisform.txtArticole.Top - lnDiferentaInaltime
			Thisform.lb_codmat.Top = Thisform.lb_codmat.Top - lnDiferentaInaltime
			Thisform.ct_codmat.Top = Thisform.ct_codmat.Top - lnDiferentaInaltime
			Thisform.txtCodmat.Top = Thisform.txtCodmat.Top - lnDiferentaInaltime
			*!*	modificare v 2.0.70
			If Type('Thisform.lb_politici_preturi.Caption') <> 'U'
				*!*	modificare v 2.0.70	^
				Thisform.lb_politici_preturi.Top = Thisform.lb_politici_preturi.Top - lnDiferentaInaltime
				Thisform.cb_politici_preturi.Top = Thisform.cb_politici_preturi.Top - lnDiferentaInaltime
				*!*	modificare v 2.0.70
			Endif
			*!*	modificare v 2.0.70	^
			Thisform.but_reset1.Top = Thisform.but_reset1.Top - lnDiferentaInaltime
			Thisform.RemoveObject('grd_contracte')
			Thisform.RemoveObject('but_urmator2')
		Endif
		*!*	modificare	v 2.0.67	^
		
		
		
		Try
			Thisform.gridextra1.Setup()
		Catch
		Endtry
		
		Try
			Thisform.gridextra2.Setup()
		Catch
		Endtry
		
		Try
			Thisform.gridextra3.Setup()
		Catch
		Endtry
		
	ENDPROC

	PROCEDURE KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		lcControl = Upper(Alltrim(Thisform.ActiveControl.Name))
		
		Do Case
		Case Inlist(nKeyCode,9,13) And (lcControl = 'PROCENT')
			Thisform.do_calculeaza_discount(Thisform.ActiveControl.Value)
		Case (nKeyCode >=33 And nKeyCode <=122) And (lcControl = 'GRD_ARTICOLE')
			Nodefault
		*!*	modificare	v 2.0.67
		*!*		With This.txtArticole
			With This.txtCodmat
		*!*	modificare	v 2.0.67	^
				.Value = Alltrim(.Value) + Chr(nKeyCode)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		Case (nKeyCode >=33 And nKeyCode <=122) And (lcControl = 'GRD_FACTURA')
			Nodefault
			With This.txtArticoleLista
				.Value = Alltrim(.Value) + Chr(nKeyCode)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		*!*	modificare	v 2.0.67
		*!*	Case (nKeyCode = 127) And (!Inlist(lcControl,'GRD_ARTICOLE','TXTCODMAT','TXTARTICOLE'))&& backspace
		*!*		Nodefault
		*!*		With This.txtArticole
		*!*			.Value = Left(Alltrim(.Value),Len(Alltrim(.Value))-1)
		*!*			.SetFocus()
		*!*		Endwith
		*!*		Keyboard '{END}'
		Case (nKeyCode = 127) And lcControl = 'GRD_ARTICOLE'	&& backspace
			Nodefault
			With This.txtCodmat
				.Value = Left(Alltrim(.Value),Len(Alltrim(.Value))-1)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		Case (nKeyCode = 127) And lcControl = 'GRD_FACTURA'		&& backspace
			Nodefault
			With This.txtArticoleLista
				.Value = Left(Alltrim(.Value),Len(Alltrim(.Value))-1)
				.SetFocus()
			Endwith
			Keyboard '{END}'
		*!*	modificare	v 2.0.67	^
		*!*	Case (nKeyCode = 127) And (lcControl <> 'GRD_FACTURA') && backspace
		*!*		Nodefault
		*!*		With This.txtArticoleLista
		*!*			.Value = Left(Alltrim(.Value),Len(Alltrim(.Value))-1)
		*!*			.SetFocus()
		*!*		Endwith
		*!*		Keyboard '{END}'
		*!*	modificare	v 2.0.67
		Case nKeyCode = 13 And lcControl = 'GRD_CONTRACTE'
			Nodefault
		*!*		Thisform.but_urmator2.SetFocus()
			Thisform.but_urmator2.Click()
		Case nKeyCode = 13 And lcControl = 'BUT_URMATOR2'
			Nodefault
			Thisform.do_urmator2()
		Case nKeyCode = 9 And lcControl = 'GRD_CONTRACTE'
			Nodefault
			Thisform.grd_articole.SetFocus()
		Case nKeyCode = 9 And lcControl = 'GRD_ARTICOLE'
			Nodefault
			Thisform.grd_factura.SetFocus()
		Case nKeyCode = 9 And lcControl = 'GRD_FACTURA'
			Nodefault
			If Type('thisform.grd_contracte.visible') <> 'U'
				Thisform.grd_contracte.SetFocus()
			Else
				Thisform.grd_articole.SetFocus()
			Endif
		*!*	modificare	v 2.0.67	^
		Case nKeyCode = 13 And lcControl = 'GRD_ARTICOLE'
			Nodefault
		*!*	modificare	v 2.0.67
		*!*		Thisform.but_urmator1.SetFocus()
			Thisform.but_urmator1.Click()
		*!*	modificare	v 2.0.67	^
		Case nKeyCode = 13 And lcControl = 'BUT_URMATOR1'
			Nodefault
			Thisform.do_urmator()
		Case nKeyCode = 13 And lcControl = 'GRD_FACTURA'
			Nodefault
		*!*	modificare	v 2.0.67
		*!*		Thisform.txtCodmat.SetFocus()
			If Type('thisform.grd_contracte.visible') <> 'U'
				Thisform.grd_contracte.SetFocus()
			Else
				Thisform.grd_articole.SetFocus()
			Endif
		*!*	modificare	v 2.0.67	^
		Case nKeyCode = 7 And lcControl = 'GRD_FACTURA'
			Nodefault
			Thisform.do_sterge()
		Case lcControl = 'TXTARTICOLELISTA' And nKeyCode = 13
			Nodefault
			lcArticolCautat = Alltrim(Thisform.txtArticoleLista.Value)
			If Used('crsfactura')
				Select crsfactura
				lnRecno = Recno()
				Locate For Substr(Alltrim(denumire),1,Len(lcArticolCautat)) = lcArticolCautat
				If Found()
					Thisform.grd_factura.SetFocus()
				Else
					amessagebox("Articolul nu a fost gasit!",48,"Atentie")
					Go lnRecno
					Thisform.txtArticoleLista.SetFocus()
				Endif
			Endif
		*!*	modificare	v 2.0.4
		*!*	Case lcControl = 'TXTARTICOLE' And nKeyCode = 13
		*!*		Nodefault
		*!*		lcArticolCautat = Alltrim(Thisform.txtArticole.Value)
		*!*		If Used('crsarticole')
		*!*			Select crsarticole
		*!*			lnRecno = Recno()
		*!*			Locate For Substr(Alltrim(denumire),1,Len(lcArticolCautat)) = lcArticolCautat
		*!*			If Found()
		*!*				Thisform.grd_articole.SetFocus()
		*!*			Else
		*!*				amessagebox("Articolul nu a fost gasit!",48,"Atentie")
		*!*				Go lnRecno
		*!*				Thisform.txtArticole.SetFocus()
		*!*			Endif
		*!*		Endif
		Case Inlist(lcControl,'TXTARTICOLE','TXTCODMAT') And nKeyCode = 13
			Nodefault
			If Used('crsarticole')
		*!*	modificare v 2.0.56
		*!*	Select crsarticole
				If Used('crspolitici')
					Select crspolitici
					lcFiltruPol = Iif(id_pol=-9999,[.T.],[id_pol = ] + Alltrim(Str(id_pol)))
				Else
					lcFiltruPol = [2=2]
				EndIf
				Select crsarticole
				Set Filter To 
		*!*	modificare v 2.0.56	^
				lnRecno = Recno()
				lcFiltruArt = Thisform.do_creeaza_filtru(Thisform.ct_articole,[denumire],Alltrim(Strtran(Thisform.txtArticole.Value,['],[''])))
				lcFiltruCodMat = Thisform.do_creeaza_filtru(Thisform.ct_codmat,[codmat],Alltrim(Strtran(Thisform.txtCodmat.Value,['],[''])))
				lcFiltru = lcFiltruPol + [ AND ] + Iif(Empty(lcFiltruArt),[2=2],lcFiltruArt) + [ AND ] + Iif(Empty(lcFiltruCodMat),[2=2],lcFiltruCodMat)
				If lcFiltru <> [2=2 AND 2=2 AND 2=2]
		*!*	modificare v 2.0.56
					Set Filter To &lcFiltru
		*!*	modificare v 2.0.56	^
					Locate For &lcFiltru
					If Found()
						Thisform.grd_articole.SetFocus()
					Else
		*!*	modificare v 2.0.56
		*!*					amessagebox("Articolul nu a fost gasit!",48,"Atentie")
		*!*					Go lnRecno
						Go Top
						Thisform.grd_articole.Refresh()
						amessagebox("Articolul nu a fost gasit!",48,"Atentie")
		*!*	modificare v 2.0.56	^
						lcFocus = [thisform.]+lcControl+[.setfocus()]
						&lcFocus
					Endif
				Else
					If lcControl = 'TXTCODMAT'
						Thisform.ct_articole.SetFocus()
					Else
						Thisform.grd_articole.SetFocus()
					Endif
				Endif
			Endif
		*!*	modificare	v 2.0.4	^
		Case nKeyCode=27 And nShiftAltCtrl=0
			Nodefault
			If amessagebox("Sunteti sigur ca doriti sa inchideti fereastra?",4+32+256,"Confirmare")==6
				This.do_renunt()
			Endif
		Case nKeyCode=6 And nShiftAltCtrl=2
			Nodefault
			This.do_termin()
		Endcase
		
	ENDPROC

	PROCEDURE modifica_lista_preturi
		Lparameters tnIdPol, tnIdArticol, tnPretftvaLista, tnPretvtvaLista, tnPretLista, tnProcTvav,tnPretListaVechi
		*!*	modificare v 2.0.90 : am adaugat llModificat
		LOCAL llModificat
		llModificat = .F.
		
		If tnPretListaVechi <> tnPretLista
			If aMESSAGEBOX(Alltrim(poArticol.denumire)+" are pretul "+Alltrim(Str(tnPretListaVechi,16,gnPPretV)) + [ in politicile de preturi. Doriti sa il schimbati cu ]+Alltrim(Str(tnPretLista,16,gnPPretV))+" ?",4+32,"Confirmare modificare pret") <> 6
				RETURN llModificat
			Endif
		Else
			Return llModificat
		Endif
		
		*!* MODIFICARE PRETURI IN LISTA DE PRETURI PENTRU NIR-UL CU MODIFICAREA LISTEI DE PRETURI (ID_SET = 231 NIR MF PV LISTA DE PRETURI)
		
		Local lcSql, lcSelect
		lcSelect = Select()
		
		*!* verific daca exista articolul in politica de preturi
		lcSql = [Select id_pol_art, id_venchelt, proc_tvav from crm_politici_pret_art where id_pol = ] + Alltrim(Str(tnIdPol)) + [ and id_articol = ] + Alltrim(Str(tnIdArticol))
		lnSucces = goExecutor.oExecute(m.lcSql, "cPoliticiPretArt")
		If lnSucces < 0
			aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
		
			Select (lcSelect)
			RETURN llModificat
		Endif
		Select cPoliticiPretArt
		Scatter Name loPoliticaPretArt MEMO
		Use In (Select('cPoliticiPretArt'))
		
		
		&& TRANZACTIE MANUALA (MODIFICARE CRM_POLITICI_PRET_ART, CRM_POLITICI_PRETURI)
		lnSucces = SQLSetprop(gnHandle,"Transactions",2)
		If lnSucces < 0
			aMessageBox("Programul nu a trecut pe tranzactie manuala",4+48,'Lista preturi')
		
			Select (lcSelect)
			RETURN llModificat
		Endif
		
		*!* ADAUGARE ARTICOL NOU IN LISTA DE PRETURI SAU MODIFICARE ARTICOL EXISTENT
		If Nvl(loPoliticaPretArt.id_pol_art,0) = 0
			lcSql = [begin pack_preturi.adauga_politica_pret_art(] + ;
				ALLTRIM(Str(tnIdPol)) + [,] + ; && id_pol
			Alltrim(Str(tnIdArticol)) + [,] + ; && id_articol
			Alltrim(Str(tnPretLista,20,4)) + [,] + ; && pret
			Alltrim(Str(tnPretftvaLista,20,4)) + [,] + ;  && pretftva
			Alltrim(Str(tnPretvtvaLista ,20,4)) + [,] + ; && pretctva
			[NULL, ] + ; && id_valuta
			Alltrim(Str(tnProcTvav,20,4)) + [,] + ; && proc_tvav
			[NULL, ] + ; && procent
			[NULL, ] + ; && id_venchelt
			Alltrim(Str(gnIdUtil)) + ; && id_util
			[); end;]
		Else
			lcSql = [begin pack_preturi.modifica_pret_pol_pret_art(] + ;
				ALLTRIM(Str(loPoliticaPretArt.id_pol_art)) + [,] + ; && id_pol_art
			Alltrim(Str(tnPretLista,20,4)) + [,] + ; && pret
			Alltrim(Str(tnPretftvaLista,20,4)) + [,] + ;  && pretftva
			Alltrim(Str(tnPretvtvaLista ,20,4)) + [,] + ; && pretctva
			Iif(IsNull(loPoliticaPretArt.id_venchelt), 'NULL',Alltrim(Str(loPoliticaPretArt.id_venchelt))) + [,] + ; && id_venchelt
			Iif(IsNull(loPoliticaPretArt.proc_tvav), 'NULL', Alltrim(Str(loPoliticaPretArt.proc_tvav,20,4))) + ; && proc_tvav
			[); end;]
		Endif && Nvl(lnIdPolArt,0) = 0
		
		
		lnSucces = goExecutor.oExecute(lcSql)
		If lnSucces < 0
			aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
		Else
			*!* MODIFICARE DATAORA, UTIL in CRM_POLITICI_PRETURI
			lcSql = [begin pack_preturi.modifica_politica_dataora(] + ;
				ALLTRIM(Str(tnIdPol)) + [,] + ; && id_pol
			Alltrim(Str(gnIdUtil)) + ; && id_util
			[); end;]
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces < 0
				aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
			Endif
		Endif
		
		*!* COMMIT / ROLLBACK
		If lnSucces > 0
			lnSucces = goExecutor.oExecute("COMMIT")
			If lnSucces < 0
				aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
			ELSE
				llModificat = .T.
			Endif
		Else
			lnSucces = goExecutor.oExecute("ROLLBACK")
			If lnSucces < 0
				aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
			Endif
		Endif
		
		SQLSetprop(gnHandle,"Transactions",1)
		
		Select (lcSelect)
		RETURN llModificat
	ENDPROC

	PROCEDURE cb_contracte.InteractiveChange
		Select crscontracte
		lcFiltru = Iif(id_ctr=-9999,[.T.],[id_ctr = ] + Alltrim(Str(id_ctr)))
		save_grid_tag(Thisform.grd_contracte)
		Select crsarticole1
		Set Filter To &lcFiltru
		Go Top
		restore_grid_tag(Thisform.grd_contracte)
		Thisform.grd_contracte.SetFocus()
	ENDPROC

	PROCEDURE cb_politici_preturi.InteractiveChange
		*!*	modificare	v 2.0.56
		*!*	Select crspolitici
		*!*	lcFiltru = Iif(id_pol=-9999,[.T.],[id_pol = ] + Alltrim(Str(id_pol)))
		*!*	save_grid_tag(Thisform.grd_articole)
		*!*	Select crsarticole
		*!*	Set Filter To &lcFiltru
		*!*	Go Top
		*!*	restore_grid_tag(Thisform.grd_articole)
		*!*	Thisform.txtArticole.SetFocus()
		Thisform.do_cauta()
		Thisform.txtCodmat.SetFocus()
		*!*	modificare	v 2.0.56	^
	ENDPROC

	PROCEDURE Clb_discount.Procent.LostFocus
		Thisform.do_calculeaza_discount(This.Value)
		
	ENDPROC

	PROCEDURE Clb_discount.TX_SUMA_NAT.InteractiveChange
		lcval=This.ControlSource
		&lcval=This.Value
		Thisform.do_calculeaza_totaluri(.T.)
	ENDPROC

	PROCEDURE Clb_discount.TX_SUMA_VAL.InteractiveChange
		lcval=This.ControlSource
		&lcval=This.Value
		Thisform.do_calculeaza_totaluri(.T.)
	ENDPROC

	PROCEDURE Clb_total_baza.tx_suma_nat.InteractiveChange
		Thisform.actualizeaza_total_mod(This.Value,1)
	ENDPROC

	PROCEDURE Clb_total_tva.tx_suma_nat.InteractiveChange
		Thisform.actualizeaza_total_mod(This.Value,2)
	ENDPROC

	PROCEDURE ct_articole.InteractiveChange
		With Thisform.txtArticole
			If This.Value>5
				.Value=""
				.ReadOnly=.T.
			Else
				.ReadOnly=.F.
				.SetFocus()
			Endif
		Endwith
	ENDPROC

	PROCEDURE ct_codmat.InteractiveChange
		With Thisform.txtcodmat
			If This.Value>5
				.Value=""
				.ReadOnly=.T.
			Else
				.ReadOnly=.F.
				.SetFocus()
			Endif
		Endwith
		
	ENDPROC

	PROCEDURE ct_codmat.ProgrammaticChange
		With Thisform.txtcodmat
			If This.Value>5
				.Value=""
				.ReadOnly=.T.
			Else
				.ReadOnly=.F.
			Endif
		Endwith
	ENDPROC

	PROCEDURE grd_articole.Init
		*Nu sterge
	ENDPROC

	PROCEDURE grd_contracte.Init
		*Nu sterge
	ENDPROC

	PROCEDURE grd_factura.Init
		*Nu sterge
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_facturare_articole2 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="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDenumire.cCboDenumire" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cValdiminuatctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cValdiminuatctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDiscountCTva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cDiscountCTva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretFtva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cPretFtva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cSerie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cSerie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVpretftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVpretftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVdiscountftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVdiscountftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVvaldiminuatftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cVvaldiminuatftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCodMat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCodMat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cCodMat.cboCodmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cGestiune.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cGestiune.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cGestiune.cCboGestiune" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cExplicatieTVA.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cExplicatieTVA.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cProcentDiscount.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_factura.cProcentDiscount.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_total_mod" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nract" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_valuta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cCurs.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cCurs.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cNume_val.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cNume_val.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cMultiplicator.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_cursuri.cMultiplicator.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_cursuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie_act1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_discountevidentiat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_zi_curs" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_dataact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount.Procent" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount.Lb_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total_baza" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_data_scadenta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_nume_client" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_responsabil" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_altele" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_lucrare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_venchelt" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ed_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_fdoc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_fdoc.cboFdoc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: actualizeaza_total_mod
		*m: do_adauga_articol
		*m: do_adauga_rata
		*m: do_adauga_tot
		*m: do_alege_stoc
		*m: do_calculeaza_discount
		*m: do_calculeaza_totaluri
		*m: do_creeaza_filtru
		*m: do_initializeaza_articol
		*m: do_retur
		*m: do_scrie_articole
		*m: do_scrie_factura
		*m: do_scrie_proforma
		*m: do_urmator2
		*m: do_verifica_articol
		*m: modifica_lista_preturi
		*p: clistaidarticoleretur		&& Lista articole retur id_articol:id_vanzare,id_articol:id_vanzare
		*p: cmesaj_cantitate
		*p: cnewvalue
		*p: coldvalue
		*p: nbazafdiscount
		*p: nbazafdiscountval
		*p: nbazaron
		*p: nbazaval
		*p: ncritcod		&& Criteriul initial de cautare dupa cod material.
		*p: ncritdenumire		&& Criteriul initial de cautare dupa denumire.
		*p: ndiscfactron
		*p: ndiscfactval
		*p: ndiscron
		*p: ndiscval
		*p: nid
		*p: nnrinregvizibile		&& Numarul de inregistrari vizibile in gridul cu elementele facturii.
		*p: nproc_disc_mem		&& Procentul de discount memorat.
		*p: nproc_tvav
		*p: ntotalron
		*p: ntotalval
		*p: ntvaron
		*p: ntvaval
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grd_factura
		clistaidarticoleretur = 
		cmesaj_cantitate = .F.
		cnewvalue = 
		coldvalue = 
		DoCreate = .T.
		Height = 586
		Name = "frm_facturare_articole2"
		nbazafdiscount = 0
		nbazafdiscountval = 0
		nbazaron = 0
		nbazaval = 0
		ncritcod = 2
		ncritdenumire = 2
		ndiscfactron = 0
		ndiscfactval = 0
		ndiscron = 0
		ndiscval = 0
		nnrinregvizibile = 16
		nproc_disc_mem = 0
		nproc_tvav = 0
		ntotalron = 0
		ntotalval = 0
		ntvaron = 0
		ntvaval = 0
		Width = 781
		WindowState = 2
		_memberdata = <VFPData>
			<memberdata name="clistaidarticoleretur" display="cListaIdArticoleRetur"/>
			<memberdata name="ncritdenumire" display="nCritDenumire"/>
			<memberdata name="ncritcod" display="nCritCod"/>
		</VFPData>
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 780
		_shape1.ZOrderSet = 1
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 712
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "FACTURA"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 24
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 748
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 17
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Left = 192
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 569
	*</PropValue>

	ADD OBJECT '_checkbox1' AS _checkbox WITH ;
		Alignment = 0, ;
		AutoSize = .T., ;
		Caption = "TVA la încasare", ;
		ControlSource = "poDate.tva_incasare", ;
		Height = 34, ;
		Left = 372, ;
		Name = "_checkbox1", ;
		TabIndex = 23, ;
		Top = 36, ;
		Width = 70, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'But_nou1' AS but_nou WITH ;
		Anchor = 8, ;
		Left = 719, ;
		Name = "But_nou1", ;
		TabIndex = 14, ;
		Top = 175
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 716, ;
		Name = "But_renunt1", ;
		TabIndex = 18, ;
		Top = 1, ;
		Width = 30, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Anchor = 8, ;
		Left = 747, ;
		Name = "But_sterge1", ;
		TabIndex = 15, ;
		Top = 175
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'ck_discountevidentiat' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 12, ;
		AutoSize = .F., ;
		Caption = "Se pune în evidenta discount-ul pe articole în notele contabile si pe factura", ;
		ControlSource = "poDate.discount_evidentiat", ;
		Height = 24, ;
		Left = 360, ;
		Name = "ck_discountevidentiat", ;
		TabIndex = 27, ;
		Top = 446, ;
		Width = 431, ;
		WordWrap = .T., ;
		ZOrderSet = 17
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_data_scadenta' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 172, ;
		Name = "Clb_data_scadenta", ;
		TabIndex = 5, ;
		Top = 87, ;
		Width = 180, ;
		TEXT_SIMPLU1.ControlSource = "poDate.datascad", ;
		TEXT_SIMPLU1.FontBold = .T., ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.Left = 69, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 77, ;
		LB_SIMPLU1.Caption = "Data scad.", ;
		LB_SIMPLU1.FontBold = .T., ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CMD_BUTON1.Left = 147, ;
		CMD_BUTON1.Name = "CMD_BUTON1", ;
		CMD_BUTON1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_dataact' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 17, ;
		Name = "Clb_dataact", ;
		TabIndex = 4, ;
		Top = 87, ;
		Width = 156, ;
		TEXT_SIMPLU1.ControlSource = "poDate.dataact", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.Left = 44, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 77, ;
		LB_SIMPLU1.Caption = "Data", ;
		LB_SIMPLU1.FontBold = .T., ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CMD_BUTON1.Left = 123, ;
		CMD_BUTON1.Name = "CMD_BUTON1", ;
		CMD_BUTON1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discount' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 53, ;
		Left = 228, ;
		Name = "Clb_discount", ;
		TabIndex = 20, ;
		Top = 523, ;
		Width = 255, ;
		ZOrderSet = 20, ;
		TX_SUMA_VAL.ControlSource = "thisform.ndiscfactval", ;
		TX_SUMA_VAL.Left = 66, ;
		TX_SUMA_VAL.Name = "TX_SUMA_VAL", ;
		TX_SUMA_VAL.Top = 27, ;
		LB_EXPLICATIE.Caption = "Discount pe factura (fara TVA)", ;
		LB_EXPLICATIE.Left = 4, ;
		LB_EXPLICATIE.Name = "LB_EXPLICATIE", ;
		LB_EXPLICATIE.Top = 5, ;
		TX_SUMA_NAT.ControlSource = "thisform.ndiscfactron", ;
		TX_SUMA_NAT.InputMask = (get_mask(14,gnPc)), ;
		TX_SUMA_NAT.Left = 164, ;
		TX_SUMA_NAT.Name = "TX_SUMA_NAT", ;
		TX_SUMA_NAT.Top = 27, ;
		LB_NUME_VAL.Left = 128, ;
		LB_NUME_VAL.Name = "LB_NUME_VAL", ;
		LB_NUME_VAL.Top = 30, ;
		LB_NUME_NAT.Left = 227, ;
		LB_NUME_NAT.Name = "LB_NUME_NAT", ;
		LB_NUME_NAT.Top = 30, ;
		lb_explicatii.Left = 151, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 5
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discount.Lb_simplu2' AS lb_simplu WITH ;
		Caption = "%", ;
		Left = 237, ;
		Name = "Lb_simplu2", ;
		TabIndex = 4, ;
		Top = 6
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'Clb_discount.Procent' AS _txbase WITH ;
		Alignment = 3, ;
		FontName = "Arial Narrow", ;
		Format = "!K", ;
		Height = 23, ;
		InputMask = "9 999.99", ;
		Left = 185, ;
		Name = "Procent", ;
		TabIndex = 1, ;
		Top = 3, ;
		Value = 0, ;
		Width = 46
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'Clb_discount_articole' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 53, ;
		Left = 228, ;
		Name = "Clb_discount_articole", ;
		TabIndex = 29, ;
		Top = 471, ;
		Width = 255, ;
		ZOrderSet = 24, ;
		tx_suma_val.ControlSource = "thisform.ndiscval", ;
		tx_suma_val.Left = 66, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 27, ;
		lb_explicatie.Caption = "Discount articole (fara TVA)", ;
		lb_explicatie.Left = 4, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 6, ;
		tx_suma_nat.ControlSource = "thisform.ndiscron", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 164, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 27, ;
		lb_nume_val.Left = 128, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 30, ;
		lb_nume_nat.Left = 227, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 30, ;
		lb_explicatii.Left = 154, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 6
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'clb_fdoc' AS _container WITH ;
		Height = 29, ;
		Left = 17, ;
		Name = "clb_fdoc", ;
		TabIndex = 1, ;
		Top = 59, ;
		Width = 128
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="container" />

	ADD OBJECT 'clb_fdoc.cboFdoc' AS _combobox WITH ;
		ColumnWidths = "100,0", ;
		ControlSource = "", ;
		Height = 23, ;
		Left = 4, ;
		Name = "cboFdoc", ;
		RowSource = "FACTURA,PROFORMA,BON FISCAL", ;
		RowSourceType = 1, ;
		SpecialEffect = 1, ;
		Top = 3, ;
		Value = FACTURA, ;
		Width = 119
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="combobox" />

	ADD OBJECT 'Clb_nract' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 299, ;
		Name = "Clb_nract", ;
		TabIndex = 3, ;
		Top = 59, ;
		Width = 179, ;
		TEXT_SIMPLU1.ControlSource = "poDate.nract", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.InputMask = (get_mask(14,0)), ;
		TEXT_SIMPLU1.Left = 54, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 121, ;
		LB_SIMPLU1.Caption = "Numar", ;
		LB_SIMPLU1.FontBold = .T., ;
		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_act1' AS clb_serie_act WITH ;
		cvariabila = serie_act, ;
		cvariabiladoc = nract, ;
		Height = 29, ;
		Left = 144, ;
		Name = "Clb_serie_act1", ;
		nid_tipdoc = 5, ;
		pcobj = poDate, ;
		TabIndex = 2, ;
		Top = 59, ;
		Width = 156, ;
		TEXT_SIMPLU1.ControlSource = "poDate.serie_act", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.Left = 43, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 110, ;
		_CBBASE1.Height = 23, ;
		_CBBASE1.Left = 44, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.Top = 3, ;
		_CBBASE1.Width = 108, ;
		_LBBASE1.Caption = "Serie", ;
		_LBBASE1.FontBold = .T., ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="serii_numere.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total_baza' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 30, ;
		Left = 482, ;
		Name = "Clb_total_baza", ;
		TabIndex = 21, ;
		Top = 471, ;
		Width = 290, ;
		ZOrderSet = 23, ;
		tx_suma_val.ControlSource = "thisform.nbazaval", ;
		tx_suma_val.Left = 111, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 4, ;
		lb_explicatie.Caption = "Total (baza)", ;
		lb_explicatie.Left = 4, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 7, ;
		tx_suma_nat.ControlSource = "thisform.nbazaron", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 203, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 4, ;
		lb_nume_val.Left = 175, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 7, ;
		lb_nume_nat.Left = 263, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 7, ;
		lb_explicatii.Left = 80, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 7
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total_factura' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 47, ;
		Left = 482, ;
		Name = "Clb_total_factura", ;
		TabIndex = 28, ;
		Top = 529, ;
		Width = 290, ;
		ZOrderSet = 22, ;
		tx_suma_val.ControlSource = "thisform.ntotalval", ;
		tx_suma_val.FontBold = .T., ;
		tx_suma_val.Left = 112, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 20, ;
		lb_explicatie.Caption = "TOTAL FACTURA", ;
		lb_explicatie.FontBold = .T., ;
		lb_explicatie.Left = 4, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 4, ;
		tx_suma_nat.ControlSource = "thisform.ntotalron", ;
		tx_suma_nat.FontBold = .T., ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 204, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 20, ;
		lb_nume_val.FontBold = .T., ;
		lb_nume_val.Left = 176, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 23, ;
		lb_nume_nat.FontBold = .T., ;
		lb_nume_nat.Left = 264, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 23, ;
		lb_explicatii.Left = 119, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 4
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total_tva' AS clb_tx_sume_valuta WITH ;
		Anchor = 12, ;
		Height = 30, ;
		Left = 482, ;
		Name = "Clb_total_tva", ;
		TabIndex = 22, ;
		Top = 500, ;
		Width = 290, ;
		ZOrderSet = 21, ;
		tx_suma_val.ControlSource = "thisform.ntvaval", ;
		tx_suma_val.Left = 111, ;
		tx_suma_val.Name = "tx_suma_val", ;
		tx_suma_val.Top = 4, ;
		lb_explicatie.Caption = "TVA", ;
		lb_explicatie.Left = 4, ;
		lb_explicatie.Name = "lb_explicatie", ;
		lb_explicatie.Top = 7, ;
		tx_suma_nat.ControlSource = "thisform.ntvaron", ;
		tx_suma_nat.InputMask = (get_mask(14,gnPc)), ;
		tx_suma_nat.Left = 203, ;
		tx_suma_nat.Name = "tx_suma_nat", ;
		tx_suma_nat.Top = 4, ;
		lb_nume_val.Left = 175, ;
		lb_nume_val.Name = "lb_nume_val", ;
		lb_nume_val.Top = 7, ;
		lb_nume_nat.Left = 263, ;
		lb_nume_nat.Name = "lb_nume_nat", ;
		lb_nume_nat.Top = 7, ;
		lb_explicatii.Left = 80, ;
		lb_explicatii.Name = "lb_explicatii", ;
		lb_explicatii.Top = 7
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_zi_curs' AS clb_tx_data WITH ;
		Height = 29, ;
		Left = 172, ;
		Name = "Clb_zi_curs", ;
		TabIndex = 7, ;
		Top = 115, ;
		Width = 180, ;
		TEXT_SIMPLU1.ControlSource = "poDate.zi_curs", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.Left = 69, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 77, ;
		LB_SIMPLU1.BackColor = 0,0,0, ;
		LB_SIMPLU1.Caption = "Data curs", ;
		LB_SIMPLU1.FontBold = .T., ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CMD_BUTON1.Left = 147, ;
		CMD_BUTON1.Name = "CMD_BUTON1", ;
		CMD_BUTON1.Top = 2
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_altele' AS ct_clb_cautare WITH ;
		Anchor = 8, ;
		cconditie = EMPTY(NVL(poDate.listaid,'')), ;
		cprocedura = thisform.do_cauta_altele, ;
		cvar_afisata = poDate.descriere, ;
		Height = 31, ;
		Left = 560, ;
		Name = "Ct_clb_altele", ;
		TabIndex = 13, ;
		Top = 142, ;
		Width = 215, ;
		IMG_CAUTARE.Left = 190, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Altele", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.FontBold = .T., ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Height = 23, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 80, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Width = 100, ;
		CLB_TX_CAUTARE.Width = 185
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_lucrare' AS ct_clb_cautare WITH ;
		Anchor = 8, ;
		cconditie = EMPTY(NVL(poDate.id_lucrare,0)), ;
		cprocedura = thisform.do_cauta_lucrare, ;
		cvar_afisata = poDate.nrord, ;
		Height = 31, ;
		Left = 560, ;
		Name = "Ct_clb_lucrare", ;
		TabIndex = 9, ;
		Top = 30, ;
		Width = 215, ;
		IMG_CAUTARE.Left = 190, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Lucrare", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.FontBold = .T., ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Height = 23, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 80, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Width = 100, ;
		CLB_TX_CAUTARE.Width = 185
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_nume_client' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(poDate.id_client) or ISNULL(poDate.id_client), ;
		cprocedura = thisform.do_cauta_client, ;
		cvar_afisata = poDate.nume_client, ;
		Height = 31, ;
		Left = 16, ;
		Name = "Ct_clb_nume_client", ;
		TabIndex = 19, ;
		Top = 30, ;
		Width = 332, ;
		IMG_CAUTARE.Left = 309, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.Height = 29, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Client", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.FontBold = .T., ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Left = 1, ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Height = 23, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 44, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Width = 247, ;
		CLB_TX_CAUTARE.Top = 1, ;
		CLB_TX_CAUTARE.Width = 295
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_responsabil' AS ct_clb_cautare WITH ;
		Anchor = 8, ;
		cconditie = EMPTY(NVL(poDate.id_responsabil,0)), ;
		cprocedura = thisform.do_cauta_responsabil, ;
		cvar_afisata = poDate.responsabil, ;
		Height = 31, ;
		Left = 560, ;
		Name = "Ct_clb_responsabil", ;
		TabIndex = 12, ;
		Top = 114, ;
		Width = 215, ;
		IMG_CAUTARE.Left = 190, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Responsabil", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.FontBold = .T., ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Height = 23, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 80, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Width = 100, ;
		CLB_TX_CAUTARE.Width = 185
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_sectie' AS ct_clb_cautare WITH ;
		Anchor = 8, ;
		cconditie = EMPTY(NVL(poDate.id_sectie,0)), ;
		cprocedura = thisform.do_cauta_sectie, ;
		cvar_afisata = poDate.sectie, ;
		Height = 31, ;
		Left = 560, ;
		Name = "Ct_clb_sectie", ;
		TabIndex = 10, ;
		Top = 58, ;
		Width = 215, ;
		IMG_CAUTARE.Left = 190, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Secție", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.FontBold = .T., ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 80, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Width = 100, ;
		CLB_TX_CAUTARE.Width = 185
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_valuta' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poDate.id_valuta,0)), ;
		cprocedura = thisform.do_cauta_valuta, ;
		cvar_afisata = poDate.nume_valuta, ;
		Height = 31, ;
		Left = 16, ;
		Name = "Ct_clb_valuta", ;
		TabIndex = 6, ;
		Top = 114, ;
		Width = 157, ;
		IMG_CAUTARE.Left = 130, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Valută", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.FontBold = .T., ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Height = 23, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 44, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Width = 77, ;
		CLB_TX_CAUTARE.Width = 125
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_venchelt' AS ct_clb_cautare WITH ;
		Anchor = 8, ;
		cconditie = EMPTY(NVL(poDate.id_venchelt,0)), ;
		cprocedura = thisform.do_cauta_venchelt, ;
		cvar_afisata = poDate.venchelt, ;
		Height = 31, ;
		Left = 560, ;
		Name = "Ct_clb_venchelt", ;
		TabIndex = 11, ;
		Top = 86, ;
		Width = 215, ;
		IMG_CAUTARE.Left = 190, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Venit", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.FontBold = .T., ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Height = 23, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 80, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Width = 100, ;
		CLB_TX_CAUTARE.Width = 185
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ed_tx_simplu1' AS ed_tx_simplu WITH ;
		Height = 28, ;
		Left = 17, ;
		Name = "Ed_tx_simplu1", ;
		TabIndex = 8, ;
		Top = 143, ;
		Width = 335, ;
		_EDBASE1.ControlSource = "poDate.explicatia4", ;
		_EDBASE1.Format = "!K", ;
		_EDBASE1.Height = 22, ;
		_EDBASE1.Left = 68, ;
		_EDBASE1.MaxLength = 100, ;
		_EDBASE1.Name = "_EDBASE1", ;
		_EDBASE1.Top = 2, ;
		_EDBASE1.Width = 262, ;
		_LBBASE1.Caption = "Explicatia", ;
		_LBBASE1.FontBold = .T., ;
		_LBBASE1.Height = 18, ;
		_LBBASE1.Left = 4, ;
		_LBBASE1.Name = "_LBBASE1", ;
		_LBBASE1.ToolTipText = "Explicatia Reg. Jurnal (max. 100 caractere) ", ;
		_LBBASE1.Top = 6, ;
		_LBBASE1.Width = 63, ;
		_LBBASE1.WordWrap = .T.
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'grd_cursuri' AS _grdrow WITH ;
		Anchor = 6, ;
		ColumnCount = 3, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 77, ;
		Left = 15, ;
		Name = "grd_cursuri", ;
		Panel = 1, ;
		RecordSource = "crscursuri", ;
		ScrollBars = 2, ;
		TabIndex = 26, ;
		TabStop = .F., ;
		Top = 499, ;
		Width = 177, ;
		ZOrderSet = 13, ;
		Column1.ColumnOrder = 3, ;
		Column1.ControlSource = "curs", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.InputMask = (get_mask(14,gnPCurs)), ;
		Column1.Name = "cCurs", ;
		Column1.Width = 38, ;
		Column2.ColumnOrder = 2, ;
		Column2.ControlSource = "nume_val", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cNume_val", ;
		Column2.Width = 56, ;
		Column3.ColumnOrder = 1, ;
		Column3.ControlSource = "multiplicator", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.InputMask = (get_mask(10,0)), ;
		Column3.Name = "cMultiplicator", ;
		Column3.Width = 49
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

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

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

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

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

	ADD OBJECT 'grd_factura' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 14, ;
		DeleteMark = .F., ;
		FontName = "Arial", ;
		HeaderHeight = 18, ;
		Height = 240, ;
		HighlightStyle = 1, ;
		Left = 12, ;
		Name = "grd_factura", ;
		Panel = 1, ;
		ReadOnly = .F., ;
		RecordSource = "crsfactura", ;
		RowHeight = 18, ;
		TabIndex = 16, ;
		Top = 204, ;
		Width = 765, ;
		ZOrderSet = 8, ;
		Column1.ColumnOrder = 2, ;
		Column1.ControlSource = "crsFactura.denumire", ;
		Column1.CurrentControl = "cCboDenumire", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 9, ;
		Column1.Name = "cDenumire", ;
		Column1.ReadOnly = .F., ;
		Column1.Width = 193, ;
		Column2.ColumnOrder = 13, ;
		Column2.ControlSource = "valdiminuatctva", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 9, ;
		Column2.InputMask = (get_mask(14,gnPc)), ;
		Column2.Name = "cValdiminuatctva", ;
		Column2.ReadOnly = .F., ;
		Column2.Width = 90, ;
		Column3.ColumnOrder = 6, ;
		Column3.ControlSource = "pretctva", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 9, ;
		Column3.InputMask = (get_mask(14,gnPPretV)), ;
		Column3.Name = "cPretctva", ;
		Column3.ReadOnly = .F., ;
		Column3.Width = 93, ;
		Column4.ColumnOrder = 5, ;
		Column4.ControlSource = "cantitate", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 9, ;
		Column4.InputMask = (get_mask(14,gnPcant)), ;
		Column4.Name = "cCantitate", ;
		Column4.ReadOnly = .F., ;
		Column4.Width = 58, ;
		Column5.ColumnOrder = 11, ;
		Column5.ControlSource = "discountctva", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 9, ;
		Column5.InputMask = (get_mask(14,gnPPretV)), ;
		Column5.Name = "cDiscountCTva", ;
		Column5.ReadOnly = .F., ;
		Column5.Width = 73, ;
		Column6.ColumnOrder = 7, ;
		Column6.ControlSource = "pretftva", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 9, ;
		Column6.InputMask = (get_mask(14,gnPPretV)), ;
		Column6.Name = "cPretFtva", ;
		Column6.ReadOnly = .F., ;
		Column6.Width = 101, ;
		Column7.ColumnOrder = 4, ;
		Column7.ControlSource = "serie", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 9, ;
		Column7.Name = "cSerie", ;
		Column7.ReadOnly = .F., ;
		Column7.Width = 64, ;
		Column8.ColumnOrder = 10, ;
		Column8.ControlSource = "vpretftva", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 9, ;
		Column8.InputMask = (get_mask(14,gnPVal)), ;
		Column8.Name = "cVpretftva", ;
		Column8.ReadOnly = .F., ;
		Column8.Width = 112, ;
		Column9.ColumnOrder = 12, ;
		Column9.ControlSource = "vdiscountftva", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 9, ;
		Column9.InputMask = (get_mask(14,gnPVal)), ;
		Column9.Name = "cVdiscountftva", ;
		Column9.ReadOnly = .F., ;
		Column9.Width = 86, ;
		Column10.ColumnOrder = 14, ;
		Column10.ControlSource = "vvaldiminuatftva", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 9, ;
		Column10.InputMask = (get_mask(14,gnPVal)), ;
		Column10.Name = "cVvaldiminuatftva", ;
		Column10.ReadOnly = .F., ;
		Column11.ColumnOrder = 1, ;
		Column11.ControlSource = "crsFactura.codmat", ;
		Column11.CurrentControl = "cboCodmat", ;
		Column11.FontName = "Arial", ;
		Column11.FontSize = 9, ;
		Column11.Name = "cCodMat", ;
		Column11.ReadOnly = .F., ;
		Column11.Width = 87, ;
		Column12.ColumnOrder = 3, ;
		Column12.ControlSource = "crsFactura.gestiune", ;
		Column12.CurrentControl = "cCboGestiune", ;
		Column12.FontName = "Arial", ;
		Column12.FontSize = 9, ;
		Column12.Name = "cGestiune", ;
		Column12.ReadOnly = .F., ;
		Column12.Width = 142, ;
		Column13.ColumnOrder = 8, ;
		Column13.ControlSource = "expltva", ;
		Column13.FontName = "Arial", ;
		Column13.FontSize = 9, ;
		Column13.Name = "cExplicatieTVA", ;
		Column13.ReadOnly = .F., ;
		Column13.Width = 120, ;
		Column14.ColumnOrder = 9, ;
		Column14.ControlSource = "procdisc", ;
		Column14.FontName = "Arial", ;
		Column14.FontSize = 9, ;
		Column14.Format = "RK", ;
		Column14.InputMask = "99 999.99", ;
		Column14.Name = "cProcentDiscount", ;
		Column14.ReadOnly = .F., ;
		Column14.Width = 85
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grd_factura.cCantitate.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cantitate", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cCantitate.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cCodMat.cboCodmat' AS combosql WITH ;
		ColumnCount = 6, ;
		ColumnWidths = "50,150,50,100,100,100", ;
		ControlSource = "crsFactura.codmat", ;
		csourcesql = select codmat, denumire, um, grupa, subgrupa, codbare, id_articol from vnom_articole, ;
		csourcewhere = inactiv = 0, ;
		FontSize = 9, ;
		Left = 25, ;
		Name = "cboCodmat", ;
		pcursorname = crsCodmat, ;
		pfieldactiv = codmat, ;
		Top = 71
		*< END OBJECT: ClassLib="cautare.vcx" BaseClass="combobox" />

	ADD OBJECT 'grd_factura.cCodMat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod material", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .F.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cCodMat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		FontSize = 8, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cDenumire.cCboDenumire' AS combosql WITH ;
		ColumnCount = 6, ;
		ColumnWidths = "150,50,50,100,100,100", ;
		ControlSource = "crsFactura.denumire", ;
		csourcesql = select denumire, codmat, um, grupa, subgrupa, codbare, id_articol from vnom_articole, ;
		csourcewhere = inactiv = 0, ;
		FontSize = 9, ;
		Left = 81, ;
		Name = "cCboDenumire", ;
		pcursorname = crsDenumire, ;
		pfieldactiv = denumire, ;
		Top = 71
		*< END OBJECT: ClassLib="cautare.vcx" BaseClass="combobox" />

	ADD OBJECT 'grd_factura.cDenumire.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Articol", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cDiscountCTva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount unitar cu TVA", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cDiscountCTva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cExplicatieTVA.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Explicatie TVA", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cExplicatieTVA.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cGestiune.cCboGestiune' AS combosql WITH ;
		ColumnCount = 2, ;
		ColumnLines = .F., ;
		ColumnWidths = "150,50", ;
		csourcesql = select nume_gestiune, cgest, id_gestiune from VNOM_GESTIUNI, ;
		csourcewhere = inactiv = 0, ;
		Left = 55, ;
		Name = "cCboGestiune", ;
		pcursorname = crsGestiuni, ;
		pfieldactiv = nume_gestiune, ;
		Top = 47
		*< END OBJECT: ClassLib="cautare.vcx" BaseClass="combobox" />

	ADD OBJECT 'grd_factura.cGestiune.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Gestiune", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grd_factura.cPretctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar cu TVA", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .F.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cPretctva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cPretFtva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar fara TVA", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .F.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cPretFtva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cProcentDiscount.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Procent discount", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .F.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cProcentDiscount.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cSerie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cSerie.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cValdiminuatctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .F.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cValdiminuatctva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cVdiscountftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Discount unitar in valuta fara TVA", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cVdiscountftva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cVpretftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret unitar fara TVA in valuta", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cVpretftva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_factura.cVvaldiminuatftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare in valuta fara TVA", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_factura.cVvaldiminuatftva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 9, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 0,64,128
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridextra3' AS gridextra WITH ;
		allowgridpreferences = .F., ;
		gridexpression = Thisform.grd_factura, ;
		Height = 17, ;
		Left = 756, ;
		Name = "Gridextra3", ;
		Top = 432, ;
		Width = 24
		*< END OBJECT: ClassLib="..\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'lb_cursuri' AS lb_simplu WITH ;
		Anchor = 6, ;
		Caption = "Curs valutar (ZZ/LL/AAAA)", ;
		Left = 15, ;
		Name = "lb_cursuri", ;
		TabIndex = 25, ;
		Top = 479, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_total_mod' AS lb_simplu WITH ;
		Alignment = 1, ;
		Anchor = 12, ;
		AutoSize = .F., ;
		Caption = "0.00", ;
		FontBold = .T., ;
		FontName = "Arial Narrow", ;
		Height = 17, ;
		Left = 705, ;
		Name = "lb_total_mod", ;
		TabIndex = 30, ;
		Top = 532, ;
		Visible = .F., ;
		Width = 37
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />
	
	PROCEDURE actualizeaza_total_mod
		Lparameters tnValoare,tnTip
		Local lnTotal,lnValoare,lnTip
		If Nvl(gnModTotFact,0) = 1
			lnValoare = IIF(EMPTY(tnValoare),0,tnValoare)
			lnTip = IIF(EMPTY(tnTip),0,tnTip)
			lnTotal = Iif(lnTip=1,lnValoare,Thisform.nbazaron) + Iif(lnTip=2,lnValoare,Thisform.ntvaron)
			If lnTotal <> Thisform.ntotalron
				Thisform.clb_total_baza.tx_SUMA_NAT.ForeColor = Rgb(255,0,0)
				Thisform.clb_total_tva.tx_SUMA_NAT.ForeColor = Rgb(255,0,0)
				Thisform.lb_total_mod.ForeColor = Rgb(255,0,0)
				Thisform.lb_total_mod.AutoSize = .F.
				Thisform.lb_total_mod.Caption = Transform(lnTotal,get_mask(14,gnPc))
				Thisform.lb_total_mod.AutoSize = .T.
				Thisform.lb_total_mod.Visible = .T.
			Else
				Thisform.clb_total_baza.tx_SUMA_NAT.ForeColor = Rgb(0,0,0)
				Thisform.clb_total_tva.tx_SUMA_NAT.ForeColor = Rgb(0,0,0)
				Thisform.lb_total_mod.Visible = .F.
			Endif
		Endif
	ENDPROC

	PROCEDURE do_adauga
		SELECT crsFactura
		APPEND BLANK
		this.grd_factura.SetFocus()
	ENDPROC

	PROCEDURE do_adauga_articol
		*!* 17.03.2015
		*!* marius.mutu
		*!* daca cantitatea ramasa dupa adaugarea articolului gestionabil este < 0, atunci pun 0 ca sa pot intra pe ramura facturare fara stoc
		
		Lparameters tlImplicit, tlContract, tlRetur
		*	llImplicit = .T.	=>	daca exista o singura linie in stoc, atunci nu mai apare formularul de completare a datelor
		*	tlContract = .T.	=>	provine din gridul cu articole din contract
		*	tlRetur	   = .T. 	=>	se face retur la articolul selectat (trebuie selectat din rulaj in loc de stoc)
		
		Private pnProcentDiscountMem
		Local ofrmadarticol As "frm_articol_factura"
		Local lcSelectActualizare, lcSql, llActualizat, llSucces, lnListaIdOld, lnRecno, lnSucces
		Local lnTotalCantitate, loCauta
		*:Global gnButon, poArtLista
		pnProcentDiscountMem = 0
		
		If Nvl(gnMemProcDisc, 0) = 1
			pnProcentDiscountMem = Thisform.nproc_disc_mem
		Endif
		Local lcCursor, loGrid
		If tlContract
			lcCursor = [crsarticole1]
			loGrid = Thisform.grd_contracte
		Else
			lcCursor = [crsarticole]
			loGrid = Thisform.grd_articole
		Endif
		
		If Used(lcCursor) And Reccount(lcCursor) > 0
			Local lnCantitate
			Private poArticol
			Select (lcCursor)
			Scatter Name poArticol MEMO 
			Scatter Name poArtLista MEMO
			lnCantitate = poArticol.cantitate
		
		* FACTURARE ARTICOLE INEXISTENTE IN STOC
		* DOAR DACA ESTE ACTIVA OPTIUNEA RF_FACTURARE_FARA_STOC = 1 SAU VREAU SA RETURNEZ UN ARTICOL
		*!*		If lnCantitate = 0 And ((Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1) OR m.tlRetur)
		*!*			lnCantitate = 999999999
		*!*		Endif
		
			Thisform.do_initializeaza_articol(@poArticol)
		
		* 8 = Retur lei, 9 = retur valuta sau factura de vanzare normala, dar cu retur de articole
			If Inlist(poDate.tip, 8, 9)
				lnCantitate = poArticol.cantitate
			Endif
		
			gnButon = 2
		
			If Thisform.do_verifica_articol(tlContract, lnCantitate)
				Do Case
					Case (poArticol.gestionabil = 0 Or gnScadereStoc = 0 Or poDate.tip = 45)	&&	45 = ROARESTAURANT
						If !tlImplicit
							ofrmadarticol = Createobject("frm_articol_factura", lnCantitate, tlImplicit)
							ofrmadarticol.Show(1)
							Release ofrmadarticol
						Else
							poArticol = calculeaza_totaluri(poArticol)
							gnButon = 1
						ENDIF
		
					OTHERWISE
						lnListaIdOld = poDate.listaid
						IF m.tlRetur
							loCauta = caut_facturi_multiple_client_articol(poDate.id_client, poDate.in_valuta, poDate.id_valuta, .F., poArticol.id_articol)
							If m.gnButon = 1 and !Empty(Nvl(loCauta.id_vanzare, 0))
								poDate.listaid = Alltrim(Str(loCauta.id_vanzare))
								* ID_ARTICOL:ID_VANZARE,ID_ARTICOL:ID_VANZARE
								thisform.cListaIdArticoleRetur = thisform.cListaIdArticoleRetur + IIF(!EMPTY(thisform.cListaIdArticoleRetur), ',', '') + ALLTRIM(STR(poArticol.id_articol)) + ':' + poDate.listaid
							Endif
						ENDIF
						llSucces = Thisform.do_alege_stoc(poArticol.id_articol, lnCantitate, poArticol.denumire, tlImplicit, poArticol.pretftva, poArticol.discount_unitar, loGrid, m.tlRetur)
						poDate.listaid = m.lnListaIdOld
						If !m.llSucces
							Return
						Endif
				Endcase
			Else
				gnButon = 2
			Endif
			If Used('crsCtrTemp')
				Select crsCtrTemp
				Set Filter To
			Endif
		
			If gnButon = 1
		
		
				If Inlist(poDate.tip, 41) &&  retur transfer catre subunitati lista pret
					llActualizat = Thisform.modifica_lista_preturi(poArticol.Id_Pol, poArticol.id_articol, ;
						  IIF(poArticol.tip_valuta = 1, poArticol.pretftva_val, poArticol.pretftva), ;
						  IIF(poArticol.tip_valuta = 1, poArticol.pretctva_val, poArticol.Pretctva), ;
						  IIF(poArticol.tip_valuta = 1, ;
							IIF(poArticol.preturi_cu_tva = 1, poArticol.pretctva_val, poArticol.pretftva_val), ;
							Iif(poArticol.preturi_cu_tva = 1, poArticol.Pretctva, poArticol.pretftva)), ;
						  poArticol.Proc_Tvav, ;
						  IIF(poArticol.tip_valuta = 1, poArtLista.pret_val, poArtLista.Pret))
					If llActualizat
						lcSelectActualizare = Select()
						Select crsarticole
						lnRecno = Recno()
						Replace Pret With Iif(poArticol.preturi_cu_tva = 1, poArticol.Pretctva, poArticol.pretftva), ;
							pret_val With Iif(poArticol.preturi_cu_tva = 1, poArticol.pretctva_val, poArticol.pretftva_val) ;
							FOR id_articol = poArticol.id_articol And Id_Pol = poArticol.Id_Pol
						Go lnRecno
						Select (lcSelectActualizare)
					Endif
				Endif
		
				lcSql = [select codmatf from nom_articole where id_articol = ?poArticol.id_articol]
				lnSucces = goExecutor.oExecute(lcSql, [crscodmatf])
				If lnSucces < 0
					amessagebox(goExecutor.cEroare, 16, "Eroare")
				Else
					If Reccount('crscodmatf') > 0
						Select crscodmatf
						poArticol.codmatf = codmatf
					Endif
					Use In crscodmatf
				Endif
		
				save_grid_tag(Thisform.grd_factura)
		
				If !Used('crsartselectate')
					Select crsfactura
					Append Blank
					Gather Name poArticol Fields Like pret_achizitie, denumire, cantitate, id_articol, Id_Pol, Cont, id_gestiune, Proc_Tvav, ;
						pretftva, valftva, valtva, valctva, valdiscountftva, valdiscounttva, valdiscountctva, Pretctva, ;
						valdiminuatftva, valdiminuattva, valdiminuatctva, ;
						vvalftva, vvaltva, vvalctva, vvaldiscountftva, vvaldiscounttva, vvaldiscountctva, ;
						vvaldiminuatftva, vvaldiminuattva, vvaldiminuatctva, id_c, serie, explicatie, ;
						id_valuta, gestionabil, tip_valuta, id_jtva_coloana, id_lucrare_rez, id_part_rez, pretv_orig, pretd, id_valuta_d, id_ctr, opt_facturare, nume_val MEMO
						
					Replace id_temp With Recno(), codmat With Nvl(poArticol.codmat, Space(50)), codmatf With Nvl(poArticol.codmatf, Space(50)), ;
						um With Nvl(poArticol.um, [ ]), Curs With Nvl(poArticol.Curs, 0), multiplicator With Nvl(poArticol.multiplicator, 1), ;
						cu_tva With poArticol.preturi_cu_tva, codbare With Nvl(poArticol.codbare, Space(50)), ;
						vpretftva With Nvl(poArticol.pretftva_val, 0), vpretctva With Nvl(poArticol.pretctva_val, 0), ;
						discountftva With poArticol.discount_unitar, discountctva With poArticol.discount_unitar_ctva, ;
						vdiscountftva With Nvl(poArticol.discount_unitar_val, 0), vdiscountctva With Nvl(poArticol.discount_unitar_ctva_val, 0)
					If Used('crsCtrTemp')
						Select crsCtrTemp
						Locate For id_ctr = poArticol.id_ctr And text_standard = 1
						If Found()
							poArticol.numar_contract = Alltrim(contract)
							Select crsfactura
							Replace numar_contract With poArticol.numar_contract
						Else
							Select crsfactura
						Endif
					Endif
					If Nvl(gnMemProcDisc, 0) = 1
						Thisform.nproc_disc_mem = pnProcentDiscountMem
					Endif
				Else
					lnTotalCantitate = poArticol.cantitate
					Select crsartselectate
					Scan
						poArticol.pret_achizitie = Pret
						poArticol.serie = Nvl(serie, [])
						poArticol.id_gestiune = id_gestiune
						poArticol.Cont = Alltrim(Cont)
						poArticol.cantitate = cantitate
						poArticol.pretv_orig = pretv
						poArticol.id_lucrare_rez = id_lucrare_rez
						poArticol.id_part_rez = id_part_rez
		
						poArticol.pretd = pretd
						poArticol.id_valuta_d = id_valuta
		
						Select crsfactura
						Append Blank
		
						Gather Name poArticol Fields Like pret_achizitie, denumire, cantitate, id_articol, Id_Pol, ;
							Cont, id_gestiune, Proc_Tvav, pretftva, Pretctva, ;
							id_c, serie, explicatie, ;
							id_valuta, gestionabil, tip_valuta, id_jtva_coloana, id_lucrare_rez, id_part_rez, pretv_orig, pretd, id_valuta_d, nume_val, id_ctr, opt_facturare MEMO
							
						Replace id_temp With Recno(), codmat With Nvl(poArticol.codmat, Space(50)), ;
							codbare With Nvl(poArticol.codbare, Space(50)), ;
							codmatf With Nvl(poArticol.codmatf, Space(50)), um With Nvl(poArticol.um, Space(50)), ;
							Curs With Nvl(poArticol.Curs, 0), multiplicator With Nvl(poArticol.multiplicator, 1), ;
							cu_tva With poArticol.preturi_cu_tva, ;
							vpretftva With Nvl(poArticol.pretftva_val, 0), vpretctva With Nvl(poArticol.pretctva_val, 0), ;
							discountftva With poArticol.discount_unitar, discountctva With poArticol.discount_unitar_ctva, ;
							vdiscountftva With Nvl(poArticol.discount_unitar_val, 0), ;
							vdiscountctva With Nvl(poArticol.discount_unitar_ctva_val, 0)
		
						poArticol = calculeaza_totaluri(poArticol)
						Gather Name poArticol Fields Like valftva, valtva, valctva, ;
							valdiscountftva, valdiscounttva, valdiscountctva, ;
							valdiminuatftva, valdiminuattva, valdiminuatctva, ;
							vvalftva, vvaltva, vvalctva, ;
							vvaldiscountftva, vvaldiscounttva, vvaldiscountctva, ;
							vvaldiminuatftva, vvaldiminuattva, vvaldiminuatctva MEMO 
					Endscan
					Use In crsartselectate
					poArticol.cantitate = lnTotalCantitate	&&	imi trebuie mai jos, unde actualizez cantitatea totala
					Select crsfactura
				Endif && !Used('crsartselectate')
		
		
				If poArticol.Proc_Tvav > Thisform.nproc_tvav
					Thisform.nproc_tvav = poArticol.Proc_Tvav
				Endif
		
				If This.nnrinregvizibile < Recno('crsfactura')
					lnRecno = Recno() - This.nnrinregvizibile
					Go lnRecno
				Else
					Go Top
				Endif
		
				restore_grid_tag(Thisform.grd_factura)
		
				Select (lcCursor)
				lnRecno = Recno()
				Do Case
					Case gnScadereStoc = 1 And poDate.tip = 41 && aviz retur transfer catre subunitati lista pret
						Replace cantitate With cantitate + poArticol.cantitate For id_c = poArticol.id_c
						Go lnRecno
					Case (gnScadereStoc = 1 And poDate.tip = 23) Or Inlist(poDate.tip, 3, 4, 21, 25, 28, 42, 47) && 23 aviz transfer catre subunitati din lista, 3 factura pe baza de comenzi, 21 aviz catre clienti din comanda
						Replace cantitate With cantitate - poArticol.cantitate For id_c = poArticol.id_c
						Go lnRecno
					Case Inlist(poDate.tip, 8, 9)
						Replace cantitate With cantitate + poArticol.cantitate For id_c = poArticol.id_c
						Go lnRecno
					Case poArticol.gestionabil = 1 And gnScadereStoc = 1 And ;
							(Inlist(poDate.tip, 1, 22, 29) Or (poDate.tip = 2 And poArticol.opt_facturare = 0))
						Replace cantitate With IIF(cantitate - poArticol.cantitate > 0, cantitate - poArticol.cantitate, 0) For id_articol = poArticol.id_articol And gestionabil = 1
						* daca cantitatea ramasa dupa adaugarea articolului gestionabil este < 0, atunci pun 0 ca sa pot intra pe ramura facturare fara stoc
						Go lnRecno
				Endcase
		
				Thisform.do_calculeaza_totaluri()
		
				If poArticol.opt_facturare = 0
					Do Case
						Case !Empty(Thisform.txtCodmat.Value)
							Thisform.txtCodmat.SetFocus()
						Case !Empty(Thisform.txtArticole.Value)
							Thisform.txtArticole.SetFocus()
						Otherwise
							Thisform.grd_articole.SetFocus()
					Endcase
				Else
					Thisform.grd_contracte.SetFocus()
				Endif
			Else
				If poArticol.opt_facturare = 0
					Do Case
						Case !Empty(Thisform.txtCodmat.Value)
							Thisform.txtCodmat.SetFocus()
						Case !Empty(Thisform.txtArticole.Value)
							Thisform.txtArticole.SetFocus()
						Otherwise
							Thisform.grd_articole.SetFocus()
					Endcase
				Else
					Thisform.grd_contracte.SetFocus()
				Endif
			Endif
		
			Release poArticol
		Endif
		Release loGrid, pnProcentDiscountMem
		
	ENDPROC

	PROCEDURE do_adauga_rata
		Private poArticol
		Select crsarticole1
		Scatter Name poArticol MEMO
		Thisform.do_initializeaza_articol(@poArticol)
		Select crsfactura
		Locate For id_rata = poArticol.id_rata
		If Found()
			amessagebox([Aceasta rata a fost deja adaugata pe factura!],48,[Atentie])
		Else
			gnButon = 2
			ofrmadarticol=Createobject("frm_articol_factura_rate")
			ofrmadarticol.Show(1)
			Release ofrmadarticol
		
			If gnButon = 1
				save_grid_tag(Thisform.grd_factura)
				Select crsfactura
				Append Blank
				Gather Name poArticol Fields Like pret_achizitie,cantitate,Id_Pol,Cont,id_gestiune,Proc_Tvav,;
					serie,id_valuta,gestionabil,tip_valuta,id_jtva_coloana,id_lucrare_rez,id_part_rez,pretv_orig,pretd,id_valuta_d,id_rata,;
					data_rata,data_scadenta,nr_rata,id_ctr,opt_facturare,nume_val MEMO	&&	modificare ROAFACTURARE v 2.0.77 : nume_val
					
				Replace id_articol With Nvl(poArticol.id_articol,0),id_temp With Recno(),;
					codmat With Nvl(poArticol.codmat,Space(50)),codmatf With Nvl(poArticol.codmatf,Space(50)),;
					codbare With Nvl(poArticol.codbare,Space(50)),um With Nvl(poArticol.um,[ ]),;
					Curs With Nvl(poArticol.Curs,0),multiplicator WITH NVL(poArticol.multiplicator,1),;
					cu_tva With poArticol.preturi_cu_tva,;
					pretftva With poArticol.pretftva,Pretctva With poArticol.Pretctva,;
					valftva With poArticol.pretftva,valtva With poArticol.tva,valctva With poArticol.Pretctva,;
					vpretftva With Nvl(poArticol.pretftva_val,0),vpretctva With Nvl(poArticol.pretctva_val,0),;
					vvalftva With NVL(poArticol.pretftva_val,0),vvaltva With NVL(poArticol.tva_val,0),vvalctva With NVL(poArticol.Pretctva_val,0),;
					discountftva With poArticol.discount_unitar,discountctva With poArticol.discount_unitar_ctva,;
					valdiscountftva WITH poArticol.discount_unitar,valdiscountctva WITH poArticol.discount_unitar_ctva,;
					valdiscounttva WITH poArticol.discount_unitar_ctva - poArticol.discount_unitar,;
					vdiscountftva With Nvl(poArticol.discount_unitar_val,0),vdiscountctva With Nvl(poArticol.discount_unitar_ctva_val,0),;
					vvaldiscountftva WITH NVL(poArticol.discount_unitar_val,0),vvaldiscountctva WITH NVL(poArticol.discount_unitar_ctva_val,0),;
					vvaldiscounttva WITH NVL(poArticol.discount_unitar_ctva_val,0)-NVL(poArticol.discount_unitar_val,0),;
					valdiminuatftva WITH poArticol.pretftva - NVL(poArticol.discount_unitar,0),;
					valdiminuattva WITH (poArticol.pretctva - poArticol.pretftva) - (NVL(poArticol.discount_unitar_ctva,0)-NVL(poArticol.discount_unitar,0)),;
					valdiminuatctva WITH poArticol.pretctva - NVL(poArticol.discount_unitar_ctva,0),;
					vvaldiminuatftva WITH poArticol.pretftva_val - NVL(poArticol.discount_unitar_val,0),;
					vvaldiminuattva WITH (poArticol.pretctva_val - poArticol.pretftva_val) - (NVL(poArticol.discount_unitar_ctva_val,0)-NVL(poArticol.discount_unitar_val,0)),;
					vvaldiminuatctva WITH poArticol.pretctva_val - NVL(poArticol.discount_unitar_ctva_val,0),;
					denumire WITH poArticol.explicatie
				
				Select crsCtrTemp
				Locate For id_ctr = poArticol.id_ctr And text_standard = 1
				If Found()
					poArticol.numar_contract = ALLTRIM(contract)
					Select crsfactura
					Replace numar_contract With poArticol.numar_contract
				Else
					Select crsfactura
				Endif
		
				If poArticol.Proc_Tvav > Thisform.nproc_tvav
					Thisform.nproc_tvav = poArticol.Proc_Tvav
				Endif
		
				poDate.datascad = Iif(Type('poArticol.data_scadenta')='T',Ttod(poArticol.data_scadenta),poArticol.data_scadenta)
				Thisform.txtDataScadenta.Refresh()
		
				If This.nnrinregvizibile < Recno('crsfactura')
					lnRecNo = Recno() - This.nnrinregvizibile
					Go lnRecNo
				Else
					Go Top
				Endif
		
				restore_grid_tag(Thisform.grd_factura)
		
				Thisform.do_calculeaza_totaluri()
			Endif
		Endif
		Thisform.grd_contracte.SetFocus()
		*!*		Thisform.txtDenRata.SetFocus()
		Release poArticol
		
	ENDPROC

	PROCEDURE do_adauga_tot
		If Used('crsarticole') And Reccount('crsarticole')>0
				Local lnNrInregistrare,lnRaspuns,lcArticol
				Select crsarticole
				Scan
					lnNrInregistrare = Recno()
					lnRaspuns = 7
					lcArticol = Alltrim(denumire)
					Do While lnRaspuns = 7
						If cantitate > 0
							Thisform.do_adauga_articol(.T.)
						Endif
						Select crsarticole
						Go lnNrInregistrare
						If cantitate = 0
							lnRaspuns = 6
						Else
							lnRaspuns = aMessageBox("Nu ati selectat toata cantitatea pentru articolul "+Alltrim(lcArticol)+". Doriti sa treceti la urmatorul?",4+32,"Confirmare cantitate")
						Endif
					Enddo
					Select crsarticole
					Go lnNrInregistrare
				Endscan
		Else
			amessagebox("Nu exista articole de adaugat!",48,"Atentie")
		Endif
	ENDPROC

	PROCEDURE do_alege_stoc
		Lparameters tnIdArticol,tnCantitate,tcNumeArticol,tlImplicit,tnPret,tnDiscount,toGrid, tlRetur
		*	llImplicit	=>	vezi thisform.do_adauga
		*	tnPret		=>	doar pentru retururi : e pretul de vanzare fara TVA
		*	toGrid		=>	gridul din care vine articolul
		*	tlRetur		=>	factura normala cu articol retur (nu factura de retur tip 8,9). se comporta la fel ca factura de retur. se selecteaza din RUL, dar nu stiu factura din care fac retur
		
		Private pnIdArticol
		Local llReturn,lofrmadarticol,lcSql, llFacturareFaraStoc
		llFactuareFaraStoc = .F.
		llReturn = .T.
		
		pnIdArticol = tnIdArticol
		
		If Inlist(poDate.tip,23,41) && 23 transfer catre subunitati din lista, 41 aviz retur transfer catre subunitati din lista
			lcIdGestiune = Alltrim(Str(poDate.id_client))
		Else
			If Isnull(poDate.id_gestiune_init)
				lcIdGestiune = [NULL]
			Else
				lcIdGestiune = Alltrim(Str(poDate.id_gestiune_init))
			Endif
		Endif
		
		*!*	llFacturareFaraStoc = (m.tnCantitate = 999999999 And Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1)
		llFacturareFaraStoc = (m.tnCantitate = 0 And Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1)
		
		If Inlist(poDate.tip,8,9) Or m.tlRetur && factura retur lei, factura retur valuta sau factura normala cu retur de articole
			lcSql = [{call pack_facturare.cursor_gestiuni_articol_retur(] + Alltrim(Str(pnIdArticol)) + [,] + ;
				Alltrim(Str(poDate.tip)) + [,] + lcIdGestiune + [,] + ;
				Alltrim(Str(tnPret,20,gnPPretV)) + [,] + Alltrim(Str(tnDiscount,20,gnPPretV)) + [,] + ;
				Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(gnAn)) + [,] + ;
				Alltrim(Str(gnIdUtil)) + [,'] + Alltrim(poDate.listaid) + [',] + ;
				Iif(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [)}]
		Else
			If !m.llFacturareFaraStoc
				lcSql = [{call pack_facturare.cursor_gestiuni_articol(] + Alltrim(Str(pnIdArticol)) + [,] + ;
					Alltrim(Str(poDate.tip)) + [,] + lcIdGestiune + [,] + ;
					Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnIdUtil)) + [,] + ;
					IIF(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [)}]
			Else
		* Selectie articol fara stoc (din stoc anul curent si precedent)
				lcSql = [{call pack_facturare.cursor_gestiuni_articol_stoc0(] + Alltrim(Str(pnIdArticol)) + [,] + ;
					Alltrim(Str(poDate.tip)) + [,] + lcIdGestiune + [,] + ;
					Alltrim(Str(gnLuna)) + [,] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnIdUtil)) + [,] + ;
					IIF(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [)}]
			Endif
		Endif
		
		lcCursor = [crsgestarticol]
		lcCursorTemp = [crsgestarticoltemp]
		lnSucces = goExecutor.oExecute(lcSql,lcCursorTemp)
		Do Case
			Case lnSucces < 0
				amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
				toGrid.SetFocus()
				llReturn = .F.
			Case Reccount(lcCursorTemp) = 0
				amessagebox("Articolul "+Alltrim(tcNumeArticol)+" nu este pe stoc!",0+48,"Atentie")
				toGrid.SetFocus()
				llReturn = .F.
			Otherwise
		
				If m.llFacturareFaraStoc
					Update (m.lcCursorTemp) Set datain = Date(Year(Date())+1,1,1) Where Empty(Nvl(datain,{}))
				Endif
		
				copiaza_structura_cursor(lcCursorTemp,lcCursor)
		
				Insert Into (lcCursor) (ales,id_gestiune,cantitate,Cont,serie,Pret,nume_gestiune,datain,pretv,pretvctva,part_rez,id_part_rez,nrord_rez,id_lucrare_rez,pretd,id_valuta,nume_val);
					Select a.ales,a.id_gestiune,a.cantitate - Iif(Inlist(poDate.tip,8,9),(-1),1) * Nvl(b.cantitate,0) As cantitate,a.Cont,a.serie,a.Pret,a.nume_gestiune,;
					a.datain,a.pretv,a.pretvctva,a.part_rez,a.id_part_rez,a.nrord_rez,a.id_lucrare_rez,a.pretd,a.id_valuta,a.nume_val ;
					from (lcCursorTemp) a Left Join ;
					(Select Iif(poDate.tip=41,-1,1)*Sum(cantitate) As cantitate,id_articol,id_gestiune,pret_achizitie,serie,Cont, ;
					id_part_rez,id_lucrare_rez,pretv_orig,pretd,id_valuta_d ;
					FROM crsfactura Where id_articol = pnIdArticol ;
					GROUP By id_articol,id_gestiune,pret_achizitie,serie,Cont,id_part_rez,id_lucrare_rez,pretv_orig,pretd,id_valuta_d) b ;
					ON a.id_gestiune = b.id_gestiune And a.Pret = b.pret_achizitie And a.Cont = b.Cont ;
					And Nvl(a.serie,'') = Nvl(b.serie,'') ;
					And Nvl(a.id_part_rez,0) = Nvl(b.id_part_rez,0) And Nvl(a.id_lucrare_rez,0) = Nvl(b.id_lucrare_rez,0) ;
					And a.pretv = b.pretv_orig And a.pretd = b.pretd And Nvl(a.id_valuta,0) = Nvl(b.id_valuta_d,0) ;	&&	modificare v 2.0.84 : am pus 0 in loc de -99 la id_valuta_d
				Where a.cantitate - Iif(Inlist(poDate.tip,8,9),(-1),1) * Nvl(b.cantitate,0) > 0 ;
					Order By a.datain, a.nume_gestiune,a.serie,a.Pret,a.pretd,a.id_valuta,;
					a.pretv,a.Cont,a.part_rez,a.nrord_rez
		
				Go Top
				Do Case
					Case Reccount(lcCursor) = 0
						amessagebox("Articolul "+Alltrim(tcNumeArticol)+" nu mai este pe stoc!",0+48,"Atentie")
						toGrid.SetFocus()
						llReturn = .F.
		*!*	modificare v 2.0.44
					Case Reccount(lcCursor) = 1 And tlImplicit
						Local lnNrOptiuniTva
						lnNrOptiuniTva = 0
						Select jtva_coloane
						Calculate Cnt() For (cota_tva + 100)/100 = Nvl(poArticol.proc_tvav,-1) To lnNrOptiuniTva
						Select (lcCursor)	&&	modificare	v 2.2.18	: l-am scos din "if" pentru ca aveam nevoie de el si pe "else"
						If lnNrOptiuniTva = 1
		*!*				Locate For (cota_tva + 100)/100 = poArticol.proc_tvav
		*!*				poArticol.proc_tvav = (cota_tva + 100)/100
		*!*				poArticol.id_jtva_coloana = id_jtva_coloana
		*!*				Select (lcCursor)		&&	modificare	v 2.2.18	:	l-am mutat inaintea "if"-ului
							poArticol.pret_achizitie = Pret
							poArticol.serie = Nvl(serie,[])
							poArticol.id_gestiune = id_gestiune
							poArticol.Cont = Alltrim(Cont)
							poArticol.id_lucrare_rez = id_lucrare_rez
							poArticol.id_part_rez = id_part_rez
							poArticol.pretv_orig = pretv
		*!*	modificare  v 2.0.56
							poArticol.pretd = pretd
							poArticol.id_valuta_d = id_valuta
		*!*	modificare  v 2.0.56	^
							lofrmadarticol=Createobject("frm_articol_gest_factura",tnCantitate,tlImplicit,tlRetur)
							If !lofrmadarticol.inainte_de_do_termin()
								lofrmadarticol.Show(1)
							Else
								lofrmadarticol.Release()
								gnButon = 1
							Endif
						Else
							lofrmadarticol=Createobject("frm_articol_gest_factura",tnCantitate, .F., tlRetur)
							lofrmadarticol.Show(1)
		*!*	modificare	v 2.0.46
							If gnButon = 1
								Select * From (lcCursor) Where ales = 1 Into Cursor crsartselectate
								If Reccount('crsartselectate') = 0
									Use In crsartselectate
								Endif
							Endif
		*!*	modificare	v 2.0.46	^
						Endif
						Release lofrmadarticol
		*!*	modificare v 2.0.44	^
					Otherwise
						lofrmadarticol=Createobject("frm_articol_gest_factura",tnCantitate, .F., tlRetur)
						lofrmadarticol.Show(1)
						Release lofrmadarticol
		*!*	modificare	v 2.0.46
						If gnButon = 1
							Select * From (lcCursor) Where ales = 1 Into Cursor crsartselectate
							If Reccount('crsartselectate') = 0
								Use In crsartselectate
							Endif
						Endif
		*!*	modificare	v 2.0.46	^
				Endcase
		Endcase
		If Used(lcCursor)
			Use In (lcCursor)
		Endif
		If Used(lcCursorTemp)
			Use In (lcCursorTemp)
		Endif
		
		*!*	* Construiesc o lista de articole la care nu am gasit stoc, ca sa le tratez special la finalizarea facturii!!! this.scrie_articole
		*!*	IF m.llReturn
		*!*		If m.llFacturareFaraStoc
		*!*			this.cListaArticoleFaraStoc = this.cListaArticoleFaraStoc + ALLTRIM(STR(tnIdArticol)) + [,]
		*!*		ENDIF
		*!*	ENDIF
		Return llReturn
		
	ENDPROC

	PROCEDURE do_calculeaza_discount
		Lparameters tnProcent
		If tnProcent = 0
			Thisform.ndiscfactron = 0
			Thisform.ndiscfactval = 0
		Else
			If poDate.in_valuta = 1
				Thisform.ndiscfactval = Round(Thisform.nbazafdiscountval * tnProcent / 100,gnPVal)
				Thisform.ndiscfactron = Round(Thisform.ndiscfactval*poDate.Curs/poDate.multiplicator,gnPc)
			Else
				Thisform.ndiscfactron = Round(Thisform.nbazafdiscount * tnProcent / 100,gnPc)
			Endif
		Endif
		*!*	Thisform.clb_discount.Refresh()
		Thisform.do_calculeaza_totaluri()
		
	ENDPROC

	PROCEDURE do_calculeaza_totaluri
		Lparameters tlModificareDiscount
		Local lnTotal,lnTva,lnBaza,lnDisc
		lnTotal = 0
		lnTva = 0
		lnBaza = 0
		lnDisc = 0
		If poDate.in_valuta = 0
		*!*	modificare	v 2.0.46
		*!*		Select Sum(valdiminuatctva) As Total,Sum(valdiminuatftva) As Baza,;
		*!*			Sum(valdiminuattva) As Tva,;
		*!*			Sum(valdiscountftva) As discount From crsfactura Into Cursor crstotalurifact
		*!*		Select crstotalurifact
		*!*		Thisform.nbazafdiscount = Nvl(Baza,0)
		*!*		lnTotal = Nvl(Total,0)
		*!*		Thisform.nbazaron = Nvl(Baza,0) - Round(Thisform.ndiscfactron, gnPc)
		*!*		Thisform.ndiscron = Nvl(discount,0)
		*!*		Thisform.ntvaron = Nvl(Tva,0) - Round(Thisform.ndiscfactron * (Thisform.nproc_tvav - 1), gnPc)
		*!*		Thisform.ntotalron = lnTotal - Round(Thisform.ndiscfactron * Thisform.nproc_tvav, gnPc)
			If Used('crsfacturaset')
				Select Sum(Nvl(valdiminuatctva,0)) As Total,Sum(Nvl(valdiminuatftva,0)) As Baza,;
					Sum(Nvl(valdiminuattva,0)) As Tva,;
					Sum(Nvl(valdiscountftva,0)) As discount From crsfacturaset ;
					union All ;
					select Nvl(Sum(valdiminuatctva),0) As Total,Nvl(Sum(valdiminuatftva),0) As Baza,;
					Nvl(Sum(valdiminuattva),0) As Tva,;
					Nvl(Sum(valdiscountftva),0) As discount From crsfactura Where Nvl(id_set_fact,0) = 0 ;
					into Cursor crstotalurifact
			Else
				Select Sum(Nvl(valdiminuatctva,0)) As Total,Sum(Nvl(valdiminuatftva,0)) As Baza,;
					Sum(Nvl(valdiminuattva,0)) As Tva,;
					Sum(Nvl(valdiscountftva,0)) As discount From crsfactura Into Cursor crstotalurifact
			Endif
		
			Select crstotalurifact
			Scan
				lnTotal = lnTotal + Nvl(Total,0)
				lnTva = lnTva + Nvl(Tva,0)
				lnBaza = lnBaza + Nvl(Baza,0)
				lnDisc = lnDisc + Nvl(discount,0)
			Endscan
			Thisform.nbazafdiscount = Nvl(lnBaza,0)
			Thisform.nbazaron = Nvl(lnBaza,0) - Round(Thisform.ndiscfactron, gnPc)
			Thisform.ndiscron = Nvl(lnDisc,0)
			Thisform.ntvaron = Nvl(lnTva,0) - Round(Thisform.ndiscfactron * (Thisform.nproc_tvav - 1), gnPc)
			Thisform.ntotalron = lnTotal - Round(Thisform.ndiscfactron * Thisform.nproc_tvav, gnPc)
		*!*	modificare	v 2.0.46	^
			If !Empty(Thisform.ndiscfactron)
				Thisform.clb_discount.procent.Value = Round(Thisform.ndiscfactron * 100 / Thisform.nbazafdiscount,2)
			Else
				Thisform.clb_discount.procent.Value = 0
			Endif
		Else
		*!*	modificare	v 2.0.46
		*!*		Select Sum(vvaldiminuatctva) As Total,Sum(vvaldiminuatftva) As Baza,;
		*!*			Sum(vvaldiminuattva) As Tva,;
		*!*			Sum(vvaldiscountftva) As discount From crsfactura Into Cursor crstotalurifact
		*!*		Select crstotalurifact
		*!*		Thisform.nbazafdiscountval = Nvl(Baza,0)
		*!*		lnTotal = Nvl(Total,0)
		*!*		Thisform.nbazaval = Nvl(Baza,0) - Round(Thisform.ndiscfactval, gnPc)
		*!*		Thisform.ndiscval = Nvl(discount,0)
		*!*		Thisform.ntvaval = Nvl(Tva,0) - Round(Thisform.ndiscfactval * (Thisform.nproc_tvav - 1), gnPc)
		*!*		Thisform.ntotalval = lnTotal - Round(Thisform.ndiscfactval * Thisform.nproc_tvav, gnPc)
			If Used('crsfacturaset')
				Select Sum(Nvl(vvaldiminuatctva,0)) As Total,Sum(Nvl(vvaldiminuatftva,0)) As Baza,;
					Sum(Nvl(vvaldiminuattva,0)) As Tva,;
					Sum(Nvl(vvaldiscountftva,0)) As discount From crsfacturaset ;
					union All ;
					select Nvl(Sum(vvaldiminuatctva),0) As Total,Nvl(Sum(vvaldiminuatftva),0) As Baza,;
					Nvl(Sum(vvaldiminuattva),0) As Tva,;
					Nvl(Sum(vvaldiscountftva),0) As discount From crsfactura Where Nvl(id_set_fact,0) = 0 ;
					into Cursor crstotalurifact
			Else
				Select Sum(Nvl(vvaldiminuatctva,0)) As Total,Sum(Nvl(vvaldiminuatftva,0)) As Baza,;
					Sum(Nvl(vvaldiminuattva,0)) As Tva,;
					Sum(Nvl(vvaldiscountftva,0)) As discount From crsfactura Into Cursor crstotalurifact
			Endif
			Select crstotalurifact
			Scan
				lnTotal = lnTotal + Nvl(Total,0)
				lnTva = lnTva + Nvl(Tva,0)
				lnBaza = lnBaza + Nvl(Baza,0)
				lnDisc = lnDisc + Nvl(discount,0)
			Endscan
			Thisform.nbazafdiscountval = Nvl(lnBaza,0)
			Thisform.nbazaval = Nvl(lnBaza,0) - Round(Thisform.ndiscfactval, gnPVal)
			Thisform.ndiscval = Nvl(lnDisc,0)
			Thisform.ntvaval = Nvl(lnTva,0) - Round(Thisform.ndiscfactval * (Thisform.nproc_tvav - 1), gnPVal)
			Thisform.ntotalval = lnTotal - Round(Thisform.ndiscfactval * Thisform.nproc_tvav, gnPVal)
		*!*	modificare	v 2.0.46	^
			Thisform.nbazaron = Round(Thisform.nbazaval*poDate.Curs/poDate.multiplicator,gnPc)
			Thisform.ndiscron = Round(Thisform.ndiscval*poDate.Curs/poDate.multiplicator,gnPc)
			Thisform.ntvaron = Round(Thisform.ntvaval*poDate.Curs/poDate.multiplicator,gnPc)
			Thisform.ntotalron = Round(Thisform.ntotalval*poDate.Curs/poDate.multiplicator,gnPc)
			Thisform.nbazafdiscount = Round(Thisform.nbazafdiscountval*poDate.Curs/poDate.multiplicator,gnPc)
		
			If !Empty(Thisform.ndiscfactval)
				Thisform.ndiscfactron = Round(Thisform.ndiscfactval * poDate.Curs/poDate.multiplicator,gnPc)
				Thisform.clb_discount.procent.Value = Round(Thisform.ndiscfactval * 100 / Thisform.nbazafdiscountval,2)
			Else
				Thisform.clb_discount.procent.Value = 0
			Endif
		
		Endif
		
		If tlModificareDiscount
			Thisform.clb_discount.procent.Refresh()
		Else
			Thisform.clb_discount.Refresh()
		Endif
		Thisform.clb_discount_articole.Refresh()
		Thisform.clb_total_baza.Refresh()
		Thisform.clb_total_tva.Refresh()
		Thisform.clb_total_factura.Refresh()
		
		If Used('crstotalurifact')
			Use In crstotalurifact
		Endif
		
	ENDPROC

	PROCEDURE do_creeaza_filtru
		Lparameters toCriteriu,tcNumeCamp,tcValoare
		Local lnCriteriu,lcFiltru
		lnCriteriu = toCriteriu.Value
		Do Case
		Case lnCriteriu = 1 and !Empty(tcValoare)
			lcFiltru = "LIKE('" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu = 2 and !Empty(tcValoare)
			lcFiltru = "UPPER(Nvl("+Alltrim(tcNumeCamp)+",''))='" + Upper(Strtran(tcValoare,['],[''])) + "'"
		Case lnCriteriu = 3 and !Empty(tcValoare)
			lcFiltru = "UPPER(Nvl("+Alltrim(tcNumeCamp)+",''))<>'" + Upper(Strtran(tcValoare,['],[''])) + "'"
		Case lnCriteriu = 4 and !Empty(tcValoare)
			lcFiltru = "LIKE('*" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu = 5 and !Empty(tcValoare)
			lcFiltru = "!LIKE('*" + Upper(Strtran(tcValoare,['],[''])) + "*',UPPER(Nvl("+Alltrim(tcNumeCamp)+",'')))"
		Case lnCriteriu=6
			lcFiltru = "EMPTY(Nvl("+Alltrim(tcNumeCamp)+",''))"
		Case lnCriteriu=7
			lcFiltru = "!EMPTY(Nvl("+Alltrim(tcNumeCamp)+",''))"
		Endcase
		Return lcFiltru
	ENDPROC

	PROCEDURE do_initializeaza_articol
		Lparameters toArticol
		toArticol.um = Nvl(toArticol.um,'')
		If Type('toArticol.id_gestiune') = "U"
			AddProperty(toArticol,'id_gestiune',-1000)
		Endif
		If Type('toArticol.cont') = "U"
			AddProperty(toArticol,'cont',[XXXX])
		Endif
		AddProperty(toArticol,'id_temp',0)
		
		If toArticol.preturi_cu_tva = 0
			toArticol.discount_unitar = Nvl(toArticol.discount_unitar,0)
			toArticol.discount_unitar_val = Nvl(toArticol.discount_unitar_val,0)
		*!*	modificare	v 2.0.56
		*!*		AddProperty(toArticol,'discount_unitar_ctva',0)
		*!*		AddProperty(toArticol,'discount_unitar_ctva_val',0)
			AddProperty(toArticol,'discount_unitar_ctva',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.discount_unitar*(toArticol.proc_tvav-1),gnPPretV)+toArticol.discount_unitar))
			AddProperty(toArticol,'discount_unitar_ctva_val',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.discount_unitar_val*(toArticol.proc_tvav-1),gnPVal)+toArticol.discount_unitar_val))
		*!*	modificare	v 2.0.56	^
			AddProperty(toArticol,'pretftva',toArticol.Pret)
			AddProperty(toArticol,'tva',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.Pret * (toArticol.proc_tvav - 1),gnPPretV)))
			AddProperty(toArticol,'pretctva',toArticol.Pret + toArticol.tva)
			AddProperty(toArticol,'pretftva_val',toArticol.pret_val)
			AddProperty(toArticol,'tva_val',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.pret_val * (toArticol.proc_tvav - 1),gnPVal)))
			AddProperty(toArticol,'pretctva_val',toArticol.pret_val + toArticol.tva_val)
		Else
			AddProperty(toArticol,'discount_unitar_ctva',Iif(Isnull(toArticol.proc_tvav),0,Nvl(toArticol.discount_unitar,0)))
			AddProperty(toArticol,'discount_unitar_ctva_val',Iif(Isnull(toArticol.proc_tvav),0,Nvl(toArticol.discount_unitar_val,0)))
		*!*	modificare	v 2.0.56
		*!*		toArticol.discount_unitar = 0
		*!*		toArticol.discount_unitar_val = 0
			toArticol.discount_unitar = Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.discount_unitar/ toArticol.proc_tvav,gnPPretV))
			toArticol.discount_unitar_val = Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.discount_unitar_val/ toArticol.proc_tvav,gnPVal))
		*!*	modificare	v 2.0.56	^
			AddProperty(toArticol,'pretctva',toArticol.Pret)
			AddProperty(toArticol,'pretftva',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.Pret / toArticol.proc_tvav,gnPPretV)))
			AddProperty(toArticol,'tva',toArticol.Pret-toArticol.pretftva)
			AddProperty(toArticol,'pretctva_val',toArticol.pret_val)
			AddProperty(toArticol,'pretftva_val',Iif(Isnull(toArticol.proc_tvav),0,Round(toArticol.pret_val/toArticol.proc_tvav,gnPVal)))
			AddProperty(toArticol,'tva_val',toArticol.pretctva_val-toArticol.pretftva_val)
		Endif
		AddProperty(toArticol,'valftva',0)
		AddProperty(toArticol,'valtva',0)
		AddProperty(toArticol,'valctva',0)
		AddProperty(toArticol,'valdiscountftva',0)
		AddProperty(toArticol,'valdiscounttva',0)
		AddProperty(toArticol,'valdiscountctva',0)
		AddProperty(toArticol,'valdiminuatftva',0)
		AddProperty(toArticol,'valdiminuattva',0)
		AddProperty(toArticol,'valdiminuatctva',0)
		AddProperty(toArticol,'vvalftva',0)
		AddProperty(toArticol,'vvaltva',0)
		AddProperty(toArticol,'vvalctva',0)
		AddProperty(toArticol,'vvaldiscountftva',0)
		AddProperty(toArticol,'vvaldiscounttva',0)
		AddProperty(toArticol,'vvaldiscountctva',0)
		AddProperty(toArticol,'vvaldiminuatftva',0)
		AddProperty(toArticol,'vvaldiminuattva',0)
		AddProperty(toArticol,'vvaldiminuatctva',0)
		*!*	modificare	v 2.0.46
		*!*	AddProperty(toArticol,'id_jtva_coloana',0)
		*!*	AddProperty(toArticol,'explicatie','')
		If Type('toArticol.id_jtva_coloana') = 'U'
			AddProperty(toArticol,'id_jtva_coloana',0)
		Endif
		*!*	modificare v 2.0.67
		*!*	AddProperty(toArticol,'explicatie',Iif(poDate.tip=7,[INVOICE ] + poDate.descriere,''))
		If Type('toArticol.explicatie') = 'U'
			AddProperty(toArticol,'explicatie',Iif(poDate.tip=7,[INVOICE ] + poDate.descriere,''))
		Endif
		If Type('toArticol.serie') = 'U'
			AddProperty(toArticol,'serie','')
		Else
			toArticol.serie = Nvl(toArticol.serie,[])
		Endif
		If Type('toArticol.opt_facturare') = 'U'
			AddProperty(toArticol,'opt_facturare',0)
		Endif
		If Type('toArticol.id_ctr') = 'U'
			AddProperty(toArticol,'id_ctr',Null)
		Endif
		If Type('toArticol.numar_contract') = 'U'
			AddProperty(toArticol,'numar_contract',Null)
		Endif
		*!*	modificare v 2.0.67	^
		AddProperty(toArticol,'codmatf','')
		*!*	modificare	v 2.0.46	^
		If Type('toArticol.pret_achizitie')="U"
			AddProperty(toArticol,'pret_achizitie',0)
		Else
			If Isnull(toArticol.pret_achizitie)
				toArticol.pret_achizitie = 0
			Endif
		Endif
		*!*	modificare v 2.0.19
		AddProperty(toArticol,'id_lucrare_rez',0)
		AddProperty(toArticol,'id_part_rez',0)
		AddProperty(toArticol,'pretv_orig',0)
		*!*	modificare v 2.0.19	^
		*!*	modificare	v 2.0.56
		If Inlist(poDate.tip,8,9) && retur lei, retur valuta
			toArticol.cantitate = (-1) * toArticol.cantitate
		Endif
		If Type('toArticol.pretd') = 'U'
			AddProperty(toArticol,'pretd',0.0000)
		Endif
		If Type('toArticol.id_valuta_d') = 'U'
			AddProperty(toArticol,'id_valuta_d',Null)
		Endif
		*!*	modificare	v 2.0.56	^
		*!*	modificare	v 2.0.67
		*!*	modificare	v 2.0.90 : am adaugat 7
		If Inlist(poDate.tip,1,2,5,6,22,23,29,41,7,10) AND !INLIST(toArticol.opt_facturare,1,2)
			toArticol.cantitate = 0
		Endif
		*!*	modificare	v 2.0.67	^
	ENDPROC

	PROCEDURE do_renunt
		*!*	modificare	19.01.2007
		DODEFAULT()
		*!*	If This.inainte_de_do_renunt()
		*!*		gnButon = 2
		*!*		pnButon = 2
		*!*		Buton = 2
		*!*		pnIesire = 2
		*!*		If !This.lhide
		*!*			This.Release
		*!*		Else
		*!*			This.Hide
		*!*		Endif
		*!*		Sqlrollback(gnHandle)
		*!*		SQLSetprop(gnHandle,"Transactions",1) && tranzactie automata
		*!*	Endif
		*!*	modificare	19.01.2007	^
	ENDPROC

	PROCEDURE do_reset
		*!*	modificare v 2.0.56
		Local lcCriteriuCod
		Local lcCriteriuDenumire
		lcCriteriuCod = goExport.citesteSetareRegistru("CRITCOD")
		If !Empty(lcCriteriuCod) And Type('VAL(lcCriteriuCod)') = 'N'
			Thisform.ncritcod = Val(lcCriteriuCod)
		Endif
		Thisform.ct_codmat.Value = Thisform.ncritcod
		*!*	modificare	v 2.0.56	^
		
		lcCriteriuDenumire = goExport.citesteSetareRegistru("CRITDENUMIRE")
		If !Empty(lcCriteriuDenumire) And Type('VAL(lcCriteriuDenumire)') = 'N'
			Thisform.ncritDenumire = Val(lcCriteriuDenumire)
		Endif
		Thisform.ct_articole.Value = Thisform.ncritDenumire
		
		Thisform.txtCodmat.Value = []
		*Thisform.ct_articole.Value = 1
		Thisform.txtArticole.Value = []
		*!*	modificare	v 2.0.56
		Thisform.do_cauta()
		Thisform.Refresh()
		Thisform.txtCodmat.SetFocus()
		*!*	modificare v 2.0.56	^
		
	ENDPROC

	PROCEDURE do_retur
		Thisform.do_adauga_articol(.F., .F., .T.)
	ENDPROC

	PROCEDURE do_scrie_articole
		Local llReturn,lcSql,lnSucces
		llReturn = .T.
		*!*	pentru lnNrInregistrari > 1 trebuie am mai multe variabile : poArt1,poArt2,poArt3 ca sa pot concatena lcSql
		*!*	lnNrInregistrari = 1	&&	trimite sirul catre server o data pentru lnNrInregistrari
		*!*	lnNrInregCurenta = 0
		
		If Thisform.do_deschide_tranzactie()
		
			* Factura de vanzare pe care am adaugat articole retur
			IF !EMPTY(thisform.cListaIdArticoleRetur)
				poDate.listaid = thisform.cListaIdArticoleRetur
			ENDIF 
			
			lcSql = [pack_facturare.initializeaza_date_factura(] + ;
				[to_date('] + ALLTRIM(NVL(Dtoc(poDate.dataireg,2),[])) + [','YYYYMMDD'),] + ;
				Nvl(Alltrim(Str(poDate.id_fdoc)),[NULL]) + [,to_date('] + ALLTRIM(NVL(Dtoc(poDate.dataact,2),[])) + [','YYYYMMDD'),] + ;
				[to_date('] + ALLTRIM(NVL(Dtoc(poDate.datascad,2),[])) + [','YYYYMMDD'),'] + ALLTRIM(Nvl(poDate.serie_act,[])) + [',] + ;
				Alltrim(Str(poDate.nract,14,0)) + [,] + ;
				Iif(Isnull(poDate.id_client),[NULL],Alltrim(Str(poDate.id_client))) + [,] + ;
				Iif(Isnull(poDate.id_lucrare),[NULL],Alltrim(Str(poDate.id_lucrare))) + [,] + ;
				Iif(Isnull(poDate.id_sectie),[NULL],Alltrim(Str(poDate.id_sectie))) + [,] + ;
				Iif(Isnull(poDate.id_venchelt),[NULL],Alltrim(Str(poDate.id_venchelt))) + [,] + ;		&&	modificare	v 2.0.46
				iif(Isnull(poDate.id_responsabil),[NULL],Alltrim(Str(poDate.id_responsabil))) + [,] + ;
				IIF(EMPTY(nvl(poDate.explicatia4,[])),[NULL],['] + OracleSpecialCharacters(ALLTRIM(poDate.explicatia4))+[']) + [,] + ;		&&	modificare	ROACONTRACTE v 2.0.42
				[NULL,] + Iif(Isnull(poDate.listaid),[NULL],['] + Alltrim(Iif(Type('poDate.listaid')='C',poDate.listaid,Str(poDate.listaid))) + [']) + [,] + ;
				['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.descriere,[]))) + [',] + ;
				Alltrim(Str(poDate.Tip)) + [,] + Alltrim(Str(poDate.id_set)) + [,] + ;
				[to_date('] + ALLTRIM(NVL(Dtoc(poDate.zi_curs,2),[])) + [','YYYYMMDD'),] + Alltrim(Str(poDate.id_valuta)) + [,] + ;
				Alltrim(Str(poDate.in_valuta)) + [,] + ;
				alltrim(str(poDate.tva_incasare)) + [,] + ;
				Iif(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [,] + ;
				Alltrim(Str(gnIdUtil)) + [);]
		
			If Inlist(poDate.Tip,23,25,30,41)				&&	transfer intre subunitati pe baza de lista de preturi/comanda
				lcSql = lcSql + [ pack_facturare.initializeaza_date_gestiune(] + Alltrim(Str(poDateGestiuneDest.id_gestiune)) + [,] + ;
					Alltrim(Str(poDateGestiuneDest.id_tipgest)) + [,'] + Alltrim(poDateGestiuneDest.Cont) +[',] + ;
					['] + Alltrim(Nvl(poDateGestiuneDest.acont,[])) + [');]
			Endif
		
			If Inlist(poDate.Tip,23,25)
				If poDateGestiuneDest.Cont = '357'
					loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Partener rezervare??cCont=>357??lAdaugCorespondente=>1]))
					If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
						poDate.id_part_rez = loCauta.id_part
						lcSql = lcSql + [ pack_facturare.initializeaza_part_rez(] + Alltrim(Str(loCauta.id_part)) + [);]
						*!*	modificare	v 2.1.0
						loCauta = caut_contract_activ(-1,poDate.id_part_rez)
						If gnButon = 1
							poDate.text_aditional = [Conform contract nr.] + Alltrim(loCauta.numar) + [ din data de ] + ;
								PADL(Alltrim(Str(Day(loCauta.Data))),2,[0]) + [.] + ;
								PADL(Alltrim(Str(Month(loCauta.Data))),2,[0]) + [.] + ;
								ALLTRIM(Str(Year(loCauta.Data))) + ;
								IIF(!Empty(poDate.text_aditional),Chr(13) + Chr(10) + poDate.text_aditional,[])
						Endif
						*!*	modificare	v 2.1.0	^
					ENDIF
				Endif
			Endif
		*!*	modificare v 2.0.19	^
			lcSql = [begin ] + lcSql + [ end;]
		
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces<0
				amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				llReturn = .F.
			Else
				Private poArt
				lcSql = []
				Select crsfactura
				Scan
		*!*				lnNrInregCurenta = lnNrInregCurenta + 1
					Scatter Name poArt MEMO
		*!*	modificare v 2.0.67
					If Inlist(poArt.opt_facturare,1,2)
						lcSql = lcSql + gcS + [.pack_facturare.adauga_rata_factura(] + Alltrim(Str(poArt.id_rata)) + [,] + ;
							IIF(poArt.cu_tva = 0,;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.pretftva,18,gnPPretV)),Alltrim(Str(poArt.vpretftva,18,gnPVal))),;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.pretctva,18,gnPPretV)),Alltrim(Str(poArt.vpretctva,18,gnPVal)))) + [,] + ;
							Alltrim(Str(poArt.Curs,18,4)) + [,] + ALLTRIM(STR(poArt.multiplicator,10)) + [,] + ;
							Alltrim(Str(poArt.id_jtva_coloana)) + [,] + ;
							['] + OracleSpecialCharacters(Alltrim(poArt.denumire)) + [',] + ;
							alltrim(Str(gnIdUtil)) + [);]
					Else
		*!*	modificare v 2.0.67	^
		*!* v 2.0.13
		*!*				lcSql = lcSql + gcS + [.pack_facturare.adauga_articol_factura(?poArt.id_temp,?poArt.id_articol,TRIM(NVL(?poArt.serie,'')),] + ;
		*!*					[TRIM(NVL(?poArt.explicatie,'')),?poArt.id_pol,?poArt.id_gestiune,?poArt.pret_achizitie,] + ;
		*!*					IIF(poArt.cu_tva=0,;
		*!*					IIF(poArt.tip_valuta = 0,[?poArt.pretftva],[?poArt.vpretftva]),;
		*!*					IIF(poArt.tip_valuta = 0,[?poArt.pretctva],[?poArt.vpretctva])) + [,] + ;
		*!*					[?poArt.id_valuta,?poArt.cu_tva,?poArt.gestionabil,?poArt.cantitate,] + ;
		*!*					IIF(poArt.cu_tva = 0,;
		*!*					Iif(poArt.tip_valuta = 0,[?poArt.discountftva],[?poArt.vdiscountftva]), ;
		*!*					IIF(poArt.tip_valuta = 0,[?poArt.discountctva],[?poArt.vdiscountctva])) + [,] + ;
		*!*					[TRIM(NVL(?poArt.Cont,'')),?poArt.Curs,?poArt.id_jtva_coloana,?poArt.id_set_fact,?gnIdUtil);]
		*!*	*!*				If lnNrInregCurenta = lnNrInregistrari
		*!*	modificare v 2.0.56 : am adaugat pretd, id_valutad
		*!*	modificare v 2.0.67 : am adaugat id_ctr
		*!*	modificare v 2.2.14 : am pus gnPPretval in loc de gnPVal la poArt.pretd
										
						lcSql = lcSql + [pack_facturare.adauga_articol_factura(] + Alltrim(Str(poArt.id_temp)) + [,] + ;
							Alltrim(Str(poArt.id_articol)) + [,] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArt.serie,[]))) + [',] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArt.explicatie,''))) + [',] + Nvl(Alltrim(Str(poArt.id_pol)),[NULL]) + [,] + ;
							Nvl(Alltrim(Str(poArt.id_gestiune)),[NULL]) + [,] + Alltrim(Str(poArt.pret_achizitie,18,gnPPret)) + [,] + ;
							Alltrim(Str(poArt.pretd,18,gnPPretval)) + [,] + ;
							Iif(Isnull(poArt.id_valuta_d),[NULL],Alltrim(Str(poArt.id_valuta_d))) + [,] + ;
							IIF(poArt.cu_tva=0,;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.pretftva,18,gnPPretV)),Alltrim(Str(poArt.vpretftva,18,gnPVal))),;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.pretctva,18,gnPPretV)),Alltrim(Str(poArt.vpretctva,18,gnPVal)))) + [,] + ;
							Alltrim(Str(poArt.id_valuta)) + [,] + Alltrim(Str(poArt.cu_tva)) + [,] + Alltrim(Str(poArt.gestionabil)) + [,] + ;
							Alltrim(Str(poArt.cantitate,18,gnPCant)) + [,] + ;
							IIF(poArt.cu_tva = 0,;
							Iif(poArt.tip_valuta = 0,Alltrim(Str(poArt.discountftva,18,gnPPretV)),Alltrim(Str(poArt.vdiscountftva,18,gnPVal))), ;
							IIF(poArt.tip_valuta = 0,Alltrim(Str(poArt.discountctva,18,gnPPretV)),Alltrim(Str(poArt.vdiscountctva,18,gnPVal)))) + [,] + ;
							['] + Alltrim(Nvl(poArt.Cont,'')) + [',] + Alltrim(Str(poArt.Curs,18,6)) + [,] + ;
							ALLTRIM(STR(poArt.multiplicator,10)) + [,] + Alltrim(Str(poArt.id_jtva_coloana)) + [,] + ;
							Nvl(Alltrim(Str(poArt.id_part_rez)),[NULL]) + [,] + Nvl(Alltrim(Str(poArt.id_lucrare_rez)),[NULL]) + [,] + ;
							Alltrim(Str(poArt.pretv_orig,18,gnPPretV)) + [,] + ;
							Nvl(Alltrim(Str(poArt.id_set_fact)),[NULL]) + [,] + NVL(ALLTRIM(STR(poArt.id_ctr)),[NULL]) + [,] + Alltrim(Str(gnIdUtil)) + [);]
		*!* v 2.0.13 ^
		*!*	modificare v 2.0.67
					Endif
		*!*	modificare v 2.0.67	^
					* Pentru articolele fara stoc, dar pe care le vreau facturate, le descarc ca si la programulde restaurant
		*!*				lcSql = [begin ] + ;
		*!*					IIF(Alltrim(Str(poArt.id_articol)) + [,]$this.cListaArticoleFaraStoc, ' pack_Facturare.ntip := pack_facturare.nTipFacturaRestaurant; ', '') + ;
		*!*					lcSql + ;
		*!*					IIF(Alltrim(Str(poArt.id_articol)) + [,]$this.cListaArticoleFaraStoc, ' pack_Facturare.ntip := ' + ALLTRIM(STR(poDate.Tip)) + '; ', '') + ;
		*!*					[ end;]
						
					lcSql = [begin ] + lcSql + [ end;]
						
					lnSucces = goExecutor.oExecute(lcSql)
					If lnSucces < 0
						amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
						llReturn = .F.
						Exit
					Else
		*!*						lnNrInregCurenta = 0
						lcSql = []
					Endif
		*!*				Endif
				Endscan
		
				If Used('crsfacturaset') And llReturn
					Private poArtSet
		*!*				lnNrInregCurenta = lnNrInregCurenta + 1				&&		1
					lcSql = lcSql + gcS + [.pack_facturare.initializeaza_seturi_temp;]
					Select crsfacturaset
					Scan
						Scatter Name poArtSet MEMO
		*!* v 2.0.13
		*!*					lnNrInregCurenta = lnNrInregCurenta + 1			&&		2
		*!*					lcSql = lcSql + gcS + [.pack_facturare.adauga_articol_set(?poArtSet.id_set_fact,] + ;
		*!*						[TRIM(NVL(?poArtSet.denumire,'')),TRIM(NVL(?poArtSet.explicatie,'')),?poArtSet.um,] + ;
		*!*						[TRIM(NVL(?poArtSet.serie,'')),?poArtSet.cantitate,] + ;
		*!*						IIF(poDate.in_valuta=0,[?poArtSet.pretftva],[?poArtSet.vpretftva]) + [);]
		
		*!*	modificare	v 2.0.56 : am adaugat discount_unitar
						lcSql = lcSql + [pack_facturare.adauga_articol_set(] + Alltrim(Str(poArtSet.id_set_fact)) + [,] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArtSet.denumire,''))) + [',] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArtSet.explicatie,''))) + [',] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArtSet.um,''))) + [',] + ;
							['] + OracleSpecialCharacters(Alltrim(Nvl(poArtSet.serie,''))) + [',] + ;
							Alltrim(Str(poArtSet.cantitate,18,gnPCant)) + [,] + ;
							IIF(poDate.in_valuta=0,Alltrim(Str(poArtSet.pretftva,18,gnPPretV)),Alltrim(Str(poArtSet.vpretftva,18,gnPVal))) + [,] + ;
							IIF(poDate.in_valuta=0,Alltrim(Str(poArtSet.discountftva,18,gnPPretV)),Alltrim(Str(poArtSet.vdiscountftva,18,gnPVal))) + [);]
		*!* v 2.0.13 ^
		
		*!*					If lnNrInregCurenta >= lnNrInregistrari			&&	daca mai raman inregistrari nescrise din crsfactura
		*!*									&& + operatiie 1 si 2 s-ar putea ca lnNrInregCurenta
		*!*									&& sa fie mai mare decat lnNrInregistrari
						lcSql = [begin ] + lcSql + [ end;]
						lnSucces = goExecutor.oExecute(lcSql)
						If lnSucces < 0
							amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
							llReturn = .F.
							Exit
						Else
		*!*							lnNrInregCurenta = 0
							lcSql = []
						Endif
		*!*					Endif
					Endscan
				Endif
		
				If !Empty(lcSql) And llReturn
					lcSql = [begin ] + lcSql + [ end;]
					lnSucces = goExecutor.oExecute(lcSql)
					If lnSucces < 0
						amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
						llReturn = .F.
					Endif
				Endif
			Endif
			If poDate.in_valuta = 1 And llReturn
				Thisform.do_calculeaza_totaluri()
		*!*		modificare 04.02.2008
		*!*			poDate.totctvaconv		=	Thisform.ntotalron
		*!*		modificare 04.02.2008	^
				poDate.totftvaconv		=	Thisform.nbazaron
				poDate.tottvaconv		=	Thisform.ntvaron
				poDate.totctvaconv		=	poDate.totftvaconv + poDate.tottvaconv
				llReturn = recalculeaza_pret_vanzare_lei([crsfactura],poDate.Curs/poDate.multiplicator) 	&& ofacturare_comun.prg
		*!*			If llReturn
		*!*				llReturn = recalculeaza_pret_vanzare_set([crsfacturaset],poDate.Curs) 	&& ofacturare_comun.prg
		*!*			Endif
			Endif
		Else
			llReturn = .F.
		Endif
		If !llReturn
			Thisform.do_inchide_tranzactie(2)
		Endif
		Release poArt,poArtSet
		Return llReturn
	ENDPROC

	PROCEDURE do_scrie_factura
		*!* 05.02.2015
		*!* marius.mutu
		*!*  Pentru poDate.eBonFiscal, hacuiesc Tip = 43 bon fiscal magazin, ca sa apara in vanzari.tip = 43, apoi pun tipul la loc, ca sa nu deranjez alte lucruri
		
		*!* 14.09.2016
		*!* marius.mutu
		*!* scrie_factura_avize - lipseau 2 parametri din apel: v_id_facturare (adresa de facturare), v_listare_detaliata
		
		*!*		emitere avize / facturi
		Private pnDiscount, pnFacturaRetur, pnParametruAditional, pcSirDifAcont, pcSirDifPart, pnTotalFtva, pnTotalTva
		Local llReturn,lnSucces,lnCantitateRamasa,lcSql, lcListaIncasare, lnTipOriginal
		Store 0 To pnTotalFtva, pnTotalTva		&&	modificare	v 2.0.46
		pcSirDifAcont = []
		pcSirDifPart = []
		lcCursorVerificare = [crsact]
		lcCursorFinal = [actactan]
		pnFacturaRetur = 0
		pnParametruAditional = 0
		llReturn = .T.
		lcListaIncasare = ''
		
		If Inlist(poDate.ntip_incasare, 11, 2, 3) && 11 = CHITANTA, 2 = BON FISCAL, 3 = POS/Card
			Do Case
				Case poDate.ntip_incasare = 11 && chitanta
					If poDate.incasat <> 0
						lcListaIncasare = lcListaIncasare + ['11|] + Alltrim(Str(poDate.incasat,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
				Case poDate.ntip_incasare = 3 && POS/Card
					If poDate.incasatCARD <> 0 && bon fiscal CARD POS
						lcListaIncasare = lcListaIncasare + ['3|] + Alltrim(Str(poDate.incasatCARD,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
				Otherwise && bon fiscal
					If poDate.incasat <> 0 && bon fiscal numerar
						lcListaIncasare = lcListaIncasare + ['2|] + Alltrim(Str(poDate.incasat,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
		
					If poDate.incasatCARD <> 0 && bon fiscal CARD POS
						lcListaIncasare = lcListaIncasare + ['3|] + Alltrim(Str(poDate.incasatCARD,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
		
					If poDate.incasatTichete <> 0 && bon fiscal tichete
						lcListaIncasare = lcListaIncasare + ['5|] + Alltrim(Str(poDate.incasatTichete,18,gnPc)) + [|] + Alltrim(Str(poDate.id_casa)) + [;']
					Endif
			Endcase
		
		Else
			lcListaIncasare = [NULL]
		Endif
		
		***************************************************************
		* Hacuiesc Tip = 43 bon fiscal magazin, ca sa apara in vanzari.tip = 43, apoi pun tipul la loc, ca sa nu deranjez alte lucruri
		lnTipOriginal = poDate.Tip
		IF (poDate.eBonFiscal = 1)
			poDate.Tip = 43 && bon fiscal magazin
		ENDIF 	
		***************************************************************
		
		*!*	modificare	v 2.0.46
		If Thisform.do_scrie_articole()
			IF (poDate.eBonFiscal = 1)
				poDate.Tip = m.lnTipOriginal
			ENDIF 	
		
		*!*	modificare	v 2.0.46	^
			If poDate.in_valuta = 1
				pnDiscount = Thisform.ndiscfactval
			Else
				pnDiscount = Thisform.ndiscfactron
			Endif
		*!*	modificare	v 2.0.46
			pnTotalFtva = Thisform.nbazaron
			pnTotalTva = Thisform.ntvaron
		*!*	modificare	v 2.0.46	^
			poDate.text_aditional = Strtran(poDate.text_aditional,Chr(13)+Chr(10),Chr(170),1,100,1)
			Do Case
			Case poDate.Tip = 4
		*!*	facturare din aviz
				Select crsarticole
				Calculate Sum(cantitate) To lnCantitateRamasa
				If lnCantitateRamasa > 0
					pnFacturaRetur = 7 - amessagebox("Doriti sa se inregistreze si avizul de retur?",4+32,"Confirmare")
					pnParametruAditional = 1
				Else
					pnFacturaRetur = 0
					pnParametruAditional = 0
				Endif
		*!* v 2.0.13
		*!*		lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura_avize(] + ;
		*!*			[?pnDiscount,?poDate.nr_incasare,?poDate.id_casa,?poDate.incasat,?poDate.id_delegat,?poDate.id_masina,] + ;
		*!*			[?poDate.id_agent,?poDate.text_aditional,?poDate.discount_evidentiat,?pnParametruAditional)}]
		*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
		*!*	modificare	v 2.0.80 : am adaugat poDate.serie_chit
				lcSql = [{call pack_facturare.scrie_factura_avize(] + ;
					ALLTRIM(Str(pnDiscount,18,gnPC))+ [,] + ;
					['] + ALLTRIM(NVL(poDate.serie_chit,[])) + [',] + ;
					Alltrim(Str(poDate.nr_incasare)) + [,] + ;
					m.lcListaIncasare + [,] + ;
					IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
					IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
					IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
					IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;
					[to_date('] + TTOC(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
					IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
					['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.text_aditional,[]))) + [',] + ;
					ALLTRIM(Str(poDate.discount_evidentiat)) + [,] + Alltrim(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare)}]
		*!* v 2.0.13 ^
			Case Inlist(poDate.Tip,3,21,25,28,42,47)			&&	modificare v 2.0.93 : am adaugat 47
		*!*	facturare pe baza de comanda / avize pe baza de comanda
				Select crsarticole
				Calculate Sum(cantitate) To lnCantitateRamasa
				If lnCantitateRamasa <> 0
					pnParametruAditional = 7 - amessagebox("Doriti sa se inchida comanda?",4+32,"Confirmare")
				Endif
		*!* v 2.0.13
		*!*		lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura(] + ;
		*!*			[?pnDiscount,?poDate.nr_incasare,?poDate.id_casa,?poDate.incasat,?poDate.id_delegat,?poDate.id_masina,] + ;
		*!*			[?poDate.id_agent,?poDate.text_aditional,?poDate.discount_evidentiat,?pnParametruAditional)}]
		*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
		*!*	modificare	v 2.0.80 : am adaugat serie_chit
				lcSql = [{call pack_facturare.scrie_factura2(] + ;
					Alltrim(Str(pnTotalFtva,18,gnPc)) + [,] + Alltrim(Str(pnTotalTva,18,gnPc)) + [,] + ;	&&	modificare	v 2.0.46
					Alltrim(Str(pnDiscount,18,gnPc)) + [,] + ;
					['] + ALLTRIM(NVL(poDate.serie_chit,[])) + [',] + ;
					Alltrim(Str(poDate.nr_incasare)) + [,] + ;
					m.lcListaIncasare + [,] + ;
					IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
					IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
					IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
					IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;				
					[to_date('] + TTOC(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
					IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
					['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.text_aditional,[]))) + [',] + ;
					Alltrim(Str(poDate.discount_evidentiat)) + [,] + ;
					ALLTRIM(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare)}]
		*!* v 2.0.13 ^
			Otherwise
		*!* v 2.0.13
		*!*		lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura(] + ;
		*!*			[?pnDiscount,?poDate.nr_incasare,?poDate.id_casa,?poDate.incasat,?poDate.id_delegat,?poDate.id_masina,] + ;
		*!*			[?poDate.id_agent,?poDate.text_aditional,?poDate.discount_evidentiat,?pnParametruAditional)}]
		*!*	modificare	v 2.0.93
				If poDate.tip = 48
					pnParametruAditional = poDate.coeficient_k
				Endif
		*!*	modificare	v 2.0.93	^
		*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
		*!*	modificare	v 2.0.80 : am adaugat serie_chit
				lcSql = [{call pack_facturare.scrie_factura2(] + ;
					Alltrim(Str(pnTotalFtva,18,gnPc)) + [,] + Alltrim(Str(pnTotalTva,18,gnPc)) + [,] + ;	&&	modificare	v 2.0.46
					Alltrim(Str(pnDiscount,18,gnPc)) + [,] + ;
					['] + ALLTRIM(NVL(poDate.serie_chit,[])) + [',] + ;			
					Alltrim(Str(poDate.nr_incasare)) + [,] + ;
					m.lcListaIncasare + [,] + ;
					IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
					IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
					IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
					IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;					
					[to_date('] + TTOC(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
					IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
					['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.text_aditional,[]))) + [',] + ;
					Alltrim(Str(poDate.discount_evidentiat)) + [,] + ;
					ALLTRIM(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare)}]
		*!* v 2.0.13 ^
			Endcase
		*!*	modificare	v 2.0.46
		*!*	If Thisform.do_scrie_articole()
		*!*	modificare	v 2.0.46	^
		
			lnSucces = goExecutor.oExecute(lcSql,lcCursorVerificare)
			If lnSucces<0
				amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				llReturn = .F.
			Else
				If Reccount(lcCursorVerificare)>0
					gnButon = 1
					Select a.*,a.suma As totftva, a.suma As tottva, Ttod(a.dataactt) As dataact, ;
						Ttod(a.datairegt) As dataireg, Ttod(a.datascadt) As datascad, ;
						0 As pozitie_1, 0 As pozitie_2 From (lcCursorVerificare) a Into Cursor (lcCursorFinal) Readwrite
					Use In (lcCursorVerificare)
					Select (lcCursorFinal)
					Do Form verificare With .T.,.T.
					If gnButon = 1
						Select (lcCursorFinal)
						Scan For Nvl(ascd,'') <> Nvl(ascd1,'') Or Nvl(ascc,'') <> Nvl(ascc1,'') Or ;
								NVL(id_partd,0) <> Nvl(id_partd1,0) Or Nvl(id_partc,0) <> Nvl(id_partc1,0)
							If Nvl(ascd,'') <> Nvl(ascd1,'') Or Nvl(ascc,'') <> Nvl(ascc1,'')
								pcSirDifAcont = pcSirDifAcont + Alltrim(Str(id_act)) + [|] + Alltrim(Nvl(ascd,'')) + [|] + Alltrim(Nvl(ascc,'')) + [;]
							Endif
							If Nvl(id_partd,0) <> Nvl(id_partd1,0) Or Nvl(id_partc,0) <> Nvl(id_partc1,0)
								If (Like([41*],scd) And Nvl(id_partd,0) <> Nvl(id_partd1,0)) ;
										Or (Like([41*],scc) And Nvl(id_partc,0) <> Nvl(id_partc1,0))
									amessagebox("Nu puteti modifica clientul!",48,"Atentie")
									Return .F.
								Else
									pcSirDifPart = pcSirDifPart + Alltrim(Str(id_act)) + [|] + Alltrim(Str(Nvl(id_partd,0))) + [|] + Alltrim(Str(Nvl(id_partc,0))) + [;]
								Endif
							Endif
						Endscan
		*!*	modificare 20.06
						lnReturn = 1
						If pnFacturaRetur = 1
							lnReturn = completeaza_date_aviz_retur() && IN ofacturare.prg	&&	modificare 13.11.2007
							If lnReturn > 0
		*!* v 2.0.13
		*!*							lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura_avize_retur(] + ;
		*!*								[?pnDiscount,?poDate.id_delegat,?poDate.id_masina,?poDate.id_agent,] + ;
		*!*								[?poDate.discount_evidentiat,?poDate.text_aditional,?poDate.text_aditional_retur,] + ;
		*!*								[?pcSirDifAcont,?pcSirDifPart,?pnParametruAditional,?poDate.serie_act_retur,] + ;
		*!*								[?poDate.nract_retur)}]
		*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare, poDate.nid_vanzare_retur
								lcSql = [{call pack_facturare.scrie_factura_avize_retur(] + ;
									ALLTRIM(Str(pnDiscount,18,gnPC)) + [,] + ;
									IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
									IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
									IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
									IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;										
									[to_date('] + TTOC(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
									IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
									ALLTRIM(Str(poDate.discount_evidentiat)) + [,] + ;
									['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.text_aditional,[]))) + [',] + ;
									['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.text_aditional_retur,[]))) + [',] + ;
									['] + Alltrim(Nvl(pcSirDifAcont,[])) + [','] + ;
									ALLTRIM(Nvl(pcSirDifPart,[])) + [',] + Alltrim(Str(pnParametruAditional)) + [,'] + ;
									ALLTRIM(Nvl(poDate.serie_act_retur,[]))+ [',] + Alltrim(Str(poDate.nract_retur,14,0)) + [,] + ;
									[?@poDate.nid_vanzare,?@poDate.nid_vanzare_retur)}]
		*!* v 2.0.13 ^
								lcCursor = [crsavizretur]
								lnSucces = goExecutor.oExecute(lcSql,lcCursor)
							Else
								gnButon = 2
								llReturn = .F.
							Endif
		*!*	modificare 20.06	^
						Else
		*!* v 2.0.13
		*!*						lcSql = [begin ] + gcS + [.pack_facturare.finalizeaza_scriere_verificare(?pnDiscount,?poDate.id_delegat,] + ;
		*!*							[?poDate.id_masina,?poDate.id_agent,?poDate.text_aditional,?pcSirDifAcont,?pcSirDifPart,?pnParametruAditional); end;]
		*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare
							lcSql = [begin pack_facturare.finalizeaza_scriere_verificare(] + ;
								ALLTRIM(Str(pnDiscount,18,gnPC)) + [,] + ;
								IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
								IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
								IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
								IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;										
								[to_date('] + TTOC(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;
								IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
								['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.text_aditional,[]))) + [',] + ;
								['] + Alltrim(Nvl(pcSirDifAcont,[])) + [','] + ;
								ALLTRIM(Nvl(pcSirDifPart,[])) + [',] + Alltrim(Str(pnParametruAditional)) + [,?@poDate.nid_vanzare); end;]
		*!* v 2.0.13 ^
							lnSucces = goExecutor.oExecute(lcSql)
						Endif
						If lnSucces<0 And lnReturn = 1
							amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
							gnButon = 2
							llReturn = .F.
						Endif
					Endif
					Use In (lcCursorFinal)
				Else
					Use In (lcCursorVerificare)
		*!*	modificare 20.06
					If pnFacturaRetur = 1
		*!*	modificare v 2.0.58
						lnReturn = completeaza_date_aviz_retur()
						If lnReturn > 0
		*!*	modificare	v 2.0.58	^
		*!* v 2.0.13
		*!*					lcSql = [{call ] + gcS + [.pack_facturare.scrie_factura_avize_retur(] + ;
		*!*						[?pnDiscount,?poDate.id_delegat,?poDate.id_masina,?poDate.id_agent,] + ;
		*!*						[?poDate.discount_evidentiat,?poDate.text_aditional,?poDate.text_aditional_retur,]+;
		*!*						[NULL,NULL,?pnParametruAditional,?@poDate.nract_retur)}]
		*!*	modificare	v 2.0.58 : am adaugat poDate.nid_vanzare, poDate.nid_vanzare_retur
							lcSql = [{call pack_facturare.scrie_factura_avize_retur(] + ;
								ALLTRIM(Str(pnDiscount,18,gnPC)) + [,] + ;
								IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ;
								IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ;
								IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ;
								IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ;										
								[to_date('] + TTOC(poDate.dataora_exp,1) + [','YYYYMMDDHH24MISS'),] + ;						
								IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
								ALLTRIM(Str(poDate.discount_evidentiat)) + [,] + ;
								['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.text_aditional,[]))) + [',] + ;
								['] + OracleSpecialCharacters(Alltrim(Nvl(poDate.text_aditional_retur,[]))) + [',] + ;
								[NULL,NULL,] + Alltrim(Str(pnParametruAditional)) + [,] + Alltrim(Str(poDate.nract_retur,14,0)) + [,] + ;
								[?@poDate.nid_vanzare,?@poDate.nid_vanzare_retur)}]
		*!* v 2.0.13 ^
							lcCursor = [crsavizretur]
							lnSucces = goExecutor.oExecute(lcSql,lcCursor)
							If lnSucces<0
								amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
								gnButon = 2
								llReturn = .F.
							Endif
		*!*	modificare	v 2.0.58
						Else
							gnButon = 2
							llReturn = .F.
						Endif
		*!*	modificare v 2.0.58	^
					Endif
		*!*	modificare 20.06 ^
				Endif
				If gnButon = 1
					If pnDiscount<> 0
						Select crsfactura
						Append Blank
		*!*	modificare	v 2.0.56 : am adaugat id_temp
						Replace denumire With Replicate('Z',20),cantitate With 1,pretftva With Thisform.nbazafdiscount,vpretftva With Thisform.nbazafdiscountval,;
							discountftva With Thisform.ndiscfactron,valdiscountftva With Thisform.ndiscfactron,valdiscounttva With Round(Thisform.ndiscfactron  * (Thisform.nproc_tvav - 1),gnPc),;
							vdiscountftva With Thisform.ndiscfactval,vvaldiscountftva With Thisform.ndiscfactval,vvaldiscounttva With Round(Thisform.ndiscfactval * (Thisform.nproc_tvav - 1),gnPVal),;
							proc_tvav With Thisform.nproc_tvav,id_temp With 99999
					Endif
				Else
					llReturn = .F.
				Endif
			Endif
			If llReturn
				llReturn = Thisform.do_inchide_tranzactie(1)
			Else
				Thisform.do_inchide_tranzactie(2)
			Endif
		Else
			llReturn = .F.
		Endif
		Return llReturn
	ENDPROC

	PROCEDURE do_scrie_proforma
		Local llReturn,lcSql,lnSucces
		*!*		emitere avize / facturi
		Private pnDiscount
		Local llReturn,lnSucces,lcSql
		llReturn = .T.
		
		If poDate.in_valuta = 1
			pnDiscount = Thisform.ndiscfactval
		Else
			pnDiscount = Thisform.ndiscfactron
		Endif
		
		poDate.text_aditional = Strtran(poDate.text_aditional,Chr(13)+Chr(10),Chr(170),1,100,1)
		
		If Thisform.do_scrie_articole()
			poDate.id_delegat = Null
			poDate.id_masina = Null
			poDate.id_agent = Null
		*!* v 2.0.13	
		*!*		lcSql = [begin ] + gcS + [.pack_facturare.scrie_proforma(] + ;
		*!*			[?pnDiscount,?poDate.nr_incasare,?poDate.id_casa,?poDate.incasat,] + ;
		*!*			[?poDate.id_delegat,?poDate.id_masina,?poDate.id_agent,?poDate.text_aditional,] + ;
		*!*			[?poDate.discount_evidentiat,?@poDate.nract); end;]
		*!*	modificare	v 2.0.58 : am adaugat poDate.id_proforma
		*!*	modificare v 2.0.67
		*!*		lcSql = [begin pack_facturare.scrie_proforma(] + ;
		*!*			ALLTRIM(STR(pnDiscount,18,gnPc)) + [,] + ALLTRIM(STR(poDate.nr_incasare)) + [,] + ;
		*!*			IIF(ISNULL(poDate.id_casa),[NULL],ALLTRIM(STR(poDate.id_casa))) + [,] + ;
		*!*			ALLTRIM(STR(poDate.incasat,18,gnPc)) + [,] + ;
		*!*			IIF(ISNULL(poDate.id_delegat),[NULL],ALLTRIM(STR(poDate.id_delegat))) + [,] + ;
		*!*			IIF(ISNULL(poDate.id_masina),[NULL],ALLTRIM(STR(poDate.id_masina))) + [,] + ;
		*!*			IIF(ISNULL(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ;
		*!*			['] + Strtran(ALLTRIM(NVL(poDate.text_aditional,'')),['],['']) + [',] + ;
		*!*			ALLTRIM(STR(poDate.discount_evidentiat)) + [,?poDate.nid_proforma,?@poDate.nract); end;]
			lcSql = [begin pack_facturare.scrie_proforma(] + ;
				ALLTRIM(STR(pnDiscount,18,gnPC)) + [,] + ;
				['] + OracleSpecialCharacters(ALLTRIM(NVL(poDate.text_aditional,''))) + [',] + ;
				ALLTRIM(STR(poDate.discount_evidentiat)) + [,?poDate.nid_proforma,?@poDate.nract); end;]
		*!*	modificare v 2.0.67	^
		*!* v 2.0.13 ^		
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces<0
				amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
				llReturn = .F.
			Else
				If pnDiscount<> 0
					Select crsfactura
					Append Blank
					*!*	modificare	v 2.0.56 : am adaugat id_temp
					Replace denumire With Replicate('Z',20),cantitate With 1,pretftva With Thisform.nbazafdiscount,vpretftva With Thisform.nbazafdiscountval,;
						discountftva With Thisform.ndiscfactron,valdiscountftva With Thisform.ndiscfactron,valdiscounttva With Round(Thisform.ndiscfactron  * (Thisform.nproc_tvav - 1),gnPC),;
						vdiscountftva With Thisform.ndiscfactval,vvaldiscountftva With Thisform.ndiscfactval,vvaldiscounttva With Round(Thisform.ndiscfactval * (Thisform.nproc_tvav - 1),gnPVal),;
						proc_tvav With Thisform.nproc_tvav,id_temp with 99999
				Endif
			Endif
			If llReturn
				llReturn = Thisform.do_inchide_tranzactie(1)
			Else
				Thisform.do_inchide_tranzactie(2)
			Endif
		Else
			llReturn = .F.
		Endif
		Return llReturn
	ENDPROC

	PROCEDURE do_sterge
		If Reccount('crsfactura')>0
			Private poArticol
			Select crsfactura
			Scatter Name poArticol MEMO
		*!*	modificare v 2.0.67
			Local lcCursor
			If poArticol.opt_facturare = 0
				lcCursor = [crsarticole]
			Else
				lcCursor = [crsarticole1]
			Endif
		*!*	modificare v 2.0.67	^
			If aMessagebox("Doriti sa stergeti " + Iif(Inlist(poArticol.opt_facturare,1,2),"rata","articolul") + " " + Upper(Alltrim(poArticol.denumire)) + " ?",4+32,"Confirmare stergere") == 6
		*!*	modificare	19.01.2008
		*!*			lcSql = [begin ] + gcS + [.pack_facturare.sterge_articol_factura(?poArticol.id_temp,] + ;
		*!*				[?gnIdUtil); end;]
		*!*			lnSucces = goExecutor.oExecute(lcSql)
		
		*!*			If lnSucces < 0
		*!*				aMessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
		*!*				Thisform.txtArticoleLista.SetFocus()
		*!*				Return
		*!*			Endif
		*!*	modificare	19.01.2008	^
				save_grid_tag(Thisform.grd_factura)
				Update crsfactura Set id_temp = -1 Where id_temp = poArticol.id_temp
				Update crsfactura Set id_temp = id_temp-1 Where id_temp > poArticol.id_temp
				Select * From crsfactura Where id_temp<>-1 Order By id_temp ;
					INTO Cursor crsfactura Readwrite
				restore_grid_tag(Thisform.grd_factura)
		
				Select (lcCursor)
				lnRecNo = Recno()
				Do Case
		*!*	modificare	v 2.0.30
		*!*			Case (gnScadereStoc = 1 And InList(poDate.tip,23,41)) Or Inlist(poDate.tip,3,4,21,25,28)
		*!*				Select crsarticole
		*!*				Replace cantitate With cantitate + poArticol.cantitate For id_c = poArticol.id_c
				Case gnScadereStoc = 1 And poDate.tip = 41
					Select (lcCursor)
					Replace cantitate With cantitate - poArticol.cantitate For id_c = poArticol.id_c
		*!*	modificare	v 2.0.56
		*!*			Case (gnScadereStoc = 1 And poDate.tip = 41) Or Inlist(poDate.tip,3,4,21,25,28,42)
				Case (gnScadereStoc = 1 And poDate.tip = 23) Or Inlist(poDate.tip,3,4,21,25,28,42,47)		&&	modificare v 2.0.93 : am adaugat 47
		*!*	modificare	v 2.0.56	^
					Select (lcCursor)
					Replace cantitate With cantitate + poArticol.cantitate For id_c = poArticol.id_c
		*!*	modificare	v 2.0.30	^
		*!*	modificare v 2.0.56
				Case Inlist(poDate.tip,8,9)
					Replace cantitate With cantitate - poArticol.cantitate For id_c = poArticol.id_c
		*!*	modificare v 2.0.56	^
		*!*	modificare v 2.0.67
		*!*			Case poArticol.id_gestiune <> - 1000 And gnScadereStoc = 1 And ;
		*!*					(Inlist(poDate.tip,1,22,29) Or (poDate.tip = 2 And pnTipFacturare = 4))
				Case poArticol.id_gestiune <> - 1000 And gnScadereStoc = 1 And ;
						(Inlist(poDate.tip,1,22,29) Or (poDate.tip = 2 And poArticol.opt_facturare = 0))
		*!*	modificare v 2.0.67	^
					Select (lcCursor)
					Replace cantitate With cantitate + poArticol.cantitate For id_articol = poArticol.id_articol And gestionabil = 1
				Endcase
				If Reccount(lcCursor)<lnRecNo
					Go Top
				Else
					Go lnRecNo
				Endif
		
				Thisform.do_calculeaza_totaluri()
			Endif
			If Reccount('crsfactura')>0
				Thisform.txtArticoleLista.SetFocus()
			Else
		*!*	modificare v 2.0.67
		*!*			Thisform.txtArticole.SetFocus()
				If poArticol.opt_facturare = 0
					Thisform.txtArticole.SetFocus()
				Else
					Thisform.grd_contracte.SetFocus()
				Endif
		*!*	modificare v 2.0.67	^
			Endif
			Release poArticol,lcCursor
		Endif
		
	ENDPROC

	PROCEDURE do_termin
		*!*	modificare	19.01.2007
		DoDefault()
		*!*	If This.inainte_de_do_termin()
		*!*		gnButon = 1
		*!*		pnButon = 1
		*!*		Buton = 1
		*!*		pnIesire = 1
		*!*		If !This.lhide
		*!*			This.Release
		*!*		Else
		*!*			This.Hide
		*!*		Endif
		*!*		Sqlcommit(gnHandle)
		*!*		SQLSetprop(gnHandle,"Transactions",1) && tranzactie automata
		*!*	Endif
		*!*	modificare	19.01.2007	^
	ENDPROC

	PROCEDURE do_urmator
		Thisform.do_adauga_articol()
		
	ENDPROC

	PROCEDURE do_urmator2
		If Used('crsarticole1') And Reccount('crsarticole1')>0
			Select crsarticole1
			If Isnull(id_rata)
				Thisform.do_adauga_articol(.F.,.T.)
			Else
				Thisform.do_adauga_rata()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_verifica_articol
		*!*	modificare	v 2.0.67
		Lparameters tlContract,tnCantitate
		Local llReturn, lcFiltru, llFacturareFaraStoc
		llReturn = .T.
		
		*!*   nu se face verificarea daca mai exista pe factura, deoarece poate exista cazul in care cantitatea dorita
		*!*  nu poate fi acoperita dintr-o singura gestiune, iar pe formularul de adaugare se poate selecta doar una din care
		*!*	 sa se faca scaderea
		llFacturareFaraStoc = (Type('gnRF_FACTURARE_FARA_STOC') = 'N' And m.gnRF_FACTURARE_FARA_STOC = 1)
		
		If (tnCantitate >= 0 And Inlist(poDate.tip,8,9)) Or ;
				(tnCantitate <= 0 And Not (poDate.tip = 2 And poArticol.opt_facturare = 3) And !Inlist(poDate.tip,8,9) And poArticol.gestionabil = 1 And gnScadereStoc = 1 AND !m.llFacturareFaraStoc)
			lcMesaj = Alltrim(Thisform.cmesaj_cantitate)
			amessagebox(lcMesaj,0+48,"Atentie")
			llReturn = .F.
		Else
			If !tlContract And Used('crsarticole1') And Used('crsCtrTemp')
				If Used('crsverifart')
					Use In crsverifart
				Endif
				Select id_ctr From crsCtrTemp Where id_ctr Not In ;
					(Select Distinct id_ctr From crsarticole1 Where id_articol = poArticol.id_articol And id_rata Is Null) ;
					INTO Cursor crsverifart
				Select crsverifart
				Do Case
					Case Reccount('crsverifart') = 0
						amessagebox("Articolul "+Alltrim(poArticol.denumire)+" din politica "+Alltrim(poArticol.nume_lista_preturi)+" are pretul fixat prin contract!",0+48,"Atentie")
						llReturn = .F.
					Case Reccount('crsverifart') <> Reccount('crsCtrTemp')
						lcFiltru = []
						Select crsverifart
						Scan
							lcFiltru = lcFiltru + [,] + Alltrim(Str(id_ctr))
						Endscan
						lcFiltru = [INLIST(id_ctr] + lcFiltru + [)]
						Select crsCtrTemp
						Set Filter To &lcFiltru
					Otherwise
						llReturn = .T.
				Endcase
				Use In crsverifart
			Endif
		Endif
		Return llReturn
		*!*	modificare	v 2.0.67	^
		
	ENDPROC

	PROCEDURE Error
		LPARAMETERS nError, cMethod, nLine
		SET STEP ON 
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		*!*	modificare	19.01.2007
		*!*	Sqlrollback(gnHandle)
		*!*	SQLSetprop(gnHandle,"Transactions",1)
		*!*	*!*	If poDate.tip<21
		*!*	*!*		Do dezaloca_numar_fact In oserii_numere.prg
		*!*	*!*	Else
		*!*	*!*		Do dezaloca_numar_aviz In oserii_numere.prg
		*!*	*!*	Endif
		*!*	modificare	19.01.2007	^
		Return .T.
	ENDPROC

	PROCEDURE inainte_de_do_termin
		*!*	04.02.2015
		*!*	marius.mutu
		*!*	frm_alte_date - se bifeaza automat incasare cu bon fiscal, daca poDate.eBonFiscal = 1
		
		*!*	05.05.2015
		*!*	marius.mutu
		*!*	frm_alte_date - se bifeaza automat bon fiscal detaliat, daca poDate.eBonFiscal = 1
		*!*	ar trebui in functie de o optiune
		
		*!*	initializare numar bon fiscal cu numar act, in caz ca s-a suprascris de utilizator
		
		Local llContinuare && plReturn
		Store .F. To plReturn
		Store .T. To llContinuare
		If poDate.tip <> 30
			lccontrol = Upper(This.ActiveControl.BaseClass )
			If  Inlist(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
				lcval=This.ActiveControl.ControlSource
				&lcval=Thisform.ActiveControl.Value
			Endif
		Endif
		
		creeaza_backup_cursoare_facturare()
		
		If poDate.in_valuta = 1
		*!*		poDate.totctvaconv		=	Thisform.ntotalron
		*!*		poDate.totftvaconv		=	Thisform.nbazaron
		*!*		poDate.tottvaconv		=	Thisform.ntvaron
			lnTotalFactura = Thisform.ntotalval
		*!*		Do recalculeaza_pret_vanzare_lei With [crsfactura],poDate.Curs In ofacturare_comun.prg
		Else
			lnTotalFactura = Thisform.ntotalron
		Endif
		poDate.totalctva = lnTotalFactura
		
		Do Case
		Case Reccount('crsfactura') = 0
			amessagebox("Nu ati ales articolele " + Iif(poDate.tip<21,[pentru facturare],[]) + "!",48,"Atentie")
			Thisform.grd_articole.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.67
		*!*	modificare ROAFACTURARE v 2.0.71
		*!*	Case Empty(poDate.datascad)
		Case Empty(poDate.datascad) AND BETWEEN(poDate.tip,1,20)
		*!*	modificare ROAFACTURARE v 2.0.71	^
			amessagebox("Nu ati completat data scadenta!",48,"Atentie")
			Thisform.txtDataScadenta.SetFocus()
			plReturn = .F.
		*!*	modificare ROAFACTURARE v 2.0.71
		*!*	Case poDate.datascad<poDate.dataact
		Case poDate.datascad<poDate.dataact AND BETWEEN(poDate.tip,1,20)
		*!*	modificare ROAFACTURARE v 2.0.71	^
			amessagebox("Data scadenta trebuie sa fie mai mare sau egala cu data documentului!",48,"Atentie")
			Thisform.txtDataScadenta.SetFocus()
			plReturn = .F.
		*!*	modificare	v 2.0.67	^
		Otherwise
			If lnTotalFactura = 0
				If amessagebox(Iif(poDate.tip<21,[Factura],[Avizul])+" are totalul 0. Doriti sa continuati?",4+48+256,"Confirmare") = 7
					llContinuare = .F.
					plReturn = .F.
					Thisform.grd_factura.SetFocus()
				Endif
			Endif
		*!*	modificare	v 2.0.46
		*!*		If Nvl(gnFactSeturi,0)=1
		*!*	modificare	v 2.0.56
		*!*		If Nvl(gnFactSeturi,0)=1 And poDate.tip <> 7
			If Nvl(gnFactSeturi,0)=1 And poDate.tip <> 7 And llContinuare
		*!*	modificare	v 2.0.56	^
		*!*	modificare	v 2.0.46	^
				llContinuare = facturare_articole_compuse()
		*!*	modificare	v 2.0.67
				If Nvl(gnModTotFact,0) = 0
		*!*	modificare	v 2.0.67	^
					Thisform.do_calculeaza_totaluri()
					poDate.totalctva = Thisform.ntotalron
		*!*	modificare	v 2.0.67
				Endif
		*!*	modificare	v 2.0.67	^
				plReturn = llContinuare
			Endif
			If llContinuare
				gnButon = 1
				*!*	modificare	v 2.0.93
				If poDate.tip = 48
					Private pnCoefK
					pnCoefK = 0
					lnSucces = goExecutor.oFunction2Value([pack_facturare.calculeaza_k()],@pnCoefK)
					If lnSucces < 0
						amessagebox(goExecutor.cEroare,16,"Eroare")
						gnButon = 2
					Else
						If pnCoefK <> 0
							poDate.coeficient_k = pnCoefK
						Endif
					Endif
					Release pnCoefK
					If Nvl(gnCoefKFact,2) <> 0
						Private ofrmdatek
						ofrmdatek = Createobject("frm_seteaza_k")
						ofrmdatek.Show(1)
						Release ofrmdatek
					Endif
				Endif
				*!*	modificare	v 2.0.93	^		
		*!*	modificare	v 2.0.67
		*!*			If poDate.eProforma = 1
		*!*	*!*				recalculeaza_pret_vanzare_compus()
		*!*				plReturn = Thisform.do_scrie_proforma()
		*!*			Else
		*!*	modificare	v 2.0.67	^
				If gnButon = 1	&&	modificare	v 2.0.93
					Private ofrmdatesupl
					poDate.dataora_exp = Get_Ora()	&&	modificare ROAFACTURARE v 2.0.80
					If poDate.tip<>30
						ofrmdatesupl = Createobject("frm_alte_date")
						ofrmdatesupl.nnrbon = poDate.nract && in caz ca s-a suprascris schimbat de catre utilizator
						IF (poDate.eBonFiscal = 1)		
							WITH ofrmdatesupl
								.opt_incasat.value = 3 && INCASARE CU BON FISCAL
								.actualizeaza_tipincasare()
								.opt_incasat.option1.tabstop = .F. && sa nu schimb din greseala cu ENTER, se poate schimba cu mouse-ul
								.opt_incasat.option2.tabstop = .F.
								.opt_incasat.option3.tabstop = .F.
							ENDWITH 
							poDate.nBonDetaliat = 1 && ar trebui in functie de o optiune					
						ENDIF 
						ofrmdatesupl.Show(1)
					Else
						gnButon = 1
					Endif
				Endif			&&	modificare	v 2.0.93
		
				If gnButon = 2
					plReturn = .F.
					gnButon = 1
		*!*	modificare	v 2.0.46	-	este in repune_backup_cursoare_facturare
		*!*					If Used('crsfacturaset')
		*!*						Use In crsfacturaset
		*!*						Select crsfactura
		*!*						lnRecno = Recno()
		*!*						Replace id_set_fact With 0 All
		*!*						Go Min(lnRecno,Reccount('crsfactura'))
		*!*					Endif
		*!*	modificare	v 2.0.46	^
				Else
		*!*					recalculeaza_pret_vanzare_compus()
		*!*	modificare	v 2.0.67
					If poDate.eProforma = 1
						plReturn = Thisform.do_scrie_proforma()
					Else
		*!*	modificare	v 2.0.67	^
						plReturn = Thisform.do_scrie_factura()
					Endif
				Endif
			Endif
		Endcase
		
		If plReturn
			sterge_backup_cursoare_facturare()
		Else
			save_grid(Thisform.grd_factura)
			repune_backup_cursoare_facturare()
		*!*	modificare	v 2.0.67
			If Nvl(gnModTotFact,0) = 0
		*!*	modificare	v 2.0.67	^
				Thisform.do_calculeaza_totaluri()
		*!*	modificare	v 2.0.67
			Endif
		*!*	modificare	v 2.0.67	^
			restore_grid(Thisform.grd_factura)
		Endif
		
		Return plReturn
		
	ENDPROC

	PROCEDURE Init
		Local lcTipDoc
		*:Global gcAcces
		gcAcces = [1;2;3;4;]
		DoDefault()
		
		lcTipDoc = [factura]
		
		With This.grd_factura
			This.nNrInregVizibile = Floor((.Height - .HeaderHeight) / .RowHeight)
		Endwith
		
		If !Used('crscursuri') Or Reccount('crscursuri') = 0
			Thisform.RemoveObject('lb_cursuri')
			Thisform.RemoveObject('grd_cursuri')
		Else
			If !Empty(Nvl(poDate.zi_curs, {}))
				Thisform.lb_cursuri.Caption = "Curs valutar " + Iif(!Inlist(poDate.tip, 8, 9), "(" + Dtoc(poDate.zi_curs) + ")", "")
			Else
				Thisform.lb_cursuri.Caption = "Curs valutar"
			Endif
			If Reccount('crscursuri') <= 3
				Thisform.grd_cursuri.ScrollBars = 0
			Endif
		Endif
		
		This.cmesaj_cantitate = [Acest articol nu este pe stoc!]
		Do Case
			Case Inlist(poDate.tip, 1, 5, 7, 10)		&&	modificare v 2.0.56 : am adaugat 10
				&&	facturare pe baza de lista de preturi
			Case Inlist(poDate.tip, 2, 6)
				&&	facturare pe baza de contract
			Case poDate.tip = 3
				&&	facturare pe baza de comanda
			Case poDate.tip = 4
				&&	facturare din avize
			Case Inlist(poDate.tip, 21, 28, 42, 47)			&&	modificare v 2.0.93 : am adaugat 47
				&&	aviz catre clienti din comanda
				lcTipDoc = [aviz]
			Case Inlist(poDate.tip, 22, 29)
				&&	aviz catre clienti din lista de preturi
				lcTipDoc = [aviz]
			Case poDate.tip = 23
				&&	transfer intre subunitati
				lcTipDoc = [aviz]
			Case poDate.tip = 41
				&&	retur
				lcTipDoc = [aviz]
			Case poDate.tip = 25
				&&	transfer intre subunitati pe baza de comanda
				lcTipDoc = [aviz]
			Case poDate.tip = 26
				&&	aviz catre clienti pe baza de contract
				lcTipDoc = [aviz]
			Case Inlist(poDate.tip, 8, 9)
				&& retur
		Endcase
		
		Thisform.clb_total_factura.lb_explicatie.Caption = [TOTAL ] + Upper(lcTipDoc)
		Thisform.ck_discountevidentiat.Caption = [Se pune în evidenta discount-ul pe articole ] + ;
			[în notele contabile și pe ] + Alltrim(lcTipDoc)
		
		Thisform.clb_total_baza.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_discount.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_discount_articole.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_total_factura.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_total_tva.do_actualizeaza_lbval(poDate.nume_valuta)
		Thisform.clb_discount.do_activeaza(1 + poDate.in_valuta)
		
		If Nvl(gnModTotFact, 0) = 1 And !Inlist(poDate.tip, 5, 6, 7, 9, 10)	&&	in afara de facturile in valuta
			Thisform.clb_total_baza.do_activeaza(1)
			Thisform.clb_total_tva.do_activeaza(1)
			Bindevent(Thisform, 'do_calculeaza_totaluri', Thisform, 'actualizeaza_total_mod', 1)
		Endif
		
		If poDate.in_valuta = 0
			Thisform.grd_factura.RemoveObject([cVpretFtva])
			Thisform.grd_factura.RemoveObject([cVdiscountftva])
			Thisform.grd_factura.RemoveObject([cVvaldiminuatftva])
		Else
			Thisform.grd_factura.RemoveObject([cPretFtva])
			Thisform.grd_factura.RemoveObject([cDiscountctva])
			Thisform.grd_factura.RemoveObject([cPretCtva])
			Thisform.grd_factura.RemoveObject([cValdiminuatctva])
		Endif
		
		Try
			Thisform.gridextra3.Setup()
		Catch
		Endtry
		
		this.Refresh()
	ENDPROC

	PROCEDURE KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		lcControl = Upper(Alltrim(Thisform.ActiveControl.Name))
		
		DO CASE
			CASE lcControl = 'CBOCODMAT'
				DODEFAULT(nKeyCode, nShiftAltCtrl)
			
			CASE INLIST(nKeyCode,9,13) AND (lcControl = 'PROCENT')
				THISFORM.do_calculeaza_discount(THISFORM.ACTIVECONTROL.VALUE)
		
			CASE nKeyCode = 7 AND lcControl = 'GRD_FACTURA'
				NODEFAULT
				THISFORM.do_sterge()
			CASE nKeyCode=27 AND nShiftAltCtrl=0
				NODEFAULT
				IF amessagebox("Sunteti sigur ca doriti sa inchideti fereastra?",4+32+256,"Confirmare")==6
					THIS.do_renunt()
				ENDIF
			CASE nKeyCode=6 AND nShiftAltCtrl=2
				NODEFAULT
				THIS.do_termin()
		ENDCASE
		
	ENDPROC

	PROCEDURE modifica_lista_preturi
		Lparameters tnIdPol, tnIdArticol, tnPretftvaLista, tnPretvtvaLista, tnPretLista, tnProcTvav,tnPretListaVechi
		*!*	modificare v 2.0.90 : am adaugat llModificat
		LOCAL llModificat
		llModificat = .F.
		
		If tnPretListaVechi <> tnPretLista
			If aMESSAGEBOX(Alltrim(poArticol.denumire)+" are pretul "+Alltrim(Str(tnPretListaVechi,16,gnPPretV)) + [ in politicile de preturi. Doriti sa il schimbati cu ]+Alltrim(Str(tnPretLista,16,gnPPretV))+" ?",4+32,"Confirmare modificare pret") <> 6
				RETURN llModificat
			Endif
		Else
			Return llModificat
		Endif
		
		*!* MODIFICARE PRETURI IN LISTA DE PRETURI PENTRU NIR-UL CU MODIFICAREA LISTEI DE PRETURI (ID_SET = 231 NIR MF PV LISTA DE PRETURI)
		
		Local lcSql, lcSelect
		lcSelect = Select()
		
		*!* verific daca exista articolul in politica de preturi
		lcSql = [Select id_pol_art, id_venchelt, proc_tvav from crm_politici_pret_art where id_pol = ] + Alltrim(Str(tnIdPol)) + [ and id_articol = ] + Alltrim(Str(tnIdArticol))
		lnSucces = goExecutor.oExecute(m.lcSql, "cPoliticiPretArt")
		If lnSucces < 0
			aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
		
			Select (lcSelect)
			RETURN llModificat
		Endif
		Select cPoliticiPretArt
		Scatter Name loPoliticaPretArt MEMO
		Use In (Select('cPoliticiPretArt'))
		
		
		&& TRANZACTIE MANUALA (MODIFICARE CRM_POLITICI_PRET_ART, CRM_POLITICI_PRETURI)
		lnSucces = SQLSetprop(gnHandle,"Transactions",2)
		If lnSucces < 0
			aMessageBox("Programul nu a trecut pe tranzactie manuala",4+48,'Lista preturi')
		
			Select (lcSelect)
			RETURN llModificat
		Endif
		
		*!* ADAUGARE ARTICOL NOU IN LISTA DE PRETURI SAU MODIFICARE ARTICOL EXISTENT
		If Nvl(loPoliticaPretArt.id_pol_art,0) = 0
			lcSql = [begin pack_preturi.adauga_politica_pret_art(] + ;
				ALLTRIM(Str(tnIdPol)) + [,] + ; && id_pol
			Alltrim(Str(tnIdArticol)) + [,] + ; && id_articol
			Alltrim(Str(tnPretLista,20,4)) + [,] + ; && pret
			Alltrim(Str(tnPretftvaLista,20,4)) + [,] + ;  && pretftva
			Alltrim(Str(tnPretvtvaLista ,20,4)) + [,] + ; && pretctva
			[NULL, ] + ; && id_valuta
			Alltrim(Str(tnProcTvav,20,4)) + [,] + ; && proc_tvav
			[NULL, ] + ; && procent
			[NULL, ] + ; && id_venchelt
			Alltrim(Str(gnIdUtil)) + ; && id_util
			[); end;]
		Else
			lcSql = [begin pack_preturi.modifica_pret_pol_pret_art(] + ;
				ALLTRIM(Str(loPoliticaPretArt.id_pol_art)) + [,] + ; && id_pol_art
			Alltrim(Str(tnPretLista,20,4)) + [,] + ; && pret
			Alltrim(Str(tnPretftvaLista,20,4)) + [,] + ;  && pretftva
			Alltrim(Str(tnPretvtvaLista ,20,4)) + [,] + ; && pretctva
			Iif(IsNull(loPoliticaPretArt.id_venchelt), 'NULL',Alltrim(Str(loPoliticaPretArt.id_venchelt))) + [,] + ; && id_venchelt
			Iif(IsNull(loPoliticaPretArt.proc_tvav), 'NULL', Alltrim(Str(loPoliticaPretArt.proc_tvav,20,4))) + ; && proc_tvav
			[); end;]
		Endif && Nvl(lnIdPolArt,0) = 0
		
		
		lnSucces = goExecutor.oExecute(lcSql)
		If lnSucces < 0
			aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
		Else
			*!* MODIFICARE DATAORA, UTIL in CRM_POLITICI_PRETURI
			lcSql = [begin pack_preturi.modifica_politica_dataora(] + ;
				ALLTRIM(Str(tnIdPol)) + [,] + ; && id_pol
			Alltrim(Str(gnIdUtil)) + ; && id_util
			[); end;]
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces < 0
				aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
			Endif
		Endif
		
		*!* COMMIT / ROLLBACK
		If lnSucces > 0
			lnSucces = goExecutor.oExecute("COMMIT")
			If lnSucces < 0
				aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
			ELSE
				llModificat = .T.
			Endif
		Else
			lnSucces = goExecutor.oExecute("ROLLBACK")
			If lnSucces < 0
				aMessageBox(goExecutor.cEroare,0+16, 'Eroare')
			Endif
		Endif
		
		SQLSetprop(gnHandle,"Transactions",1)
		
		Select (lcSelect)
		RETURN llModificat
	ENDPROC

	PROCEDURE Clb_dataact.TEXT_SIMPLU1.LostFocus
		*!*	modificare	v 2.2.4	:	daca scadenta nu e automata, atunci poate modifica data scadenta propusa
		*!*	poDate.datascad	= Iif(gnScadentaAutomata=0,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
		poDate.datascad	= Iif(gnZileScadentaFact=-1,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
		*!*	modificare	v 2.2.4	^
		Thisform.clb_data_scadenta.Refresh()
		*!*	modificare	v 2.0.56
		If Type('thisform.clb_zi_curs.visible')<>'U'
		*!*	modificare	v 2.0.56	^
			poDate.zi_curs = poDate.dataact
			Thisform.clb_zi_curs.Refresh()
		*!*	modificare	v 2.0.56
		Endif
		*!*	modificare	v 2.0.56	^
		
	ENDPROC

	PROCEDURE Clb_discount.Procent.LostFocus
		Thisform.do_calculeaza_discount(This.Value)
		
	ENDPROC

	PROCEDURE Clb_discount.TX_SUMA_NAT.InteractiveChange
		lcval=This.ControlSource
		&lcval=This.Value
		Thisform.do_calculeaza_totaluri(.T.)
	ENDPROC

	PROCEDURE Clb_discount.TX_SUMA_VAL.InteractiveChange
		lcval=This.ControlSource
		&lcval=This.Value
		Thisform.do_calculeaza_totaluri(.T.)
	ENDPROC

	PROCEDURE clb_fdoc.cboFdoc.Init
		LOCAL lcTipDoc
		lcTipDoc = IIF(poDate.nIdTipDoc = poDate.nIdTipDocFactura, 'FACTURA', ;
			IIF(poDate.nIdTipDoc = poDate.nIdTipDocProforma, 'PROFORMA', ;
			IIF(poDate.nIdTipDoc = poDate.nIdTipDocBonFiscal, 'BON FISCAL', ;
			IIF(poDate.nIdTipDoc = poDate.nIdTipDocAviz, 'AVIZ', 'FACTURA'))))
		THIS.Value = m.lcTipDoc
	ENDPROC

	PROCEDURE clb_fdoc.cboFdoc.Valid
		thisform.do_schimba_tipdoc()
	ENDPROC

	PROCEDURE Clb_nract.TEXT_SIMPLU1.LostFocus
		poDate.nract = this.value
	ENDPROC

	PROCEDURE Clb_serie_act1.TEXT_SIMPLU1.LostFocus
		*!* 03.02.2015
		*!* marius.mutu
		*!* sa se genereze numar din plaja, chiar daca nu exista serie (BON FISCAL)
		IF poDate.rezultat_serii = 2 && CU PLAJE, FARA SERIE
			This.Parent.genereazaNumar()
		ENDIF 
	ENDPROC

	PROCEDURE Clb_total_baza.tx_suma_nat.InteractiveChange
		Thisform.actualizeaza_total_mod(This.Value,1)
	ENDPROC

	PROCEDURE Clb_total_tva.tx_suma_nat.InteractiveChange
		Thisform.actualizeaza_total_mod(This.Value,2)
	ENDPROC

	PROCEDURE Ed_tx_simplu1._EDBASE1.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 13 && ENTER
			NODEFAULT 
			thisform.but_terMIN1.SetFocus()
		ENDIF 
	ENDPROC

	PROCEDURE grd_factura.cCodMat.cboCodmat.LostFocus
		DODEFAULT()
		
		IF this.Value <> thisform.cOldValue
			thisform.cOldvalue = this.Value
			REPLACE codmat WITH crsCodMat.codmat, denumire WITH crsCodmat.denumire, id_articol WITH crsCodmat.id_articol IN crsFactura
		
			* Actualizez cursorul pentru coloana Denumire
			lcRowSource = thisform.grd_factura.cDenumire.cCboDenumire.RowSource
			WITH thisform.grd_factura
				.cDenumire.cCboDenumire.cSearchString = ALLTRIM(crsCodmat.denumire)
				.cDenumire.cCboDenumire.RefreshData(1)
				.cDenumire.cCboDenumire.RowSource = ""
				.cDenumire.cCboDenumire.RowSource = m.lcRowSource && forteaza recreerea cursorului 
			ENDWITH 	
		
			thisform.grd_factura.cDenumire.Refresh()
		ENDIF 	
	ENDPROC

	PROCEDURE grd_factura.cCodMat.cboCodmat.When
		thisform.cOldValue = this.Value
	ENDPROC

	PROCEDURE grd_factura.cDenumire.cCboDenumire.LostFocus
		DODEFAULT()
		
		IF this.Value <> thisform.cOldValue
			thisform.cOldvalue = this.Value
			REPLACE codmat WITH crsDenumire.codmat, denumire WITH crsDenumire.denumire, id_articol WITH crsDenumire.id_articol IN crsFactura
		
			* Actualizez cursorul pentru coloana Codmat
			lcRowSource = thisform.grd_factura.cCodMat.cboCodmat.RowSource
			WITH thisform.grd_factura.cCodMat.cCboDenumire
				.cSearchString = ALLTRIM(crsDenumire.codmat)
				.RefreshData(1)
				.RowSource = ""
				.RowSource = m.lcRowSource && forteaza recreerea cursorului 
			ENDWITH 	
		
			thisform.grd_factura.cCodMat.Refresh()
		ENDIF 	
	ENDPROC

	PROCEDURE grd_factura.cDenumire.cCboDenumire.When
		Thisform.cOldvalue = this.Value
	ENDPROC

	PROCEDURE grd_factura.cGestiune.cCboGestiune.LostFocus
		DODEFAULT()
		
		IF this.Value <> thisform.cOldValue
			thisform.cOldvalue = this.Value
			REPLACE nume_gestiune WITH crsGestiune.nume_gestiune, id_gestiune WITH crsGestiune.id_gestiune IN crsFactura
		ENDIF 	
	ENDPROC

	PROCEDURE grd_factura.cGestiune.cCboGestiune.When
		thisform.cOldvalue = this.Value 
	ENDPROC

	PROCEDURE grd_factura.Init
		DODEFAULT()
		THIS.FontName= "Arial"
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_nomrute AS frm_termin OF "_frm_child.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_grdrow1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column3.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column3.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 450
		Name = "frm_nomrute"
		Width = 397
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 408
		_shape2.Left = 347
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		Lb_titlu_alb_b121.Caption = "Nomenclator rute"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 1
		BUT_TERMIN1.Left = 367
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_grdrow1' AS _grdrow WITH ;
		ColumnCount = 4, ;
		DeleteMark = .F., ;
		Height = 396, ;
		Left = 12, ;
		Name = "_grdrow1", ;
		Panel = 1, ;
		RecordSource = "crsnomRUTE", ;
		TabIndex = 3, ;
		Top = 48, ;
		Width = 372, ;
		Column1.ControlSource = "ruta", ;
		Column1.Name = "Column1", ;
		Column1.Width = 89, ;
		Column2.ControlSource = "delegat", ;
		Column2.Name = "Column2", ;
		Column2.Width = 109, ;
		Column3.ControlSource = "agent", ;
		Column3.Name = "Column3", ;
		Column4.ControlSource = "nrinmat", ;
		Column4.Name = "Column4"
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

	ADD OBJECT '_grdrow1.Column2.Header1' AS header WITH ;
		Caption = "Delegat", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column3.Header1' AS header WITH ;
		Caption = "Agent", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column4.Header1' AS header WITH ;
		Caption = "Nr. inmatriculare", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

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

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

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Left = 335, ;
		Name = "But_sterge1", ;
		TabIndex = 6, ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />
	
	PROCEDURE actualizeaza_grid1
		LPARAMETERS pcFiltru
		LOCAL lcFiltru
		lcFiltru=pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru=ponomrute.ca_baza1.cfiltru
		ENDIF
		save_grid_tag(thisform._grdrow1)
		ponomrute.ca_baza1.cfiltru=lcFiltru
		ponomrute.ca_baza1.afisare()
		restore_grid_tag(thisform._grdrow1)
		*!*	IF RECCOUNT('v_delegati')>0
			thisform._grdrow1.SetFocus()
		*!*	ELSE
		*!*		thisform.lb_delegati.SetFocus()
		*!*	ENDIF
		
	ENDPROC

	PROCEDURE do_adauga
		Private pniesire
		pniesire=0
		Select crsnomRUTE
		*!*	pcNume = loRec.nume
		*!*	pcPrenume = loRec.prenume
		Scatter Name loRec Blank
		Do Adauga_Modifica_Inregistrare With "nomrute",loRec,,"INSERT",,"addruta"
		 
		
		If pniesire=1
			This.actualizeaza_grid1()
		Endif
		
	ENDPROC

	PROCEDURE do_modifica
		Private pniesire
		pniesire=0
		Select crsnomRUTE
		Scatter Name loRec
		*!*	pcNume = loRec.nume
		*!*	pcPrenume = loRec.prenume
		Do Adauga_Modifica_Inregistrare With "nomrute",loRec,loRec.id_ruta,"UPDATE",,"modruta"
		
		If pniesire=1
			This.actualizeaza_grid1()
		Endif
		
		
	ENDPROC

	PROCEDURE do_sterge
		SELECT crsnomRUTE
		SCATTER NAME lorec
		Do STERGE_INREGISTRARE With "nomrute",loRec.id_ruta
		This.actualizeaza_grid1()
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_nomrute_nou AS frm_termin_renunt OF "_frm_child.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Cus_odata_nomrute1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_delegat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_masina" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_agent" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_agent
		*m: do_cauta_delegat
		*m: do_cauta_masina
		*p: nid
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 158
		Name = "frm_nomrute_nou"
		nid = .F.
		orec = .F.
		Width = 375
		_shape1.Name = "_shape1"
		_shape2.Left = 314
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		Lb_titlu_alb_b121.Caption = "Nume rută"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 7
		BUT_TERMIN1.Left = 344
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 5
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
		But_renunt1.Left = 315
		But_renunt1.Name = "But_renunt1"
		But_renunt1.TabIndex = 6
		But_renunt1.Top = 1
	*</PropValue>

	ADD OBJECT 'Clb_tx_simplu3' AS clb_tx_simplu WITH ;
		Left = 6, ;
		Name = "Clb_tx_simplu3", ;
		TabIndex = 1, ;
		Top = 35, ;
		Text_simplu1.ControlSource = "porec.ruta", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Rută", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_agent' AS ct_clb_cautare WITH ;
		cconditie = ISNULL(porec.id_agent), ;
		cprocedura = thisform.do_cauta_agent, ;
		cvar_afisata = porec.agent, ;
		Left = 5, ;
		Name = "Ct_clb_agent", ;
		TabIndex = 2, ;
		Top = 62, ;
		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(porec.id_delegat), ;
		cprocedura = thisform.do_cauta_delegat, ;
		cvar_afisata = porec.delegat, ;
		Left = 5, ;
		Name = "Ct_clb_delegat", ;
		TabIndex = 3, ;
		Top = 90, ;
		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 = isnull(porec.id_masina), ;
		cprocedura = thisform.do_cauta_masina, ;
		cvar_afisata = porec.nrinmat, ;
		Left = 5, ;
		Name = "Ct_clb_masina", ;
		TabIndex = 4, ;
		Top = 118, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Mașină", ;
		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 'Cus_odata_nomrute1' AS cus_odata_nomrute WITH ;
		Left = 6, ;
		Name = "Cus_odata_nomrute1", ;
		Top = 149
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="custom" />
	
	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)
			poRec.id_agent = loCauta.id_part
			poRec.agent = Alltrim(loCauta.denumire)
			Thisform.ct_clb_agent.Refresh()
			Thisform.ct_clb_delegat.SetFocus()
		Else
			poRec.id_agent = Null
			poRec.agent = []
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_delegat
		Local loCauta
		*!*	If Inlist(poRec.tip,23,25)
		*!*		loCauta=caut_delegati()
		*!*	Else
			loCauta=caut_delegati()
		*!*	Endif
		If !Empty(loCauta.id_responsabil)
			poRec.id_delegat = loCauta.id_responsabil
			poRec.delegat = Alltrim(loCauta.nume)
			Thisform.ct_clb_delegat.Refresh()
			Thisform.ct_clb_masina.SetFocus()
		Else
			poRec.id_delegat = Null
			poRec.delegat = []
		Endif
		
	ENDPROC

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

	PROCEDURE inainte_de_do_termin
		LOCAL PLRETURN
		
		lccontrol = UPPER(this.ActiveControl.BaseClass )
		IF   INLIST(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.Activecontrol.controlsource
			&lcval=thisform.ActiveControl.value
		ENDIF 	
		
		
		Do Case
		Case Empty(porec.ruta)
			aMessagebox('Nu ati completat numele rutei!',0+48,"Atentie")
			this.clb_tx_simplu3.text_simplu1.SetFocus()
			
			plreturn=.F.
		
		OTHERWISE
			PLRETURN=This.cus_odata_nomrute1.salvare(This.OREC,This.NID)
		
		ENDCASE 
		
		Return PLRETURN
		
		
		
		
	ENDPROC

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

ENDDEFINE

DEFINE CLASS frm_optiuni_facturare 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="pgfrm_optiuni" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Clb_zile_scadenta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Clb_zile_scadenta.But_help1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.op_scadenta_automata" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.op_scadere_stoc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Op_discountevidentiat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Ct_clb_pol_pret_stoc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.op_facturare_set" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Clb_marja_eroare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Op_lista_livrare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Op_salvare_pdf" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Op_salvare_pdf.But_help1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.op_memorare_procdisc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Ct_clb_pol_pret_k" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Op_coeficient_k" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.op_aviz_bon_fiscal" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.op_factura_email" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Ed_txt_subsol_fact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Ct_clb_fdoc_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.op_printdenumire" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtfooter_fact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtfooter_fact.Lb_simplu12" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.Lb_simplu12" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact8" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.op_conformitate" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page3.Ed_txt_subsol_aviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page3.Ct_clb_fdoc_aviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page3.Ct_clb_fdoc_aviz_retur" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page3.Ct_clb_fdoc_compensare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page3.Ct_clb_id_banca" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page3.Ct_clb_pol_pret_tr" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page3.Op_pret_subunitati" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page4.Op_format_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page4.Op_format_aviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page4.op_listare_curs" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page4.op_factura_chitanta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page4.op_listare_sold" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page5.Ct_clb_fdoc_proforma" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page6.Ct_clb_fdoc_chitanta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page6.Ct_clb_id_casa" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page6.Ct_clb_fdoc_bonfisc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page6.Ct_clb_fdoc_card" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_banca
		*m: do_cauta_casa
		*m: do_cauta_fdoc
		*m: do_cauta_politica
		*p: cfdocaviz
		*p: cfdocavizretur
		*p: cfdocbonfisc
		*p: cfdoccard
		*p: cfdocchit
		*p: cfdoccomp
		*p: cfdocfact
		*p: cfdocproforma
		*p: cnumebanca
		*p: cnumecasa
		*p: cpolpretk
		*p: cpolpretstoc
		*p: cpolprettr
		*p: natasamentefact
		*p: nidfdocaviz
		*p: nidfdocavizretur
		*p: nidfdocbonfisc
		*p: nidfdoccard
		*p: nidfdocchit
		*p: nidfdoccomp
		*p: nidfdocfact
		*p: nidfdocproforma
		*p: nidpartbanca
		*p: nidpartcasa
		*p: nidpolpretk
		*p: nidpolpretstoc
		*p: nidpolprettr
		*p: ntipoptiuni
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 3
		Caption = "Form"
		cfdocaviz = 
		cfdocavizretur = 
		cfdocbonfisc = 
		cfdoccard = 
		cfdocchit = 
		cfdoccomp = 
		cfdocfact = 
		cfdocproforma = 
		cnumebanca = 
		cnumecasa = 
		cpolpretk = 
		cpolpretstoc = 
		cpolprettr = 
		DoCreate = .T.
		FontCharSet = 238
		Height = 586
		Name = "frm_optiuni_facturare"
		natasamentefact = 0
		nidfdocaviz = 0
		nidfdocavizretur = 0
		nidfdocbonfisc = 0
		nidfdoccard = 0
		nidfdocchit = 0
		nidfdoccomp = 0
		nidfdocfact = 0
		nidfdocproforma = 0
		nidpartbanca = 0
		nidpartcasa = 0
		nidpolpretk = 0
		nidpolpretstoc = 
		nidpolprettr = 0
		ntipoptiuni = 0
		Width = 666
		_memberdata = <VFPData>
			<memberdata name="ntipoptiuni" display="nTipOptiuni"/>
			<memberdata name="nidfdocproforma" display="nIdFdocProforma"/>
			<memberdata name="cfdocproforma" display="cFdocProforma"/>
			<memberdata name="nidfdocbonfisc" display="nIdFdocBonFisc"/>
			<memberdata name="cfdocbonfisc" display="cFdocBonFisc"/>
			<memberdata name="nidfdoccard" display="nIdFdocCard"/>
			<memberdata name="cfdoccard" display="cFdocCard"/>
		</VFPData>
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 669
		_SHAPE2.Height = 29
		_SHAPE2.Left = 598
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = -1
		_SHAPE2.Width = 72
		LB_TITLU_ALB_B121.Caption = "OPȚIUNI FACTURARE"
		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 = 4
		BUT_TERMIN1.Left = 636
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 1
		BUT_TERMIN1.Top = 0
		Gridsort1.Left = 7
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 42
	*</PropValue>

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

	ADD OBJECT 'pgfrm_optiuni' AS _pageframe WITH ;
		ErasePage = .T., ;
		Height = 555, ;
		Left = 0, ;
		Name = "pgfrm_optiuni", ;
		PageCount = 6, ;
		TabIndex = 2, ;
		TabStyle = 0, ;
		Themes = .F., ;
		Top = 29, ;
		Width = 660, ;
		Page1.BackColor = 255,255,255, ;
		Page1.Caption = "\<Generale", ;
		Page1.Name = "Page1", ;
		Page1.PageOrder = 1, ;
		Page2.BackColor = 255,255,255, ;
		Page2.Caption = "\<Facturi", ;
		Page2.Name = "Page2", ;
		Page2.PageOrder = 2, ;
		Page3.BackColor = 255,255,255, ;
		Page3.Caption = "\<Avize", ;
		Page3.Name = "Page3", ;
		Page3.PageOrder = 3, ;
		Page4.BackColor = 255,255,255, ;
		Page4.Caption = "\<Listări", ;
		Page4.FontCharSet = 238, ;
		Page4.Name = "Page4", ;
		Page4.PageOrder = 6, ;
		Page5.BackColor = 255,255,255, ;
		Page5.Caption = "\<Proforme", ;
		Page5.Name = "Page5", ;
		Page5.PageOrder = 4, ;
		Page6.BackColor = 255,255,255, ;
		Page6.Caption = "Incasari", ;
		Page6.Name = "Page6", ;
		Page6.PageOrder = 5
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="pageframe" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Clb_marja_eroare' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_marja_eroare", ;
		TabIndex = 10, ;
		Top = 202, ;
		Width = 510, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "9.99", ;
		Text_simplu1.Left = 254, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Value = 0, ;
		Text_simplu1.Width = 69, ;
		Lb_simplu1.Caption = "Eroare la recalculare preț articol compus", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Clb_zile_scadenta' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_zile_scadenta", ;
		TabIndex = 3, ;
		Top = 64, ;
		Width = 510, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.InputMask = "999", ;
		Text_simplu1.Left = 126, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Zile scadență", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Clb_zile_scadenta.But_help1' AS but_help WITH ;
		clistaparametri = 1, ;
		Left = 92, ;
		Name = "But_help1", ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Ct_clb_pol_pret_k' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(thisform.nidpolpretk,0)), ;
		clista_parametri = 3, ;
		cprocedura = thisform.do_cauta_politica, ;
		cvar_afisata = thisform.cpolpretk, ;
		Height = 39, ;
		Left = 9, ;
		Name = "Ct_clb_pol_pret_k", ;
		TabIndex = 8, ;
		Top = 270, ;
		Width = 629, ;
		IMG_CAUTARE.Left = 575, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.Height = 34, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Politica de preț pentru facturare marfă în custodie", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Top = 8, ;
		CLB_TX_CAUTARE.Left = 1, ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Height = 23, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 321, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 6, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Width = 239, ;
		CLB_TX_CAUTARE.Top = 1, ;
		CLB_TX_CAUTARE.Width = 566
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Ct_clb_pol_pret_stoc' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(thisform.nidpolpretstoc,0)), ;
		clista_parametri = 1, ;
		cprocedura = thisform.do_cauta_politica, ;
		cvar_afisata = thisform.cpolpretstoc, ;
		Height = 39, ;
		Left = 9, ;
		Name = "Ct_clb_pol_pret_stoc", ;
		TabIndex = 6, ;
		Top = 237, ;
		Width = 601, ;
		img_cautare.Left = 572, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 8, ;
		clb_tx_cautare.Height = 34, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Politica de preț pentru avizare/facturare din stoc", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Lb_simplu1.Top = 8, ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Height = 23, ;
		clb_tx_cautare.Text_simplu1.Left = 321, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 6, ;
		clb_tx_cautare.Text_simplu1.Width = 239, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 566
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.op_aviz_bon_fiscal' AS op_tx_simplu WITH ;
		Height = 28, ;
		Left = 9, ;
		Name = "op_aviz_bon_fiscal", ;
		TabIndex = 12, ;
		Top = 338, ;
		Width = 510, ;
		Lb_simplu1.Caption = "Se imprimă aviz la bon fiscal?", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.TabIndex = 1, ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 174, ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 28, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 1, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 1, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 6, ;
		_optiongrup1.OPTION2.Value = 0, ;
		_optiongrup1.TabIndex = 2, ;
		_optiongrup1.Top = 0, ;
		_optiongrup1.Value = 1, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Op_coeficient_k' AS op_tx_simplu WITH ;
		Height = 28, ;
		Left = 9, ;
		Name = "Op_coeficient_k", ;
		TabIndex = 9, ;
		Top = 175, ;
		Width = 510, ;
		LB_SIMPLU1.Caption = "Coeficientul K este :", ;
		LB_SIMPLU1.Height = 18, ;
		LB_SIMPLU1.Left = 8, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 6, ;
		LB_SIMPLU1.Width = 119, ;
		_OPTIONGRUP1.AutoSize = .F., ;
		_OPTIONGRUP1.BorderStyle = 0, ;
		_OPTIONGRUP1.ButtonCount = 3, ;
		_OPTIONGRUP1.Height = 27, ;
		_OPTIONGRUP1.Left = 197, ;
		_OPTIONGRUP1.Name = "_OPTIONGRUP1", ;
		_OPTIONGRUP1.ndefault = 2, ;
		_OPTIONGRUP1.OPTION1.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION1.Caption = "invizibil", ;
		_OPTIONGRUP1.OPTION1.Left = 1, ;
		_OPTIONGRUP1.OPTION1.Name = "OPTION1", ;
		_OPTIONGRUP1.OPTION1.Top = 5, ;
		_OPTIONGRUP1.OPTION1.Value = 0, ;
		_OPTIONGRUP1.OPTION2.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION2.Caption = "vizibil, nemodificabil", ;
		_OPTIONGRUP1.OPTION2.Left = 63, ;
		_OPTIONGRUP1.OPTION2.Name = "OPTION2", ;
		_OPTIONGRUP1.OPTION2.Top = 5, ;
		_OPTIONGRUP1.OPTION2.Value = 0, ;
		_OPTIONGRUP1.Option3.AutoSize = .T., ;
		_OPTIONGRUP1.Option3.BackStyle = 0, ;
		_OPTIONGRUP1.Option3.Caption = "vizibil, modificabil", ;
		_OPTIONGRUP1.Option3.Height = 17, ;
		_OPTIONGRUP1.Option3.Left = 195, ;
		_OPTIONGRUP1.Option3.Name = "Option3", ;
		_OPTIONGRUP1.Option3.Top = 5, ;
		_OPTIONGRUP1.Option3.Value = 1, ;
		_OPTIONGRUP1.Option3.Width = 113, ;
		_OPTIONGRUP1.Top = 0, ;
		_OPTIONGRUP1.Value = 3, ;
		_OPTIONGRUP1.Width = 312
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Op_discountevidentiat' AS op_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Op_discountevidentiat", ;
		TabIndex = 4, ;
		Top = 92, ;
		Width = 510, ;
		Lb_simplu1.AutoSize = .F., ;
		Lb_simplu1.Caption = "Discountul pe articole este evidențiat pe factură și în notele contabile?", ;
		Lb_simplu1.Height = 31, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 10, ;
		Lb_simplu1.Width = 414, ;
		Lb_simplu1.WordWrap = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 1, ;
		_optiongrup1.OPTION2.AutoSize = .F., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 0, ;
		_optiongrup1.Top = 3, ;
		_optiongrup1.Value = 1, ;
		_optiongrup1.Width = 121
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.op_factura_email' AS op_tx_simplu WITH ;
		Height = 28, ;
		Left = 9, ;
		Name = "op_factura_email", ;
		TabIndex = 14, ;
		Top = 401, ;
		Width = 510, ;
		Lb_simplu1.Caption = "Se trimite email după emiterea facturii?", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 4, ;
		Lb_simplu1.Width = 228, ;
		_optiongrup1.AutoSize = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.ButtonCount = 3, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 334, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 2, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Left = 46, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 0, ;
		_optiongrup1.Option3.AutoSize = .T., ;
		_optiongrup1.Option3.Caption = "Confirmare", ;
		_optiongrup1.Option3.Height = 17, ;
		_optiongrup1.Option3.Left = 87, ;
		_optiongrup1.Option3.Name = "Option3", ;
		_optiongrup1.Option3.Top = 5, ;
		_optiongrup1.Option3.Value = 1, ;
		_optiongrup1.Option3.Width = 80, ;
		_optiongrup1.Top = 0, ;
		_optiongrup1.Value = 3, ;
		_optiongrup1.Width = 172
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.op_facturare_set' AS op_tx_simplu WITH ;
		Height = 28, ;
		Left = 9, ;
		Name = "op_facturare_set", ;
		TabIndex = 7, ;
		Top = 148, ;
		Width = 510, ;
		Lb_simplu1.AutoSize = .F., ;
		Lb_simplu1.Caption = "Se face facturare pe seturi?", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 159, ;
		Lb_simplu1.WordWrap = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 28, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 2, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 6, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.Top = 0, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Op_lista_livrare' AS op_tx_simplu WITH ;
		Height = 28, ;
		Left = 9, ;
		Name = "Op_lista_livrare", ;
		TabIndex = 11, ;
		Top = 311, ;
		Width = 510, ;
		Lb_simplu1.Caption = "Se imprimă și lista de livrare?", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 172, ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 28, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 2, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 6, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.Top = 0, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.op_memorare_procdisc' AS op_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "op_memorare_procdisc", ;
		TabIndex = 5, ;
		Top = 120, ;
		Width = 510, ;
		Lb_simplu1.AutoSize = .F., ;
		Lb_simplu1.Caption = "Se reține procentul de discount de la un reper la următorul?", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 10, ;
		Lb_simplu1.Width = 342, ;
		Lb_simplu1.WordWrap = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 2, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION2.AutoSize = .F., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.Top = 3, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 121
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Op_salvare_pdf' AS op_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Op_salvare_pdf", ;
		TabIndex = 13, ;
		ToolTipText = "*=documentele care pot fi salvate sunt : facturi, facturi in valuta, invoice, aviz ( fara cele din avizele de transfer pe baza de lucrare ), recapitulatii.", ;
		Top = 373, ;
		Width = 510, ;
		Lb_simplu1.Caption = "Se salvează documentele în baza de date?", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 250, ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 2, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Height = 17, ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION1.Width = 34, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Height = 17, ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.OPTION2.Width = 34, ;
		_optiongrup1.Top = 2, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Op_salvare_pdf.But_help1' AS but_help WITH ;
		clistaparametri = 2, ;
		Left = 270, ;
		Name = "But_help1", ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'pgfrm_optiuni.Page1.op_scadenta_automata' AS op_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "op_scadenta_automata", ;
		TabIndex = 2, ;
		Top = 36, ;
		Width = 510, ;
		Lb_simplu1.Caption = "Scadența este automată?", ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 2, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.Top = 1, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page1.op_scadere_stoc' AS op_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "op_scadere_stoc", ;
		TabIndex = 1, ;
		Top = 8, ;
		Width = 510, ;
		Lb_simplu1.AutoSize = .F., ;
		Lb_simplu1.Caption = "Se face scădere din stoc pentru articolele gestionabile?", ;
		Lb_simplu1.Height = 19, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 304, ;
		Lb_simplu1.WordWrap = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 2, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Height = 17, ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION1.Width = 34, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Height = 17, ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.OPTION2.Width = 34, ;
		_optiongrup1.Top = 2, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page2.Ct_clb_fdoc_factura' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(thisform.nidfdocfact) OR ISNULL(thisform.nidfdocfact), ;
		clista_parametri = 1, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = thisform.cfdocfact, ;
		Height = 31, ;
		Left = 8, ;
		Name = "Ct_clb_fdoc_factura", ;
		TabIndex = 1, ;
		Top = 16, ;
		Width = 510, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Document factură", ;
		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 'pgfrm_optiuni.Page2.ct_txtconform_fact' AS _container WITH ;
		Height = 201, ;
		Left = 9, ;
		Name = "ct_txtconform_fact", ;
		TabIndex = 6, ;
		Top = 316, ;
		Width = 638
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.Lb_simplu12' AS lb_simplu WITH ;
		Caption = "Text declaratie conformitate (maxim 8 linii. Se listeaza in subsolul facturii) ", ;
		FontBold = .T., ;
		Height = 18, ;
		Left = 6, ;
		Name = "Lb_simplu12", ;
		TabIndex = 9, ;
		ToolTipText = "Se pot folosi variabilele: <FIRMA>, <ADRESA>, <REG_COMERT>, <COD_FISCAL>, <FACTURA_NR>, <FACTURA_DATA)", ;
		Top = 4, ;
		Width = 479, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact1' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtConformFact1", ;
		TabIndex = 1, ;
		Top = 22, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact2' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtConformFact2", ;
		TabIndex = 2, ;
		Top = 44, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact3' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtConformFact3", ;
		TabIndex = 3, ;
		Top = 66, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact4' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtConformFact4", ;
		TabIndex = 4, ;
		Top = 88, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact5' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtConformFact5", ;
		TabIndex = 5, ;
		Top = 110, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact6' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtConformFact6", ;
		TabIndex = 6, ;
		Top = 132, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact7' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtConformFact7", ;
		TabIndex = 7, ;
		Top = 154, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtconform_fact.txtConformFact8' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtConformFact8", ;
		TabIndex = 8, ;
		Top = 176, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtfooter_fact' AS _container WITH ;
		Height = 141, ;
		Left = 9, ;
		Name = "ct_txtfooter_fact", ;
		TabIndex = 4, ;
		Top = 149, ;
		Width = 638
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtfooter_fact.Lb_simplu12' AS lb_simplu WITH ;
		Caption = "Text subsol factură (maxim 5 linii. Se listeaza sub totalul facturii)", ;
		FontBold = .T., ;
		Height = 18, ;
		Left = 6, ;
		Name = "Lb_simplu12", ;
		TabIndex = 17, ;
		Top = 4, ;
		Width = 413, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact1' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtFooterFact1", ;
		TabIndex = 8, ;
		Top = 22, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact2' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtFooterFact2", ;
		TabIndex = 9, ;
		Top = 44, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact3' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtFooterFact3", ;
		TabIndex = 10, ;
		Top = 66, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact4' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtFooterFact4", ;
		TabIndex = 11, ;
		Top = 88, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.ct_txtfooter_fact.txtFooterFact5' AS _textbox WITH ;
		Height = 23, ;
		Left = 8, ;
		MaxLength = 250, ;
		Name = "txtFooterFact5", ;
		TabIndex = 12, ;
		Top = 110, ;
		Width = 620
		*< END OBJECT: ClassLib="..\..\..\roaauto\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'pgfrm_optiuni.Page2.Ed_txt_subsol_fact' AS ed_tx_simplu WITH ;
		Height = 78, ;
		Left = 9, ;
		Name = "Ed_txt_subsol_fact", ;
		TabIndex = 3, ;
		Top = 72, ;
		Width = 638, ;
		_edbase1.Height = 48, ;
		_edbase1.Left = 13, ;
		_edbase1.Name = "_edbase1", ;
		_edbase1.Top = 26, ;
		_edbase1.Width = 596, ;
		_lbbase1.Caption = "Text final factură (Se listează la sfarsitul articolelor)", ;
		_lbbase1.Left = 8, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page2.op_conformitate' AS op_tx_simplu WITH ;
		Height = 28, ;
		Left = 9, ;
		Name = "op_conformitate", ;
		TabIndex = 5, ;
		Top = 289, ;
		Width = 510, ;
		Lb_simplu1.Caption = "Se listează Declaratia de Conformitate in subsolul facturii", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.TabIndex = 1, ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 332, ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 412, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.ndefault = 1, ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 1, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Left = 42, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 0, ;
		_optiongrup1.TabIndex = 2, ;
		_optiongrup1.Top = 0, ;
		_optiongrup1.Value = 1, ;
		_optiongrup1.Width = 81
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page2.op_printdenumire' AS op_tx_simplu WITH ;
		Height = 28, ;
		Left = 9, ;
		Name = "op_printdenumire", ;
		TabIndex = 2, ;
		Top = 45, ;
		Width = 510, ;
		LB_SIMPLU1.Caption = "Se listează denumirea articolului", ;
		LB_SIMPLU1.Height = 18, ;
		LB_SIMPLU1.Left = 8, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.TabIndex = 1, ;
		LB_SIMPLU1.Top = 6, ;
		LB_SIMPLU1.Width = 190, ;
		_OPTIONGRUP1.BorderStyle = 0, ;
		_OPTIONGRUP1.Height = 27, ;
		_OPTIONGRUP1.Left = 412, ;
		_OPTIONGRUP1.Name = "_OPTIONGRUP1", ;
		_OPTIONGRUP1.ndefault = 1, ;
		_OPTIONGRUP1.OPTION1.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION1.Caption = "Da", ;
		_OPTIONGRUP1.OPTION1.Left = 5, ;
		_OPTIONGRUP1.OPTION1.Name = "OPTION1", ;
		_OPTIONGRUP1.OPTION1.Top = 5, ;
		_OPTIONGRUP1.OPTION1.Value = 1, ;
		_OPTIONGRUP1.OPTION2.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION2.Caption = "Nu", ;
		_OPTIONGRUP1.OPTION2.Left = 42, ;
		_OPTIONGRUP1.OPTION2.Name = "OPTION2", ;
		_OPTIONGRUP1.OPTION2.Top = 5, ;
		_OPTIONGRUP1.OPTION2.Value = 0, ;
		_OPTIONGRUP1.TabIndex = 2, ;
		_OPTIONGRUP1.Top = 0, ;
		_OPTIONGRUP1.Value = 1, ;
		_OPTIONGRUP1.Width = 81
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page3.Ct_clb_fdoc_aviz' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(thisform.nidfdocaviz) OR ISNULL(thisform.nidfdocaviz), ;
		clista_parametri = 2, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = thisform.cfdocaviz, ;
		Left = 9, ;
		Name = "Ct_clb_fdoc_aviz", ;
		TabIndex = 1, ;
		Top = 16, ;
		Width = 510, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Document aviz", ;
		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 'pgfrm_optiuni.Page3.Ct_clb_fdoc_aviz_retur' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(thisform.nidfdocavizretur) OR ISNULL(thisform.nidfdocavizretur), ;
		clista_parametri = 3, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = thisform.cfdocavizretur, ;
		Left = 9, ;
		Name = "Ct_clb_fdoc_aviz_retur", ;
		TabIndex = 3, ;
		Top = 160, ;
		Width = 510, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Document aviz retur", ;
		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 'pgfrm_optiuni.Page3.Ct_clb_fdoc_compensare' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(thisform.nidfdoccomp) OR ISNULL(thisform.nidfdoccomp), ;
		clista_parametri = 4, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = thisform.cfdoccomp, ;
		Left = 9, ;
		Name = "Ct_clb_fdoc_compensare", ;
		TabIndex = 5, ;
		Top = 216, ;
		Width = 510, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Doc. compensare", ;
		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 'pgfrm_optiuni.Page3.Ct_clb_id_banca' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(thisform.nidpartbanca) OR ISNULL(thisform.nidpartbanca), ;
		cprocedura = thisform.do_cauta_banca, ;
		cvar_afisata = thisform.cnumebanca, ;
		Left = 9, ;
		Name = "Ct_clb_id_banca", ;
		TabIndex = 4, ;
		Top = 188, ;
		Width = 510, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Banca compensări", ;
		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 'pgfrm_optiuni.Page3.Ct_clb_pol_pret_tr' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(thisform.nidpolprettr,0)), ;
		cprocedura = thisform.do_cauta_politica, ;
		cvaloare_intoarsa = 2, ;
		cvar_afisata = thisform.cpolprettr, ;
		Height = 54, ;
		Left = 9, ;
		Name = "Ct_clb_pol_pret_tr", ;
		TabIndex = 6, ;
		Top = 244, ;
		Width = 510, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Height = 53, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Politica de preț pentru avize de transfer", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Height = 23, ;
		clb_tx_cautare.Text_simplu1.Left = 71, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 25, ;
		clb_tx_cautare.Text_simplu1.Width = 239, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 314
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page3.Ed_txt_subsol_aviz' AS ed_tx_simplu WITH ;
		Height = 108, ;
		Left = 9, ;
		Name = "Ed_txt_subsol_aviz", ;
		TabIndex = 2, ;
		Top = 45, ;
		Width = 638, ;
		_edbase1.Height = 72, ;
		_edbase1.Left = 13, ;
		_edbase1.Name = "_edbase1", ;
		_edbase1.Top = 26, ;
		_edbase1.Width = 481, ;
		_lbbase1.Caption = "Text de subsol pe aviz", ;
		_lbbase1.Left = 8, ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page3.Op_pret_subunitati' AS op_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Op_pret_subunitati", ;
		TabIndex = 7, ;
		Top = 297, ;
		Width = 510, ;
		Lb_simplu1.Caption = "Prețul listat pe avize este :", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 156, ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 28, ;
		_optiongrup1.Left = 364, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Cu TVA", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Fara TVA", ;
		_optiongrup1.OPTION2.Left = 70, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 6, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.Top = 1, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 142
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page4.op_factura_chitanta' AS op_tx_simplu WITH ;
		Height = 41, ;
		Left = 9, ;
		Name = "op_factura_chitanta", ;
		TabIndex = 4, ;
		Top = 164, ;
		Width = 510, ;
		Lb_simplu1.AutoSize = .F., ;
		Lb_simplu1.Caption = "Se listează factura și chitanța pe același formular?    ( doar dacă sunt cel mult 10 elemente pe factura A4 )", ;
		Lb_simplu1.Height = 47, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 402, ;
		Lb_simplu1.WordWrap = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Height = 17, ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION1.Width = 34, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Height = 17, ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.OPTION2.Width = 34, ;
		_optiongrup1.Top = 7, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page4.Op_format_aviz' AS op_tx_simplu WITH ;
		Height = 60, ;
		Left = 9, ;
		Name = "Op_format_aviz", ;
		TabIndex = 2, ;
		Top = 77, ;
		Width = 510, ;
		Lb_simplu1.Caption = "Alegeți formatul implicit pentru avize:", ;
		Lb_simplu1.Left = 7, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 5, ;
		_optiongrup1.AutoSize = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.ButtonCount = 3, ;
		_optiongrup1.Height = 62, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "A4", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 1, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "A5", ;
		_optiongrup1.OPTION2.Left = 5, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 22, ;
		_optiongrup1.OPTION2.Value = 0, ;
		_optiongrup1.Option3.BackStyle = 0, ;
		_optiongrup1.Option3.Caption = "A4 și A5", ;
		_optiongrup1.Option3.FontCharSet = 238, ;
		_optiongrup1.Option3.Height = 17, ;
		_optiongrup1.Option3.Left = 5, ;
		_optiongrup1.Option3.Name = "Option3", ;
		_optiongrup1.Option3.Top = 40, ;
		_optiongrup1.Option3.Width = 61, ;
		_optiongrup1.Top = 0, ;
		_optiongrup1.Width = 71
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page4.Op_format_factura' AS op_tx_simplu WITH ;
		Height = 60, ;
		Left = 9, ;
		Name = "Op_format_factura", ;
		TabIndex = 1, ;
		Top = 18, ;
		Width = 510, ;
		LB_SIMPLU1.Caption = "Alegeți formatul implicit pentru facturi:", ;
		LB_SIMPLU1.Left = 7, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 5, ;
		_optiongrup1.AutoSize = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.ButtonCount = 3, ;
		_optiongrup1.Height = 62, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "A4", ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 1, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "A5", ;
		_optiongrup1.OPTION2.Left = 5, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 22, ;
		_optiongrup1.OPTION2.Value = 0, ;
		_optiongrup1.Option3.BackStyle = 0, ;
		_optiongrup1.Option3.Caption = "A4 și A5", ;
		_optiongrup1.Option3.FontCharSet = 238, ;
		_optiongrup1.Option3.Height = 17, ;
		_optiongrup1.Option3.Left = 5, ;
		_optiongrup1.Option3.Name = "Option3", ;
		_optiongrup1.Option3.Top = 40, ;
		_optiongrup1.Option3.Width = 61, ;
		_optiongrup1.Top = 0, ;
		_optiongrup1.Width = 71
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page4.op_listare_curs' AS op_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "op_listare_curs", ;
		TabIndex = 3, ;
		Top = 136, ;
		Width = 510, ;
		Lb_simplu1.AutoSize = .F., ;
		Lb_simplu1.Caption = "Se listează cursul valutar pe factura/proforma în lei?", ;
		Lb_simplu1.Height = 19, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 304, ;
		Lb_simplu1.WordWrap = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Height = 17, ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 1, ;
		_optiongrup1.OPTION1.Width = 34, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Height = 17, ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 0, ;
		_optiongrup1.OPTION2.Width = 34, ;
		_optiongrup1.Top = 2, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page4.op_listare_sold' AS op_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "op_listare_sold", ;
		TabIndex = 5, ;
		Top = 204, ;
		Width = 510, ;
		Lb_simplu1.AutoSize = .F., ;
		Lb_simplu1.Caption = "Se listează soldul total client pe factura?", ;
		Lb_simplu1.Height = 18, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Width = 235, ;
		Lb_simplu1.WordWrap = .T., ;
		_optiongrup1.BorderStyle = 0, ;
		_optiongrup1.Height = 27, ;
		_optiongrup1.Left = 419, ;
		_optiongrup1.Name = "_optiongrup1", ;
		_optiongrup1.OPTION1.AutoSize = .T., ;
		_optiongrup1.OPTION1.Caption = "Da", ;
		_optiongrup1.OPTION1.Height = 17, ;
		_optiongrup1.OPTION1.Left = 5, ;
		_optiongrup1.OPTION1.Name = "OPTION1", ;
		_optiongrup1.OPTION1.Top = 5, ;
		_optiongrup1.OPTION1.Value = 0, ;
		_optiongrup1.OPTION1.Width = 34, ;
		_optiongrup1.OPTION2.AutoSize = .T., ;
		_optiongrup1.OPTION2.Caption = "Nu", ;
		_optiongrup1.OPTION2.Height = 17, ;
		_optiongrup1.OPTION2.Left = 55, ;
		_optiongrup1.OPTION2.Name = "OPTION2", ;
		_optiongrup1.OPTION2.Top = 5, ;
		_optiongrup1.OPTION2.Value = 1, ;
		_optiongrup1.OPTION2.Width = 34, ;
		_optiongrup1.Top = 2, ;
		_optiongrup1.Value = 2, ;
		_optiongrup1.Width = 94
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page5.Ct_clb_fdoc_proforma' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(thisform.nidfdocproforma) OR ISNULL(thisform.nidfdocproforma), ;
		clista_parametri = 6, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = thisform.cfdocproforma, ;
		Left = 9, ;
		Name = "Ct_clb_fdoc_proforma", ;
		TabIndex = 1, ;
		Top = 16, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Document proforma", ;
		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 'pgfrm_optiuni.Page6.Ct_clb_fdoc_bonfisc' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(thisform.nidfdocbonfisc,[])), ;
		clista_parametri = 7, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = thisform.cfdocbonfisc, ;
		Left = 9, ;
		Name = "Ct_clb_fdoc_bonfisc", ;
		TabIndex = 2, ;
		Top = 44, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Document bon fiscal", ;
		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 'pgfrm_optiuni.Page6.Ct_clb_fdoc_card' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(thisform.nidfdocCard,[])), ;
		clista_parametri = 8, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = thisform.cFdocCard, ;
		Left = 9, ;
		Name = "Ct_clb_fdoc_card", ;
		TabIndex = 3, ;
		Top = 72, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Document POS/Card", ;
		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 'pgfrm_optiuni.Page6.Ct_clb_fdoc_chitanta' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(thisform.nidfdocchit,[])), ;
		clista_parametri = 5, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		cvar_afisata = thisform.cfdocchit, ;
		Left = 9, ;
		Name = "Ct_clb_fdoc_chitanta", ;
		TabIndex = 1, ;
		Top = 16, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Document chitanță", ;
		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 'pgfrm_optiuni.Page6.Ct_clb_id_casa' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(thisform.nidpartcasa,[])), ;
		cprocedura = thisform.do_cauta_casa, ;
		cvar_afisata = thisform.cnumecasa, ;
		Left = 9, ;
		Name = "Ct_clb_id_casa", ;
		TabIndex = 4, ;
		Top = 106, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Casa încasări", ;
		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" />
	
	PROCEDURE do_cauta_banca
		Local loCauta
		loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Alegeti Banca??lAdaugCorespondente=>1??cCont=>5121]))
		
		If !Isnull(loCauta)
			Thisform.nidpartbanca = loCauta.id_part
			Thisform.cnumebanca = loCauta.denumire
		*!*		Thisform.pgfrm_optiuni.page3.ct_clb_id_banca.Refresh()
		Endif
	ENDPROC

	PROCEDURE do_cauta_casa
		Local loCauta
		loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Alegeti casa in lei??lAdaugCorespondente=>1??cCont=>5311]))
		
		If !Isnull(loCauta)
			Thisform.nidpartcasa = loCauta.id_part
			Thisform.cnumecasa = loCauta.denumire
		*!*		Thisform.pgfrm_optiuni.page3.ct_clb_id_banca.Refresh()
		Endif
	ENDPROC

	PROCEDURE do_cauta_fdoc
		Lparameters tnTipCautare
		Local loCauta
		loCauta = caut_fdoc()
		If !Isnull(loCauta)
			Do Case
				Case tnTipCautare = 1
					&&	factura
					Thisform.nidfdocfact = loCauta.id_fdoc
					Thisform.cfdocfact = loCauta.fel_document
				Case tnTipCautare = 2
					&&	aviz
					Thisform.nidfdocaviz = loCauta.id_fdoc
					Thisform.cfdocaviz = loCauta.fel_document
				Case tnTipCautare = 3
					&&	aviz retur
					Thisform.nidfdocavizretur = loCauta.id_fdoc
					Thisform.cfdocavizretur = loCauta.fel_document
				Case tnTipCautare = 4
					&&	document compensare
					Thisform.nidfdoccomp = loCauta.id_fdoc
					Thisform.cfdoccomp = loCauta.fel_document
				Case tnTipCautare = 5
					&&	document chitanta
					Thisform.nidfdocchit = loCauta.id_fdoc
					Thisform.cfdocchit = loCauta.fel_document
				Case tnTipCautare = 6
					&&	proforma
					Thisform.nIdFdocProforma = loCauta.id_fdoc
					Thisform.cFdocProforma = loCauta.fel_document
				Case tnTipCautare = 7
					&&	bon fiscal
					Thisform.nIdFdocBonFisc = loCauta.id_fdoc
					Thisform.cFdocBonFisc = loCauta.fel_document
				Case tnTipCautare = 8
					&&	POS/Card
					Thisform.nIdFdocCard = loCauta.id_fdoc
					Thisform.cFdocCard = loCauta.fel_document			
			Endcase
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_politica
		Lparameters tnParametru
		Local loCauta
		loCauta = caut_politici_curente_util()
		If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_pol,0))
			Do Case
				Case tnParametru = 1
					Thisform.nidpolpretstoc = loCauta.id_pol
					Thisform.cpolpretstoc = loCauta.nume
				Case tnParametru = 2
					Thisform.nidpolprettr = loCauta.id_pol
					Thisform.cpolprettr = loCauta.nume
				Otherwise
					Thisform.nidpolpretk = loCauta.id_pol	&&	modificare v 2.0.93
					Thisform.cpolpretk = loCauta.nume		&&	modificare v 2.0.93
			Endcase
		Endif
	ENDPROC

	PROCEDURE do_help
		Lparameters tnTip
		Local lcMesaj
		If tnTip = 1
			lcMesaj = Chr(9) + "Daca se doreste ca data scadenta sa fie la distanta de o luna de data documentului," + Chr(13) + Chr(10) + ;
				"atunci in acest camp se trece valoarea -1."
		Else
			lcMesaj = "Incepand cu versiunea 2.0.58, documentele care pot fi salvate in baza de date sunt :" + Chr(13) + Chr(10) + ;
				Chr(9) + "- factura" + Chr(13) + Chr(10) + ;
				Chr(9) + "- aviz ( in afara avizelor de transfer pe baza de lucrare )" + Chr(13) + Chr(10) + ;
				Chr(9) + "- invoice" + Chr(13) + Chr(10) + ;
				Chr(9) + "- factura fiscala in valuta" + Chr(13) + Chr(10) + ;
				Chr(9) + "- recapitulatie"
		Endif
		aMessageBox(lcMesaj,64,"Info")
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local lcSql, lcOptiuni, lcValori, lcSeparator, lcSqlAltele
		Local lcSetare, lcTextSubsolAviz, lcTextSubsolFact, llFacturaCuChitanta, lnAtasamenteFact
		Local lnCoefKFact, lnDiscountEvidentiat, lnFactSeturi, lnFormatAviz, lnFormatFactura, lnId_fdoc_aviz
		Local lnId_fdoc_aviz_retur, lnId_fdoc_bonfiscal, lnId_fdoc_chit, lnId_fdoc_comp, lnId_fdoc_fact
		Local lnId_fdoc_proforma, lnId_part_banca, lnId_part_casa, lnId_pol_pret_k, lnId_pol_pret_stoc
		Local lnId_pol_pret_tr, lnListCursVal, lnListaLivrare, lnMarjaEroareRepartizare, lnMemProcDisc
		Local lnPretListAviz, lnScadentaAutomata, lnScadereStoc, lnSucces, lnZileScadentaFact
		Local lnListareAvizBonFiscal, lnFacturaEmail, lnPrintDenumrie
		Local lcTextConformFact1, lcTextConformFact2, lcTextConformFact3, lcTextConformFact4
		Local lcTextConformFact5, lcTextConformFact6, lcTextFooterFact1, lcTextFooterFact2
		Local lcTextFooterFact3, lcTextFooterFact4, lcTextFooterFact5, lnPrintDenumire, lnTextConformitate, lnId_fdoc_card
		Local lcTextConformFact7, lcTextConformFact8, lnFacturaSold
		*:Global gcTextConformFact7, gcTextConformFact8, gnFacturaSold, gnId_fdoc_card
		*:Global gcTextConformFact1, gcTextConformFact2, gcTextConformFact3, gcTextConformFact4
		*:Global gcTextConformFact5, gcTextConformFact6, gcTextFooterFact1, gcTextFooterFact2
		*:Global gcTextFooterFact3, gcTextFooterFact4, gcTextFooterFact5, gnFacturaEmail, gnPrintDenumire
		*:Global gnTextConformitate
		*:Global gnId_fdoc_bonfiscal, gnId_fdoc_proforma, gnListareAvizBonFiscal
		*:Global gcTextSubsolAviz, gcTextSubsolFact, glFacturaCuChitanta, gnCoefKFact, gnDiscountEvidentiat
		*:Global gnFactSeturi, gnFormatAviz, gnFormatFactura, gnIdPolPretFactK, gnId_fdoc_aviz
		*:Global gnId_fdoc_aviz_retur, gnId_fdoc_chitanta, gnId_fdoc_compensare, gnId_fdoc_fact
		*:Global gnId_part_banca_comp, gnId_part_casa, gnId_pol_pret_stoc, gnId_pol_pret_tr, gnListCursVal
		*:Global gnListaLivrare, gnMarjaEroareRepartizare, gnMemProcDisc, gnPretListAviz, gnScadentaAutomata
		*:Global gnScadereStoc, gnZileScadentaFact
		lcSeparator = [|]
		lcOptiuni = []
		lcValori = []
		lcSqlAltele = []
		
		With Thisform.pgfrm_optiuni
			lcTextSubsolFact = .page2.ed_txt_subsol_fact._edbase1.Value
		
			lcTextFooterFact1 = .page2.ct_txtfooter_fact.txtFooterFact1.Value
			lcTextFooterFact2 = .page2.ct_txtfooter_fact.txtFooterFact2.Value
			lcTextFooterFact3 = .page2.ct_txtfooter_fact.txtFooterFact3.Value
			lcTextFooterFact4 = .page2.ct_txtfooter_fact.txtFooterFact4.Value
			lcTextFooterFact5 = .page2.ct_txtfooter_fact.txtFooterFact5.Value
		
			lnTextConformitate = Mod(.page2.op_conformitate._optiongrup1.Value, 2)
			lcTextConformFact1 = .page2.ct_txtconform_fact.txtConformFact1.Value
			lcTextConformFact2 = .page2.ct_txtconform_fact.txtConformFact2.Value
			lcTextConformFact3 = .page2.ct_txtconform_fact.txtConformFact3.Value
			lcTextConformFact4 = .page2.ct_txtconform_fact.txtConformFact4.Value
			lcTextConformFact5 = .page2.ct_txtconform_fact.txtConformFact5.Value
			lcTextConformFact6 = .page2.ct_txtconform_fact.txtConformFact6.Value
			lcTextConformFact7 = .page2.ct_txtconform_fact.txtConformFact7.Value
			lcTextConformFact8 = .page2.ct_txtconform_fact.txtConformFact8.Value
			
			lnPrintDenumire = Mod(.page2.op_printdenumire._optiongrup1.Value, 2)
			lnScadereStoc = Mod(.page1.op_scadere_stoc._optiongrup1.Value, 2)
			lnScadentaAutomata = Mod(.page1.op_scadenta_automata._optiongrup1.Value, 2)
			lnFactSeturi = Mod(.page1.op_facturare_set._optiongrup1.Value, 2)
			lnZileScadentaFact = .page1.clb_zile_scadenta.teXT_SIMPLU1.Value
			lnMarjaEroareRepartizare = .page1.clb_marja_eroare.teXT_SIMPLU1.Value
			lnListaLivrare = Mod(.page1.op_lista_livrare._optiongrup1.Value, 2)
			lnListareAvizBonFiscal = Mod(.page1.op_aviz_bon_fiscal._optiongrup1.Value, 2)
			lnFacturaEmail = .page1.op_factura_email._optiongrup1.Value
			lnFacturaEmail = Iif(m.lnFacturaEmail = 2, 0, Iif(m.lnFacturaEmail = 1, 1, 2))
			lnId_fdoc_fact = Thisform.nidfdocfact
			lnId_fdoc_aviz_retur = Thisform.nidfdocavizretur
			lnId_fdoc_aviz = Thisform.nidfdocaviz
			lnId_fdoc_comp = Thisform.nidfdoccomp
			lnId_fdoc_chit = Thisform.nidfdocchit
			lnId_fdoc_bonfiscal = Thisform.nIdFdocBonFisc
			lnId_fdoc_proforma = Thisform.nIdFdocProforma
			lnId_fdoc_card = Thisform.nIdFdocCard
		
			lnId_part_banca = Thisform.nidpartbanca
			lnId_part_casa = Thisform.nidpartcasa
			lnId_pol_pret_tr = Thisform.nidpolprettr
			lnId_pol_pret_stoc = Thisform.nidpolpretstoc
			*!*	modificare	v 2.0.58
			lnAtasamenteFact = .page1.op_salvare_pdf._optiongrup1.Value
			*!*	modificare	v 2.0.58	^
			*!*	modificare	v 2.0.67
			lnMemProcDisc = Mod(.page1.op_memorare_procdisc._optiongrup1.Value, 2)
			lnListCursVal = Mod(.page4.op_listare_curs._optiongrup1.Value, 2)
			lnFacturaSold = Mod(.page4.op_listare_sold._optiongrup1.Value, 2)	
			*!*	modificare	v 2.0.67	^
			lnDiscountEvidentiat = Mod(.page1.op_discountevidentiat._optiongrup1.Value, 2)
			If Thisform.nTipOptiuni = 1
				lnPretListAviz = .page3.op_pret_subunitati._optiongrup1.Value
				lcTextSubsolAviz = .page3.ed_txt_subsol_aviz._edbase1.Value
			Else
				lnPretListAviz = Nvl(gnPretListAviz, 2)
				lcTextSubsolAviz = Nvl(gcTextSubsolAviz, [])
			Endif
			With .page4
				*!*	modificare	v 2.0.80
				llFacturaCuChitanta = Iif(Mod(.op_factura_chitanta._optiongrup1.Value, 2) = 1, .T., .F.)
				*!*	modificare	v 2.0.80	^
				*!*	modificare	v 2.0.46
				lnFormatAviz = .op_format_aviz._optiongrup1.Value
				*!*	modificare	v 2.0.46	^
				lnFormatFactura = .op_format_factura._optiongrup1.Value
			Endwith
			*!*	modificare v 2.0.93
			lnId_pol_pret_k = Thisform.nidpolpretk
			lnCoefKFact = .page1.op_coeficient_k._optiongrup1.Value - 1
			*!*	modificare v 2.0.93	^	
		Endwith
		
		lcSetare = Sys(2001, 'EXACT')
		Set Exact On
		If lcTextSubsolFact <> Nvl(gcTextSubsolFact, [])
			lcValori = lcValori + Alltrim(lcTextSubsolFact) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTSUBSOLFACT] + lcSeparator
		Endif
		If lnPrintDenumire <> Nvl(gnPrintDenumire, 0)
			lcValori = lcValori + Alltrim(Str(lnPrintDenumire)) + lcSeparator
			lcOptiuni = lcOptiuni + [PRINTDENUMIRE] + lcSeparator
		Endif
		
		If lcTextFooterFact1 <> Nvl(gcTextFooterFact1, [])
			lcValori = lcValori + Alltrim(lcTextFooterFact1 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTFOOTERFACT1] + lcSeparator
		Endif
		If lcTextFooterFact2 <> Nvl(gcTextFooterFact2, [])
			lcValori = lcValori + Alltrim(lcTextFooterFact2 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTFOOTERFACT2] + lcSeparator
		Endif
		If lcTextFooterFact3 <> Nvl(gcTextFooterFact3, [])
			lcValori = lcValori + Alltrim(lcTextFooterFact3 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTFOOTERFACT3] + lcSeparator
		Endif
		If lcTextFooterFact4 <> Nvl(gcTextFooterFact4, [])
			lcValori = lcValori + Alltrim(lcTextFooterFact4 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTFOOTERFACT4] + lcSeparator
		Endif
		If lcTextFooterFact5 <> Nvl(gcTextFooterFact5, [])
			lcValori = lcValori + Alltrim(lcTextFooterFact5 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTFOOTERFACT5] + lcSeparator
		Endif
		
		If lnTextConformitate <> Nvl(gnTextConformitate, 0)
			lcValori = lcValori + Alltrim(Str(lnTextConformitate)) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMITATE] + lcSeparator
		Endif
		If lcTextConformFact1 <> Nvl(gcTextConformFact1, [])
			lcValori = lcValori + Alltrim(lcTextConformFact1 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMFACT1] + lcSeparator
		Endif
		If lcTextConformFact2 <> Nvl(gcTextConformFact2, [])
			lcValori = lcValori + Alltrim(lcTextConformFact2 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMFACT2] + lcSeparator
		Endif
		If lcTextConformFact3 <> Nvl(gcTextConformFact3, [])
			lcValori = lcValori + Alltrim(lcTextConformFact3 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMFACT3] + lcSeparator
		Endif
		If lcTextConformFact4 <> Nvl(gcTextConformFact4, [])
			lcValori = lcValori + Alltrim(lcTextConformFact4 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMFACT4] + lcSeparator
		Endif
		If lcTextConformFact5 <> Nvl(gcTextConformFact5, [])
			lcValori = lcValori + Alltrim(lcTextConformFact5 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMFACT5] + lcSeparator
		Endif
		If lcTextConformFact6 <> Nvl(gcTextConformFact6, [])
			lcValori = lcValori + Alltrim(lcTextConformFact6 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMFACT6] + lcSeparator
		Endif
		If lcTextConformFact7 <> Nvl(gcTextConformFact7, [])
			lcValori = lcValori + Alltrim(lcTextConformFact7 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMFACT7] + lcSeparator
		ENDIF
		If lcTextConformFact8 <> Nvl(gcTextConformFact8, [])
			lcValori = lcValori + Alltrim(lcTextConformFact8 ) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTCONFORMFACT8] + lcSeparator
		ENDIF
		
		If lcTextSubsolAviz <> Nvl(gcTextSubsolAviz, []) And Thisform.nTipOptiuni = 1
			lcValori = lcValori + Alltrim(lcTextSubsolAviz) + lcSeparator
			lcOptiuni = lcOptiuni + [TEXTSUBSOLAVIZ] + lcSeparator
		Endif
		
		If lnScadereStoc <> Nvl(gnScadereStoc, 0)
			lcValori = lcValori + Alltrim(Str(lnScadereStoc)) + lcSeparator
			lcOptiuni = lcOptiuni + [SCADERESTOC] + lcSeparator
		Endif
		
		If lnScadentaAutomata <> Nvl(gnScadentaAutomata, 0)
			lcValori = lcValori + Alltrim(Str(lnScadentaAutomata)) + lcSeparator
			lcOptiuni = lcOptiuni + [SCADENTAAUTOMATA] + lcSeparator
		Endif
		
		If lnFactSeturi <> Nvl(gnFactSeturi, 0)
			lcValori = lcValori + Alltrim(Str(lnFactSeturi)) + lcSeparator
			lcOptiuni = lcOptiuni + [FACTSETURI] + lcSeparator
		Endif
		
		If lnMarjaEroareRepartizare <> Nvl(gnMarjaEroareRepartizare, 0)
			lcValori = lcValori + Alltrim(Str(lnMarjaEroareRepartizare)) + lcSeparator
			lcOptiuni = lcOptiuni + [MARJAEROAREREPARTIZARE] + lcSeparator
		Endif
		
		If lnListaLivrare <> Nvl(gnListaLivrare, 0)
			lcValori = lcValori + Alltrim(Str(lnListaLivrare)) + lcSeparator
			lcOptiuni = lcOptiuni + [LISTALIVRARE] + lcSeparator
		Endif
		
		If m.lnListareAvizBonFiscal <> Nvl(m.gnListareAvizBonFiscal, 0)
			lcValori = lcValori + Alltrim(Str(m.lnListareAvizBonFiscal)) + lcSeparator
			lcOptiuni = lcOptiuni + [LISTAREAVIZBONFISCAL] + lcSeparator
		Endif
		
		If m.lnFacturaEmail <> Nvl(m.gnFacturaEmail, 0)
			lcValori = lcValori + Alltrim(Str(lnFacturaEmail)) + lcSeparator
			lcOptiuni = lcOptiuni + [FACTURAEMAIL] + lcSeparator
		Endif
		
		*!*	modificare	v 2.2.4
		*!*	If lnScadentaAutomata = 1 And lnZileScadentaFact <> Nvl(gnZileScadentaFact,0)
		If lnZileScadentaFact <> Nvl(gnZileScadentaFact, -1)
			*!*	modificare	v 2.2.4	^
			lcValori = lcValori + Alltrim(Str(lnZileScadentaFact)) + lcSeparator
			lcOptiuni = lcOptiuni + [ZILESCADENTAFACT] + lcSeparator
		Endif
		
		If lnId_fdoc_fact <> Nvl(gnId_fdoc_fact, 0)
			lcValori = lcValori + Alltrim(Str(lnId_fdoc_fact)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_FDOC_FACT] + lcSeparator
		Endif
		
		If lnId_fdoc_aviz <> Nvl(gnId_fdoc_aviz, 0)
			lcValori = lcValori + Alltrim(Str(lnId_fdoc_aviz)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_FDOC_AVIZ] + lcSeparator
		Endif
		
		If lnId_fdoc_aviz_retur <> Nvl(gnId_fdoc_aviz_retur, 0)
			lcValori = lcValori + Alltrim(Str(lnId_fdoc_aviz_retur)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_FDOC_AVIZ_RETUR] + lcSeparator
		Endif
		
		If lnId_fdoc_comp <> Nvl(gnId_fdoc_compensare, 0)
			lcValori = lcValori + Alltrim(Str(lnId_fdoc_comp)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_FDOC_COMPENSARE] + lcSeparator
		Endif
		
		If lnId_fdoc_chit <> Nvl(gnId_fdoc_chitanta, 0)
			lcValori = lcValori + Alltrim(Str(lnId_fdoc_chit)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_FDOC_CHITANTA] + lcSeparator
		Endif
		
		If lnId_fdoc_bonfiscal <> Nvl(gnId_fdoc_bonfiscal, 0)
			lcValori = lcValori + Alltrim(Str(lnId_fdoc_bonfiscal)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_FDOC_BONFISCAL] + lcSeparator
		Endif
		
		If lnId_fdoc_proforma <> Nvl(gnId_fdoc_proforma, 0)
			lcValori = lcValori + Alltrim(Str(lnId_fdoc_proforma)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_FDOC_PROFORMA] + lcSeparator
		Endif
		
		If lnId_fdoc_card <> Nvl(gnId_fdoc_card, 0)
			lcValori = lcValori + Alltrim(Str(lnId_fdoc_card)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_FDOC_CARD] + lcSeparator
		ENDIF
		
		If lnId_part_banca <> Nvl(gnId_part_banca_comp, 0)
			lcValori = lcValori + Alltrim(Str(lnId_part_banca)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_PART_BANCA_COMP] + lcSeparator
		Endif
		
		If lnId_part_casa <> Nvl(gnId_part_casa, 0)
			lcValori = lcValori + Alltrim(Str(lnId_part_casa)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_PART_CASA] + lcSeparator
		Endif
		
		If lnId_pol_pret_tr <> Nvl(gnId_pol_pret_tr, 0)
			lcValori = lcValori + Alltrim(Str(lnId_pol_pret_tr)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_POL_PRET_TR] + lcSeparator
		Endif
		
		If lnId_pol_pret_stoc <> Nvl(gnId_pol_pret_stoc, 0)
			lcValori = lcValori + Alltrim(Str(lnId_pol_pret_stoc)) + lcSeparator
			lcOptiuni = lcOptiuni + [ID_POL_PRET_STOC] + lcSeparator
			*!*	modificare	v 2.0.46
			If !Isnull(lnId_pol_pret_stoc)
				lcSqlAltele = [pack_facturare.modificare_politica_stoc(] + Alltrim(Str(lnId_pol_pret_stoc)) + [);]
				amessagebox(Chr(9) + Chr(9) + Chr(9) + "Ati modificat politica de preturi pentru facturarea din stoc." + Chr(13) + Chr(10) + ;
					  "Toate preturile de pe politica aleasa vor fi sterse, iar valuta va fi modificata in moneda nationala!", 48, "Atentie")
			Endif
			*!*	modificare	v 2.0.46	^
		Endif
		
		If lnDiscountEvidentiat <> Nvl(gnDiscountEvidentiat, 1)
			lcValori = lcValori + Alltrim(Str(lnDiscountEvidentiat)) + lcSeparator
			lcOptiuni = lcOptiuni + [DISCOUNTEVIDENTIAT] + lcSeparator
		Endif
		
		If lnPretListAviz <> Nvl(gnPretListAviz, 2) And Thisform.nTipOptiuni = 1
			lcValori = lcValori + Alltrim(Str(lnPretListAviz)) + lcSeparator
			lcOptiuni = lcOptiuni + [PRETLISTAVIZ] + lcSeparator
		Endif
		
		If lnFormatFactura <> Nvl(gnFormatFactura, 1)
			lcValori = lcValori + Alltrim(Str(lnFormatFactura)) + lcSeparator
			lcOptiuni = lcOptiuni + [FORMATFACTURA] + lcSeparator
		Endif
		
		*!*	modificare	v 2.0.46
		If lnFormatAviz <> Nvl(gnFormatAviz, 1)
			lcValori = lcValori + Alltrim(Str(lnFormatAviz)) + lcSeparator
			lcOptiuni = lcOptiuni + [FORMATAVIZ] + lcSeparator
		Endif
		*!*	modificare	v 2.0.46	^
		
		*!*	modificare	v 2.0.58
		If lnAtasamenteFact <> Thisform.natasamentefact
			lcValori = lcValori + Alltrim(Str(Mod(lnAtasamenteFact, 2))) + lcSeparator
			lcOptiuni = lcOptiuni + [ATASAMENTEFACT] + lcSeparator
		Endif
		*!*	modificare	v 2.0.58	^
		
		*!*	modificare	v 2.0.67
		If lnMemProcDisc <> Nvl(gnMemProcDisc, 0)
			lcValori = lcValori + Alltrim(Str(lnMemProcDisc)) + lcSeparator
			lcOptiuni = lcOptiuni + [MEMPROCDISC] + lcSeparator
		Endif
		If lnListCursVal <> Nvl(gnListCursVal, 1)
			lcValori = lcValori + Alltrim(Str(lnListCursVal)) + lcSeparator
			lcOptiuni = lcOptiuni + [LISTCURSVAL] + lcSeparator
		Endif
		*!*	modificare	v 2.0.67	^
		
		If m.lnFacturaSold <> Nvl(m.gnFacturaSold, 0)
			lcValori = m.lcValori + Alltrim(Str(m.lnFacturaSold)) + m.lcSeparator
			lcOptiuni = m.lcOptiuni + [FACTURASOLD] + m.lcSeparator
		ENDIF
		
		*!*	modificare	v 2.0.80
		If llFacturaCuChitanta <> Nvl(glFacturaCuChitanta, .F.)
			lcValori = lcValori + Iif(llFacturaCuChitanta, [T], [F]) + lcSeparator
			lcOptiuni = lcOptiuni + [FACTURACUCHITANTA] + lcSeparator
		Endif
		*!*	modificare	v 2.0.80	^
		
		*!*	modificare v 2.0.93
		If lnId_pol_pret_k <> Nvl(gnIdPolPretFactK, 0)
			lcValori = lcValori + Alltrim(Str(lnId_pol_pret_k)) + lcSeparator
			lcOptiuni = lcOptiuni + [IDPOLPRETFACTK] + lcSeparator
		Endif
		
		If lnCoefKFact <> Nvl(gnCoefKFact, 2)
			lcValori = lcValori + Alltrim(Str(lnCoefKFact)) + lcSeparator
			lcOptiuni = lcOptiuni + [COEFKFACT] + lcSeparator
		Endif
		*!*	modificare v 2.0.93	^
		
		Set Exact &lcSetare
		
		If !Empty(lcOptiuni) And !Empty(lcValori)
			If amessagebox("Sunteti sigur ca doriti sa salvati modificarile facute?", 4 + 32, "Confirmare") == 6
				*!*	modificare	v 2.0.46
				*!*				lcSql=[begin actualizeaza_optiuni(?gcNumeProgram,'] + lcOptiuni + [','] + lcValori + [','] + lcSeparator + ['); end;]
				lcSql = [begin actualizeaza_optiuni(?gcNumeProgram,'] + lcOptiuni + [','] + lcValori + [','] + lcSeparator + ['); ] + ;
					lcSqlAltele + [end;]
				*!*	modificare	v 2.0.46	^
				lnSucces = goExecutor.oExecute(lcSql)
				If lnSucces < 0
					amessagebox(goExecutor.cEroare, 0 + 16, "Eroare")
					Return .F.
				Else
					gnId_part_banca_comp = lnId_part_banca
					gnId_part_casa = lnId_part_casa
					gnId_fdoc_compensare = lnId_fdoc_comp
					gnId_fdoc_aviz_retur = lnId_fdoc_aviz_retur
					gnId_fdoc_fact = lnId_fdoc_fact
					gnId_fdoc_aviz = lnId_fdoc_aviz
					gnId_fdoc_chitanta = lnId_fdoc_chit
					gnId_fdoc_bonfiscal = lnId_fdoc_bonfiscal
					gnId_fdoc_proforma = lnId_fdoc_proforma
					gnId_fdoc_card = lnId_fdoc_card
		
					gnId_pol_pret_tr = lnId_pol_pret_tr
					gnId_pol_pret_stoc = lnId_pol_pret_stoc
					gcTextSubsolFact = lcTextSubsolFact
		
					gcTextFooterFact1 = m.lcTextFooterFact1
					gcTextFooterFact2 = m.lcTextFooterFact2
					gcTextFooterFact3 = m.lcTextFooterFact3
					gcTextFooterFact4 = m.lcTextFooterFact4
					gcTextFooterFact5 = m.lcTextFooterFact5
		
					gnTextConformitate = m.lnTextConformitate
					gcTextConformFact1 = m.lcTextConformFact1
					gcTextConformFact2 = m.lcTextConformFact2
					gcTextConformFact3 = m.lcTextConformFact3
					gcTextConformFact4 = m.lcTextConformFact4
					gcTextConformFact5 = m.lcTextConformFact5
					gcTextConformFact6 = m.lcTextConformFact6
					gcTextConformFact7 = m.lcTextConformFact7
					gcTextConformFact8 = m.lcTextConformFact8
								
					If Thisform.nTipOptiuni = 1
						gcTextSubsolAviz = lcTextSubsolAviz
						gnPretListAviz = lnPretListAviz
					Endif
					gnScadereStoc = lnScadereStoc
					gnFactSeturi = lnFactSeturi
					gnMarjaEroareRepartizare = lnMarjaEroareRepartizare
					gnListaLivrare = lnListaLivrare
					gnListareAvizBonFiscal = m.lnListareAvizBonFiscal
					gnFacturaEmail = m.lnFacturaEmail
					gnScadentaAutomata = lnScadentaAutomata
					*!*	modificare	v 2.2.4
					*!*				If gnScadentaAutomata  = 1
					gnZileScadentaFact = lnZileScadentaFact
					*!*				Endif
					*!*	modificare	v 2.2.4	^
					gnDiscountEvidentiat = lnDiscountEvidentiat
					*!*	modificare	v 2.0.46
					*!*					gnVizualFact = lnVizualFact
					*!*					gnVizualAviz = lnVizualAviz
					*!*					gnVizualProf = lnVizualProf
					*!*	modificare	v 2.0.46	^
					gnFormatFactura = lnFormatFactura
					*!*	modificare	v 2.0.46
					gnFormatAviz = lnFormatAviz
					*!*	modificare	v 2.0.46	^
					*!*	modificare	v 2.0.67
					gnListCursVal = lnListCursVal
					gnFacturaSold = m.lnFacturaSold
					gnMemProcDisc = lnMemProcDisc
					*!*	modificare	v 2.0.67	^
					*!*	modificare	v 2.0.80
					glFacturaCuChitanta = llFacturaCuChitanta
					*!*	modificare	v 2.0.80	^
					*!*	modificare v 2.0.93
					gnIdPolPretFactK = lnId_pol_pret_k
					gnCoefKFact = lnCoefKFact
					*!*	modificare v 2.0.93		^
					gnPrintDenumire = lnPrintDenumire
					amessagebox("Modificarile au fost salvate!", 0 + 64, "Salvare optiuni")
				Endif
			Endif
		Endif
		
		Return .T.
		 
	ENDPROC

	PROCEDURE Init
		Lparameters tnTipOptiuni
		
		Thisform.nTipOptiuni = tnTipOptiuni
		If Thisform.nTipOptiuni = 2 && ROACONTRACTE
			Thisform.pgfrm_optiuni.RemoveObject('page3')
			Thisform.pgfrm_optiuni.page4.Op_format_aviz.Visible = .F.
		Endif
		
		Local lcFdocFact,lcFdocAviz,lcFdocAvizRetur,lcPolPretK, lcFdocBonFiscal, lcFdocProforma, lcFdocCard
		Store "" To lcFdocFact,lcFdocAviz,lcFdocAvizRetur,lcFdocChitanta,lcFdocComp,lcNumeBanca,lcNumeCasa,lcPolPretTr,lcPolPretStoc,lcPolPretK, lcFdocBonFiscal, lcFdocProforma, lcFdocCard
		DoDefault()
		
		actualizeaza_document(1,@gnId_fdoc_fact,@lcFdocFact)
		actualizeaza_document(21,@gnId_fdoc_aviz,@lcFdocAviz)
		actualizeaza_document(24,@gnId_fdoc_aviz_retur,@lcFdocAvizRetur)
		actualizeaza_document(0,@gnId_fdoc_compensare,@lcFdocComp)
		actualizeaza_document(-100,@gnId_fdoc_chitanta,@lcFdocChitanta)
		actualizeaza_document(-101,@gnId_fdoc_bonfiscal,@lcFdocBonFiscal)
		actualizeaza_document(-102,@gnId_fdoc_proforma,@lcFdocProforma)
		actualizeaza_document(-103,@gnId_fdoc_card,@lcFdocCard)
		
		actualizeaza_partener_fact(0,@gnId_part_banca_comp,@lcNumeBanca)
		actualizeaza_partener_fact(1,@gnId_part_casa,@lcNumeCasa)
		
		actualizeaza_politica_pret(23,@gnId_pol_pret_tr,@lcPolPretTr)
		actualizeaza_politica_pret(1,@gnId_pol_pret_stoc,@lcPolPretStoc)
		*!*	modificare	v 2.0.58
		Thisform.natasamentefact = 2-Nvl(citeste_optiune_firma([ATASAMENTEFACT]),0)
		*!*	modificare	v 2.0.58	^
		*!*	modificare	v 2.0.93
		actualizeaza_politica_pret(48,@gnIdPolPretFactK,@lcPolPretK)
		*!*	modificare	v 2.0.93	^
		
		This.nidfdocfact = Nvl(gnId_fdoc_fact,0)
		This.nidfdocaviz = Nvl(gnId_fdoc_aviz,0)
		This.nidfdoccomp = Nvl(gnId_fdoc_compensare,0)
		This.nidfdocavizretur = Nvl(gnId_fdoc_aviz_retur,0)
		This.nidfdocchit = Nvl(gnId_fdoc_chitanta,0)
		This.nIdFdocBonFisc = Nvl(gnId_fdoc_bonfiscal,0)
		This.nIdFdocProforma = Nvl(gnId_fdoc_proforma,0)
		This.nIdFdocCard = Nvl(gnId_fdoc_card,0)
		This.nidpartbanca = Nvl(gnId_part_banca_comp,0)
		This.nidpartcasa = Nvl(gnId_part_casa,0)
		This.nidpolprettr = Nvl(gnId_pol_pret_tr,0)
		This.nidpolpretstoc = Nvl(gnId_pol_pret_stoc,0)
		This.cfdocfact = lcFdocFact
		This.cfdocaviz = lcFdocAviz
		This.cfdocavizretur = lcFdocAvizRetur
		This.cfdoccomp = lcFdocComp
		This.cfdocchit = lcFdocChitanta
		This.cFdocBonFisc = lcFdocBonFiscal
		This.cFdocProforma = lcFdocProforma
		This.cFdocCard = lcFdocCard
		
		This.cnumebanca = lcNumeBanca
		This.cnumecasa = lcNumeCasa
		This.cpolprettr = lcPolPretTr
		This.cpolpretstoc = lcPolPretStoc
		*!*	modificare	v 2.0.93
		Thisform.cpolpretk = lcPolPretK
		Thisform.nidpolpretk = Nvl(gnIdPolPretFactK,0)
		*!*	modificare	v 2.0.93	^
		
		With Thisform.pgfrm_optiuni	
			With .page1
				If Nvl(gnScadereStoc,0)=1
					.op_scadere_stoc._optiongrup1.Value=1
				Endif
		
				If Nvl(gnScadentaAutomata,0)=1
					.op_scadenta_automata._optiongrup1.Value=1
			*!*	modificare	v 2.2.4	:	daca nu e scadenta automata, atunci valoarea lui gnZileScadentaFact va fi doar propusa
			*!*			.page1.clb_zile_scadenta.teXT_SIMPLU1.ReadOnly=.F.
			*!*			.page1.clb_zile_scadenta.teXT_SIMPLU1.Value=Nvl(gnZileScadentaFact,0)
			*!*		Endif
				Endif
				.clb_zile_scadenta.teXT_SIMPLU1.Value=Nvl(gnZileScadentaFact,-1)
			*!*	modificare	v 2.2.4	^
		
				If Nvl(gnDiscountEvidentiat,1) <> 1
					.op_discountevidentiat._optiongrup1.Value = 2
				Endif
		
				If Nvl(gnFactSeturi,0)=1
					.op_facturare_set._optiongrup1.Value=1
					.clb_marja_eroare.teXT_SIMPLU1.ReadOnly = .F.
				Endif
		
				.clb_marja_eroare.teXT_SIMPLU1.Value = Nvl(gnMarjaEroareRepartizare,0)
		
				If Nvl(gnListaLivrare,0)=1
					.op_lista_livrare._optiongrup1.Value = 1
				Endif
		
				If Nvl(m.gnListareAvizBonFiscal,0) = 0
					.op_aviz_bon_fiscal._optiongrup1.Value = 0
				ENDIF
		
		
				.op_factura_email._optiongrup1.Value = IIF(Nvl(m.gnFacturaEmail,0) = 0, 2, IIF(Nvl(m.gnFacturaEmail,0) = 1, 1, 3))
			
				.ct_clb_pol_pret_stoc.clb_tx_cautare.teXT_SIMPLU1.Refresh()
				*!*	modificare	v 2.0.58
				.op_salvare_pdf._optiongrup1.Value = Thisform.natasamentefact
				.op_salvare_pdf.Refresh()
				*!*	modificare	v 2.0.58	^
				*!*	modificare	v 2.0.67
				.op_memorare_procdisc._optiongrup1.Value =  Iif(Nvl(gnMemProcDisc,0)=1,1,2)
				*!*	modificare	v 2.0.67	^
				*!*	modificare	v 2.0.93
				.Ct_clb_pol_pret_k.clb_tx_cautare.teXT_SIMPLU1.Refresh()
				.Op_coeficient_k._optiongrup1.Value =  Nvl(gnCoefKFact,2)+1
				*!*	modificare	v 2.0.93	^
			Endwith
		
			WITH .page2
				.ed_txt_subsol_fact._edbase1.Value = NVL(gcTextSubsolFact, '')
				.op_printdenumire._optiongrup1.Value = IIF(NVL(m.gnPrintDenumire,0) = 1, 1, 2)
						
				.ct_txtfooter_fact.txtFooterFact1.Value = ALLTRIM(NVL(m.gcTextFooterFact1, ''))
				.ct_txtfooter_fact.txtFooterFact2.Value = ALLTRIM(NVL(m.gcTextFooterFact2, ''))
				.ct_txtfooter_fact.txtFooterFact3.Value = ALLTRIM(NVL(m.gcTextFooterFact3, ''))
				.ct_txtfooter_fact.txtFooterFact4.Value = ALLTRIM(NVL(m.gcTextFooterFact4, ''))
				.ct_txtfooter_fact.txtFooterFact5.Value = ALLTRIM(NVL(m.gcTextFooterFact5, ''))
				
				.op_conformitate._optiongrup1.Value = IIF(NVL(m.gnTextConformitate,0) = 1, 1, 2)	
		
				.ct_txtconform_fact.txtConformFact1.Value = ALLTRIM(NVL(m.gcTextConformFact1, ''))
				.ct_txtconform_fact.txtConformFact2.Value = ALLTRIM(NVL(m.gcTextConformFact2, ''))
				.ct_txtconform_fact.txtConformFact3.Value = ALLTRIM(NVL(m.gcTextConformFact3, ''))
				.ct_txtconform_fact.txtConformFact4.Value = ALLTRIM(NVL(m.gcTextConformFact4, ''))
				.ct_txtconform_fact.txtConformFact5.Value = ALLTRIM(NVL(m.gcTextConformFact5, ''))
				.ct_txtconform_fact.txtConformFact6.Value = ALLTRIM(NVL(m.gcTextConformFact6, ''))					
				.ct_txtconform_fact.txtConformFact7.Value = ALLTRIM(NVL(m.gcTextConformFact7, ''))
				.ct_txtconform_fact.txtConformFact8.Value = ALLTRIM(NVL(m.gcTextConformFact8, ''))					
						
				.ct_clb_fdoc_factura.clb_tx_cautare.teXT_SIMPLU1.Refresh()		
			ENDWITH && .page2
		
			If Thisform.nTipOptiuni <> 2 && 2 = ROACONTRACTE, NU ARAT AVIZELE
				With .page3
					.ed_txt_subsol_aviz._edbase1.Value=gcTextSubsolAviz
					.ct_clb_fdoc_aviz.clb_tx_cautare.teXT_SIMPLU1.Refresh()
					.ct_clb_fdoc_aviz_retur.clb_tx_cautare.teXT_SIMPLU1.Refresh()
					.ct_clb_fdoc_compensare.clb_tx_cautare.teXT_SIMPLU1.Refresh()
					.ct_clb_id_banca.clb_tx_cautare.teXT_SIMPLU1.Refresh()
					.ct_clb_pol_pret_tr.clb_tx_cautare.teXT_SIMPLU1.Refresh()
					.op_pret_subunitati._optiongrup1.Value = Nvl(gnPretListAviz,2)
				Endwith
			Endif
		
			With .page4
				.op_format_factura._optiongrup1.Value = gnFormatFactura
				*!*	modificare	v 2.0.46
				.op_format_aviz._optiongrup1.Value = gnFormatAviz
				*!*	modificare	v 2.0.46	^
				*!*	modificare	v 2.0.67
				.op_listare_curs._optiongrup1.Value =  Iif(Nvl(gnListCursVal,1)=1,1,2)
				.op_listare_sold._optiongrup1.Value =  Iif(Nvl(gnFacturaSold,1)=1,1,2)		
				*!*	modificare	v 2.0.67	^
				*!*	modificare	v 2.0.80
				.op_factura_chitanta._optiongrup1.Value =  Iif(Nvl(glFacturaCuChitanta,.F.),1,2)
				*!*	modificare	v 2.0.80	^
			ENDWITH
			
			With .page5
				.ct_clb_fdoc_proforma.clb_tx_cautare.teXT_SIMPLU1.Refresh()
			ENDWITH
			
			With .page6
				.ct_clb_fdoc_chitanta.clb_tx_cautare.teXT_SIMPLU1.Refresh()
				.ct_clb_fdoc_bonfisc.clb_tx_cautare.teXT_SIMPLU1.Refresh()		
				.ct_clb_fdoc_card.clb_tx_cautare.teXT_SIMPLU1.Refresh()				
				.ct_clb_id_casa.clb_tx_cautare.teXT_SIMPLU1.Refresh()
			Endwith
			
		Endwith
		
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page1.Op_coeficient_k._OPTIONGRUP1.Click
		If This.Value = 1
			This.Parent.Parent.clb_marja_eroare.text_simplu1.Enabled = .T.
		Else
			This.Parent.Parent.clb_marja_eroare.text_simplu1.Enabled = .F.
		Endif
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page1.op_facturare_set._optiongrup1.Click
		If This.Value = 1
			This.Parent.Parent.clb_marja_eroare.text_simplu1.Enabled = .T.
		Else
			This.Parent.Parent.clb_marja_eroare.text_simplu1.Enabled = .F.
		Endif
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page1.op_scadenta_automata._optiongrup1.Click
		*!*	modificare	v 2.2.4
		*!*	If This.Value=1
		*!*		This.Parent.Parent.clb_zile_scadenta.teXT_SIMPLU1.ReadOnly=.F.
		*!*		This.Parent.Parent.clb_zile_scadenta.teXT_SIMPLU1.SetFocus()
		*!*	Else
		*!*		This.Parent.Parent.clb_zile_scadenta.teXT_SIMPLU1.ReadOnly=.T.
		*!*	endif
		DoDefault()
		*!*	modificare	v 2.2.4	^
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_optiuni_facturare_local 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="pgfrm_optiuni" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.shape_cod" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.ct_codmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.lb_explicatie_cod" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1._shape1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.ct_denumire" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page1.Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Op_list_aviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Ct_impr_rapoarte" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Ct_impr_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Ct_impr_aviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Op_list_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Ct_impr_proforma" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="pgfrm_optiuni.Page2.Op_list_proforma" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_adauga_modificare_reg
		*m: do_cauta_imprimanta
		*m: initializeaza_setari_locale
		*m: salveaza_setari_locale
		*p: cimpraviz
		*p: cimpravizini
		*p: cimprfact
		*p: cimprfactini
		*p: cimprprof
		*p: cimprprofini
		*p: cimprrap
		*p: cimprrapini
		*p: cvizualaviz
		*p: cvizualavizini
		*p: cvizualfact
		*p: cvizualfactini
		*p: cvizualprof
		*p: cvizualprofini
		*p: ncriteriucod		&& Criteriu cod.
		*p: ncriteriucodini		&& Criteriu de cautare initial la cod material.
		*p: ncriteriudenumire		&& Criteriu denumire
		*p: ncriteriudenumireini		&& Criteriu initial de cautare denumire
		*p: ntipoptiuni
		*a: amodificariregistru[10,2]
	*</DefinedPropArrayMethod>

	*<PropValue>
		cimpraviz = 
		cimpravizini = 
		cimprfact = 
		cimprfactini = 
		cimprprof = 
		cimprprofini = 
		cimprrap = 
		cimprrapini = 
		cvizualaviz = 1
		cvizualavizini = 1
		cvizualfact = 1
		cvizualfactini = 1
		cvizualprof = 1
		cvizualprofini = 1
		DoCreate = .T.
		FontCharSet = 238
		Height = 360
		Name = "frm_optiuni_facturare_local"
		ncriteriucod = 2
		ncriteriucodini = 2
		ncriteriudenumire = 2
		ncriteriudenumireini = 2
		ntipoptiuni = 0
		Width = 528
		_memberdata = <VFPData>
			<memberdata name="ntipoptiuni" display="nTipOptiuni"/>
			<memberdata name="ncriteriudenumire" display="nCriteriuDenumire"/>
			<memberdata name="ncriteriucod" display="nCriteriuCod"/>
			<memberdata name="ncriteriucodini" display="nCriteriuCodIni"/>
			<memberdata name="ncriteriudenumireini" display="nCriteriuDenumireIni"/>
		</VFPData>
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 528
		_SHAPE2.Height = 29
		_SHAPE2.Left = 457
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = -1
		_SHAPE2.Width = 72
		LB_TITLU_ALB_B121.Caption = "OPTIUNI"
		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 = 4
		BUT_TERMIN1.Left = 496
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Top = 0
		Gridsort1.Left = 7
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 42
	*</PropValue>

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

	ADD OBJECT 'pgfrm_optiuni' AS _pageframe WITH ;
		ErasePage = .T., ;
		Height = 293, ;
		Left = 24, ;
		Name = "pgfrm_optiuni", ;
		PageCount = 2, ;
		TabIndex = 1, ;
		TabStyle = 0, ;
		Themes = .F., ;
		Top = 43, ;
		Width = 480, ;
		Page1.BackColor = 255,255,255, ;
		Page1.Caption = "\<Generale", ;
		Page1.Name = "Page1", ;
		Page1.PageOrder = 1, ;
		Page2.BackColor = 255,255,255, ;
		Page2.Caption = "\<Listări", ;
		Page2.Name = "Page2", ;
		Page2.PageOrder = 2
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="pageframe" />

	ADD OBJECT 'pgfrm_optiuni.Page1._shape1' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 36, ;
		Left = 37, ;
		Name = "_shape1", ;
		Top = 48, ;
		Width = 396, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'pgfrm_optiuni.Page1.ct_codmat' AS criteriu_text WITH ;
		ControlSource = "Thisform.ncriteriucod", ;
		FontName = "Arial Narrow", ;
		Height = 24, ;
		Left = 335, ;
		Name = "ct_codmat", ;
		TabIndex = 1, ;
		Top = 20, ;
		Width = 84, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'pgfrm_optiuni.Page1.ct_denumire' AS criteriu_text WITH ;
		ControlSource = "Thisform.ncriteriudenumire", ;
		FontName = "Arial Narrow", ;
		Height = 24, ;
		Left = 335, ;
		Name = "ct_denumire", ;
		TabIndex = 2, ;
		Top = 55, ;
		Width = 84, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="combobox" />

	ADD OBJECT 'pgfrm_optiuni.Page1.lb_explicatie_cod' AS lb_simplu WITH ;
		Caption = 'Criteriul de căutare pentru "cod material" este :', ;
		Left = 48, ;
		Name = "lb_explicatie_cod", ;
		TabIndex = 3, ;
		Top = 24
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'pgfrm_optiuni.Page1.Lb_simplu1' AS lb_simplu WITH ;
		Caption = 'Criteriul de căutare pentru "denumire" este :', ;
		Left = 48, ;
		Name = "Lb_simplu1", ;
		TabIndex = 4, ;
		Top = 59
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'pgfrm_optiuni.Page1.shape_cod' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 36, ;
		Left = 37, ;
		Name = "shape_cod", ;
		Top = 13, ;
		Width = 396, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'pgfrm_optiuni.Page2.Ct_impr_aviz' AS ct_clb_cautare WITH ;
		cconditie = !EMPTY(thisform.cimpraviz), ;
		clista_parametri = 2, ;
		cprocedura = thisform.do_cauta_imprimanta, ;
		cvar_afisata = thisform.cimpraviz, ;
		Left = 46, ;
		Name = "Ct_impr_aviz", ;
		TabIndex = 5, ;
		Top = 118, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Imprimantă avize", ;
		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 'pgfrm_optiuni.Page2.Ct_impr_factura' AS ct_clb_cautare WITH ;
		cconditie = !EMPTY(thisform.cimprfact), ;
		clista_parametri = 1, ;
		cprocedura = thisform.do_cauta_imprimanta, ;
		cvar_afisata = thisform.cimprfact, ;
		Left = 46, ;
		Name = "Ct_impr_factura", ;
		TabIndex = 2, ;
		Top = 51, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Imprimantă facturi", ;
		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 'pgfrm_optiuni.Page2.Ct_impr_proforma' AS ct_clb_cautare WITH ;
		cconditie = !EMPTY(thisform.cimprprof), ;
		clista_parametri = 3, ;
		cprocedura = thisform.do_cauta_imprimanta, ;
		cvar_afisata = thisform.cimprprof, ;
		Left = 46, ;
		Name = "Ct_impr_proforma", ;
		TabIndex = 8, ;
		Top = 185, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Imprimantă proforme", ;
		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 'pgfrm_optiuni.Page2.Ct_impr_rapoarte' AS ct_clb_cautare WITH ;
		cconditie = !EMPTY(thisform.cimprrap), ;
		clista_parametri = 4, ;
		cprocedura = thisform.do_cauta_imprimanta, ;
		cvar_afisata = thisform.cimprrap, ;
		Left = 46, ;
		Name = "Ct_impr_rapoarte", ;
		TabIndex = 9, ;
		Top = 213, ;
		Visible = .F., ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Imprimantă alte listări", ;
		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 'pgfrm_optiuni.Page2.Op_list_aviz' AS op_tx_simplu WITH ;
		Height = 40, ;
		Left = 47, ;
		Name = "Op_list_aviz", ;
		TabIndex = 4, ;
		Top = 80, ;
		Width = 314, ;
		Lb_simplu1.Caption = "Se vizualizează avizul înainte de listare?", ;
		Lb_simplu1.Left = 10, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 11, ;
		_OPTIONGRUP1.AutoSize = .F., ;
		_OPTIONGRUP1.BorderStyle = 0, ;
		_OPTIONGRUP1.Height = 33, ;
		_OPTIONGRUP1.Left = 264, ;
		_OPTIONGRUP1.Name = "_OPTIONGRUP1", ;
		_OPTIONGRUP1.OPTION1.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION1.Caption = "Da", ;
		_OPTIONGRUP1.OPTION1.Left = 4, ;
		_OPTIONGRUP1.OPTION1.Name = "OPTION1", ;
		_OPTIONGRUP1.OPTION1.Top = 2, ;
		_OPTIONGRUP1.OPTION1.Value = 1, ;
		_OPTIONGRUP1.OPTION2.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION2.Caption = "Nu", ;
		_OPTIONGRUP1.OPTION2.Left = 4, ;
		_OPTIONGRUP1.OPTION2.Name = "OPTION2", ;
		_OPTIONGRUP1.OPTION2.Top = 18, ;
		_OPTIONGRUP1.OPTION2.Value = 0, ;
		_OPTIONGRUP1.Top = 3, ;
		_OPTIONGRUP1.Width = 71
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page2.Op_list_factura' AS op_tx_simplu WITH ;
		Height = 40, ;
		Left = 47, ;
		Name = "Op_list_factura", ;
		TabIndex = 1, ;
		Top = 13, ;
		Width = 314, ;
		Lb_simplu1.Caption = "Se vizualizează factura înainte de listare?", ;
		Lb_simplu1.Left = 10, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 11, ;
		_OPTIONGRUP1.AutoSize = .F., ;
		_OPTIONGRUP1.BorderStyle = 0, ;
		_OPTIONGRUP1.Height = 33, ;
		_OPTIONGRUP1.Left = 264, ;
		_OPTIONGRUP1.Name = "_OPTIONGRUP1", ;
		_OPTIONGRUP1.OPTION1.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION1.Caption = "Da", ;
		_OPTIONGRUP1.OPTION1.Left = 4, ;
		_OPTIONGRUP1.OPTION1.Name = "OPTION1", ;
		_OPTIONGRUP1.OPTION1.Top = 2, ;
		_OPTIONGRUP1.OPTION1.Value = 1, ;
		_OPTIONGRUP1.OPTION2.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION2.Caption = "Nu", ;
		_OPTIONGRUP1.OPTION2.Left = 4, ;
		_OPTIONGRUP1.OPTION2.Name = "OPTION2", ;
		_OPTIONGRUP1.OPTION2.Top = 18, ;
		_OPTIONGRUP1.OPTION2.Value = 0, ;
		_OPTIONGRUP1.Top = 3, ;
		_OPTIONGRUP1.Width = 71
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'pgfrm_optiuni.Page2.Op_list_proforma' AS op_tx_simplu WITH ;
		Height = 40, ;
		Left = 47, ;
		Name = "Op_list_proforma", ;
		TabIndex = 7, ;
		Top = 147, ;
		Width = 314, ;
		Lb_simplu1.Caption = "Se vizualizează proforma înainte de listare?", ;
		Lb_simplu1.Left = 10, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 11, ;
		_OPTIONGRUP1.AutoSize = .F., ;
		_OPTIONGRUP1.BorderStyle = 0, ;
		_OPTIONGRUP1.Height = 33, ;
		_OPTIONGRUP1.Left = 264, ;
		_OPTIONGRUP1.Name = "_OPTIONGRUP1", ;
		_OPTIONGRUP1.OPTION1.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION1.Caption = "Da", ;
		_OPTIONGRUP1.OPTION1.Left = 4, ;
		_OPTIONGRUP1.OPTION1.Name = "OPTION1", ;
		_OPTIONGRUP1.OPTION1.Top = 2, ;
		_OPTIONGRUP1.OPTION1.Value = 1, ;
		_OPTIONGRUP1.OPTION2.AutoSize = .T., ;
		_OPTIONGRUP1.OPTION2.Caption = "Nu", ;
		_OPTIONGRUP1.OPTION2.Left = 4, ;
		_OPTIONGRUP1.OPTION2.Name = "OPTION2", ;
		_OPTIONGRUP1.OPTION2.Top = 18, ;
		_OPTIONGRUP1.OPTION2.Value = 0, ;
		_OPTIONGRUP1.Top = 3, ;
		_OPTIONGRUP1.Width = 71
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE do_adauga_modificare_reg
		Lparameters tcSetare,tcValoare
		Ains(This.amodificariregistru,1)
		This.amodificariregistru[1,1] = tcSetare
		This.amodificariregistru[1,2] = tcValoare
	ENDPROC

	PROCEDURE do_cauta_imprimanta
		Lparameters tnTip
		Local loCauta
		loCauta = caut_imprimanta()
		If !Isnull(loCauta)
			Do Case
			Case tnTip = 1
				Thisform.cimprfact = loCauta.imprimanta
				Thisform.pgfrm_optiuni.page2.op_list_aviz.SetFocus()
			Case tnTip = 2
				Thisform.cimpraviz = loCauta.imprimanta
				Thisform.pgfrm_optiuni.page2.op_list_proforma.SetFocus()
			Case tnTip = 3
				Thisform.cimprprof = loCauta.imprimanta
				Thisform.pgfrm_optiuni.page2.ct_impr_rapoarte.SetFocus()
			Case tnTip = 4
				Thisform.cimprrap = loCauta.imprimanta
				Thisform.but_TERMIN1.SetFocus()
			Endcase
		Else
			Do Case
			Case tnTip = 1
				Thisform.cimprfact = []
			Case tnTip = 2
				Thisform.cimpraviz = []
			Case tnTip = 3
				Thisform.cimprprof = []
			Case tnTip = 4
				Thisform.cimprrap = []
			Endcase
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local llModificari, llSalvare
		llModificari = .F.
		llSalvare = .F.
		
		With Thisform.pgfrm_optiuni.page2
				Thisform.cvizualaviz = Alltrim(Str(.op_list_aviz._optiongrup1.Value))
				Thisform.cvizualfact = Alltrim(Str(.op_list_factura._optiongrup1.Value))
				Thisform.cvizualprof = Alltrim(Str(.op_list_proforma._optiongrup1.Value))
		Endwith
		
		lcSetare = Sys(2001,'EXACT')
		Set Exact On
		If Nvl(Thisform.cvizualavizini,"1") <> Thisform.cvizualaviz
			Thisform.do_adauga_modificare_reg([PREVIZAVIZ],Thisform.cvizualaviz)
			llModificari = .T.
		Endif
		
		If This.cimpraviz <> Nvl(This.cimpravizini,[])
			Thisform.do_adauga_modificare_reg([AVIZ],This.cimpraviz)
			llModificari = .T.
		Endif
		
		If Nvl(Thisform.cvizualfactini,"1") <> Thisform.cvizualfact
			Thisform.do_adauga_modificare_reg([PREVIZFACT],Thisform.cvizualfact)
			llModificari = .T.
		Endif
		
		If This.cimprfact <> Nvl(This.cimprfactini,[])
			Thisform.do_adauga_modificare_reg([FACTURA],This.cimprfact)
			llModificari = .T.
		Endif
		
		If Nvl(Thisform.cvizualprofini,"1") <> Thisform.cvizualprof
			Thisform.do_adauga_modificare_reg([PREVIZPROF],This.cvizualprof)
			llModificari = .T.
		Endif
		
		If This.cimprprof <> Nvl(This.cimprprofini,[])
			Thisform.do_adauga_modificare_reg([PROFORMA],This.cimprprof)
			llModificari = .T.
		Endif
		
		If This.cimprrap <> Nvl(This.cimprrapini,[])
			Thisform.do_adauga_modificare_reg([RAPORT],This.cimprrap)
			llModificari = .T.
		Endif
		
		If This.ncriteriucod <> Nvl(This.ncriteriucodini,0)
			Thisform.do_adauga_modificare_reg([CRITCOD],Alltrim(Str(This.ncriteriucod)))
			llModificari = .T.
		Endif
		
		If This.ncriteriuDenumire <> Nvl(This.nCriteriuDenumireIni,0)
			Thisform.do_adauga_modificare_reg([CRITDENUMIRE],Alltrim(Str(This.nCriteriuDenumire)))
			llModificari = .T.
		ENDIF
		
		Set Exact &lcSetare
		
		If llModificari
			If amessagebox("Sunteti sigur ca doriti sa salvati modificarile facute?",4+32,"Confirmare")==6
				This.salveaza_setari_locale()
				amessagebox("Modificarile au fost salvate!",0+64,"Salvare optiuni")
			Endif
		Endif
		
		Return .T.
		
	ENDPROC

	PROCEDURE Init
		Lparameters tnTipOptiuni
		Thisform.nTipOptiuni = tnTipOptiuni
		DoDefault()
		
		With Thisform.pgfrm_optiuni
			This.initializeaza_setari_locale()
			With .page1.ct_codmat
				.Requery()
				.SetFocus()
			Endwith
		
			With .page2
				.op_list_factura._optiongrup1.Value = Val(Thisform.cVizualFact)		&&	gnVizualFact	&& modificare v 2.0.46
				If Thisform.nTipOptiuni = 2
					.op_list_aviz.Visible = .F.
					.ct_impr_aviz.Visible = .F.
				Endif
				.op_list_aviz._optiongrup1.Value = Val(Thisform.cVizualAviz)		&&	gnVizualAviz	&& modificare v 2.0.46
				.op_list_proforma._optiongrup1.Value = Val(Thisform.cVizualProf)	&&	gnVizualProf	&& modificare v 2.0.46
				.ct_impr_rapoarte.clb_tx_cautare.teXT_SIMPLU1.Refresh()
			Endwith
		
		Endwith
		
	ENDPROC

	PROCEDURE initializeaza_setari_locale
		This.cimprfactini = goExport.citesteSetareRegistru("FACTURA")
		This.cimpravizini = goExport.citesteSetareRegistru("AVIZ")
		This.cimprprofini = goExport.citesteSetareRegistru("PROFORMA")
		This.cimprrapini = goExport.citesteSetareRegistru("RAPORT")
		This.cvizualfactini = goExport.citesteSetareRegistru("PREVIZFACT")
		This.cvizualavizini = goExport.citesteSetareRegistru("PREVIZAVIZ")
		This.cvizualprofini = goExport.citesteSetareRegistru("PREVIZPROF")
		lcCriteriuCod = goExport.citesteSetareRegistru("CRITCOD")
		If !Empty(lcCriteriuCod) And Type('val(lcCriteriuCod)') = 'N'
			This.ncriteriucodini = Val(lcCriteriuCod)
			This.ncriteriucod = This.ncriteriucodini
		Endif
		
		lcCriteriuDenumire = goExport.citesteSetareRegistru("CRITDENUMIRE")
		If !Empty(m.lcCriteriuDenumire) And Type('val(lcCriteriuDenumire)') = 'N'
			This.nCriteriuDenumireIni = Val(lcCriteriuDenumire)
			This.nCriteriuDenumire = This.nCriteriuDenumireIni
		ENDIF
		
		This.cimprfact = This.cimprfactini
		This.cimpraviz = This.cimpravizini
		This.cimprprof = This.cimprprofini
		This.cimprrap = This.cimprrapini
		This.cvizualfact = Iif(Empty(Nvl(This.cvizualfactini,[])),[1],This.cvizualfactini)
		This.cvizualaviz = Iif(Empty(Nvl(This.cvizualavizini,[])),[1],This.cvizualavizini)
		This.cvizualprof = Iif(Empty(Nvl(This.cvizualprofini,[])),[1],This.cvizualprofini)
	ENDPROC

	PROCEDURE salveaza_setari_locale
		For i = 1 To Alen(This.aModificariRegistru,1)
			If !Empty(This.aModificariRegistru[i,1])
				goExport.modificaSetareRegistru(This.aModificariRegistru[i,1],This.aModificariRegistru[i,2])
			Endif
		Endfor
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page2.Op_list_aviz._OPTIONGRUP1.InteractiveChange
		If This.Value = 1
			Thisform.cimpraviz = []
			This.Parent.Parent.ct_impr_aviz.do_dezactiveaza()
		Else
			Thisform.cimpraviz = Thisform.cimpravizini
			This.Parent.Parent.ct_impr_aviz.do_activeaza()
		ENDIF
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page2.Op_list_aviz._OPTIONGRUP1.ProgrammaticChange
		If This.Value = 1
			Thisform.cimpraviz = []
			This.Parent.Parent.ct_impr_aviz.do_dezactiveaza()
		Else
			Thisform.cimpraviz = Thisform.cimpravizini
			This.Parent.Parent.ct_impr_aviz.do_activeaza()
		Endif
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page2.Op_list_factura._OPTIONGRUP1.InteractiveChange
		If This.Value = 1
			Thisform.cimprfact = []
			This.Parent.Parent.ct_impr_factura.do_dezactiveaza()
		Else
			Thisform.cimprfact = Thisform.cimprfactini
			This.Parent.Parent.ct_impr_factura.do_activeaza()
		Endif
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page2.Op_list_factura._OPTIONGRUP1.ProgrammaticChange
		If This.Value = 1
			Thisform.cimprfact = []
			This.Parent.Parent.ct_impr_factura.do_dezactiveaza()
		Else
			Thisform.cimprfact = Thisform.cimprfactini
			This.Parent.Parent.ct_impr_factura.do_activeaza()
		Endif
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page2.Op_list_proforma._OPTIONGRUP1.InteractiveChange
		If This.Value = 1
			Thisform.cimprprof = []
			This.Parent.Parent.ct_impr_proforma.do_dezactiveaza()
		Else
			Thisform.cimprprof = Thisform.cimprprofini
			This.Parent.Parent.ct_impr_proforma.do_activeaza()
		Endif
	ENDPROC

	PROCEDURE pgfrm_optiuni.Page2.Op_list_proforma._OPTIONGRUP1.ProgrammaticChange
		If This.Value = 1
			Thisform.cimprprof = []
			This.Parent.Parent.ct_impr_proforma.do_dezactiveaza()
		Else
			Thisform.cimprprof = Thisform.cimprprofini
			This.Parent.Parent.ct_impr_proforma.do_activeaza()
		Endif
	ENDPROC

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column3.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column3.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column5.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column5.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column6.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column6.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column7.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column7.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column8.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column8.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column9.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column9.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column10.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column10.Text1" UniqueID="" Timestamp="" />

	*<PropValue>
		BorderStyle = 3
		DoCreate = .T.
		Height = 397
		Name = "frm_rute"
		Width = 749
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 752
		_shape2.Name = "_shape2"
		Lb_titlu_alb_b121.Caption = "Rute"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 710
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 0
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_grdrow1' AS _grdrow WITH ;
		ColumnCount = 10, ;
		DeleteMark = .F., ;
		Height = 348, ;
		Left = 12, ;
		Name = "_grdrow1", ;
		Panel = 1, ;
		RecordSource = "crsRUTE", ;
		Top = 36, ;
		Width = 708, ;
		Column1.ControlSource = "ordine", ;
		Column1.Name = "Column1", ;
		Column1.Width = 41, ;
		Column2.ControlSource = "ruta", ;
		Column2.Name = "Column2", ;
		Column3.ControlSource = "nume_gestiune", ;
		Column3.Name = "Column3", ;
		Column3.Width = 122, ;
		Column4.ControlSource = "partener", ;
		Column4.Name = "Column4", ;
		Column5.ControlSource = "adresa", ;
		Column5.Name = "Column5", ;
		Column5.Width = 92, ;
		Column6.ControlSource = "localitate", ;
		Column6.Name = "Column6", ;
		Column6.Width = 106, ;
		Column7.ControlSource = "judet", ;
		Column7.Name = "Column7", ;
		Column7.Width = 83, ;
		Column8.ControlSource = "agent", ;
		Column8.Name = "Column8", ;
		Column9.ControlSource = "delegat", ;
		Column9.Name = "Column9", ;
		Column10.ControlSource = "nrinmat", ;
		Column10.Name = "Column10", ;
		Column10.Width = 92
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

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

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

	ADD OBJECT '_grdrow1.Column10.Header1' AS header WITH ;
		Caption = "Nr inmatriculare", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column2.Header1' AS header WITH ;
		Caption = "Ruta", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column3.Header1' AS header WITH ;
		Caption = "Gestiune", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column4.Header1' AS header WITH ;
		Caption = "Partener", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column5.Header1' AS header WITH ;
		Caption = "Adresa partener", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column6.Header1' AS header WITH ;
		Caption = "Localitate partener", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column7.Header1' AS header WITH ;
		Caption = "Judet partener", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column8.Header1' AS header WITH ;
		Caption = "Agent", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column9.Header1' AS header WITH ;
		Caption = "Delegat", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Left = 678, ;
		Name = "But_listare1", ;
		Top = 0
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		Left = 618, ;
		Name = "But_modifica1", ;
		Top = 0
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_nou1' AS but_nou WITH ;
		Left = 588, ;
		Name = "But_nou1", ;
		Top = 0
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Left = 648, ;
		Name = "But_sterge1", ;
		Top = 0
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />
	
	PROCEDURE actualizeaza_grid1
		LPARAMETERS pcFiltru
		LOCAL lcFiltru
		lcFiltru=pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru=poRUTE.ca_baza1.cfiltru
		ENDIF
		save_grid_tag(thisform._grdrow1)
		poRUTE.ca_baza1.cfiltru=lcFiltru
		poRUTE.ca_baza1.afisare()
		restore_grid_tag(thisform._grdrow1)
		*!*	IF RECCOUNT('v_delegati')>0
			thisform._grdrow1.SetFocus()
		*!*	ELSE
		*!*		thisform.lb_delegati.SetFocus()
		*!*	ENDIF
		
	ENDPROC

	PROCEDURE do_adauga
		Private pniesire
		pniesire=0
		Select crsRUTE
		*!*	pcNume = loRec.nume
		*!*	pcPrenume = loRec.prenume
		Scatter Name loRec Blank
		Do Adauga_Modifica_Inregistrare With "rute",loRec,,"INSERT",,"addruta"
		 
		
		If pniesire=1
			This.actualizeaza_grid1()
		Endif
		
	ENDPROC

	PROCEDURE do_listare
		thisform.AlwaysOnTop= .F.
		PRIVATE pcDataora 
		pcDataora = get_ora(2)
		SELECT crsRUTE
		
		REPORT FORM rap_rute TO PRINTER PROMPT PREVIEW 
		thisform.AlwaysOnTop= .t.
		RELEASE pcDataora 
	ENDPROC

	PROCEDURE do_modifica
		Private pniesire
		pniesire=0
		Select crsRUTE
		Scatter Name loRec
		*!*	pcNume = loRec.nume
		*!*	pcPrenume = loRec.prenume
		Do Adauga_Modifica_Inregistrare With "rute",loRec,loRec.id_rutagest,"UPDATE",,"modruta"
		
		If pniesire=1
			This.actualizeaza_grid1()
		Endif
		
		
	ENDPROC

	PROCEDURE do_sterge
		SELECT crsRUTE
		SCATTER NAME lorec
		Do STERGE_INREGISTRARE With "rute",loRec.id_rutagest
		This.actualizeaza_grid1()
	ENDPROC

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Ct_gestiune" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cus_odata_rute1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_cautare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_alege_gestiune
		*m: do_alege_ruta
		*m: do_cauta_agent
		*m: do_cauta_delegat
		*m: do_cauta_masina
		*p: nid
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 134
		Name = "frm_rute_nou"
		nid = .F.
		orec = .F.
		Width = 375
		_shape1.Name = "_shape1"
		_shape2.Height = 29
		_shape2.Left = 314
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 62
		Lb_titlu_alb_b121.Caption = "Rute"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 6
		BUT_TERMIN1.Left = 344
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 4
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
		But_renunt1.Left = 315
		But_renunt1.Name = "But_renunt1"
		But_renunt1.TabIndex = 5
		But_renunt1.Top = 1
	*</PropValue>

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Left = 13, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 1, ;
		Top = 38, ;
		Text_simplu1.ControlSource = "porec.ordine", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Ordine", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_cautare1' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poRec.ruta,[])) AND EMPTY(NVL(poRec.id_ruta,0)), ;
		cprocedura = thisform.do_alege_ruta, ;
		cvar_afisata = porec.ruta, ;
		Left = 12, ;
		Name = "Ct_clb_cautare1", ;
		TabIndex = 3, ;
		Top = 93, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Ruta", ;
		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="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_gestiune' AS ct_clb_cautare WITH ;
		cconditie = EMPTY(NVL(poRec.nume_gestiune,[])) AND EMPTY(NVL(poRec.id_gestiune,0)), ;
		cprocedura = thisform.do_alege_gestiune, ;
		cvar_afisata = porec.nume_gestiune, ;
		Left = 12, ;
		Name = "Ct_gestiune", ;
		TabIndex = 2, ;
		Top = 65, ;
		img_cautare.Name = "img_cautare", ;
		clb_tx_cautare.Lb_simplu1.Caption = "Gestiunea", ;
		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="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Cus_odata_rute1' AS cus_odata_rute WITH ;
		Left = 86, ;
		Name = "Cus_odata_rute1", ;
		Top = 35
		*< END OBJECT: ClassLib="ofacturare.vcx" BaseClass="custom" />
	
	PROCEDURE do_alege_gestiune
		Local loCauta
		
		loCauta = caut_gestiune(0,gnidutil,.f.)
		
		If !Empty(loCauta.id_gestiune) And !Empty(loCauta.nume_gestiune)
			poRec.id_gestiune = loCauta.id_gestiune
			poRec.nume_gestiune = Alltrim(loCauta.nume_gestiune)
		
		Endif
		
		Thisform.ct_gestiune.Refresh()
		
	ENDPROC

	PROCEDURE do_alege_ruta
		
		Local locauta
		lcFiltru = [2=2]
		lcSchema = [id_ruta n(20),ruta c(64)]
		lcOrder = [ruta]
		lccoloane = [ruta]
		lcTitlu = [ALEGETI RUTA]
		lcTitluColoane = [Ruta]
		*!*	llMaiMulteMasini = tlMaiMulteMasini
		lcSelect = [select id_ruta,ruta from fact_nom_rute]
		lcFiltruOriginal = [sters = 0]
		lcNumeProc = [nom_nomrute]
		llToateIreg = .f.
		lcPrimaColoana = [ruta]
		lnPornire = 1
		*!*	lnTipReturn = Iif(tlMaiMulteMasini, 1, 0)
		lcIdColumn = "id_ruta"
		*!*	Debug
		*!*	Suspend 
		loCauta = cauta_alfa(lcSelect, lcFiltru, lcSchema, lcOrder, lccoloane, lcTitlu, lcTitluColoane, lcNumeProc, llToateIreg, lcFiltruOriginal)&&, lcPrimaColoana, lnPornire, , lcIdColumn)
		*!*	loCauta = cauta_alfa(lcSelect, lcFiltru, lcSchema, lcOrder, lccoloane, lcTitlu, lcTitluColoane, lcNumeProc, tlToateIreg, lcFiltruOriginal)		&& 11.07.2007
		
		If !Empty(locauta.id_ruta)
			poRec.ruta = Alltrim(locauta.ruta)
			poRec.id_ruta = locauta.id_ruta
		
			Thisform.ct_clb_cautare1.Refresh()
		*!*		Thisform.ed_tx_simplu1.SetFocus()
		Else
			poRec.ruta = []
			poRec.id_ruta = Null
		Endif
		
	ENDPROC

	PROCEDURE do_cauta_agent
	ENDPROC

	PROCEDURE do_cauta_delegat
	ENDPROC

	PROCEDURE do_cauta_masina
	ENDPROC

	PROCEDURE inainte_de_do_termin
		LOCAL PLRETURN
		
		lccontrol = UPPER(this.ActiveControl.BaseClass )
		IF   INLIST(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.Activecontrol.controlsource
			&lcval=thisform.ActiveControl.value
		ENDIF 	
		
		
		Do Case
		Case Empty(porec.ruta)
			aMessagebox('Nu ati completat ruta!',0+48,"Atentie")
			this.clb_tx_simplu2.text_simplu1.SetFocus()
			
			plreturn=.F.
		
		OTHERWISE
			PLRETURN=This.cus_odata_rute1.salvare(This.OREC,This.NID)
		
		ENDCASE 
		
		Return PLRETURN
		
		
		
		
	ENDPROC

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

ENDDEFINE

DEFINE CLASS frm_seteaza_k 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_coeficient" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 104
		Name = "frm_seteaza_k"
		Width = 311
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 312
		_shape2.Height = 29
		_shape2.Left = 240
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Visible = .T.
		_shape2.Width = 72
		Lb_titlu_alb_b121.Caption = "Coeficient K"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 3
		BUT_TERMIN1.Left = 279
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

	ADD OBJECT 'Clb_coeficient' AS clb_tx_simplu WITH ;
		Left = 12, ;
		Name = "Clb_coeficient", ;
		TabIndex = 1, ;
		Top = 48, ;
		Text_simplu1.ControlSource = "poDate.coeficient_k", ;
		Text_simplu1.InputMask = (get_mask(5,2)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Lb_simplu1.Caption = "Coeficient K", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE inainte_de_do_termin
		Local llReturn
		llReturn = .T.
		If poDate.coeficient_k <= 0
			amessagebox("Coeficientul K trebuie sa fie mai mare decat 0!",48,"Atentie")
			Thisform.clb_coeficient.text_simplu1.SetFocus()
			llReturn = .F.
		Endif
		Return llReturn
	ENDPROC

	PROCEDURE Init
		DoDefault()
		If gnCoefKFact = 1
			Thisform.clb_coeficient.teXT_SIMPLU1.ReadOnly = .T.
		Endif
	ENDPROC

ENDDEFINE
