*!* 19.08.2014
*!* marius.mutu
*!* vizualizeaza_detalii_comanda: adaugat campul UM

Procedure distribuire_timp_normat
*!*	Local lcFiltru,lcSql,lnSucces
*!*	lcFiltru = Strtran(gcCondLuna,Chr(39),Chr(63))
*!*	lcSql=[begin pack_devize.dev_distribuie_timp_n('] + Alltrim(gcS) + [',']+Alltrim(lcFiltru)+['); end;]
LOCAL lcSql,lnSucces
lcSql = [begin pack_auto.dev_distribuie_timp_n(?gnLuna,?gnAn); end;]
lnSucces=goExecutor.oExecute(lcSql)
If lnSucces < 0
	amessagebox(goExecutor.cEroare,0+16,'Eroare')
	Return
Endif
Endproc
**********************************************************************************
Procedure emitere_facturi
If glLunaInchisa
	amessagebox("Nu puteti emite facturi, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa")
	Return
Endif
*!*	*---------------------------------

*!*	lcSql = [select a.id_ordl,a.id_lucrare,a.luna,a.an,a.datai,a.validat,a.dataoravalid,b.manopera,b.materiale,;
*!*			a.nume,a.nrord,a.nrinmat,a.asigurator,a.inspector,a.util_valid,a.numar,a.tip_incas,a.id_masiniclient,;
*!*			b.facturat,b.datafact;
*!*			from ] + gcs + [.dev_vordl a left join ] + gcs +[.dev_vordl_manmat b on a.id_ordl = b.id_ordl]
*!*	lnSucces=goExecutor.oExecute(lcSql,'crsMater')
*!*	If lnSucces < 0
*!*		amessagebox(goExecutor.cEroare,0+16,'Eroare')
*!*	ENDIF
*!*	SELECT crsMater
*!*	BROWSE
*!*	*-----------------------------------
Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra,pcFiltruVfp
Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza
Store '' To pocomenzi
pcValoare1 = ""
pcValoare2 = ""
pnCriteriu = 1
pnCriteriu2 = 1
pcIntre = ""
pcFiltruOra = ""
pcFiltruVfp = ""
Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra

If Used('crscomenzi')
	Use In crscomenzi
Endif
*!*	pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),DATAI d,VALIDAT n(1),DATAORAVALID t,MANOPERA n(20,4),MATERIALE n(20,4),'+]+;
*!*		['NUME c(50),NRORD c(30),NRINMAT c(10),ASIGURATOR c(24),INSPECTOR c(24),UTIL_VALID c(30),FACTURAT n(1),DATAFACT d,'+]+;
*!*		['NRFACT n(15),ID_MASINICLIENT n(8),ID_PARTENER n(5),TIP_COMANDA c(50)']
*!*	pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.validat,a.dataoravalid,a.manopera,a.materiale,a.nume,'+]+;
*!*		['a.nrord,a.nrinmat,a.asigurator,a.inspector,a.util_valid,a.facturat,a.datafact,a.nrfact,a.id_masiniclient,'+]+;
*!*		['a.id_partener,a.tip_comanda '+]+;
*!*		['from ] + gcS + [.dev_vvalid_comenzi a '+]+;
*!*		['where 1=2']
pcschema=['']
pcselect=['select 0 as ales,a.* from ] + gcS + [.auto_validare_comenzi a '+]+;
	['where 1=2']
IF !EMPTY(pcFiltruora)
	* TIP = 1 POST GARANTIE, 2 = GARANTIE
	pcfiltru = gcCondLuna + [ and a.inchis_fortat = 0 and a.id_tip IN (1,2) ] + pcFiltruOra
ELSE
	pcfiltru = [1=2]
ENDIF
pcorder=[datai,nrord]
llAfiseaza=.F.
gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
pocomenzi.ca_baza1.afisare()
Select crscomenzi

ofrmfacturare=Createobject('frm_emitere_facturi')
*!*	modificare	v 2.0.17
If !Empty(pcFiltruOra)
	With ofrmfacturare.ck_nrord
		.cValoare1 = pcValoare1
		.cValoare2 = pcValoare2
		.criteriu = pnCriteriu
		.criteriu2 = pnCriteriu2
		.cIntre = pcIntre
		.filtru = pcFiltruOra
		.filtru_vfp = pcFiltruVFP
		.Value = 1
	Endwith
Endif
*!*	modificare	v 2.0.17	^
ofrmfacturare.Show(1)
If Used('crscomenzi')
	Use In crscomenzi
Endif
Release pocomenzi,ofrmfacturare

Endproc	&& emitere_facturi
*****************************************************************************************
**********************************************************************************
Procedure inchidere_regie
Private pnVar
STORE 0 TO pnVar
goExecutor.oFunction2Value("pack_auto.getOptiuneInchidere(3)",@pnVar)
If Nvl(pnVar,1) = 1
	amessagebox("Comenzile de regie se inchid automat la validare!",0+48,"Atentie")
	Return
Endif

If glLunaInchisa
	amessagebox("Nu puteti inchide comenzi de regie, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa")
	Return
Endif

Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra, pcFiltruVFP
Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza
Store '' To pocomenzi
pcValoare1 = ""
pcValoare2 = ""
pnCriteriu = 1
pnCriteriu2 = 1
pcIntre = ""
pcFiltruOra = ""
pcFiltruVFP = ""
Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra

If Used('crscomenzi')
	Use In crscomenzi
Endif
pcschema=['']
pcselect=['select * from ] + gcS + [.auto_validare_comenzi a '+]+;
	['where 1=2']
IF !EMPTY(pcFiltruora)
	pcfiltru = gcCondLuna + [ and a.id_tip=3 ] + pcFiltruOra
ELSE
	pcfiltru = [1=2]
ENDIF
pcorder=[datai,nrord]
llAfiseaza=.F.
gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
pocomenzi.ca_baza1.afisare()
Select crscomenzi

