;** Ed_0121********************************************************************
;*  Emissao de Duplicatas                     SANTA ALICE AUTO FREIOS   ********
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 07/11/2005 por Nikolas M. Mateus
;Alterado em     : 03/02/2006 por Nikolas M. Mateus
;Motivo Alteracao: Inclusao do bairro e ajustes
;Alterado em     : 13/01/2017 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes dados fatura            
;Alterado em     : 17/08/2018 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes dupnf codigo do documento,Tipo do Documento
;Alterado em     : 30/08/2018 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes dupnf codigo do documento,Tipo do Documento [2..14]+ +1linha salto inicial

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

Print File ARQIMP CI_10CPP
Print File ARQIMP CI_6LPP

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

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

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

Print File ARQIMP Format("W12,AR",CodDoc[1]+"/"+NoNota[1])+Format("W09.2,EIC",VrNota[1])
Print File ARQIMP Spaces(02)+Format("W11.2,EIC,AR",[Answer->Valor Nota Fiscal])
Print File ARQIMP Spaces(03)+Format("W09,AC",[Answer->Numero do Documento])
Print File ARQIMP Format("W13.2,EIC,AR",[Valor Duplicata])
Print File ARQIMP Spaces(01)+Format("W6,AC",[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(01)+"C.APRESENT \n"
   Else Print File ARQIMP Spaces(01)+AlinhM(LTrim(StrVal(Format("D10",[Data Vencimento]))),08)+"\n"
EndIf
Print File ARQIMP Format("W12,AR",CodDoc[2]+"/"+NoNota[2])+Format("W09.2,EIC",VrNota[2])+"\n"

Print File ARQIMP Format("W12,AR",CodDoc[3]+"/"+NoNota[3])+Format("W09.2,EIC",VrNota[3])          
Print File ARQIMP Spaces(15) + Format("W29.2,EIC,AL",[Valor do Desconto])
Print File ARQIMP Spaces(08) + Format("D13",[Data Limite Desconto]) + "\n"

Print File ARQIMP Format("W12,AR",CodDoc[4]+"/"+NoNota[4])+Format("W09.2,EIC",VrNota[4])          
Print File ARQIMP Spaces(15) + [Answer->Condicoes Especiais]
VALOR_JUROS=([Valor Duplicata]*([Taxa de Juros]/[NDias Taxa de Juros]))/100
Print File ARQIMP "Juros: "+LTrim(Format("W7.2,EIC",VALOR_JUROS))
Print File ARQIMP " ao Dia"+"\n"

Print File ARQIMP Format("W12,AR",CodDoc[5]+"/"+NoNota[5])+Format("W09.2,EIC",VrNota[5])+"\n"          

Print File ARQIMP CI_15CPP

Print File ARQIMP Format("W12,AR",CodDoc[6]+"/"+NoNota[6])+Format("W09.2,EIC",VrNota[6])          
Print File ARQIMP Spaces(35) + [Answer->Razao Social Fatura]+" - "+[Answer->Codigo]+"\n"

Print File ARQIMP Format("W12,AR",CodDoc[7]+"/"+NoNota[7])+Format("W09.2,EIC",VrNota[7])          
Print File ARQIMP Spaces(35) + Format("w55,AL",[Answer->Endereco Fatura])
Print File ARQIMP " -"
Print File ARQIMP Spaces(01) + Format("W25,AL",[Answer->Bairro Fatura])+"\n"

Print File ARQIMP Format("W12,AR",CodDoc[8]+"/"+NoNota[8])+Format("W09.2,EIC",VrNota[8])          
Print File ARQIMP Spaces(35) + Format("W27,AL",[Answer->Cidade Fatura])+Spaces(03)+
                  [Answer->CEP Fatura]+" "+[Answer->UF Fatura]+"\n"

Print File ARQIMP Format("W12,AR",CodDoc[9]+"/"+NoNota[9])+Format("W09.2,EIC",VrNota[9])          
Print File ARQIMP Spaces(35) + [Answer->Endereco de Cobranca]
Print File ARQIMP " -"
Print File ARQIMP Spaces(02) + Format("W25,AL",[Answer->Bairro de Cobranca])+"\n"

Print File ARQIMP Format("W12,AR",CodDoc[10]+"/"+NoNota[10])+Format("W09.2,EIC",VrNota[10])          
If Not IsBlank([Answer->Cidade de Cobranca])
   Then Print File ARQIMP Spaces(35) + [Answer->Cidade de Cobranca] + "/" + [Answer->UF de Cobranca]
        Print File ARQIMP Spaces(03)+ Format("W10,AL",[Answer->CEP de Cobranca])+"\n"
   Else Print File ARQIMP "\n"
EndIf

Print File ARQIMP Format("W12,AR",CodDoc[11]+"/"+NoNota[11])+Format("W09.2,EIC",VrNota[11])          
Print File ARQIMP Spaces(35) + Format("W22,AL",[Answer->IE Fatura])+
                  " - "+[Answer->CGC Fatura]+"\n"

ESCEXT([Valor Duplicata])

Print File ARQIMP Format("W12,AR",CodDoc[12]+"/"+NoNota[12])+Format("W09.2,EIC",VrNota[12])          
Print File ARQIMP Spaces(34) + SubStr(EXTENSO,001,48) + "\n"
Print File ARQIMP Format("W12,AR",CodDoc[13]+"/"+NoNota[13])+Format("W09.2,EIC",VrNota[13])          
Print File ARQIMP Spaces(34) + SubStr(EXTENSO,052,48) + "\n"
Print File ARQIMP Format("W12,AR",CodDoc[14]+"/"+NoNota[14])+Format("W09.2,EIC",VrNota[14])          
Print File ARQIMP Spaces(34) + SubStr(EXTENSO,103,48) + "\n"

Print File ARQIMP CI_10CPP

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

Print File ARQIMP Spaces(05)+SubStr(MSGDUP,001,70)+"\n"
Print File ARQIMP Spaces(05)+SubStr(MSGDUP,071,141)+"\n"

Print File ARQIMP  CI_INEG

Print File ARQIMP "\n"
Print File ARQIMP  CI_FNEG

If [Codigo da Empresa]<>"0003"
   Then Print File ARQIMP "\n\n\n\n"
Endif


