;** Pd_0041 *******************************************************************
;** Imprime a Digitacao do Pedido               *** Mega Dias Distribuidora  ***
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 11/08/97 por Ricardo Augusto Silva
;Alterado em     : 13/04/2006 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes

;*******************************************************************************
;* Rotina para Impressao do Relatorio                                          *
;*******************************************************************************
Proc IMPPED()

;************************* IMPRESSAO DO CABECALHO *****************************
If Not IsAssigned(NOMEMPRESA)
   Then NOMEMPRESA=""
EndIf

Print File ARQIMP ASP1+CI_15CPP
Print File ARQIMP  "  ------------------------------------------------------------------------------------------------------------------------------------" + ASP2+"\n"
Print File ARQIMP ASP1+Spaces(02)+Format("W40,AL",NOMEMPRESA)+Spaces(15)+"Pedido de Venda"+Spaces(32)+"Impressao: "+Format("D13",Today())+"-"+Time()+ASP2+ "\n"
Print File ARQIMP ASP1+ "  ------------------------------------------------------------------------------------------------------------------------------------" +ASP2+ "\n"

Print File ARQIMP ASP1+Spaces(02)+"Cliente: "
Print File ARQIMP Format("W05,AL",[Codigo])
Print File ARQIMP Format("W97,AL",[Razao Social])
Print File ARQIMP "N§ do Pedido : "+Format("W06.3,AL",[Numero do Pedido])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(16)+Format("W40,AL",[Endereco])
Print File ARQIMP Format("W18,AL",[CGC])+Spaces(07)+"Emissao: "
Print File ARQIMP Format("D13",[Data de Emissao])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(16)+Format("W20,AL",[Bairro])
Print File ARQIMP Format("W20,AL",[CEP])
Print File ARQIMP Format("W25,AL",[IE])
Print File ARQIMP "Entrega: "+Format("D13",[Data de Entrega])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(16)+Format("W20,AL",[Cidade])
Print File ARQIMP Format("W20,AL",[UF])
Print File ARQIMP Format("W25,AL",[Telefone])
Print File ARQIMP "Empresa: "+Format("W05,AL",[Codigo da Empresa])+Format("W20,AL",[Nome Fantasia Empresa])+ASP2+"\n\n"


;********************* IMPRESSAO DOS ITENS ********************************
CONTADOR=0
Print File ARQIMP ASP1+Spaces(02)+"Sq Item                                                Cor/Tecido                Tm   Quantidade Un PrUnitario    PrTotal"+ASP2+"\n"
Print File ARQIMP ASP1+Spaces(02)+"-- --------------------------------------------------- ------------------------- --- ----------- -- ---------- ----------"+ASP2+"\n"
Moveto "PedidoI"
Scan
   Print File ARQIMP ASP1+Spaces(02)+Format("W03,AL",[Item do Pedido])
   Print File ARQIMP Format("W11,AL",[Codigo do Item])
   Print File ARQIMP Format("W41,AL",[Descricao do Item])
   Print File ARQIMP Format("W05,AL",[Codigo da Cor_Tecido])
   Print File ARQIMP Format("W21,AL",[Descricao da Cor_Tecido])
   Print File ARQIMP Format("W03,AR",[Tamanho])
   Print File ARQIMP Format("W12.3,EIC",[Quantidade])
   Print File ARQIMP Format("W03,AR",[Unidade Fiscal])
   Print File ARQIMP Format("W11.2,EIC",[Preco Unitario])
   Print File ARQIMP Format("W11.2,EIC",[Preco Total])+ASP2+"\n"
   CONTADOR=CONTADOR+1
EndScan
While CONTADOR < 15
  Print File ARQIMP ASP1+ASP2+"\n"
  CONTADOR=CONTADOR+1
EndWhile

;********************* IMPRESSAO DOS TOTAIS **************************
Moveto "PedidoC"
Print File ARQIMP ASP1+ASP2+"\n"
Print File ARQIMP ASP1+Spaces(77)+"  Mecadorias    Desconto     Liquido     Total     "+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(77)+Format("W12.2,EIC",[Valor Mercadoria])

If Not Isblank([Taxa de Desconto])
   Then Print File ARQIMP " "+Format("W10.2,EIC",[Taxa de Desconto])+"%"
   Else Print File ARQIMP "  "+Format("W10.2,EIC",[Valor do Desconto])
EndIf

Print File ARQIMP Format("W12.2,EIC",[Valor Mercadoria Liquido])
Print File ARQIMP Format("W010.2,EIC",[Valor Nota Fiscal])+ASP2+"\n"

;************************* IMPRESSAO DO RODAPE ********************************
Moveto "PedidoC"
Print File ARQIMP ASP1+Spaces(02)+"Obs. do Pedido..: "+Format("W110,AL",SubStr([Observacao do Pedido],001,110))+ASP2+"\n"
If Substr([Observacao do Pedido],111,110)<>""
   Then Print File ASP1+ARQIMP Spaces(20)+Format("W110,AL",SubStr([Observacao do Pedido],111,110))+ASP2+"\n"
   Else Print File ARQIMP ASP1+ASP2+"\n"
EndIf
Print File ARQIMP ASP1+Spaces(02)+"Representante: "+Format("W05,AL",[Codigo do Representante])
Print File ARQIMP Format("W25,AL",[Nome Fantasia Represent])+Spaces(43)+ "-------------------------------------"+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(95)+"Data/Assinatura Responsavel"+ASP2+"\n\n"
Print File ARQIMP ASP1+CI_10CPP
Print File ARQIMP CI_6LPP+ASP2
EndProc

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

Seta_FilePrint("PD_0041")
IMPPED()
Imprime_FilePrint("Imprimindo Pedido -> "+PEDIDO,"1")

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

