*******************************************
* PROCEDURE inchidprog(  )
* Date : 05/23/05, 11:32:30
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE inchidprog(  )

RETURN 

ENDPROC
*----------------------------------sfarsit procedura inchidprog----------------------------------

*___________________________________________
Procedure nrord
Parameters ALI
Sele &ALI
A=Reccount()
If A=0
	Return
Endif
If A>65000
	Return 0
Endif
Declare NROR(A)
K=0
Scan
	K=K+1
	NROR(K)=Recno()
Endscan
Return

Function NRCRT
NR=Ascan(NROR,Recno())
Return NR
**********************
*_____________________________________-
PROCEDURE IESIRE

QUIT
RETURN
*___________________________________________
Procedure mesaj
Parameters m1,m2
ot=Create('text')
ot.label2.Caption=m1
ot.label3.Caption=m2
ot.Show(1)
Return
*___________________________________________
Procedure danu
Parameters m1
od=Create('danu')
od.label1.Caption=m1
od.Show(1)
RETURN

*_________________________________________________________
PROCEDURE caut_alfa_cursor
PARAMETERS NUMEBAZA,NUMECIMP,CAPTEXT,VARMEM
LOCAL MC0,MC1,MC2, llVizibil
SET SAFETY OFF
llVizibil = .t.

MC0='SELE '+NUMEBAZA
MC1='VARMEM=M.'+NUMECIMP
*MC2='SET order TO TAG '+NUMECIMP
MC2 = [INDEX ON ] +NUMECIMP+ [ TAG nume OF &loc\&nfscurt\tempo\xindex.idx COMPACT ASCENDING ] 


*!*	&MC0
*!*	&MC2
*!*	GO TOP

LOCAL lcNumeCol2
STORE '' TO lcNumeCol2

LcCol = ALLTRIM(NUMEBAZA) + '.cod_fiscal'
IF TYPE(LcCol) # 'U'
	lcNumeCol2 = 'cod_fiscal'
ENDIF 

LcCol = ALLTRIM(NUMEBAZA) + '.gest'
IF TYPE(LcCol) # 'U'
	lcNumeCol2 = 'gest'
ENDIF 

LcCol = ALLTRIM(NUMEBAZA) + '.id_sectie'
IF TYPE(LcCol) # 'U'
	lcNumeCol2 = 'id_sectie'
ENDIF 

IF EMPTY(lcNumeCol2)
	lcNumeCol2 = 'space(4)'
	llVizibil = .f.
ENDIF 	

LcCol = ALLTRIM(NUMEBAZA) + '.id'
IF TYPE(LcCol) # 'U'
	lcNumeCol3 = 'id'
ELSE 
	lcNumeCol3 = 'space(4)'
ENDIF 

SELECT DISTINCT &NUMECIMP, &lcNumeCol2, &lcNumeCol3 FROM (numebaza) INTO CURSOR tnomenclator READWRITE ORDER BY &NUMECIMP

OCA=CREATEOBJECT("CAUTALFa")
OCA.CAPTION=CAPTEXT
OCA.GRID1.RECORDSOURCE='tnomenclator'
OCA.GRID1.COLUMN1.CONTROLSOURCE = NUMECIMP
OCA.GRID1.COLUMN2.CONTROLSOURCE = lcNumeCol2 
OCA.GRID1.COLUMN2.visible = llVizibil
OCA.cmdrenunt1.visible=.t.
OCA.command1.visible=.f.
OCA.command2.visible=.f.
OCA.command3.visible=.f.
OCA.SHOW(1)

*!*	&MC0
*!*	SCATTER MEMVAR
*!*	SET FILTER TO 

IF buton=2
	USE IN tnomenclator 
	RETURN
ENDIF 

lcFile = ADDBS(gcTempPath) + 'xindex.idx'
IF FILE(lcFile)
	SET INDEX TO 
	DELETE FILE &lcFile
ENDIF 
*!*	&MC1

SELECT tnomenclator
SCATTER MEMVAR 

&MC1


USE IN tnomenclator 
RETURN

*_________________________________________________________
Procedure CAUT_ALF
Parameters NUMEBAZA,NUMECIMP,CAPTEXT,VARMEM
Local MC0,MC1,MC2
Set Safety Off
MC0='SELE '+NUMEBAZA
MC1='VARMEM=M.'+NUMECIMP
MC2='SET order TO TAG '+NUMECIMP

&MC0
Go Top
If Eof()
	Appe Blank
