;** Ed_0003 ********************************************************************
;** Impressao de Duplicata                             ** TRICUSTURA **        *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 01/01/1998 por Anivel Augusto Rodrigues
;Ultima Alteracao: 10/07/2003 por Karen Lauar Nery
;Motivo Alteracao: Mudanca ARQIMP
;*******************************************************************************

;**** Teste da Impressora ****
While True
  AGUARDE("Imprimindo Vencimentos")
  If Not PrinterStatus()
     Then MENSAGEM("Impressora Fora de Linha ou Desligada")
          CONFGERAL("Imprime Vencimentos")
          If OK="S"
             Then Loop
             Else Return
          EndIf
     Else QuitLoop
  EndIf
EndWhile

Print File ARQIMP CI_10CPP
Print File ARQIMP CI_8LPP

Print File ARQIMP "\n\n"

;********* Imprime Vencimentos*********
For I From 1 To 12
    dtvencto[i]=BlankDate()
    valorven[i]=BlankNum()
EndFor

Moveto "FaturaV"
Moveto [Numero da OF]
Locate [FaturaC->Numero da OF]
If RetVal
   Then i=0
        While [Numero da OF] = [FaturaC->Numero da OF]
          i=i+1
          dtvencto[i] = [Data ]
          valorven[i] = [Valor]
          Skip
          If EOT()
             Then QuitLoop
          Endif
        EndWhile
Endif
Moveto "FaturaC"
i=1

While valorven[i] <> BlankNum()

      ESCEXT(valorven[i])

      Print File ARQIMP "\n"

      Print File ARQIMP "Empresa: "+Format("W20,Al",[Faturac->Nome Fantasia Empresa])
      Print File ARQIMP Spaces(04)+"Emissao: "+Format("D13",[Faturac->Data de Emissao])+Spaces(04)
      If [NotaC->Descricao CondPagto]="CONTRA APRESENTACAO"
         Then Print File ARQIMP "Vencimento: "+"C.APRESENT \n"
         Else Print File ARQIMP "Vencimento: "+AlinhM(LTrim(StrVal(Format("D13",dtvencto[i]))),10)+"\n"
      EndIf

      Print File ARQIMP "\n\n"

      If Not IsBlank(dtvencto[2])
         Then Print File ARQIMP Spaces(12)+"Documento: "+Format("W08,AR",(NOTAFISC+"  "))
              Print File ARQIMP Spaces(03)+"Duplicata: "+Format("W08,AR",(NOTAFISC+"/"+CHR(65+i-1)))
              Print File ARQIMP Spaces(03)+"Valor:"+Format("W08.2,EIC",valorven[i])+"\n"
         Else Print File ARQIMP Spaces(12)+"Documento:"+Format("W08,AR",(NOTAFISC+"  "))
              Print File ARQIMP Spaces(03)+"Duplicata:"+Format("W08,AR",(NOTAFISC+"  "))
              Print File ARQIMP Spaces(03)+"Valor:"+Format("W08.2,EIC",valorven[i])+"\n"
      EndIf

      Print File ARQIMP "\n"

      Print File ARQIMP Spaces(20)+"Cliente: "+Format("W4,AR",[Codigo])+" "+Format("W40,Al",[Razao Social])+"\n"
      Print File ARQIMP Spaces(29)+Format("W18,AL",[CGC])+"\n"
      Print File ARQIMP Spaces(29)+Format("W40,AL",[Endereco])+"\n\n"

      Print File ARQIMP "\n"
      Print File ARQIMP Spaces(20) + "Extenso:"+SubStr(EXTENSO,001,51) + "\n"
      Print File ARQIMP Spaces(29) + SubStr(EXTENSO,052,51) + "\n"
      Print File ARQIMP Spaces(29) + SubStr(EXTENSO,103,51) + "\n"
      Print File ARQIMP "\n\n"

      Print File ARQIMP Spaces(35)+"_______________________________"+"\n"
      Print File ARQIMP Spaces(37)+Format("W40,Al",[Razao Social])+"\n"

      Print File ARQIMP "------------------------------------------------------------------------------"

      i=i+1

EndWhile

Print File ARQIMP CI_INEG
Print File ARQIMP "\n\n"
Print File ARQIMP CI_FNEG
LIMPAGUARDE()
