*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="oschimbare_pret.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS frm_centralizator_schimbare_pret 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="Shape2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Shape1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Optiongroup1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Check5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Check6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Text2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_filtru_pretnou" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_filtru_pretvechi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_filtru_dataact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_filtru_codmat" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: select_rul
		*p: cautatorarticol
		*p: cautatorsubgrupa
		*p: filtruart
		*p: filtrusbgr
	*</DefinedPropArrayMethod>

	*<PropValue>
		cautatorarticol = 
		cautatorsubgrupa = 
		DoCreate = .T.
		filtruart = 
		filtrusbgr = 
		Height = 280
		Name = "frm_centralizator_schimbare_pret"
		Width = 375
		_shape1.Name = "_shape1"
		_shape1.ZOrderSet = 2
		_shape2.Name = "_shape2"
		_shape2.ZOrderSet = 3
		Lb_titlu_alb_b121.Caption = "Procese verbale schimbare pret"
		Lb_titlu_alb_b121.FontSize = 12
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.ZOrderSet = 4
		BUT_TERMIN1.Left = 346
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 5
		Gridsort1.Left = 9
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 16
	*</PropValue>

	ADD OBJECT 'But_excel1' AS but_excel WITH ;
		Left = 287, ;
		Name = "But_excel1", ;
		TabIndex = 16, ;
		Top = 1, ;
		Visible = .T., ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		caction = do_listare, ;
		Left = 317, ;
		Name = "But_listare1", ;
		TabIndex = 15, ;
		Top = 1, ;
		Visible = .T., ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Check5' AS checkbox WITH ;
		Alignment = 0, ;
		BackColor = 255,255,255, ;
		Caption = "Subgr.articol", ;
		Height = 17, ;
		Left = 114, ;
		Name = "Check5", ;
		Top = 52, ;
		Width = 101, ;
		ZOrderSet = 10
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'Check6' AS checkbox WITH ;
		Alignment = 0, ;
		BackColor = 255,255,255, ;
		Caption = "Articol", ;
		Height = 17, ;
		Left = 114, ;
		Name = "Check6", ;
		Top = 78, ;
		Width = 60, ;
		ZOrderSet = 11
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'ck_filtru_codmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		camp_nume = codmat, ;
		Caption = "Cod material", ;
		FontName = "Arial", ;
		Left = 114, ;
		Name = "ck_filtru_codmat", ;
		Top = 101, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_filtru_dataact' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		camp_nume = dataact, ;
		Caption = "Data act", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Left = 114, ;
		Name = "ck_filtru_dataact", ;
		tip = D, ;
		Top = 167, ;
		ZOrderSet = 18
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_filtru_pretnou' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		camp_nume = pretvi, ;
		Caption = "Pret nou", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Left = 114, ;
		Name = "ck_filtru_pretnou", ;
		Top = 124, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_filtru_pretvechi' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		camp_nume = pretvf, ;
		Caption = "Pret vechi", ;
		FontName = "Arial", ;
		FontSize = 9, ;
		Left = 114, ;
		Name = "ck_filtru_pretvechi", ;
		Top = 146, ;
		ZOrderSet = 17
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Lb_simplu2' AS lb_simplu WITH ;
		Caption = "Cautare dupa :", ;
		Left = 15, ;
		Name = "Lb_simplu2", ;
		Top = 52, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu3' AS lb_simplu WITH ;
		Caption = "Grupat dupa :", ;
		Left = 15, ;
		Name = "Lb_simplu3", ;
		Top = 219, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'Optiongroup1' AS optiongroup WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ButtonCount = 3, ;
		Height = 66, ;
		Left = 109, ;
		Name = "Optiongroup1", ;
		Top = 195, ;
		Value = 1, ;
		Width = 88, ;
		ZOrderSet = 9, ;
		Option1.BackColor = 255,255,255, ;
		Option1.Caption = "Articol", ;
		Option1.Height = 17, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option1.Value = 1, ;
		Option1.Width = 61, ;
		Option2.BackColor = 255,255,255, ;
		Option2.Caption = "Gestiune", ;
		Option2.Height = 17, ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24, ;
		Option2.Width = 71, ;
		Option3.BackColor = 255,255,255, ;
		Option3.Caption = "Data", ;
		Option3.Height = 17, ;
		Option3.Left = 5, ;
		Option3.Name = "Option3", ;
		Option3.Top = 43, ;
		Option3.Width = 61
		*< END OBJECT: BaseClass="optiongroup" />

	ADD OBJECT 'Shape1' AS shape WITH ;
		BackStyle = 0, ;
		Height = 152, ;
		Left = 5, ;
		Name = "Shape1", ;
		Top = 40, ;
		Width = 365, ;
		ZOrderSet = 1
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'Shape2' AS shape WITH ;
		BackStyle = 0, ;
		Height = 73, ;
		Left = 5, ;
		Name = "Shape2", ;
		Top = 191, ;
		Width = 365, ;
		ZOrderSet = 0
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'Text1' AS textbox WITH ;
		ControlSource = "thisform.cautatorSubgrupa", ;
		DisabledBackColor = 224,223,227, ;
		DisabledForeColor = 0,0,0, ;
		Enabled = .F., ;
		FontName = "Arial Narrow", ;
		FontSize = 9, ;
		Height = 25, ;
		Left = 218, ;
		Name = "Text1", ;
		Top = 48, ;
		Width = 142, ;
		ZOrderSet = 12
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Text2' AS textbox WITH ;
		ControlSource = "thisform.cautatorArticol", ;
		DisabledBackColor = 224,223,227, ;
		DisabledForeColor = 0,0,0, ;
		Enabled = .F., ;
		FontName = "Arial Narrow", ;
		FontSize = 9, ;
		Height = 25, ;
		Left = 218, ;
		Name = "Text2", ;
		Top = 74, ;
		Width = 142, ;
		ZOrderSet = 13
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE do_cauta
		Private lcFiltre
		STORE '' TO lcFiltre
		IF this.check5.Value = 1 AND !EMPTY(thisform.filtrusbgr)
		    lcFiltre = lcFiltre + [ and id_subgrupa=] + thisform.filtrusbgr
		ENDIF
		IF this.check6.Value = 1 AND !EMPTY(thisform.filtruart)
		    lcFiltre = lcFiltre + [ and id_articol=] + thisform.filtruart 
		ENDIF    
		IF this.ck_filtru_dataact.Value = 1
			lcFiltre = lcFiltre + this.ck_filtru_dataact.filtru
		ENDIF 
		IF this.ck_filtru_codmat.Value = 1 
		    lcFiltre = lcFiltre + this.ck_filtru_codmat.filtru
		ENDIF
		IF this.ck_filtru_pretnou.Value = 1
		    lcFiltre = lcFiltre + this.ck_filtru_pretnou.filtru 
		ENDIF
		IF this.ck_filtru_pretvechi.Value = 1
		    lcFiltre = lcFiltre + this.ck_filtru_pretvechi.filtru         
		ENDIF
		this.select_rul 
		
	ENDPROC

	PROCEDURE do_excel
		Thisform.do_cauta
		If Used('crsCentralizator')
			If Reccount('crsCentralizator') > 0
				Thisform.AlwaysOnTop=.F.
		
				Select dataact,nract,codmat,denumire,pretvi as pret_vechi_fara_tva, pretvi+tvavi as pret_vechi_cu_tva, ;
					pretvf as pret_nou_fara_tva, pretvf + tvavf as pret_nou_cu_tva,	nume_gestiune ;
					From crsCentralizator ;
					Into Cursor crsCentralizatorTempExcel
					
				lcFileName = strtranx(This.lb_titlu_alb_b121.Caption, "([^a-zA-Z0-9])", [_] )
				goExport.export2xls('crsCentralizatorTempExcel', lcFileName)
				Thisform.AlwaysOnTop=.T.
			Else
				aMESSAGEBOX("Nu exista inregistrari pentru optiunile selectate!",0+48,"Atentie")
			Endif
			Use In crsCentralizatorTempExcel
		Endif
	ENDPROC

	PROCEDURE do_listare
		Private pcGroup, pcTitlu
		Store '' To pcGroup
		Thisform.do_cauta()
		pcTitlu = 'CENTRALIZATOR ARTICOLE PROCESE VERBALE SCHIMBARE PRET'
		Thisform.AlwaysOnTop=.F.
		goExport.export2frx([crscentralizator],[rap_sch_pret])
		Thisform.AlwaysOnTop=.T.
		
		
	ENDPROC

	PROCEDURE select_rul
		TEXT to pcSelectRul textmerge noshow
		select y.* from
		(
		select r1.dataact,r1.serie_act,r1.nract,r1.cod,
		       r1.id_articol,
		       r1.cante,
		       r1.pretv as pretvi,
		       r1.tvav as tvavi,
		       r1.cante * (r1.pretv + r1.tvav) as valctvavi,
		       r1.id_gestiune,
		       r2.cant ,
		       r2.pretv as pretvf,
		       r2.tvav as tvavf,
		       r2.cant * (r2.pretv + r2.tvav) as valctvavf,
		       c.denumire,
		       c.codmat,
		       c.id_subgrupa,
		       r2.cant * (r2.pretv + r2.tvav) - r1.cante * (r1.pretv + r1.tvav) as dif,
		       d.nr_pag,
		       d.nume_gestiune
		  from (select dataact,serie_act,nract,cod, id_articol, sum(cante) as cante, pretv, tvav, sters,id_gestiune
		          from rul
		          where
		          cod in (select a.cod
		                    from (select a1.dataact, a1.nract, a1.cod, a1.id_set
		                            from act a1
		                           WHERE
		                                 a1.an*12+a1.luna = ?gnAn*12+?gnLuna
		                             and a1.id_set in (52,245,269, 999)
		                             and a1.scd = '371'
		                             and a1.scc = '378'
		                             and a1.sters = 0
		                             and a1.id_sucursala = 4) a)
		         group by dataact,serie_act,nract,id_articol, cod, pretv, tvav, sters,id_gestiune
		         ) r1
		  join (select dataact,serie_act,nract,cod, id_articol, sum(cant) as cant, pretv, tvav, sters,id_gestiune
		          from rul
		          where cod in (select a.cod
		                    from (select a1.dataact, a1.nract, a1.cod, a1.id_set
		                            from act a1
		                           WHERE
		                                 a1.an*12+a1.luna = ?gnAn*12+?gnLuna
		                             and a1.id_set in (52,245,269,999)
		                             and a1.scd = '371'
		                             and a1.scc = '378'
		                             and a1.sters = 0
		                             and a1.id_sucursala = 4) a)
		         group by dataact,serie_act,nract,id_articol, cod, pretv, tvav, sters,id_gestiune) r2 on r1.cod =
		                                                             r2.cod
		                                                         and r1.id_articol =
		                                                             r2.id_articol
		  left join nom_articole c on r1.id_articol = c.id_articol
		  left join nom_gestiuni d on r1.id_gestiune = d.id_gestiune
		 where
		    r1.cante > 0
		   and r1.sters = 0
		   and r2.cant > 0
		   and r2.sters = 0) y
		ENDTEXT
		Private pocentralizator
		Store '' To pocentralizator
		lcSchema = []
		lcgroup= []
		Do Case
			Case This.optiongroup1.Value  = 1
				lcorder =[ denumire]
			Case This.optiongroup1.Value = 2
				lcorder=[ nume_gestiune]
			Case This.optiongroup1.Value = 3
				lcorder=[ dataact]
			Otherwise
				lcorder=[]
		ENDCASE
		pcGroup = ALLTRIM(lcOrder)
		lcFiltruOriginal = []
		*!*	Do Case
		*!*		Case This.check1.Value = 1
		*!*			lcOrder = [codmat]
		*!*		Case This.check2.Value = 1
		*!*			lcOrder = [dataact]
		*!*		Case This.check3.Value = 1
		*!*			lcOrder = [nract]
		*!*		Case This.check4.Value = 1
		*!*			lcOrder=[denumire]
		*!*		Otherwise
		*!*			lcOrder=[]
		*!*	Endcase
		lcFiltru = [nr_pag =?gnTipGest]+lcFiltre
		llModParam = .T.
		llAfiseaza = .F.
		gencursor('pocentralizator','crsCentralizator', pcSelectRul , lcFiltru, lcSchema, lcorder, llAfiseaza,  lcgroup, llModParam, lcFiltruOriginal)
		pocentralizator.ca_baza1.afisare()
		*!*	Thisform.AlwaysOnTop=.F.
		*!*	Select crsCentralizator
		*!*	Local lcRaport
		*!*	Private pcDataora
		*!*	Store '' To pcDataora
		*!*	pcDataora=get_Ora(2)
		*!*	lcRaport = 'rap_sch_pret'
		*!*	Report Form &lcRaport To Printer Prompt Preview
		*!*	Thisform.AlwaysOnTop=.T.
		
		
		
		
	ENDPROC

	PROCEDURE Check5.Click
		If Thisform.check5.Value = 1
			pcselect = [select * from gest_art_sbgr]
			pcfiltruinitial=[sters=0]
			pcfiltru = [1=2]
			pcschema = []
			pcorder = []
			pccoloane = [subgrupa]
			pcTitlu = [Alegeti subgrupa]
			pcTitluColoane = [Subgrupa]
			locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,'gest_art_sbgr',,pcfiltruinitial)
			If gnButon = 2
				Thisform.cautatorsubgrupa  = []
				Thisform.filtrusbgr  = []
			Else
				Thisform.cautatorsubgrupa = Alltrim(locauta.subgrupa)
				Thisform.filtrusbgr = Alltrim(Transform(locauta.id_subgrupa))
				Thisform.text1.Refresh
			Endif
		Else
			Thisform.cautatorsubgrupa = []
			Thisform.filtrusbgr = []
		Endif
		
		
	ENDPROC

	PROCEDURE Check6.Click
		If Thisform.check6.Value = 1
			pcselect = [select * from nom_articole]
			pcfiltruinitial=[sters=0]
			pcfiltru = [1=2]
			pcschema = []
			pcorder = []
			pccoloane = [denumire]
			pcTitlu = [Alegeti articolul]
			pcTitluColoane = [Articol]
			locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,'nom_articole',,pcfiltruinitial)
			IF gnButon = 2
				Thisform.cautatorArticol = []
				Thisform.filtruart = []
			ELSE 
				Thisform.cautatorArticol = ALLTRIM(locauta.denumire)
				Thisform.filtruart = Alltrim(Transform(locauta.id_articol))
				Thisform.text2.Refresh
			ENDIF 
		ELSE 
			Thisform.cautatorArticol = []
			Thisform.filtruart = []
		Endif
		
	ENDPROC

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="BUT_RENUNT1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cusodatabase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_NOU1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_STERGE1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_cautare_var1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_clb_cautare_var2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cCodMat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cCodMat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cPretVechi.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cPretVechi.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cPretNou.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cPretNou.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cProcTvav.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cProcTvav.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintariDet.cProcTvav._combobox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkPret" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_alege_politica
		*p: idpol
		*p: nid
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		DoCreate = .T.
		Height = 550
		idpol = 
		Name = "frm_instiintaripret_nou"
		nid = .F.
		orec = .F.
		Width = 570
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 576
		_SHAPE2.Height = 29
		_SHAPE2.Left = 500
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 71
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 10
		BUT_TERMIN1.Left = 540
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 8
		BUT_TERMIN1.Top = 1
		GRIDSORT1.Left = 12
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 48
	*</PropValue>

	ADD OBJECT 'BUT_NOU1' AS but_nou WITH ;
		caction = , ;
		Left = 492, ;
		Name = "BUT_NOU1", ;
		Picture = ..\grafice\nou_sus.bmp, ;
		TabIndex = 5, ;
		Top = 134
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

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

	ADD OBJECT 'BUT_STERGE1' AS but_sterge WITH ;
		DisabledPicture = ..\grafice\sterg2_sus_dis.bmp, ;
		Left = 522, ;
		Name = "BUT_STERGE1", ;
		Picture = ..\grafice\sterg_sus.bmp, ;
		TabIndex = 7, ;
		Top = 134, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'chkPret' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "pret > 0", ;
		FontBold = .T., ;
		Left = 346, ;
		Name = "chkPret", ;
		Top = 106, ;
		Value = 1
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Left = 16, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 1, ;
		Top = 43, ;
		TEXT_SIMPLU1.ControlSource = "poRec.numar", ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		LB_SIMPLU1.Caption = "Numar", ;
		LB_SIMPLU1.FontBold = .T., ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu2' AS clb_tx_simplu WITH ;
		Left = 16, ;
		Name = "Clb_tx_simplu2", ;
		TabIndex = 2, ;
		Top = 71, ;
		TEXT_SIMPLU1.ControlSource = "poRec.dataora", ;
		TEXT_SIMPLU1.Format = "D", ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		LB_SIMPLU1.Caption = "Data", ;
		LB_SIMPLU1.FontBold = .T., ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_cautare_var1' AS ct_clb_cautare_var WITH ;
		cconditie = empty(poRec.nume_lista_preturim), ;
		cprocedura = thisform.do_alege_politica(2), ;
		cvar_afisata = poRec.nume_lista_preturim, ;
		Height = 31, ;
		Left = 15, ;
		Name = "Ct_clb_cautare_var1", ;
		TabIndex = 4, ;
		Top = 126, ;
		Width = 327, ;
		shape_cautare.Height = 29, ;
		shape_cautare.Left = 1, ;
		shape_cautare.Name = "shape_cautare", ;
		shape_cautare.Top = 1, ;
		shape_cautare.Width = 290, ;
		img_cautare.Left = 301, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		lb_cautare.Caption = "Politica magazin", ;
		lb_cautare.FontBold = .T., ;
		lb_cautare.Name = "lb_cautare", ;
		lb_cautare.ToolTipText = "Politica de preturi in care se va schimba pretul", ;
		tx_cautare.Left = 102, ;
		tx_cautare.Name = "tx_cautare", ;
		tx_cautare.Top = 4
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_clb_cautare_var2' AS ct_clb_cautare_var WITH ;
		cconditie = empty(poRec.nume_lista_preturid), ;
		cprocedura = thisform.do_alege_politica(1), ;
		cvar_afisata = poRec.nume_lista_preturid, ;
		Height = 31, ;
		Left = 15, ;
		Name = "Ct_clb_cautare_var2", ;
		TabIndex = 3, ;
		Top = 98, ;
		Width = 327, ;
		shape_cautare.Height = 29, ;
		shape_cautare.Left = 1, ;
		shape_cautare.Name = "shape_cautare", ;
		shape_cautare.Top = 1, ;
		shape_cautare.Width = 290, ;
		img_cautare.Left = 301, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		lb_cautare.Caption = "Politica depozit", ;
		lb_cautare.FontBold = .T., ;
		lb_cautare.Name = "lb_cautare", ;
		lb_cautare.ToolTipText = "Politica de preturi din care se obtine pretul nou", ;
		tx_cautare.Left = 102, ;
		tx_cautare.Name = "tx_cautare", ;
		tx_cautare.Top = 4
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT 'cusodatabase1' AS _cusodatabase WITH ;
		Left = 12, ;
		Name = "cusodatabase1", ;
		Top = 84
		*< END OBJECT: ClassLib="_cus_odata_base.vcx" BaseClass="custom" />

	ADD OBJECT 'grdInstiintariDet' AS _grdbase WITH ;
		ColumnCount = 5, ;
		DeleteMark = .F., ;
		HeaderHeight = 33, ;
		Height = 372, ;
		HighlightBackColor = 0,64,128, ;
		Left = 12, ;
		Name = "grdInstiintariDet", ;
		Panel = 1, ;
		TabIndex = 6, ;
		Top = 168, ;
		Width = 540, ;
		Column1.Name = "cDenumire", ;
		Column1.ReadOnly = .F., ;
		Column1.Width = 207, ;
		Column2.ColumnOrder = 2, ;
		Column2.Name = "cCodMat", ;
		Column2.ReadOnly = .T., ;
		Column3.ColumnOrder = 3, ;
		Column3.Format = "RK", ;
		Column3.InputMask = "999 999.99", ;
		Column3.Name = "cPretVechi", ;
		Column3.ReadOnly = .F., ;
		Column4.Format = "RK", ;
		Column4.InputMask = "999 999.99", ;
		Column4.Name = "cPretNou", ;
		Column4.ReadOnly = .F., ;
		Column5.CurrentControl = "_combobox1", ;
		Column5.Name = "cProcTvav", ;
		Column5.ReadOnly = .F., ;
		Column5.Sparse = .T., ;
		Column5.Width = 71
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdInstiintariDet.cCodMat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod Material", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

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

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

	ADD OBJECT 'grdInstiintariDet.cPretNou.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret nou (depozit)", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdInstiintariDet.cPretVechi.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vechi (magazin)", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdInstiintariDet.cProcTvav._combobox1' AS _combobox WITH ;
		BorderStyle = 0, ;
		BoundTo = .T., ;
		Left = 37, ;
		Name = "_combobox1", ;
		ReadOnly = .F., ;
		Top = 47
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="combobox" />

	ADD OBJECT 'grdInstiintariDet.cProcTvav.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Procent TVA", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdInstiintariDet.cProcTvav.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE do_alege_politica
		LPARAMETERS tnTip
		* tnTip: 1=politica depozit; 2=politica magazin
		LOCAL loCauta
		loCauta = caut_politici_preturi()
		
		IF EMPTY(tnTip)
			tnTip = 1
		ENDIF
		
		IF !EMPTY(NVL(loCauta.id_pol,0))
			IF tnTip = 1
				poRec.nume_lista_preturid = loCauta.NUME_LISTA_PRETURI
				poRec.id_pold  = loCauta.id_pol
			ELSE
				poRec.nume_lista_preturim  = loCauta.NUME_LISTA_PRETURI
				poRec.id_polm = loCauta.id_pol
			ENDIF 
			
		ENDIF 	
	ENDPROC

	PROCEDURE inainte_de_do_termin
		IF EMPTY(NVL(poRec.numar,0)) 
			AMESSAGEBOX("Nu ati completat numarul instiintarii",0+48,"Atentie")
			this.clb_tx_simplu1.SetFocus()
			RETURN .f.
		ENDIF 	
		IF EMPTY(NVL(poRec.id_polm,0))
			AMESSAGEBOX("Nu ati completat politica de preturi a magazinului",0+48,"Atentie")
			this.ct_clb_cautare_var1.SetFocus()
			RETURN .f.
		ENDIF 
		*!*	SELECT cInstiintariDet
		*!*	LOCATE FOR EMPTY(pret_vechi)
		*!*	IF FOUND()
		*!*		amessagebox("Nu ati completat pretul vechi!",0+48,"Atentie")
		*!*		this.grdInstiintariDet.SetFocus()
		*!*		RETURN .f.
		*!*	ENDIF
		LOCATE FOR EMPTY(pret_nou)
		IF FOUND()
			amessagebox("Nu ati completat pretul nou la toate articolele!",0+48,"Atentie")
			this.grdInstiintariDet.SetFocus()
			RETURN .f.
		ENDIF
		LOCATE FOR EMPTY(proc_tvav) 
		IF FOUND()
			amessagebox("Nu ati completat TVA la toate articolele!",0+48,"Atentie")
			this.grdInstiintariDet.SetFocus()
			RETURN .f.
		ENDIF	
		
		RETURN THIS.cusodatabase1.make_sql(THIS.OREC,THIS.NID)
	ENDPROC

	PROCEDURE Init
		Lparameters toRec, tnId, tcActiune
		DoDefault()
		Private poInstiintaripret_detnou
		Local lcSchema,lcSelect,lcOrder,lcGroup,lcFiltru,lcFiltruOriginal,llModParam,llAfiseaza,lcSelect1,lcOrder1,lcFiltru1,;
			lcFiltruOriginal1, lcSql, lnSucces
		Store Null To poInstiintaripret_detnou
		
		Do Case
			Case Upper(Alltrim(tcActiune)) = [INSERT]
				This.lb_titlu_alb_b121.Caption = [Instiintare pret - Adaugare]
				This.clb_tx_simplu2.tEXT_SIMPLU1.Value = Datetime()
			Case Upper(Alltrim(tcActiune)) = [UPDATE]
				This.lb_titlu_alb_b121.Caption = [Instiintare pret - Modificare]
		Endcase
		
		This.orec = toRec
		This.nid = tnId
		This.cusodatabase1.cactiune = tcActiune
		*lcSchema = [id n(20), id_articol n(20), codmat c(50), denumire c(100), pret_vechi n(20,4), pret_nou n(20,4), proc_tvav n(10,4), id_instiintare n(20)]
		lcSchema = []
		lcSelect = [select id, id_articol, codmat, denumire, pret_vechi, pret_nou, proc_tvav, id_instiintare from instiintaripret_vdetalii ]
		lcOrder = [ denumire ]
		lcGroup = []
		lcFiltru = []
		lcFiltruOriginal = Iif(!Empty(tnId),[ id_instiintare = ] + Alltrim(Str(tnId)),[ 1=2 ])
		llModParam = .T.
		llAfiseaza = .F.
		
		gencursor('poInstiintaripret_detnou','cInstiintariDet', lcSelect, lcFiltru, lcSchema, lcOrder, llAfiseaza, lcGroup, llModParam, lcFiltruOriginal)
		poInstiintaripret_detnou.ca_baza1.afisare()
		
		lcSql = [ select id_proc_tva,proc_tva,procent from vcote_tva where an = ?gnAn and luna = ?gnLuna ]
		lnSucces = goExecutor.oExecute(lcSql,'cProcTva')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,16,"Eroare")
		Endif
		
		SELECT cInstiintariDet
		With This.grdInstiintariDet
			.RecordSource = [cInstiintariDet]
			.cDenumire.ControlSource = [denumire]
			.cCodMat.ControlSource = [codmat]
			.cPretVechi.ControlSource = [pret_vechi]
			.cPretVechi.readonly = .F.
			.cPretNou.ControlSource = [pret_nou]
			.cPretNou.readonly = .F.
			.cProcTvav.ControlSource = [proc_tvav]
			.cProcTvav.readonly = .F.
			.cProcTvav._combobox1.RowSource = [cProcTva.proc_tva]
			.cProcTvav._combobox1.RowSourceType = 2
		Endwith
		
		
		this.ct_clb_cautare_var1.lb_cautare.ToolTipText = 'Din politica magazin se obtin preturile vechi.'
		this.ct_clb_cautare_var2.lb_cautare.ToolTipText = 'Din politica depozit se obtin preturile noi.'
		this.chkPret.ToolTipText = 'Se preiau doar articolele care au pretul nou > 0.'
		
		
		
		
		
		
	ENDPROC

	PROCEDURE BUT_NOU1.Click
		*!* 05.11.2009
		*!* marius.mutu
		*!* articolele cu pret > 0 din politica depozit
		
		Local lcSql,lcCursor,lcSelect,lnSucces,lcFile
		Local lntipg, llToateIreg, llMultipleArticles, llCRM, llCautPlus
		Local loArticol, lnPretVechi, lnPretNou, lnProcTvav
		LOCAL llPret
		llPret = thisform.chkPret.Value = 1
		
		lnPretVechi = 0
		lnPretNou = 0
		lnProcTvav = 0
		
		lntipg = 0
		llToateIreg = .F.
		llMultipleArticles = .T.
		llCRM = .F.
		llCautPlus = .T.
		
		lcXML = caut_articol(lntipg, llToateIreg, llMultipleArticles, llCRM, llCautPlus)
		If !Empty(lcXML)
			lnArticole = Xmltocursor(lcXML, "cArticoleTemp")
		
			If Used('cArticoleTemp')
				Select cArticoleTemp
				Scan
					Scatter Name loArticol
					If !Empty(Nvl(loArticol.id_articol,0))
		
						*!* VERIFIC ARTICOLE DUPLICATE
						SELECT cInstiintariDet
						LOCATE FOR id_articol = loArticol.id_articol
						IF FOUND()
							LOOP
						ENDIF 
						*!* VERIFIC ARTICOLE DUPLICATE ^
										
						If !Empty(Nvl(poRec.id_pold,0))
							lcSql = [select pret as pretnou,proc_tvav from crm_politici_pret_art where id_articol = ] +Alltrim(Str(loArticol.id_articol))+ ;
								[ and id_pol = ] + Alltrim(Str(poRec.id_pold))
							lnSucces = goExecutor.oExecute(lcSql,'cPretNou')
							If lnSucces < 0
								amessagebox(goExecutor.cEroare,16,"Eroare")
							ELSE
								lnPretNou = cPretNou.pretnou
								lnProcTvav = cPretNou.proc_tvav
							Endif
							Use In (Select('cPretNou'))
						Endif
						If !Empty(Nvl(poRec.id_polm,0))
							lcSql1 = [select pret as pretvechi from crm_politici_pret_art where id_articol = ] +Alltrim(Str(loArticol.id_articol))+ [ and id_pol = ] + Alltrim(Str(poRec.id_polm))
							lnSucces = goExecutor.oExecute(lcSql1,'cPretVechi')
							If lnSucces < 0
								amessagebox(goExecutor.cEroare,16,"Eroare")
							ELSE 
								lnPretvechi = cPretVechi.pretvechi	
							Endif
							Use In (Select('cPretVechi'))
						Endif
						
						*!* 05.11.2009
						IF (llPret and lnPretnou > 0) OR !llPret
							Insert Into cInstiintariDet(denumire,id_articol,codmat,pret_vechi,pret_nou,proc_tvav) Values (loArticol.denumire,loArticol.id_articol,loArticol.codmat, lnPretvechi, lnPretnou, lnProcTvav)
						ENDIF 	
						*!* 05.11.2009 ^				
					Endif
				Endscan
				Select cInstiintariDet
				Thisform.grdInstiintariDet.SetFocus()
			Endif && used
		Endif && !empty
		
	ENDPROC

	PROCEDURE BUT_STERGE1.Click
		DODEFAULT()
		SELECT cInstiintariDet
		DELETE
		
		thisform.but_NOU1.setfocus()
		thisform.grdInstiintariDet.Refresh
		GO TOP IN cInstiintariDet
		thisform.grdInstiintariDet.SetFocus() 
		
		
		
	ENDPROC

	PROCEDURE cusodatabase1.make_sql
		Lparameters toRec,tnId
		Private pnId,pnIdInst, pnIdValuta
		Local lcSql, lnSucces, lcSelect, lnSucces2, lcComanda, lnIdPol, lcSqlMerge, lcSql1, lnSucces1
		pnIdInst = 0
		
		pnId = 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
		
		lnSucces = SQLSetprop(gnhandle,"Transactions",2)
		If lnSucces >= 0
			Do Case
				Case lcActiune = "INSERT"
					If gnButon = 2
						lnSucces = -1
					Else
						lcSelect = [INSERT INTO ] + gcS + [.instiintaripret (numar,id_util,dataora,id_pold,id_polm) VALUES (?poRec.numar,?gnIdUtil,?poRec.dataora,?poRec.id_pold,?poRec.id_polm)]+;
							[ RETURNING ID INTO ?@pnIdInst]
						lnSucces = goExecutor.oExecute(lcSelect)
						If lnSucces < 0
							amessagebox(goExecutor.cEroare,16,"Eroare")
						Else
							Select cInstiintariDet
							Scan
								Scatter Name loInst
		
								lcSql = [INSERT INTO ] + gcS + [.instiintaripret_detalii (id_instiintare,id_articol,pret_nou,pret_vechi,proc_tvav) VALUES ]+;
									[(?pnIdInst,?loInst.id_articol,?loInst.pret_nou,?loInst.pret_vechi,?loInst.proc_tvav)]
								lnSucces = goExecutor.oExecute(lcSql)
								If lnSucces < 0
									IF 'ORA-00001'$UPPER(goExecutor.cEroare)
											aMESSAGEBOX('Nu se poate adauga un articol de mai multe ori!',0+48,_screen.Caption)
									Else
										amessagebox(goExecutor.cEroare,16,"Eroare")
									ENDIF
									Exit
								Endif
							Endscan
						Endif
					Endif
				Case lcActiune = "UPDATE"
					If gnButon = 2
						lnSucces = -1
					Else
						lcSql = [UPDATE ] + gcS + [.instiintaripret SET numar=?poRec.numar, dataora = sysdate, id_pold=?poRec.id_pold, id_polm=?poRec.id_polm where id=?pnId ]
						lnSucces = goExecutor.oExecute(lcSql)
						If lnSucces < 0
							amessagebox(goExecutor.cEroare,16,"Eroare")
						Else
							lcDeleted = Set("Deleted")
							Set Deleted Off
							Select cInstiintariDet
							Scan
								Scatter Name loInst
								If Deleted()
									If  !Empty(Nvl(loInst.Id,0))
										lcComanda = [DELETE FROM ] + gcS + [.instiintaripret_detalii where id =?loInst.id ]
										lnSucces = goExecutor.oExecute(lcComanda)
										If lnSucces < 0
											amessagebox(goExecutor.cEroare,16,"Eroare")
										Endif
									Endif
								Else
									If !Empty(Nvl(loInst.Id,0))
										lcSql = [UPDATE ] + gcS + [.instiintaripret_detalii SET pret_nou =?loInst.pret_nou,pret_vechi=?loInst.pret_vechi, proc_tvav =?loInst.proc_tvav] +;
											[ where id =?loInst.Id]
									Else
										lcSql = [INSERT INTO ] + gcS + [.instiintaripret_detalii(id_instiintare,id_articol,pret_nou,pret_vechi,proc_tvav) values ]+;
											[(?pnId, ?loInst.id_articol, ?loInst.pret_nou, ?loInst.pret_vechi, ?loInst.proc_tvav)]
									Endif
									lnSucces = goExecutor.oExecute(lcSql)
									If lnSucces < 0
										IF 'ORA-00001'$UPPER(goExecutor.cEroare)
											aMESSAGEBOX('Nu se poate adauga un articol de mai multe ori!',0+48,_screen.Caption)
										ELSE 	
											amessagebox(goExecutor.cEroare,16,"Eroare")
										ENDIF
										Exit								
									Endif
								Endif
							ENDSCAN
							SET DELETED &lcDeleted
						Endif
					Endif
			Endcase
		Endif
		
		lcCmd = [select id_valuta from crm_politici_preturi where id_pol=?poRec.id_polm ]
		lnSucces3 = goExecutor.oExecute(lcCmd,'cIdVal')
		If lnSucces3 < 0
			amessagebox(goExecutor.cEroare,16,"Eroare")
		Else
			pnIdValuta = cIdVal.id_valuta
		Endif
		
		Select cInstiintariDet
		Scan
			Scatter Name loInst
			If lnSucces > 0
			TEXT TO lcSqlMerge TEXTMERGE NOSHOW
			merge into crm_politici_pret_art ppa using dual on (ppa.id_pol =?poRec.id_polm and ppa.id_Articol = ?loInst.id_articol)
			when matched then
			update set pret = ?loInst.pret_nou, pretctva = ?loInst.pret_nou, pretftva = round(?loInst.pret_nou * 1 / ?loInst.proc_tvav, 2), proc_tvav = ?loInst.proc_tvav
			when not matched then
			insert (id_pol, id_articol, pret, pretftva, pretctva, proc_tvav, id_valuta)
			values(?poRec.id_polm, ?loInst.id_articol, ?loInst.pret_nou, round(?loInst.pret_nou * 1 / ?loInst.proc_tvav, 2),?loInst.pret_nou,?loInst.proc_tvav,?pnIdValuta)
				ENDTEXT
				lnSucces = goExecutor.oExecute(lcSqlMerge)
				If lnSucces < 0
					amessagebox(goExecutor.cEroare,16,"Eroare")
				Endif
			Endif
		Endscan
		
		If lnSucces < 0
			lcSql = "ROLLBACK"
		Else
			lcSql = "COMMIT"
		Endif
		lnSucces2 = goExecutor.oExecute(lcSql)
		IF lnSucces2 < 0
			amessagebox(lcSql + Chr(13) + goExecutor.cEroare,0+16,"Eroare")
			lnSucces = -1
		ENDIF 
		
		lnSucces2 = SQLSetprop(gnhandle,"Transactions",1)
		If lnSucces2 < 0
			amessagebox('Programul nu a reusit sa treaca pe tranzactie automata. Iesiti din program si intrati din nou!',48,'Atentie!')
			lnSucces = -1	
		Endif
		
		This.csql = lcSql
		
		Return lnSucces > 0
		
	ENDPROC

	PROCEDURE grdInstiintariDet.cProcTvav._combobox1.Valid
		replace proc_tvav WITH cProcTva.proc_tva
	ENDPROC

