;** ED_0296  *******************************************************************
;*  Emissao de Duplicatas                                    **  D'Almeida **  *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 09/07/2011 por Karina Andrade
;Ultima Alteracao: 08/11/2011 por Bruno Carvalho
;Motivo Alteracao: Ajustes na Serie dos Documentos
;Ultima Alteracao: 23/12/2013 por Bruno Carvalho
;Motivo Alteracao: Ajustes na impressÆo p/ coluna DISCRIMINACAO
;Ultima Alteracao: 23/12/2013 por Bruno Carvalho
;Motivo Alteracao: Adicionado Serie da Nota "SrNota"
;Ultima Alteracao: 20/05/2015 por Andrey Fillipe
;Motivo Alteracao: Ajustes para imprimir em formulario
;Ultima Alteracao: 25/08/2016 por Kamila Gomes
;Motivo Alteracao: Ajustes para imprimir em A4

;*******************************************************************************
;* Rotina de Impressao de Duplicatas                                           *
;*******************************************************************************
Print File ARQIMP CI_15CPP
Print File ARQIMP CI_8LPP

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

Print File ARQIMP Spaces(94) + AlinhM(LTrim(StrVal(Format("D10",[Answer->Data de Emissao]))),8)

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

VrNotaF = 0
For i From 1 To ArraySize(VrNota)
   If VrNota[i] = BlankNum() Then Loop EndIf
   VrNotaF = VrNotaF + VrNota[i]
Endfor

Print File ARQIMP Spaces(12) + Format("W11.2,EIC",VrNotaF)
Print File ARQIMP Spaces(04)
Print File ARQIMP Format("W06,AC",[Numero do Documento])
Print File ARQIMP Spaces(14)
Print File ARQIMP Format("W12.2,EIC",[Valor Duplicata])
Print File ARQIMP Spaces(06)+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(15)+"C.APRESENT"
   Else Print File ARQIMP Spaces(15)+AlinhM(LTrim(StrVal(Format("D10",[Data Vencimento]))),8)
EndIf
Print File ARQIMP "\n\n\n\n"

Print File ARQIMP Spaces(52) + Format("W11.2,EIC",[Valor do Desconto])
Print File ARQIMP Spaces(20) + Format("D10",[Data Limite Desconto])+"\n\n\n"

;**** 1§ Linha **************************************
Print File ARQIMP Spaces(06) + Format("W3,AL",DiaNota[1])                  
Print File ARQIMP Spaces(03) + Format("W6,AL",NoNota[1])
Print File ARQIMP Spaces(06) + Format("W11.2,EIC",VrNota[1]) 

Print File ARQIMP Spaces(24) + Format("W44,AL",[Answer->Condicoes Especiais])+ "\n"

If NoNota[1]<>" "
   Then Print File ARQIMP Spaces(14)+Format("W4,AL",SrNota[1])
   Else Print File ARQIMP Spaces(18)
EndIf  

VALOR_JUROS=([Valor Duplicata]*([Taxa de Juros]/[NDias Taxa de Juros]))/100
If VALOR_JUROS>0
   Then Print File ARQIMP Spaces(04)+"Juros: "+LTrim(Format("W7.2,EIC",VALOR_JUROS))
        Print File ARQIMP "/Dia"
EndIf
Print File ARQIMP "\n"

;**** 3§ Linha **************************************
Print File ARQIMP Spaces(06) + Format("W3,AL",DiaNota[2])
Print File ARQIMP Spaces(03) + Format("W6,AL",NoNota[2])
Print File ARQIMP Spaces(06) + Format("W11.2,EIC",VrNota[2])+Spaces(11)

Print File ARQIMP CI_6LPP
Print File ARQIMP Spaces(10) + Format("W47,AL",[Answer->Razao Social Fatura]+" - "+[Answer->Codigo])+"\n"

Print File ARQIMP CI_8LPP
If NoNota[2]<>" "
   Then Print File ARQIMP Spaces(14)+Format("W4,AL",SrNota[2])
        Print File ARQIMP Spaces(9)
   Else Print File ARQIMP Spaces(23)     
EndIf  

Print File ARQIMP CI_6LPP
If Not  IsBlank([Answer->Cidade de Cobranca])
   Then Print File ARQIMP Spaces(33) + Format("W40,AL",[Answer->Endereco de Cobranca])
        Print File ARQIMP Spaces(18) + Format("W02,AL",[Answer->UF de Cobranca])+"\n"
   Else Print File ARQIMP Spaces(33) + Format("W40,AL",[Answer->Endereco Fatura])
        Print File ARQIMP Spaces(18) + Format("W02,AL",[Answer->UF Fatura])+"\n"
EndIf

;**** 5§ Linha **************************************
Print File ARQIMP CI_8LPP
Print File ARQIMP Spaces(06) + Format("W3,AL",DiaNota[3])
Print File ARQIMP Spaces(03) + Format("W6,AL",NoNota[3])
Print File ARQIMP Spaces(06) + Format("W11.2,EIC",VrNota[3])+Spaces(11)