Endif
&MC2
OCA=Createobject("CAUTALF")
OCA.Caption=CAPTEXT
OCA.GRID1.RecordSource=NUMEBAZA
OCA.GRID1.COLUMN1.ControlSource=NUMECIMP
OCA.Show(1)

Scatter Memvar
&MC1

Return


*_________________________________________________________


*******************************************
* PROCEDURE introd_respsal(  )
* Date : 05/23/05, 12:27:24
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE introd_respsal(  )

Private poresp,pcschema1,pcselect1
Store '' To poresp
If Used('v_resp')
	Use In v_resp
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_responsabil where 1=2']
pcorder1=[nume,prenume]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('poresp','v_resp',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
poresp.ca_baza1.afisare()
ofrmresp=Createobject('frm_resp_sal')
ofrmresp.Show(1)
Release poresp

ENDPROC
*----------------------------------sfarsit procedura introd_respsal----------------------------------

*******************************************
* PROCEDURE zile_lucr(  )
* Date : 05/23/05, 15:30:38
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE zile_lucr(  )

*----------- sarbatori
Private posarbat,pcschema1,pcselect1
Store '' To posarbat
If Used('v_sarbat')
	Use In v_sarbat
Endif
pcschema1=['data d,sarbatoare c(50),id_sarbat n(10)']
pcselect1=[select data,sarbatoare,id_sarbat from ] + gcS + [.sal_nom_sarbatori where sters = 0]
pcorder1=[data]
*!*	modificare	v 2.0.5
*!*	pcfiltru1 = [extract(year from data) = ] + ALLTRIM(STR(gnAN)) + [ and sters = 0]
IF gnLuna = 12
	pcfiltru1 = [extract(year from data) between ] + ALLTRIM(STR(gnAN)) + [ and ] + ALLTRIM(STR(gnAN+1)) + [ and sters = 0]
ELSE
	pcfiltru1 = [extract(year from data) = ] + ALLTRIM(STR(gnAN)) + [ and sters = 0]
ENDIF
*!*	modificare	v 2.0.5	^
llAfiseaza = .F.
gencursor('posarbat','v_sarbat',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
posarbat.ca_baza1.afisare()
SELECT v_sarbat


*----------- zile lucratoare
Private pozile,pcschema2,pcselect2
Store '' To pozile
If Used('v_zile')
	Use In v_zile
Endif
pcschema2=['']
pcselect2=[select * from ] + gcS + [.sal_calendar where 1=2]
pcorder2=[luna,an]
*!*	pcfiltru2 = [ 2 = 2 ]
pcfiltru2 = [ luna = ] + ALLTRIM(STR(gnLuna)) + [ and an = ]+ALLTRIM(STR(gnAn))

llAfiseaza = .F.
gencursor('pozile','v_zile',pcselect2,pcfiltru2,pcschema2,pcorder2,llAfiseaza)
pozile.ca_baza1.afisare()
SELECT v_sarbat

*--------------
PRIVATE pnIdSal,pnZileluc,pnOreluc,pnOrestas,pnORESUPLUNA
STORE 0 TO pnIdSal,pnZileluc,pnOreluc,pnOrestas,pnORESUPLUNA

pnIdSal = v_zile.id_Calendar
pnZileluc = v_zile.zileluc
pnOreluc = v_zile.oreluc
pnOrestas = v_zile.orestas
pnORESUPLUNA = v_zile.ORESUPLUNA

ofrmform=Createobject('frm_zileluc')
ofrmform.Show(1)

IF gnButon == 1
		lcSql = [update ] + gcS +[.sal_calendar set zileluc = ] + ALLTRIM(STR(NVL(pnZileluc,0))) + [,] +;
				[ oreluc = ] + ALLTRIM(STR(NVL(pnOreluc,0))) +;
				[,orestas = ] + ALLTRIM(STR(NVL(pnOrestas,0))) +;
				[,ORESUPLUNA = ] + ALLTRIM(STR(NVL(pnORESUPLUNA,0))) +;
				 [where id_calendar = ] + ALLTRIM(STR(NVL(pnIdSal,0)))

	lnSucces = goExecutor.oExecute(lcSql)
	IF lnSucces < 0
		MESSAGEBOX(goExecutor.cEroare,0 +16,'Eroare')
	ENDIF 
	goExecutor.oReset()

	RETURN lnSucces
ENDIF 
Release posarbat,ofrmform


ENDPROC
*----------------------------------sfarsit procedura zile_lucr----------------------------------

*******************************************
* PROCEDURE nom_formatii(  )
* Date : 05/26/05, 16:37:20
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_formatii(  )
Private poformatii,pcschema1,pcselect1
Store '' To poformatii
If Used('v_formatii')
	Use In v_formatii
Endif
*!*	DEBUG
*!*	SUSPEND 
pcschema1=['']
*!*	pcselect1=[select f.*,s.SECTIE,t.TRANSA from ] + gcS +;
*!*	 [.sal_nom_formatii f left join ]+gcS;
*!*	 +[.vnom_sectii s on f.id_sectie = s.ID_SECTIE ]+;
*!*		[ left join ]+gcS+[.sal_vnom_transe t on f.id_sectie = t.ID_TRANSA where 1=2]
IF gnSAL_SPECIAL = 4 AND gnIdProgram = 9
pcselect1=[select f.*,S.SECTIE,T.TRANSA,semn.denumire as semnatura,semn.directie from ] + gcS + [.sal_nom_locmunca f ] + ;
	[ LEFT JOIN ] + GCS + [.VNOM_SECTII S ON F.ID_SECTIE = S.ID_SECTIE ] +;
	[ LEFT JOIN ] + GCS + [.SAL_VNOM_TRANSE T ON F.ID_TRANSA = T.ID_TRANSA ]+;
	[left join sal_semnaturi semn on f.id_semnatura = semn.id_semnatura ]+;
	[ where 1=2]
ELSE 
pcselect1=[select f.*,S.SECTIE,T.TRANSA,semn.denumire as semnatura,semn.directie from ] + gcS + [.sal_nom_formatii f ] + ;
	[ LEFT JOIN ] + GCS + [.VNOM_SECTII S ON F.ID_SECTIE = S.ID_SECTIE ] +;
	[ LEFT JOIN ] + GCS + [.SAL_VNOM_TRANSE T ON F.ID_TRANSA = T.ID_TRANSA ]+;
	[left join sal_semnaturi semn on f.id_semnatura = semn.id_semnatura ]+;
	[ where 1=2]
ENDIF 
pcorder1=[ordine]
pcfiltru1 = [f.sters = 0]
llAfiseaza = .F.
gencursor('poformatii','v_formatii',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
poformatii.ca_baza1.afisare()
SELECT V_FORMATII
ofrmform=Createobject('frm_formatii')
ofrmform.Show(1)
Release poformatii

ENDPROC
*----------------------------------sfarsit procedura nom_formatii----------------------------------

*******************************************
* PROCEDURE nom_meserii(  )
* Date : 05/23/05, 12:27:24
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
Procedure nom_meserii(  )

	Private poresp,pcschema1,pcselect1
	Local lnDiferente,lcCursor
	Store '' To poresp
	lcCursor = [crsTemp]
	If Used('v_meserii')
		Use In v_meserii
	Endif

	lcSql = [select pack_def_salarii.verifica_versiune_cor() as dif from dual]
	If goExecutor.oExecuta(lcSql,lcCursor)
		Select (lcCursor)
		lnDiferente = Dif
		Use In (Select(lcCursor))

		pcschema1=['']
		pcselect1=['select * from ] + gcS + [.sal_nom_mes where 1=2']
		pcorder1=[meserie]
		pcfiltru1 = [sters = 0]
		llAfiseaza = .F.
		gencursor('poresp','v_meserii',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
		poresp.ca_baza1.afisare()
		ofrmresp=Createobject('frm_meserii',lnDiferente)
		ofrmresp.Show(1)
		Release poresp
	Endif

Endproc
*----------------------------------sfarsit procedura nom_meserii----------------------------------


*******************************************
* PROCEDURE nom_transe(  )
* Date : 05/23/05, 12:27:24
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_transe(  )

Private potransa,pcschema1,pcselect1
Store '' To potransa
If Used('v_transe')
	Use In v_transe
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_nom_transe where 1=2']
pcorder1=[transa]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('potransa','v_transe',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
potransa.ca_baza1.afisare()
ofrmresp=Createobject('frm_transe')
ofrmresp.Show(1)
Release potransa

ENDPROC
*----------------------------------sfarsit procedura nom_transe----------------------------------
*******************************************
* PROCEDURE nom_clasesal(  )
* Date : 05/23/05, 12:27:24
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_clasesal(  )

Private poclasesal,pcschema1,pcselect1
Store '' To poclasesal
If Used('v_clasesal')
	Use In v_clasesal
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_nom_clasesal where 1=2']
pcorder1=[tarifar]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('poclasesal','v_clasesal',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
poclasesal.ca_baza1.afisare()
ofrmresp=Createobject('frm_clasesal')
ofrmresp.Show(1)
Release poclasesal

ENDPROC
*----------------------------------sfarsit procedura nom_clasesal----------------------------------

*******************************************
* PROCEDURE nom_tipctr(  )
* Date : 05/23/05, 12:27:24
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_tipctr

Private potipctr,pcschema1,pcselect1
Store '' To potipctr
If Used('v_tipctr')
	Use In v_tipctr
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vnom_tipctr where 1=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('potipctr','v_tipctr',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
potipctr.ca_baza1.afisare()
ofrmresp=Createobject('frm_tipctr')
ofrmresp.Show(1)
Release poclasesal

ENDPROC 

*******************************************
* PROCEDURE nom_sporuri(  )
* Date : 06/17/05, 09:04:27
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
*!*	modificare ROASAL v 2.0.0
*!*	PROCEDURE nom_sporuri(  )
*!*	Private ponomspor,pcschema1,pcselect1
*!*	Store '' To ponomspor
*!*	If Used('v_nomspor')
*!*		Use In v_nomspor
*!*	Endif
*!*	pcschema1=['']
*!*	pcselect1=['select * from ] + gcS + [.sal_vnom_sporuri where 1=2']
*!*	pcorder1=[]
*!*	pcfiltru1 = [sters = 0]
*!*	llAfiseaza = .F.
*!*	gencursor('ponomspor','v_nomspor',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
*!*	ponomspor.ca_baza1.afisare()
*!*	ofrmresp=Createobject('frm_nomspor')
*!*	ofrmresp.Show(1)
*!*	Release poclasesal
*!*	ENDPROC
*!*	modificare ROASAL v 2.0.0	^
*----------------------------------sfarsit procedura nom_sporuri----------------------------------


*******************************************
* PROCEDURE nom_popriri(  )
* Date : 06/17/05, 13:52:11
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_popriri(  )
Private ponompop,pcschema1,pcselect1
Store '' To ponompop
If Used('v_nompop')
	Use In v_nompop
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vnom_popriri where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('ponompop','v_nompop',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponompop.ca_baza1.afisare()
SELECT v_nompop
ofrmpop=Createobject('frm_nompopriri')
ofrmpop.Show(1)
Release ponompop


ENDPROC
*----------------------------------sfarsit procedura nom_popriri----------------------------------

*******************************************
* PROCEDURE nom_grpmun(  )
* Date : 06/17/05, 15:03:04
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_grpmun(  )
Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_nomgrp')
	Use In v_nomgrp
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_coef_cas where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('ponomgrp','v_nomgrp',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_nomgrp
ofrmpop=Createobject('frm_grpmun')
ofrmpop.Show(1)
Release ponomgrp
*!*	SELECT v_nomgrp
*!*	USE 

ENDPROC
*----------------------------------sfarsit procedura nom_grpmun----------------------------------

*******************************************
* PROCEDURE nom_grdhand(  )
* Date : 06/17/05, 15:10:33
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_grdhand(  )

Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp

If Used('v_nomhand')
	Use In v_nomhand
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_nom_handicap where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('ponomgrp','v_nomhand',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_nomhand
ofrmpop=Createobject('frm_grdhand')
ofrmpop.Show(1)
Release ponompop

*!*	SELECT v_nomhand
*!*	USE 
ENDPROC
*----------------------------------sfarsit procedura nom_grdhand----------------------------------

*******************************************
* PROCEDURE nom_tipintret(  )
* Date : 06/17/05, 15:13:34
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_tipintret(  )

Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_nomintret')
	Use In v_nomintret
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_nom_dedsupl where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('ponomgrp','v_nomintret',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_nomintret
ofrmpop=Createobject('frm_tipintret')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura nom_tipintret----------------------------------

*******************************************
* PROCEDURE caseasig(  )
* Date : 06/17/05, 15:20:20
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE caseasig(  )

Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_caseasig')
	Use In v_caseasig
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vcaseasig where 2=2']
pcorder1=[]
pcfiltru1 = [2=2]
llAfiseaza = .F.
gencursor('ponomgrp','v_caseasig',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_caseasig
ofrmpop=Createobject('frm_caseasig')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura caseasig----------------------------------

*******************************************
* PROCEDURE nom_tabvechimi(  )
* Date : 06/21/05, 09:54:04
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_tabvechimi(  )

Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_tabvechimi')
	Use In v_tabvechimi
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vtab_vechimi where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
gencursor('ponomgrp','v_tabvechimi',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_tabvechimi
ofrmpop=Createobject('frm_tabvechimi')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura nom_tabvechimi----------------------------------

*******************************************
* PROCEDURE nom_grilaco(  )
* Date : 06/21/05, 10:54:08
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_grilaco(  )
Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_grilaco')
	Use In v_grilaco
Endif

pcschema1=['liminf n(3),limsup n(3),zile n(2),id_grilaco n(10),datai d,datas d']
pcselect1=['select liminf,limsup,zile,id_grilaco,datai,datas from ] + gcS + [.sal_vnom_zileco where 2=2']
pcorder1=[liminf,limsup,datai,datas]
pcfiltru1 = [1=1]
llAfiseaza = .F.
gencursor('ponomgrp','v_grilaco',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_grilaco
ofrmpop=Createobject('frm_grilaco')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura nom_grilaco----------------------------------

*******************************************
* PROCEDURE nom_ore(  )
* Date : 06/21/05, 11:41:51
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_ore(  )
Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_nomore')
	Use In v_nomore
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vnomore where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
pcorder1 = [ ordine ]
gencursor('ponomgrp','v_nomore',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_nomore
ofrmpop=Createobject('frm_nomore')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura nom_ore----------------------------------

*******************************************
* PROCEDURE nom_tipcm(  )
* Date : 06/22/05, 09:34:42
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_tipcm(  )
Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_nomtipcm')
	Use In v_nomtipcm
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vnom_cm where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
pcorder1 = [ ordine ]
gencursor('ponomgrp','v_nomtipcm',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_nomtipcm
ofrmpop=Createobject('frm_nomcm')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura nom_tipcm----------------------------------

*******************************************
* PROCEDURE impozit_luna(  )
* Date : 06/22/05, 11:36:42
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE impozit_luna(tlImpAn)

Private ponomgrp,pcschema1,pcselect1,plImpAn
Store '' To ponomgrp

IF EMPTY(tlImpAn)
	STORE .f. TO plImpAn
ELSE 
	STORE tlImpAn TO plImpAn
ENDIF 

If Used('v_imp')
	Use In v_imp
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_impozitar where 2=2']
pcorder1=[]
IF plImpAn
	pcfiltru1 = [sters = 0 and luna = 0 and an = ]+ALLTRIM(STR(gnAn))
ELSE 
	pcfiltru1 = [sters = 0 and luna = ]+ALLTRIM(STR(gnLuna))+[ and an = ]+ALLTRIM(STR(gnAn))
ENDIF 

llAfiseaza = .F.
pcorder1 = [ inf ]
gencursor('ponomgrp','v_imp',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_imp
ofrmpop=Createobject('frm_imp')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura impozit_luna----------------------------------

*******************************************
* PROCEDURE nom_limded(  )
* Date : 06/22/05, 13:23:29
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_limded(  )
Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_deduceri')
	Use In v_deduceri
ENDIF

lcsql=[select NVL(id_calendar,0) as id_calendar,an,luna from ]+gcs+[.sal_calendar where an = ]+str(gnan)+[ and luna = ]+str(gnluna)
lnSucces = goExecutor.oExecute(lcSql,'crsCalendar')
	IF lnSucces < 0
		MESSAGEBOX(goExecutor.cEroare,0 +16,'Eroare')
	ENDIF 

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vdeduceri where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
pcorder1 = [ nrpers ]
gencursor('ponomgrp','v_deduceri',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_deduceri
ofrmpop=Createobject('frm_limded')
ofrmpop.Show(1)
Release ponompop

IF USED('crsCalendar')
	USE IN crsCalendar
ENDIF 

ENDPROC
*----------------------------------sfarsit procedura nom_limded----------------------------------
*******************************************
* PROCEDURE nom_curscal(  )
* Date : 06/22/05, 14:01:51
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_curscal(  )
Private ponomgrp,pcschema1,pcselect1
Store '' To ponomgrp
If Used('v_curscal')
	Use In v_curscal
Endif


pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vnom_curs where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
pcorder1 = [ denumire ]
gencursor('ponomgrp','v_curscal',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomgrp.ca_baza1.afisare()
SELECT v_curscal
ofrmpop=Createobject('frm_curscal')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura nom_curscal----------------------------------
*******************************************
* PROCEDURE sal_coef(  )
* Date : 06/22/05, 15:27:17
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
Function modificare_coef_luna
	Private pozile,pcschema2,pcselect2
	
	lnSucces = goExecutor.oExecute('select MAX(coef) as coef from sal_impozitar where sters = 0 and '+[luna = ] + Alltrim(Str(gnLuna)) + [ and an = ]+Alltrim(Str(gnAn)),'crsImpozitar')
	IF lnSucces < 0
		MESSAGEBOX(goExecutor.cEroare,0 +16,'Eroare')
		RETURN 
	ENDIF  
	
	SELECT crsImpozitar

	Store '' To pozile
	If Used('v_coef')
		Use In v_coef
	Endif
	pcschema2=['']
	pcselect2=[select * from ] + gcS + [.sal_calendar where 1=2]
	pcorder2=[luna,an]
	pcfiltru2 = [luna = ] + Alltrim(Str(gnLuna)) + [ and an = ]+Alltrim(Str(gnAn))
	llAfiseaza = .F.
	gencursor('pozile','v_coef',pcselect2,pcfiltru2,pcschema2,pcorder2,llAfiseaza)
	pozile.ca_baza1.afisare()
	Select v_coef
	Scatter Name pocoef
	ADDPROPERTY(poCoef,'impozit',crsImpozitar.coef)
	ofrmform=Createobject('frm_salcoef')
	ofrmform.Show(1)
&&	CURSORTOXML('v_coef','c:\coeficienti.xml',1,512)
	If Used('v_coef')
		Use In v_coef
	ENDIF
	USE IN crsImpozitar
	Release posarbat,ofrmform
	Return Iif(gnButon=1,pocoef,Null)
Endfunc
*******************************************
PROCEDURE sal_coef
PARAMETERS tlPreiauDinVariabile
*----------- zile lucratoare
*!*	Private pozile,pcschema2,pcselect2
*!*	Store '' To pozile
*!*	If Used('v_coef')
*!*		Use In v_coef
*!*	Endif
*!*	pcschema2=['']
*!*	pcselect2=[select * from ] + gcS + [.sal_calendar where 1=2]
*!*	pcorder2=[luna,an]
*!*	pcfiltru2 = [ luna = ] + ALLTRIM(STR(gnLuna)) + [ and an = ]+ALLTRIM(STR(gnAn))
*!*	llAfiseaza = .F.
*!*	*!*	WAIT WINDOW ' Luna:'+STR(gnLuna) + ' an:'+STR(gnAn)
*!*	gencursor('pozile','v_coef',pcselect2,pcfiltru2,pcschema2,pcorder2,llAfiseaza)
*!*	pozile.ca_baza1.afisare()

*!*	SELECT v_coef
*!*	*--------------
*!*	PRIVATE pnIdSal
*!*	STORE 0 TO pnIdSal

*!*	pnIdSal = v_coef.id_Calendar
*!*	SELECT v_coef
*!*	SCATTER NAME pocoef

*!*	ofrmform=Createobject('frm_salcoef')
*!*	ofrmform.Show(1)
IF PCOUNT() = 0 OR !tlPreiauDinVariabile
	poCoef = modificare_coef_luna()
ENDIF 
IF !ISNULL(poCoef)
	lcSql = [begin pack_salarii.actualizeaza_calendar(] + ALLTRIM(STR(NVL(pocoef.id_Calendar,0))) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.c_meds,0),5,3)) + [,] +;
					ALLTRIM(STR(NVL(pocoef.c_medp,0),5,3)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.c_soms,0),11,8)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.c_somp,0),7,5)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.c_casp,0),7,5)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.salmin,0),16,gnPa)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.salmed,0),16,gnPa)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.c_munca,0),8,6)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.dedl1,0),16,gnPa)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.dedl2,0),16,gnPa)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.c_faambp,0),8,6)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.zilecmplang,0))) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.zilecmplangf,0))) + [,] + ;					
					ALLTRIM(STR(NVL(pocoef.BAZA_INGR,0))) + [,] + ;
					AllTRIM(STR(NVL(pocoef.c_cas1,0),6,4)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.c_cas2,0),6,4)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.c_cas3,0),6,4)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.FD_FNUASS,0),6,4)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.brutprimaco,0))) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.netprimaco,0))) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.coefavco,0),6,4)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.C_FDGARANT,0),6,4)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.fol_cstandard,0))) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.C_ORESUPL,0),6,3)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.C_OREW,0),6,3)) + [,] + ;
					ALLTRIM(STR(NVL(pocoef.C_ORENOAPTE,0),6,3)) + [,]+;
					ALLTRIM(STR(NVL(pocoef.diurnaneimp,0),16,2))+ [,]+;
					ALLTRIM(STR(NVL(pocoef.oug114_2018,0),1)) + [,]+;
					ALLTRIM(STR(NVL(pocoef.impozit,0),6,4)) +[,]+;
					ALLTRIM(STR(NVL(pocoef.salminstudii,0),16,gnPa)) + [,]+ ;
					ALLTRIM(STR(NVL(pocoef.orestas,0),7,3)) +;
					[); end;]
