;** NE_0148  *******************************************************************
;** Imprime a Digitacao da Nota de Entrada                 ** California       *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 21/03/2006 por Nikolas M. Mateus
;Alterado em     : 21/06/2007 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes

;*******************************************************************************
;* Rotina para Impressao do Relatorio                                          *
;*******************************************************************************
Proc IMPNE()
Cabecalho()

Moveto "NotaEI"
Scan
   Print File ARQIMP ASP1+Format("W03,AR",StrVal([Sequencia do Lancamento]))+Spaces(1)
   Print File ARQIMP Format("W11,AL",[Codigo_Fornecedor])
   Print File ARQIMP Format("W30,AL",[Descricao do Item])
   Print File ARQIMP Format("W11.3,EIC",[Quantidade])
   Print File ARQIMP Format("W03,AR",[Unidade Fiscal])
   Print File ARQIMP Format("W10.2,EIC",[Preco Unitario])
   Print File ARQIMP Format("W11.2,EIC",[Preco Total])+ASP2+"\n"

   Limite = Limite + 1
   If Limite > 62
      Then Print ASP1+"\f"+ASP2+"\n"
           Cabecalho()
           Moveto "NotaEI"
   Endif
EndScan

Rodape()
EndProc

;************************************************************************************
;Impressao do Cabecalho                                                             *
;************************************************************************************
Proc Cabecalho()

If Not IsAssigned(NOMEMPRESA)
   Then NOMEMPRESA=""
EndIf

Moveto "NotaEC"

Open Printer
Printer On

Print File ARQIMP ASP1+CI_10CPP+ASP2+"\n"
Print File ARQIMP ASP1+Format("W40,AL",NOMEMPRESA)+Spaces(04)+"Impressao: "+Format("D10",Today())+"-"+Time()+ASP2+ "\n\n"
If OK<>"I"
   Then Print File ARQIMP ASP1+Spaces(65)+"NE: "+Format("W06,AL",[Numero do Lancamento])+ASP2+ "\n"
   Else Print File ARQIMP ASP1+Spaces(46)+CI_INEG+CI_IEXP+"NE: "+Format("W06,AL",[Numero do Lancamento])+CI_FEXP+CI_FNEG+ASP2+ "\n"
EndIf
Print File ARQIMP ASP1+"Fornecedor: "+Format("W05,AL",[Codigo])+Format("W46,AL",[Razao Social])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(17)+Format("W20,AL",[CGC])+Format("W22,AL",[Cidade])
Print File ARQIMP Format("W05,AL",[UF])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(17)+"Docto: "+Format("W04,AL",[Tipo do Documento])+" "+Format("W13,AL",[Numero do Documento])
Print File ARQIMP "CFO: "+Format("W15,AL",[CFO])
Print File ARQIMP "OC: "+Format("W06,AL",[Numero da OC])+ASP2+"\n\n"

Print File ARQIMP ASP1+"Emissao...: "+Format("D13",[Data de Emissao])+Spaces(05)
Print File ARQIMP "Entrada: "+Format("D13",[Data de Entrada])+Spaces(05)
Print File ARQIMP "Operacao: "+Format("A20",[Descricao da Operacao])+ASP2+"\n"

Print File ARQIMP ASP1+"Represent.: "+Format("W05,AL",[Codigo do Representante])
Print File ARQIMP Format("W34,AL",[Nome Fantasia Represent])
Print File ARQIMP "TabPreco: "+Format("W06,AL",[Codigo da Tabela])+ASP2+"\n"

Print File ARQIMP ASP1+CI_10CPP+ASP2+"\n"
Print File ARQIMP ASP1+"Sq  Item                                      Quantidade Un  PrUnitar    PrTotal"+ASP2+"\n"
Print File ARQIMP ASP1+"--- ---------------------------------------- ----------- -- --------- ----------"+ASP2+"\n"

Limite=13
EndProc

;*******************************************************************************
;* Impressao do RodaP‚                                                         *
;*******************************************************************************
Proc RodaPe()

;********************* IMPRESSAO DOS TOTAIS **************************

Moveto "NotaEC"

Print File ARQIMP ASP1+""+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(05)+"  Mecadorias  Desconto     Liquido   Desp.Aces    Vr.Subst       Total"+ASP2+"\n"
                                 ;;9.999.999,99777.777,776.666.666,665.555.555,555.555.555,555.555.555,55

Print File ARQIMP ASP1+Spaces(05)+Format("W12.2,EIC",[Valor Mercadoria])
Print File ARQIMP Format("W10.2,EIC",[Valor Desconto])
Print File ARQIMP Format("W12.2,EIC",[Valor Mercadoria Liquido])
Print File ARQIMP Format("W12.2,EIC",[Valor Despesas Acessorias])
Print File ARQIMP Format("W12.2,EIC",[Valor Substituicao ICMS])
Print File ARQIMP Format("W12.2,EIC",[Valor Nota Fiscal])+CI_10CPP+ASP2+"\n\n"

Print File ARQIMP ASP1+"Cond. Pagto: "+[Descricao Tipo Pagamento]+"   Frete:"+Format("W10.2,EIC",[Valor do Frete])+ASP2+"\n"

;********************* IMPRESSAO DOS VENCIMENTOS **************************
Print File ARQIMP ASP1+"Vencimentos: "

Array DATA[9]
Array VALOR[9]
K=0
KV=0
Moveto "NotaECP"
Scan
  K=K+1
  DATA[K]  = Format("D13",[Data de Vencimento])
  VALOR[K] = Format("W10.2,AR,EIC",[Valor do Documento])
  If K=9
     Then VENC()
          K=0
  EndIf
EndScan
If K>0
   Then VENC()
EndIf


Moveto "NotaEC"

Print File ARQIMP ASP1+ASP2+"\n\n"

Print File ARQIMP ASP1+"Mercadoria recebida e conferida em ___/___/______  por _________________________"+ASP2+"\n\n"
Print File ARQIMP ASP1+"\f"+ASP2+"\n"
Print File ARQIMP ASP1+CI_10CPP+ASP2+"\n"
Print File ARQIMP ASP1+CI_6LPP+ASP2+"\n"
Printer Off
Close Printer

EndProc

;*******************************************************************************
;* Rotina de Impressao dos Vencimentos                                         *
;*******************************************************************************
Proc VENC()
If KV>0
   Then Print File ARQIMP ASP1+Spaces(13)
EndIf
For I From 1 to K
  Print File ARQIMP DATA[I]+Spaces(02)
EndFor
Print File ARQIMP ASP2+"\n"
Print File ARQIMP ASP1+Spaces(13)
For I From 1 to K
  Print File ARQIMP VALOR[I]+Spaces(02)
EndFor
Print File ARQIMP ASP2+"\n"

KV=KV+1
EndProc

;*******************************************************************************
;* Rotina Principal                                                            *
;*******************************************************************************

Seta_FilePrint("NE_0148")
IMPNE()
Imprime_FilePrint("Imprimindo NE -> "+NE,"R")

Release Vars VALOR,DATA
Release Procs IMPPED,VENC,Cabecalho,Rodape,
              Seta_FilePrint, Imprime_FilePrint