Print File ARQIMP CI_6LPP
If Not  IsBlank([Answer->Cidade de Cobranca])
   Then Print File ARQIMP Spaces(10) + Format("W34,AL",SubStr([Answer->Cidade de Cobranca]+"-"+[Answer->Bairro de Cobranca],1,30))
        Print File ARQIMP Spaces(21) + [Answer->CEP de Cobranca]
   Else Print File ARQIMP Spaces(10) + Format("W34,AL",SubStr([Answer->Cidade Fatura]+"-"+[Answer->Bairro Fatura],1,30))
        Print File ARQIMP Spaces(21) + [Answer->CEP Fatura]

EndIf
Print File ARQIMP "\n"

Print File ARQIMP CI_8LPP
If NoNota[3]<>" "
   Then Print File ARQIMP Spaces(14)+Format("W4,AL",SrNota[3])
        Print File ARQIMP Spaces(09)
   Else Print File ARQIMP Spaces(23)     
EndIf  

Print File ARQIMP CI_6LPP
If Not  IsBlank([Answer->Cidade de Cobranca])
   Then Print File ARQIMP Spaces(33) + [Answer->Cidade de Cobranca] + "/" + [Answer->UF de Cobranca]
        Print File ARQIMP " - " + [Answer->Cep de Cobranca] + "\n"
   Else Print File ARQIMP Spaces(33)+"O MESMO \n"
EndIf

;**** 7§ Linha **************************************
Print File ARQIMP CI_8LPP
Print File ARQIMP Spaces(06) + Format("W3,AL",DiaNota[4])
Print File ARQIMP Spaces(03) + Format("W6,AL",NoNota[4])
Print File ARQIMP Spaces(06) + Format("W11.2,EIC",VrNota[4])+Spaces(11)

Print File ARQIMP CI_6LPP
Print File ARQIMP Spaces(10) + Format("W20,AL",[Answer->CGC Fatura])
Print File ARQIMP Spaces(25) + Format("W15,AL",[Answer->IE Fatura])+"\n"

Print File ARQIMP CI_8LPP
If NoNota[4]<>" "
   Then Print File ARQIMP Spaces(14)+Format("W4,AL",SrNota[4])
        Print File ARQIMP Spaces(9)
   Else Print File ARQIMP Spaces(23)     
EndIf 
Print File ARQIMP CI_6LPP 
Print File ARQIMP Spaces(33) + Format("W30,AL",FONE)+"\n"

;**** 9§ Linha **************************************
Print File ARQIMP CI_8LPP
Print File ARQIMP Spaces(06) + Format("W3,AL",DiaNota[5])
Print File ARQIMP Spaces(03) + Format("W6,AL",NoNota[5])
Print File ARQIMP Spaces(06) + Format("W11.2,EIC",VrNota[5])+"\n"

Print File ARQIMP CI_8LPP
If NoNota[5]<>" "
   Then Print File ARQIMP Spaces(14)+Format("W4,AL",SrNota[5])
        Print File ARQIMP Spaces(9)
   Else Print File ARQIMP Spaces(23)     
EndIf  

Print File ARQIMP CI_6LPP
ESCEXT([Valor Duplicata])
Print File ARQIMP Spaces(29)+SubStr(EXTENSO,001,085) + "\n"
                  
;**** 11§ Linha **************************************
Print File ARQIMP CI_8LPP
Print File ARQIMP Spaces(06) + Format("W3,AL",DiaNota[6])
Print File ARQIMP Spaces(03) + Format("W6,AL",NoNota[6])
Print File ARQIMP Spaces(06) + Format("W11.2,EIC",VrNota[6])+Spaces(10)

Print File ARQIMP CI_6LPP
Print File ARQIMP Spaces(08)+ SubStr(EXTENSO,086,084) + "\n"

Print File ARQIMP CI_8LPP
If NoNota[6]<>" "
   Then Print File ARQIMP Spaces(14)+Format("W4,AL",SrNota[6])
        Print File ARQIMP Spaces(09)
   Else Print File ARQIMP Spaces(23)     
EndIf   

Print File ARQIMP CI_6LPP
Print File ARQIMP Spaces(30)+ SubStr(EXTENSO,170,084) + "\n"

;**** 13§ Linha **************************************
Print File ARQIMP CI_8LPP
Print File ARQIMP Spaces(06) + Format("W3,AL",DiaNota[7])
Print File ARQIMP Spaces(03) + Format("W6,AL",NoNota[7])
Print File ARQIMP Spaces(06) + Format("W11.2,EIC",VrNota[7])+"\n"

If NoNota[7]<>" "
   Then Print File ARQIMP Spaces(04)+Format("W4,AL",SrNota[7])    
EndIf
Print File ARQIMP "\n"

;**** 15§ Linha **************************************
Print File ARQIMP Spaces(06) + Format("W3,AL",DiaNota[8])
Print File ARQIMP Spaces(03) + Format("W6,AL",NoNota[8])
Print File ARQIMP Spaces(06) + Format("W11.2,EIC",VrNota[8])+"\n"

If NoNota[8]<>" "
   Then Print File ARQIMP Spaces(04)+Format("W4,AL",SrNota[8])
EndIf

;Print File ARQIMP "\f"
;Print File ARQIMP "\n\n\n\n\n"
If Num_Copia=1
   Then Print File ARQIMP "\n\n\n\n\n\n" 
   Else Print File ARQIMP CI_6LPP
        Print File ARQIMP "\f"    
        Num_Copia=0 
EndIf

Print File ARQIMP CI_10CPP
Print File ARQIMP CI_6LPP