ofrmfacturare=Createobject('frm_inchidere_regie')
*!*	modificare	v 2.0.17
If !Empty(pcFiltruOra)
	With ofrmfacturare.ck_nrord
		.cValoare1 = pcValoare1
		.cValoare2 = pcValoare2
		.criteriu = pnCriteriu
		.criteriu2 = pnCriteriu2
		.cIntre = pcIntre
		.filtru = pcFiltruOra
		.filtru_vfp = pcFiltruVFP
		.Value = 1
	Endwith
Endif
*!*	modificare	v 2.0.17	^
ofrmfacturare.Show(1)
If Used('crscomenzi')
	Use In crscomenzi
Endif
Release pocomenzi,ofrmfacturare

Endproc	&& inchidere_regie
*****************************************************************************************
**********************************************************************************
Procedure inchidere_productie
Private pnVar
STORE 1 TO pnVar
goExecutor.oFunction2Value("pack_auto.getOptiuneInchidere(6)",@pnVar)
If Nvl(pnVar,1) = 1
	amessagebox("Comenzile de productie se inchid automat la validare!",0+48,"Atentie")
	Return
Endif

If glLunaInchisa
	amessagebox("Nu puteti inchide comenzi de productie, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa")
	Return
Endif

Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra, pcFiltruVFP
Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza
Store '' To pocomenzi
pcValoare1 = ""
pcValoare2 = ""
pnCriteriu = 1
pnCriteriu2 = 1
pcIntre = ""
pcFiltruOra = ""
pcFiltruVFP = ""
Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra

If Used('crscomenzi')
	Use In crscomenzi
Endif
pcschema=['']
pcselect=['select * from ] + gcS + [.auto_validare_comenzi a '+]+;
	['where 1=2']
IF !EMPTY(pcFiltruora)
	pcfiltru = gcCondLuna + [ and a.id_tip=6 ] + pcFiltruOra
ELSE
	pcfiltru = [1=2]
ENDIF
pcorder=[datai,nrord]
llAfiseaza=.F.
gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
pocomenzi.ca_baza1.afisare()
Select crscomenzi

ofrmfacturare=Createobject('frm_inchidere_productie')
*!*	modificare	v 2.0.17
If !Empty(pcFiltruOra)
	With ofrmfacturare.ck_nrord
		.cValoare1 = pcValoare1
		.cValoare2 = pcValoare2
		.criteriu = pnCriteriu
		.criteriu2 = pnCriteriu2
		.cIntre = pcIntre
		.filtru = pcFiltruOra
		.filtru_vfp = pcFiltruVFP
		.Value = 1
	Endwith
Endif
*!*	modificare	v 2.0.17	^
ofrmfacturare.Show(1)
If Used('crscomenzi')
	Use In crscomenzi
Endif
Release pocomenzi,ofrmfacturare

Endproc	&& inchidere_productie
*****************************************************************************************
Procedure vizualizare_facturi
Private pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza
Store '' To pofacturi
pcschema=['NRCRT n(5),ID_LUCRARE N(20),NRORD C(50),DATAI d,NUME c(50),TELEFON C(50),MANOPERA n(20,4),MATERIALE n(20,4),MANOPERA_DEVIZ n(20,4), MATERIALE_DEVIZ n(20,4),'+]+;
	['ASIGURATOR c(24),INSPECTOR c(24),NR_DOSAR c(40),NRINMAT c(35),NRACT n(14),DATAACT d,VALCTVA n(19,2), ID_PART_REF N(20), PART_REF C(100)']
pcorder=[a.dataact,a.nract,a.datai,a.nrord]
*!*	modificare 27.01
*!*	pcselect=['select row_number() over (partition by a.nrord order by ] + pcorder + [) as nrcrt,'+]+;
*!*		['a.nrord,a.datai,a.nume,a.manopera,a.materiale,a.asigurator,'+]+;
*!*		['a.inspector,a.nrinmat,a.nrfact as nract,a.datafact as dataact,a.valctva '+]+;
*!*		['from ] + gcS + [.dev_validare_comenzi a '+]+;
*!*		['where 1=2']
pcselect=['select a.nrcrt,a.id_lucrare,a.nrord,a.datai,a.nume,a.telefon,a.manopera,a.materiale,a.manopera_deviz, a.materiale_deviz, a.asigurator,a.inspector,'+]+;
	['a.nr_dosar,a.nrinmat,a.nract,a.dataact,a.valctva, a.id_part_ref, a.part_ref '+]+;
	['from auto_facturi_emise a'+]+;
	['where 1=2']

*!*	*!*		['join ] + gcS + [.vireg_parteneri b on a.id_lucrare=b.id_lucrare '+]+;
*!*	*!*	pcfiltru=[b.luna=]+Alltrim(Str(gnLuna))+[ and b.an=]+Alltrim(Str(gnAn))
*!*	*!*	pcfiltru=[(extract(month from dataact) =]+Alltrim(Str(gnLuna))+[ and extract(year from dataact) =]+Alltrim(Str(gnAn))+[)]
pcFiltru=[1=2]
*!*	*!*	pcfiltru = gcCondLuna + [ and a.facturat = 1]
llAfiseaza=.F.

gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
pofacturi.ca_baza1.afisare()

ofrmvizfact=Createobject('frm_viz_facturi')
ofrmvizfact.Show(1)
If Used('crsfacturi')
	Use In crsfacturi
