Esempio n. 1
0
        public static void PrintToPrinter(EtiAplicacao etiApp, string DocFiscalYearCode, string DocSeccion, string DocType, int DocNumber)
        {
            Eticadata.Views.Reports.ReportsGcePOS report = new Views.Reports.ReportsGcePOS(etiApp, "", ERP.EtiEnums.ExportWebFormat.PDF);

            byte[] reportBytes;

            var rptProp = new Eticadata.Common.EtiReportProperties()
            {
                TpDocAEmitir        = TpDocumentoAEmitir.Vendas,
                AbrevTpDoc          = DocType,
                CodExercicio        = DocFiscalYearCode,
                CodSeccao           = DocSeccion,
                Numero              = DocNumber,
                EtiApp              = etiApp,
                ExportaFicheiro     = false,
                SoExportacao        = false,
                ToPrinter           = true,
                IncrementPrintCount = true,
                Application         = ReportApplication.BackOffice,
                ExportaFormato      = "1"
            };

            reportBytes = report.EmiteDocumentos(rptProp);

            if (!string.IsNullOrEmpty(rptProp.ErrorDescription))
            {
                throw new Exception(rptProp.ErrorDescription);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Depois de gravar a venda
        /// Imprimir o documento de venda alternativo
        /// </summary>
        /// <param name="etiApp"></param>
        /// <param name="sale"></param>
        internal void PrintAlternativeFile(EtiAplicacao etiApp, MovVenda sale)
        {
            ReportsGcePOS report = new ReportsGcePOS(etiApp, "", ExportWebFormat.PDF);

            var rptProp = new Eticadata.Common.EtiReportProperties()
            {
                FrontOffBackOff   = ReportApplication.BackOffice,
                PerfilPerifericos = -1,
                TpDocAEmitir      = TpDocumentoAEmitir.Vendas,
                ToPrinter         = true,
                CodExercicio      = sale.Cabecalho.CodExercicio,
                CodSeccao         = sale.Cabecalho.CodSeccao,
                AbrevTpDoc        = sale.Cabecalho.AbrevTpDoc,
                Numero            = sale.Cabecalho.Numero,
                ConfigImpressao   = 1,
                Gravacao          = false,
                Movimento         = 1,
                ReportName        = "VNDDocumentoA5.rpt",
                Entidade          = sale.Cabecalho.CodEntidade.ToString(),
                EtiApp            = etiApp,
            };

            System.Threading.Thread th = new System.Threading.Thread(() => report.EmiteDocumentos(rptProp));
            th.IsBackground = true;
            th.Start();
        }
Esempio n. 3
0
        /// <summary>
        /// Depois de Gravar Venda
        /// Imprimir um report personalizado
        /// </summary>
        /// <param name="etiApp"></param>
        /// <param name="sale"></param>
        internal void PrintReportPersonalized(EtiAplicacao etiApp, MovVenda sale)
        {
            var errors       = "";
            var customerName = "Sou o cliente XPTO";

            var rptProp = new Eticadata.Common.EtiReportProperties()
            {
                FrontOffBackOff         = ReportApplication.BackOffice,
                ReportServer_ReportPath = "Consultas",
                WindowTitle             = "Titulo do report personalizado",
                ReportName = "USR_TESTE.rdl",
                ToPrinter  = true,
                EtiApp     = etiApp,
            };

            //Adicionar parametros
            rptProp.AdicionarFormula($"CustomerName = {customerName}");

            System.Threading.Thread th = new System.Threading.Thread(() => Eticadata.Views.Reports.ReportsInit.MapaSimplesEmissao(rptProp, etiApp, null, null, ref errors));
            th.IsBackground = true;
            th.Start();
        }
        public IHttpActionResult PrintReport([FromBody] PrintInput docParams)
        {
            try
            {
                Eticadata.Views.Reports.ReportsGcePOS report = new Views.Reports.ReportsGcePOS(Eti.Aplicacao, "", ERP.EtiEnums.ExportWebFormat.PDF);
                EtiAplicacao etiapp = new EtiAplicacao();

                byte[] reportBytes;

                var rptProp = new Eticadata.Common.EtiReportProperties()
                {
                    TpDocAEmitir        = TpDocumentoAEmitir.Vendas,
                    AbrevTpDoc          = docParams.DocType,
                    CodExercicio        = docParams.DocFiscalYearCode,
                    CodSeccao           = docParams.DocSeccion,
                    Numero              = docParams.DocNumber,
                    EtiApp              = Eti.Aplicacao,
                    ExportaFicheiro     = false,
                    SoExportacao        = false,
                    ToPrinter           = true,
                    IncrementPrintCount = true,
                    //FrontOffBackOff = ReportApplication.BackOffice,
                    ExportaFormato = "1"
                };

                reportBytes = report.EmiteDocumentos(rptProp);

                if (!string.IsNullOrEmpty(rptProp.ErrorDescription))
                {
                    return(BadRequest(rptProp.ErrorDescription));
                }

                return(Ok(reportBytes));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }