Open only one Crystal screen (preview) - Spring BSS

0

Is there any way in the event before printing in ERP Primavera to open only one preview of the crystal so that later only one request is spooled of the printer with the paths all together, otherwise it was detected that when printing several users simultaneously the prints were shuffled.

    
asked by anonymous 03.05.2018 / 10:27

2 answers

0

To call the preview window through the API must do according to the code below.

Public Function ImprimeDocPdf(TipoDoc As String, NumDoc As Long, Caminho As 
String, SerieDoc As String)

'------------- Variaveis de configuração ----------
Dim strMapa As String
Dim StrSF As String
Dim strFormula As String
Dim strAssinatura As String
Dim strInicializaParametros As String
Dim Nome As String
Dim Morada As String
Dim Localidade As String
Dim CodPostal As String
Dim Telefone As String
Dim Fax As String
Dim Contribuinte As String
Dim CapitalSocial As String
Dim Conservatoria As String
Dim Matricula As String
Dim MoedaCapitalSocial As String


'------------------------------------------------------------------
strMapa = ""
StrSF = ""
'-----------------------------------------------------------------
'carrega dados
strMapa = BSO.Comercial.Series.DaConfig("V", TipoDoc, SerieDoc)

StrSF = "{CabecDoc.TipoDoc}='" & TipoDoc & "' AND {CabecDoc.Serie}='" & SerieDoc & "' AND {CabecDoc.NumDoc}=" & NumDoc

PSO.Mapas.Inicializar "GCP"

'------- Carrega dados vindos do priempre -------------------
Nome = BSO.Contexto.IDNome
Morada = BSO.Contexto.IDMorada
Localidade = BSO.Contexto.IDLocalidade
CodPostal = BSO.Contexto.IDCodPostal & "  " & BSO.Contexto.IDCodPostalLocal
Telefone = BSO.Contexto.IDTelefone
Fax = BSO.Contexto.IDFax
Contribuinte = BSO.Contexto.IFNIF
CapitalSocial = BSO.Contexto.ICCapitalSocial
Conservatoria = BSO.Contexto.ICConservatoria
Matricula = BSO.Contexto.ICMatricula
MoedaCapitalSocial = BSO.Contexto.ICMoedaCapSocial

strFormula = "StringVar Nome:='" & Nome & "';" & _
    "StringVar Morada:='" & Morada & "';" & _
    "StringVar Localidade:='" & Localidade & "';" & _
    "StringVar CodPostal:='" & CodPostal & "';" & _
    "StringVar Telefone:='" & Telefone & "';" & _
    "StringVar Fax:='" & Fax & "';" & _
    "StringVar Contribuinte:='" & Contribuinte & "';" & _
    "StringVar CapitalSocial:='" & CapitalSocial & "';" & _
    "StringVar Conservatoria:='" & Conservatoria & "';" & _
    "StringVar Matricula:='" & Matricula & "';" & _
    "StringVar MoedaCapitalSocial:='" & MoedaCapitalSocial & "';"

strAssinatura = BSO.Comercial.Vendas.DevolveTextoAssinaturaDoc(TipoDoc, SerieDoc, NumDoc, "000")

strInicializaParametros = _
    "NumberVar TipoDesc;" & _
    "NumberVar DecQde;" & _
    "NumberVar DecPrecUnit;" & _
    "StringVar  MotivoIsencao;" & _
    "BooleanVar UltimaPag;" & _
    "StringVar PRI_TextoCertificacao;" & _
    "TipoDesc:= 0;" & _
    "DecQde:=3;" & _
    "DecPrecUnit:=" & PSO.FuncoesGlobais.DaCasasDecimais("Moedas", "DecArredonda") & ";" & _
    "MotivoIsencao:='" & BSO.Contexto.IFMotivoIsencao & "';" & _
    "UltimaPag := False;" & _
    "PRI_TextoCertificacao:='" & strAssinatura & "';"

PSO.Mapas.SetFormula "DadosEmpresa", strFormula
PSO.Mapas.SetFormula "InicializaParametros", strInicializaParametros

PSO.Mapas.Destino = edNoExport


PSO.Mapas.SetFormula "DadosEmpresa", strFormula
PSO.Mapas.ImprimeListagem strMapa, "Impressão de documentos em PDF", "W", , "S", StrSF, , , , , True
PSO.Mapas.TerminaJanelas



Exit Function

Erro:
    MsgBox "Erro: " & Err.Number & " - " & Err.Description
    Set Emp = Nothing

End Function
    
03.05.2018 / 16:30
0

There is a little pragmatic alternative - it is only possible in publishers that have access and that have BeforePrint () events - that is to interpolate the ERP print calls by canceling them, and calling their own method that uses the printers the respective paths to a folder, which are later used to create a single PDF file. Thus, it is possible to make a single call in the spooler of printing avoiding confusions of several posts to send different calls by each way.

    
09.05.2018 / 10:25