*******************************************
* PROCEDURE update_mecanici(  )
* Data/ora : 12/16/04, 13:01:32
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_mecanici(  )
If Used('v_mecanici')
	Use In v_mecanici
Endif

lcSql = [select * from ] + gcS + [.auto_vmecanici order by nume]
lcCursor = [v_mecanici]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces

Endproc

**********************sfarsit procedura update_mecanici*******************

*******************************************
* PROCEDURE caut_personal_devize(  )
*******************************************
Procedure caut_personal_devize(  )
Local loCauta,llReturn
Store "" To loCauta
Store .F. To llReturn
pcselect = ["select id_salariat,id_part,nume,prenume,marca from ] + gcS + [.auto_vnom_salariati where inactiv = 0"]
pcfiltru = [1=2]
pcschema = ['']
pcorder = [2]
pccoloane = [nume,prenume,marca]
pcTitlu = [Alegeži mecanicul]
pcTitluColoane = [Nume,Prenume,Marca]
loCauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"")
Return loCauta
Endproc

**********************sfarsit procedura caut_personal_devize *******************

*******************************************
* PROCEDURE caut_norme(  )
*******************************************
Procedure caut_norme(  )
Local loCauta,llReturn
Store "" To loCauta
Store .F. To llReturn
pcselect = ["select id_norme,denop from ] + gcS + [.auto_vnorme where inactiv = 0"]
pcfiltru = [1=2]
pcschema = ['']
pcorder = [2]
pccoloane = [denop]
pcTitlu = [Alegeži operažia]
pcTitluColoane = [Denumire]
loCauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"")
Return loCauta
Endproc

**********************sfarsit procedura caut_norme *******************
*******************************************
* PROCEDURE update_sectie(  )
* Data/ora : 12/16/04, 14:26:22
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_sectie(  )
If Used('v_sectie')
	Use In v_sectie
Endif

lcSql = [select * from ] + gcS + [.vnom_sectii order by sectie]&& where inactiv = 0]
lcCursor = [v_sectie]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces

Endproc

**********************sfarsit procedura update_sectie*******************

*******************************************
* PROCEDURE update_clienti(  )
* Data/ora : 12/20/04, 09:58:55
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_clienti(  )
LPARAMETERS tnid_partener
LOCAL lcFiltru
IF !EMPTY(tnid_partener)
	lcFiltru = [ and p.id_part=]+ALLTRIM(STR(tnid_partener))
ELSE
	lcFiltru = []
ENDIF
If Used('v_clienti')
	Use In v_clienti
Endif

*!*	lcSql=[select p.nume,p.cod_fiscal,p.id_part from ] + gcS + [.vnom_parteneri p order by p.nume]
lcSql = [select distinct p.nume, p.cod_fiscal, p.id_part FROM ] + gcS + [.vcoresp_tip_part p ] + ;
		[join ] + gcS + [.vcoresp_tip_cont c on p.id_tip_part=c.id_tip_part where c.cont ='4111' ] + ;
		[and p.inactiv=0 ]+lcFiltru+[ order by p.nume ]
*!*	lcSql = [select distinct p.nume, p.cod_fiscal, p.id_part FROM ] + gcS + [.Vcoresp_tip_part p ] + ;
*!*		[ join ]+gcS+[.vcoresp_tip_cont c on p.id_tip_part=c.id_tip_part where c.cont = 411 order by nume]
lcCursor = 'v_clienti'
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()
Return lnSucces


Endproc

**********************sfarsit procedura update_clienti*******************
*******************************************
* PROCEDURE update_masini(  )
* Data/ora : 12/21/04, 10:33:10
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_masini(  )
If Used('v_masini')
	Use In v_masini
Endif

lcSql = [select id_masina,id_marca,nvl(masina,lpad(CHR(32),100,CHR(32))) as masina,sctip,clasa,] + ;
	[nvl(marca,lpad(CHR(32),100,CHR(32))) as marca from ] + gcS + [.auto_vmasini where inactiv = 0 order by 3]
lcCursor = [v_masini]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces
Endproc

**********************sfarsit procedura update_masini*******************
*******************************************
* PROCEDURE update_ansamble(  )
* Data/ora : 12/21/04, 10:34:31
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_ansamble(  )
If Used('v_ansamble')
	Use In v_ansamble
Endif

