Librería

Clase

Metodo

AhoraListados

Listados

ListadoaPDF


Implementación:


 Public Sub ListadoaPDF(
     aIdDocListado As Long,
     aWhere As String,
     aObjeto As Object,
     aFileName As String)
  
   Dim lFrmInf As frmVisorInforme
   Dim lFileName As String
   Dim lPathListado As String
  
   Set lFrmInf = New frmVisorInforme
   lPathListado = gCn.Sesion.ParametroValor("PATHLISTADOS")
   If Right(lPathListado, 1) <> "\" Then
     lPathListado = lPathListado & "\"
   End If
   lFileName = ""
  
   lFrmInf.Carga lPathListado & gCn.DameValorCampo("SELECT Fichero FROM CEESI_Listados WHERE IdDoc=" & aIdDocListado), aWhere, False, 1, False, aObjeto, False, Me, "", aIdDocListado, True, lFileName
  
   aFileName = lFileName
  
 End Sub


Descripción:


Utilizando el formulario visor de informes, con el listado indicado aplicado al objeto indicado, genera el informe en un archivo formato PDF y devuelve su nombre.


Código C#:

using AhoraCl;
using AhoraOCX;
using AhoraSistema;
using System;
using static AhoraCore.VBA.Interaction;

namespace AhoraScriptsVacia
{
    public class Script_33 : AhoraOCX.AhoraBaseScript
    {
        public void Main()
        {
            Object[] lParam_AP_ListadoAPDF = { null, null, null, null };
            int lIdDocListado = 60;
            string lFileName = "";
            IItemColeccion lObjeto = gCn.Obj.DameObjeto("Articulos", "WHERE IdArticulo = '0'");
            lParam_AP_ListadoAPDF = new Object[] { lIdDocListado, "WHERE 1 = 1", lObjeto, lFileName};

            gCn.AhoraProceso("ListadoAPDF", out _, lParam_AP_ListadoAPDF);
            lFileName = lParam_AP_ListadoAPDF[3].ToString();

            MsgBox("Ruta fichero PDF: " +  lFileName);
        }
    }
}