Procedure casademarcat
Local lnLungime,lnButon
lnLungime=14
lnRaspuns=6
Dimension taValori[lnLungime,3]
*!*	modificare migrare v 1.0	>	v 2.0
*!*	Do While lnRaspuns = 6
*!*		glListareBonFiscal=.T.
*!*	modificare migrare v 1.0	>	v 2.0	^

taValori[1,1]="poAct.id_fdoc"
taValori[1,2]=Alltrim(Str(gnid_fdoc_bonfiscal))
taValori[1,3]= !Empty(gnid_fdoc_bonfiscal)

taValori[2,1]="poAct.fdoc"
*!*	modificare migrare v 1.0	>	v 2.0
*!*		taValori[2,2]=IIF(!EMPTY(gnid_fdoc_bonfiscal),[BON FISCAL],[])
taValori[2,2]=Iif(!Empty(gnid_fdoc_bonfiscal),citeste_setari_casademarcat(1,gnid_fdoc_bonfiscal),[])
*!*	modificare migrare v 1.0	>	v 2.0
taValori[2,3]= !Empty(gnid_fdoc_bonfiscal)

taValori[3,1]="poAct.id_gestout"
taValori[3,2]=Alltrim(Str(gnid_gestiune_bufet))
taValori[3,3]= !Empty(gnid_gestiune_bufet)

taValori[4,1]="poAct.gestout"
*!*	modificare migrare v 1.0	>	v 2.0
*!*		taValori[4,2]=IIF(!EMPTY(gnid_gestiune_bufet),[BUFET],[])
taValori[4,2]=Iif(!Empty(gnid_gestiune_bufet),citeste_setari_casademarcat(2,gnid_gestiune_bufet),[])
*!*	modificare migrare v 1.0	>	v 2.0
taValori[4,3]=!Empty(gnid_gestiune_bufet)

*!*		lnNumarBon = aloca_numar_bf()	&&	in oserii_numere.prg
*!*		IF lnNumarBon = -1
*!*			Return
*!*		Endif

*!*		taValori[5,1]="poAct.nract"
*!*		taValori[5,2]=Alltrim(Str(lnNumarBon))
*!*		taValori[5,3]=.T.

taValori[5,1]="poAct.id_vv4111"
taValori[5,2]=Alltrim(Str(gnid_part_diversi))
taValori[5,3]=!Empty(gnid_part_diversi)

taValori[6,1]="poAct.v4111"
*!*	modificare migrare v 1.0	>	v 2.0
*!*		taValori[6,2]= IIF(!EMPTY(gnid_part_diversi),[DIVERSI],[])
taValori[6,2]= Iif(!Empty(gnid_part_diversi),citeste_setari_casademarcat(3,gnid_part_diversi),[])
*!*	modificare migrare v 1.0	>	v 2.0	^
taValori[6,3]=!Empty(gnid_part_diversi)

taValori[7,1]="poAct.id_lucrare"
taValori[7,2]=[0]
taValori[7,3]=.T.

taValori[8,1]="poAct.nrord"
taValori[8,2]=[<NU SE COMPLETEAZA>]
taValori[8,3]=.T.

taValori[9,1]="poAct.id_responsabil"
taValori[9,2]=[0]
taValori[9,3]=.T.

taValori[10,1]="poAct.nresp"
taValori[10,2]=[<NU SE COMPLETEAZA>]
taValori[10,3]=.T.

taValori[11,1]="poAct.id_sectie"
taValori[11,2]=Alltrim(Str(gnid_sectie_bufet))
taValori[11,3]=!Empty(gnid_sectie_bufet)

taValori[12,1]="poAct.sectie"
*!*	modificare migrare v 1.0	>	v 2.0
*!*		taValori[12,2]=IIF(!EMPTY(gnid_sectie_bufet),[BUFET],[])
taValori[12,2]=Iif(!Empty(gnid_sectie_bufet),citeste_setari_casademarcat(4,gnid_sectie_bufet),[])
*!*	modificare migrare v 1.0	>	v 2.0	^
taValori[12,3]=!Empty(gnid_sectie_bufet)

taValori[13,1]="poAct.id_vv53110"
taValori[13,2]=Alltrim(Str(gnid_part_bufet))
taValori[13,3]=!Empty(gnid_part_bufet)

taValori[14,1]="poAct.v53110"
*!*	modificare migrare v 1.0	>	v 2.0
*!*		taValori[14,2]=IIF(!EMPTY(gnid_part_bufet),[BUFET],[])
taValori[14,2]=Iif(!Empty(gnid_part_bufet),citeste_setari_casademarcat(5,gnid_part_bufet),[])
*!*	modificare migrare v 1.0	>	v 2.0	^
taValori[14,3]=!Empty(gnid_part_bufet)

