Guest User

Untitled

a guest
Jan 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. Public Sub ImprimeDocPDF(TipoDoc As String, NumDoc As Long, Modelo As String, SerieDoc As String, varcaminho As String)
  2. Dim PSO As StdPlatBS
  3. Dim objConfPlat As StdBSConfApl
  4. Dim strMapa As String
  5. Dim StrSF As String
  6. Dim strFormula As String
  7. Dim strAssinatura As String
  8. Dim strInicializaParametros As String
  9. Dim Nome As String
  10. Dim Morada As String
  11. Dim Localidade As String
  12. Dim CodPostal As String
  13. Dim Telefone As String
  14. Dim Fax As String
  15. Dim Contribuinte As String
  16. Dim CapitalSocial As String
  17. Dim Conservatoria As String
  18. Dim Matricula As String
  19. Dim MoedaCapitalSocial As String
  20.  
  21. objConfPlat = New StdBSConfApl
  22. objConfPlat.AbvtApl = "GCP"
  23. objConfPlat.Instancia = "DEFAULT"
  24. objConfPlat.Utilizador = "utilizador"
  25. objConfPlat.PwdUtilizador = "PASSWORD"
  26.  
  27. objConfPlat.LicVersaoMinima = "9.00"
  28.  
  29.  
  30. Dim objTrans As StdBETransaccao
  31. objTrans = New StdBETransaccao
  32.  
  33. PSO = New StdPlatBS
  34. PSO.AbrePlataformaEmpresa(cmdarg(1), objTrans, objConfPlat, EnumTipoPlataforma.tpProfissional, "")
  35.  
  36. strMapa = "nomereport"
  37.  
  38. StrSF = "{CabecDoc.TipoDoc}='" & TipoDoc & "' AND {CabecDoc.Serie}='" & SerieDoc & "' AND {CabecDoc.NumDoc}=" & NumDoc
  39. PSO.Mapas.Inicializar("GCP")
  40.  
  41. Nome = PSO.Contexto.Empresa.IDNome
  42. Morada = PSO.Contexto.Empresa.IDMorada
  43. Localidade = PSO.Contexto.Empresa.IDLocalidade
  44. CodPostal = PSO.Contexto.Empresa.IDCodPostal & " " & PSO.Contexto.Empresa.IDCodPostalLocal
  45. Telefone = PSO.Contexto.Empresa.IDTelefone
  46. Fax = PSO.Contexto.Empresa.IDFax
  47. Contribuinte = PSO.Contexto.Empresa.IFNIF
  48. CapitalSocial = PSO.Contexto.Empresa.ICCapitalSocial
  49. Conservatoria = PSO.Contexto.Empresa.ICConservatoria
  50. Matricula = PSO.Contexto.Empresa.ICMatricula
  51. MoedaCapitalSocial = PSO.Contexto.Empresa.ICMoedaCapSocial
  52.  
  53. strFormula = "StringVar Nome:='" & Nome & "';" &
  54. "StringVar Morada:='" & Morada & "';" &
  55. "StringVar Localidade:='" & Localidade & "';" &
  56. "StringVar CodPostal:='" & CodPostal & "';" &
  57. "StringVar Telefone:='" & Telefone & "';" &
  58. "StringVar Fax:='" & Fax & "';" &
  59. "StringVar Contribuinte:='" & Contribuinte & "';" &
  60. "StringVar CapitalSocial:='" & CapitalSocial & "';" &
  61. "StringVar Conservatoria:='" & Conservatoria & "';" &
  62. "StringVar Matricula:='" & Matricula & "';" &
  63. "StringVar MoedaCapitalSocial:='" & MoedaCapitalSocial & "';"
  64.  
  65. strAssinatura = Motor.Comercial.Vendas.DevolveTextoAssinaturaDoc(TipoDoc, SerieDoc, NumDoc, "000")
  66.  
  67. strInicializaParametros =
  68. "NumberVar TipoDesc;" &
  69. "NumberVar DecQde;" &
  70. "NumberVar DecPrecUnit;" &
  71. "StringVar MotivoIsencao;" &
  72. "BooleanVar UltimaPag;" &
  73. "StringVar PRI_TextoCertificacao;" &
  74. "TipoDesc:= 0;" &
  75. "DecQde:=3;" &
  76. "DecPrecUnit:=" & PSO.FuncoesGlobais.DaCasasDecimais("Moedas", "DecArredonda") & ";" &
  77. "MotivoIsencao:='" & Motor.Contexto.IFMotivoIsencao & "';" &
  78. "UltimaPag := False;" &
  79. "PRI_TextoCertificacao:='" & strAssinatura & "';"
  80.  
  81. PSO.Mapas.SetFormula("DadosEmpresa", strFormula)
  82. PSO.Mapas.SetFormula("InicializaParametros", strInicializaParametros)
  83.  
  84. 'PSO.Mapas.Destino = CRPEExportDestino.edFicheiro
  85. 'PSO.Mapas.Destino = CRPEExportDestino.edNoExport
  86. 'PSO.Mapas.SetFileProp(CRPEExportFormat.efPdf, "c:/temp/DOCUMENTOAGORA.PDF")
  87. PSO.Mapas.SetFormula("DadosEmpresa", strFormula)
  88. PSO.Mapas.ImprimeListagem(strMapa, "Impressão de documentos em PDF", "W", , "S", StrSF, , , , , True)
  89. PSO.Mapas.TerminaJanelas()
  90. End Sub
Add Comment
Please, Sign In to add comment