*!*			lcSql = [update ] + gcS +[.sal_calendar set c_meds = ] + ALLTRIM(STR(NVL(pocoef.c_meds,0),5,3)) + [,] +;
*!*					[ c_medp = ] + ALLTRIM(STR(NVL(pocoef.c_medp,0),5,3)) +;
*!*					[,c_soms = ] + ALLTRIM(STR(NVL(pocoef.c_soms,0),5,3)) +;
*!*					[,c_somp = ] + ALLTRIM(STR(NVL(pocoef.c_somp,0),5,3)) +;
*!*					[,c_casp = ] + ALLTRIM(STR(NVL(pocoef.c_casp,0),5,3)) +;
*!*					[,salmin = ] + ALLTRIM(STR(NVL(pocoef.salmin,0),16,gnPa)) +;
*!*					[,salmed = ] + ALLTRIM(STR(NVL(pocoef.salmed,0),16,gnPa)) +;
*!*					[,c_munca = ] + ALLTRIM(STR(NVL(pocoef.c_munca,0),8,6)) +;
*!*					[,dedl1  = ] + ALLTRIM(STR(NVL(pocoef.dedl1,0),16,gnPa)) +;
*!*					[,dedl2  = ] + ALLTRIM(STR(NVL(pocoef.dedl2,0),16,gnPa)) +;
*!*					[,c_faambp  = ] + ALLTRIM(STR(NVL(pocoef.c_faambp,0),8,6)) +;
*!*					[,zilecmplang  = ] + ALLTRIM(STR(NVL(pocoef.zilecmplang,0))) +;
*!*					[,BAZA_INGR  = ] + ALLTRIM(STR(NVL(pocoef.BAZA_INGR,0))) +;
*!*					[,c_cas1 = ] + ALLTRIM(STR(NVL(pocoef.c_cas1,0),6,4)) +;
*!*					[,c_cas2 = ] + ALLTRIM(STR(NVL(pocoef.c_cas2,0),6,4)) +;
*!*					[,c_cas3 = ] + ALLTRIM(STR(NVL(pocoef.c_cas3,0),6,4)) +;
*!*					[,FD_FNUASS = ] + ALLTRIM(STR(NVL(pocoef.FD_FNUASS,0),6,4)) +;
*!*					[,brutprimaco = ] + ALLTRIM(STR(NVL(pocoef.brutprimaco,0))) +;
*!*					[,netprimaco = ] + ALLTRIM(STR(NVL(pocoef.netprimaco,0))) +;
*!*					[,coefavco = ] + ALLTRIM(STR(NVL(pocoef.coefavco,0),6,4)) +;
*!*					[,C_FDGARANT = ] + ALLTRIM(STR(NVL(pocoef.C_FDGARANT,0),6,4)) +;
*!*					 [where id_calendar = ] + ALLTRIM(STR(NVL(pnIdSal,0)))
	lnSucces = goExecutor.oExecute(lcSql)
	IF lnSucces < 0
		MESSAGEBOX(goExecutor.cEroare,0 +16,'Eroare')
	ELSE 
		IF USED('crsDeduceri')
		SET STEP ON 
			LOCAL lcStringDeduceri
			STORE [] TO lcStringDeduceri
			SELECT crsDeduceri
			SCAN
				lcStringDeduceri = lcStringDeduceri +ALLTRIM(STR(crsDeduceri.nrpers))+[,]+ALLTRIM(STR(crsDeduceri.suma))+[|]
			ENDSCAN 
			IF !EMPTY(lcStringDeduceri)
			IF m.gnAn*12+m.gnLuna <=2018*12+1
				lcSql = [merge into sal_deduceri a ]+;
						[ using ]+;
						[(select to_number(substr(X,1,instr(X, ',') - 1)) as nrpers, ]+;
       					[ to_number(substr(X, instr(X, ',') + 1)) as suma, ]+;
        				ALLTRIM(STR(NVL(pocoef.id_Calendar,0))) + [ as id_calendar] +;
        				[ from table(charc2collection(']+lcStringDeduceri+[','|'))) b ]+;
        				[ on (a.nrpers = b.nrpers and a.id_calensal = b.id_calendar) ] +;
						[ WHEN MATCHED THEN UPDATE SET ]+;
						 [  a.suma = b.suma ]+;
						 [ when not matched then ]+;
						 [  insert (nrpers,suma,id_calensal) values (b.nrpers,b.suma,b.id_calendar)]			
			ENDIF 							
				lnSucces = goExecutor.oExecute(lcSql)
				IF lnSucces < 0
					MESSAGEBOX(goExecutor.cEroare,0 +16,'Eroare')
				ENDIF 
			ENDIF  
			
		ENDIF 
	ENDIF 
	goExecutor.oReset()

	RETURN lnSucces