ENDDEFINE

DEFINE CLASS instiintaripret 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="grdInstiintare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintare.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintare.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintare.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintare.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cCodMat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cCodMat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cUM.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cUM.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cGrupa.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cGrupa.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cSubgrupa.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cSubgrupa.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cPretVechi.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cPretVechi.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cProcTvav.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cProcTvav.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cPretNou.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdInstiintareDet.cPretNou.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_NOU1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_MODIFICA1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_STERGE1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 576
		lactiv2 = .T.
		lactiv3 = .T.
		lactiv4 = .T.
		Name = "instiintaripret"
		Width = 870
		_shape1.Height = 29
		_shape1.Left = -1
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 877
		_shape2.Height = 29
		_shape2.Left = 857
		_shape2.Name = "_shape2"
		_shape2.Top = -1
		_shape2.Width = 12
		Lb_titlu_alb_b121.Caption = "Instiintari pret"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 840
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

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

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

	ADD OBJECT 'BUT_STERGE1' AS but_sterge WITH ;
		DisabledPicture = ..\grafice\sterg2_sus_dis.bmp, ;
		Left = 778, ;
		Name = "BUT_STERGE1", ;
		Picture = ..\grafice\sterg_sus.bmp, ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdInstiintare' AS _grdrow WITH ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		Height = 492, ;
		Left = 12, ;
		Name = "grdInstiintare", ;
		Panel = 1, ;
		RecordSource = "cInstiintaripret", ;
		Top = 60, ;
		Width = 192, ;
		Column1.ControlSource = "numar", ;
		Column1.Name = "Column1", ;
		Column1.Width = 58, ;
		Column2.ControlSource = "dataora", ;
		Column2.Name = "Column2", ;
		Column2.Width = 99
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

	ADD OBJECT 'grdInstiintare.Column2.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data", ;
		FontBold = .T., ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdInstiintareDet' AS _grdrow WITH ;
		ColumnCount = 8, ;
		DeleteMark = .F., ;
		Height = 492, ;
		Left = 216, ;
		Name = "grdInstiintareDet", ;
		Panel = 1, ;
		RecordSource = "cInstiintaripret_det", ;
		Top = 60, ;
		Width = 636, ;
		Column1.ColumnOrder = 2, ;
		Column1.ControlSource = "denumire", ;
		Column1.Name = "cDenumire", ;
		Column1.Visible = .T., ;
		Column1.Width = 140, ;
		Column2.ColumnOrder = 1, ;
		Column2.ControlSource = "codmat", ;
		Column2.Name = "cCodMat", ;
		Column2.Visible = .T., ;
		Column2.Width = 67, ;
		Column3.ColumnOrder = 6, ;
		Column3.ControlSource = "um", ;
		Column3.Name = "cUM", ;
		Column3.Visible = .T., ;
		Column3.Width = 43, ;
		Column4.ColumnOrder = 8, ;
		Column4.ControlSource = "grupa", ;
		Column4.Name = "cGrupa", ;
		Column4.Visible = .T., ;
		Column4.Width = 64, ;
		Column5.ColumnOrder = 7, ;
		Column5.ControlSource = "subgrupa", ;
		Column5.Name = "cSubgrupa", ;
		Column5.Visible = .T., ;
		Column5.Width = 64, ;
		Column6.ColumnOrder = 4, ;
		Column6.ControlSource = "pret_vechi", ;
		Column6.Name = "cPretVechi", ;
		Column6.Visible = .T., ;
		Column6.Width = 73, ;
		Column7.ColumnOrder = 5, ;
		Column7.ControlSource = "proc_tvav", ;
		Column7.Name = "cProcTvav", ;
		Column7.Visible = .T., ;
		Column7.Width = 66, ;
		Column8.ColumnOrder = 3, ;
		Column8.ControlSource = "pret_nou", ;
		Column8.Name = "cPretNou"
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdInstiintareDet.cCodMat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "CodMat", ;
		FontBold = .T., ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

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

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

	ADD OBJECT 'grdInstiintareDet.cGrupa.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Grupa", ;
		FontBold = .T., ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdInstiintareDet.cPretNou.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret nou", ;
		FontBold = .T., ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdInstiintareDet.cPretVechi.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vechi", ;
		FontBold = .T., ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdInstiintareDet.cProcTvav.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Proc TVAV", ;
		FontBold = .T., ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdInstiintareDet.cSubgrupa.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Subgrupa", ;
		FontBold = .T., ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdInstiintareDet.cUM.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "UM", ;
		FontBold = .T., ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdInstiintareDet.cUM.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		Visible = .T.
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE actualizeaza_grid1
		LPARAMETERS pcFiltru
		
		LOCAL lcFiltru
		lcFiltru = pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru = poInstiintaripret.ca_baza1.cfiltru
		ENDIF
		
		save_grid_tag(thisform.grdInstiintare)
		poInstiintaripret.ca_baza1.cfiltru = lcFiltru
		poInstiintaripret.ca_baza1.afisare()
		restore_grid_tag(thisform.grdInstiintare)
		thisform.grdInstiintare.refresh
		thisform.grdInstiintareDet.Refresh
	ENDPROC

	PROCEDURE actualizeaza_grid2
		LPARAMETERS pcFiltru
		
		LOCAL lcFiltru
		lcFiltru = pcFiltru
		IF EMPTY(lcFiltru)
			lcFiltru = poInstiintaripret_det.ca_baza1.cfiltru
		ENDIF
		
		save_grid_tag(thisform.grdInstiintareDet)
		poInstiintaripret_det.ca_baza1.cfiltru = lcFiltru
		poInstiintaripret_det.ca_baza1.afisare()
		restore_grid_tag(thisform.grdInstiintareDet)
		thisform.grdInstiintare.refresh
		thisform.grdInstiintareDet.Refresh
	ENDPROC

	PROCEDURE do_adauga
		SELECT cInstiintaripret
		SCATTER NAME loRec BLANK MEMO 
		
		DO Adauga_Modifica_Inregistrare WITH "instiintaripret",loRec,,"INSERT"
		THIS.actualizeaza_grid1()
		this.actualizeaza_grid2()
		
		THISFORM.grdInstiintare.SETFOCUS()
	ENDPROC

	PROCEDURE do_listare
		Private pdDataOra
		If Reccount('cInstiintaripret_det')>0
			Thisform.AlwaysOnTop = .F.
			Select cInstiintaripret
			Scatter Name loRec Memo
			pdDataOra = Ttod(loRec.dataora)
			Select cInstiintaripret_det
			Index On Id Tag Id
			Select cInstiintaripret_det
			Set Order To Id
			Report Form rap_instiintaripret.frx To Printer Prompt Preview
			Thisform.AlwaysOnTop = .T.
		Else
			amessagebox("Nu exista inregistrari pentru listare",0+48,"Atentie")
		Endif
		
		
		
		
	ENDPROC

	PROCEDURE do_modifica
		LOCAL lnId
		
		SELECT cInstiintaripret
		SCATTER NAME loRec MEMO 	
		lnId = loRec.id
		
		DO Adauga_Modifica_Inregistrare WITH [instiintaripret],loRec,lnId,[UPDATE]
		IF gnButon = 1
			this.actualizeaza_grid1()
		ENDIF 	
		
		SELECT cInstiintaripret
		LOCATE FOR id = lnId
		IF !FOUND()
			GO TOP 
		ENDIF 
		this.grdInstiintare.SetFocus()
	ENDPROC

	PROCEDURE do_sterge
		LOCAL lnRasp,lcId,lcSql,lnSucces 
		lnRasp = amessagebox("Doriti sa efectuati stergerea",4+32,"Atentie")
		IF lnRasp = 6
		lcId = ALLTRIM(STR(cInstiintaripret.id))
		lcSql = [UPDATE ] + gcS + [.instiintaripret SET sters =1, id_utils = ] + ALLTRIM(STR(gnIdUtil)) + [, dataoras = sysdate where id = ] + lcId
		lnSucces = goExecutor.oExecute(lcSql)
		If lnSucces < 0
			AMESSAGEBOX(goExecutor.cEroare,0+16,'Eroare')
		ENDIF 	
		IF gnButon = 1
			this.actualizeaza_grid1()
		ENDIF 
		ENDIF 
		this.grdInstiintare.SetFocus()
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		this.grdInstiintare.SetFocus()
	ENDPROC

	PROCEDURE grdInstiintare.AfterRowColChange
		Lparameters nColIndex
		Local lnId, lcSql, lnSucces, lcCursor
		lnId = cInstiintaripret.Id
		save_grid_tag(Thisform.grdInstiintareDet)
		lcSql = [select * from instiintaripret_vdetalii where id_instiintare =] +Alltrim(Str(lnId))
		lcCursor = [cInstiintaripret_det]
		lnSucces = goExecutor.oExecute(lcSql,lcCursor)
		If lnSucces < 0
			AMESSAGEBOX(goExecutor.cEroare,0+16, 'Eroare')
		Endif
		restore_grid_tag(Thisform.grdInstiintareDet)
		Thisform.grdInstiintareDet.Refresh()
		
	ENDPROC

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_grdrow1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.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.cCant.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cCant.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.Check1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column7.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column7.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column9.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column9.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cSerie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.cSerie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column10.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column10.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column11.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_grdrow1.Column11.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_RENUNT1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: cantveche
	*</DefinedPropArrayMethod>

	*<PropValue>
		cantveche = 0
		cgridsortlist = _grdrow1
		DoCreate = .T.
		Height = 576
		Name = "schimbpret"
		Width = 780
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 780
		_SHAPE2.Anchor = 9
		_SHAPE2.Height = 29
		_SHAPE2.Left = 719
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 62
		LB_TITLU_ALB_B121.Caption = "SCHIMBARE DE PRETURI DE VANZARE"
		LB_TITLU_ALB_B121.FontSize = 11
		LB_TITLU_ALB_B121.Left = 6
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.Top = 6
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 750
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		GRIDSORT1.Left = 420
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 12
	*</PropValue>

	ADD OBJECT '_grdrow1' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 11, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		HeaderHeight = 47, ;
		Height = 513, ;
		HighlightStyle = 2, ;
		Left = 8, ;
		Name = "_grdrow1", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "schimbpret", ;
		Top = 51, ;
		Width = 760, ;
		Column1.BackColor = 255,255,255, ;
		Column1.ControlSource = "nrcrt()", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Format = "rk", ;
		Column1.Name = "Column1", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 29, ;
		Column2.BackColor = 255,255,255, ;
		Column2.ControlSource = "denumire", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "Column2", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 180, ;
		Column3.BackColor = 255,255,255, ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "codmat", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "Column3", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 63, ;
		Column4.BackColor = 255,255,236, ;
		Column4.ColumnOrder = 6, ;
		Column4.ControlSource = "stoc", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Format = "rk", ;
		Column4.InputMask = (get_mask(12,gnpCant)), ;
		Column4.Name = "cCant", ;
		Column4.ReadOnly = .F., ;
		Column4.Width = 81, ;
		Column5.BackColor = 255,255,255, ;
		Column5.ColumnOrder = 7, ;
		Column5.ControlSource = "pretvtva", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Format = "rk", ;
		Column5.InputMask = (get_mask(12,gnPPretV)), ;
		Column5.Name = "Column5", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 64, ;
		Column6.Alignment = 2, ;
		Column6.BackColor = 255,255,236, ;
		Column6.ColumnOrder = 8, ;
		Column6.ControlSource = "schimb", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Name = "Column6", ;
		Column6.ReadOnly = .F., ;
		Column6.Sparse = .F., ;
		Column6.Width = 38, ;
		Column7.BackColor = 255,255,236, ;
		Column7.ColumnOrder = 9, ;
		Column7.ControlSource = "pretvtvanou", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Format = "rk", ;
		Column7.InputMask = (get_mask(12,gnPPretV)), ;
		Column7.Name = "Column7", ;
		Column7.ReadOnly = .F., ;
		Column7.Width = 72, ;
		Column8.BackColor = 255,255,255, ;
		Column8.ColumnOrder = 10, ;
		Column8.ControlSource = "proc_tvav", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "Column9", ;
		Column8.ReadOnly = .T., ;
		Column8.Width = 45, ;
		Column9.ColumnOrder = 4, ;
		Column9.ControlSource = "serie", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.Name = "cSerie", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 84, ;
		Column10.ColumnOrder = 11, ;
		Column10.ControlSource = "pret", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.Format = "rk", ;
		Column10.InputMask = (get_mask(12,gnPA)), ;
		Column10.Name = "Column10", ;
		Column10.ReadOnly = .T., ;
		Column10.Width = 58, ;
		Column11.ColumnOrder = 5, ;
		Column11.ControlSource = "stoc_original", ;
		Column11.FontName = "Arial Narrow", ;
		Column11.Format = "rk", ;
		Column11.InputMask = (get_mask(12,gnpCant)), ;
		Column11.Name = "Column11", ;
		Column11.ReadOnly = .T.
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

	ADD OBJECT '_grdrow1.Column1.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. crt.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

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

	ADD OBJECT '_grdrow1.Column10.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 '_grdrow1.Column11.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cantitate originala", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

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

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

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

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

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

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

	ADD OBJECT '_grdrow1.Column6.Check1' AS checkbox WITH ;
		Alignment = 0, ;
		BackColor = 255,255,236, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial Narrow", ;
		Height = 17, ;
		Left = 35, ;
		Name = "Check1", ;
		ReadOnly = .F., ;
		Top = 44, ;
		Width = 60
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT '_grdrow1.Column6.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Schimb", ;
		FontBold = .T., ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT '_grdrow1.Column7.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vanz. cu TVA actual", ;
		FontBold = .T., ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT '_grdrow1.Column9.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Coef. TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

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

	ADD OBJECT '_grdrow1.cSerie.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 'BUT_RENUNT1' AS but_renunt WITH ;
		Anchor = 9, ;
		Left = 719, ;
		Name = "BUT_RENUNT1", ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Label1' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Bifati pe coloana <Schimb> si modificati pretul de vanzare cu tva <pret vanz.cu TVA actual>", ;
		Height = 17, ;
		Left = 6, ;
		Name = "Label1", ;
		Top = 31, ;
		Width = 492
		*< END OBJECT: BaseClass="label" />
	
	PROCEDURE Destroy
		
		
	ENDPROC

	PROCEDURE do_termin
		IF this.inainte_de_do_termin()
			gnButon = 1
			pnButon = 1
			Buton = 1
			pnIesire = 1
			*this.Hide 
			SELECT actactan
			DO FORM verificare WITH .t.,.t.,3  && cu buton de precedent
			
			DO CASE 
				CASE gnButon = 3
					*onirbon.visible = .t.
					* DO nrord WITH lcSelRul
				OTHERWISE 
					this.Release 
			ENDCASE 
		ENDIF
	ENDPROC

	PROCEDURE inainte_de_do_termin
		IF USED('rul_temp')
			USE IN rul_temp
		ENDIF
		
		Select schimbpret
		LOCATE FOR schimb = 1
		IF !FOUND()
			AMESSAGEBOX([Nici un articol nu are bifat "Schimb"!],0+48,"Atentie")
			RETURN
		ENDIF 
		
		*** salvez backupset-ul
		Local loBackupXML
		loBackupXML = Thisform.oBackupXML
		IF TYPE('loBackupXml') = 'O'
			loBackupXML.SaveBackupSet("schimbpret")
		ENDIF 	 
		
		lcSql = [select v.*, v.id_gestiune as id_gestin, v.nume_gestiune as gestin, v.id_gestiune as id_gestout, v.nume_gestiune as gestout, 0 as nuInConturiX from ] + gcS + [.vrul v where 1=2]
		lcCursor = [rul_temp]
		lnSucces = goExecutor.oExecute(lcSql,lcCursor)
		IF lnSucces < 0
			AMESSAGEBOX(goExecutor.cEroare,0+16, 'Eroare')
		ENDIF 
		
		&& iesiri
		Select schimbpret
		Scan For schimb = 1
			Scatter NAME poSchimb
			lnPretvtva = pretvtva
			lnCant = stoc
			
			*!* 11.06.2008
			*!* nu trebuie sa recalculez pretul de vanzare
		*!*		lnPretv = lnPretvtva / NVL(proc_tvav,1)
			
			Select rul_temp
			Append Blank
			Gather NAME poSchimb
		*!*		REPLACE pretvtva WITH lnPretvtva, pretv WITH lnPretv, cant WITH 0, cante WITH lnCant 
			REPLACE cant WITH 0, cante WITH lnCant, id_tip_rulaj with 3
			*!* 11.06.2008 ^
			Select schimbpret
		ENDSCAN
		
		
		&& intrari
		Select schimbpret
		Scan For schimb = 1 && and pretvtvanou <> pretvtva
			Scatter NAME poSchimb
			lnPretvtvanou = Round(pretvtvanou, gnPPretV)
			lnCant = stoc
			lnProcTvav = Iif(NVL(proc_tvav,1) = 0, 1, NVL(proc_tvav,1))
			If Type('schimbpret.pretvnou') = 'N'
				lnPretvNou = pretvnou
			Else 
				lnPretvnou = Round(lnPretvtvanou / lnProcTvav, gnPPretV)
			EndIf 	
			If Type('schimbpret.tvavnou') = 'N'
				lntvav = tvavnou
			Else 
				lntvav = lnPretvtvanou - lnPretvnou 
			EndIf 	
			
			Select rul_temp
			Append Blank
			Gather NAME poSchimb
			REPLACE pretv WITH lnPretvnou, pretvtva WITH lnPretvtvanou, tvav WITH lntvav, proc_tvav with lnProcTvav, cant WITH lnCant, cante with 0, id_tip_rulaj with 3
		
			Select schimbpret
		ENDSCAN
		Select rul_temp
		Replace all id_Set with poAct.id_set
		
		*** completez tabela ACTACTAN
		IF TYPE('oitem') = 'O'
			IF PEMSTATUS(oitem,'adunadate',5)
				oitem.adunadate()
			ENDIF
		ENDIF
		
		*!* 11.06.2008
		*!* proc_tvav = 1 daca este 0
		update schimbpret set proc_tvav = 1 where Empty(Nvl(proc_tvav,0))
		*!* 11.06.2008 ^
		
		Select Distinct Cont, acont, proc_tvav From schimbpret with (buffering = .t.) Into Cursor SCDURI Order By Cont, acont NOFILTER 
		
		
		Select actactan
		Locate For Alltrim(Upper(SCD))='X' And ALLTRIM(SCC)='378'
		If Found()
			Scatter NAME loAct
			Delete
		Endif
		
		Select SCDURI
		SCAN
			lnValdif = 0
			lcCont = cont
			lcAcont = NVL(acont,'')
			lnProc_tvav = proc_tvav
			
			Select schimbpret
			SUM ROUND((pretvtvanou-pretvtva)/proc_tvav*stoc,gnPC) TO lnValdif FOR schimb = 1 And cont = lcCont AND NVL(acont,'') = lcAcont AND proc_tvav = lnProc_tvav 
			
		*!*	   round(stoc*(pretvtvanou/proc_tvav pretvnou - a.pretv), 2) as difvalv,       
		*!*	   round(a.stoc*(a.tvavnou - a.tvav), 2) as difvaltva,
		*!*	   round(a.stoc*(a.pretvtvanou - a.pretvtva), 2) as difvalvvtva 
			       	
			loAct.suma = lnValdif 
			loAct.scd = lcCont 
			loAct.ascd = lcAcont 
			loAct.proc_tva = lnProc_tvav
			
			Select actactan
			Append Blank
			Gather NAME loAct
		
			Select SCDURI
		Endscan
		
		Select actactan
		Locate For Alltrim(Upper(SCD))='X' And ALLTRIM(SCC)='4428'
		If Found()
			Scatter NAME loAct
			Delete
		ENDIF
		
		Select SCDURI
		SCAN
			lnValdiftva = 0
			lcCont = cont
			lcAcont = NVL(acont,'')
			lnProc_tvav = proc_tvav
			
			Select schimbpret
			SUM ROUND((pretvtvanou-pretvtva)*(proc_tvav-1)/proc_tvav*stoc,gnPC) TO lnValdiftva FOR schimb=1 And cont = lcCont AND NVL(acont,'') = lcAcont AND proc_tvav = lnProc_tvav 
			loAct.suma = lnValdiftva 
			loAct.scd = lcCont 
			loAct.ascd = lcAcont 
			loAct.proc_tva = lnProc_tvav
			
			Select actactan
			Append Blank
			Gather NAME loAct
		
			Select SCDURI
		ENDSCAN
		
		Delete From actactan where suma = 0
		
		Do completare_parteneri_gestiune in ointroduceri.prg
		Do completare_gruputil_analitice In oproceduri_comune.prg
		Do completare_tva_analitice In oproceduri_comune.prg
		
		Select actactan
		GO TOP 
		
		SELECT rul_temp
		REPLACE ALL dataact WITH loact.dataact, nnir WITH loact.nnir, proc_tva WITH loact.proc_tva
		
		
		
		
		
	ENDPROC

	PROCEDURE Load
		*** REINCARCARE STARE PROCES VERBAL SCHIMBARE PRET SALVAT ANTERIOR IN FORMAT XML SI NETERMINAT (FATAL ERROR)
		LOCAL loBackupXML
		loBackupXML = CREATEOBJECT("BackupXML", "schimba_pret") && oproceduri_comune.prg
		This.AddProperty("oBackupXML", m.loBackupXML)
		*** daca exista deja un backupset
		IF loBackupXML.ExistsBackupSet() AND AMESSAGEBOX('Exista un proces verbal de schimbare de pret nesalvat. Doriti sa il continuati?', 4+32, _screen.Caption) = 6
			loBackupXML.RestoreBackupSet()
			Select schimbpret
			Go Top
			RETURN 
		ENDIF 
			
		Local lnTipPretNou
		lnTipPretNou = 1
		Use in (SELECT("schimbPret"))
		
		*!*	If gcUserNameApp = 'SUPERVIZOR'
		*!*		X = XMENU('PRET DIN STOC (DEFAULT);PRET DIN POLITICA DE PRETURI;PRET DIN STOCUL DIN LUNA URMATOARE')
		*!*		lnTipPretNou = Iif(Between(X,1,3), X, 1)
		*!*	EndIf 
		
		&& 1 = PRETUL NOU ESTE PRETUL DE VANZARE CU TVA DIN STOC (DEFAULT)
		&& 2 = PRETUL NOU ESTE LUAT DINTR-O POLITICA 
		&& 3 = PRETUL NOU ESTE LUAT DIN STOCUL DIN LUNA URMATOARE, PRETUL VECHI = PRETUL DE ACHIZITIE :D (PRELUARE CONPRESS DEPOZIT MARFA)
		Do Case
			Case lnTipPretNou = 2
				*!* STOC + POLITICA DE PRETURI - SCHIMB GESTIUNEA DE LA PRET DE ACHIZITIE LA PRET DE VANZARE
				*!* PRETUL DE VANZARE VECHI IL IAU DIN PRETUL DE ACHIZITIE + TVA
				*!* PRETUL DE VANZARE NOU IL IAU DIN LISTA DE PRETURI
		
				TEXT to lcSql TEXTMERGE noshow
		select s.id_stoc, s.id_articol, s.an, s.luna, s.pret, s.pretv, s.denumire, s.codmat, s.um, s.dnf, s.um2, s.cant_bax,
		       s.id_gestiune, s.nume_gestiune, s.cgest, s.nr_pag, s.tva, s.tvav, s.cants, s.cant, s.cante, s.cont, s.pretd,
		       s.dataora, s.acont, s.datain, s.dataout, s.proc_tvav, s.serie, s.grupa, s.id_subgrupa, s.subgrupa, s.id_rul_aux,
		       s.id_valuta, s.nume_val, s.codmatf, s.lot, s.adata_expirare, s.id_sucursala, s.sucursala,
		       round(s.pret,2) + round(s.tva,2) as pretvtva,
		       nvl(p.pretctva, round(s.pret,2) + round(s.tva,2)) as pretvtvanou,
		       s.cants + s.cant - s.cante AS stoc,s.cants + s.cant - s.cante AS stoc_original,
		       1  as schimb
		  from vstoc s
		  left join (select id_articol, pret as pretctva
		               from vcrm_politici_pret_art
		              where id_pol = 1 and pret <> 0) p on s.ID_ARTICOL = p.id_articol
		 where s.an = <<gnAn>>
		   and s.luna = <<gnLuna>>
		   <<Strtran(gcCondSucursala,[id_sucursala],[s.id_sucursala])>>
		   and s.cants + s.cant - s.cante > 0
		   and s.id_gestiune = <<Alltrim(Str(poact.id_gestiune))>>
		 order by s.denumire
				EndText
		
			Case lnTipPretNou = 3
				*!* STOC + POLITICA DE PRETURI - SCHIMB GESTIUNEA DE LA PRET DE ACHIZITIE LA PRET DE VANZARE
				*!* PRETUL DE VANZARE VECHI IL IAU DIN PRETUL DE ACHIZITIE + TVA
				*!* PRETUL DE VANZARE NOU IL IAU DIN LISTA DE PRETURI
		
				TEXT to lcSql TEXTMERGE noshow
		select s.id_stoc, s.id_articol, s.an, s.luna, s.pret, s.pretv, s.denumire, s.codmat, s.um, s.dnf, s.um2, s.cant_bax,
		       s.id_gestiune, s.nume_gestiune, s.cgest, s.nr_pag, s.tva, s.tvav, s.cants, s.cant, s.cante, s.cont, s.pretd,
		       s.dataora, s.acont, s.datain, s.dataout, s.proc_tvav, s.serie, s.grupa, s.id_subgrupa, s.subgrupa, s.id_rul_aux,
		       s.id_valuta, s.nume_val, s.codmatf, s.lot, s.adata_expirare, s.id_sucursala, s.sucursala,
		       round(s.pret,2) + round(s.tva,2) as pretvtva,
		       nvl(p.pretctva, round(s.pret,2) + round(s.tva,2)) as pretvtvanou,
		       nvl(p.pretv, round(s.pret,2)) as pretvnou,
		       nvl(p.tvav, round(s.tva,2)) as tvavnou,       
		       s.cants + s.cant - s.cante AS stoc,s.cants + s.cant - s.cante AS stoc_original,
		       1  as schimb
		  from vstoc s
		  left join (select id_articol, Max(PRETV) AS pretv, Max(tvav) as tvav, Max(pretv+tvav) as pretctva
		               from vstoc
		              where cants<> 0 and pretv+tvav <> 0 and an*12+luna = <<gnAn*12+gnLuna+1>> and id_gestiune = <<poact.id_gestiune>> 
					  <<gcCondSucursala>> 
					  group by id_articol) p on s.ID_ARTICOL = p.id_articol
		 where s.an = <<gnAn>>
		   and s.luna = <<gnLuna>>
		   <<Strtran(gcCondSucursala,[id_sucursala],[s.id_sucursala])>>
		   and s.cants + s.cant - s.cante > 0
		   and s.id_gestiune = <<Alltrim(Str(poact.id_gestiune))>>
		 order by s.denumire
				EndText
						
			Otherwise
				lcSql = [select s.*, s.pretv + s.tvav as pretvtva, s.pretv + s.tvav as pretvtvanou, s.cants+s.cant-s.cante AS stoc,s.cants + s.cant - s.cante AS stoc_original, 0 as schimb ]+;
					[ from vstoc s ]+;
					[ where s.an = ] + Alltrim(Str(gnAn)) + [ and s.luna = ] + Alltrim(Str(gnLuna)) + Strtran(gcCondSucursala,[id_sucursala],[s.id_sucursala]) + ;
					[ and s.cants+s.cant-s.cante>0 and s.id_gestiune =]+Alltrim(Str(poact.id_gestiune)) + [ order by s.denumire]
		
		Endcase
		lcCursor = [schimbpret]
		lnSucces = goExecutor.oExecute(lcSql,lcCursor)
		If lnSucces < 0
			AMESSAGEBOX(goExecutor.cEroare,0+16, 'Eroare')
		Endif
		
		Select schimbpret
		Do NRORD With 'schimbpret'
		
		Select schimbpret
		Go Top
		
		
	ENDPROC

	PROCEDURE _grdrow1.AfterRowColChange
		LPARAMETERS nColIndex
		DODEFAULT(nColIndex)
		
		Local loBackupXML
		loBackupXML = Thisform.oBackupXML
		IF TYPE('loBackupXml') = 'O'
			loBackupXML.SaveBackupSet("schimbpret")
		ENDIF 	 
	ENDPROC

	PROCEDURE _grdrow1.cCant.Text1.Valid
		If thisform.cantveche>0
			IF(this.value>=0 and this.value<thisform.cantveche)
			Else
			this.Value=thisform.cantveche
			EndIf
			
		Else
		this.Value=thisform.cantveche
		EndIf
		
	ENDPROC

	PROCEDURE _grdrow1.cCant.Text1.When
		thisform.cantveche=schimbpret.stoc_original
		
	ENDPROC

	PROCEDURE _grdrow1.Init
		*
	ENDPROC

