Migration Imprimelistagem V9 - V10 in web application

Asked

Viewed 209 times

0

Good morning, I have a problem migrating Imprimelistagem from V9 to V10 in a web application.

    PriEngine.Platform.Mapas.Inicializar("VND")
    PriEngine.Platform.Mapas.Destino = CRPEExportDestino.edFicheiro
    PriEngine.Platform.Mapas.SelectionFormula = "{LinhasDoc.TipoLinha} <> '65' and {LinhasDoc.CDU_Confirmado} and {%Stock} > 0 and {LinhasDocStatus.EstadoTrans} <> 'T' and {CabecDoc.Documento} = " & Session("Documento") & ""
    PriEngine.Platform.Mapas.SetFileProp(CRPEExportFormat.efPdf, Server.MapPath("~\File\" & Session("Entidade") & ".pdf"))
    PriEngine.Platform.Mapas.ImprimeListagem("C:\Program Files (x86)\PRIMAVERA\SG100\Mapas\LP\NOVOS\NotaExecucao", "Pendentes", , 1, "N", , , False, False)

In V9 it worked perfectly and in this new version I have the following error:

Error loading report.

What I’m doing wrong?

Thank you

  • You’re passing all the necessary formulas?

  • @Sérgiosereno yes, besides it was working on V9.

2 answers

2


Good morning Bruno, do the following:

Copy the report to the GCP LP Maps folder.

Then, in the print request uses only the name of the report.

Use this example that I created and worked:

string Report = "NotaExec";
string Titulo = "documento vendas";
string Destino = "P";
short NumVias = 1;
string Documento = "S"; //Testei com "S" e com "N"
string Formula = "{CabecDoc.TipoDoc} = 'FA' and {CabecDoc.Serie} = 'C' and {CabecDoc.NumDoc} = 5";

PriEngine.Plataforma.Mapas.Inicializar("VND");
PriEngine.Plataforma.Mapas.Destino = CRPEExportDestino.edFicheiro;
PriEngine.Plataforma.Mapas.SetFileProp(CRPEExportFormat.efPdf, @"c:\fa1.pdf");
PriEngine.Plataforma.Mapas.ImprimeListagem(Report, Titulo, Destino, NumVias, Documento, Formula, CRPESentidoOrdenacao.soAscendente, false, true);

Note that the report name has to be the same as defined in the ERP.

  • Solved, thank you!

-1

Not knowing the type of report and with the lack of code, if you give more information it is easier to know and be able to analyze, but I still leave here this example that is working well. Also available on Github.

 public static void PrintInvoice(StdBSInterfPub pso,
            ErpBS bso,
            string reportPath,
            string DocType,
            string DocSeries,
            int DocNumber)
        {
            var reportTemplate = "GCPVLS01";

            try
            {
                var strSelFormula = $"{{CabecDoc.TipoDoc}}=\'{DocType}\' and {{CabecDoc.Serie}} = \'{DocSeries}\' AND {{CabecDoc.NumDoc}}={Convert.ToString(DocNumber)}";

                pso.Mapas.Inicializar("VND");

                var strFormula = new StringBuilder();
                strFormula.Append($"StringVar Nome:='{bso.Contexto.IDNome}';");
                strFormula.Append($"StringVar Morada:='{bso.Contexto.IDMorada}';");
                strFormula.Append($"StringVar Localidade:='{bso.Contexto.IDLocalidade}';");
                strFormula.Append($"StringVar CodPostal:='{bso.Contexto.IDCodPostal} {bso.Contexto.IDCodPostalLocal}';");
                strFormula.Append($"StringVar Telefone:='{bso.Contexto.IDTelefone}';");
                strFormula.Append($"StringVar Fax:='{bso.Contexto.IDFax}';");
                strFormula.Append($"StringVar Contribuinte:='{bso.Contexto.IFNIF}';");
                strFormula.Append($"StringVar CapitalSocial:='{bso.Contexto.ICCapitalSocial}';");
                strFormula.Append($"StringVar Conservatoria:='{bso.Contexto.ICConservatoria}';");
                strFormula.Append($"StringVar Matricula:='{bso.Contexto.ICMatricula}';");
                strFormula.Append($"StringVar MoedaCapitalSocial:='{bso.Contexto.ICMoedaCapSocial}';");

                pso.Mapas.SetFormula("DadosEmpresa", strFormula.ToString());

                var strParametros = new StringBuilder();
                strParametros.Append("NumberVar TipoDesc;");
                strParametros.Append("NumberVar DecQde;");
                strParametros.Append("NumberVar DecPrecUnit;");
                strParametros.Append("StringVar MotivoIsencao;");
                strParametros.Append("BooleanVar UltimaPag;");
                strParametros.Append("StringVar PRI_TextoCertificacao;");
                strParametros.Append("TipoDesc:= 0;");
                strParametros.Append("DecQde:=3;");
                strParametros.Append($"DecPrecUnit:={pso.FuncoesGlobais.DaCasasDecimais("Moedas", "DecArredonda")};");
                strParametros.Append("UltimaPag:=False;");
                strParametros.Append($"PRI_TextoCertificacao:='{bso.Vendas.Documentos.DevolveTextoAssinaturaDoc(DocType, DocSeries, DocNumber, "000")}';");

                pso.Mapas.SetFormula("InicializaParametros", strParametros.ToString());
                pso.Mapas.Destino = 0;
                pso.Mapas.SetFileProp(StdBSTipos.CRPEExportFormat.efPdf, reportPath);

                pso.Mapas.ImprimeListagem(reportTemplate, "Invoice", "P", 1, "N", strSelFormula, 0, false, true);
            }
            catch (Exception ex)
            {
                throw new Exception("Error while printing the document. \n" + ex.Message);
            }
        }
  • With this example gives exactly the same error...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.