;** Ed_0079   ******************************************************************
;*  Emissao de Duplicatas                              Isabela Garcia          *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 31/10/2002 por Anivel Augusto Rodrigues
;Alterado em     : 26/01/2006 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes
;Alterado em     : 29/06/2006 por Antonio Marcelo Alves
;Motivo Alteracao: Inclusao ImpriArq()
;Ultima Alteracao: 14/08/2007 por Antonio Marcelo Alves
;Motivo Alteracao: Ajustes Deleta_Arquivo

;*******************************************************************************
;* Rotina de Impressao de Duplicatas                                           *
;*******************************************************************************

MSG=Format("W06,AL",NoNota[1])
If [Ordem do Documento]<>""
   Then MSG=MSG+"/"+[Ordem do Documento]
EndIf

ConfGeral("Prepare Formulario, Docto: "+MSG+"//Continuar a impress„o ?")
If OK<>"S"
   Then Return
EndIf


ArqImp=PrivDir()+"EmitDup.Txt"
If IsFile(ArqImp)
   Then Deleta_Arquivo(ArqImp)
EndIf

Print File ARQIMP CI_10CPP
Print File ARQIMP CI_8LPP

Print File ARQIMP "\n\n\n\n\n\n"

Print File ARQIMP Spaces(61) + AlinhM(LTrim(StrVal(Format("D13",[Answer->Data de Emissao]))),10)+"\n"

Print File ARQIMP "\n\n\n\n"

Print File ARQIMP Spaces(23)
Print File ARQIMP Format("W08,AL",NoNota[1])
Print File ARQIMP Format("W12.2,EIC,AR",[Valor Duplicata])
Print File ARQIMP Spaces(2)+Format("W6,AC",[Answer->Numero do Documento])
If [Ordem do Documento]<>""
   Then Print File ARQIMP "/"+[Ordem do Documento]
   Else Print File ARQIMP "  "
EndIf
If [NotaC->Descricao CondPagto]="CONTRA APRESENTACAO"
   Then Print File ARQIMP Spaces(1)+"C.APRESENT \n"
   Else Print File ARQIMP Spaces(1)+AlinhM(LTrim(StrVal(Format("D13",[Data Vencimento]))),10)+"\n"
EndIf

Print File ARQIMP "\n\n"

Print File ARQIMP Format("W9,AR",NoNota[3])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[3])
Print File ARQIMP Spaces(33) + Format("D13",[Data Limite Desconto])+ "\n"

Print File ARQIMP Format("W9,AR",NoNota[4])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[4])+ "\n"

Print File ARQIMP Format("W9,AR",NoNota[5])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[5])
Print File ARQIMP Spaces(16) + [Answer->Condicoes Especiais]
VALOR_JUROS=([Valor Duplicata]*([Taxa de Juros]/[NDias Taxa de Juros]))/100
If VALOR_JUROS>0
   Then Print File ARQIMP "Juros: "+LTrim(Format("W7.2,EIC",VALOR_JUROS))
        Print File ARQIMP "/Dia"
EndIf
Print File ARQIMP "\n"

Print File ARQIMP Format("W9,AR",NoNota[6])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[6]) + "\n"

Print File ARQIMP Format("W9,AR",NoNota[7])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[7])
Print File ARQIMP Spaces(15) + [Answer->Razao Social Fatura]+" - "+[Answer->Codigo]+"\n"

Print File ARQIMP Format("W9,AR",NoNota[8])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[8])
Print File ARQIMP Spaces(15) + Format("W40,AL",[Answer->Endereco Fatura])+"\n"

Print File ARQIMP Format("W9,AR",NoNota[9])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[9])
Print File ARQIMP Spaces(15) + Format("W31,AL",[Answer->Bairro Fatura])
Print File ARQIMP Format("W10,AL",[Answer->CEP Fatura])+"\n"

Print File ARQIMP Format("W9,AR",NoNota[10])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[10]) + "\n"

Print File ARQIMP Format("W9,AR",NoNota[11])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[11])
Print File ARQIMP Spaces(15) + Format("W31,AL",[Answer->Cidade Fatura])
Print File ARQIMP Format("W02,AL",[Answer->UF Fatura])+"\n"

Print File ARQIMP Format("W9,AR",NoNota[12])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[12])
If Not IsBlank([Answer->Cidade de Cobranca])
   Then Print File ARQIMP Spaces(15) + [Answer->Cidade de Cobranca] + "/" + [Answer->UF de Cobranca]
        Print File ARQIMP " - " + [Answer->Cep de Cobranca] + "\n"
   Else Print File ARQIMP Spaces(15)+"O MESMO \n"
EndIf

Print File ARQIMP Format("W9,AR",NoNota[13])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[13]) + "\n"

Print File ARQIMP Format("W9,AR",NoNota[14])
Print File ARQIMP Format("W12.2,EIC,AR",VrNota[14])
Print File ARQIMP Spaces(13) + Format("W27,AL",[Answer->CGC Fatura])
Print File ARQIMP Format("W20,AL",[Answer->IE Fatura])+"\n\n"

ESCEXT([Valor Duplicata])

Print File ARQIMP Spaces(30) + SubStr(EXTENSO,001,50) + "\n\n\n"
Print File ARQIMP Spaces(30) + SubStr(EXTENSO,051,50) + "\n"

Print File ARQIMP CI_10CPP
Print File ARQIMP CI_6LPP

Print File ARQIMP "\f"

;---- Imprime Arquivo Impressao ------------------------------------------------
ImpriArq(ARQIMP)

