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

	*<PropValue>
		Name = "cus_odata_catalog_articole"
	*</PropValue>
	
	PROCEDURE make_sql
		*!* 27.08.2009
		*!* marius.mutu
		*!* nom_articole.taxa_reconditionare
		
		*!*	19.12.2019
		*!*	marius.mutu
		*!*	variabila privata pnIdAMS creata in adauga_modifica_inregistrare@oproceduri_ams.prg pentru completarea cu id-ul generat in INSERT
		
		Lparameters toRec,tnId
		lcActiune = Alltrim(This.cActiune)
		
		
		If Inlist(lcActiune, "UPDATE",'INSERT') And Type('toRec') != "O"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE') And Type('tnId') != "N"
			Return .F.
		Endif
		
		IF TYPE('pnIdAMS') = 'U'
			PRIVATE pnIdAMS
			pnIdAMS = 0
		ENDIF 	
		
		lcActiune = Alltrim(This.cActiune)
		Private pnId, pccodmat, pcdenumire, pcum, pccont, pcacont, pnid_subgrupa, pnCant_bax, pcum2, pcCodBare, pnDNF, pnin_stoc, pnin_crm, pninactiv, pnIdUtil, pnListareCodBare
		PRIVATE pcCodNC8, pnGreutate, pnIdTaraOrigine, pcCodUMISO
		*!*	Public pnIdArticolTemp
		*!*	pnIdArticolTemp = 0		&&	14.02.2013 : l-am adaugat pentru ca altfel imi da eroare la apelarea procedurii de salvare
		If Inlist(lcActiune, "UPDATE",'DELETE')
			pnId = tnId
		ENDIF
		pnIdUtil = gnIdUtil
		
		If Inlist(lcActiune, "UPDATE",'INSERT')
			pccodmat = Strtran(Alltrim(Upper(Nvl(toRec.codmat,[]))),['],[''])
			pccodmatf = Strtran(Alltrim(Upper(Nvl(toRec.codmatf,[]))),['],[''])
			pcdenumire = Strtran(Alltrim(Upper(Nvl(toRec.denumire,[]))),['],[''])
			pcconditii_pastrare = Strtran(Alltrim(Upper(Nvl(toRec.conditii_pastrare,[]))),['],[''])
			pcum = Nvl(Upper(Alltrim(toRec.um)),'')
			pccont = Alltrim(Nvl(toRec.Cont,[]))
			pcacont = Nvl(Alltrim(toRec.acont),'')
			pnid_subgrupa =  toRec.id_subgrupa
			pnCant_bax = toRec.cant_bax
			pcum2 = Nvl(Upper(Alltrim(toRec.um2)),'')
			pcCodBare = Nvl(Alltrim(toRec.codbare),'')
			pnDNF = Nvl(toRec.dnf,0)
			pnin_stoc = Nvl(toRec.in_stoc,0)
			pnin_crm = Nvl(toRec.in_crm,0)
			pnListareCodBare = Nvl(toRec.listare_codbare,0)	
			pninactiv = Nvl(toRec.inactiv,0)
			pnId_part = toRec.id_part
			pnTaxaReconditionare = Nvl(toRec.taxa_reconditionare,0)
			pnIdArticolGeneral = toRec.id_articol_general
			pnTip = toRec.tip
			pcCodNC8 = ALLTRIM(NVL(toRec.codNC8, ''))
			pnGreutate = toRec.greutate
			pnIdTaraOrigine = toRec.id_tara_origine
			pcCodCPV = ALLTRIM(NVL(toRec.codCPV, ''))
			pcCodUMISO = ALLTRIM(NVL(toRec.cod_um_iso, ''))
		Endif
		Do Case
			Case lcActiune = "INSERT"
				lcSql = [begin pack_preturi.adauga_articol(?gnAn,']+pccodmat+[', '] + pccodmatf + [', '] + pcconditii_pastrare + [', '] + ;
					pcdenumire + [','] + pcum + [','] + pccont + [','] + pcacont + [',] + Alltrim(Str(pnid_subgrupa)) + [,] + ;
					ALLTRIM(Str(pnCant_bax,10,4)) + [,'] + pcum2 + [','] + pcCodBare + [',] + Alltrim(Str(pnDNF)) + [,] + ;
					IIF(Isnull(pnIdArticolGeneral),[NULL],Alltrim(Str(pnIdArticolGeneral))) + [,] + ;
					Alltrim(Str(pnin_stoc)) + [,] + Alltrim(Str(pnin_crm)) + [,] + ;
					ALLTRIM(Str(pninactiv)) + [,?gnIdUtil,] + ;
					IIF(Isnull(pnId_part),[NULL],Alltrim(Str(pnId_part)))+[,] + ;
					Alltrim(Str(pnTaxaReconditionare,18,4)) + [,] + ;
					Alltrim(Str(pnListareCodBare)) + [,?@pnIdAMS,] + ;
					alltrim(str(pnTip)) + [,0] + [, '] + m.pcCodNC8 + [',] + ALLTRIM(STR(NVL(m.pnGreutate, 0),12,4)) + [,] + ALLTRIM(STR(m.pnIdTaraOrigine)) + [, '] + m.pcCodCPV + [','] + m.pcCodUMISO + ['); end;]
			Case lcActiune = "UPDATE"
				lcSql = [begin pack_preturi.modifica_articol(?gnAn,]+Alltrim(Str(pnId))+[, ']+;
					pccodmat+ [', '] + pccodmatf + [', '] + pcconditii_pastrare + [','] + pcdenumire+[',] + ;
					[']+pcum+[', ']+pccont+[', ']+pcacont+[', ]+Alltrim(Str(pnid_subgrupa))+[, ]+;
					ALLTRIM(Str(pnCant_bax,10,4))+[, ']+pcum2+[', ']+pcCodBare+[', ]+Alltrim(Str(pnDNF))+[, ]+;
					IIF(Isnull(pnIdArticolGeneral),[NULL],Alltrim(Str(pnIdArticolGeneral))) + [,] + ;
					Alltrim(Str(pnin_stoc)) + [,] + Alltrim(Str(pnin_crm)) + [,] + ;
					ALLTRIM(Str(pninactiv)) + [,?gnIdUtil,] + ;
					IIF(Isnull(pnId_part),[NULL],Alltrim(Str(pnId_part)))+[,] + ;
					Alltrim(Str(pnTaxaReconditionare,18,4)) + [,] + ;
					Alltrim(Str(pnListareCodBare)) + [,] + ;
					alltrim(str(pnTip)) + [,0] + [, '] + m.pcCodNC8 + [',] + ALLTRIM(STR(NVL(m.pnGreutate, 0),12,4)) + [,] + IIF(ISNULL(m.pnIdTaraOrigine), [NULL], ALLTRIM(STR(m.pnIdTaraOrigine))) + [, '] + m.pcCodCPV + [','] + m.pcCodUMISO + ['); end;]
			Case lcActiune = "DELETE"
				lcSql = [begin pack_preturi.sterge_articol(?pnId, ?pnIdUtil); end;]
		Endcase
		
		This.csql = lcSql
	ENDPROC

ENDDEFINE

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

	*<PropValue>
		Name = "cus_odata_grupe_art"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		
		lcActiune = Alltrim(This.cActiune)
		
		If Inlist(lcActiune, "UPDATE",'INSERT') And Type('toRec') != "O"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE') And Type('tnId') != "N"
			Return .F.
		Endif
		
		IF INLIST(lcActiune, "UPDATE",'DELETE')
			lcId = Alltrim(Str(tnId))
			lcnom = [gest_art_gr]	
			lc_camp_id = [id_grupa]
			lc_copil_lookup = [vnom_articole]
			lc_camp_id_lookup = [id_grupa]
			lc_copil_del = [gest_art_sbgr]
			lc_camp_id_del = [id_grupa]
		ENDIF 
		
		If Inlist(lcActiune, "UPDATE",'DELETE')
			lcId = Alltrim(Str(tnId))
		Endif
		
		If Inlist(lcActiune, "UPDATE",'INSERT')
			lcgrupa = Nvl(STRTRAN(Alltrim(Upper(toRec.grupa)),['],['']),"")		
		Endif
		
		
		Do Case
			Case lcActiune = "INSERT"
				lcSql = [INSERT INTO ] + gcS + [.gest_art_gr (grupa) VALUES ('] + lcgrupa + [')]
			Case lcActiune = "UPDATE"
				lcSql = [UPDATE ] + gcS + [.gest_art_gr SET grupa = '] + lcgrupa + ['] + ;
						[ where id_grupa = ] + lcId 
			Case lcActiune = "DELETE"
				lcSql = [begin NOM_COPIL_DELPROC('] + gcS + [','] + lcnom + [','] + lc_camp_id +;
						[',] + lcId + [,'] + lc_copil_lookup + [','] + lc_camp_id_lookup + [','] +;
						lc_copil_del + [','] + lc_camp_id_del + ['); end;]
		*!*				lcSql = [begin nomdelproc('] + lcnom + [','] + lcamp + [',] + lcid + [,'] +;
		*!*				  lclook + [','] + lclookid + ['); end;]
					
		Endcase
		
		This.csql = lcSql
		
	ENDPROC

ENDDEFINE

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

	*<PropValue>
		Name = "cus_odata_parteneri_articole_conturi"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		lcActiune = Alltrim(This.cActiune)
		
		If Inlist(lcActiune, "UPDATE",'INSERT') And Type('toRec') != "O"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE') And Type('tnId') != "N"
			Return .F.
		Endif
		
		Do Case
			Case lcActiune = "INSERT"
				lcSql = [insert into parteneri_articole_coduri(id_part, id_articol, cod, id_util, dataora) values (?poRec.id_part, ?poRec.id_articol, TRIM(?poRec.cod), ?gnIdUtil, sysdate) returning id into ?@pnIdAMS]
			Case lcActiune = "UPDATE"
				lcSql = [update parteneri_articole_coduri set id_part = ?poRec.id_part, id_articol = ?poRec.id_articol, cod = TRIM(?poRec.cod), id_util = ?gnIdUtil, dataora = sysdate where id = ?poRec.id]
			Case lcActiune = "DELETE"
				lcSql = [update parteneri_articole_coduri set sters = 1, id_utils = ?gnIdUtil, dataoras = sysdate where id = ?poRec.id]
		Endcase
		
		This.csql = lcSql
	ENDPROC

ENDDEFINE

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

	*<PropValue>
		Name = "cus_odata_subgrupe_art"
	*</PropValue>
	
	PROCEDURE make_sql
		Lparameters toRec,tnId
		
		lcActiune = Alltrim(This.cActiune)
		
		If Inlist(lcActiune, "UPDATE",'INSERT') And Type('toRec') != "O"
			Return .F.
		Endif
		
		If Inlist(lcActiune, "UPDATE",'DELETE') And Type('tnId') != "N"
			Return .F.
		Endif
		
		IF INLIST(lcActiune, "UPDATE",'DELETE')
			lcId = Alltrim(Str(tnId))
			lcnom = gcS + [.gest_art_sbgr]	
			lc_camp_id = [id_subgrupa]
			lc_copil_lookup = gcS + [.vnom_articole]
			lc_camp_id_lookup = [id_subgrupa]
		ENDIF 
		
		If Inlist(lcActiune, "UPDATE",'DELETE')
			lcId = Alltrim(Str(tnId))
		Endif
		
		If Inlist(lcActiune, "UPDATE",'INSERT')
			lcsubgrupa = Nvl(STRTRAN(Alltrim(Upper(toRec.subgrupa)),['],['']),"")		
			lcId_grupa = ALLTRIM(STR(pnId_grupa))
			lcIndicativ = Nvl(STRTRAN(Alltrim(Upper(toRec.indicativ)),['],['']),"")	
		Endif
		
		
		Do Case
			Case lcActiune = "INSERT"
				lcSql = [INSERT INTO ] + gcS + [.gest_art_sbgr (subgrupa,id_grupa,indicativ) VALUES ('] +;
					 lcsubgrupa + [',] + lcId_grupa +[,']+lcIndicativ + [')]
			Case lcActiune = "UPDATE"
				lcSql = [UPDATE ] + gcS + [.gest_art_sbgr SET subgrupa = '] + lcsubgrupa + ;
						[',id_grupa = ] + lcId_grupa + [,indicativ = ']+lcIndicativ +[' where id_subgrupa = ] + lcId 
			Case lcActiune = "DELETE"
		*!*			lcSql = [begin NOM_COPIL_DELPROC('] + gcS + [','] + lcnom + [','] + lc_camp_id +;
		*!*					[',] + lcId + [,'] + lc_copil_lookup + [','] + lc_camp_id_lookup + [','] +;
		*!*					lc_copil_del + [','] + lc_camp_id_del + ['); end;]
					lcSql = [begin nomdelproc('] + lcnom + [','] + lc_camp_id + [',] + lcid + [,'] +;
					  		lc_copil_lookup + [','] + lc_camp_id_lookup + ['); end;]
					
		Endcase
		
		This.csql = lcSql
		
	ENDPROC

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Ct_grid_search1" 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="" />
	*< OBJECTDATA: ObjPath="BUT_RENUNT1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="BUT_EXCEL1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_start_criterii1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_reset_criterii1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_listare_codbare
		*p: clista_id
		*p: lcaut
		*p: lcubifa
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		clista_id = 
		DoCreate = .T.
		Height = 425
		Name = "frm_catalog_articole"
		Width = 774
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 775
		_shape1.ZOrderSet = 0
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 594
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE, NOVERTICAL_MOVE"
		_shape2.Top = 0
		_shape2.Width = 180
		_shape2.ZOrderSet = 1
		Lb_titlu_alb_b121.Caption = "CATALOG DE MATERIALE SI MARFURI"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 8
		Lb_titlu_alb_b121.ZOrderSet = 2
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Height = 27
		BUT_TERMIN1.Left = 743
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Tag = "MOVABLE, NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.Width = 30
		BUT_TERMIN1.ZOrderSet = 3
		GRIDSORT1.Name = "GRIDSORT1"
	*</PropValue>

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

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 712, ;
		Name = "But_listare1", ;
		TabIndex = 4, ;
		Tag = "MOVABLE, NOVERTICAL_MOVE", ;
		Top = 1, ;
		Width = 30, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 624, ;
		Name = "But_modifica1", ;
		TabIndex = 6, ;
		Tag = "MOVABLE, NOVERTICAL_MOVE", ;
		Top = 1, ;
		Width = 30, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_nou1' AS but_nou WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 595, ;
		Name = "But_nou1", ;
		TabIndex = 7, ;
		Tag = "MOVABLE, NOVERTICAL_MOVE", ;
		Top = 1, ;
		Width = 30, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'BUT_RENUNT1' AS but_renunt WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 468, ;
		Name = "BUT_RENUNT1", ;
		TabIndex = 3, ;
		Tag = "MOVABLE, NOVERTICAL_MOVE", ;
		Top = 0, ;
		Visible = .F., ;
		Width = 30, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_reset_criterii1' AS but_reset_criterii WITH ;
		Anchor = 9, ;
		Left = 535, ;
		Name = "But_reset_criterii1", ;
		Top = 2, ;
		Visible = .T.
		*< END OBJECT: ClassLib="ocriterii.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_start_criterii1' AS but_start_criterii WITH ;
		Anchor = 9, ;
		Comment = "*:OnResize=RT", ;
		Left = 564, ;
		Name = "But_start_criterii1", ;
		Top = 1
		*< END OBJECT: ClassLib="ocriterii.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 653, ;
		Name = "But_sterge1", ;
		TabIndex = 5, ;
		Tag = "MOVABLE, NOVERTICAL_MOVE", ;
		Top = 1, ;
		Width = 30, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ct_grid_search1' AS ct_grid_search WITH ;
		Anchor = 15, ;
		Height = 385, ;
		Left = 4, ;
		Name = "Ct_grid_search1", ;
		TabIndex = 1, ;
		Tag = "RESIZABLE", ;
		Top = 35, ;
		Width = 762, ;
		ZOrderSet = 4, ;
		_GRID1.Height = 325, ;
		_GRID1.Left = 6, ;
		_GRID1.Name = "_GRID1", ;
		_GRID1.TabIndex = 2, ;
		_GRID1.Tag = "RESIZABLE", ;
		_GRID1.Top = 56, ;
		_GRID1.Width = 755, ;
		TITLU.Left = 9, ;
		TITLU.Name = "TITLU", ;
		TITLU.TabIndex = 3, ;
		TITLU.Top = 3, ;
		CB_TX_CAUTARE1.CRITERIU.Name = "CRITERIU", ;
		CB_TX_CAUTARE1.Left = 7, ;
		CB_TX_CAUTARE1.Name = "CB_TX_CAUTARE1", ;
		CB_TX_CAUTARE1.TabIndex = 1, ;
		CB_TX_CAUTARE1.Text.Name = "Text", ;
		CB_TX_CAUTARE1.Top = 24
		*< END OBJECT: ClassLib="ferestre_cere_date.vcx" BaseClass="container" />

	ADD OBJECT 'Gridextra1' AS gridextra WITH ;
		gridexpression = thisform.CT_GRID_SEARCH1._GRID1, ;
		Left = 384, ;
		Name = "Gridextra1", ;
		productname = ROA, ;
		Top = 33
		*< END OBJECT: ClassLib="..\utile\gridextras\gridextras.vcx" BaseClass="custom" />
	
	PROCEDURE do_adauga
		local lnId
		lnId = 0
		llSucces = nom_articole_nou(@lnId)
		
		this.ct_grid_search1.actualizeaza_grid
		
		
	ENDPROC

	PROCEDURE do_cauta
		Lparameters tcFiltru, tlForceSerch
		Local lcFiltru
		If !Empty(tcFiltru)
			lcFiltru = tcFiltru
		Else
			lcFiltru = []
		Endif
		
		&& filtru pretty
		IF LEN(THISFORM.filtru_pretty)>0
			filtrutext = THISFORM.filtru_pretty
			lcFiltru = IIF(!EMPTY(lcFiltru), " and ", "") + "("+ALLTRIM(filtrutext)+")"
		ENDIF
		
		IF (THIS.filtru_pretty#"none" OR tlForceSerch)
			this.ct_GRID_SEARCH1.actualizeaza_grid(lcfiltru) 
		ENDIF
		
		Select (This.ct_GRID_SEARCH1.cnumecursor)
		Go Top
		If (Reccount(This.ct_GRID_SEARCH1.cnumecursor)=0)
			This.ct_GRID_SEARCH1._GRID1.SetFocus()
			aMessagebox("Nu exista rezultate!",0+48,"Atentie")
			This.ct_GRID_SEARCH1._GRID1.SetFocus()
		Endif
		
		
		
		
		
		
		
	ENDPROC

	PROCEDURE do_excel
		LOCAL loGrid
		loGrid = this.ct_grid_search1._gRID1 
		DO export_excel_grid WITH loGrid
		
	ENDPROC

	PROCEDURE do_listare_codbare
		ofrmlist = CreateObject('frm_listeaza_articolecodbare')
		ofrmlist.show(1)
	ENDPROC

	PROCEDURE do_modifica
		LOCAL loRec
		Select crsnom_articole
		Scatter Name lorec Memo
		If lorec.tip = 1
			amessagebox("Acest articol poate fi modificat doar prin optiunea 'Norme' din programul ROADEVIZE !",48,"Atentie")
		Else
			llSucces = nom_articole_modifica(loRec.id_articol)
			IF m.llSucces
				This.ct_grid_search1.actualizeaza_grid
		
				Select crsnom_articole
				Locate For id_articol = loRec.id_articol
				If !Found()
					Go Top
				ENDIF
			ENDIF 	
		Endif
		This.ct_grid_search1._GRID1.SetFocus()
		
		
	ENDPROC

	PROCEDURE do_sterge
		*!* 18.05.2007
		*!* marius.mutu
		*!* variabile private sa le pot folosi in cus_odata_catalog_articole.salvare
		PRIVATE pnId, pnIdUtil
		LOCAL lnId
		
		SELECT crsnom_articole
		SCATTER NAME lorec 	
		lnId = lorec.id_articol	
		
		pnId = lnId
		pnIdUtil = NVL(gnIdUtil,0)
		
		DO STERGE_INREGISTRARE WITH [catalog_articole],lnid
		this.ct_grid_search1.actualizeaza_grid
		IF BUTON = 2 && RENUNT
			SELECT crsnom_articole
			LOCATE FOR id_articol = lnId
			IF !FOUND()
				GO top
			ENDIF 
		ENDIF 
		this.ct_grid_search1._GRID1.SetFocus()
		
	ENDPROC

	PROCEDURE inainte_de_do_listare
		
		X = XMENU("\<Listare catalog articole;Listare coduri de bare")
		
		
		PRIVATE pcSubtitlu
		pcSubtitlu = THIS.filtru_pretty_ro_full
		pcDataOra = get_ora(2)
		DO CASE
			CASE X = 1
				thisform.AlwaysOnTop = .F.
		
		
				SELECT crsnom_articole
				REPORT FORM rap_catalog_articole TO PRINTER PROMPT PREVIEW
		
				thisform.AlwaysOnTop = .T.
			CASE X = 2
				thisform.AlwaysOnTop = .F.
				THIS.do_listare_codbare()
				thisform.AlwaysOnTop = .T.
		EndCase
		
		RELEASE plListareValuta
		
	ENDPROC

	PROCEDURE inainte_de_do_termin
		pcLista_art = []
		IF this.lcaut = .t.
			lccursor = this.ct_grid_search1.cnumecursor
		 	SELECT (lccursor)
			IF this.lcubifa = .t.
				SCAN FOR bifa = 1	
					pcLista_art = pcLista_art + ',' + ALLTRIM(STR(id_articol))				
				ENDSCAN		
				pcLista_art = SUBSTR(pcLista_art,2)		
			ELSE		
				pcLista_art = ALLTRIM(STR(id_articol))
			ENDIF	
		ENDIF
		this.clista_id = pcLista_art
		
		*!* 18.04.2012
		SCRIE_SELECTII_OPTIUNI_UTILIZATOR("CATALOG_ARTICOLE", this.ct_grid_search1)
		*!* 18.04.2012 ^
			
		RETURN .T.
		
		
		 
		 
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		THIS.WindowState = 2
		
	ENDPROC

	PROCEDURE Resize
		*this.xresize1.rearrange 
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		
		thisform.Ct_grid_search1.initializare(.t.)
		*!*thisform.Ct_grid_search1._grid1.columns(8).inputmask = [999]
		this.gridextra1.setup()
	ENDPROC

	PROCEDURE But_start_criterii1.loadcriterii
		PARAMETERS tacriterii
		EXTERNAL ARRAY tacriterii
		#DEFINE crlf CHR(13)+CHR(10)
		PRIVATE lcStringCriterii
		lcStringCriterii="Denumire articol\denumire\T\id_articol\nom_articol"+ crlf + ;
			"Cod material\codmat\T\none\" + crlf + ;
			"Grupa articol\none\I\id_grupa\nom_grupa_articol"+ crlf + ;
			"Subgrupa articol\none\I\id_subgrupa\nom_subgrupa_articol"+ crlf + ;
			"Cont\cont\T\none\"+ crlf + ;
			"Cont analitic\acont\T\none\"+ crlf + ;
			"Gestionabil\nofiled\A\Gestionabil,Negestionabil,Cu pret de catalog,Fara pret de catalog, " + ;
			"Gestionabil cu pret de catalog,Gestionabil fara pret de catalog, " + ;
			"Negestionabil cu pret de catalog,Negestionabil fara pret de catalog,Toate" + ;
			"#in_stoc = 1,in_stoc=0,in_crm=1,in_crm=0,in_stoc=1 and in_crm=1,in_stoc=1 and in_crm=0, in_stoc=0 and in_crm=1,in_stoc=0 and in_crm=0,1=1\" + crlf + ;
			"Cod bare\codbare\T\none\"+ crlf + ;
			"Activ\nofiled\A\Activ,Inactiv,Toate" + ;
			"#inactiv=0,inactiv=1,1=1\" + crlf + ;	
			"Conditii pastrare\conditii_pastrare\T\none\" + crlf + ;
			"Cod material furnizor\codmatf\T\none\" + crlf + ;
			"Furnizor principal\partener\T\id_part\nom_parteneri" + crlf + ;
			"Lista cod bare\nofiled\E\(NVL(listare_codbare,0) = 1)\" + crlf
			
		DODEFAULT()
		
	ENDPROC

	PROCEDURE Ct_grid_search1._GRID1.AfterRowColChange
		LPARAMETERS nColIndex
		this.SetAll("DynamicBackColor","iif(inactiv = 1, RGB(230,230,230), RGB(255,255,255))","Column")
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_catalog_articole_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="Cus_odata_catalog_articole" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1._shape1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.ct_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.ct_nume.txtCodMatF" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.ct_nume.lblCodMatF" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.grdParteneriArticoleCoduri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.grdParteneriArticoleCoduri.cPartener.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.grdParteneriArticoleCoduri.cPartener.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.grdParteneriArticoleCoduri.cCod.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.grdParteneriArticoleCoduri.cCod.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Ct_articol_general" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Cb_tx_grupa" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Cb_tx_tip" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_codmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_codmat.Cmd_executa1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_denumire" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_taxa_reconditionare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Cb_tx_subgrupa" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_cont" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_cont.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_cont.But_help1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_dnf" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.ckInStoc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_tx_cant_bax" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_codbare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.Clb_codbare.Cmd_executa2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.lblIntrastat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.chkListareCodBare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.ckInCRM" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.cboUMISO" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1._lbbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page1.cboUM" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page2.Ed_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page2.Clb_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page2.Clb_tx_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page2.ct_tara_origine" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page2.lblIntrastat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pageframe1.Page2.Clb_tx_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cus_odata_parteneri_articole_coduri" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: arata_date
		*m: do_alege_articol_general
		*m: do_alege_furnizor
		*m: do_alege_partener
		*m: do_alege_tara
		*m: do_genereaza_codbare
		*m: do_genereaza_codmat
		*p: nid
		*p: ogeneratorcodbare
		*p: ogeneratorcodmat
		*p: orec
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		DoCreate = .T.
		Height = 437
		Name = "frm_catalog_articole_nou"
		nid = 0
		ogeneratorcodbare = .NULL.
		ogeneratorcodmat = .NULL.
		Width = 610
		_memberdata = <VFPData>
			<memberdata name="ogeneratorcodmat" type="property" display="oGeneratorCodmat"/>
			<memberdata name="ogeneratorcodbare" type="property" display="oGeneratorCodBare"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 624
		_shape1.ZOrderSet = 0
		_shape2.Height = 29
		_shape2.Left = 608
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 61
		_shape2.ZOrderSet = 1
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 4
		Lb_titlu_alb_b121.ZOrderSet = 2
		BUT_TERMIN1.Left = 580
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Top = 0
		BUT_TERMIN1.ZOrderSet = 3
		Gridsort1.Left = 96
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 12
	*</PropValue>

	ADD OBJECT '_pageframe1' AS _pageframe WITH ;
		ErasePage = .T., ;
		Height = 415, ;
		Left = 1, ;
		Name = "_pageframe1", ;
		PageCount = 2, ;
		TabIndex = 1, ;
		Top = 27, ;
		Width = 610, ;
		Page1.Caption = "Articol", ;
		Page1.Name = "Page1", ;
		Page2.Caption = "Alte informatii", ;
		Page2.Name = "Page2"
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="pageframe" />

	ADD OBJECT '_pageframe1.Page1._checkbox1' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 12, ;
		Caption = "\<Inactiv", ;
		ControlSource = "porec.inactiv", ;
		FontBold = .T., ;
		Left = 540, ;
		Name = "_checkbox1", ;
		TabIndex = 21, ;
		TabStop = .F., ;
		Top = 356, ;
		ZOrderSet = 17
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT '_pageframe1.Page1._lbbase1' AS _lbbase WITH ;
		Caption = "UM", ;
		FontBold = .T., ;
		Left = 16, ;
		Name = "_lbbase1", ;
		TabIndex = 24, ;
		Top = 153, ;
		ZOrderSet = 23
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_pageframe1.Page1._shape1' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 29, ;
		Left = 9, ;
		Name = "_shape1", ;
		Top = 147, ;
		Width = 290, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_pageframe1.Page1.But_nou1' AS but_nou WITH ;
		Anchor = 12, ;
		Left = 540, ;
		Name = "But_nou1", ;
		TabIndex = 22, ;
		Top = 212, ;
		ZOrderSet = 20
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT '_pageframe1.Page1.But_sterge1' AS but_sterge WITH ;
		Anchor = 12, ;
		Left = 569, ;
		Name = "But_sterge1", ;
		TabIndex = 23, ;
		Top = 212, ;
		Visible = .T., ;
		ZOrderSet = 21
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT '_pageframe1.Page1.Cb_tx_grupa' AS cb_tx_simplu WITH ;
		Left = 9, ;
		Name = "Cb_tx_grupa", ;
		TabIndex = 2, ;
		Top = 35, ;
		ZOrderSet = 4, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "crs_grupe_art.grupa", ;
		_cbbase1.RowSourceType = 2, ;
		_lbbase1.Caption = "Grupa", ;
		_lbbase1.FontBold = .T., ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Cb_tx_subgrupa' AS cb_tx_simplu WITH ;
		Left = 9, ;
		Name = "Cb_tx_subgrupa", ;
		TabIndex = 3, ;
		Top = 63, ;
		Width = 290, ;
		ZOrderSet = 9, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "crs_subgrupe_art.subgrupa", ;
		_cbbase1.RowSourceType = 2, ;
		_lbbase1.Caption = "Subgrupa", ;
		_lbbase1.FontBold = .T., ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Cb_tx_tip' AS cb_tx_simplu WITH ;
		Anchor = 10, ;
		Height = 29, ;
		Left = 322, ;
		Name = "Cb_tx_tip", ;
		TabIndex = 15, ;
		Top = 174, ;
		Width = 231, ;
		ZOrderSet = 5, ;
		_cbbase1.BoundColumn = 2, ;
		_cbbase1.BoundTo = .T., ;
		_cbbase1.ColumnCount = 2, ;
		_cbbase1.ColumnLines = .F., ;
		_cbbase1.ColumnWidths = "169,0", ;
		_cbbase1.ControlSource = "poRec.tip", ;
		_cbbase1.FontName = "Arial Narrow", ;
		_cbbase1.Height = 23, ;
		_cbbase1.Left = 55, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = "MATERIALE,0,MANOPERĂ,1,UTILAJE,2,TERȚI,3", ;
		_cbbase1.RowSourceType = 1, ;
		_cbbase1.Top = 3, ;
		_cbbase1.Width = 169, ;
		_lbbase1.Caption = "Tip", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.cboUM' AS _cbsearch WITH ;
		BoundColumn = 1, ;
		BoundTo = .T., ;
		ColumnCount = 3, ;
		ColumnLines = .F., ;
		ColumnWidths = "50,150,50", ;
		ControlSource = "poRec.um", ;
		Format = "!K", ;
		Height = 24, ;
		Left = 57, ;
		Name = "cboUM", ;
		RowSource = "vnom_um.um,um_iso, cod_um_iso", ;
		RowSourceType = 6, ;
		TabIndex = 6, ;
		Top = 150, ;
		Width = 74, ;
		ZOrderSet = 24
		*< END OBJECT: ClassLib="_cb_base.vcx" BaseClass="combobox" />

	ADD OBJECT '_pageframe1.Page1.cboUMISO' AS _cbsearch WITH ;
		BoundColumn = 2, ;
		BoundTo = .T., ;
		ColumnCount = 2, ;
		ColumnLines = .F., ;
		ColumnWidths = "150,50", ;
		ControlSource = "poRec.cod_um_iso", ;
		Format = "K", ;
		Height = 24, ;
		Left = 133, ;
		Name = "cboUMISO", ;
		RowSource = "vnom_um_iso.um_iso, cod_um_iso", ;
		RowSourceType = 6, ;
		TabIndex = 7, ;
		Top = 150, ;
		Width = 161, ;
		ZOrderSet = 22
		*< END OBJECT: ClassLib="_cb_base.vcx" BaseClass="combobox" />

	ADD OBJECT '_pageframe1.Page1.chkListareCodBare' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 4, ;
		Caption = "Lista \<cod bare", ;
		ControlSource = "porec.listare_codbare", ;
		Left = 8, ;
		Name = "chkListareCodBare", ;
		TabIndex = 19, ;
		ToolTipText = 'Se listeaza pe raportul "Lista cod bare"', ;
		Top = 356, ;
		ZOrderSet = 18
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT '_pageframe1.Page1.ckInCRM' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 4, ;
		Caption = "Cu \<pret de catalog", ;
		ControlSource = "porec.in_crm", ;
		FontBold = .T., ;
		Left = 151, ;
		Name = "ckInCRM", ;
		TabIndex = 18, ;
		Top = 337, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT '_pageframe1.Page1.ckInStoc' AS _checkbox WITH ;
		Alignment = 0, ;
		Anchor = 4, ;
		Caption = "Articol \<gestionabil", ;
		ControlSource = "porec.in_stoc", ;
		FontBold = .T., ;
		Left = 8, ;
		Name = "ckInStoc", ;
		TabIndex = 17, ;
		Top = 337, ;
		ZOrderSet = 13
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT '_pageframe1.Page1.Clb_codbare' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_codbare", ;
		TabIndex = 5, ;
		Top = 119, ;
		Width = 290, ;
		ZOrderSet = 15, ;
		Text_simplu1.ControlSource = "porec.codbare", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 166, ;
		Lb_simplu1.Caption = "Cod bare", ;
		Lb_simplu1.FontBold = .T., ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Clb_codbare.Cmd_executa2' AS cmd_executa WITH ;
		caction = do_genereaza_codbare, ;
		Caption = "!", ;
		Height = 17, ;
		Left = 272, ;
		Name = "Cmd_executa2", ;
		TabIndex = 29, ;
		TabStop = .F., ;
		ToolTipText = "Genereaza cod bare automat", ;
		Top = 6, ;
		Width = 15, ;
		ZOrderSet = 24
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_cant_bax' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_tx_cant_bax", ;
		TabIndex = 9, ;
		Top = 212, ;
		Width = 290, ;
		ZOrderSet = 14, ;
		Text_simplu1.ControlSource = "porec.cant_bax", ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = (get_mask(7,4)), ;
		Text_simplu1.Left = 163, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 120, ;
		Lb_simplu1.Caption = "Cantitate/pachet", ;
		Lb_simplu1.Left = 6, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_codmat' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_tx_codmat", ;
		TabIndex = 4, ;
		Top = 91, ;
		Width = 290, ;
		ZOrderSet = 6, ;
		Text_simplu1.ControlSource = "porec.codmat", ;
		Text_simplu1.Format = "!k", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.MaxLength = 50, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.TabIndex = 1, ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 166, ;
		Lb_simplu1.Caption = "Cod material", ;
		Lb_simplu1.FontBold = .T., ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.TabIndex = 2, ;
		Lb_simplu1.Top = 5
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_codmat.Cmd_executa1' AS cmd_executa WITH ;
		caction = do_genereaza_codmat, ;
		Caption = "!", ;
		Height = 17, ;
		Left = 272, ;
		Name = "Cmd_executa1", ;
		TabIndex = 28, ;
		TabStop = .F., ;
		ToolTipText = "Genereaza cod material automat", ;
		Top = 6, ;
		Width = 15, ;
		ZOrderSet = 24
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_cont' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_tx_cont", ;
		TabIndex = 8, ;
		Top = 175, ;
		Width = 290, ;
		ZOrderSet = 10, ;
		Text_simplu1.ControlSource = "porec.cont", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.MaxLength = 4, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.TabIndex = 1, ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 74, ;
		Lb_simplu1.Caption = "Cont*", ;
		Lb_simplu1.FontBold = .T., ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.TabIndex = 3
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_cont.But_help1' AS but_help WITH ;
		Height = 23, ;
		Left = 259, ;
		Name = "But_help1", ;
		TabIndex = 26, ;
		ToolTipText = "Help - Planul de conturi (CTRL+ H)", ;
		Top = 3, ;
		Width = 26, ;
		ZOrderSet = 18
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_cont.Text1' AS textbox WITH ;
		ControlSource = "porec.acont", ;
		Format = "!k", ;
		Height = 22, ;
		Left = 179, ;
		MaxLength = 4, ;
		Name = "Text1", ;
		TabIndex = 2, ;
		Top = 3, ;
		Width = 74
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_denumire' AS clb_tx_simplu WITH ;
		Anchor = 10, ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_tx_denumire", ;
		TabIndex = 1, ;
		Top = 7, ;
		Width = 544, ;
		ZOrderSet = 7, ;
		Text_simplu1.ControlSource = "porec.denumire", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.MaxLength = 100, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 436, ;
		Lb_simplu1.Caption = "Denumire*", ;
		Lb_simplu1.FontBold = .T., ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 9
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_dnf' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_tx_dnf", ;
		TabIndex = 11, ;
		Top = 277, ;
		Visible = .F., ;
		Width = 290, ;
		ZOrderSet = 11, ;
		Text_simplu1.ControlSource = "porec.dnf", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 217, ;
		Text_simplu1.MaxLength = 6, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 63, ;
		Lb_simplu1.Caption = "Durata normata de functionare (luni)", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_simplu2' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_tx_simplu2", ;
		TabIndex = 10, ;
		Top = 240, ;
		Width = 290, ;
		ZOrderSet = 12, ;
		Text_simplu1.ControlSource = "porec.um2", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.MaxLength = 6, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 184, ;
		Lb_simplu1.Caption = "UM pachet", ;
		Lb_simplu1.FontSize = 10, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Clb_tx_taxa_reconditionare' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 9, ;
		Name = "Clb_tx_taxa_reconditionare", ;
		TabIndex = 12, ;
		Top = 305, ;
		Visible = .F., ;
		Width = 290, ;
		ZOrderSet = 8, ;
		Text_simplu1.ControlSource = "porec.taxa_reconditionare", ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = (GET_MASK(12,gnPC)), ;
		Text_simplu1.Left = 168, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 113, ;
		Lb_simplu1.Caption = "Taxa reconditionare", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.Ct_articol_general' AS ct_clb_cautare WITH ;
		Anchor = 10, ;
		cconditie = EMPTY(NVL(poRec.articol_general,'')) AND EMPTY(NVL(poRec.id_articol_general,0)), ;
		cprocedura = thisform.do_alege_articol_general, ;
		cvar_afisata = porec.articol_general, ;
		Height = 48, ;
		Left = 321, ;
		Name = "Ct_articol_general", ;
		TabIndex = 14, ;
		Top = 122, ;
		Width = 261, ;
		ZOrderSet = 3, ;
		img_cautare.Left = 235, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 14, ;
		clb_tx_cautare.Height = 47, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Articol general", ;
		clb_tx_cautare.Lb_simplu1.Left = 5, ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Lb_simplu1.Top = 4, ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Height = 23, ;
		clb_tx_cautare.Text_simplu1.Left = 10, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 21, ;
		clb_tx_cautare.Text_simplu1.Width = 214, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 231
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.ct_nume' AS ct_clb_cautare WITH ;
		Anchor = 10, ;
		cconditie = EMPTY(NVL(poRec.furnizor,'')) AND EMPTY(NVL(poRec.id_furnizor,0)), ;
		cprocedura = [thisform.do_alege_furnizor], ;
		cvar_afisata = porec.partener, ;
		Height = 86, ;
		Left = 321, ;
		Name = "ct_nume", ;
		TabIndex = 13, ;
		Top = 34, ;
		Width = 257, ;
		ZOrderSet = 1, ;
		img_cautare.Left = 235, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 14, ;
		clb_tx_cautare.Height = 85, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Furnizor principal", ;
		clb_tx_cautare.Lb_simplu1.Left = 6, ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Lb_simplu1.Top = 3, ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Left = 10, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 21, ;
		clb_tx_cautare.Text_simplu1.Width = 214, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 231
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page1.ct_nume.lblCodMatF' AS _label WITH ;
		Caption = "Cod furnizor", ;
		Height = 18, ;
		Left = 12, ;
		Name = "lblCodMatF", ;
		Top = 61, ;
		Width = 71
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_pageframe1.Page1.ct_nume.txtCodMatF' AS _textbox WITH ;
		ControlSource = "porec.codmatf", ;
		Format = "!K", ;
		Height = 23, ;
		Left = 85, ;
		MaxLength = 50, ;
		Name = "txtCodMatF", ;
		Top = 57, ;
		Width = 139
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_pageframe1.Page1.grdParteneriArticoleCoduri' AS _grid WITH ;
		Anchor = 13, ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		Height = 97, ;
		lcamptextneeditabil = .F., ;
		lcoloreazaeditabil = .T., ;
		Left = 322, ;
		Name = "grdParteneriArticoleCoduri", ;
		Panel = 1, ;
		ReadOnly = .F., ;
		RecordMark = .F., ;
		RecordSource = "crsParteneriArticoleCoduri", ;
		RecordSourceType = 1, ;
		ScrollBars = 2, ;
		TabIndex = 16, ;
		Top = 240, ;
		Width = 279, ;
		ZOrderSet = 2, ;
		Column1.ControlSource = "partener", ;
		Column1.Name = "cPartener", ;
		Column1.ReadOnly = .F., ;
		Column1.Width = 146, ;
		Column2.ControlSource = "cod", ;
		Column2.Name = "cCod", ;
		Column2.ReadOnly = .F., ;
		Column2.Width = 96
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="grid" />

	ADD OBJECT '_pageframe1.Page1.grdParteneriArticoleCoduri.cCod.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT '_pageframe1.Page1.grdParteneriArticoleCoduri.cCod.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT '_pageframe1.Page1.grdParteneriArticoleCoduri.cPartener.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Client", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT '_pageframe1.Page1.grdParteneriArticoleCoduri.cPartener.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT '_pageframe1.Page1.lblIntrastat' AS _label WITH ;
		Anchor = 12, ;
		Caption = "Coduri clienti", ;
		FontBold = .T., ;
		Left = 322, ;
		Name = "lblIntrastat", ;
		TabIndex = 20, ;
		Top = 218, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

	ADD OBJECT '_pageframe1.Page2.Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Anchor = 8, ;
		Height = 29, ;
		Left = 287, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 1, ;
		Top = 30, ;
		Width = 290, ;
		ZOrderSet = 13, ;
		Text_simplu1.ControlSource = "porec.codnc8", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.MaxLength = 20, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ToolTipText = "Cod NC8 declaratia INTRASTAT", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 183, ;
		Lb_simplu1.Caption = "Cod NC8", ;
		Lb_simplu1.FontSize = 10, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page2.Clb_tx_simplu2' AS clb_tx_simplu WITH ;
		Anchor = 8, ;
		Height = 29, ;
		Left = 287, ;
		Name = "Clb_tx_simplu2", ;
		TabIndex = 4, ;
		Top = 126, ;
		Width = 290, ;
		ZOrderSet = 13, ;
		Text_simplu1.ControlSource = "porec.codcpv", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.MaxLength = 20, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ToolTipText = "Cod CPV (Vocabular Comun Achizitii Publice)", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 183, ;
		Lb_simplu1.Caption = "Cod CPV", ;
		Lb_simplu1.FontSize = 10, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page2.Clb_tx_simplu3' AS clb_tx_simplu WITH ;
		Anchor = 8, ;
		Height = 29, ;
		Left = 287, ;
		Name = "Clb_tx_simplu3", ;
		TabIndex = 2, ;
		Top = 58, ;
		Width = 290, ;
		ZOrderSet = 15, ;
		Text_simplu1.ControlSource = "porec.greutate", ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = (get_mask(12,4)), ;
		Text_simplu1.Left = 100, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ToolTipText = "Greutate (Kg) declaratia INTRASTAT", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 184, ;
		Lb_simplu1.Caption = "Greutate (Kg)", ;
		Lb_simplu1.Left = 6, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page2.ct_tara_origine' AS ct_clb_cautare WITH ;
		Anchor = 8, ;
		cconditie = EMPTY(NVL(poRec.tara_origine,'')) AND EMPTY(NVL(poRec.id_tara_origine,0)), ;
		cprocedura = thisform.do_alege_tara, ;
		cvar_afisata = porec.tara_origine, ;
		Height = 31, ;
		Left = 286, ;
		Name = "ct_tara_origine", ;
		TabIndex = 3, ;
		Top = 85, ;
		Width = 319, ;
		ZOrderSet = 23, ;
		img_cautare.Left = 295, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Tara origine", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Left = 100, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.ToolTipText = "Tara origine declaratia INTRASTAT", ;
		clb_tx_cautare.Text_simplu1.Top = 3, ;
		clb_tx_cautare.Width = 290
		*< END OBJECT: ClassLib="caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page2.Ed_tx_simplu1' AS ed_tx_simplu WITH ;
		Anchor = 10, ;
		Height = 156, ;
		Left = 10, ;
		Name = "Ed_tx_simplu1", ;
		TabIndex = 5, ;
		Top = 8, ;
		Width = 261, ;
		ZOrderSet = 22, ;
		_edbase1.ControlSource = "porec.conditii_pastrare", ;
		_edbase1.Height = 127, ;
		_edbase1.Left = 5, ;
		_edbase1.Name = "_edbase1", ;
		_edbase1.Top = 23, ;
		_edbase1.Width = 250, ;
		_lbbase1.Caption = "Conditii de pastrare", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pageframe1.Page2.lblIntrastat' AS _label WITH ;
		Anchor = 8, ;
		Caption = "INTRASTAT", ;
		FontBold = .T., ;
		Left = 286, ;
		Name = "lblIntrastat", ;
		TabIndex = 6, ;
		Top = 8
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="label" />

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

	ADD OBJECT 'Cus_odata_catalog_articole' AS cus_odata_catalog_articole WITH ;
		Left = 156, ;
		Name = "Cus_odata_catalog_articole", ;
		Top = 12
		*< END OBJECT: ClassLib="onom_articole.vcx" BaseClass="custom" />

	ADD OBJECT 'Cus_odata_parteneri_articole_coduri' AS cus_odata_parteneri_articole_coduri WITH ;
		Left = 194, ;
		lsilent = .T., ;
		Name = "Cus_odata_parteneri_articole_coduri", ;
		Top = 10
		*< END OBJECT: ClassLib="onom_articole.vcx" BaseClass="custom" />
	
	PROCEDURE arata_date
		WITH thisform._pageframe1.page1.ct_nume
			.VISIBLE = .T.
			.cconditie = [EMPTY(NVL(poRec.partener,'')) AND EMPTY(NVL(poRec.id_part,0))]
			.cprocedura = [thisform.do_alege_furnizor]
			.clb_tx_cautare.lb_simplu1.CAPTION = [Nume furnizor]
		ENDWITH
		
	ENDPROC

	PROCEDURE Destroy
		Use In (SELECT('crs_grupe_art'))
		Use In (SELECT('crs_subgrupe_art'))
		
	ENDPROC

	PROCEDURE do_alege_articol_general
		Local loCauta
		loCauta = caut_articol(.F.,.F.,.F.,.F.,.F.,.T.)
		If !Empty(Nvl(loCauta.id_articol,0))
			If loCauta.id_articol = Nvl(poRec.id_articol,0)
				amessagebox("Articolul nu poate fi general pentru el insusi!",64,"Atentie")
			Else
				poRec.id_articol_general = loCauta.id_articol
				poRec.articol_general = Alltrim(loCauta.denumire)
			Endif
		Else
			poRec.id_articol_general = Null
			poRec.articol_general = []
		Endif
		
		thisform._pageframe1.page1.ct_articol_general.Refresh()
		
	ENDPROC

	PROCEDURE do_alege_furnizor
		Local loCauta
		loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Alegeti furnizorul??cCont=>401??lAdaugCorespondente=>1]))
		If !Empty(loCauta.id_part) And !Empty(loCauta.denumire) AND !ISNULL(loCauta.id_part)
			poRec.id_part = loCauta.id_part
			poRec.partener = Alltrim(loCauta.denumire)
		*!*		Thisform.clb_data_livrare.SetFocus()
		*!*	Else
		*!*		poRec.id_furnizor = 0
		*!*		poRec.furnizor = []
		Endif
		
		thisform._pageframe1.page1.ct_nume.Refresh()
		
	ENDPROC

	PROCEDURE do_alege_partener
		Local loCauta, lnRecno, lnRecno2
		SELECT crsParteneriArticoleCoduri
		lnRecno = RECNO()
		
		loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Alegeti clientul??cCont=>4111??lAdaugCorespondente=>1]))
		If !Empty(loCauta.id_part) And !Empty(loCauta.denumire) AND !ISNULL(loCauta.id_part)
			SELECT crsParteneriArticoleCoduri
			LOCATE FOR id_part = loCauta.id_part
			IF FOUND()
				lnRecno2 = RECNO()
				AMESSAGEBOX('Exista deja configurat un cod pe acest partener!',0+48,_screen.Caption)
				GOTO m.lnRecno
				DELETE
				GOTO m.lnRecno2
			ELSE	
				GOTO m.lnRecno
				REPLACE id_part WITH loCauta.id_part, partener WITH Alltrim(loCauta.denumire)
			ENDIF 	
		Endif
		
		thisform._pageframe1.page1.grdParteneriArticoleCoduri.cPartener.Refresh()
		
	ENDPROC

	PROCEDURE do_alege_tara
		Local loCauta
		loCauta = caut_tara()
		IF TYPE('loCauta.id_tara') = 'N'
			poRec.id_tara_origine = loCauta.id_tara
			poRec.tara_origine = Alltrim(loCauta.tara)
		Endif
		
		thisform._pageframe1.page2.ct_tara_origine.Refresh()
		
	ENDPROC

	PROCEDURE do_genereaza_codbare
		*!*	07.09.2009
		*!*	marius.mutu
		*!*	generator
		
		If gnCodBareAutomat = 2
			If Empty(porec.codbare) Or Isnull(porec.codbare)
				Local lcsel2 ,lccursor2 ,lnsucces2 ,lnNnr2
				Private pcIndicativsubgrupa2
				pcIndicativsubgrupa2=  Alltrim(crs_subgrupe_art.indicativ)
				*!*	07.09.2009
				If !Isnull(This.oGeneratorCodBare)
					This.oGeneratorCodBare.dezaloca_numar(15)
					lnNnr2 = This.oGeneratorCodBare.aloca_numar(15,porec.id_subgrupa)
					porec.codbare = Alltrim(Nvl(gcCodbarePrefix,''))+pcIndicativsubgrupa2+Padl(Alltrim(Str(lnNnr2)),Val(gcCodBareCifre),'0')
					thisform._pageframe1.page1.clb_codbare.Refresh
				Endif && !isnull
				*!*	07.09.2009 ^
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_genereaza_codmat
		*!*	07.09.2009
		*!*	marius.mutu
		*!*	generator
		
		If gnCodmatAutomat = 2
			If Empty(porec.codmat ) Or Isnull(porec.codmat)
				Local lcsel ,lccursor ,lnsucces ,lnNnr
				Private pcIndicativsubgrupa
				pcIndicativsubgrupa =  Alltrim(crs_subgrupe_art.indicativ)
				*!*	07.09.2009		
				If !Isnull(This.oGeneratorCodmat)
					This.oGeneratorCodmat.dezaloca_numar(14)
					lnNnr = This.oGeneratorCodmat.aloca_numar(14,porec.id_subgrupa)
					porec.codmat = Alltrim(Nvl(gcCodmatPrefix,''))+pcIndicativsubgrupa+Alltrim(Nvl(gcCodmatMijloc,''))+ Padl(Alltrim(Str(lnNnr)),Val(gcCodmatCifre),'0')
					thisform._pageframe1.page1.clb_tx_codmat.Refresh()
				ENDIF && !isnull
				*!*	07.09.2009 ^
			Endif
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		*!* 07.09.2009
		*!*	marius.mutu
		*!*	generator codmat, codbare
		
		If gnCodMatAutomat = 2 AND !Isnull(This.oGeneratorCodmat)
			This.oGeneratorCodmat.dezaloca_numar(14)
		Endif
		
		If gnCodBareAutomat = 2 and !Isnull(This.oGeneratorCodBare)
			This.oGeneratorCodBare.dezaloca_numar(15)
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local llReturn
		Local lnSucces, lcSql, lcMesaj
		Local lcActiune, lcDeleted, lccontrol, lcval, lnIdArticol, loRec, loob
		m.llReturn = .F.
		lccontrol = Upper(This.ActiveControl.BaseClass )
		If   Inlist(lccontrol, "TEXTBOX", "EDITBOX", "COMBOBOX")
			lcval = This.ActiveControl.ControlSource
			&lcval = Thisform.ActiveControl.Value
		Endif
		
		lcMesaj = []
		
		Do Case
			Case Empty(porec.denumire)
				lcMesaj = [Completati Denumirea!]
				loob = Thisform._pageframe1.page1.clb_tx_denumire.text_simplu1
		
			Case Empty(porec.Cont) And porec.in_stoc = 1
				lcMesaj = [Nu ati completat contul!]
				loob = Thisform._pageframe1.page1.clb_tx_cont.text_simplu1
			Otherwise
				If Thisform.do_deschide_tranzactie()
					llReturn = This.cus_odata_catalog_articole.salvare(Thisform.orec, Thisform.NID)
					If m.llReturn
						lnIdArticol = m.pnIdAMS
		
						* Salvare parteneri_articole_coduri
						lcDeleted = Set("Deleted")
						Set Deleted Off
						Select crsParteneriArticoleCoduri
						Replace All id_articol With m.lnIdArticol For Empty(Nvl(id_articol, 0))
		
						Select crsParteneriArticoleCoduri
						SCAN FOR !(EMPTY(NVL(id_part,0)) OR EMPTY(NVL(cod,'')))
							Do Case
								Case Id = 0 And !Deleted()
									lcActiune = [INSERT]
								Case Id <> 0 And !Deleted()
									lcActiune = [UPDATE]
								Case Id <> 0 And Deleted()
									lcActiune = [DELETE]
								Otherwise
									lcActiune = []
							Endcase
							If !Empty(lcActiune)
								Scatter Name loRec
								Thisform.Cus_odata_parteneri_articole_coduri.cactiune = lcActiune
								llReturn = Thisform.Cus_odata_parteneri_articole_coduri.salvare(loRec, loRec.Id)
								If !m.llReturn
									Exit
								Endif
							Endif
							Select crsParteneriArticoleCoduri
						Endscan
		
						Set Deleted &lcDeleted
					Endif && cus_odata_catalog_articole
		
					Thisform.do_inchide_tranzactie(Iif(m.llReturn, 1, 2))
				Endif && do_deschide_tranzactie
		Endcase
		
		If !Empty(lcMesaj)
			AMESSAGEBOX(lcMesaj, 0 + 48, "Atentie")
			loob.SetFocus()
		Endif
		
		Return m.llReturn
		
	ENDPROC

	PROCEDURE Init
		*!* 27.08.2009
		*!* marius.mutu
		*!* taxa reconditionare
		
		*!*	07.09.2009
		*!*	marius.mutu
		*!*	generatoare codmat, codbare
		
		LPARAMETERS toRec, tnId, tcActiune
		
		DODEFAULT()
		
		SELECT crs_grupe_art
		LOCATE FOR id_grupa = toRec.id_grupa
		THIS._pageframe1.page1.cb_tx_grupa._cbbase1.VALUE = crs_grupe_art.grupa
		*this.cb_tx_grupa._cbbase1.Value = torec.id_grupa
		THIS._pageframe1.page1.cb_tx_subgrupa._cbbase1.ROWSOURCE = []
		SELECT crs_subgrupe_art
		
		lcFiltru = [set filter to id_grupa = ] + ALLTRIM(STR(NVL(toRec.id_grupa,0)))
		&lcFiltru
		THIS._pageframe1.page1.cb_tx_subgrupa._cbbase1.ROWSOURCE = [crs_subgrupe_art.subgrupa]
		LOCATE FOR id_subgrupa = toRec.id_subgrupa
		THIS._pageframe1.page1.cb_tx_subgrupa._cbbase1.VALUE = crs_subgrupe_art.subgrupa
		*this.cb_tx_subgrupa._cbbase1.Value = torec.id_subgrupa
		
		THIS.orec= toRec
		THIS.nid = tnId
		THIS.cus_odata_catalog_articole.cactiune = tcActiune
		
		DO CASE
			CASE UPPER(ALLTRIM(tcActiune)) = [INSERT]
				THIS.lb_titlu_alb_b121.CAPTION = [Adaugare]
		*!* se pot adauga si articolele negestionabile 17.02.2009
		*!*			IF NVL(toRec.in_stoc,0) = 1
		*!*				this.ckInStoc.ReadOnly = .T.
		*!*			ENDIF 	
		*!* 17.02.2009 ^
				IF NVL(toRec.in_crm,0) = 1
					THIS._pageframe1.page1.ckInCrm.ReadOnly = .T.
				ENDIF 		
			CASE UPPER(ALLTRIM(tcActiune)) = [UPDATE]
				THIS.lb_titlu_alb_b121.CAPTION = [Modificare]
		
			*!* 27.08.2009
			IF LEFT(torec.cont,3) = "303"
				thisform._pageframe1.page1.Clb_tx_dnf.Visible = .T.
				thisform._pageframe1.page1.Clb_tx_taxa_reconditionare.Visible = .T.	
			ELSE
				thisform._pageframe1.page1.Clb_tx_dnf.Visible = .F.
				thisform._pageframe1.page1.Clb_tx_taxa_reconditionare.Visible = .F.		
			ENDIF 
			*!* 27.08.2009 ^
		ENDCASE
		Thisform.arata_date()
		
		
		*!*	07.09.2009
		If gnCodMatAutomat = 2
			This.oGeneratorCodmat= Createobject("oGeneratorNumere")
			lnRezultat = This.oGeneratorCodmat.creeaza_cursor_serii(14)
		EndIf 
		If gnCodBareAutomat = 2
			This.oGeneratorCodBare= Createobject("oGeneratorNumere")
			lnRezultat2 = This.oGeneratorCodBare.creeaza_cursor_serii(15)
		EndIf 
		*!*	07.09.2009 ^
	ENDPROC

	PROCEDURE Load
		If Used('crs_grupe_art')
			Use In 'crs_grupe_art'
		Endif
		If !Used('crs_grupe_art')
			lcsel1 = [select grupa,id_grupa from ] + gcS + [.vgest_art_gr order by grupa]
			lccursor1 = [crs_grupe_art]
			lnsucces1 = goExecutor.oExecute(lcsel1,lccursor1)
			If lnsucces1 < 0
				lcmesaj = goExecutor.cEroare
				ofrm_er = Createobject('frm_mesaj','Eroare','exclam.ico','Avertizare',lcmesaj)
				ofrm_er.Show(1)
				Release ofrm_er
			Endif
		Endif
		
		If Used('crs_subgrupe_art')
			Use In 'crs_subgrupe_art'
		Endif
		If !Used('crs_subgrupe_art')
			lcsel2 = [select subgrupa,id_subgrupa,id_grupa,indicativ from ] + gcS + [.vgest_art_sbgr order by subgrupa]
			lccursor2 = [crs_subgrupe_art]
			lnsucces2 = goExecutor.oExecute(lcsel2,lccursor2)
			If lnsucces2 < 0
				lcmesaj = goExecutor.cEroare
				ofrm_er = Createobject('frm_mesaj','Eroare','exclam.ico','Avertizare',lcmesaj)
				ofrm_er.Show(1)
				Release ofrm_er
			Endif
		Endif
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		DODEFAULT(nStyle)
		this._pageframe1.pAGE1.clb_tx_denumire.texT_SIMPLU1.SetFocus()
		
	ENDPROC

	PROCEDURE _pageframe1.Page1.But_nou1.Click
		SELECT crsParteneriArticoleCoduri
		APPEND BLANK 
		this.Parent.grdParteneriArticoleCoduri.cPartener.SetFocus()
	ENDPROC

	PROCEDURE _pageframe1.Page1.But_sterge1.Click
		SELECT crsParteneriArticoleCoduri
		IF !BOF('crsParteneriArticoleCoduri') AND AMESSAGEBOX('Stergeti inregistrarea?',4+32,_screen.Caption) = 6
			DELETE
			TRY 
				SKIP -1 IN crsParteneriArticoleCoduri
			ENDTRY 
			this.Parent.grdParteneriArticoleCoduri.cPartener.SetFocus()
		ENDIF 
		
	ENDPROC

	PROCEDURE _pageframe1.Page1.cboUM.LostFocus
		poRec.cod_um_iso = ALLTRIM(vnom_um.cod_um_iso)
		poRec.um_iso = ALLTRIM(vnom_um.um_iso)
		this.Parent.cboUMISO.Refresh()
	ENDPROC

	PROCEDURE _pageframe1.Page1.cboUM.ProgrammaticChange
		poRec.cod_um_iso = ALLTRIM(vnom_um.cod_um_iso)
		poRec.um_iso = ALLTRIM(vnom_um.um_iso)
		this.Parent.cboUMISO.Refresh()
		
	ENDPROC

	PROCEDURE _pageframe1.Page1.cboUM.Valid
		Local laUM[1], lcUM, lcSelect
		lcSelect = SELECT()
		lcUM = ALLTRIM(this.DisplayValue)
		SELECT COUNT(*) as nr FROM vnom_um WHERE ALLTRIM(um) == m.lcUM INTO ARRAY laUM
		IF laUM[1] = 0
			SELECT vnom_um
			APPEND BLANK
			REPLACE um WITH m.lcUM, um_iso WITH '', cod_um_iso WITH ''
			poRec.um = m.lcUM
		ENDIF 
		
		poRec.cod_um_iso = ALLTRIM(vnom_um.cod_um_iso)
		poRec.um_iso = ALLTRIM(vnom_um.um_iso)
		this.Parent.cboUMISO.Refresh()
		
		SELECT (m.lcSelect)
		RETURN .T. 
	ENDPROC

	PROCEDURE _pageframe1.Page1.cboUMISO.Valid
		Local laUMISO[1], lcUMISO
		lcUMISO = ALLTRIM(this.DisplayValue)
		IF !EMPTY(m.lcUMISO)
			SELECT COUNT(*) as nr FROM vnom_um_iso WHERE ALLTRIM(um_iso) == m.lcUMISO INTO ARRAY laUMISO
			IF laUMISO[1] = 0
				AMESSAGEBOX('Alegeti o unitate de masura valida!',0+48,_screen.Caption)
				RETURN .F.
			ENDIF 
		ENDIF 
		
		RETURN .T. 
	ENDPROC

	PROCEDURE _pageframe1.Page1.Cb_tx_grupa._cbbase1.Valid
		
		IF !EMPTY(this.value)
			porec.id_grupa = crs_grupe_art.id_grupa	
			thisform._pageframe1.page1.cb_tx_subgrupa._cbbase1.RowSource = []   
			SELECT crs_subgrupe_art
			lcfilter = [SET FILTER TO id_grupa = ] + ALLTRIM(STR(porec.id_grupa))
			&lcfilter	
			thisform._pageframe1.page1.cb_tx_subgrupa._cbbase1.RowSource = [crs_subgrupe_art.subgrupa]
			thisform._pageframe1.page1.cb_tx_subgrupa._cbbase1.ResetToDefault('value')
			porec.id_subgrupa = 0
			thisform._pageframe1.page1.cb_tx_subgrupa._cbbase1.refresh
		ENDIF
		
	ENDPROC

	PROCEDURE _pageframe1.Page1.Cb_tx_subgrupa._cbbase1.GotFocus
		IF EMPTY(thisform._pageframe1.page1.cb_tx_grupa._cbbase1.value)
			AMESSAGEBOX('Alegeti mai intai grupa!',0+32,_screen.Caption)
			thisform._pageframe1.page1.cb_tx_grupa._cbbase1.setfocus
		ENDIF
		
		 
	ENDPROC

	PROCEDURE _pageframe1.Page1.Cb_tx_subgrupa._cbbase1.LostFocus
		IF !EMPTY(this.value)
			porec.id_subgrupa = crs_subgrupe_art.id_subgrupa
		EndIf
		thisform.Refresh 
	ENDPROC

	PROCEDURE _pageframe1.Page1.Clb_tx_cont.Text_simplu1.Valid
		*!* 27.08.2009
		*!* marius.mutu
		*!* taxa reconditionare
		
		*!* 27.08.2009
		IF LEFT(porec.cont,3) = "303"
			thisform._pageframe1.page1.Clb_tx_dnf.Visible = .T.
			thisform._pageframe1.page1.Clb_tx_taxa_reconditionare.Visible = .T.	
		ELSE
			thisform._pageframe1.page1.Clb_tx_dnf.Visible = .F.
			thisform._pageframe1.page1.Clb_tx_taxa_reconditionare.Visible = .F.		
		ENDIF 
		*!* 27.08.2009 ^
	ENDPROC

	PROCEDURE _pageframe1.Page1.grdParteneriArticoleCoduri.cPartener.Text1.InteractiveChange
		thisform.do_alege_partener()
	ENDPROC

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_txbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_LBBASE1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lbbase2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_optiongrup1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lbbase4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lbbase3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_txbase2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lbbase5" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_enabledisable
		*p: ccodbarecifre
		*p: ccodbareprefix
		*p: ncodbareautomat
	*</DefinedPropArrayMethod>

	*<PropValue>
		ccodbarecifre = 
		ccodbareprefix = 
		DoCreate = .T.
		Height = 133
		Name = "frm_config_codbare"
		ncodbareautomat = 0
		Width = 417
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 492
		_shape2.Name = "_shape2"
		Lb_titlu_alb_b121.Caption = "Configurare cod bare"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 387
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 0
		Gridsort1.Name = "Gridsort1"
		But_renunt1.Left = 358
		But_renunt1.Name = "But_renunt1"
		But_renunt1.Top = 0
	*</PropValue>

	ADD OBJECT '_LBBASE1' AS _lbbase WITH ;
		Caption = "Prefix:", ;
		Left = 5, ;
		Name = "_LBBASE1", ;
		Top = 107
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_lbbase2' AS _lbbase WITH ;
		Caption = "+ Cod Subgrupa+", ;
		Left = 123, ;
		Name = "_lbbase2", ;
		Top = 107
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_lbbase3' AS _lbbase WITH ;
		Caption = "Numar automat din ", ;
		Left = 223, ;
		Name = "_lbbase3", ;
		Top = 107
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_lbbase4' AS _lbbase WITH ;
		Caption = "Se genereaza automat codul de bare?", ;
		Left = 12, ;
		Name = "_lbbase4", ;
		Top = 37
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_lbbase5' AS _lbbase WITH ;
		Caption = "cifre", ;
		Left = 385, ;
		Name = "_lbbase5", ;
		Top = 107
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_optiongrup1' AS _optiongrup WITH ;
		ControlSource = "thisform.ncodbareautomat", ;
		Height = 46, ;
		Left = 29, ;
		Name = "_optiongrup1", ;
		Top = 55, ;
		Width = 71, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "NU", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.Caption = "DA", ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_txbase1' AS _txbase WITH ;
		ControlSource = "thisform.ccodbareprefix", ;
		Height = 23, ;
		Left = 45, ;
		Name = "_txbase1", ;
		Top = 104, ;
		Width = 72
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT '_txbase2' AS _txbase WITH ;
		ControlSource = "thisform.ccodbarecifre", ;
		Height = 23, ;
		Left = 337, ;
		Name = "_txbase2", ;
		Top = 104, ;
		Width = 38
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />
	
	PROCEDURE do_enabledisable
		Parameters tnValoare
		
		If tnValoare = 1
			thisform._LBBASE1.Enabled= .F.
			thisform._lbbase2.Enabled= .F.
			thisform._lbbase3.Enabled= .F.
			thisform._lbbase5.Enabled= .F.
			thisform._txbase1.Enabled= .F.
			thisform._txbase2.Enabled= .F.
		Else 
			thisform._LBBASE1.Enabled= .t.
			thisform._lbbase2.Enabled= .t.
			thisform._lbbase3.Enabled= .t.
			thisform._lbbase5.Enabled= .t.
			thisform._txbase1.Enabled= .t.
			thisform._txbase2.Enabled= .t.
		EndIf 	
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local lcSel,lnsucces ,lcmesaj 
		lcsel = [begin  update optiuni set  varvalue = ']+Alltrim(Transform(thisform.ncodbareautomat ))+[' where varname = 'CODBAREAUTOMAT';]+;
				[update optiuni set  varvalue = ']+Nvl(Alltrim(thisform.ccodbareprefix ),[])+[' where varname = 'CODBAREPREFIX';]+;
				[update optiuni set  varvalue = ']+Nvl(Alltrim(thisform.ccodbarecifre),[0])+[' where varname = 'CODBARECIFRE';]+;
				[end;]
		lnsucces = goExecutor.oExecute(lcsel)
		If lnsucces < 0
			lcmesaj = goExecutor.cEroare
			ofrm_er = Createobject('frm_mesaj','Eroare','exclam.ico','Avertizare',lcmesaj)
			ofrm_er.Show(1)
			Release ofrm_er
			Return 
		EndIf
		
		gnCODBAREAUTOMAT = thisform.ncodbareautomat 
		gcCODBAREPREFIX = Alltrim(thisform.ccodbareprefix )
		gcCODBAREcifre = Alltrim(thisform.ccodbarecifre)
		
		DoDefault()
		
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		 thisform.ncodbareautomat = gnCODBAREAUTOMAT
		 thisform.ccodbareprefix = gcCODBAREPREFIX 
		 thisform.ccodbarecifre = gcCODBAREcifre
		
		thisform.do_enabledisable(gnCodbareAutomat)
	ENDPROC

	PROCEDURE _optiongrup1.InteractiveChange
		thisform.do_enabledisable(this.Value)
	ENDPROC

ENDDEFINE

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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_optiongrup1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lbbase4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_txbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_executa1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_txbase2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lbbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lbbase2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_txbase3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lbbase3" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_enabledisable
		*p: ccodmatcifre
		*p: ccodmatmijloc
		*p: ccodmatprefix
		*p: ccodmatsablon
		*p: ncodmatautomat
	*</DefinedPropArrayMethod>

	*<PropValue>
		ccodmatcifre = 
		ccodmatmijloc = 
		ccodmatprefix = 
		ccodmatsablon = 
		DoCreate = .T.
		Height = 165
		Name = "frm_config_codmat"
		ncodmatautomat = 
		Width = 486
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 540
		_shape2.Name = "_shape2"
		Lb_titlu_alb_b121.Caption = "Configurare cod material"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 454
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Left = 228
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 12
		But_renunt1.Left = 425
		But_renunt1.Name = "But_renunt1"
		But_renunt1.Top = 1
	*</PropValue>

	ADD OBJECT '_lbbase1' AS _lbbase WITH ;
		Caption = "+ Cod Subgrupa +", ;
		Left = 88, ;
		Name = "_lbbase1", ;
		Top = 131
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_lbbase2' AS _lbbase WITH ;
		Caption = "+ Numar automat din ", ;
		Left = 264, ;
		Name = "_lbbase2", ;
		Top = 131
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_lbbase3' AS _lbbase WITH ;
		Caption = "cifre", ;
		Left = 432, ;
		Name = "_lbbase3", ;
		Top = 131
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_lbbase4' AS _lbbase WITH ;
		Caption = "Se genereaza automat codul material?", ;
		Left = 12, ;
		Name = "_lbbase4", ;
		Top = 36
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT '_optiongrup1' AS _optiongrup WITH ;
		ControlSource = "thisform.ncodmatautomat", ;
		Height = 46, ;
		Left = 29, ;
		Name = "_optiongrup1", ;
		Top = 55, ;
		Width = 71, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "NU", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.Caption = "DA", ;
		Option2.Left = 5, ;
		Option2.Name = "Option2", ;
		Option2.Top = 24
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_txbase1' AS _txbase WITH ;
		ControlSource = "thisform.ccodmatprefix", ;
		Height = 23, ;
		Left = 12, ;
		Name = "_txbase1", ;
		Top = 128, ;
		Width = 72
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT '_txbase2' AS _txbase WITH ;
		ControlSource = "thisform.ccodmatmijloc", ;
		Height = 23, ;
		Left = 192, ;
		Name = "_txbase2", ;
		Top = 128, ;
		Width = 72
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT '_txbase3' AS _txbase WITH ;
		ControlSource = "thisform.ccodmatcifre", ;
		Height = 23, ;
		Left = 384, ;
		Name = "_txbase3", ;
		Top = 128, ;
		Width = 38
		*< END OBJECT: ClassLib="_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'Cmd_executa1' AS cmd_executa WITH ;
		Left = 360, ;
		Name = "Cmd_executa1", ;
		Top = 48, ;
		Visible = .F.
		*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />
	
	PROCEDURE do_enabledisable
		Parameters tnValoare
		
		If tnValoare = 1
			thisform._LBBASE1.Enabled= .F.
			thisform._lbbase2.Enabled= .F.
			thisform._lbbase3.Enabled= .F.
			thisform._txbase1.Enabled= .F.
			thisform._txbase2.Enabled= .F.
			thisform._txbase3.Enabled= .F.
			
		Else 
			thisform._LBBASE1.Enabled= .t.
			thisform._lbbase2.Enabled= .t.
			thisform._lbbase3.Enabled= .t.
			thisform._txbase1.Enabled= .t.
			thisform._txbase2.Enabled= .t.	
			thisform._txbase3.Enabled= .t.	
		EndIf 	
	ENDPROC

	PROCEDURE do_executa
		Local lnNnir 
		Store 0 to lnNnir 
		*!*	Debug
		*!*	Suspend 
		
		Private poGeneratorNumere
		poGeneratorNumere = Createobject("oGeneratorNumere")
		lnRezultat = poGeneratorNumere.creeaza_cursor_serii(14)
		*!*	poGeneratorNumere.activeazaBuffer(2,2)
		lnNnir = poGeneratorNumere.aloca_numar(14,2)
		
		MessageBox(Transform(lnNnir ),0,'a')
		poGeneratorNumere.dezaloca_numar(14)
		poGeneratorNumere.dezaloca_numere()
		Release poGeneratorNumere 
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local lcSel,lnsucces ,lcmesaj 
		
		lcsel = [begin  update optiuni set  varvalue = ']+Alltrim(Transform(thisform.ncodmatautomat))+[' where varname = 'CODMATAUTOMAT'; ]+;
				[update optiuni set  varvalue = ']+Nvl(Alltrim(thisform.CCODMATPRefix),[])+[' where varname = 'CODMATPREFIX'; ]+;
				[update optiuni set  varvalue = ']+Nvl(Alltrim(thisform.CCODmatmijloc),[])+[' where varname = 'CODMATMIJLOC'; ]+;
				[update optiuni set  varvalue = ']+Nvl(Alltrim(thisform.CCODMAtcifre),[0])+[' where varname = 'CODMATCIFRE'; ]+;
				[ end;]
		lnsucces = goExecutor.oExecute(lcsel)
		If lnsucces < 0
			lcmesaj = goExecutor.cEroare
			ofrm_er = Createobject('frm_mesaj','Eroare','exclam.ico','Avertizare',lcmesaj)
			ofrm_er.Show(1)
			Release ofrm_er
			Return 
		EndIf
		gncodmatautomat = thisform.ncodmatautomat
		gccodmatPrefix = Alltrim(thisform.ccodmatprefix)
		gccodmatMijloc = Alltrim(thisform.ccodmatMijloc)
		gccodmatCifre = Alltrim(thisform.ccodmatCifre)
		DoDefault()
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		thisform.ncodmatautomat = gncodmatautomat
		thisform.ccodmatmijloc = gcCodMatMijloc
		thisform.ccodmatprefix = gcCodmatPrefix
		thisform.ccodmatcifre  = gcCodmatCifre 
		
		
		thisform.do_enabledisable(thisform.ncodmatautomat)
	ENDPROC

	PROCEDURE _optiongrup1.InteractiveChange
		thisform.do_enabledisable(this.Value)
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_grupe_subgr_art_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="Cus_odata_grupe_art" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cus_odata_subgrupe_art" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />

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

	*<PropValue>
		DoCreate = .T.
		Height = 99
		Name = "frm_grupe_subgr_art_nou"
		nid = 0
		Width = 417
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 468
		_shape2.Height = 29
		_shape2.Left = 354
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 61
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 5
		BUT_TERMIN1.Left = 385
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 3
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

	ADD OBJECT 'Clb_tx_simplu' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 13, ;
		Name = "Clb_tx_simplu", ;
		TabIndex = 1, ;
		Top = 34, ;
		Width = 393, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 99, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 286, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 13, ;
		Name = "Clb_tx_simplu1", ;
		TabIndex = 2, ;
		Top = 65, ;
		Width = 393, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 99, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 286, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cus_odata_grupe_art' AS cus_odata_grupe_art WITH ;
		Left = 21, ;
		Name = "Cus_odata_grupe_art", ;
		Top = 80
		*< END OBJECT: ClassLib="onom_articole.vcx" BaseClass="custom" />

	ADD OBJECT 'Cus_odata_subgrupe_art' AS cus_odata_subgrupe_art WITH ;
		Left = 294, ;
		Name = "Cus_odata_subgrupe_art", ;
		Top = 79
		*< END OBJECT: ClassLib="onom_articole.vcx" BaseClass="custom" />
	
	PROCEDURE inainte_de_do_termin
		LOCAL PLRETURN
		
		lccontrol = UPPER(this.ActiveControl.BaseClass )
		IF   INLIST(lccontrol,"TEXTBOX","EDITBOX","COMBOBOX")
			lcval=This.Activecontrol.controlsource
			&lcval=thisform.ActiveControl.value
		ENDIF 	
		
		DO  case 
			CASE UPPER(ALLTRIM(this.clb_tx_simplu.lb_simplu1.Caption))='GRUPA' 
			IF EMPTY(porec.grupa)
				lcTitlu=[Atentie]
				lcMesaj=[Nu ati completat numele grupei!]	
				lcimagine = [exclam.ico]
				lctip = [Avertizare]
				ofrm_av = CREATEOBJECT([frm_mesaj],lcTitlu,lcimagine,lctip,lcMesaj)
				ofrm_av.show(1)
				RELEASE ofrm_av
				
				This.clb_tx_simplu.SetFocus()			
				plreturn=.F.
			ELSE 	
				If Alltrim(Upper(This.cus_odata_grupe_art.cactiune))="INSERT"  ;
				     Or (Alltrim(Upper(This.cus_odata_grupe_art.cactiune))="UPDATE"  ;
				     And porec.grupa!=pcnume) 
					SELECT crsgrupe_art
					LOCATE FOR UPPER(ALLTRIM(grupa)) = UPPER(TRIM(porec.grupa))
					IF FOUND()
						ofrm_av = CREATEOBJECT([frm_mesaj],[Atentie],[exclam.ico],[Avertizare],[Mai exista o grupa cu acest nume inregistrata!])
						ofrm_av.show(1)
						RELEASE ofrm_av
		
						Thisform.clb_tx_simplu.SetFocus()				
						plreturn=.F.				
					Else
					
						PLRETURN=This.cus_odata_grupe_art.salvare(This.OREC,This.NID)
					ENDIF			
				ELSE
					PLRETURN=This.cus_odata_grupe_art.salvare(This.OREC,This.NID)   
				ENDIF		   			
			ENDIF 	
			
			CASE UPPER(ALLTRIM(this.clb_tx_simplu.lb_simplu1.Caption))='SUBGRUPA'
			IF EMPTY(porec.subgrupa)
				lcTitlu=[Atentie]
				lcMesaj=[Nu ati completat numele subgrupei!]	
				lcimagine = [exclam.ico]
				lctip = [Avertizare]
				ofrm_av = CREATEOBJECT([frm_mesaj],lcTitlu,lcimagine,lctip,lcMesaj)
				ofrm_av.show(1)
				RELEASE ofrm_av
				
				This.clb_tx_simplu.SetFocus()			
				plreturn=.F.
			ELSE
				If Alltrim(Upper(This.cus_odata_subgrupe_art.cactiune))="INSERT"  ;
				     Or (Alltrim(Upper(This.cus_odata_subgrupe_art.cactiune))="UPDATE"  ;
				     And (porec.subgrupa!=pcnume or Nvl(porec.indicativ,[]) != Nvl(pcIndicativ,[])))
					SELECT crssubgrupe_art
					If Alltrim(Upper(This.cus_odata_subgrupe_art.cactiune))="INSERT"
						LOCATE For(UPPER(ALLTRIM(subgrupa)) = UPPER(TRIM(porec.subgrupa)))
					Else 
						LOCATE For(UPPER(ALLTRIM(subgrupa)) = UPPER(TRIM(porec.subgrupa)) and porec.subgrupa!=pcnume )
					EndIf 
					IF FOUND()
						ofrm_av = CREATEOBJECT([frm_mesaj],[Atentie],[exclam.ico],[Avertizare],[Mai exista o subgrupa cu acest nume inregistrata!])
						ofrm_av.show(1)
						RELEASE ofrm_av
		
						Thisform.clb_tx_simplu.SetFocus()				
						plreturn=.F.				
					Else
						SELECT crssubgrupe_art
						If Alltrim(Upper(This.cus_odata_subgrupe_art.cactiune))="INSERT"
							LOCATE FOR Nvl(Alltrim(indicativ),[])=Nvl(Alltrim(porec.indicativ),[])
						Else 
							LOCATE FOR UPPER(ALLTRIM(subgrupa)) <> UPPER(TRIM(pcnume)) and Nvl(Alltrim(indicativ),[])=Nvl(Alltrim(porec.indicativ),[])
						EndIf 
						IF FOUND()
							ofrm_av = CREATEOBJECT([frm_mesaj],[Atentie],[exclam.ico],[Avertizare],[Mai exista o subgrupa cu acest indicativ inregistrata!])
							ofrm_av.show(1)
							RELEASE ofrm_av
		
							Thisform.clb_tx_simplu1.SetFocus()				
							plreturn=.F.
						Else 
							PLRETURN=This.cus_odata_subgrupe_art.salvare(This.OREC,This.NID)
						EndIf 
					ENDIF			
				ELSE
					PLRETURN=This.cus_odata_subgrupe_art.salvare(This.OREC,This.NID)   
				ENDIF		   						
			ENDIF			
		ENDCASE
		
		Return PLRETURN
		
		
	ENDPROC

	PROCEDURE Init
		LPARAMETERS toRec, tnId, tcActiune
		
		DODEFAULT()
		
		IF PEMSTATUS(torec,'id_subgrupa',5) && se creeaza sau se modifica o subgrupa
			lccus_odata = 'cus_odata_subgrupe_art'
			lcTitlu = 'Subgrupa articole'
			this.clb_tx_simplu.lb_simplu1.caption = 'Subgrupa' 	
			this.clb_tx_simplu.text_simplu1.ControlSource = 'porec.subgrupa'  
			this.clb_tx_simplu1.lb_simplu1.caption = 'Indicativ' 	
			this.clb_tx_simplu1.text_simplu1.ControlSource = 'porec.indicativ' 
			this.clb_tx_simplu1.Visible= .T.
			thisform.Height=100 	
		ELSE && se creeaza sau se modifica o grupa
			lccus_odata = 'cus_odata_grupe_art'
			lcTitlu = 'Grupa articole'
			this.clb_tx_simplu.lb_simplu1.caption = 'Grupa'
			this.clb_tx_simplu.text_simplu1.ControlSource = 'porec.grupa'
			this.clb_tx_simplu1.Visible= .F.
			thisform.Height=70
		ENDIF
		
		this.Lb_titlu_alb_b121.Caption = lctitlu
		this.orec= toRec
		this.nid = tnId
		this.&lccus_odata..cactiune = tcActiune
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_grupe_subgr_articole AS _frmbase OF "..\..\..\roacomenzi\comun\clase\_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="Ct_grid_search1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ct_grid_search2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge2" UniqueID="" Timestamp="" />

	*<PropValue>
		cbuton3 = but_modifica1;but_modifica2
		cbuton4 = but_sterge1;but_sterge2;but_reface1
		DoCreate = .T.
		Height = 419
		Name = "frm_grupe_subgr_articole"
		Width = 711
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 720
		_shape2.Height = 29
		_shape2.Left = 679
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 32
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 681
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		caction = do_modifica, ;
		Left = 45, ;
		Name = "But_modifica1", ;
		Top = 383
		*< END OBJECT: ClassLib="..\..\..\roacomenzi\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_modifica2' AS but_modifica WITH ;
		caction = do_modifica, ;
		Left = 382, ;
		Name = "But_modifica2", ;
		Top = 383
		*< END OBJECT: ClassLib="..\..\..\roacomenzi\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_nou1' AS but_nou WITH ;
		caction = do_adauga, ;
		Left = 15, ;
		Name = "But_nou1", ;
		Top = 382
		*< END OBJECT: ClassLib="..\..\..\roacomenzi\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_nou2' AS but_nou WITH ;
		caction = do_adauga, ;
		Left = 352, ;
		Name = "But_nou2", ;
		Top = 382
		*< END OBJECT: ClassLib="..\..\..\roacomenzi\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		caction = do_sterge, ;
		Left = 74, ;
		Name = "But_sterge1", ;
		Top = 382
		*< END OBJECT: ClassLib="..\..\..\roacomenzi\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge2' AS but_sterge WITH ;
		caction = do_sterge, ;
		Left = 411, ;
		Name = "But_sterge2", ;
		Top = 382
		*< END OBJECT: ClassLib="..\..\..\roacomenzi\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ct_grid_search1' AS ct_grid_search WITH ;
		Height = 352, ;
		Left = 6, ;
		Name = "Ct_grid_search1", ;
		Top = 31, ;
		Width = 330, ;
		_GRID1.Height = 285, ;
		_GRID1.Left = 6, ;
		_GRID1.Name = "_GRID1", ;
		_GRID1.Top = 57, ;
		_GRID1.Width = 312, ;
		Titlu.Left = 6, ;
		Titlu.Name = "Titlu", ;
		Titlu.Top = 3, ;
		Cb_tx_cautare1.Criteriu.Name = "Criteriu", ;
		Cb_tx_cautare1.Height = 27, ;
		Cb_tx_cautare1.Left = 4, ;
		Cb_tx_cautare1.Name = "Cb_tx_cautare1", ;
		Cb_tx_cautare1.Text.Height = 25, ;
		Cb_tx_cautare1.Text.Left = 103, ;
		Cb_tx_cautare1.Text.Name = "Text", ;
		Cb_tx_cautare1.Text.Top = 1, ;
		Cb_tx_cautare1.Text.Width = 208, ;
		Cb_tx_cautare1.Top = 23, ;
		Cb_tx_cautare1.Width = 314
		*< END OBJECT: ClassLib="..\..\..\roacomenzi\comun\clase\ferestre_cere_date.vcx" BaseClass="container" />

	ADD OBJECT 'Ct_grid_search2' AS ct_grid_search WITH ;
		Height = 354, ;
		Left = 343, ;
		Name = "Ct_grid_search2", ;
		Top = 31, ;
		Width = 365, ;
		_GRID1.Height = 285, ;
		_GRID1.Left = 6, ;
		_GRID1.Name = "_GRID1", ;
		_GRID1.Top = 57, ;
		_GRID1.Width = 347, ;
		Titlu.Left = 6, ;
		Titlu.Name = "Titlu", ;
		Titlu.Top = 3, ;
		Cb_tx_cautare1.Criteriu.Name = "Criteriu", ;
		Cb_tx_cautare1.Height = 27, ;
		Cb_tx_cautare1.Left = 4, ;
		Cb_tx_cautare1.Name = "Cb_tx_cautare1", ;
		Cb_tx_cautare1.Text.Height = 25, ;
		Cb_tx_cautare1.Text.Left = 103, ;
		Cb_tx_cautare1.Text.Name = "Text", ;
		Cb_tx_cautare1.Text.Top = 1, ;
		Cb_tx_cautare1.Text.Width = 243, ;
		Cb_tx_cautare1.Top = 23, ;
		Cb_tx_cautare1.Width = 349
		*< END OBJECT: ClassLib="..\..\..\roacomenzi\comun\clase\ferestre_cere_date.vcx" BaseClass="container" />
	
	PROCEDURE do_adauga
		
		DO case
			CASE pnnr = 1
				lccursor = 'crsgrupe_art'
				lcgrid = 'ct_grid_search1'		
			CASE pnnr = 2
				lccursor = 'crssubgrupe_art'
				lcgrid = 'ct_grid_search2'			
		ENDCASE
		
		SELECT (lccursor)
		SCATTER NAME lorec blank	
		DO Adauga_Modifica_Inregistrare WITH [grupe_subgr_art],lorec,,[INSERT]
		this.&lcgrid..actualizeaza_grid	
	ENDPROC

	PROCEDURE do_modifica
		IF TYPE('pnnr') # 'N'
			pnnr =1 
		ENDIF 
			
		PRIVATE pcnume,pcIndicativ
		STORE '' TO pcnume,pcIndicativ
		
		DO case
			CASE pnnr = 1
				lccursor = 'crsgrupe_art'
				lcgrid = 'ct_grid_search1'	
				lcamp_id = 'id_grupa'	
				lcamp_nume = 'grupa'
			CASE pnnr = 2
				lccursor = 'crssubgrupe_art'
				lcgrid = 'ct_grid_search2'
				lcamp_id = 'id_subgrupa'
				lcamp_nume = 'subgrupa'
							
		ENDCASE
		
		SELECT (lccursor)
		SCATTER NAME lorec
		lnId = lorec.&lcamp_id.
		pcnume = lorec.&lcamp_nume.
		If pnnr = 2
			pcIndicativ = lorec.indicativ	
		EndIf 
		DO Adauga_Modifica_Inregistrare WITH [grupe_subgr_art],lorec,lnid,[UPDATE]
		this.&lcgrid..actualizeaza_grid	
	ENDPROC

	PROCEDURE do_sterge
		
		DO case
			CASE pnnr = 1
				lccursor = 'crsgrupe_art'
				lcgrid = 'ct_grid_search1'	
				lcamp_id = 'id_grupa'
				lcalias = [grupe_art]			
			CASE pnnr = 2
				lccursor = 'crssubgrupe_art'
				lcgrid = 'ct_grid_search2'
				lcamp_id = 'id_subgrupa'
				lcalias = [subgrupe_art]					
		ENDCASE
		
		SELECT (lccursor)
		SCATTER NAME lorec
		lnId = lorec.&lcamp_id.
		DO STERGE_INREGISTRARE WITH lcalias,lnid
		this.&lcgrid..actualizeaza_grid	
		
				
		
	ENDPROC

	PROCEDURE Show
		LPARAMETERS nStyle
		
		thisform.Ct_grid_search1.initializare(.t.)
		SELECT crsgrupe_art
		pnId_grupa = id_grupa
		thisform.Ct_grid_search2.initializare(.t.)
		
		
	ENDPROC

	PROCEDURE But_modifica1.Click
		PRIVATE pnnr
		pnnr =1 
		DODEFAULT()
	ENDPROC

	PROCEDURE But_modifica2.Click
		PRIVATE pnnr
		pnnr =2 
		DODEFAULT()
	ENDPROC

	PROCEDURE But_nou1.Click
		PRIVATE pnnr
		pnnr =1 
		DODEFAULT()
	ENDPROC

	PROCEDURE But_nou2.Click
		PRIVATE pnnr
		pnnr =2 
		DODEFAULT()
	ENDPROC

	PROCEDURE But_sterge1.Click
		PRIVATE pnnr
		pnnr =1 
		DODEFAULT()
	ENDPROC

	PROCEDURE But_sterge2.Click
		PRIVATE pnnr
		pnnr =2 
		DODEFAULT()
	ENDPROC

	PROCEDURE Ct_grid_search1._GRID1.AfterRowColChange
		LPARAMETERS nColIndex
		
		SELECT crsgrupe_art
		pnId_grupa = id_grupa
		thisform.Ct_grid_search2.actualizeaza_grid()
		
	ENDPROC

ENDDEFINE

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

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

	*<DefinedPropArrayMethod>
		*p: cgrupa1
		*p: cgrupa2
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgrupa1 = 
		cgrupa2 = 
		DoCreate = .T.
		Height = 130
		Name = "frm_listeaza_articolecodbare"
		Width = 375
		_shape1.Name = "_shape1"
		_shape2.Name = "_shape2"
		Lb_titlu_alb_b121.Caption = "Listare coduri de bare"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

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

	ADD OBJECT 'Cb_grupare1' AS cb_tx_simplu WITH ;
		Left = 42, ;
		Name = "Cb_grupare1", ;
		Top = 48, ;
		_cbbase1.ControlSource = "thisform.cGrupa1", ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = " ,Grupa,Subgrupa", ;
		_cbbase1.RowSourceType = 1, ;
		_lbbase1.Caption = "Grupare 1", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cb_grupare2' AS cb_tx_simplu WITH ;
		Left = 42, ;
		Name = "Cb_grupare2", ;
		Top = 84, ;
		_cbbase1.ControlSource = "thisform.cGrupa2", ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.RowSource = " ,Grupa,Subgrupa", ;
		_cbbase1.RowSourceType = 1, ;
		_lbbase1.Caption = "Grupare 2", ;
		_lbbase1.Name = "_lbbase1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE inainte_de_do_listare
		Local lcGrupare,lcOrdine,lcSelect
		Private pcGrup1,pcGrup2,pcHeaderGrup1,pcHeaderGrup2
		X = XMENU("Listare coduri de bare (pentru cititor);Listare coduri de bare (simpla)")
		
		Store [EOF()] To pcGrup1,pcGrup2
		Store [] To pcHeaderGrup1,pcHeaderGrup2
		
		Store [] To lcGrupare,lcOrdine,lcSelect
		Select crsnom_articole
		If !Empty(Alltrim(Nvl(This.cgrupa1,'')))
			lcGrupare = This.cgrupa1
			pcGrup1 = Alltrim(This.cgrupa1)
			pcHeaderGrup1 = Alltrim(This.cgrupa1)
		Endif
		
		If !Empty(Alltrim(Nvl(This.cgrupa2,'')))
			lcGrupare = lcGrupare +Iif(!Empty(lcGrupare ),[,],[])+This.cgrupa2
			pcGrup2 = Alltrim(This.cgrupa2)
			pcHeaderGrup2 = Alltrim(This.cgrupa2)
		Endif
		
		If !Empty(lcGrupare)
			lcOrdine = lcGrupare+[ ,]
			lcGrupare = [ group by ]+lcGrupare
		Endif
		
		lcSelect = [Select denumire, codmat, subgrupa, grupa, codbare from crsnom_articole order by ]+Nvl(lcOrdine,[]) +[ denumire into cursor crsListare ]
		&lcSelect
		Thisform.AlwaysOnTop = .F.
		Select crsListare
		Do Case
			Case X=1
				Report Form rap_articolecodbare To Printer Prompt Preview
			Case X=2
				Report Form rap_articolecodbares To Printer Prompt Preview
			Otherwise
				X= 3
		Endcase
		Thisform.AlwaysOnTop = .T.
	ENDPROC

ENDDEFINE
