Alias HELP
VARIAVEL zCli = 0 
VARIAVEL Z_DE = CTOD( "01."+SUBSTR(DTOC(S_DATUAL),4) ) 
VARIAVEL Z_ATE = S_DATUAL 
VARIAVEL wAaaaMm = ""
VARIAVEL ztNf = 0 
VARIAVEL ztFval = 0 
VARIAVEL ztTotIcms = 0 
VARIAVEL z_STRFORN = ""
VARIAVEL zCrNome := ""
variavel sPrtLineLen = 132
variavel zFgOk = .f.

T10,10,15,40,Parametros 
T2,2,Data Inicial:,10,Z_DE,99.99.9999 
T3,2,Data Final..:,10,Z_ATE,99.99.9999 

comando antes wAaaaMm = Left( Dtos(z_de), 6 )
comando antes DbGoBottom()

//   if FgDev$'DTE'
//      sccpfor->( DbGoto( sf_fatnf->fCli ))
//      zCrNome := sccpfor->(if(empty(cp_fantasi),cp_nome,cp_fantasi))
//   else
//      sccrcli->( DbGoto( sf_fatnf->fCli ))
//      zCrNome := sccrcli->(if(empty(cr_fantasi),cr_nome,cr_fantasi))
//   endif
//   zCrNome := Pad( zCrNome , 35)
//   ztNf := ztNf + 1

comando depois #TEXTO_FONTE
   zFgOk := ChecaSped(Z_DE)

   Abra ('0NOIDX', r_siga, 'efd_C190', 'efd_C190', 'efd_C190', 'AaaaMm+AuxIndOper+AuxCodPart+AuxNumDoc+AuxSer+ cfop+Cst_Icms+Str(Aliq_icms,6,2)')
   Abra ('0NOIDX', r_siga, 'efd_0150', 'efd_0150', 'efd_0150', 'AaaaMm+COD_PART')
   Abra ('0NOIDX', r_siga, 'efd_c100', 'efd_C100', 'efd_C100', 'AaaaMm')
   OrdScope(0, wAaaaMm)
   OrdScope(1, wAaaaMm)
   if( zFgOk, DbGoTop(), DbGoBottom() )

   oLst:AddMasterDetail( 'efd_c100', 'efd_c190', 'AaaaMm+ind_oper+cod_part+Num_Doc+Ser') 
   oLst:AddMasterDetail( 'efd_c100', 'efd_0150', 'AaaaMm+COD_PART') 

   // oLst:lPortrait := .t.
   // oLst:nLinesPorPagina := 96
   oLst:lPortrait := .f.
   oLst:nLinesPorPagina := 56
   oLst:lOutputMatricial := .t.   

   oLst:cAlias_DataCols := 'efd_c100'

   oLst:AddCab( {"FONT"=>"Helvetica,14", "COLS"=>"0,C"}, "Entradas de Mercadorias e Aquisicao de Servicos" )
   oLst:AddCab( {|| "Emissoes de "+Dtoc(z_DE)+" ate "+Dtoc(z_ATE) })
   oLst:AddCab( '_LINHA_FINA_' )
   oLst:AddCab( '_DB:efd_c100', '_CABCOLS_' )
   oLst:AddCab( '_DB:efd_c190', '_CABCOLS_' )
   oLst:AddCab( '_LINHA_GROSSA_' )

   oLst:AddCol('DtEntrada;Dt_E_S;D;99.99.9999;8;S;')
   oLst:AddCol('DtEmissao;Dt_Doc;D;99.99.9999;8;S;')
   oLst:AddCol('Nr.Doc;Num_Doc;N;999999999;9;S;')
   oLst:AddCol('Mod;Cod_Mod;C;99;3;S;')
   oLst:AddCol('Ser;Ser;C;999;3;S;')
   oLst:AddCol('Sit;Cod_Sit;C;99;3;S;')
   oLst:AddCol('CNPJ/CPF;(FormataCnpjCpf(Cod_Part));P;@S18;18;S;')
   oLst:AddCol('IE;(EFD_0150->IE);P;@S14;14;S;')
   oLst:AddCol('UF;AuxUF;C;XX;2;S;')
   // oLst:AddCol('Municipio;(MunicipioIbge(EFD_0150->COD_MUN));P;@S20;20;S;')
   oLst:AddCol('Municipio;(EFD_0150->COD_MUN);P;@S8;8;S;')
   oLst:AddCol('Razao Social;(EFD_0150->NOME);P;@S35;35;S;')

   oLst:cAlias_DataCols := 'efd_c190'
   oLst:AddCol('       ;Space(10);C;@S10;10;S;')
   oLst:AddCol('CstIcms;Cst_Icms;C;999;3;S;')
   oLst:AddCol('CFOP;CFOP;C;9999;4;S;')
   oLst:AddCol('%ICMs;Aliq_icms;N;99.99;5;S;')
   oLst:AddCol('Vl_Oper;vl_opr;N;@E 99999,999.99;12;S;')
   oLst:AddCol('Base_Icms;vl_bc_icms;N;@E 99999,999.99;12;S;')
   oLst:AddCol('Vl_Icms;vl_icms;N;@E 999,999.99;10;S;')
   oLst:AddCol('Base_St;vlbcicmsst;N;@E 99999,999.99;12;S;')
   oLst:AddCol('Icm_St;vl_icms_st;N;@E 999,999.99;10;S;')
   oLst:AddCol('Vl_IPI;vl_ipi;N;@E 999,999.99;10;S;')
   oLst:AddCol('RedBase;vl_red_bc;N;@E 999,999.99;10;S;')

   // oLst:AddCol('xSituacao;nfe_xMotiv;C;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;10;S;')

   // oLst:cAlias_DataCols = 'sccrcli'
   // oLst:AddCol('cnpj;cr_cgc;C;99.999.999/9999-99;18;S;D;;')
   // oLst:AddCol('nome;cr_nome;C;@S44;44;S;')

   // oLst:AddDetalhes( '_LINHA_FINA_', '.' )

   oLst:cAlias_DataCols := 'efd_c100'
   oLst:AddRodape( '_LINHA_FINA_', "", {|| "Pagina "+Str(pag++,4)+" "} )

   DbSelectArea('efd_c100')
   oLst:DbEval() 

   efd_c100->(DbCloseArea())
   efd_0150->(DbCloseArea())
   efd_C190->(DbCloseArea())
   
   if zFgOk
      oLst:lPrtRodape := .f.
      oLst:EvalLineBlocks('DETALHE', '_PULE_1LINHA_', '_LINHA_GROSSA_', '_SOMACOLS_')
      oLst:EvalLineBlocks('DETALHE', {"ROWCOL" => "oLst:oPdf:pRow,0"}, "Totais Referentes a "+lTrim(Transform(ztNf,"@E 999,999"))+" NFs :")
      oLst:Run()
      oLst:End()
   endif
#FIM_TEXTO_FONTE