ENDIF 
*!*	Release posarbat,ofrmform


ENDPROC
*----------------------------------sfarsit procedura sal_coef----------------------------------

*******************************************
* PROCEDURE nom_tiptichetemasa(  )
* Date : 06/22/05, 09:34:42
* author : liana.macinic
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_tiptichetemasa(  )
Private ponomtic,pcschema1,pcselect1
Store '' To ponomtic
If Used('vnom_tichete')
	Use In vnom_tichete
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_vnom_tichete where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
pcorder1 = [ denumire ]
gencursor('ponomtic','vnom_tichete',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomtic.ca_baza1.afisare()
SELECT vnom_tichete
ofrmpop=Createobject('frm_nomtichete')
ofrmpop.Show(1)
Release ponompop

ENDPROC
*----------------------------------sfarsit procedura nom_tipcm----------------------------------

*******************************************
* PROCEDURE nom_turelucru(  )
* Date : 19/09/2017, 09:34:42
* author : liana.neagu
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_turelucru(  )
Private ponomture,pcschema1,pcselect1
Store '' To ponomture
If Used('vnom_ture')
	Use In vnom_ture
Endif

pcschema1=['']
pcselect1=['select * from ] + gcS + [.sal_nom_ture where 2=2']
pcorder1=[]
pcfiltru1 = [sters = 0]
llAfiseaza = .F.
pcorder1 = [ denumire ]
gencursor('ponomture','vnom_ture',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
ponomture.ca_baza1.afisare()
SELECT vnom_ture
ofrmture=Createobject('frm_nomTure')
ofrmture.Show(1)
Release ponomture

ENDPROC
*----------------------------------sfarsit procedura nom_turelucru----------------------------------
*******************************************
* PROCEDURE nom_locmunca(  )
* Date : 03/09/21, 16:37:20
* author : liana.neagu
* description: 

****** PARAMETER BLOCK **************
* Parameters : 0
* 
*******************************************
PROCEDURE nom_locmunca(  )
Private poformatii,pcschema1,pcselect1
Store '' To poformatii
If Used('v_formatii')
	Use In v_formatii
Endif
*!*	DEBUG
*!*	SUSPEND 
pcschema1=['']
*!*	pcselect1=[select f.*,s.SECTIE,t.TRANSA from ] + gcS +;
*!*	 [.sal_nom_formatii f left join ]+gcS;
*!*	 +[.vnom_sectii s on f.id_sectie = s.ID_SECTIE ]+;
*!*		[ left join ]+gcS+[.sal_vnom_transe t on f.id_sectie = t.ID_TRANSA where 1=2]
pcselect1=[select f.*,S.SECTIE,T.TRANSA,semn.denumire as semnatura,semn.directie from ] + gcS + [.sal_nom_locmunca f ] + ;
	[ LEFT JOIN ] + GCS + [.VNOM_SECTII S ON F.ID_SECTIE = S.ID_SECTIE ] +;
	[ LEFT JOIN ] + GCS + [.SAL_VNOM_TRANSE T ON F.ID_TRANSA = T.ID_TRANSA ]+;
	[left join sal_semnaturi semn on f.id_semnatura = semn.id_semnatura ]+;
	[ where 1=2]
pcorder1=[ordine]
pcfiltru1 = [f.sters = 0]
llAfiseaza = .F.
gencursor('poformatii','v_formatii',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
poformatii.ca_baza1.afisare()
SELECT V_FORMATII
ofrmform=Createobject('frm_formatii')
ofrmform.but_nou1.visible = .f.
ofrmform.but_modifica1.visible = .f.
ofrmform.but_sterge1.visible = .f.
ofrmform.Show(1)
Release poformatii

ENDPROC
*----------------------------------sfarsit procedura nom_formatii----------------------------------