VARIAVEL Z_AAMM = right( str(year(date()),4), 2) + strzero( month(date()) ,2) 
VARIAVEL Z_FATF = "" 
VARIAVEL Z_FORN = 0 
VARIAVEL Z_DE = CTOD( "01."+SUBSTR(DTOC(S_DATUAL),4) ) 
VARIAVEL Z_ATE = S_DATUAL 
 
T10,10,18,60,Parametros 
T2,2,Ano e Mes (AaMm) ..:,4,z_aamm,9999 
T3,2,Fornecedor ........:,3,z_forn,999 
T4,2,Data Emissao Inici.:,10,Z_DE,99.99.9999 
T5,2,Data Emissao Final.:,10,Z_ATE,99.99.9999 
 
COMANDO ANTES DbGoBottom() 
COMANDO DEPOIS Z_FATF = "FATF"+Z_AAMM 
 
# ARQUIVO (z_FATF) z_FATF+".xx" pfdataemi 
ARQUIVO (z_FATF) ("temp00xx") pfdataemi 
OUTROARQ SCCPFOR 
 
FILTRO (Z_FORN=0 .OR. Z_FORN=PFFOR) .AND. (PFDATAEMI>=Z_DE .AND. PFDATAEMI<=Z_ATE) 
FILTRO PFNUM>0 
COMANDO DURANTE SCCPFOR->( DbGoto( Z_fatf->pffor )) 
COMANDO DURANTE Z_FANT = SCCPFOR->cp_fantasi 
VARIAVEL Z_TPFVAL = 0 
VARIAVEL Z_TPFTOTICMS = 0 
VARIAVEL Z_TPFVALRET = 0 
VARIAVEL Z_TPFVALPAS = 0 
VARIAVEL Z_TNF = 0 
VARIAVEL Z_STRFORN = IF( Z_FORN=0, "Todos", STR(Z_FORN,4) ) 
COMANDO DURANTE Z_TPFVAL = Z_TPFVAL + PFVAL 
COMANDO DURANTE Z_TPFTOTICMS = Z_TPFTOTICMS + PFTOTICMS 
COMANDO DURANTE Z_TPFVALRET = Z_TPFVALRET + PFVALRET 
COMANDO DURANTE Z_TPFVALPAS = Z_TPFVALPAS + PFVALREP 
COMANDO DURANTE Z_TNF = Z_TNF + 1 
 
*COMANDO DURANTE Z_INDFORN = ASCAN( ZV_FORN, {|X| X[1]=ZFATF->PFFOR} ) 
*COMANDO DURANTE ZV_FORN[Z_INDFORN][2] = ZV_FORN[Z_INDFORN] + PFVAL 
CRelacao de Notas Fiscais de Entrada, Emitida em [s_datual] as [time()]         Pag [pag 999] 
C*** Fornecedor: [Z_STRFORN]    Periodo de Emissao: [Z_DE] ate [Z_ATE] 
C[repl("-",92)] 
CForn                Dt Emis. Dt Cheg.   N.F.    Valor BaseIcms %Icm  Val_Icm Repasse Icm_Ret
*999-xxxxxYYYYYxxxxx 99999999 9,999.99 9,999.99 99% 9,999.99 999.99 9,999.99 DD/MM/AA 99 
C[repl("=",92)] 
D[PFFOR 999]-[Z_FANT] [pfdataemi] [PFDATACHE] [PFNUM 9999999] [PFVAL 9,999.99] [PFBASEICMS 9,999.99] [PFTAXAICMS 99]% [PFTOTICMS 9,999.99] [PFVALREP 999.99] [PFVALRET 9,999.99] 
ULTPAG [repl("-",92)] 
ULTPAG *** Totais com [Z_TNF 999] lancamentos: 
ULTPAG     Total das Notas          Total ICMS        Total Repasse       Total ICMS ST 
ULTPAG     R$ [z_tpfval 9,999,999.99]       R$ [z_tpftoticms 999,999.99]        R$ [z_tpfvalpas 999,999.99]       R$ [z_tpfvalret 999,999.99] 
 
