Пример #1
0
        private static void PrintViaLink(RichEditDocumentServer srv)
        {
            if (!srv.IsPrintingAvailable)
            {
                return;
            }
            using (PrintingSystemBase ps = new PrintingSystemBase())
                using (PrintableComponentLinkBase link = new PrintableComponentLinkBase(ps)) {
                    link.Component = srv;
                    // Disable warnings.
                    ps.ShowMarginsWarning    = false;
                    ps.ShowPrintStatusDialog = false;
                    // Find a printer containing 'Canon' in its name.
                    string printerName = String.Empty;
                    for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
                    {
                        string pName = PrinterSettings.InstalledPrinters[i];
                        if (pName.Contains("PDF"))
                        {
                            printerName = pName;
                            break;
                        }
                    }

                    //Run document creaion
                    link.CreateDocument();

                    // Print to the specified printer.
                    PrintToolBase tool = new PrintToolBase(ps);
                    tool.Print(printerName);
                }
        }
Пример #2
0
        public void autoPrintDocument(XtraReport rep)
        {
            rep.CreateDocument();
            PrintToolBase toolPrint = new PrintToolBase(rep.PrintingSystem);

            toolPrint.Print(Methods.PRINTER);
        }
Пример #3
0
        private void PrintOrderReport(int OrderID)
        {
            XtraReport report = new OrderReport();

            report.DataSource = service.OrderReportSource(OrderID);
            report.RollPaper  = true;
            //var path = System.IO.Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\ReportsPDf\");
            //report.ExportToPdf(path +  Order.OrderNumberForShift + ".pdf");
            //report.CreateDocument();
            try {
                PrintToolBase tool = new PrintToolBase(report.PrintingSystem);
                tool.Print();
            }
            catch
            {
            }
        }
Пример #4
0
        public PartialViewResult GetReport(int OrderID)
        {
            XtraReport report = new OrderReport();

            report.DataSource = service.OrderReportSource(OrderID);
            report.RollPaper  = true;


            report.CreateDocument();
            try
            {
                PrintToolBase tool = new PrintToolBase(report.PrintingSystem);
                tool.Print();
            }
            catch
            {
            }
            return(PartialView(report));
        }
Пример #5
0
        private void OnTimedEvent(object sender, ElapsedEventArgs e)
        {
            #region Variables
            tb_sis_reporte_x_tb_empresa_Bus bus_rep_x_emp     = new tb_sis_reporte_x_tb_empresa_Bus();
            tb_ColaImpresionDirecta_Bus     bus_colaImpresion = new tb_ColaImpresionDirecta_Bus();
            string  RootReporte = System.IO.Path.GetTempPath() + "Rpt_Facturacion.repx";
            string  IPLocal     = string.Empty;
            int     IdSucursal  = 0;
            int     IdBodega    = 0;
            decimal IdCbteVta   = 0;
            #endregion

            #region GetIPAdress

            var host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (var ip in host.AddressList)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                {
                    IPLocal = ip.ToString();
                }
            }
            #endregion

            #region GetImpresion
            var Impresion = bus_colaImpresion.GetInfoPorImprimir(IPLocal);
            if (Impresion == null)
            {
                return;
            }

            bus_colaImpresion.ModificarDB(Impresion);
            #endregion

            try
            {
                var reporte = bus_rep_x_emp.GetInfo(Impresion.IdEmpresa, Impresion.CodReporte);
                if (!string.IsNullOrEmpty(Impresion.Parametros))
                {
                    string[] array = Impresion.Parametros.Split(',');
                    if (array.Count() > 2)
                    {
                        IdSucursal = Convert.ToInt32(array[0]);
                        IdBodega   = Convert.ToInt32(array[1]);
                        IdCbteVta  = Convert.ToDecimal(array[2]);
                    }
                }
                #region


                switch (Impresion.CodReporte)
                {
                case "FAC_003":
                    FAC_003_Rpt RPT_003 = new FAC_003_Rpt();

                    #region Cargo diseño desde base
                    if (reporte != null)
                    {
                        System.IO.File.WriteAllBytes(RootReporte, reporte.ReporteDisenio);
                        RPT_003.LoadLayout(RootReporte);
                    }
                    #endregion

                    #region Parametros
                    if (!string.IsNullOrEmpty(Impresion.Parametros))
                    {
                        RPT_003.p_IdEmpresa.Value      = Impresion.IdEmpresa;
                        RPT_003.p_IdBodega.Value       = IdBodega;
                        RPT_003.p_IdSucursal.Value     = IdSucursal;
                        RPT_003.p_IdCbteVta.Value      = IdCbteVta;
                        RPT_003.p_mostrar_cuotas.Value = false;
                        RPT_003.PrinterName            = Impresion.IPImpresora;
                        RPT_003.CreateDocument();
                    }
                    #endregion

                    PrintToolBase tool003 = new PrintToolBase(RPT_003.PrintingSystem);
                    for (int i = 0; i < Impresion.NumCopias; i++)
                    {
                        if (string.IsNullOrEmpty(Impresion.IPImpresora))
                        {
                            tool003.Print();
                        }
                        else
                        {
                            tool003.Print(Impresion.IPImpresora);
                        }
                    }
                    break;

                case "FAC_013":
                    FAC_013_Rpt RPT_013 = new FAC_013_Rpt();

                    #region Cargo diseño desde base
                    if (reporte != null)
                    {
                        System.IO.File.WriteAllBytes(RootReporte, reporte.ReporteDisenio);
                        RPT_013.LoadLayout(RootReporte);
                    }
                    #endregion

                    #region Parametros
                    if (!string.IsNullOrEmpty(Impresion.Parametros))
                    {
                        RPT_013.p_IdEmpresa.Value  = Impresion.IdEmpresa;
                        RPT_013.p_IdBodega.Value   = IdBodega;
                        RPT_013.p_IdSucursal.Value = IdSucursal;
                        RPT_013.p_IdCbteVta.Value  = IdCbteVta;
                        RPT_013.PrinterName        = Impresion.IPImpresora;
                        RPT_013.CreateDocument();
                    }
                    #endregion
                    PrintToolBase tool013 = new PrintToolBase(RPT_013.PrintingSystem);
                    for (int i = 0; i < Impresion.NumCopias; i++)
                    {
                        if (string.IsNullOrEmpty(Impresion.IPImpresora))
                        {
                            tool013.Print();
                        }
                        else
                        {
                            tool013.Print(Impresion.IPImpresora);
                        }
                    }
                    break;
                }
                #endregion
                bus_colaImpresion.ModificarDB(Impresion);
            }
            catch (Exception ex)
            {
                Impresion.Comentario = ex.Message.ToString();
                bus_colaImpresion.ModificarDB(Impresion);
            }
        }