Endif
Release pofacturi
Endproc	&& vizualizare_facturi
*****************************************************************************************
Function vizualizeaza_detalii_comanda
	Lparameters toFereastra,toComanda,tlDoarVizualizare
	Local loFrmDetaliiComanda, lcSelect, lcSchema, lcFiltru, lcOrder, llAfiseaza, lnDoarVizualizare
	Private plComandaM, poOper, poRul, poDevEst
	Store '' To poOper, poRul, poDevEst
	plComandaM = .F.
	llAfiseaza = .F.
	Do ccsectii In update_devize.prg

	lcSchema=['ID_ORDL n(10),CODOP c(10),TIMPN n(9,3),PRET n(20,4),VALIDAT n(1),DENOP c(100),SECTIE c(100),DATAI d,ID_OPER N(20),NOU N(1)']
	lcSelect=['select id_ordl,codop,timpn,pret,validat,denop,sectie,datai,id_oper,nou from ] + gcS + [.auto_voper where 1=2']
	lcOrder=[datai,id_oper]
	lcFiltru= [id_ordl = ]+Alltrim(Str(toComanda.id_ordl))+[ and ]+;
		[extract(month from datai)+extract(year from datai)*12<=?gnLuna+?gnAn*12]
	gencursor('pooper','oper',lcSelect,lcFiltru,lcSchema,lcOrder,llAfiseaza)
	poOper.ca_baza1.afisare()

	*!*	am pus toComanda.proc_tvav in loc de pack_contafin.getCotaTVAStandard
	*!*	 era pack_contafin.getCotaTVAStandard era pus pentru ca se poate schimba TVA-ul de la o luna la alta si pe factura trebuie sa am
	*!*	calculat tva-ul cu cota din luna curenta,nu cu cea din luna in care am facut bonul
	*!*	 toComanda.proc_tvav se stabileste la crearea comenzii auto, se actualizeaza la validare si la facturare
	lcSchema=['CODMAT c(50),DENUMIRE c(100),UM C(10),PRETV n(20,4),CANTE n(18,3),DATAACT D,ID_RUL n(20),COTA_DIFERITA n(1),TVA n(20,4),PRETCTVA n(20,4)']
	*!*	modificare	v 2.0.41	:	am adaugat pack_sesiune.calculeaza_pret_cu_tva	
	lcSelect=[select codmat,denumire,um,pretv,cante,dataact,id_rul,decode(proc_tvav,] + ALLTRIM(STR(toComanda.proc_tvav,10,4)) + [,0,1) as cota_diferita,] + ;
		[pack_sesiune.calculeaza_pret_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + ;
		ALLTRIM(STR(toComanda.proc_tvav,10,4)) + [,0,2) as tva, ] + ;
		[pack_sesiune.calculeaza_pret_cu_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + ;
		ALLTRIM(STR(toComanda.proc_tvav,10,4)) + [,0,2) as pretctva ] + ;
		[from ] + gcS + [.vrul where 1=2']
	lcOrder=[dataact,id_rul]
	lcFiltru= [id_lucrare = ]+Alltrim(Str(toComanda.id_lucrare))+[ and cante <> 0 and ]+;
		[luna+an*12<=?gnLuna+?gnAn*12]
	gencursor('porul','rul',lcSelect,lcFiltru,lcSchema,lcOrder,llAfiseaza)
	poRul.ca_baza1.afisare()

	lcSchema=['DENUMIRE v(100),COD v(10),UM v(10),CANTITATE n(20,4),PRETFTVA n(20,4),PRETCTVA n(20,4),COTA_TVA n(10),VALOARE n(20,4),ID_DEV_ESTIMARE_REP n(20),ID_LUCRARE n(10),NRORD v(50),ID_NORME n(5),ID_ARTICOL n(20),PRET_CU_TVA n(1),VALFTVA n(20,4),VALTVA n(20,4)']
	lcSelect=['select denumire,cod,um,cantitate,pretftva,pretctva,cota_tva,valoare,id_dev_estimare_rep,id_lucrare,nrord,id_norme,id_articol,pret_cu_tva,valftva,valtva from ] + gcS + [.auto_vestimari_rep where 1=2']
	lcOrder=[id_dev_estimare_rep]
	lcFiltru= [id_lucrare = ]+Alltrim(Str(toComanda.id_lucrare))
	gencursor('podevest','v_devizest',lcSelect,lcFiltru,lcSchema,lcOrder,llAfiseaza)
	poDevEst.ca_baza1.afisare()

	lnDoarVizualizare = Iif(Empty(tlDoarVizualizare),1,Iif(tlDoarVizualizare,2,1))
	toFereastra.AlwaysOnTop=.F.
	loFrmDetaliiComanda = Createobject('frm_vizcomanda',lnDoarVizualizare,toComanda.Validat)
	loFrmDetaliiComanda.Show(1)
	toFereastra.AlwaysOnTop=.T.
	Use In (Select('oper'))
	Use In (Select('rul'))
	Use In (Select('v_devizest'))
	Release loFrmDetaliiComanda, lcSelect, lcSchema, lcFiltru, lcOrder, llAfiseaza, poOper, poRul, poDevEst,llDoarVizualizare
	Return plComandaM
Endfunc
*****************************************************************************************
Procedure vizualizare_comenzi_regie
Private pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza
Store '' To pofacturi
pcschema=['NRCRT n(5),NRORD c(50),DATAI d,NUME c(50),MANOPERA n(20,4),MATERIALE n(20,4),'+]+;
	['NRINMAT c(35),NRACT n(14),DATAACT d,TOTALFTVA n(19,2)']
pcorder=[a.datai,a.nrord]
pcselect=['select a.nrcrt,a.nrord,a.datai,a.nume,a.manopera,a.materiale,'+]+;
	['a.nrinmat,a.nract,a.dataact,a.totalftva '+]+;
	['from ]+gcS+[.auto_inchidere a'+]+;
	['where 1=2']

pcFiltru=[1=2]
llAfiseaza=.F.

gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
pofacturi.ca_baza1.afisare()

ofrmvizfact=Createobject('frm_viz_comenzi_regie')
ofrmvizfact.Show(1)
If Used('crsfacturi')
	Use In crsfacturi
Endif
Release pofacturi
Endproc	&& vizualizare_comenzi_regie
*****************************************************************************************
Procedure normare_salarii
*!*	If glLunaInchisa
*!*		amessagebox("Nu puteti norma salariile, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa")
*!*		Return
*!*	Endif

Local loTherm, lcTask, lnPercent
Private pcselect,pcschema,pcfiltru,pcorder,pomanopera,pomecanici,llAfiseaza
Store '' To pomanopera,pomecanici
If Used('crsmanopera')
	Use In crsmanopera
Endif
If Used('crsmecanici')
	Use In crsmecanici
Endif
loTherm = Newobject("_thermometer","_therm","","Manopera comenzi inchise...")
lcTask = "Incarcare date vizualizare"
_Screen.MousePointer= 11
*!*	gofundal.AlwaysOnTop=.F.
With loTherm
	.AlwaysOnTop=.T.
	.Show()

	lnPercent = 0
	lcTask="Incarcare date mecanici..."
	.Update(lnPercent, lcTask)
*!*		=ccsectii()
	=ccmecanici()

	lnPercent = 20
	.Update(lnPercent, lcTask)
	pcschema=['NRORD c(50),DATAI d,ID_OPER n(10),TIMPN n(9,3),PRET n(20,4),ID_SECTIE n(5),SECTIE c(30),'+]+;
		['DENOP c(100),UTIL c(30),DATAORA t,FACTURAT n(1),NRFACT N(14),DATAFACT d,TIP_COMANDA c(50)']
*!*	pcselect=['select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,'+]+;
*!*		['c.facturat,c.nrfact,c.datafact '+]+;
*!*		['from ] + gcS + [.dev_vordl a '+]+;
*!*		['join ] + gcS + [.dev_voper b on a.id_ordl=b.id_ordl '+]+;
*!*		['left join ] + gcS + [.dev_vordl_facturat c on a.id_ordl=c.id_ordl '+]+;
*!*		['where 1=2']
	*!* inlocuire dev_vvalid_comenzi
	pcselect=['select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,'+]+;
		['a.facturat,a.nrfact,a.datafact,a.tip_comanda '+]+;
		['from ] + gcS + [.auto_normare_comenzi a '+]+;
		['join ] + gcS + [.auto_voper b on a.id_ordl=b.id_ordl '+]+;
		['where 1=2']
*!*	pcfiltru=[a.luna=]+Alltrim(Str(gnLuna))+[ and a.an=]+Alltrim(Str(gnAn))+[ and a.facturat=1]
*!*	pcFiltru = [extract(month from a.datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.datafact) = ]+Alltrim(Str(gnAn))+[ and a.facturat=1]
	pcfiltru = gcCondLuna + [ and a.facturat = 1]
	pcorder=[a.datai,a.nrord]
	llAfiseaza=.F.
	pcfiltru = [1=2]
	gencursor('pomanopera','crsmanopera',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)

	If !glLunaInchisa
		lnPercent = 30
		lcTask="Distribuire timp normat..."
		.Update(lnPercent, lcTask)
		distribuire_timp_normat()
	endif
*!*		lcSql=[begin pack_devize.dev_distribuie_timp_n('] + Alltrim(gcS) + [',']+Alltrim(pcfiltru)+['); end;]
*!*		lnSucces=goExecutor.oExecute(lcSql)
*!*		If lnSucces < 0
*!*			amessagebox(goExecutor.cEroare,0+16,'Eroare')
*!*		Endif

	lnPercent = 60
	lcTask="Incarcare date operatii comenzi..."
	.Update(lnPercent, lcTask)
	pomanopera.ca_baza1.afisare()

	lnPercent = 90
	lcTask="Incarcare date manopera..."
	.Update(lnPercent, lcTask)
	pcschema=['ID_OPERMECANIC n(10),ORE n(9,3),NUME c(100),ID_MECANIC n(5)']
	pcselect=['select id_opermecanic,ore,nume||CHR(32)||prenume as nume,id_mecanic from ] + gcS + [.auto_voper_detalii_m '+]+;
		['where 1=2']
	pcfiltru=[1=2]
	pcorder=[nume]
	llAfiseaza=.F.
	gencursor('pomecanici','crsmecanici',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)

	.Complete()
	.AlwaysOnTop=.F.
Endwith
*!*	gofundal.AlwaysOnTop=.T.
_Screen.MousePointer= 0

ofrmvizfact=Createobject('frm_normare_salarii')
ofrmvizfact.Show(1)
If Used('crsmecanici')
	Use In crsmecanici
Endif
If Used('crsmanopera')
	Use In crsmanopera
Endif
Release pocomenzi,pomanopera
Endproc	&& normare salarii
*****************************************************************************************
Procedure vizualizare_ist_comenzi
Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza
Store '' To pocomenzi

pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),ID_MASINICLIENT n(8),ID_TIP n(5),DATAI d,'+]+;
	['VALIDAT n(1),DATAORAVALID T,UTIL_VALID C(50),NRORD c(50),FACTURAT n(1),DATAFACT d,NRFACT N(14),'+]+;
	['VALCTVA_FACTURA N(20,4),VAL_MANOPERA_FACTURA N(20,4),VAL_MATERIALE_FACTURA N(20,4),'+]+;
	['VAL_MATERIALE_ACH N(20,4),VAL_MATERIALE_VZ N(20,4),ORE_MANOPERA N(20,4),VAL_MANOPERA N(20,4),'+]+;
	['ID_PARTENER n(10),NRINMAT c(35),MASINA c(20),MARCA c(24),NUME c(50),'+]+;
	['ASIGURATOR c(40),INSPECTOR c(40),NR_DOSAR c(40),TIP_COMANDA c(50),PROC_TVAV N(10,4), INCHIS_FORTAT N(1), DATAORAINCHIS T, UTIL_INCHIS C(30), ID_PART_REF N(20), PART_REF C(100),'+]+;
	['SERIES V(100), KMINT I, ORE_FUNCTIONARE I']

