;** EB_BB2 ********************************************************************
;*  Emissao de Boletas Banco do Brasil- Folha dupla                           *
;*****************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 19/06/2002 por Anivel Augusto Rodrigues
;Ultima Alteracao: 10/07/2003 por Karen Lauar Nery
;Motivo Alteracao: Mudanca ARQIMP

;*******************************************************************************
;* Rotina de Impressao de Duplicatas                                           *
;*******************************************************************************
If FIM_ARQUIVO And NBOL=1
   Then Return
EndIf

If NBOL=1 and Not FIM_ARQUIVO
   Then For wcc From 1 to 11
           Reg1[wcc]=""
           Reg2[wcc]=""
        Endfor

        Reg1[1]=strval([Data Vencimento])
        Reg1[2]=strval([Answer->Data de Emissao])
        Reg1[3]=[Numero do Documento]
        Reg1[4]=[Ordem do Documento]
        Reg1[5]=[Valor Duplicata]
        Reg1[6]=[Answer->Razao Social Fatura] + " - CGC "+[Answer->CGC Fatura]
        Reg1[7]=[Answer->Endereco Fatura]+" -  "+[Answer->Bairro Fatura]
        Reg1[8]=[Answer->Cidade Fatura]+"/"+[Answer->UF Fatura]+" -   "+[Answer->CEP Fatura]
        Reg1[9]=MSGDUP
        Reg1[10]="DP"
        Reg1[11]=VSDGBOLETA
EndIf
If NBOL=2 and Not FIM_ARQUIVO
   Then Reg2[1]=Strval([Data Vencimento])
        Reg2[2]=Strval([Answer->Data de Emissao])
        Reg2[3]=[Numero do Documento]
        Reg2[4]=[Ordem do Documento]
        Reg2[5]=[Valor Duplicata]
        Reg2[6]=[Answer->Razao Social Fatura] + " - CGC "+[Answer->CGC Fatura]
        Reg2[7]=[Answer->Endereco Fatura]+" -  "+[Answer->Bairro Fatura]
        Reg2[8]=[Answer->Cidade Fatura]+"/"+[Answer->UF Fatura]+" -   "+[Answer->CEP Fatura]
        Reg2[9]=MSGDUP
        Reg2[10]="DP"
        Reg2[11]=VSDGBOLETA
EndIf
NBOL=NBOL+1

If NBOL<3 And Not FIM_ARQUIVO
   Then Return
EndIf 

Print File ARQIMP CI_10CPP
Print File ARQIMP CI_8LPP

 Print File ARQIMP "\n"

 Print File ARQIMP Spaces(056)+Format("D13",(Reg1[1]))
 Print File ARQIMP Spaces(057)+Format("D13",(Reg2[1]))+"\n\n\n\n"

 Print File ARQIMP Spaces(02)+Format("W17,AL",(Reg1[2]))
 If Not (IsBlank(Reg1[4]))
    Then Print File ARQIMP Format("W12,AL",Reg1[3]+"/"+Reg1[4])
    Else Print File ARQIMP Format("W12,AL",Reg1[3])
 EndIf

 Print File ARQIMP Reg1[10]+Spaces(37)
 Print File ARQIMP Format("W17,AL",(Reg2[2]))
 If Not (IsBlank(Reg2[4]))
    Then Print File ARQIMP Format("W12,AL",Reg2[3]+"/"+Reg2[4])
    Else Print File ARQIMP Format("W12,AL",Reg2[3])
 EndIf
 Print File ARQIMP Reg2[10]
 Print File ARQIMP "\n"

 Print File ARQIMP "\n"

 Print File ARQIMP Spaces(57)+Format("W13.2,EIC,AL",Reg1[5])
 Print File ARQIMP Spaces(55)+Format("W12.2,EIC,AL",Reg2[5])+"\n"

 Print File ARQIMP "\n"

 Print File ARQIMP Spaces(05)+Format("W67,AL",SubStr(Reg1[9],1,40))+SubStr(Reg2[9],1,40)+"\n"
 Print File ARQIMP Spaces(05)+Format("W67,AL",SubStr(Reg1[9],41,40))+SubStr(Reg2[9],41,40)+"\n"
 Print File ARQIMP Spaces(05)+Format("W67,AL",SubStr(Reg1[9],81,40))+SubStr(Reg2[9],81,40)+"\n"
 Print File ARQIMP Spaces(05)+Format("W67,AL",SubStr(Reg1[9],121,30))+SubStr(Reg2[9],121,30)+"\n"
 Print File ARQIMP Spaces(05)+Format("W67,AL","NBOL: "+Reg1[11])+"NBOL: "+Reg2[11]+"\n"

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

 Print File ARQIMP Spaces(02)+Format("W68,AL",Reg1[6])+Reg2[6]+"\n"
 Print File ARQIMP Spaces(02)+Format("W68,AL",Reg1[7])+Reg2[7]+"\n"
 Print File ARQIMP Spaces(02)+Format("W68,AL",Reg1[8])+Reg2[8]+"\n"

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

 NBOL=1

Print File ARQIMP CI_10CPP
Print File ARQIMP CI_6LPP

