      Private RtfTemplate:="", RtfName:="", RtfOutTemplate:="", nRtfHandle:=0, RtfFontNumber, RtfFontSyze, RtfFontColor, RtfStyle, RtfHeader, RtfFooter, ;
         RtfFontList:={"Times New Roman", "Arial", "Courier New", "MS Sans Serif", "Verdana", "System", "Symbol"}
      Private htmName:="", nHtmHandle:=0, HtmJpgLogo:="", htmFgJaFezCabecalho:=.f., htm1FgJaFezColunas:=.f.
      Private pdfName:="", nPdfHandle:=0, pdfVetorLines:={}, aReport := array( PDF_PARAMLEN )
      Private n1RtfHandleTemplate:=0, RtfCab_Template:="", RtfDetalhe_Template:="", rtfRodape_Template:=""

   if RtfTemplate<>"" ; SplitTemplateRtf(@RtfTemplate, @RtfCab_Template, @RtfDetalhe_Template, @RtfRodape_Template)
   endif
   
      if RtfCab_Template<>"" // Se ainda nao fez o cabecalho rtf, eh porque nao processou nenhuma linha detalhe, entao processa e imprime o template rtf
         ProcessTemplateRtf(, @RtfDetalhe_Template) // Nao preciso mandar imprimir o cabecalho, pois sempre que a 'ProcessTemplateRtf' eh chamada ela tenta imprimir o cabecalho rtf, se nao foi impresso
      endif
      if RtfRodape_Template<>"" ; ProcessTemplateRtf(, @RtfRodape_Template)
      endif
      fClose( n1RtfHandleTemplate )
   
   

variavel hDadosEmp   = IdUsuarioPaf('Ler')
variavel zEmpnome    = hDadosEmp["EMP_NOME"]
variavel zEmprua     = hDadosEmp["EMP_RUA"]+" "+hDadosEmp["EMP_NUMRUA"]
variavel zEmpbairro  = hDadosEmp["EMP_BAIRRO"]
variavel zEmpcep     = hDadosEmp["EMP_CEP"]
variavel zEmpcidade  = hDadosEmp["EMP_CIDADE"]
variavel zEmpuf      = hDadosEmp["EMP_UF"]
variavel zEmpfone    = hDadosEmp["EMP_FONE"]
variavel zEmpinscest = hDadosEmp["EMP_IE"]
variavel zEmpisncmun = hDadosEmp["EMP_IM"]
variavel zEmpcgc     = hDadosEmp["CNPJ"]
variavel zEmpcgc     = if(!'.'$zEmpCgc, left(zEmpCgc,2)+'.'+SubStr(zEmpCgc,3,3)+'.'+SubStr(zEmpCgc,6,3)+'/'+SubStr(zEmpCgc,9,4)+'-'+SubStr(zEmpCgc,13,2), zEmpCgc)
variavel zEmail      = hDadosEmp["EMP_EMAIL"]

variavel zAreaOrig = Select()
variavel znil = if( select('sf_fat')=0, Abra ('0NOIDX', r_siga, sf_fat, "sf_fat",   sf_fat, 'fnum') , '')
variavel zfNum = Val( Left(cr_num_ped,6) )
variavel zfval = if( sf_fat->(DbSeek(zfNum)), sf_fat->fVal, sccrdup->cr_valor)
variavel znil = dbselectarea(zAreaOrig)

variavel z_parcela   = AllTrim(SubStr( cr_num_ped, 7))
variavel zcr_valor   = sccrdup->cr_valor
variavel zcr_num_ped = sccrdup->cr_num_ped
variavel zcr_dt_venc = sccrdup->cr_dt_venc

variavel m_cr_nome   = sccrcli->cr_nome
variavel m_cr_rua    = sccrcli->cr_rua
variavel m_cr_cidade = sccrcli->cr_cidade
variavel m_cr_uf     = sccrcli->cr_uf
variavel m_cr_cep    = sccrcli->cr_cep
variavel m_cr_cgc    = sccrcli->cr_cgc
variavel m_cr_est    = sccrcli->cr_insc_est

variavel z_extenso   = NumExt( sccrdup->cr_valor )