lcSql = [select * from ] + gcS + [.auto_vansamble where inactiv=0 order by denumire]
lcCursor = [v_ansamble]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces

Endproc

**********************sfarsit procedura update_ansamble*******************

*******************************************
* PROCEDURE update_marci(  )
* Data/ora : 12/21/04, 16:05:00
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_marci(  )
If Used('v_marci')
	Use In v_marci
Endif

lcSql = [select * from ] + gcS + [.auto_vmarci order by marca]
lcCursor = [v_marci]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces

Endproc

**********************sfarsit procedura update_marci*******************
*******************************************
* PROCEDURE update_asigurator(  )
* Data/ora : 12/21/04, 16:08:00
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_asigurator(  )
If Used('v_asiguratori')
	Use In v_asiguratori
Endif

lcSql = [select * from ] + gcS + [.auto_vasiguratori where inactiv = 0 order by asigurator]
lcCursor = [v_asiguratori]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces
Endproc

**********************sfarsit procedura update_asigurator*******************

*******************************************
* PROCEDURE update_inspector(  )
* Data/ora : 01/06/05, 10:42:26
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_inspector(  )
If Used('v_inspectori')
	Use In v_inspectori
Endif

lcSql = [select * from ] + gcS + [.auto_vinspectori where inactiv = 0 order by inspector]
lcCursor = [v_inspectori]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces

Endproc

**********************sfarsit procedura update_inspectori*******************

*******************************************
* PROCEDURE update_furnizori(  )
* Data/ora : 01/03/05, 15:36:04
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_furnizori(  )
If Used('v_dealeri')
	Use In v_dealeri
Endif

lcSql = [select id_furnizor,denumire as furnizor,inactiv from ] + gcS + [.auto_vfurnizori order by denumire]
lcCursor = [v_dealeri]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces

Endproc

**********************sfarsit procedura update_furnizori*******************

*******************************************
* PROCEDURE update_preturi(  )
* Data/ora : 01/12/05, 16:36:27
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_preturi(  )
If Used('v_preturi')
	Use In v_preturi
Endif

lcSql = [select * from ] + gcS + [.auto_vpreturi where inactiv=0]
lcCursor = [v_preturi]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces
Endproc

**********************sfarsit procedura update_preturi*******************

*******************************************
* PROCEDURE update_norme(  )
* Data/ora : 01/12/05, 16:40:41
* autor : liana.macinic
* descriere:

****** PARAMETER BLOCK **************
* Parametri : 0
*
*******************************************
Procedure update_norme
LPARAMETERS tcFiltru
LOCAL lcFiltru
IF EMPTY(tcFiltru)
	lcFiltru = [where inactiv=0]
ELSE
	lcFiltru = [where inactiv=0 and ] + tcFiltru
ENDIF

If Used('v_norme')
	Use In v_norme
Endif

lcSql = [select auto_vnorme.*,0 as ales,9999 as ordine from ] + gcS + [.auto_vnorme ] + lcFiltru + [ order by denop,masina]
lcCursor = [v_norme]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
goExecutor.oReset()

Return lnSucces
Endproc

**********************sfarsit procedura update_norme*******************


*******************************************
* PROCEDURE update_optiuni_util(  )
* Data/ora : 02/11/05, 11:07:19
* autor : liana.macinic
* descriere: 

****** PARAMETER BLOCK **************
* Parametri : 0
* 
*******************************************
PROCEDURE update_optiuni_util(  )
	IF USED('v_optiuni_util')
		USE IN v_optiuni_util
	ENDIF

	lcSql='select * from optiuni_util where id_util = '+ALLTRIM(STR(gnIdUtil)) + [ or id_util = 0  order by varname]
	lcCursor = 'v_optiuni_util'

	lnSucces = goExecutor.oExecute(lcSql,lcCursor)
*!*		AMESSAGEBOX('v_optiuni_util')
	RETURN lnSucces
	
ENDPROC

**********************sfarsit procedura update_optiuni_util*******************
***********************************************************************

PROCEDURE ccsectii

	IF USED('v_nom_sectii')
		USE IN v_nom_sectii
	ENDIF
	
	lcSql='select id_sectie,sectie from '+gcS+'.vnom_sectii order by sectie'
	lcCursor = 'v_nom_sectii'

	lnSucces = goExecutor.oExecute(lcSql,lcCursor)
	RETURN lnSucces