pcselect=[select a.id_ordl,a.id_lucrare,a.id_masiniclient,a.id_tip,a.datai,]+;
	[a.validat,a.dataoravalid,a.util_valid,a.nrord,a.facturat,a.datafact,a.nrfact,]+;
	[a.valctva_factura, a.val_manopera_factura, a.val_materiale_factura, a.val_materiale_ach, a.val_materiale_vz, a.ore_manopera, a.val_manopera,]+;	
	[a.id_partener,a.nrinmat,a.masina,a.marca,a.nume,a.asigurator,a.inspector,a.nr_dosar,]+;
	[a.tip_comanda,a.proc_tvav, ] + ;
	[a.inchis_fortat, a.dataorainchis, a.util_inchis, a.id_part_ref, a.part_ref, ]+;
	[a.series, a.kmint, a.ore_functionare ] + ;		
	[ from auto_istoric_comenzi a where 1=2]

pcfiltru=[1=2]
pcorder=[a.datai,a.nrord]
llAfiseaza=.F.
gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
pocomenzi.ca_baza1.afisare()

ofrmistoric=Createobject('frm_istoric_comenzi')
ofrmistoric.Show(1)
If Used('crscomenzi')
	Use In crscomenzi
Endif
Release pocomenzi
Endproc && vizualizare_ist_comenzi
*****************************************************************************************
Procedure vizualizare_manopera
*!*	If glLunaInchisa
*!*		amessagebox("Nu puteti vizualiza manopera, deoarece luna este inchisa!",0+48,"Luna inchisa")
*!*		Return
*!*	Endif