ENDDEFINE

DEFINE CLASS schimbpret_grupa 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="grd_schimbarepret" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cNrCrt.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cNrCrt.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cNume_articol.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cNume_articol.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cCodmat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cCodmat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cPret.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cPret.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cSchimb.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cSchimb.Check1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cPretnou.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cPretnou.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cProc_tvav.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepret.cProc_tvav.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_RENUNT1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_urmator1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_codmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtCodmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ct_codmat" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_creeaza_filtru
		*m: do_schimba_ordine
		*p: cantveche
		*p: nordine
		*p: ntip		&& 1 - normal; 2 - cu * ( stocul gestiunilor nu este actualizat )
	*</DefinedPropArrayMethod>

	*<PropValue>
		cantveche = 0
		cgridsortlist = grd_schimbarepret
		DoCreate = .T.
		Height = 576
		Name = "schimbpret_grupa"
		nordine = 1
		ntip = 1
		Width = 780
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 780
		_SHAPE2.Anchor = 9
		_SHAPE2.Height = 29
		_SHAPE2.Left = 719
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 62
		LB_TITLU_ALB_B121.Caption = "SCHIMBARE DE PRETURI DE VANZARE - LISTA DE PRETURI"
		LB_TITLU_ALB_B121.FontSize = 11
		LB_TITLU_ALB_B121.Left = 6
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 5
		LB_TITLU_ALB_B121.Top = 6
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 750
		BUT_TERMIN1.lvizibil = .F.
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 6
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Visible = .F.
		GRIDSORT1.Left = 420
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 12
	*</PropValue>

	ADD OBJECT 'BUT_RENUNT1' AS but_renunt WITH ;
		Anchor = 9, ;
		Left = 719, ;
		Name = "BUT_RENUNT1", ;
		TabIndex = 4, ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_urmator1' AS but_urmator WITH ;
		caction = do_termin, ;
		Left = 750, ;
		Name = "But_urmator1", ;
		TabIndex = 3, ;
		Top = 1
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

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

	ADD OBJECT 'grd_schimbarepret' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 7, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		HeaderHeight = 47, ;
		Height = 480, ;
		HighlightStyle = 2, ;
		Left = 8, ;
		Name = "grd_schimbarepret", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "schimbpret", ;
		TabIndex = 2, ;
		Top = 84, ;
		Width = 760, ;
		Column1.BackColor = 255,255,255, ;
		Column1.ControlSource = "nrcrt", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Format = "rk", ;
		Column1.InputMask = "9999999999", ;
		Column1.Name = "cNrCrt", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 29, ;
		Column2.BackColor = 255,255,255, ;
		Column2.ControlSource = "nume_articol", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cNume_articol", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 180, ;
		Column3.BackColor = 255,255,255, ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "codmat", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cCodmat", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 63, ;
		Column4.BackColor = 255,255,255, ;
		Column4.ColumnOrder = 4, ;
		Column4.ControlSource = "pret", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Format = "rk", ;
		Column4.InputMask = (get_mask(12,gnPPretV)), ;
		Column4.Name = "cPret", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 64, ;
		Column5.Alignment = 2, ;
		Column5.BackColor = 255,255,236, ;
		Column5.ColumnOrder = 5, ;
		Column5.ControlSource = "schimb", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Name = "cSchimb", ;
		Column5.ReadOnly = .F., ;
		Column5.Sparse = .F., ;
		Column5.Width = 38, ;
		Column6.BackColor = 255,255,236, ;
		Column6.ColumnOrder = 6, ;
		Column6.ControlSource = "pretnou", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Format = "rk", ;
		Column6.InputMask = (get_mask(12,gnPPretV)), ;
		Column6.Name = "cPretnou", ;
		Column6.ReadOnly = .F., ;
		Column6.Width = 72, ;
		Column7.BackColor = 255,255,255, ;
		Column7.ColumnOrder = 7, ;
		Column7.ControlSource = "proc_tvav", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cProc_tvav", ;
		Column7.ReadOnly = .T., ;
		Column7.Width = 45
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

	ADD OBJECT 'grd_schimbarepret.cCodmat.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_schimbarepret.cNrCrt.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. crt.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_schimbarepret.cNrCrt.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_schimbarepret.cNume_articol.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Denumire", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_schimbarepret.cNume_articol.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_schimbarepret.cPret.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vanz. cu TVA prec.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_schimbarepret.cPret.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_schimbarepret.cPretnou.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vanz. cu TVA actual", ;
		FontBold = .T., ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

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

	ADD OBJECT 'grd_schimbarepret.cProc_tvav.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_schimbarepret.cSchimb.Check1' AS checkbox WITH ;
		Alignment = 0, ;
		BackColor = 255,255,236, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial Narrow", ;
		Height = 17, ;
		Left = 35, ;
		Name = "Check1", ;
		ReadOnly = .F., ;
		Top = 44, ;
		Width = 60
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'grd_schimbarepret.cSchimb.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Schimb", ;
		FontBold = .T., ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'lb_explicatie' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Bifati pe coloana <Schimb> si modificati pretul de vanzare cu tva <pret vanz.cu TVA actual>", ;
		Height = 17, ;
		Left = 6, ;
		Name = "lb_explicatie", ;
		TabIndex = 8, ;
		Top = 63, ;
		Width = 492
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'txtCodmat' AS textbox WITH ;
		Format = "!k", ;
		Height = 23, ;
		Left = 156, ;
		Name = "txtCodmat", ;
		TabIndex = 1, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 35, ;
		Width = 144
		*< END OBJECT: BaseClass="textbox" />
	
	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_schimba_ordine
		Lparameters tnValoare
		lcCursor = Thisform.grd_schimbarepret.RecordSource
		Select (lcCursor)
		If tnValoare = 0
			Replace ordine With 0
		Else
			Replace ordine With Thisform.nordine
			Thisform.nordine = Thisform.nordine + 1
		EndIf
	ENDPROC

	PROCEDURE do_termin
		If This.inainte_de_do_termin()
			This.Hide()
			lnRezultat = arata_stoc_schimbare(Thisform.ntip)
			Do Case
			Case lnRezultat = 3
				This.Show()
			Case lnRezultat = 2
				This.do_renunt()
			Otherwise
				gnButon = 1
				pnButon = 1
				Buton = 1
				nIesire = 1
				This.Release()
			Endcase
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local llReturn
		llReturn = .T.
		
		Thisform.ct_codmat.Value = 2
		Thisform.txtCodmat.Value = []
		Select schimbpret
		Set Filter To
		Thisform.Refresh()
		
		Select schimbpret
		Locate For schimb = 1
		If !Found()
			AMESSAGEBOX([Nici un articol nu are bifat "Schimb"!],0+48,"Atentie")
			llReturn = .F.
		Endif
		Return llReturn
	ENDPROC

	PROCEDURE Init
		Lparameters tnTip
		
		Thisform.ntip = tnTip
		DoDefault()
		
		IF tnTip = 2 && stoc neactualizat => completez si pretul precedent
			This.grd_schimbarepret.cPret.ReadOnly = .F.
			This.grd_schimbarepret.cPret.header1.FontBold = .T.
		ENDIF 
		Select schimbpret
		Go Top
		If preturi_cu_tva = 0
			lcCaption = [Bifati pe coloana "Schimb" si modificati pretul de vanzare fara TVA ( "Pret vanz. fara TVA actual" ).]
			Thisform.grd_schimbarepret.cpret.header1.Caption = [Pret vanz. fara TVA prec.]
			Thisform.grd_schimbarepret.cpretnou.header1.Caption = [Pret vanz. fara TVA actual]
		Else
			lcCaption = [Bifati pe coloana "Schimb" si modificati pretul de vanzare cu TVA ( "Pret vanz.cu TVA actual" ).]
			Thisform.grd_schimbarepret.cpret.header1.Caption = [Pret vanz. cu TVA prec.]
			Thisform.grd_schimbarepret.cpretnou.header1.Caption = [Pret vanz. cu TVA actual]
		Endif
		Thisform.lb_explicatie.Caption = lcCaption
		
	ENDPROC

	PROCEDURE KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		lcControl = Upper(Alltrim(Thisform.ActiveControl.Name))
		If lcControl = 'TXTCODMAT' And nKeyCode = 13
			Select schimbpret
			lnRecno = Recno()
			lcFiltruArt = Thisform.do_creeaza_filtru(Thisform.ct_codmat,Thisform.grd_schimbarepret.ccodmat.ControlSource,Alltrim(Strtran(Thisform.txtCodmat.Value,['],[''])))
			lcFiltru = Iif(Empty(lcFiltruArt),[2=2],lcFiltruArt)
			Set Filter To &lcFiltru
			Go top
			Thisform.grd_schimbarepret.SetFocus()
		Else
			DoDefault(nKeyCode, nShiftAltCtrl)
		Endif
	ENDPROC

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

	PROCEDURE grd_schimbarepret.cSchimb.Check1.Click
		DoDefault()
		Thisform.do_schimba_ordine(This.Value)
	ENDPROC

	PROCEDURE grd_schimbarepret.Init
		*
	ENDPROC

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_shape5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_shape4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici.cPolitica.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici.cPolitica.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici.cPretcuTVA.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici.cPretcuTVA.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici.cPretcuTVA.Check1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici.cAles.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici.cAles.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdPolitici.cAles.Check1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdGestiuni" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdGestiuni.cAles.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdGestiuni.cAles.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdGestiuni.cAles.Check1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdGestiuni.cGestiune.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdGestiuni.cGestiune.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdSubgrupe" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdSubgrupe.cSubgrupa.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdSubgrupe.cSubgrupa.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdSubgrupe.cGrupa.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdSubgrupe.cGrupa.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdSubgrupe.cAles.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdSubgrupe.cAles.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdSubgrupe.cAles.Check1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtCotaTVAVeche" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtCotaTVANoua" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdPolitici" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdGestiuni" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblInfo" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label8" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label9" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label10" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtDataActualizare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="optPret" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label11" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtZecimale" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdSelect1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdSelect2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdSelect3" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: creeazalisteales
		*m: inainte_de_actualizare_gestiuni
		*m: inainte_de_actualizare_politici
		*m: selecteazatot
		*p: cantveche
		*p: clistagestiuni		&& liste id-uri gestiuni alese
		*p: clistapoliticipreturi		&& lista id-uri politici preturi alese
		*p: clistasubgrupe		&& liste id-uri subgrupe articole alese
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		cantveche = 0
		clistagestiuni = 
		clistapoliticipreturi = 
		clistasubgrupe = 
		DoCreate = .T.
		Height = 600
		Name = "schimbpret_masa_tva"
		Width = 733
		_memberdata = <VFPData>
			<memberdata name="creeazalisteales" display="CreeazaListeAles"/>
			<memberdata name="clistapoliticipreturi" display="cListaPoliticiPreturi"/>
			<memberdata name="clistagestiuni" display="cListaGestiuni"/>
			<memberdata name="clistasubgrupe" display="cListaSubgrupe"/>
			<memberdata name="selecteazatot" display="SelecteazaTot"/>
		</VFPData>
		_SHAPE1.Anchor = 10
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 780
		_SHAPE1.ZOrderSet = 3
		_SHAPE2.Anchor = 9
		_SHAPE2.Height = 29
		_SHAPE2.Left = 702
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 33
		_SHAPE2.ZOrderSet = 4
		LB_TITLU_ALB_B121.Caption = "SCHIMBARE PRETURI IN MASA -  MODIFICAREA COTEI DE TVA VANZARE"
		LB_TITLU_ALB_B121.FontSize = 11
		LB_TITLU_ALB_B121.Left = 6
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.Top = 6
		LB_TITLU_ALB_B121.ZOrderSet = 5
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 703
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 6
		GRIDSORT1.Left = 420
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 12
	*</PropValue>

	ADD OBJECT '_label1' AS _label WITH ;
		Caption = "Politici preturi", ;
		FontBold = .T., ;
		Left = 62, ;
		Name = "_label1", ;
		Top = 40, ;
		ZOrderSet = 10
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label10' AS _label WITH ;
		Anchor = 2, ;
		Caption = "Data activare politica preturi", ;
		FontBold = .T., ;
		Left = 356, ;
		Name = "_label10", ;
		Top = 117, ;
		ZOrderSet = 25
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label11' AS _label WITH ;
		Anchor = 2, ;
		Caption = "Zecimale rotunjire pret cu TVA", ;
		FontBold = .T., ;
		Left = 356, ;
		Name = "_label11", ;
		Top = 141, ;
		ZOrderSet = 28
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label2' AS _label WITH ;
		Anchor = 8, ;
		Caption = "Gestiuni marfa pret de vanzare", ;
		FontBold = .T., ;
		Height = 18, ;
		Left = 410, ;
		Name = "_label2", ;
		Top = 387, ;
		Width = 199, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label3' AS _label WITH ;
		Caption = "Subgrupe articole", ;
		FontBold = .T., ;
		Height = 18, ;
		Left = 61, ;
		Name = "_label3", ;
		Top = 387, ;
		Width = 116, ;
		ZOrderSet = 13
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label4' AS _label WITH ;
		Anchor = 2, ;
		Caption = "Cota TVA veche", ;
		FontBold = .T., ;
		Left = 356, ;
		Name = "_label4", ;
		Top = 66, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label5' AS _label WITH ;
		Anchor = 2, ;
		Caption = "Cota TVA noua", ;
		FontBold = .T., ;
		Left = 356, ;
		Name = "_label5", ;
		Top = 92, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label6' AS _label WITH ;
		Anchor = 2, ;
		Caption = "%", ;
		FontBold = .T., ;
		Left = 499, ;
		Name = "_label6", ;
		Top = 65, ;
		ZOrderSet = 18
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label7' AS _label WITH ;
		Anchor = 2, ;
		Caption = "%", ;
		FontBold = .T., ;
		Left = 499, ;
		Name = "_label7", ;
		Top = 91, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label8' AS _label WITH ;
		Anchor = 10, ;
		AutoSize = .F., ;
		Caption = "2. Alegeti gestiunile, subgrupele de articole si cotele de TVA. Apasati butonul 2. Actualizeaza stoc. Se vor genera procese verbale de schimbare de pret.", ;
		FontBold = .F., ;
		Height = 51, ;
		Left = 358, ;
		Name = "_label8", ;
		Top = 248, ;
		Width = 362, ;
		WordWrap = .T., ;
		ZOrderSet = 23
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label9' AS _label WITH ;
		Anchor = 10, ;
		AutoSize = .F., ;
		Caption = "* Daca se aleg politici de preturi pentru procesele verbale se vor folosi preturile de vanzare din politicile de preturi (cu prioritate)", ;
		DisabledForeColor = 128,128,128, ;
		FontBold = .F., ;
		ForeColor = 255,0,0, ;
		Height = 30, ;
		Left = 358, ;
		Name = "_label9", ;
		Top = 298, ;
		Width = 363, ;
		WordWrap = .T., ;
		ZOrderSet = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_shape3' AS _shape WITH ;
		Anchor = 10, ;
		BackStyle = 0, ;
		Height = 107, ;
		Left = 350, ;
		Name = "_shape3", ;
		Top = 59, ;
		Width = 377, ;
		ZOrderSet = 2
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_shape4' AS _shape WITH ;
		Anchor = 10, ;
		BackStyle = 0, ;
		Height = 66, ;
		Left = 350, ;
		Name = "_shape4", ;
		Top = 172, ;
		Width = 377, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_shape5' AS _shape WITH ;
		Anchor = 10, ;
		BackStyle = 0, ;
		Height = 129, ;
		Left = 350, ;
		Name = "_shape5", ;
		Top = 242, ;
		Width = 377, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'cmdGestiuni' AS cmd_executa WITH ;
		Anchor = 2, ;
		AutoSize = .F., ;
		Caption = "2.  Actualizeaza  \<stoc (PV schimbare pret)", ;
		ForeColor = 0,0,160, ;
		Left = 359, ;
		Name = "cmdGestiuni", ;
		Top = 338, ;
		Width = 284, ;
		WordWrap = .T., ;
		ZOrderSet = 21
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cmdPolitici' AS cmd_executa WITH ;
		Anchor = 2, ;
		AutoSize = .F., ;
		Caption = "1. Actualizeaza politici \<preturi", ;
		ForeColor = 0,0,160, ;
		Left = 359, ;
		Name = "cmdPolitici", ;
		Top = 207, ;
		Width = 284, ;
		WordWrap = .T., ;
		ZOrderSet = 20
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cmdSelect1' AS cmd_executa WITH ;
		AutoSize = .F., ;
		Caption = "X", ;
		FontBold = .F., ;
		FontSize = 7, ;
		ForeColor = 0,0,255, ;
		Height = 19, ;
		Left = 27, ;
		Name = "cmdSelect1", ;
		Tag = "crsPolitici", ;
		ToolTipText = "Selecteaza/deselecteaza toate inregistrarile", ;
		Top = 39, ;
		Width = 24, ;
		ZOrderSet = 30
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cmdSelect2' AS cmd_executa WITH ;
		AutoSize = .F., ;
		Caption = "X", ;
		FontBold = .F., ;
		FontSize = 7, ;
		ForeColor = 0,0,255, ;
		Height = 19, ;
		Left = 26, ;
		Name = "cmdSelect2", ;
		Tag = "crsSubgrupe", ;
		ToolTipText = "Selecteaza/deselecteaza toate inregistrarile", ;
		Top = 386, ;
		Width = 24, ;
		ZOrderSet = 31
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cmdSelect3' AS cmd_executa WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		Caption = "X", ;
		FontBold = .F., ;
		FontSize = 7, ;
		ForeColor = 0,0,255, ;
		Height = 19, ;
		Left = 375, ;
		Name = "cmdSelect3", ;
		Tag = "crsGestiuni", ;
		ToolTipText = "Selecteaza/deselecteaza toate inregistrarile", ;
		Top = 386, ;
		Width = 24, ;
		ZOrderSet = 32
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdGestiuni' AS _grdbase WITH ;
		Anchor = 5, ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		Height = 184, ;
		Left = 360, ;
		Name = "grdGestiuni", ;
		Panel = 1, ;
		RecordSource = "crsGestiuni", ;
		RowHeight = 19, ;
		Top = 408, ;
		Width = 281, ;
		ZOrderSet = 9, ;
		Column1.ControlSource = "ales", ;
		Column1.CurrentControl = "Check1", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cAles", ;
		Column1.Sparse = .F., ;
		Column1.Width = 39, ;
		Column2.ControlSource = "gestiune", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cGestiune", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 207
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdGestiuni.cAles.Check1' AS checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		FontSize = 10, ;
		Height = 17, ;
		Left = 25, ;
		Name = "Check1", ;
		Top = 53, ;
		Width = 60
		*< END OBJECT: BaseClass="checkbox" />

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

	ADD OBJECT 'grdGestiuni.cAles.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 'grdGestiuni.cGestiune.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Gestiune", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdPolitici' AS _grdbase WITH ;
		Anchor = 2, ;
		ColumnCount = 3, ;
		DeleteMark = .F., ;
		HeaderHeight = 36, ;
		Height = 312, ;
		Left = 12, ;
		Name = "grdPolitici", ;
		Panel = 1, ;
		RecordSource = "crsPolitici", ;
		RowHeight = 19, ;
		Top = 60, ;
		Width = 334, ;
		ZOrderSet = 8, ;
		Column1.ColumnOrder = 2, ;
		Column1.ControlSource = "politica", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cPolitica", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 207, ;
		Column2.ColumnOrder = 3, ;
		Column2.ControlSource = "preturi_cu_tva", ;
		Column2.CurrentControl = "Check1", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cPretcuTVA", ;
		Column2.ReadOnly = .T., ;
		Column2.Sparse = .F., ;
		Column2.Width = 59, ;
		Column3.ColumnOrder = 1, ;
		Column3.ControlSource = "ales", ;
		Column3.CurrentControl = "Check1", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cAles", ;
		Column3.Sparse = .F., ;
		Column3.Width = 34
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdPolitici.cAles.Check1' AS checkbox WITH ;
		Alignment = 2, ;
		Caption = "", ;
		FontSize = 10, ;
		Height = 17, ;
		Left = 13, ;
		Name = "Check1", ;
		Top = 47, ;
		Width = 60
		*< END OBJECT: BaseClass="checkbox" />

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

	ADD OBJECT 'grdPolitici.cAles.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 'grdPolitici.cPolitica.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Politica", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdPolitici.cPretcuTVA.Check1' AS checkbox WITH ;
		Alignment = 0, ;
		Caption = "", ;
		FontSize = 10, ;
		Height = 17, ;
		Left = 70, ;
		Name = "Check1", ;
		Top = 95, ;
		Width = 60
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'grdPolitici.cPretcuTVA.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Preturi cu TVA", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdPolitici.cPretcuTVA.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 'grdSubgrupe' AS _grdbase WITH ;
		Anchor = 7, ;
		ColumnCount = 3, ;
		DeleteMark = .F., ;
		Height = 182, ;
		Left = 12, ;
		Name = "grdSubgrupe", ;
		Panel = 1, ;
		RecordSource = "crsSubgrupe", ;
		RowHeight = 19, ;
		Top = 408, ;
		Width = 334, ;
		ZOrderSet = 12, ;
		Column1.ColumnOrder = 3, ;
		Column1.ControlSource = "subgrupa", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cSubgrupa", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 190, ;
		Column2.ColumnOrder = 2, ;
		Column2.ControlSource = "grupa", ;
		Column2.CurrentControl = "Text1", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cGrupa", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 72, ;
		Column3.ColumnOrder = 1, ;
		Column3.ControlSource = "ales", ;
		Column3.CurrentControl = "Check1", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cAles", ;
		Column3.ReadOnly = .F., ;
		Column3.Sparse = .F., ;
		Column3.Width = 34
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

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

	ADD OBJECT 'grdSubgrupe.cAles.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 'grdSubgrupe.cGrupa.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Grupa", ;
		FontSize = 10, ;
		Name = "Header1", ;
		WordWrap = .F.
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'grdSubgrupe.cSubgrupa.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Subgrupa", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

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

	ADD OBJECT 'lblInfo' AS _label WITH ;
		Anchor = 10, ;
		AutoSize = .F., ;
		Caption = "1. (Optional) Alegeti politicile de preturi, subgrupele de articole si cotele de TVA. Apasati butonul 1. Actualizeaza politici preturi", ;
		DisabledForeColor = 128,128,128, ;
		FontBold = .F., ;
		Height = 30, ;
		Left = 356, ;
		Name = "lblInfo", ;
		Top = 175, ;
		Width = 361, ;
		WordWrap = .T., ;
		ZOrderSet = 22
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT 'optPret' AS _optiongrup WITH ;
		Anchor = 2, ;
		AutoSize = .T., ;
		Left = 516, ;
		Name = "optPret", ;
		Top = 60, ;
		ZOrderSet = 27, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Se pastreaza PRETUL FARA TVA", ;
		Option1.FontBold = .T., ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Se pastreaza PRETUL CU TVA", ;
		Option2.FontBold = .T., ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'txtCotaTVANoua' AS _textbox WITH ;
		Alignment = 3, ;
		Anchor = 2, ;
		Height = 23, ;
		Left = 450, ;
		Name = "txtCotaTVANoua", ;
		Top = 89, ;
		Value = 9, ;
		Width = 48, ;
		ZOrderSet = 17
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtCotaTVAVeche' AS _textbox WITH ;
		Alignment = 3, ;
		Anchor = 2, ;
		Height = 23, ;
		Left = 450, ;
		Name = "txtCotaTVAVeche", ;
		Top = 63, ;
		Value = 24, ;
		Width = 48, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtDataActualizare' AS _textbox WITH ;
		Anchor = 2, ;
		Height = 23, ;
		Left = 559, ;
		Name = "txtDataActualizare", ;
		Top = 114, ;
		Width = 73, ;
		ZOrderSet = 26
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtZecimale' AS _textbox WITH ;
		Alignment = 3, ;
		Anchor = 2, ;
		Height = 23, ;
		Left = 559, ;
		Name = "txtZecimale", ;
		ToolTipText = "Numar zecimale rotunjire Pret cu TVA (implicit 2)", ;
		Top = 139, ;
		Value = 2, ;
		Width = 24, ;
		ZOrderSet = 29
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE creeazalisteales
		lcLista = ''
		SELECT id_pol FROM crsPolitici WITH (buffering = .T.) WHERE ales = 1 INTO CURSOR crsListaAles
		SELECT crsListaAles
		scan
			lcLista = lcLista + '|' + ALLTRIM(STR(id_pol))
		ENDSCAN 
		USE IN (SELECT('crsListaAles'))
		IF !EMPTY(lcLista)
			lcLista = SUBSTR(m.lcLista, 2)
		ENDIF 
		thisform.cListaPoliticiPreturi = m.lcLista	
		
		lcLista = ''
		SELECT id_gestiune FROM crsGestiuni WITH (buffering = .T.) WHERE ales = 1 INTO CURSOR crsListaAles
		SELECT crsListaAles
		scan
			lcLista = lcLista + '|' + ALLTRIM(STR(id_gestiune))
		ENDSCAN 
		USE IN (SELECT('crsListaAles'))
		IF !EMPTY(lcLista)
			lcLista = SUBSTR(m.lcLista, 2)
		ENDIF 
		thisform.cListaGestiuni = m.lcLista	
		
		
		lcLista = ''
		SELECT id_subgrupa FROM crsSubgrupe WITH (buffering = .T.) WHERE ales = 1 INTO CURSOR crsListaAles
		SELECT crsListaAles
		scan
			lcLista = lcLista + '|' + ALLTRIM(STR(id_subgrupa))
		ENDSCAN 
		USE IN (SELECT('crsListaAles'))
		IF !EMPTY(lcLista)
			lcLista = SUBSTR(m.lcLista, 2)
		ENDIF 
		thisform.cListaSubgrupe = m.lcLista
	ENDPROC

	PROCEDURE Destroy
		USE IN (SELECT('crsPolitici'))
		USE IN (SELECT('crsSubgrupe'))
		USE IN (SELECT('crsGestiuni'))
	ENDPROC

	PROCEDURE inainte_de_actualizare_gestiuni
		#define CRLF CHR(13) + CHR(10)
		Local lcMesaj, lnPolitici, lnSubgrupe, lnGestiuni 
		lcMesaj = ''
		llReturn = .T.
		
		lnProcTVAVechi = thisform.txtCotaTVAVeche.Value
		lnProcTVANou = thisform.txtCotaTVANoua.Value
		lnZecimaleRotunjire = thisform.txtZecimale.value 
		ldDataActualizare = thisform.txtDataActualizare
		
		Calculate Cnt(id_pol) For ales = 1 To lnPolitici In crsPolitici
		Calculate Cnt(id_subgrupa) For ales = 1 To lnSubgrupe In crsSubgrupe
		Calculate Cnt(id_gestiune) For ales = 1 To lnGestiuni In crsGestiuni
		Do Case
			Case lnGestiuni = 0
				llReturn = (AMESSAGEBOX('Nu ati ales nici o gestiune! Doriti sa modificati preturile pentru toate gestiunile de marfa la pret de vanzare?',4+32, _screen.Caption) = 6)
			Case lnSubgrupe = 0
				llReturn = (AMESSAGEBOX('Nu ati ales nici o subgrupa de articole! Doriti sa modificati preturile pentru toate subgrupele de articole?',4+32, _screen.Caption) = 6)
			CASE !BETWEEN(m.lnProcTVAVechi, 0, 50)
				AMESSAGEBOX('Cota TVA veche nu este intre 0-50%!',0+48, _screen.Caption)
				llReturn = .F.		
			CASE !BETWEEN(m.lnProcTVANou, 0, 50)
				AMESSAGEBOX('Cota TVA noua nu este intre 0-50%!',0+48, _screen.Caption)
				llReturn = .F.		
			CASE m.lnProcTVAVechi = m.lnProcTVANou
				AMESSAGEBOX('Cotele TVA nu trebuie sa fie egale!',0+48, _screen.Caption)
				llReturn = .F.		
			CASE !BETWEEN(m.lnZecimaleRotunjire, 1, 2)
				AMESSAGEBOX('Numarul de zecimale rotunjire pret de vanzare nu este intre 1 si 2',0+48, _screen.Caption)
				llReturn = .F.		
		Endcase
		IF m.llReturn
			lcMesaj = 'Doriti sa actualizati stocul pentru ' + ;
				IIF(lnGestiuni = 0, 'toate gestiunile de marfa la pret de vanzare, ', 'gestiunile alese, ') + CRLF + ;	
				IIF(lnSubgrupe = 0, 'toate subgrupele de articole, ', 'subgrupele de articole alese, ') + CRLF + ;
				IIF(lnPolitici = 0, 'cu preturile din politicile alese, ', '') + CRLF + ;			
				'de la cota TVA ' + TRANSFORM(lnProcTVAVechi) + '% la ' + TRANSFORM(lnProcTVANou) + '%?'
			llReturn = (AMESSAGEBOX(m.lcMesaj, 4+32, _Screen.Caption) = 6)
		ENDIF 	
		Return m.llReturn
		
	ENDPROC

	PROCEDURE inainte_de_actualizare_politici
		#define CRLF CHR(13) + CHR(10)
		Local lcMesaj, lnPolitici, lnSubgrupe
		lcMesaj = ''
		llReturn = .T.
		
		lnProcTVAVechi = thisform.txtCotaTVAVeche.Value
		lnProcTVANou = thisform.txtCotaTVANoua.Value
		lnZecimaleRotunjire = thisform.txtZecimale.value 
		ldDataActualizare = thisform.txtDataActualizare
		
		Calculate Cnt(id_pol) For ales = 1 To lnPolitici In crsPolitici
		Calculate Cnt(id_subgrupa) For ales = 1 To lnSubgrupe In crsSubgrupe
		Do Case
			Case lnPolitici = 0
				AMESSAGEBOX('Alegeti politicile de preturi pentru actualizare!', 0+48, _screen.Caption)
				llReturn = .F.
			Case lnSubgrupe = 0
				llReturn = (AMESSAGEBOX('Nu ati ales subgrupele de articole. Doriti sa modificati preturile pentru toate subgrupele de articole?',4+32, _screen.Caption) = 6)
			CASE !BETWEEN(m.lnProcTVAVechi, 0, 50)
				AMESSAGEBOX('Cota TVA veche nu este intre 0-50%!',0+48, _screen.Caption)
				llReturn = .F.		
			CASE !BETWEEN(m.lnProcTVANou, 0, 50)
				AMESSAGEBOX('Cota TVA noua nu este intre 0-50%!',0+48, _screen.Caption)
				llReturn = .F.		
			CASE m.lnProcTVAVechi = m.lnProcTVANou
				AMESSAGEBOX('Cotele TVA nu trebuie sa fie egale!',0+48, _screen.Caption)
				llReturn = .F.		
			CASE !BETWEEN(m.lnZecimaleRotunjire, 0, 2)
				AMESSAGEBOX('Numarul de zecimale rotunjire pret de vanzare nu este intre 1 si 2',0+48, _screen.Caption)
				llReturn = .F.		
		Endcase
		IF m.llReturn
			lcMesaj = 'Doriti sa actualizati preturile din politicile de preturi alese, pentru ' + ;
				IIF(lnSubgrupe = 0, 'toate subgrupele de articole, ', 'subgrupele de articole alese, ') + CRLF + ;
				'de la cota TVA ' + TRANSFORM(lnProcTVAVechi) + '% la ' + TRANSFORM(lnProcTVANou) + '%?'
			llReturn = (AMESSAGEBOX(m.lcMesaj, 4+32, _Screen.Caption) = 6)
		ENDIF 	
		Return m.llReturn
		
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		
		DO CASE 
			CASE m.gnAn = 2025
				thisform.txtCotaTVAVeche.Value = 19
				thisform.txtCotaTVANoua.Value = 21
				thisform.txtDataActualizare.Value = DATE(2025,8,1)
				thisform.txtzecimale.Value = 2
		
			CASE m.gnAn = 2015
				thisform.txtCotaTVAVeche.Value = 24
				thisform.txtCotaTVANoua.Value = 9
				thisform.txtDataActualizare.Value = DATE(2015,6,1)
				thisform.txtzecimale.Value = 2
				
			CASE m.gnAn = 2010
				thisform.txtCotaTVAVeche.Value = 19
				thisform.txtCotaTVANoua.Value = 24
				thisform.txtDataActualizare.Value = DATE(2010,7,1)
				thisform.txtzecimale.Value = 2
		
			OTHERWISE 	
				thisform.txtCotaTVAVeche.Value = 24
				thisform.txtCotaTVANoua.Value = 24
				thisform.txtDataActualizare.Value = DATE() + 1
				thisform.txtzecimale.Value = 2
		ENDCASE 
	ENDPROC

	PROCEDURE Load
		TEXT TO lcSql TEXTMERGE NOSHOW 
		select 0 as ales,
			   p.sucursala,
		       id_pol,
		       nume_lista_preturi as politica,
		       datai,
		       datas,
		       preturi_cu_tva
		  from vcrm_politici_preturi p
		  left join vnom_valute v
		    on p.id_valuta = v.id_valuta
		 where p.inactiv = 0
		   and to_date('<<[01] + PADL(gnLuna,2,[0]) + ALLTRIM(STR(gnAn))>>','ddmmyyyy') between datai and datas
		   <<gcCondSucursala>>
		 order by sucursala, nume_lista_preturi
		endtext  
		llSucces = goExecutor.oExecuta(m.lcSql, 'crsPolitici')
		
		TEXT TO lcSql TEXTMERGE NOSHOW 
		select 0 as ales, sucursala, id_gestiune, nume_gestiune as gestiune, cgest
		  from vnom_gestiuni
		 where inactiv = 0
		   and nr_pag in (6, 7)
		   <<gcCondSucursala>>
		 order by sucursala, nume_gestiune
		endtext
		llSucces = goExecutor.oExecuta(m.lcSql, 'crsGestiuni')
		
		TEXT TO lcSql NOSHOW 
		select 0 as ales, id_subgrupa, subgrupa, indicativ, grupa
		  from vgest_art_sbgr
		 order by grupa, subgrupa
		endtext 
		llSucces = goExecutor.oExecuta(m.lcSql, 'crsSubgrupe')
	ENDPROC

	PROCEDURE selecteazatot
		LPARAMETERS toCmdSelecteaza
		lcCaption = toCmdSelecteaza.Caption
		lcCursor = toCmdSelecteaza.Tag
		IF m.lcCaption = 'X'
			UPDATE (lcCursor) SET ales = 1
			toCmdSelecteaza.Caption = '-'
		ELSE
			UPDATE (lcCursor) SET ales = 0
			toCmdSelecteaza.Caption = 'X'
		ENDIF 	
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		
		DODEFAULT(nStyle)
		LOCAL lnHeight, lnWidth
		
		lnHeight = _screen.Height
		lnWidth = _screen.Width
		
		This.Height = INT(m.lnHeight *0.8)
		*This.Width = INT(m.lnWidth * 0.8)
		
		This.AutoCenter = .T. 
	ENDPROC

	PROCEDURE cmdGestiuni.Click
		Local lcSql, llSucces
		PRIVATE pcListaPoliticiPreturi, pcListaSubgrupeArticol, pdDataActualizare, pnPretCuTVAIdentic
		PRIVATE pnProcTVANou, pnProcTVAVechi, pnZecimaleRotunjire
		SET STEP ON 
		llSucces = Thisform.inainte_de_actualizare_gestiuni()
		IF !m.llSucces
			RETURN
		ENDIF 
		
		Thisform.CreeazaListeAles()
		pcListaGestiuni = thisform.cListaGestiuni
		pcListaPoliticiPreturi = thisform.cListaPoliticiPreturi
		pcListaSubgrupeArticol = thisform.cListaSubgrupe
		pnPretCuTVAIdentic = IIF(thisform.optPret.Value = 2, 1, 0)
		pnProcTVAVechi = 1 + thisform.txtCotaTVAVeche.Value/100
		pnProcTVANou = 1 + thisform.txtCotaTVANoua.Value/100 
		pnZecimaleRotunjire = thisform.txtZecimale.value 
		
		TEXT TO lcSql NOSHOW 
		begin
		pack_gestiuni.actualizare_stoc_tva(?pcListaGestiuni,
										?pcListaSubgrupeArticol,
										?pcListaPoliticiPreturi,
		                                ?pnPretCuTVAIdentic,
		                                ?pnProcTVAVechi,
		                                ?pnProcTVANou,
		                                ?pnZecimaleRotunjire,
		                                ?gnAn,
		                                ?gnLuna);
		end;
		ENDTEXT                                 
		llSucces = goExecutor.oExecuta(m.lcSql)
		
	ENDPROC

	PROCEDURE cmdPolitici.Click
		Local lcSql, llSucces
		PRIVATE pcListaPoliticiPreturi, pcListaSubgrupeArticol, pdDataActualizare, pnPretCuTVAIdentic
		PRIVATE pnProcTVANou, pnProcTVAVechi, pnZecimaleRotunjire
		SET STEP ON 
		llSucces = Thisform.inainte_de_actualizare_politici()
		IF !m.llSucces
			RETURN
		ENDIF 
		
		Thisform.CreeazaListeAles()
		pcListaPoliticiPreturi = thisform.cListaPoliticiPreturi
		pcListaSubgrupeArticol = thisform.cListaSubgrupe
		pnPretCuTVAIdentic = IIF(thisform.optPret.Value = 2, 1, 0)
		pnProcTVAVechi = 1 + thisform.txtCotaTVAVeche.Value/100
		pnProcTVANou = 1 + thisform.txtCotaTVANoua.Value/100 
		pnZecimaleRotunjire = thisform.txtZecimale.value 
		pdDataActualizare = thisform.txtDataActualizare.Value 
		
		TEXT TO lcSql NOSHOW 
		begin
		pack_preturi.actualizare_pol_tva(?pcListaPoliticiPreturi,
		                                ?pcListaSubgrupeArticol,
		                                ?pnPretCuTVAIdentic,
		                                ?pnProcTVAVechi,
		                                ?pnProcTVANou,
		                                ?pnZecimaleRotunjire,
		                                ?pdDataActualizare);
		                                
		end;
		ENDTEXT                         
		
		                                     
		llSucces = goExecutor.oExecuta(m.lcSql)
		
	ENDPROC

	PROCEDURE cmdSelect1.Click
		thisform.SelecteazaTot(this)
		
		
	ENDPROC

	PROCEDURE cmdSelect2.Click
		thisform.SelecteazaTot(this)
	ENDPROC

	PROCEDURE cmdSelect3.Click
		thisform.SelecteazaTot(this)
	ENDPROC

	PROCEDURE optPret.Valid
		This.Parent.txtZecimale.Enabled = (this.Value = 1)
		This.Parent.txtZecimale.Refresh()
	ENDPROC

ENDDEFINE

DEFINE CLASS schimbpret_stoc_gest 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="grd_schimbarepretcant" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cNrcrt.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cNrcrt.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cCodmat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cCodmat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cStoc.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cStoc.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cPretvtva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cPretvtva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cPretvtvanou.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cPretvtvanou.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cProc_tvav.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cProc_tvav.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cSerie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cSerie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cPret.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cPret.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cStoc_original.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cStoc_original.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cNume_gestiune.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_schimbarepretcant.cNume_gestiune.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_precedent1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_RENUNT1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_nume_gestiune" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtNumeGestiune" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ct_gestiune" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_pret" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_ascunde
		*m: do_creeaza_filtru
		*p: nstoc_original
		*p: ntip		&& 1 - normal; 2 - cu * ( stocul gestiunilor nu este actualizat )
		*p: obackupxml
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grd_schimbarepretcant
		DoCreate = .T.
		Height = 576
		Name = "schimbpret_stoc_gest"
		nstoc_original = 0
		ntip = 1
		obackupxml = .NULL.
		Width = 780
		WindowState = 2
		_memberdata = <VFPData>
			<memberdata name="obackupxml" display="oBackupXML"/>
		</VFPData>
		_SHAPE1.Anchor = 11
		_SHAPE1.Height = 29
		_SHAPE1.Left = 0
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE1.Top = 0
		_SHAPE1.Width = 780
		_SHAPE1.ZOrderSet = 0
		_SHAPE2.Anchor = 9
		_SHAPE2.Height = 29
		_SHAPE2.Left = 688
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 97
		_SHAPE2.ZOrderSet = 1
		LB_TITLU_ALB_B121.Caption = "SCHIMBARE DE PRETURI DE VANZARE - CANTITATI IN GESTIUNE"
		LB_TITLU_ALB_B121.FontSize = 11
		LB_TITLU_ALB_B121.Left = 6
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 6
		LB_TITLU_ALB_B121.Top = 6
		LB_TITLU_ALB_B121.ZOrderSet = 2
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 750
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 3
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 7
		GRIDSORT1.Left = 420
		GRIDSORT1.Name = "GRIDSORT1"
		GRIDSORT1.Top = 12
	*</PropValue>

	ADD OBJECT 'But_precedent1' AS but_precedent WITH ;
		Anchor = 9, ;
		Left = 689, ;
		Name = "But_precedent1", ;
		TabIndex = 5, ;
		Top = 1, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'BUT_RENUNT1' AS but_renunt WITH ;
		Anchor = 9, ;
		Left = 719, ;
		Name = "BUT_RENUNT1", ;
		TabIndex = 4, ;
		Top = 1, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'ck_pret' AS _checkbox WITH ;
		Alignment = 0, ;
		AutoSize = .F., ;
		Caption = "Ascunde gestiunile pentru care pretul de vanz. cu TVA prec. este egal cu pretul de vanz. cu TVA actual.", ;
		FontName = "Arial Narrow", ;
		Height = 40, ;
		Left = 334, ;
		Name = "ck_pret", ;
		TabIndex = 9, ;
		Top = 28, ;
		Visible = .F., ;
		Width = 247, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

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

	ADD OBJECT 'grd_schimbarepretcant' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 11, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		HeaderHeight = 47, ;
		Height = 492, ;
		HighlightStyle = 2, ;
		Left = 9, ;
		Name = "grd_schimbarepretcant", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "schimbpretstoc", ;
		TabIndex = 2, ;
		Top = 72, ;
		Width = 760, ;
		ZOrderSet = 4, ;
		Column1.BackColor = 255,255,255, ;
		Column1.ControlSource = "nrcrt", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Format = "rk", ;
		Column1.InputMask = "9999999999", ;
		Column1.Name = "cNrcrt", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 29, ;
		Column2.BackColor = 255,255,255, ;
		Column2.ControlSource = "denumire", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDenumire", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 180, ;
		Column3.BackColor = 255,255,255, ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "codmat", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cCodmat", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 63, ;
		Column4.BackColor = 255,255,236, ;
		Column4.ColumnOrder = 7, ;
		Column4.ControlSource = "stoc", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Format = "rk", ;
		Column4.InputMask = (get_mask(12,gnpCant)), ;
		Column4.Name = "cStoc", ;
		Column4.ReadOnly = .F., ;
		Column4.Width = 81, ;
		Column5.ColumnOrder = 8, ;
		Column5.ControlSource = "pretvtva", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Format = "rk", ;
		Column5.InputMask = (get_mask(12,gnPPretV)), ;
		Column5.Name = "cPretvtva", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 64, ;
		Column6.ColumnOrder = 9, ;
		Column6.ControlSource = "pretvtvanou", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Format = "rk", ;
		Column6.InputMask = (get_mask(12,gnPPretV)), ;
		Column6.Name = "cPretvtvanou", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 72, ;
		Column7.Bound = .T., ;
		Column7.ColumnOrder = 10, ;
		Column7.ControlSource = "proc_tva", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.InputMask = "99.99", ;
		Column7.Name = "cProc_tvav", ;
		Column7.ReadOnly = .T., ;
		Column7.Width = 45, ;
		Column8.ColumnOrder = 4, ;
		Column8.ControlSource = "serie", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "cSerie", ;
		Column8.ReadOnly = .T., ;
		Column8.Width = 84, ;
		Column9.ColumnOrder = 11, ;
		Column9.ControlSource = "pret", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.Format = "rk", ;
		Column9.InputMask = (get_mask(12,gnPPret)), ;
		Column9.Name = "cPret", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 58, ;
		Column10.ColumnOrder = 6, ;
		Column10.ControlSource = "stoc_original", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.Format = "rk", ;
		Column10.InputMask = (get_mask(12,gnpCant)), ;
		Column10.Name = "cStoc_original", ;
		Column10.ReadOnly = .T., ;
		Column11.ColumnOrder = 5, ;
		Column11.ControlSource = "nume_gestiune", ;
		Column11.FontName = "Arial Narrow", ;
		Column11.Name = "cNume_gestiune", ;
		Column11.ReadOnly = .T.
		*< END OBJECT: ClassLib="_grd_base.vcx" BaseClass="grid" />

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

	ADD OBJECT 'grd_schimbarepretcant.cCodmat.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_schimbarepretcant.cDenumire.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Denumire", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_schimbarepretcant.cDenumire.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_schimbarepretcant.cNrcrt.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. crt.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_schimbarepretcant.cNrcrt.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_schimbarepretcant.cNume_gestiune.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Gestiune", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_schimbarepretcant.cNume_gestiune.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_schimbarepretcant.cPret.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret achizitie", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_schimbarepretcant.cPret.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_schimbarepretcant.cPretvtva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vanz. cu TVA prec.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_schimbarepretcant.cPretvtva.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_schimbarepretcant.cPretvtvanou.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret vanz. cu TVA actual", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

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

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

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

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

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

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

	ADD OBJECT 'grd_schimbarepretcant.cStoc_original.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 'Lb_nume_gestiune' AS lb_simplu WITH ;
		Caption = "Gestiune", ;
		FontName = "Arial Narrow", ;
		Left = 17, ;
		Name = "Lb_nume_gestiune", ;
		TabIndex = 8, ;
		Top = 40
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />

	ADD OBJECT 'txtNumeGestiune' AS textbox WITH ;
		Format = "!k", ;
		Height = 23, ;
		Left = 162, ;
		Name = "txtNumeGestiune", ;
		TabIndex = 1, ;
		ToolTipText = "Tastati primele litere pentru cautare articole", ;
		Top = 38, ;
		Width = 144
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE do_ascunde
		Lparameters tnValCk
		Select schimbpretstoc
		If tnValCk = 1
			Set Filter To pretvtva<>pretvtvanou
		Else
			Set Filter To
		Endif
		Thisform.grd_schimbarepretcant.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_termin
		If This.inainte_de_do_termin()
			Thisform.AlwaysOnTop = .F.
			lnRezultat = creeaza_note_schimbare_pret()
			Thisform.AlwaysOnTop = .T.
			Do Case
			Case lnRezultat = 1
				gnButon = 1
				pnButon = 1
				Buton = 1
				nIesire = 1
				This.Release()
			Case lnRezultat = 2
			*!*	modificare	ROAGEST	v 2.0.111
				This.do_ascunde(thisform.ck_pret.Value)
			*!*	modificare	ROAGEST	v 2.0.111	^
				This.do_renunt()
			Otherwise
		*!*	se intoarce in fereastra
			Endcase
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Select schimbpretstoc
		Set Filter To
		Thisform.txtNumeGestiune.Value = []
		Thisform.ct_gestiune.Value = 1
		Thisform.Refresh()
		Return .T.
	ENDPROC

	PROCEDURE Init
		Lparameters tnTip
		Thisform.nTip = tnTip
		DoDefault()
		If Thisform.nTip = 2
		*!*	modificare	ROAGEST v 2.0.111
			Thisform.ck_pret.Visible = .T.
			Thisform.grd_schimbarepretcant.SetAll('DynamicForeColor','IIF(pretvtva<>pretvtvanou,RGB(0,0,0),RGB(40,145,67))','Column')
			Thisform.grd_schimbarepretcant.SetAll('DynamicFontBold','IIF(pretvtva<>pretvtvanou,.F.,.T.)','Column')
		*!*	modificare	ROAGEST v 2.0.111	^
			With Thisform.grd_schimbarepretcant.cPretvtva
				.ReadOnly = .F.
				.BackColor = Rgb(255,255,236)
			Endwith
		Endif
		
	ENDPROC

	PROCEDURE KeyPress
		Lparameters nKeyCode, nShiftAltCtrl
		lcControl = Upper(Alltrim(Thisform.ActiveControl.Name))
		If lcControl = 'TXTNUMEGESTIUNE' And nKeyCode = 13
			Select schimbpretstoc
			lnRecno = Recno()
			lcFiltruGest = Thisform.do_creeaza_filtru(Thisform.ct_gestiune,Thisform.grd_schimbarepretcant.cNume_gestiune.ControlSource,Alltrim(Strtran(Thisform.txtNumeGestiune.Value,['],[''])))
			lcFiltru = Iif(Empty(lcFiltruGest),[2=2],lcFiltruGest)
			Set Filter To &lcFiltru
			Go top
			Thisform.grd_schimbarepretcant.cStoc.text1.SetFocus()
		Else
			DoDefault(nKeyCode, nShiftAltCtrl)
		Endif
	ENDPROC

	PROCEDURE ck_pret.Click
		Thisform.do_ascunde(This.Value)
	ENDPROC

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

	PROCEDURE grd_schimbarepretcant.AfterRowColChange
		LPARAMETERS nColIndex
		DODEFAULT(nColIndex)
		Local loBackupXML
		loBackupXML = Thisform.oBackupXML
		IF TYPE('loBackupXml') = 'O'
			loBackupXML.SaveBackupSet("schimbpretstoc")
		ENDIF 	 
	ENDPROC

	PROCEDURE grd_schimbarepretcant.cStoc.Text1.InteractiveChange
		If Thisform.nstoc_original>0
		*!*	modificare ROAGEST v 2.0.72
		*!*		If !Between(This.Value,0,Thisform.nstoc_original)
			If This.Value <0
		*!*	modificare ROAGEST v 2.0.72	^
				This.Value = Thisform.nstoc_original
			Endif
		*Else
			*This.Value = Thisform.nstoc_original
		Endif
	ENDPROC

	PROCEDURE grd_schimbarepretcant.cStoc.Text1.When
		Thisform.nstoc_original=schimbpretstoc.stoc_original
		
	ENDPROC

	PROCEDURE grd_schimbarepretcant.Init
		*
	ENDPROC

ENDDEFINE
