;** PD_0341S *******************************************************************
;** Imprime a Digitacao do Pedido                   ** Casinha de Cachorro **  *
;*******************************************************************************
;Autor: Visao/Vise
;Desenvolvido  em: 22/02/2013 por Bruno Carvalho
;Ultima Alteracao: 18/03/2013 por Bruno Carvalho 
;Motivo Alteracao: Ajustes no layout de impressÆo do pedido

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

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

Moveto "PedidoC"

Print File ARQIMP CI_15CPP
Print File ARQIMP CI_8LPP

Print File ARQIMP "\015"
Print File ARQIMP "\n"
Print File ARQIMP Fill("=",57)+"\n"

Print File ARQIMP Spaces(34)+"Ordem de Servico "+[Numero do Pedido]+"\n\n"
Print File ARQIMP "\018"
Print File ARQIMP "\027E"+Spaces(11)+"PET SERVICE LTDA"+"\027F"+"\n"
Print File ARQIMP "\015"
Print File ARQIMP Format("W57,AC","AV . SETE DE SETEMBRO, 1300 - CENTRO")+"\n"   
Print File ARQIMP Format("W57,AC","DIVINOPOLIS - MG")+"\n"
Print File ARQIMP "\018"
Print File ARQIMP Spaces(11)+"(37) 3212-2493"+"\n"
Print File ARQIMP "\015"

Print File ARQIMP Fill("-",57)+"\n"
Print File ARQIMP "\018"
;Print File ARQIMP Spaces(7)+"Numero: "+[Numero do Pedido]+"\n"

DIA=AlinhM(StrVal(Day(Today())),2)
MES=Upper(StrVal(MesExt(Month(Today()))))
ANO=StrVal(Year(Today()))

DATA=StrVal(Format("D13,AL",[Data de Entrega]))
If Len(DATA)=9
   Then DATA="0"+DATA
EndIf   

Print File ARQIMP "\015"
Print File ARQIMP Format("W57,AC","DIVINOPOLIS, "+DIA+" DE "+MES+" DE "+ANO)+"\n\n"
Print File ARQIMP "\027E"+"NOME....: "+"\027F"+Format("W05,AL",[Codigo])+Format("W37,AL",[Nome Fantasia EmitDest])+"\n"
Print File ARQIMP "\027E"+"ANIMAL..: "+"\027F"+Format("W42,AL",[Livre])+"\n"
Print File ARQIMP "\027E"+"OBS.....: "+"\027F"+Format("W42,AL",[Observacao do Pedido])+"\n"
Print File ARQIMP "\027E"+"ENDERECO: "+"\027F"+Format("W42,AL",[Endereco])+"\n"
Print File ARQIMP "\027E"+"PREVISAO: "+"\027F"+DATA+" HORA: "+[Hora de Saida]+"\n"

;Print File ARQIMP Spaces(02)+"OBS...:"
;Moveto "PedidoC"
;If SubStr([Observacao na Nota Fiscal],001,73)<>""
;   Then Print File ARQIMP Format("W75,AL",SubStr([Observacao na Nota Fiscal],001,73))+"\n"
;EndIf

Print File ARQIMP Fill("-",57)+"\n"
Print File ARQIMP "QUANTIDADE PRODUTO/SERVICO                          VALOR"+"\n" 
Print File ARQIMP "---------- ----------------------------------- ----------"+"\n"

;QUANTIDADE PRODUTO/SERVICO                          VALOR  
;---------- ----------------------------------- ----------
;999.999,99 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 999.999,99
;---------------------------------------------------------
;                                        TOTAL: 999.999,99  
;---------------------------------------------------------

Moveto "PedidoI"
TOT  =0
Scan
 Print File ARQIMP Format("W10,AL",[Quantidade])+Spaces(1)
 Print File ARQIMP Format("W35,AL",[Descricao do Item])+Spaces(1)
 Print File ARQIMP Format("W10.2,EIC",[Preco Total])+"\n"

 TOT=TOT+[Preco Total]
EndScan

Print File ARQIMP Fill("-",57)+"\n"
Print File ARQIMP Spaces(40)+"TOTAL: "+Format("W10.2,EIC",TOT)+"\n"  
Print File ARQIMP Fill("=",57)+"\n"

EndProc ;IMPRO()

;*******************************************************************************
;* Rotina Principal                                                            *
;*****************+*************************************************************
ArqImp=PrivDir()+"PD_045S.Txt" 

If IsFile(ArqImp)
   Then Deleta_Arquivo(ARQIMP)
EndIf

AGUARDE("Imprimindo Ordem de Servi‡o -> "+[Numero do Pedido])
IMPRO()

;---- Imprime Arquivo Impressao ------------------------------------------------
ImpriArq(ARQIMP)

Release Vars CLIENTE,END_ENT,BAI_ENT,CID_ENT,CEP_ENT
Release Procs IMPRO
LIMPAGUARDE()