Local loTherm, lcTask, lnPercent
Private pcselect,pcschema,pcfiltru,pcorder,pomanopera,pomecanici,llAfiseaza
Store '' To pomanopera,pomecanici
If Used('crsmanopera')
	Use In crsmanopera
Endif
If Used('crsmecanici')
	Use In crsmecanici
Endif

loTherm = Newobject("_thermometer","_therm","","Manopera comenzi in luna curenta...")
lcTask = "Incarcare date vizualizare"
_Screen.MousePointer= 11
*!*	gofundal.AlwaysOnTop=.F.
With loTherm
	.AlwaysOnTop=.T.
	.Show()

	lnPercent = 0
	lcTask="Incarcare date sectii si mecanici..."
	.Update(lnPercent, lcTask)
	Do ccsectii in update_devize.prg
	=ccmecanici()

	lnPercent = 20
	.Update(lnPercent, lcTask)
	pcschema=['NRORD c(50),DATAI d,ID_OPER n(10),TIMPN n(9,3),PRET n(20,4),ID_SECTIE n(5),SECTIE c(30),'+]+;
		['DENOP c(100),UTIL c(30),DATAORA t,FACTURAT n(1),NRFACT N(14),DATAFACT d,TIP_COMANDA c(50)']
	*!* inlocuire dev_vvalid_comenzi
	pcselect=['select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,'+]+;
		['a.facturat,a.nrfact,a.datafact,a.tip_comanda '+]+;
		['from ] + gcS + [.auto_normare_comenzi a '+]+;
		['join ] + gcS + [.auto_voper b on a.id_ordl=b.id_ordl '+]+;
		['where 1=2']
*!*	pcselect=['select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,'+]+;
*!*		['c.facturat,c.nrfact,c.datafact '+]+;
*!*		['from ] + gcS + [.dev_vordl a '+]+;
*!*		['join ] + gcS + [.dev_voper b on a.id_ordl=b.id_ordl '+]+;
*!*		['left join ] + gcS + [.dev_vordl_facturat c on a.id_ordl=c.id_ordl '+]+;
*!*		['where 1=2']
*!*	pcfiltru=[a.luna=]+Alltrim(Str(gnLuna))+[ and a.an=]+Alltrim(Str(gnAn))
*!*	pcFiltru = [(extract(month from a.datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.datafact) = ]+Alltrim(Str(gnAn)) + [ or a.datafact is null)]
	pcfiltru = gcCondLuna
	pcorder=[a.datai,a.nrord]
	llAfiseaza=.F.
	pcfiltru = [1=2]
	gencursor('pomanopera','crsmanopera',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)

	If !glLunaInchisa
		lnPercent = 30
		lcTask="Distribuire timp normat..."
		.Update(lnPercent, lcTask)
		distribuire_timp_normat()
	endif
*!*		lcSql=[begin pack_devize.dev_distribuie_timp_n('] + Alltrim(gcS) + [',']+Alltrim(pcfiltru)+['); end;]
*!*		lnSucces=goExecutor.oExecute(lcSql)
*!*		If lnSucces < 0
*!*			amessagebox(goExecutor.cEroare,0+16,'Eroare')
*!*		Endif

	lnPercent = 60
	lcTask="Incarcare date operatii comenzi..."
	.Update(lnPercent, lcTask)
	pomanopera.ca_baza1.afisare()

	lnPercent = 90
	lcTask="Incarcare date manopera..."
	.Update(lnPercent, lcTask)
	pcschema=['ID_OPERMECANIC n(10),ORE n(9,3),NUME c(100),ID_MECANIC n(5)']
	pcselect=['select id_opermecanic,ore,nume||CHR(32)||prenume as nume,id_mecanic from ] + gcS + [.auto_voper_detalii_m '+]+;
		['where 1=2']
	pcfiltru=[1=2]
	pcorder=[nume]
	llAfiseaza=.F.
	gencursor('pomecanici','crsmecanici',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)

	.Complete()
	.AlwaysOnTop=.F.
Endwith
Release loTherm
*!*	gofundal.AlwaysOnTop=.T.
_Screen.MousePointer= 0

ofrmmanopera=Createobject('frm_viz_manopera')
ofrmmanopera.Show(1)
If Used('crsmecanici')
	Use In crsmecanici
