コード例 #1
0
        public void ShowReport(string fileName, Form parentForm)
        {
            try
            {
                Cursor          tmp = this.Cursor;
                ResourceManager res = new ResourceManager("mz.erp.ui.forms.localization", this.GetType().Assembly);
                _viewer.Localize = res;

                //Cursor = Cursors.WaitCursor;
                MdiParent = parentForm;
                string path = this.getPath(fileName);
                if (File.Exists(path))
                {
                    StreamReader sr = new StreamReader(path);
                    DataDynamics.ActiveReports.ActiveReport rpt = new DataDynamics.ActiveReports.ActiveReport();
                    rpt.LoadLayout(sr.BaseStream);
                    //DataDynamics.ActiveReports.DataSources.SqlDBDataSource sqlDS = (DataDynamics.ActiveReports.DataSources.SqlDBDataSource)rpt.DataSource;
                    //sqlDS.ConnectionString = dbhelper.Connection.GetConnection().ConnectionString;
                    //rpt.DataSource = sqlDS;

                    //rpt.AddNamedItem("Empresa",Variables.GetValueString("Sistema.NombreEmpresa"));

                    rpt.Run();

                    _viewer.Document = rpt.Document;
                    Show();
                }
                else
                {
                    Errores.MessageFileNotFound();
                }
            }
            catch (Exception e) {; }
        }
コード例 #2
0
        private void ShowReport(string fileName, Form parentForm)
        {
            try
            {
                Cursor          tmp = this.Cursor;
                ResourceManager res = new ResourceManager("mz.erp.ui.forms.localization", this.GetType().Assembly);
                _viewer.Localize = res;

                //Cursor = Cursors.WaitCursor;
                MdiParent = parentForm;
                string path = this.getPath(fileName);
                if (File.Exists(path))
                {
                    StreamReader sr = new StreamReader(path);
                    DataDynamics.ActiveReports.ActiveReport rpt = new DataDynamics.ActiveReports.ActiveReport();
                    rpt.LoadLayout(sr.BaseStream);

                    rpt.Run();

                    _viewer.Document = rpt.Document;
                    ShowDialog();
                }
                else
                {
                    Errores.MessageFileNotFound();
                }
            }
            catch (Exception e) {; }
        }