ENDPROC
***********************************************************************
Procedure ccnorme
Lparameters tctip,tnid
Local lcFiltru

If Used('v_denop')
	Use In v_denop
Endif
Do Case
Case Empty(tctip)
	lcFiltru = [ where inactiv=0 ]
Case tctip='NORMA'
	lcFiltru=[ where id_norme = ] + Alltrim(Str(tnid))
Case tctip='MASINA'
	lcFiltru=[ where id_masina = ] + Alltrim(Str(tnid)) + [ and inactiv=0 ]
Endcase
lcSql='select id_norme,denop,timpn from '+gcS+'.auto_vnorme '+;
	lcFiltru+' order by denop'
lcCursor = 'v_denop'

lnSucces = goExecutor.oExecute(lcSql,lcCursor)
Return lnSucces

Endproc
***********************************************************************
Procedure ccmecanici
If Used('v_mecanici')
	Use In v_mecanici
Endif

lcSql='select id_mecanic,TRIM(nume)||CHR(32)||TRIM(prenume) as nume from auto_vmecanici where inactiv=0 order by nume'
lcCursor = 'v_mecanici'

lnSucces = goExecutor.oExecute(lcSql,lcCursor)
Return lnSucces

Endproc
***********************************************************************
PROCEDURE cctipuri_deviz
IF USED('crstipuri_deviz')
	USE IN crstipuri_deviz
ENDIF
	
lcSql='select id_tip,denumire,inch_validare from dev_tip_deviz where sters=0 order by denumire'
lcCursor = 'crstipuri_deviz'
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
RETURN lnSucces

ENDPROC
***********************************************************************
Function cauta_utilizator
Lparameters	tnIdUtil,tcUtilizator
Local locauta,llReturn
Store "" To locauta
Store .F. To llReturn
pcselect = ["select id_util,utilizator from syn_vutilizatori"]
pcfiltru = [1=2]
pcschema = ['']
pcorder = [utilizator]
pccoloane = [Utilizator]
pcTitlu = [Alegeži utilizatorul]
pcTitluColoane = [Utilizator]
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"")
If !Empty(locauta.id_util)
	tnIdUtil=locauta.id_util
	tcUtilizator=Alltrim(locauta.utilizator)
	llReturn=.T.
Endif
Return llReturn
Endfunc	&&	cauta_utilizator
***********************************************************************
FUNCTION cauta_client
Lparameters	tnIdPartener,tcNume
Local locauta,llReturn
Store "" To locauta
Store .F. To llReturn
pcselect = ["select p.id_part,p.nume,p.cod_fiscal from ]+gcS+[.vcoresp_tip_part p "+] + ;
		["join ] + gcS + [.vcoresp_tip_cont c on p.id_tip_part=c.id_tip_part "+]+;
		["where c.cont ='4111' and p.inactiv=0"]
pcfiltru = [1=2]
pcschema = ['id_part n(10),nume c(100),cod_fiscal c(100)']
pcorder = [nume]
pccoloane = [nume,cod_fiscal]
pcTitlu = [Alegeži clientul]
pcTitluColoane = [Client,Cod fiscal]
locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"")
If !Empty(locauta.id_part)
	tnIdPartener=locauta.id_part
	tcNume=Alltrim(locauta.nume)
	llReturn=.T.
Endif
Return llReturn
ENDFUNC
***********************************************************************

PROCEDURE ccarticole
LPARAMETERS tcFiltru
If Used('v_articole')
	Use In v_articole
Endif

lcSql = [select * from ] + gcS + [.vnom_articole where inactiv = 0 ] + IIF(!EMPTY(tcFiltru),[ and ] + tcFiltru,[])+ [ order by denumire ]
lcCursor = [v_articole]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)

Return lnSucces
Endproc
***********************************************************************

Procedure ccnorme_devest
LPARAMETERS tcFiltru
If Used('v_norme')
	Use In v_norme
Endif

lcSql='select * from '+gcS+'.auto_vnorme where inactiv = 0 ' + IIF(!EMPTY(tcFiltru),' and ' + tcFiltru,'')+ ' order by denop'
lcCursor = 'v_norme'

lnSucces = goExecutor.oExecute(lcSql,lcCursor)
Return lnSucces

ENDPROC
***********************************************************************

