******************************************************************
Procedure listare_registru_tva
Lparameters tcRegistru

pcRegistru = Upper(Alltrim(tcRegistru))
Do Case
Case 'VANZ'$pcRegistru
	pcContTVA = [4427]
	pcListaContTVA = [411,4111,4112,4113,4114,4115,4116,4117,461,635,5311,5121,428,4281,4282,4426,4428]
	pcListaContBaza = [411,4111,4112,4113,4114,4115,4116,4117,461,428,4281,4282]
	pcListaContExceptii  = [667,419]
Otherwise
	pcContTVA = [4426]
	pcListaContTVA = [401,404,5121,5124,542,4427,4428]
	pcListaContBaza = [401,404]
	pcListaContExceptii  = [767]
Endcase


lcSql = [{call PACK_REGISTRE_TVA.REGISTRUTVA(?gcS, ?gnAn, ?gnLuna, ] + ;
	[?pcRegistru, ?pcContTVA, ?pcListaContTVA, ?pcListaContBaza, ?pcListaContExceptii )}]
lcCursor = 'crsRegistruTemp'
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
If lnSucces < 0
	AMESSAGEbox(goExecutor.cEroare,0+16,"Eroare")
Else

	Select nract, dataact, Part As nume, cod_fiscal, fdoc, baza, proc_tva, tva, baza + tva As totctva, 00000000000.0000 As Total ;
		FROM crsRegistruTemp ;
		INTO Cursor crsRegistru ;
		READWRITE Order By dataact, nract, nume
	Use In crsRegistruTemp

	Select nract, dataact, nume,Sum(totctva) As Total ;
		from crsRegistru ;
		INTO Cursor tgrup ;
		GROUP By dataact, nract, nume

	Select tgrup
	Scan
		Scatter Name ot
		Select crsRegistru
		Locate For nume = ot.nume And nract = ot.nract And dataact = ot.dataact
		If Found()
			Replace Total With ot.Total
		Endif
		Select tgrup
	Endscan
	Use In tgrup

	If Reccount('crsRegistru')>0
		Private pcDataOra
		pcDataOra = get_ora(2)
		Select crsRegistru
		Report Form registru_tva_simplu To Printer Prompt Preview
	Else
		AMESSAGEbox("Nu exista inregistrari pentru listare!",48,"Atentie")
	Endif
	Use In crsRegistru
Endif
Endproc

******************************************************************