Endif
If Used('crsmanopera')
	Use In crsmanopera
Endif
Release pocomenzi,pomanopera
Endproc	&& vizualizare_manopera
*****************************************************************************************
Procedure validare_comenzi
If glLunaInchisa
	amessagebox("Nu puteti valida comenzi, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa")
	Return
Endif

Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra, pcFiltruVFP
Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza
Store '' To pocomenzi
pcValoare1 = ""
pcValoare2 = ""
pnCriteriu = 1
pnCriteriu2 = 1
pcIntre = ""
pcFiltruOra = ""
pcFiltruVFP = ""
Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra

If Used('crscomenzi')
	Use In crscomenzi
Endif
*!*	pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),DATAI d,VALIDAT n(1),DATAORAVALID t,MANOPERA n(20,4),MATERIALE n(20,4),'+]+;
*!*		['NUME c(50),NRORD c(30),NRINMAT c(10),ASIGURATOR c(24),INSPECTOR c(24),UTIL_VALID c(30),FACTURAT n(1),TIP_COMANDA c(50)']
*!*	pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.validat,a.dataoravalid,a.manopera,a.materiale,a.nume,'+]+;
*!*		['a.nrord,a.nrinmat,a.asigurator,a.inspector,a.util_valid,a.facturat,tip_comanda from ] + gcS + [.dev_validare_comenzi a '+]+;
*!*		['where 1=2']
pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),DATAI d,VALIDAT n(1),DATAORAVALID t,MANOPERA n(20,4),MATERIALE n(20,4),'+]+;
	['NUME c(50),NRORD c(50),NRINMAT c(35),ASIGURATOR c(24),INSPECTOR c(24),NR_DOSAR c(40),UTIL_VALID c(30),'+]+;
	['FACTURAT n(1),ID_TIP N(5),TIP_COMANDA c(50),PROC_TVAV N(10,4), INCHIS_FORTAT N(1), DATAORAINCHIS T, UTIL_INCHIS C(30),' + ]+;
	['KMINT I, ORE_FUNCTIONARE I, SERIES V(100), CILINDREE I, PUTERECP I, PUTEREKW I']
pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.validat,a.dataoravalid,a.manopera,a.materiale,a.nume,'+]+;
	['a.nrord,a.nrinmat,a.asigurator,a.inspector,a.nr_dosar,a.util_valid,a.facturat,a.id_tip,a.tip_comanda,a.proc_tvav, '+]+;
	['a.inchis_fortat, a.dataorainchis, a.util_inchis, a.kmint, a.ore_functionare, a.series, a.cilindree, a.puterecp, a.puterekw '+]+;
	['from auto_validare_comenzi a '+]+;
	['where 1=2']
	
       
&&pcFiltru = [extract(month from a.datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.datafact) = ]+Alltrim(Str(gnAn))+
*!*	pcfiltru=[((extract(month from datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from datafact) =]+Alltrim(Str(gnAn)) +[) or (datafact is null ))]+pcFiltruOra
IF !EMPTY(pcFiltruora)
	pcfiltru = gcCondLuna +pcFiltruOra
ELSE
	pcfiltru = [1=2]
ENDIF
pcorder=[a.datai,a.nrord]
llAfiseaza=.F.
gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
pocomenzi.ca_baza1.afisare()
Select crscomenzi
ofrmvalidare=Createobject('frm_val_comenzi')
*!*	modificare	v 2.0.17
If !Empty(pcFiltruOra)
	With ofrmvalidare.ck_nrord
		.cValoare1 = pcValoare1
		.cValoare2 = pcValoare2
		.criteriu = pnCriteriu
		.criteriu2 = pnCriteriu2
		.cIntre = pcIntre
		.filtru = pcFiltruOra
		.filtru_vfp = pcFiltruVFP
		.Value = 1
	Endwith
Endif
*!*	modificare	v 2.0.17	^
ofrmvalidare.Show(1)
If Used('crscomenzi')
	Use In crscomenzi
Endif
Release pocomenzi
Endproc	&& validare_comenzi
*****************************************************************************************
Procedure vizualizare_comenzi
Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza
Store '' To pocomenzi
If Used('crscomenzi')
	Use In crscomenzi
Endif
pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),DATAI d,NUME c(50),NRORD c(50),NRINMAT c(35),VALIDAT n(1),ID_TIP N(5),TIP_COMANDA c(50),DATAORAVALID D,'+] +;
	['FACTURAT n(1),DATAFACT d,NRFACT N(14),PROC_TVAV N(10,4), ID_PART_REF N(20), PART_REF C(100), SERIES V(100), KMINT I, ORE_FUNCTIONARE I']

pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.nume,a.nrord,a.nrinmat,a.validat,a.id_tip,a.tip_comanda,a.dataoravalid,a.facturat,a.datafact,a.nrfact,a.proc_tvav, a.id_part_ref, a.part_ref, '+]+;
	[' a.series, a.kmint, a.ore_functionare '+] + ;
	[' from ] + gcS + [.auto_normare_comenzi a where 1=2']
*!*		[' from ] + gcS + [.dev_vvalid_comenzi a where 1=2']
*!*	pcfiltru=[luna=]+Alltrim(Str(gnLuna))+[ and an=]+Alltrim(Str(gnAn))
*!*	pcfiltru=[(extract(month from datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from datafact) =]+Alltrim(Str(gnAn))+[) or (datafact is null )]

pcfiltru = [1=2]  && gcCondLuna

pcorder=[a.datai,a.nrord]
llAfiseaza=.F.
gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
pocomenzi.ca_baza1.afisare()

ofrmviz=Createobject('frm_viz_comenzi')
ofrmviz.Show(1)
If Used('crscomenzi')
	Use In crscomenzi