コード例 #3
0
        private void ShowReport(System.Data.DataTable table, string fileName, Form parentForm, ReportParameterCollection parameters, bool show, bool print, bool printSetup, bool printProgress)
        {
            ResourceManager res = new ResourceManager("mz.erp.ui.forms.localization", this.GetType().Assembly);

            _viewer.Localize = res;
            try
            {
                string path = this.getPath(fileName);
                MdiParent = parentForm;
                if (File.Exists(path))
                {
                    StreamReader sr = new StreamReader(path);
                    DataDynamics.ActiveReports.ActiveReport rpt = new DataDynamics.ActiveReports.ActiveReport();



                    rpt.LoadLayout(sr.BaseStream);

                    DataDynamics.ActiveReports.DataSources.SqlDBDataSource sqlDS = (DataDynamics.ActiveReports.DataSources.SqlDBDataSource)rpt.DataSource;
                    rpt.DataSource = table;
                    rpt.AddNamedItem("Empresa", _uiController.Empresa);
                    rpt.AddNamedItem("DireccionEmpresa", _uiController.DireccionEmpresa);
                    rpt.AddNamedItem("TelefonoEmpresa", _uiController.TelefonoEmpresa);
                    rpt.AddNamedItem("Usuario", _uiController.Usuario);


                    FormatParameters(rpt, parameters);

                    rpt.Run();

                    _viewer.Document = rpt.Document;
                    if (show)
                    {
                        Show();
                    }
                    if (print)
                    {
                        //Deprecated
                        //rpt.Document.Print(printSetup, printProgress);
                        rpt.Document.Print(printSetup, printProgress, false);
                    }
                }
                else
                {
                    Errores.MessageFileNotFound();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #4
0
        public void ShowReport(System.Data.DataTable table, string fileName, Form parentForm, object[] parameters)
        {
            ResourceManager res = new ResourceManager("mz.erp.ui.forms.localization", this.GetType().Assembly);

            _viewer.Localize = res;
            try
            {
                string path = this.getPath(fileName);
                MdiParent = parentForm;
                if (File.Exists(path))
                {
                    StreamReader sr = new StreamReader(path);
                    DataDynamics.ActiveReports.ActiveReport rpt = new DataDynamics.ActiveReports.ActiveReport();


                    rpt.LoadLayout(sr.BaseStream);

                    DataDynamics.ActiveReports.DataSources.SqlDBDataSource sqlDS = (DataDynamics.ActiveReports.DataSources.SqlDBDataSource)rpt.DataSource;
                    rpt.DataSource = table.DefaultView;


                    Console.WriteLine("Vivi");
                    rpt.AddNamedItem("Empresa", Variables.GetValueString("Sistema.NombreEmpresa"));
                    FormatParameters(rpt, parameters);


                    rpt.Run();



                    _viewer.Document = rpt.Document;
                    Show();
                }

                else
                {
                    Errores.MessageFileNotFound();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #5
0
        /*
         * private void ShowReport(System.Data.DataView table,string fileName, Form parentForm ,ReportParameterCollection parameters, bool show, bool print, bool printSetup, bool printProgress, bool askPrint)
         * {
         *
         *  ResourceManager res = new ResourceManager("mz.erp.ui.forms.localization", this.GetType().Assembly);
         *  _viewer.Localize = res;
         *  try
         *  {
         *
         *
         *      string path = this.getPath(fileName);
         *      MdiParent = parentForm;
         *      if ( File.Exists( path ) )
         *      {
         *
         *          StreamReader sr = new StreamReader( path );
         *          DataDynamics.ActiveReports.ActiveReport rpt = new DataDynamics.ActiveReports.ActiveReport();
         *
         *
         *
         *          rpt.LoadLayout( sr.BaseStream );
         *
         *          DataDynamics.ActiveReports.DataSources.SqlDBDataSource sqlDS = (DataDynamics.ActiveReports.DataSources.SqlDBDataSource)rpt.DataSource;
         *          rpt.DataSource = table;
         *          rpt.AddNamedItem("Empresa", _uiController.Empresa);
         *          rpt.AddNamedItem("DireccionEmpresa", _uiController.DireccionEmpresa);
         *          rpt.AddNamedItem("TelefonoEmpresa", _uiController.TelefonoEmpresa);
         *          rpt.AddNamedItem("Usuario", _uiController.Usuario);
         *
         *
         *          rpt.AddNamedItem("CUITEmpresa",Variables.GetValueString("Sistema.CUITEmpresa"));
         *          rpt.AddNamedItem("CategoriaIvaEmpresa",Variables.GetValueString("Sistema.CategoriaIvaEmpresa"));
         *          rpt.AddNamedItem("IngresosBrutosEmpresa",Variables.GetValueString("Sistema.IngresosBrutosEmpresa"));
         *          rpt.AddNamedItem("InicioActividadesEmpresa",Variables.GetValueString("Sistema.InicioActividadesEmpresa"));
         *          rpt.AddNamedItem("Logo",Variables.GetValueString("Reportes.Logo"));
         *
         *
         *          rpt.AddNamedItem("CategoriaIvaEmpresa", Variables.GetValueString("Sistema.CategoriaDeIvaEmpresa"));
         *          rpt.AddNamedItem("CUITEmpresa", Variables.GetValueString("Sistema.CUITEmpresa"));
         *          rpt.AddNamedItem("IngresosBrutosEmpresa", Variables.GetValueString("Sistema.IngresosBrutosEmpresa"));
         *          rpt.AddNamedItem("InicioActividadesEmpresa", Variables.GetValueString("Sistema.InicioActividadesEmpresa"));
         *          rpt.AddNamedItem("Logo", Variables.GetValueString("Reportes.Logo"));
         *
         *
         *          FormatParameters(rpt,parameters);
         *
         *          rpt.Run();
         *
         *          _viewer.Document = rpt.Document;
         *          if(show)
         *              Show();
         *          else
         *          {
         *              if(print)
         *                  if(askPrint)
         *                  {
         *                      if(MessageBox.Show("Desea Imprimir?","Impresión", System.Windows.Forms.MessageBoxButtons.YesNo,System.Windows.Forms.MessageBoxIcon.Question).Equals(DialogResult.Yes))
         *                          //Deprecated
         *                          //rpt.Document.Print(printSetup, printProgress);
         *                          rpt.Document.Print(printSetup,printProgress,false);
         *                  }
         *                  else
         *                      //Deprecated
         *                      //rpt.Document.Print(printSetup, printProgress);
         *                      rpt.Document.Print(printSetup,printProgress,false);
         *          }
         *
         *      }
         *      else
         *      {
         *          Errores.MessageFileNotFound();
         *      }
         *  }
         *  catch(Exception e )
         *  {
         *
         *      Console.WriteLine(e.Message);
         *
         *  }
         * }
         */

        /*Se Modifico, pasar al codigo nuevo*/
        private void ShowReport(System.Data.DataView table, string fileName, Form parentForm, ReportParameterCollection parameters, bool show, bool print, bool printSetup, bool printProgress, bool askPrint, bool customPrinter, string PrinterName, short copies)
        {
            ResourceManager res = new ResourceManager("mz.erp.ui.forms.localization", this.GetType().Assembly);

            _viewer.Localize = res;
            try
            {
                string path = this.getPath(fileName);
                MdiParent = parentForm;
                if (File.Exists(path))
                {
                    StreamReader sr = new StreamReader(path);
                    DataDynamics.ActiveReports.ActiveReport rpt = new DataDynamics.ActiveReports.ActiveReport();



                    rpt.LoadLayout(sr.BaseStream);

                    DataDynamics.ActiveReports.DataSources.SqlDBDataSource sqlDS = (DataDynamics.ActiveReports.DataSources.SqlDBDataSource)rpt.DataSource;
                    rpt.DataSource = table;
                    rpt.AddNamedItem("Empresa", _uiController.Empresa);
                    rpt.AddNamedItem("DireccionEmpresa", _uiController.DireccionEmpresa);
                    rpt.AddNamedItem("TelefonoEmpresa", _uiController.TelefonoEmpresa);
                    rpt.AddNamedItem("Usuario", _uiController.Usuario);

                    rpt.AddNamedItem("CUITEmpresa", Variables.GetValueString("Sistema.CUITEmpresa"));
                    rpt.AddNamedItem("CategoriaIvaEmpresa", Variables.GetValueString("Sistema.CategoriaIvaEmpresa"));
                    rpt.AddNamedItem("IngresosBrutosEmpresa", Variables.GetValueString("Sistema.IngresosBrutosEmpresa"));
                    rpt.AddNamedItem("InicioActividadesEmpresa", Variables.GetValueString("Sistema.InicioActividadesEmpresa"));
                    rpt.AddNamedItem("Logo", Variables.GetValueString("Reportes.Logo"));


                    FormatParameters(rpt, parameters);

                    rpt.Run(false);

                    _viewer.Document = rpt.Document;

                    /*
                     *                                      System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
                     *                                      ps.PrinterName = "HP LaserJet 1020 en PCADRIANA";
                     *                                      rpt.Document.Printer.PrinterSettings = ps;
                     *                                      rpt.Document.Printer.PrinterName = "HP LaserJet 1020 en PCADRIANA";
                     *
                     *
                     *                                      rpt.Document.Printer.PrinterSettings.PrinterName = "HP LaserJet 1020 en PCADRIANA";
                     *                                      rpt.Document.Printer.PrinterName = "HP LaserJet 1020 en PCADRIANA";
                     */



                    if (show)
                    {
                        Show();
                    }
                    else
                    {
                        if (print)
                        {
                            /*
                             * PrintDialog pd = new PrintDialog();
                             * System.Drawing.Printing.PrinterSettings.StringCollection printerCollection = System.Drawing.Printing.PrinterSettings.InstalledPrinters;
                             * pd.Document = rpt.Document.Printer;
                             * pd.Document.DefaultPageSettings.PrinterSettings.PrinterName = @"\\PCADRIANA\HP LaserJet 1020";
                             */
                            //pd.Document.PrinterSettings.
                            //pd.Document.Print();
                            if (askPrint)
                            {
                                if (MessageBox.Show("Desea Imprimir?", "Impresión", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question).Equals(DialogResult.Yes))
                                {
                                    if (customPrinter)
                                    {
                                        rpt.Document.Printer.PrinterSettings.PrinterName = PrinterName;                                          //@"\\PCADRIANA\HP LaserJet 1020";
                                    }
                                    else
                                    if (_uiController.AllowImpresoraPorTipoDeComprobante)
                                    {
                                        rpt.Document.Printer.PrinterSettings.PrinterName = _uiController.ImpresoraPorTipoDeComprobante;
                                    }

                                    //rpt.Document.Printer.PrinterSettings.PrinterName = PrinterName;
                                    rpt.Document.Printer.PrinterSettings.Copies = copies;

                                    //German 20100713 - Tarea 793
                                    if (_uiController.BandejaPersonalizada)
                                    {
                                        if (_uiController.Bandeja != null && _uiController.Bandeja != string.Empty)
                                        {
                                            //rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.Bandeja, rpt.Document);
                                            rpt.Document.Printer.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.Bandeja, rpt.Document);
                                        }
                                    }
                                    else
                                    {
                                        if (_uiController.AllowBandejaPorTipoDeComprobante)
                                        {
                                            if (_uiController.BandejaPorTipoDeComprobante != null && _uiController.BandejaPorTipoDeComprobante != string.Empty)
                                            {
                                                //rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.BandejaPorTipoDeComprobante, rpt.Document);
                                                rpt.Document.Printer.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.BandejaPorTipoDeComprobante, rpt.Document);
                                            }
                                        }
                                    }
                                    //Fin German 20100713 - Tarea 793


                                    //Deprecated
                                    //rpt.Document.Print(printSetup, printProgress);
                                    rpt.Document.Print(printSetup, printProgress, false);
                                }
                            }
                            else
                            {
                                if (customPrinter)
                                {
                                    rpt.Document.Printer.PrinterSettings.PrinterName = PrinterName;                                      //@"\\PCADRIANA\HP LaserJet 1020";
                                }
                                else
                                if (_uiController.AllowImpresoraPorTipoDeComprobante)
                                {
                                    rpt.Document.Printer.PrinterSettings.PrinterName = _uiController.ImpresoraPorTipoDeComprobante;
                                }

                                rpt.Document.Printer.PrinterSettings.Copies = copies;

                                //German 20100713 - Tarea 793
                                if (_uiController.BandejaPersonalizada)
                                {
                                    if (_uiController.Bandeja != null && _uiController.Bandeja != string.Empty)
                                    {
                                        //rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.Bandeja, rpt.Document);
                                        rpt.Document.Printer.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.Bandeja, rpt.Document);
                                    }
                                }
                                else
                                {
                                    if (_uiController.AllowBandejaPorTipoDeComprobante)
                                    {
                                        if (_uiController.BandejaPorTipoDeComprobante != null && _uiController.BandejaPorTipoDeComprobante != string.Empty)
                                        {
                                            //rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.BandejaPorTipoDeComprobante, rpt.Document);
                                            rpt.Document.Printer.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.BandejaPorTipoDeComprobante, rpt.Document);
                                        }
                                    }
                                }
                                //Fin German 20100713 - Tarea 793

                                //Deprecated
                                //rpt.Document.Print(printSetup, printProgress);
                                rpt.Document.Print(printSetup, printProgress, false);
                            }
                        }
                    }
                }
                else
                {
                    Errores.MessageFileNotFound();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #6
0
        public void ShowReport(System.Data.DataTable table, string fileName, Form parentForm, ReportParameterCollection parameters, bool show, bool print, bool printSetup, bool printProgress, bool askPrint, bool customPrinter, string PrinterName, short copies)
        {
            ResourceManager res = new ResourceManager("mz.erp.ui.forms.localization", this.GetType().Assembly);

            _viewer.Localize = res;
            try
            {
                string path = this.getPath(fileName);
                MdiParent = parentForm;
                if (File.Exists(path))
                {
                    StreamReader sr = new StreamReader(path);
                    DataDynamics.ActiveReports.ActiveReport rpt = new DataDynamics.ActiveReports.ActiveReport();



                    rpt.LoadLayout(sr.BaseStream);

                    DataDynamics.ActiveReports.DataSources.SqlDBDataSource sqlDS = (DataDynamics.ActiveReports.DataSources.SqlDBDataSource)rpt.DataSource;
                    rpt.DataSource = table;
                    rpt.AddNamedItem("Empresa", Variables.GetValueString("Sistema.NombreEmpresa"));
                    FormatParameters(rpt, parameters);

                    rpt.Run();

                    _viewer.Document = rpt.Document;
                    if (show)
                    {
                        Show();
                    }
                    else
                    {
                        if (print)
                        {
                            if (askPrint)
                            {
                                if (MessageBox.Show("Desea Imprimir?", "Impresión", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question).Equals(DialogResult.Yes))
                                {
                                    if (customPrinter)
                                    {
                                        rpt.Document.Printer.PrinterSettings.PrinterName = PrinterName;                                          //@"\\PCADRIANA\HP LaserJet 1020";
                                    }
                                    else
                                    if (_uiController.AllowImpresoraPorTipoDeComprobante)
                                    {
                                        rpt.Document.Printer.PrinterSettings.PrinterName = _uiController.ImpresoraPorTipoDeComprobante;
                                    }
                                    rpt.Document.Printer.PrinterSettings.Copies = copies;

                                    //German 20100713 - Tarea 793
                                    if (_uiController.BandejaPersonalizada)
                                    {
                                        if (_uiController.Bandeja != null && _uiController.Bandeja != string.Empty)
                                        {
                                            //rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.Bandeja, rpt.Document);
                                            rpt.Document.Printer.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.Bandeja, rpt.Document);
                                        }
                                    }
                                    else
                                    {
                                        if (_uiController.AllowBandejaPorTipoDeComprobante)
                                        {
                                            if (_uiController.BandejaPorTipoDeComprobante != null && _uiController.BandejaPorTipoDeComprobante != string.Empty)
                                            {
                                                //rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.BandejaPorTipoDeComprobante, rpt.Document);
                                                rpt.Document.Printer.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.BandejaPorTipoDeComprobante, rpt.Document);
                                            }
                                        }
                                    }
                                    //Fin German 20100713 - Tarea 793


                                    //Deprecated
                                    //rpt.Document.Print(printSetup, printProgress);
                                    rpt.Document.Print(printSetup, printProgress, false);
                                }
                            }
                            else
                            {
                                if (customPrinter)
                                {
                                    rpt.Document.Printer.PrinterSettings.PrinterName = PrinterName;                                      //@"\\PCADRIANA\HP LaserJet 1020";
                                }
                                else
                                if (_uiController.AllowImpresoraPorTipoDeComprobante)
                                {
                                    rpt.Document.Printer.PrinterSettings.PrinterName = _uiController.ImpresoraPorTipoDeComprobante;
                                }
                                rpt.Document.Printer.PrinterSettings.Copies = copies;

                                //German 20100713 - Tarea 793
                                if (_uiController.BandejaPersonalizada)
                                {
                                    if (_uiController.Bandeja != null && _uiController.Bandeja != string.Empty)
                                    {
                                        //rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.Bandeja, rpt.Document);
                                        rpt.Document.Printer.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.Bandeja, rpt.Document);
                                    }
                                }
                                else
                                {
                                    if (_uiController.AllowBandejaPorTipoDeComprobante)
                                    {
                                        if (_uiController.BandejaPorTipoDeComprobante != null && _uiController.BandejaPorTipoDeComprobante != string.Empty)
                                        {
                                            //rpt.Document.Printer.PrinterSettings.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.BandejaPorTipoDeComprobante, rpt.Document);
                                            rpt.Document.Printer.DefaultPageSettings.PaperSource = GetPrinterTray(_uiController.BandejaPorTipoDeComprobante, rpt.Document);
                                        }
                                    }
                                }
                                //Fin German 20100713 - Tarea 793


                                //Deprecated
                                //rpt.Document.Print(printSetup, printProgress);
                                rpt.Document.Print(printSetup, printProgress, false);
                            }
                        }
                    }
                }
                else
                {
                    Errores.MessageFileNotFound();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }