ALIAS SF_FATNF
OUTROARQ SF_VEND

VARIAVEL Z_DE = CTOD( "01."+SUBSTR(DTOC(S_DATUAL),4) ) 
VARIAVEL Z_ATE = S_DATUAL 
VARIAVEL zTotSubSidio = 0
VARIAVEL zTotFat = 0

T10,10,18,60,Parametros 
T4,2,Data Inicial ......:,10,Z_DE,99.99.9999 
T5,2,Data Final ........:,10,Z_ATE,99.99.9999

COMANDO ANTES ZNIL = SF_FATNF->(DbGoTop())

COMANDO DURANTE zVendedor= fVendedor
COMANDO DURANTE sf_vend->(DbGoto(zVendedor))
COMANDO DURANTE zVndNome = sf_vend->nome
COMANDO DURANTE zTotFat = zTotFat + fval
COMANDO DURANTE zTotSubSidio = zTotSubSidio + fsubsidio

FILTRO FDATAEMI >= Z_dE  .AND. FDATAEMI <= Z_ATE .and. fsubsidio>0

CVendas Farmacia Popular, Emitida em [s_datual] as [time()]   Pag [pag 999]     
CPeriodo: [z_DE] ate [z_ATE] 
C[repl("-",80)] 
CPedido   dtaEmi        Venda     SubSidio       DifCli  CVnd Vendedor
*999999 99.99.99 9,999,999.99 9,999,999.99 9,999,999.99  9999 999999 zCrNome
C[repl("=",80)] 
D[FNUMPED 999999] [fdataemi] [fval @E 9,999,999.99] [fsubsidio @E 9,999,999.99] [fval-fsubsidio @E 9,999,999.99]  [fvendedor 9999] [zVndNome]
ULTPAG[repl("=",80)] 
ULTPAG ** TOTAL FATURADO COM FARMACIA POPULAR.....:   [zTotFat @E 999,999,999.99]
ULTPAG ** TOTAL DAS AUTORIZACOES FARMACIA POPULAR.:   [zTotSubSidio @E 999,999,999.99]
ULTPAG ** TOTAL DAS DIFERENCCAS PAGAS PELO CLIENTE:   [zTotFat-zTotSubSidio @E 999,999,999.99]