Endif
Release pocomenzi
Endproc	&& vizualizare_comenzi
*****************************************************************************************
*******************************************
* PROCEDURE viz_optiuni(  )
* Data/ora : 02/10/05, 15:46:17
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure viz_optiuni(  )
Private lcCuloare,pcDev_p411,pcDEV_s411,pcDev_nr411,pcDev_poz411,pcDev_p704,pcDEV_s704,pcDev_nr704,pcDev_poz704
pcDev_p411 = gcDev_p411
pcDEV_s411 = gcDEV_s411
pcDev_nr411 = gcDev_nr411
pcDev_poz411 = gcDev_poz411

pcDev_p704 = gcDev_p704
pcDEV_s704 = gcDEV_s704
pcDev_nr704 = gcDev_nr704
pcDev_poz704 = gcDev_poz704

*!*	STORE gcCuloare_fundal TO lcCuloare
oopt = Createobject('optiuni_frm')
oopt.Show(1)
*!*	DEBUG
*!*	SUSPEND

If pcDev_p411 # gcDev_p411
	lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDEV_Sp411) + [' where varname =] + ['DEV_P411']
	lnSucces = goExecutor.oExecute(lcSql)
	If lnSucces < 0
		amessagebox(goExecutor.cEroare,0+16,"Eroare")
		Return
	Endif
Endif
If pcDEV_s411 # gcDEV_s411
	lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDEV_s411) + [' where varname =] + [ 'DEV_S411']
	lnSucces = goExecutor.oExecute(lcSql)
	If lnSucces < 0
		amessagebox(goExecutor.cEroare,0+16,"Eroare")
		Return
	Endif
Endif

If pcDev_poz411 # gcDev_poz411
	lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_poz411) + [' where varname =] + [ 'DEV_POZ411']
	lnSucces = goExecutor.oExecute(lcSql)
	If lnSucces < 0
		amessagebox(goExecutor.cEroare,0+16,"Eroare")
		Return
	Endif
Endif
If pcDev_nr411 # gcDev_nr411
	lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_nr411) + [' where varname =] + [ 'DEV_NR411']
	lnSucces = goExecutor.oExecute(lcSql)
	If lnSucces < 0
		amessagebox(goExecutor.cEroare,0+16,"Eroare")
		Return
	Endif
Endif



*------------------
If pcDev_p704 # gcDev_p704
	lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_p704) + [' where varname =] + ['DEV_P704']
	lnSucces = goExecutor.oExecute(lcSql)
	If lnSucces < 0
		amessagebox(goExecutor.cEroare,0+16,"Eroare")
		Return
	Endif
Endif
If pcDEV_s704 # gcDEV_s704
	lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDEV_s704) + [' where varname =] + [ 'DEV_S704']
	lnSucces = goExecutor.oExecute(lcSql)
	If lnSucces < 0
		amessagebox(goExecutor.cEroare,0+16,"Eroare")
		Return
	Endif
Endif

If pcDev_poz704 # gcDev_poz704
	lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_poz704) + [' where varname =] + [ 'DEV_POZ704']
	lnSucces = goExecutor.oExecute(lcSql)
	If lnSucces < 0
		amessagebox(goExecutor.cEroare,0+16,"Eroare")
		Return
	Endif
Endif
If pcDev_nr704 # gcDev_nr704
	lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_nr704) + [' where varname =] + [ 'DEV_NR704']
	lnSucces = goExecutor.oExecute(lcSql)
	If lnSucces < 0
		amessagebox(goExecutor.cEroare,0+16,"Eroare")
		Return
	Endif
Endif
*!*	pcDev_p704 = gcDev_p704
*!*	pcDEV_s704 = gcDEV_s704
*!*	pcDev_nr704 = gcDev_nr704
*!*	pcDev_poz704 = gcDev_poz704





*!*	*----------optiuni analitice pt 704

*!*	IF !EMPTY(gcDEV_P704)
*!*		lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + ALLTRIM(gcDEV_P704) + [' where varname =] + ['DEV_P704']
*!*	ELSE
*!*		lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + [' where varname =] + ['DEV_P704']
*!*	ENDIF
*!*	lnSucces = goExecutor.oExecute(lcSql)
*!*	If lnSucces < 0
*!*		amessagebox(goExecutor.cEroare,0+16,"Eroare")
*!*		Return
*!*	ENDIF
*!*	IF EMPTY(gcDEV_S704)
*!*		lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + [' where varname =]+[ 'DEV_S704']
*!*	ELSE
*!*		lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + ALLTRIM(gcDEV_S704) + [' where varname =] + [ 'DEV_S704']
*!*	ENDIF
*!*	lnSucces = goExecutor.oExecute(lcSql)
*!*	If lnSucces < 0
*!*		amessagebox(goExecutor.cEroare,0+16,"Eroare")
*!*		Return
*!*	ENDIF

*!*	IF EMPTY(gcDEV_POZ704)
*!*		lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + [' where varname =]+[ 'DEV_POZ704']
*!*	ELSE
*!*		lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + ALLTRIM(gcDEV_POZ704) + [' where varname =] + [ 'DEV_POZ704']
*!*	ENDIF
*!*	lnSucces = goExecutor.oExecute(lcSql)
*!*	If lnSucces < 0
*!*		amessagebox(goExecutor.cEroare,0+16,"Eroare")
*!*		Return
*!*	ENDIF

*!*	IF EMPTY(gcDEV_NR704)
*!*		lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + [' where varname =]+[ 'DEV_NR704']
*!*	ELSE
*!*		lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + ALLTRIM(gcDEV_NR704) + [' where varname =] + [ 'DEV_NR704']
*!*	ENDIF
*!*	lnSucces = goExecutor.oExecute(lcSql)
*!*	If lnSucces < 0
*!*		amessagebox(goExecutor.cEroare,0+16,"Eroare")
*!*		Return
*!*	ENDIF

*!*	IF gcCuloare_fundal # lcCuloare
*!*	ENDIF

Endproc

**********************sfarsit procedura viz_optiuni*******************
**********************inceput procedura viz_stocuri*******************
Procedure viz_stocuri
*!*	
tcTipGest=[]
tnTipGest=0
*!*	
LOCAL lnTipGest, lcFiltruInitial,lcTipGest, lcFiltruPermis
lcFiltruTipGest = ""
lcFiltruPermis = ""
lnTipGest = tnTipGest
lcTipGest = ""
IF EMPTY(tcTipGest)
	lcTipGest = []
ELSE
	lcTipGest = tcTipGest
ENDIF

lcFiltruInitial = [a.an=]+ Alltrim(Str(gnAn))+[ and a.luna=]+ Alltrim(Str(gnLuna))+;
	STRTRAN(gcCondSucursala,[id_sucursala],[a.id_sucursala])
IF !EMPTY(lnTipGest)
	lcFiltruTipGest = [ and a.nr_pag = ] + ALLTRIM(STR(lnTipGest))
ENDIF

IF EMPTY(gcGestPermis)
	lcFiltruPermis = [ and 1=2] 
else	
	lcFiltruPermis = [ and a.id_gestiune in (] + gcGestPermis + [)]
EndIf

lcFiltruInitial = lcFiltruInitial + lcFiltruTipGest + lcFiltruPermis

LOCAL lnStocObinv
lnStocObinv = 0
DO INAINTE_DE_STOC WITH gnAn, gnLuna, lnTipGest, lnStocObinv in oinainte_de.prg

PRIVATE postocuri,pcschema,pcselect,pcfiltru,pcorder
STORE '' TO postocuri

pcschema=['nr_crt n(6),id_stoc n(20),an n(4),luna n(2),id_articol n(10),serie c(100),pret n(16,4),pretv n(16,4),'+]+;
	['tva n(16,4),tvav n(16,4),cants n(14,3),cant n(14,3),cante n(14,3),cont c(4),'+]+;
	['acont c(4),pretd n(16,4),dataora d,datain d,dataout d,proc_tvav n(5,2),'+]+;
	['id_gestiune n(5),codmat c(50),denumire c(100),um c(6),nr_pag n(2),nume_gestiune c(50),'+]+;
	['cgest c(20),um2 c(10),cant_bax n(9,4),grupa c(100),subgrupa c(100),id_valuta n(10), nume_val c(4),'+]+;
	['codmatf c(50), lot c(50), adata_expirare T,id_sucursala N(5),sucursala C(100),'+]+;
	['id_lucrare_rez N(10),nrord_rez C(50),id_part_rez N(10),part_rez C(100)']
pcselect=['select row_number() over (order by a.denumire) as nr_crt,a.id_stoc,a.an,a.luna,a.id_articol,a.serie,'+]+;
	['a.pret,a.pretv,a.tva,a.tvav,a.cants,a.cant,a.cante,a.cont,a.acont,a.pretd,a.dataora,'+]+;
	['a.datain,a.dataout,a.proc_tvav,'+]+;
	['a.id_gestiune,a.codmat,a.denumire,a.um,a.nr_pag,a.nume_gestiune,a.cgest,a.um2,a.cant_bax,a.grupa,a.subgrupa, a.id_valuta, a.nume_val, a.codmatf, a.lot, a.adata_expirare,'+]+;
	['a.id_sucursala,a.sucursala,'+]+;
	['a.id_lucrare_rez,a.nrord_rez,a.id_part_rez,a.part_rez '+]+;
	['from vstoc a where 1=2']
pcfiltru = [1=2]
pcorder=[1]
llAfiseaza=.F.
_SCREEN.MOUSEPOINTER= 11
gencursor('postocuri','crsStocuri',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
postocuri.ca_baza1.afisare()

LOCAL loStocuri
loStocuri=CREATEOBJECT('frm_stocuri')
_SCREEN.MOUSEPOINTER= 0
loStocuri.ntipgest = lnTipGest
PRIVATE pcListTipGest
pcListTipGest = []
lnOptgrValue = IIF(loStocuri.ntipgest<>0,IIF(loStocuri.ntipgest=6,2,IIF(loStocuri.ntipgest=7,4,1)),3)
WITH loStocuri
	.Lb_titlu_alb_b121.CAPTION = [STOCURI] + IIF(!EMPTY(lcTipGest),[ / ] + lcTipGest,[])
	.cFiltruInitial = lcFiltruInitial
	.optgrup.VALUE = lnOptgrValue
	*!*	modificare	v 2.0.5
	.but_verifica1.visible = .F.
	*!*	modificare	v 2.0.5	^
	IF lnOptgrValue = 1
		.optgrup.option2.VISIBLE = .F.
		.optgrup.option3.VISIBLE = .F.
		.optgrup.option4.VISIBLE = .F.
	ENDIF
	IF lnOptgrValue = 2
		.optgrup.option1.VISIBLE = .F.
		.optgrup.option3.VISIBLE = .F.
		.optgrup.option4.VISIBLE = .F.
	ENDIF
	IF lnOptgrValue = 4
		.optgrup.option1.VISIBLE = .F.
		.optgrup.option2.VISIBLE = .F.
		.optgrup.option3.VISIBLE = .F.
	ENDIF	
	.optgrup.ENABLED = IIF(.ntipgest<>0,.F.,.T.)
	IF .But_modifica1.VISIBLE
		.But_modifica1.VISIBLE = IIF(.ntipgest<>0,.T.,.F.)
	ENDIF
ENDWITH
loStocuri.SHOW(1)
RELEASE postocuri

ENDPROC && viz_stocuri
******************************************************************************
PROCEDURE export_cursor_excel
PARAMETERS tcAlias,tcListaCampuri,tcAliasCampuri

ENDPROC	&&	export_cursor_excel
**********************sfarsit procedura export_cursor_excel*******************