*!*	modificare migrare v 1.0	>	v 2.0
Do While lnRaspuns = 6
	glListareBonFiscal=.T.
*!*	modificare migrare v 1.0	>	v 2.0	^
	lnSucces=lans(228,.F.,.T.,@taValori)
	glListareBonFiscal=.F.
	lnRaspuns = amessagebox("Doriti sa continuati cu operatii de acest fel?",4+32,"Confirmare")
Enddo
Endproc

*******************************************
Procedure creare_bon_fiscal
Local lcSirBonFiscal,lnTip,lnIdCasa,lnTotalSuma,ldDataBonFiscal,lnNumarBonFiscal,lnTotalSuma
lnNumarBonFiscal=0
lnTotalSuma=0
lcSirBonFiscal=[]

&&	lcSirBonFiscal (explicatii) :
&&	5 (incasare);suma achitata;0(numerar);0(moneda);0(numar card credit)
ldDataBonFiscal=get_ora()
Select actactan
Set Filter To scd='5311'
Scan
	lnNumarBonFiscal=nract
	lnIdCasa=id_partd
	Do Case
	Case Type('gnId_casa_achit')<>'U' And lnIdCasa=gnId_casa_achit		&&	optiune din Devize
		lnTip=1
*!*		Case TYPE('gnId_Part_Bufet')<>'U' AND lnIdCasa=gnId_Part_Bufet		&&	optiune din Gestiuni
*!*			lnTip=2
	Otherwise
		lnTip=3
	Endcase
	lcSirBonFiscal=lcSirBonFiscal+[1;Fact.]+Alltrim(Str(perechec))+[;1;]+Alltrim(Str(lnTip))+[;1;]+Alltrim(Str(suma*100))+[;1000;0]+CRLF
	lnTotalSuma=lnTotalSuma+suma
Endscan
Set Filter To
If !Empty(lcSirBonFiscal)
	lcSirBonFiscal=lcSirBonFiscal+[5;]+Alltrim(Str(lnTotalSuma*100))+[;0;0;0]+CRLF+CRLF
	imprimare_bon_fiscal(lcSirBonFiscal,ldDataBonFiscal,lnNumarBonFiscal)
Else
	amessagebox("Bonul nu contine nici un element!",0+48,"Atentie")
Endif
Endproc
******************************************************************************************
Function citeste_setari_casademarcat
Lparameters tnTip,tnId
Local lcValoare,lcCursor,llCautare
llCautare = .T.
lcCursor = [crssetaricasa]
Do Case
Case tnTip = 1 And !Empty(Nvl(tnId,0))
	lcValoare = [BON FISCAL]
	lcSql = [select fel_document as valoare from nom_fdoc ] + ;
		[where sters = 0 and inactiv = 0 and id_fdoc = ] + Alltrim(Str(tnId))		&&	gnid_fdoc_bonfiscal
Case tnTip = 2 And !Empty(Nvl(tnId,0))
	lcValoare = [BUFET]
	lcSql = [select nume_gestiune as valoare from nom_gestiuni ] + ;
		[where sters = 0 and inactiv = 0 and id_gestiune = ] + Alltrim(Str(tnId))	&&	gnid_gestiune_bufet
Case tnTip = 3 And !Empty(Nvl(tnId,0))
	lcValoare = [DIVERSI]
	lcSql = [select denumire as valoare from nom_parteneri ] + ;
		[where sters = 0 and inactiv = 0 and id_part = ] + Alltrim(Str(tnId))		&&	gnid_part_diversi
Case tnTip = 4 And !Empty(Nvl(tnId,0))
	lcValoare = [BUFET]
	lcSql = [select sectie as valoare from nom_sectii ] + ;
		[where sters = 0 and inactiv = 0 and id_sectie = ] + Alltrim(Str(tnId))		&&	gnid_sectie_bufet
Case tnTip = 5 And !Empty(Nvl(tnId,0))
	lcValoare = [BUFET]
	lcSql = [select denumire as valoare from nom_parteneri ] + ;
		[where sters = 0 and inactiv = 0 and id_part = ] + Alltrim(Str(tnId))		&&	gnid_part_bufet
Otherwise
	lcValoare = []
	llCautare = .F.
Endcase

If llCautare
	If Used(lcCursor)
		Use In (lcCursor)
	Endif
	lnSucces = goExecutor.oExecute(lcSql,lcCursor)
	If lnSucces < 0
		amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
	Else
		If Reccount(lcCursor) > 0
			Select (lcCursor)
			lcValoare = Alltrim(valoare)
		Endif
	Endif
	If Used(lcCursor)
		Use In (lcCursor)
	Endif
Endif
Return lcValoare
Endfunc	&&	citeste_setari_casademarcat
******************************************************************************************