;** Or_0223 ********************************************************************
;** Imprime a Digitacao do Orcamento                 ** Fatima Designs **      *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 11/03/2009 por Anivel Augusto Rodrigues
;Alterado em     : 20/04/2009 por Nikolas
;Motivo Alteracao: Ajustes Layout

;*******************************************************************************
;* Rotina para Impressao do Relatorio                                          *
;*******************************************************************************
Proc IMPORC()
Moveto "OrcaC"

;************************* IMPRESSAO DO CABECALHO *****************************
If Not IsAssigned(NOMEMPRESA)
   Then NOMEMPRESA=""
EndIf
Print File ARQIMP ASP1+Chr(27)+Chr(67)+Chr(33)
Print File ARQIMP CI_15CPP
Print File ARQIMP CI_6LPP
;Print File ARQIMP       "------------------------------------------------------------------------------------------------------------------------------------" +ASP2+ "\n"
;Print File ARQIMP ASP1+ Format("W40,AL",NOMEMPRESA)+"              "+Spaces(02)+"Orcamento"+Spaces(37)+"Impressao: "+Format("D13",Today())+"-"+Time()+ ASP2+"\n"
;Print File ARQIMP ASP1+ "------------------------------------------------------------------------------------------------------------------------------------" +ASP2+ "\n"

;Print File ARQIMP ASP1+Format("W06,AL",[Codigo])

Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"
Print File ARQIMP Spaces(45)+"*** ORDEM DE SERVICO AVULSA ***"+"\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"
Print File ARQIMP "Data:        Nome:"+"\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"
Print File ARQIMP "Endereco:                                  Bairro:"+"\n\n"

Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"
Print File ARQIMP "Cidade:                         Tel.:                       Cel.:"+"\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"

Print File ARQIMP "Montador:                  Ruas proximas ao local:"+"\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"

Print File ARQIMP "Valor Previsto:              Obs.:"+"\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"

Print File ARQIMP "Explicacao do servico a ser prestado:"+"\n\n\n\n\n\n\n\n\n\n\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"

Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"
Print File ARQIMP Spaces(45)+"*** ORDEM DE SERVICO AVULSA ***"+"\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"
Print File ARQIMP "Data:        Nome:"+"\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"
Print File ARQIMP "Endereco:                                  Bairro:"+"\n\n"

Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"
Print File ARQIMP "Cidade:                         Tel.:                       Cel.:"+"\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"

Print File ARQIMP "Montador:                  Ruas proximas ao local:"+"\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"

Print File ARQIMP "Valor Previsto:              Obs.:"+"\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"

Print File ARQIMP "Explicacao do servico a ser prestado:"+"\n\n\n\n\n\n\n\n\n\n\n\n"
Print File ARQIMP ASP1+Fill("-",132)+ASP2+"\n"




;********************* IMPRESSAO DOS ITENS ********************************
wc=0
Moveto "OrcaI"
Scan For [Item do Orcamento]>0
   If wc=0 Then
      Print File ARQIMP ASP1+Spaces(02)+"Sq Item                                                Quantidade  Un PrUnitario    PrTotal"+ASP2+"\n"
      Print File ARQIMP ASP1+Spaces(02)+"-- --------------------------------------------------- ----------- -- ---------- ----------"+ASP2+"\n"
   EndIf

;   Print File ARQIMP ASP1+Spaces(02)+Format("W03,AL",[Item do Orcamento])
;   Print File ARQIMP Format("W11,AL",[Codigo do Item])
;   Print File ARQIMP Format("W41,AL",[Descricao do Item])
;   Print File ARQIMP Format("W11.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"
   wc=wc+1
EndScan

;If wc=0 Then
;   Print File ARQIMP ASP1+ "  ------------------------------------------------------------------------------------------------------------------------------------" +ASP2+ "\n"
;   Print File ARQIMP ASP1+ "  explicacao do servico a ser prestado" +ASP2+ "\n"
;EndIf

;For wi From wc To 8
;   Print File ARQIMP ASP1+ASP2+"\n"
;EndFor

;********************* IMPRESSAO DOS TOTAIS **************************
Moveto "OrcaC"
;Print File ARQIMP ASP1+ "  ------------------------------------------------------------------------------------------------------------------------------------" +ASP2+ "\n"
;If wc>0 Then
;   Print File ARQIMP ASP1+Spaces(50)+"  Mecadorias         Desconto     Liquido     Servico   Desp.Aces       Total "+ASP2+"\n"
                         ;;9.999.999,99888.88%777.777,776.666.666,664.444.444,441.111.111,112.222.222,22

;   Print File ARQIMP ASP1+Spaces(50)+Format("W12.2,EIC",[Valor Mercadoria])
;   Print File ARQIMP Format("W06.2,EIC",[Taxa de Desconto])+"%"
;   Print File ARQIMP Format("W10.2,EIC",[Valor do Desconto])
;   Print File ARQIMP Format("W12.2,EIC",[Valor Mercadoria Liquido])
;   Print File ARQIMP Format("W012.2,EIC",[Valor Servico])
;   Print File ARQIMP Format("W012.2,EIC",[Valor Despesas Acessorias])
;   Print File ARQIMP Format("W012.2,EIC",[Valor Nota Fiscal])+ASP2+"\n"

   Moveto"Orcacpg"
;   Aux=true
;   Scan
;     If Aux
;        Then Print File ARQIMP ASP1+Spaces(02)+"Cond.Pagto: "
;             Aux=false
;        Else Print File ARQIMP ASP1+Spaces(14)
;     endif
;     Print File ARQIMP Completa([Descricao CondPagto],22,".")
;     Print File ARQIMP Format("W010.2,EIC",[Orcac->Valor Nota Fiscal]+(([Orcac->Valor Nota Fiscal]*[Taxa Financeira])/100))+ASP2+"\n"
;   EndScan

   Moveto "Orcac"
;EndIf

;************************* IMPRESSAO DO RODAPE ********************************
Moveto "OrcaC"
;Print File ARQIMP ASP1+"  Observacao: "+Format("W120,AL",SubStr([Observacao do Orcamento],001,120))+ASP2+"\n"
;Print File ARQIMP ASP1+ASP2+"\n"

;Print File ARQIMP ASP1+ "  Fatima Designs - Rua Goias, 1.009 - Centro - 35.500.001 - Divinopolis/MG - 37 3213-1490 - fatimadesigns@hotmail.com                 "+ASP2+"\n"
Print File ARQIMP CI_10CPP
Print File ARQIMP CI_6LPP
Print File ARQIMP "\f"+ASP2
EndProc

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

Seta_FilePrint("OR_0012")
IMPORC()
Imprime_FilePrint("Imprimindo Orcamento -> "+ORCA,"1")

Release Vars VALOR,DATA
Release Procs IMPORC,
              Seta_FilePrint, Imprime_FilePrint
