public CrystalReportViewer InserirDocumento(ReportClass documento, string texto)
        {
            AguardeDB.Mostrar();

            // Insere documento na lista
            documentos.Add(documento);

            // Insere controles
            CrystalReportViewer novoViewer;
            TabPage novaTab;

            novoViewer = new CrystalReportViewer();
            novaTab = new TabPage();
            tabControl.TabPages.Add(novaTab);
            tabControl.SuspendLayout();
            novaTab.SuspendLayout();
            this.SuspendLayout();
            // 
            // visualizador
            // 
            novoViewer.ActiveViewIndex = -1;
            novoViewer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            novoViewer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            novoViewer.EnableDrillDown = false;
            novoViewer.Location = new System.Drawing.Point(0, 0);
            novoViewer.Name = "visualizador";
            novoViewer.SelectionFormula = "";
            novoViewer.ShowCloseButton = false;
            novoViewer.ShowExportButton = false;
            novoViewer.ShowGotoPageButton = false;
            novoViewer.ShowGroupTreeButton = false;
            novoViewer.ShowPrintButton = false;
            novoViewer.ShowRefreshButton = false;
            novoViewer.ShowTextSearchButton = false;
            novoViewer.Size = new System.Drawing.Size(709, 210);
            novoViewer.TabIndex = 0;
            novoViewer.ViewTimeSelectionFormula = "";

            novaTab.Controls.Add(novoViewer);
            novaTab.Location = new System.Drawing.Point(4, 22);
            novaTab.Padding = new System.Windows.Forms.Padding(3);
            novaTab.Size = new System.Drawing.Size(709, 210);
            novaTab.TabIndex = 0;
            novaTab.Text = texto;
            novaTab.UseVisualStyleBackColor = true;
            this.tabControl.ResumeLayout(false);
            novaTab.ResumeLayout(false);
            this.ResumeLayout(false);
            novoViewer.ReportSource = documento;

            AguardeDB.Fechar();

            return novoViewer;
        }
Example #2
1
        public Boolean printReport(CrystalDecisions.CrystalReports.Engine.ReportClass crReport, CrystalReportViewer CrystalReportViewer1, String param1, String ParamName1, String param2, String ParamName2)
        {
            if (PrinterName=="none") return false;

            paramField.ParameterFieldName = ParamName1;
            discreteVal.Value = param1;
            paramField.CurrentValues.Add (discreteVal);
            paramFields.Add (paramField);
            crReport.DataDefinition.ParameterFields[0].CurrentValues.Add (discreteVal);

            paramField2.ParameterFieldName = ParamName2;
            discreteVal2.Value = param2;
            paramField2.CurrentValues.Add (discreteVal2);
            paramFields.Add (paramField2);
            crReport.DataDefinition.ParameterFields[1].CurrentValues.Add (discreteVal2);

            CrystalReportViewer1.ReportSource = crReport;
            CrystalReportViewer1.ParameterFieldInfo = paramFields;
            CrystalReportViewer1.RefreshReport();

            ParameterValues tmpParam = new ParameterValues();
            ParameterValues tmpParam2 = new ParameterValues();
            tmpParam.Add(discreteVal);
            tmpParam2.Add(discreteVal2);
            crReport.DataDefinition.ParameterFields[0].ApplyCurrentValues(tmpParam);
            crReport.DataDefinition.ParameterFields[1].ApplyCurrentValues(tmpParam2);
            crReport.PrintOptions.PrinterName = PrinterName;
            //			crReport.PrintToPrinter(1,false,1,1);
            crReport.PrintToPrinter(1,false,1,99);

            //Response.write (PrinterName);
            return true;
        }
 private void btnImprimir_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor = Cursors.WaitCursor;
         ReportDocument document = new ReportDocument();
         document.Load("Reportes\\PendienteEntrega.rpt");
         CrystalReportViewer crvVisor = new CrystalReportViewer();
         crvVisor.ReportSource = document;
         document.SetParameterValue("@ID", PendienteID);
         string strServer   = ConfigurationManager.AppSettings["ServerName"].ToString();
         string strDatabase = ConfigurationManager.AppSettings["DataBaseName"].ToString();
         string strUserID   = ConfigurationManager.AppSettings["UserId"].ToString();
         string strPwd      = ConfigurationManager.AppSettings["Password"].ToString();
         document.DataSourceConnections[0].SetConnection(strServer, strDatabase, strUserID, strPwd);
         PrintDialog pd = new PrintDialog();
         if (pd.ShowDialog() == DialogResult.OK)
         {
             document.PrintOptions.PrinterName = pd.PrinterSettings.PrinterName;
             document.PrintToPrinter(2, true, 0, 0);
         }
         Cursor = Cursors.Default;
     }
     catch (Exception ex)
     {
         Cursor = Cursors.Default;
         MessageBox.Show("Ocurrio el siguiente problema: " + ex.Message, "Pendiente de Entrega", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #4
0
    public printpreview(string rptfilename, string recordselectionformula)
    {
        MessageBox.Show(rptfilename);
        StartPosition = FormStartPosition.CenterParent;
        Size          = new Size(550, 400);

        ConnectionInfo cni = new ConnectionInfo();

        if (gv.mdbfile == "")
        {
            cni.ServerName = gv.listfile;
        }
        else
        {
            cni.ServerName = gv.mdbfile;
        }
        doc = new ReportDocument();
        doc.Load(rptfilename);
        doc.RecordSelectionFormula = recordselectionformula;
        foreach (Table crtb in doc.Database.Tables)
        {
            TableLogOnInfo li = crtb.LogOnInfo;
            li.ConnectionInfo = cni;
            crtb.ApplyLogOnInfo(li);
        }
        crv               = new CrystalReportViewer();
        crv.Dock          = DockStyle.Fill;
        crv.Size          = new Size(550, 350);
        crv.ToolPanelView = ToolPanelViewType.None;
        crv.ReportSource  = doc;
        crv.RefreshReport();
        crv.Parent = this;
    }
Example #5
0
 private void InitializeComponent()
 {
     this.crViewer = new CrystalReportViewer();
     base.SuspendLayout();
     this.crViewer.set_ActiveViewIndex(-1);
     this.crViewer.BorderStyle = BorderStyle.FixedSingle;
     this.crViewer.Dock        = DockStyle.Fill;
     this.crViewer.Location    = new Point(0, 0);
     this.crViewer.Name        = "crViewer";
     this.crViewer.set_SelectionFormula("");
     this.crViewer.Size     = new Size(558, 386);
     this.crViewer.TabIndex = 0;
     this.crViewer.set_ViewTimeSelectionFormula("");
     base.AutoScaleDimensions = new SizeF(6, 13);
     base.AutoScaleMode       = AutoScaleMode.Font;
     base.ClientSize          = new Size(558, 386);
     base.Controls.Add(this.crViewer);
     base.FormBorderStyle   = FormBorderStyle.Fixed3D;
     base.Name              = "ReportFrom";
     base.RightToLeft       = RightToLeft.Yes;
     base.RightToLeftLayout = true;
     base.ShowIcon          = false;
     base.Text              = "تقارير";
     base.Load             += new EventHandler(this.TransactionsReportFrom_Load);
     base.ResumeLayout(false);
 }
Example #6
0
        public static void ReplaceReportName(CrystalReportViewer viewer, string oldName, string newName)
        {
            if (viewer == null)
            {
                throw new ArgumentNullException("viewer");
            }
            if (oldName == null || oldName.Length == 0)
            {
                throw new ArgumentException("May not be empty.", "oldName");
            }

            foreach (Control control in viewer.Controls)
            {
                if (string.Compare(control.GetType().Name, "PageView", true, CultureInfo.InvariantCulture) == 0)
                {
                    foreach (Control controlInPage in control.Controls)
                    {
                        if (string.Compare(controlInPage.GetType().Name, "TabControl", true, CultureInfo.InvariantCulture) == 0)
                        {
                            TabControl tabs = (TabControl)controlInPage;

                            foreach (TabPage tabPage in tabs.TabPages)
                            {
                                if (string.Compare(tabPage.Text, oldName, false, CultureInfo.InvariantCulture) == 0)
                                {
                                    tabPage.Text = newName;
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
        public static void ShowReportSaleReturn(CrystalReportViewer crv, string proc, string param = null, object val1 = null)
        {
            try
            {
                ReportDocument rd;

                SqlConnection sql_con = new SqlConnection(MainClass.connection());

                SqlCommand cmd = new SqlCommand(proc, sql_con);

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue(param, val1);

                SqlDataAdapter adapter = new SqlDataAdapter(cmd);

                DataTable dat = new DataTable();

                adapter.Fill(dat);

                rd = new ReportDocument();

                rd.Load(Application.StartupPath + "\\Reports\\SalesReturnReport.rpt");

                rd.SetDataSource(dat);

                crv.ReportSource = rd;

                crv.RefreshReport();
            }
            catch (Exception ex)
            {
                MainClass.ShowMsg(ex.Message, "Error");
            }
        }
Example #8
0
 private void InitializeComponent()
 {
     this.rptViewer = new CrystalReportViewer();
     base.SuspendLayout();
     this.rptViewer.ActiveViewIndex          = -1;
     this.rptViewer.BorderStyle              = BorderStyle.FixedSingle;
     this.rptViewer.DisplayGroupTree         = false;
     this.rptViewer.Dock                     = DockStyle.Fill;
     this.rptViewer.Location                 = new Point(0, 0);
     this.rptViewer.Name                     = "rptViewer";
     this.rptViewer.SelectionFormula         = "";
     this.rptViewer.ShowGroupTreeButton      = false;
     this.rptViewer.Size                     = new Size(0x2ec, 0x1a9);
     this.rptViewer.TabIndex                 = 0;
     this.rptViewer.ViewTimeSelectionFormula = "";
     base.AutoScaleDimensions                = new SizeF(6f, 12f);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.ClientSize    = new Size(0x2ec, 0x1a9);
     base.Controls.Add(this.rptViewer);
     base.MinimizeBox   = false;
     base.Name          = "frmReportView";
     base.StartPosition = FormStartPosition.CenterScreen;
     this.Text          = "frmReportView";
     base.Load         += new EventHandler(this.frmReportView_Load);
     base.ResumeLayout(false);
 }
Example #9
0
    ///<summary>
    ///功能:拉模式提取水晶报表
    ///个人主页:http://www.dzend.com/
    ///</summary>
    ///<param name="sender"></param>
    ///<param name="e"></param>
    ///
    public int view_report(CrystalReportViewer CrystalReportViewer1, string file_name, string report_sql)
    {
        // CrystalReport.rpt是水晶报表文件的名称;CrystalReportSource1是从工具箱加到页面上的水晶报表数据源对像。


        ExcuteDataTable(dt_report, report_sql, CommandType.Text);
        try
        {
            CrystalReportSource cs = new CrystalReportSource();
            cs.ReportDocument.Load(file_name);
            cs.ReportDocument.SetDataSource(dt_report);
            cs.DataBind();

            for (int i = 0; i < cs.ReportDocument.ParameterFields.Count; i++)
            {
                string ls_part = cs.ReportDocument.ParameterFields[i].Name;
            }

            CrystalReportViewer1.ReportSource = cs;
            CrystalReportViewer1.DataBind();

            return(1);
        }
        catch (Exception e)
        {
            return(-1);
        }
    }
Example #10
0
 public static void loadReport(ReportDocument rd, CrystalReportViewer crv, Int16 status, string phone = null, int?tableID = null)
 {
     try
     {
         SqlCommand cmd = new SqlCommand("st_getOrderReport", MainClass.con);
         cmd.CommandType = CommandType.StoredProcedure;
         if (phone == null)
         {
             cmd.Parameters.AddWithValue("@tableID", tableID);
             cmd.Parameters.AddWithValue("@status", status);
             cmd.Parameters.AddWithValue("@phone", DBNull.Value);
         }
         else
         {
             cmd.Parameters.AddWithValue("@phone", phone);
             cmd.Parameters.AddWithValue("@status", status);
             cmd.Parameters.AddWithValue("@tableID", DBNull.Value);
         }
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         DataTable      dt = new DataTable();
         da.Fill(dt);
         rd.Load(Application.StartupPath + "\\Reports\\billReport.rpt");
         rd.SetDataSource(dt);
         crv.ReportSource = rd;
         crv.RefreshReport();
     }
     catch (Exception ex)
     {
         if (rd != null)
         {
             rd.Close();
         }
         MainClass.showMessage(ex.Message, "error");
     }
 }
Example #11
0
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmcrystal_report_single));
     this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
     this.SuspendLayout();
     //
     // crystalReportViewer1
     //
     this.crystalReportViewer1.ActiveViewIndex = -1;
     this.crystalReportViewer1.BorderStyle     = System.Windows.Forms.BorderStyle.FixedSingle;
     this.crystalReportViewer1.Cursor          = System.Windows.Forms.Cursors.Default;
     this.crystalReportViewer1.Dock            = System.Windows.Forms.DockStyle.Fill;
     this.crystalReportViewer1.Location        = new System.Drawing.Point(0, 0);
     this.crystalReportViewer1.Name            = "crystalReportViewer1";
     this.crystalReportViewer1.Size            = new System.Drawing.Size(828, 578);
     this.crystalReportViewer1.TabIndex        = 0;
     //
     // frmcrystal_report_single
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(828, 578);
     this.Controls.Add(this.crystalReportViewer1);
     this.Icon          = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name          = "frmcrystal_report_single";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text          = "GUARD PROFILE REPORT";
     this.Load         += new System.EventHandler(this.frmcrystal_report_single_Load);
     this.ResumeLayout(false);
 }
Example #12
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReportView));
     this.Viewer = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
     this.SuspendLayout();
     //
     // Viewer
     //
     this.Viewer.ActiveViewIndex = -1;
     this.Viewer.BorderStyle     = System.Windows.Forms.BorderStyle.FixedSingle;
     this.Viewer.Cursor          = System.Windows.Forms.Cursors.Default;
     this.Viewer.Dock            = System.Windows.Forms.DockStyle.Fill;
     this.Viewer.Location        = new System.Drawing.Point(0, 0);
     this.Viewer.Name            = "Viewer";
     this.Viewer.Size            = new System.Drawing.Size(533, 344);
     this.Viewer.TabIndex        = 0;
     this.Viewer.ToolPanelView   = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
     //
     // ReportView
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(533, 344);
     this.Controls.Add(this.Viewer);
     this.Icon  = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name  = "ReportView";
     this.Text  = "ReportView";
     this.Load += new System.EventHandler(this.ReportView_Load);
     this.ResumeLayout(false);
 }
        public void reporte()
        {
            var dt_reporte = new DataTable();

            var ds_reporte = new Php.Datas.dsCuentas();

            string columnas = "plan_cuentas.nombre_plan_cuentas,entidades.nombre_entidades,plan_cuentas.nivel_plan_cuentas," +
                              "plan_cuentas.t_plan_cuentas,plan_cuentas.n_plan_cuentas,plan_cuentas.codigo_plan_cuentas";

            string tablas = "public.plan_cuentas, public.entidades";

            string where = "entidades.id_entidades = plan_cuentas.id_entidades AND entidades.id_entidades=3";

            dt_reporte = AccesoLogica.Select(columnas, tablas, where);
            ds_reporte.Tables.Add(dt_reporte);

            CrystalReportViewer CrystalReportViewer1 = new CrystalReportViewer();

            ReportDocument _reporte = new ReportDocument();

            string url_file_rpt = Server.MapPath("~/Php/Reporte/crCuentas.rpt");

            //_reporte.Load(url_file_rpt);

            //_reporte.SetDataSource(ds_reporte.Tables[0]);

            //CrystalReportViewer1.ReportSource = _reporte;

            //CrystalReportViewer1.Visible = true;

            Php.Reporte.crCuentas rptXMLReport = new Php.Reporte.crCuentas();
            rptXMLReport.SetDataSource(ds_reporte.Tables[1]);
            CrystalReportViewer1.ReportSource = rptXMLReport;
        }
        public static void loadBillReport(ReportDocument rd, CrystalReportViewer crv, Int16 status, Int64 orderid)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("st_getOrderReport", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;


                cmd.Parameters.AddWithValue("@orderID", orderid);
                cmd.Parameters.AddWithValue("@status", status);

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                rd.Load(Application.StartupPath + "\\Reports\\billReport.rpt");
                rd.SetDataSource(dt);
                crv.ReportSource = rd;
                crv.RefreshReport();
            }
            catch (Exception ex)
            {
                if (rd != null)
                {
                    rd.Close();
                }
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
Example #15
0
        private void ImprimirArqueo(object xArqueo, bool xMostrar)
        {
            Arqueo Arq = (Arqueo)xArqueo;

            ReportDocument rptDoc;

            rptDoc = new rpPagosCreditosDias();
            rptDoc.PrintOptions.PrinterName.ToString();
            TextObject Campo;

            Campo      = (TextObject)rptDoc.ReportDefinition.ReportObjects["txtUsuario"];
            Campo.Text = Arq.Usuario.Nombre;
            Campo      = (TextObject)rptDoc.ReportDefinition.ReportObjects["txtZ"];
            Campo.Text = Arq.Numero.ToString();
            Campo      = (TextObject)rptDoc.ReportDefinition.ReportObjects["txtFecha"];
            Campo.Text = Arq.Fecha.ToShortDateString();

            if (Arq is ArqueoCP)
            {
                rptDoc.SetDataSource(getMovimientosCP((ArqueoCP)xArqueo));
            }
            //rptDoc.PrintToPrinter(0, false, 0, 0);

            if (xMostrar)
            {
                frmImpresion        frmReport = new Reportes.frmImpresion();
                CrystalReportViewer RP        = (CrystalReportViewer)frmReport.Controls["RPViewer"];
                RP.ReportSource = rptDoc;
                frmReport.Show();
            }
        }
        /// <summary>
        /// Build a Crystal Reports viewer and display it.
        /// </summary>
        /// <returns>The newly created viewer.</returns>
        private CrystalReportViewer GetCrystalViewer()
        {
            CrystalReportViewer viewer = this.host.Child as CrystalReportViewer;

            if (viewer == null)
            {
                viewer = new CrystalReportViewer();

                viewer.HandleException        += OnCrystalException;
                viewer.Error                  += OnCrystalException;
                viewer.DisplayGroupTree        = false;
                viewer.DisplayStatusBar        = false;
                viewer.DisplayToolbar          = true;
                viewer.ShowPageNavigateButtons = true;
                viewer.ShowGroupTreeButton     = false;
                viewer.ShowGotoPageButton      = true;
                viewer.ShowRefreshButton       = false;
                viewer.ShowTextSearchButton    = true;

                viewer.DisplayBackgroundEdge = false;
                viewer.EnableDrillDown       = false;
                viewer.Dock         = System.Windows.Forms.DockStyle.Fill;
                viewer.AutoSize     = true;
                viewer.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                this.host.Child     = viewer;
            }

            return(viewer);
        }
Example #17
0
        public static void ViewerTabs(CrystalReportViewer viewer, bool visible)
        {
            if (viewer == null)
            {
                throw new ArgumentNullException("viewer");
            }

            foreach (Control control in viewer.Controls)
            {
                if (string.Compare(control.GetType().Name, "PageView", true, CultureInfo.InvariantCulture) == 0)
                {
                    TabControl tab = (TabControl)((PageView)control).Controls[0];

                    if (!visible)
                    {
                        tab.ItemSize   = new Size(0, 1);
                        tab.SizeMode   = TabSizeMode.Fixed;
                        tab.Appearance = TabAppearance.Buttons;
                    }
                    else
                    {
                        tab.ItemSize   = new Size(67, 18);
                        tab.SizeMode   = TabSizeMode.Normal;
                        tab.Appearance = TabAppearance.Normal;
                    }
                }
            }
        }
Example #18
0
        public void showReport(ReportDocument rd, CrystalReportViewer crv, string proc, string reportFile, string param = null, object val = null)
        {
            try
            {
                //DialogResult dr = MessageBox.Show(param, Convert.ToInt32(val).ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                SqlCommand cmd = new SqlCommand(proc, MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                if (param != null && val != null)
                {
                    cmd.Parameters.AddWithValue(param, val);
                }

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                rd.Load(Application.StartupPath + "\\Reports\\" + reportFile);
                rd.SetDataSource(dt);
                crv.ReportSource = rd;
                crv.RefreshReport();
            }
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.ShowMSG(ex.Message, "Error ", "Error");
            }
        }
Example #19
0
 private void InitializeComponent()
 {
     this.rptv_Main = new CrystalReportViewer();
     base.SuspendLayout();
     this.rptv_Main.ActiveViewIndex          = -1;
     this.rptv_Main.BorderStyle              = BorderStyle.FixedSingle;
     this.rptv_Main.DisplayGroupTree         = false;
     this.rptv_Main.Dock                     = DockStyle.Fill;
     this.rptv_Main.Location                 = new Point(0, 0);
     this.rptv_Main.Name                     = "rptv_Main";
     this.rptv_Main.SelectionFormula         = "";
     this.rptv_Main.ShowGroupTreeButton      = false;
     this.rptv_Main.Size                     = new Size(0x30a, 0x1f7);
     this.rptv_Main.TabIndex                 = 0;
     this.rptv_Main.ViewTimeSelectionFormula = "";
     base.AutoScaleDimensions                = new SizeF(6f, 12f);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.ClientSize    = new Size(0x30a, 0x1f7);
     base.Controls.Add(this.rptv_Main);
     base.Name          = "frmRptViewer";
     base.StartPosition = FormStartPosition.CenterScreen;
     this.Text          = "报表预览";
     base.WindowState   = FormWindowState.Maximized;
     base.ResumeLayout(false);
 }
Example #20
0
 private void InitializeComponent()
 {
     this.crystalReportViewer1 = new CrystalReportViewer();
     base.SuspendLayout();
     this.crystalReportViewer1.ActiveViewIndex          = -1;
     this.crystalReportViewer1.BorderStyle              = BorderStyle.FixedSingle;
     this.crystalReportViewer1.DisplayGroupTree         = false;
     this.crystalReportViewer1.Dock                     = DockStyle.Fill;
     this.crystalReportViewer1.Location                 = new Point(0, 0);
     this.crystalReportViewer1.Name                     = "crystalReportViewer1";
     this.crystalReportViewer1.SelectionFormula         = "";
     this.crystalReportViewer1.ShowGroupTreeButton      = false;
     this.crystalReportViewer1.Size                     = new Size(0x361, 0x1e4);
     this.crystalReportViewer1.TabIndex                 = 0;
     this.crystalReportViewer1.ViewTimeSelectionFormula = "";
     this.crystalReportViewer1.Load                    += new EventHandler(this.crystalReportViewer1_Load);
     base.AutoScaleDimensions = new SizeF(6f, 12f);
     base.AutoScaleMode       = AutoScaleMode.Font;
     base.ClientSize          = new Size(0x361, 0x1e4);
     base.Controls.Add(this.crystalReportViewer1);
     base.MinimizeBox   = false;
     base.Name          = "FrmRptShow";
     base.ShowIcon      = false;
     base.ShowInTaskbar = false;
     base.StartPosition = FormStartPosition.CenterScreen;
     this.Text          = "RptInOutRece";
     base.ResumeLayout(false);
 }
Example #21
0
        public void PrintGACommissionReport(CrystalReportViewer oViewer)
        {
            DataSet ds = Global.oMySql.GetDataset(String.Format("CALL GARepCommissions('{0}');", this.CompanyID));



            ds.Tables[0].TableName = "Customer";
            ds.Tables[1].TableName = "Reps";
            ds.Tables[2].TableName = "Payments";

            //frmViewReport oViewReport = new frmViewReport();
            //ds.WriteXml("GARepCommissions1.xml", XmlWriteMode.WriteSchema);

            GARepCommissions oRpt = new GARepCommissions();

            oRpt.SetDataSource(ds);
            oRpt.SetParameterValue("CompanyName", "Signature Fundraising, Inc.");

            //oViewReport.cReport.ReportSource = oRpt;
            //oViewReport.ShowDialog();

            oViewer.ReportSource = oRpt;


            //ds.Dispose();
            //oRpt.Dispose();
            //oViewReport.Dispose();
        }
Example #22
0
        //private void crystalReportViewer1_Load(object sender, EventArgs e)
        //{


        //    CrystalReport4 rpt = new CrystalReport4();


        //    DataSet1 db = new DataSet1();

        //    rpt.SetDataSource(from employee in db.Employees.Take(100)
        //                                select employee.FirstName );


        //    //rpt.SetDataSource(db);

        //    //rpt.SetDataSource(from u in db.Employees
        //    //                      select new
        //    //                      {
        //    //                          u.EmployeeID,
        //    //                          u.FirstName,
        //    //                          u.LastName
        //    //                      });

        //   // crystalReportViewer1.ReportSource = rpt;
        //    crystalReportViewer1.RefreshReport();
        //}

        private void crystalReportViewer2_Load(object sender, EventArgs e)
        {
            DataSet1 db = new DataSet1();

            DataSet dsReport = new DataSet();

            var EmployeeTable = db.Employees.Copy();
            var OrdersTable   = db.Orders.Copy();


            dsReport.Tables.Add(EmployeeTable);
            dsReport.Tables.Add(OrdersTable);

            CrystalReportDataSet crystalReport = new CrystalReportDataSet();

            //var path = @"C:\Users\jaqbs\source\repos\CrystalReportsSolution\CrystalReportsEntity1\CrystalReportDataSet.rpt";
            //crystalReport.Load(path);
            crystalReport.SetDataSource(dsReport);
            CrystalReportViewer rv = new CrystalReportViewer();

            rv.ReportSource = crystalReport;
            crystalReportViewer2.ReportSource = crystalReport;
            crystalReportViewer2.Refresh();

            //rpt.SetDataSource(from employee in db.Employees.Take(100)
            //                  select employee.FirstName);
        }
Example #23
0
        public void generaReporteReceta(VentanaReporte vr,String numero_receta)
        {
            String consulta = "SELECT R.NUMERO AS \"Número\",P.ID AS \"IDP\",(P.NOMBRE_PILA||' '||P.APELLIDO_PATERNO||' '||P.APELLIDO_MATERNO) AS \"Paciente\","
                              +"M.ID AS \"IDM\",(M.NOMBRE_PILA||' '||M.APELLIDO_PATERNO||' '||M.APELLIDO_MATERNO) AS \"Médico\",TO_CHAR(R.FECHA,'DD-MON-YYYY HH24:MI:SS') AS \"Fecha\","
                              + "R.INDICACIONES AS \"Indicaciones\" FROM RECETAF R, NOMBRE_PACIENTE P,NOMBRE_MEDICO M WHERE P.ID = R.ID_PACIENTE AND M.ID=R.ID_MEDICO AND R.NUMERO="+numero_receta;

            String consulta2 = "SELECT M.ID,T.NOMBRE AS \"Tipo\",M.NOMBRE_COMPUESTO AS \"Compuesto\",M.PRESENTACION AS \"Presentación\","
                               + "M.CONTENIDO AS \"Contenido\",M.VIA_ADMINISTRACION AS \"Vía de administración\",M.CBP AS \"c.b.p\",MX.DOSIS AS \"Dosis\" "
                               + "FROM MEDICAMENTOF M,TIPO_MEDICAMENTOF T, MXRF MX WHERE M.ID_TIPO_MEDICAMENTO = T.ID "
                               +"AND M.ID = MX.ID_MEDICAMENTO AND MX.NUMERO_RECETA =" + numero_receta;

            dsReportes ds = new dsReportes();
            crReceta cr = new crReceta();
            CrystalReportViewer crv = vr.dame_viewer();
            OracleDataAdapter adapter = new OracleDataAdapter();
            OracleDataAdapter adapter2 = new OracleDataAdapter();

            adapter.SelectCommand = new OracleCommand(consulta, conexion);
            adapter.Fill(ds, "Encabezado_receta");
            adapter2.SelectCommand = new OracleCommand(consulta2, conexion);
            adapter2.Fill(ds, "MXRF");
            cr.SetDataSource(ds);
            crv.ReportSource = cr;
            crv.Show();
            vr.Show();
        }
Example #24
0
 public void Load_BC_Nghiviec(CrystalReportViewer cryView, ReportDocument rp)
 {
     kn.Open_DB();
     kn.Exe_sp_X("proc_Nghiviec_BC");
     rp.SetDataSource(kn._dataset.Tables[0]);
     cryView.ReportSource = rp;
 }
 /// <summary>
 /// Present the user with a print dialog for the report.
 /// </summary>
 public override void PrintReport()
 {
     if (this.host.Child is CrystalReportViewer)
     {
         CrystalReportViewer viewer = this.host.Child as CrystalReportViewer;
         viewer.PrintReport();
     }
 }
        private void LoadReport()
        {
            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(Application.StartupPath + "\\Reports\\TopMeters.rpt");
            CrystalReportViewer.ReportSource = cryRpt;
            CrystalReportViewer.Refresh();
        }
Example #27
0
 public void loaddg_Chiluongphongban(CrystalReportViewer cryView, ReportDocument rp, string phongban)
 {
     kn.Open_DB();
     kn._sqlcommand.Parameters.Add("@maphong", SqlDbType.VarChar, 4).Value = phongban;
     kn.Exe_sp_X("Select_BC_Chiluongtheophong");
     rp.SetDataSource(kn._dataset.Tables[0]);
     cryView.ReportSource = rp;
 }
 public ReportPreview(DataTable dataTable, DataTable dataTableTitle, string reportPath, CrystalReportViewer crystalReportViewer)
 {
     this.reportPath          = reportPath;
     this.dataTable           = dataTable;
     this.dataTableTitle      = dataTableTitle;
     this.crystalReportViewer = crystalReportViewer;
     loadReportPreview();
 }
Example #29
0
 public void loaddg_Chamcongthangnam(CrystalReportViewer cryView, ReportDocument rp, int thang, int nam)
 {
     kn.Open_DB();
     kn._sqlcommand.Parameters.Add("@thang", SqlDbType.Int).Value = thang;
     kn._sqlcommand.Parameters.Add("@nam", SqlDbType.Int).Value   = nam;
     kn.Exe_sp_X("select_BC_Chamcongthangnam");
     rp.SetDataSource(kn._dataset.Tables[0]);
     cryView.ReportSource = rp;
 }
Example #30
0
        private void ImpresionSaldos(object xEstadoCuenta)
        {
            if (xEstadoCuenta == null)
            {
                return;
            }

            List <EstadoCuenta> Lista = (List <EstadoCuenta>)xEstadoCuenta;



            EstadoCuenta E;

            int Resultado = Lista.Count % 2;

            if (Resultado == 0)
            {
                Resultado = Lista.Count;
            }
            else
            {
                Resultado = Lista.Count - 1;
            }

            ReportDocument rptDoc;

            rptDoc = new repMiniECuenta();
            rptDoc.PrintOptions.PrinterName.ToString();
            TextObject Campo;

            for (int index = 0; index <= Resultado - 1; index += 2)
            {
                E = Lista[index];

                CargarReportesSaldos(ref rptDoc, E, 1);

                //=======//

                E = Lista[index + 1];
                CargarReportesSaldos(ref rptDoc, E, 2);

                frmImpresion        frmReport = new Reportes.frmImpresion();
                CrystalReportViewer RP        = (CrystalReportViewer)frmReport.Controls["RPViewer"];
                RP.ReportSource = rptDoc;
                rptDoc.PrintToPrinter(0, false, 0, 0);
            }
            if (Resultado != Lista.Count)
            {
                E = Lista[Lista.Count - 1];
                CargarReportesSaldos(ref rptDoc, E, 1);
                frmImpresion        frmReport = new Reportes.frmImpresion();
                CrystalReportViewer RP        = (CrystalReportViewer)frmReport.Controls["RPViewer"];
                RP.ReportSource = rptDoc;
                rptDoc.PrintToPrinter(0, false, 0, 0);
            }
        }
Example #31
0
        private void GenerateItemWiseReport()
        {
            List <CSOMaster> oListSOMaster = LoadItemWiseSales();

            POS       posdateset  = new POS();
            DataTable dtDailySale = posdateset.DailySales;

            foreach (CSOMaster oSOMaster in oListSOMaster)
            {
                foreach (CSODetails oSODetails in oSOMaster.SOMstr_DetailsList)
                {
                    DataRow drDailySale = dtDailySale.NewRow();

                    //drDailySale["InvoiceNo"] = dr1["InvoiceNo"];
                    drDailySale["BranchName"]  = oSOMaster.SOMstr_Branch;
                    drDailySale["Address"]     = currentBranch.CompBrn_Street;
                    drDailySale["Road"]        = currentBranch.CompBrn_Road;
                    drDailySale["City"]        = currentBranch.CompBrn_City;
                    drDailySale["Phone"]       = currentBranch.CompBrn_Phone;
                    drDailySale["Mobile"]      = currentBranch.CompBrn_Mobile;
                    drDailySale["ItemName"]    = oSODetails.SODet_ItemName;
                    drDailySale["Qty"]         = oSODetails.SODet_QTY;
                    drDailySale["Rate"]        = oSODetails.SODet_Price;
                    drDailySale["Amount"]      = oSODetails.SODet_Amount;
                    drDailySale["TotalAmount"] = oSOMaster.SOMstr_TotalAmt;
                    drDailySale["DiscAmount"]  = oSOMaster.SOMstr_DiscAmt;
                    drDailySale["NetAmount"]   = oSOMaster.SOMstr_NetAmt;

                    dtDailySale.Rows.Add(drDailySale);
                }
            }

            rptItemWiseSales orpt = new rptItemWiseSales();

            orpt.SetDataSource(posdateset);
            orpt.SetParameterValue(0, currentBranch.CompBrn_Name.Trim());
            orpt.SetParameterValue(1, dtpDateFrom2.Value.Date);
            orpt.SetParameterValue(2, dtpDateTo2.Value.Date);
            //  orpt.SetParameterValue(3, cmbItemName.SelectedText.ToString());
            //  orpt.SetParameterValue(1, currentUser.User_UserName.Trim());



            frmReportView       ofrmReportView = new frmReportView();
            CrystalReportViewer orptviewer     = (CrystalReportViewer)ofrmReportView.Controls["rptviewer"];

            orptviewer.ReportSource = orpt;
            // orptviewer.AutoSize = false;

            orptviewer.Show();
            ofrmReportView.Show();


            //crystalReportViewer1.ReportSource = orpt;
            //crystalReportViewer1.Show();
        }
Example #32
0
        private void ShowReport()
        {
            POS       posdataset = new POS();
            DataTable stickertbl = (DataTable)posdataset.StickerPrint;

            for (int i = 0; i < lvItem.Items.Count; i++)
            {
                for (int j = 0; j < Convert.ToInt32(lvItem.Items[i].SubItems[2].Text); j++)
                {
                    DataRow row = stickertbl.NewRow();
                    row["ItemCode"] = "*" + lvItem.Items[i].SubItems[0].Text + "*";
                    row["ItemName"] = lvItem.Items[i].SubItems[1].Text;
                    row["Price"]    = lvItem.Items[i].SubItems[3].Text;
                    stickertbl.Rows.Add(row);
                }



                //POS posdataset = new POS();
                //DataTable stickertbl = (DataTable)posdataset.StickerPrint;

                //for (int i = 0; i < lvItem.Items.Count; i++)
                //{
                //    for (int j = 0; j < Convert.ToInt32(lvItem.Items[i].SubItems[2].Text); j++)
                //    {
                //        DataRow row = stickertbl.NewRow();
                //        row["ItemCode"] = "*" + lvItem.Items[i].SubItems[0].Text + "*";
                //        string[] itemarray = lvItem.Items[i].SubItems[1].Text.Split('-');
                //        try
                //        {
                //            row["ItemName"] = itemarray[0].ToString();
                //            row["Code"] = itemarray[1].ToString();
                //            row["Size"] = itemarray[3].ToString();
                //        }
                //        catch (Exception ex)
                //        {

                //        }
                //        row["Price"] = lvItem.Items[i].SubItems[3].Text;
                //        stickertbl.Rows.Add(row);
                //    }
            }

            rptSticker objrpt = new rptSticker();

            objrpt.SetDataSource(stickertbl);

            frmReportView       ofrmReportView = new frmReportView();
            CrystalReportViewer orptviewer     = (CrystalReportViewer)ofrmReportView.Controls["rptviewer"];

            orptviewer.ReportSource = objrpt;
            orptviewer.AutoSize     = false;

            orptviewer.Show();
            ofrmReportView.Show();
        }
Example #33
0
        public Boolean initReport(ReportClass crReport, CrystalReportViewer CrystalReportViewer1, String param, String ParamName)
        {
            if(param=="" || param==null	) return false;

            paramField.ParameterFieldName = ParamName;
            discreteVal.Value = param;
            paramField.CurrentValues.Add (discreteVal);
            paramFields.Add (paramField);

            CrystalReportViewer1.ReportSource = crReport;
            CrystalReportViewer1.ParameterFieldInfo = paramFields;
            CrystalReportViewer1.RefreshReport();
            return true;
        }
Example #34
0
 public void ShowHDNoView(int ma)
 {
     DataTable dt = new DataTable();
     if (ma == 0)
         //   DataSet ds = new DataSet();
         dt = tXuat.GetDataHD(maHD);
     else dt = tXuat.GetDataHD(ma);
     //  ds.Tables.Add(dt);
     rptHD rpt = new rptHD();
     rpt.SetDataSource(dt);
     CrystalReportViewer rptview = new CrystalReportViewer();
     rptview.ReportSource = rpt;
     rptview.Refresh();
     rptview.PrintReport();
 }
Example #35
0
        public Boolean initReport(ReportClass crReport, CrystalReportViewer CrystalReportViewer1, String param1, String ParamName1, String param2, String ParamName2)
        {
            if(param1=="" || param1==null	) return false;
            if(param2=="" || param2==null	) return false;

            paramField.ParameterFieldName = ParamName1;
            discreteVal.Value = param1;
            paramField.CurrentValues.Add (discreteVal);
            paramFields.Add (paramField);
            crReport.DataDefinition.ParameterFields[0].CurrentValues.Add (discreteVal);

            paramField2.ParameterFieldName = ParamName2;
            discreteVal2.Value = param2;
            paramField2.CurrentValues.Add (discreteVal2);
            paramFields.Add (paramField2);
            crReport.DataDefinition.ParameterFields[1].CurrentValues.Add (discreteVal2);

            CrystalReportViewer1.ReportSource = crReport;
            CrystalReportViewer1.ParameterFieldInfo = paramFields;
            CrystalReportViewer1.RefreshReport();
            return true;
        }
        public JanelaImpressão(Entidades.Acerto.Acerto acerto)
        {
            Apresentação.Formulários.AguardeDB.Mostrar();
            InitializeComponent();

            this.acerto = acerto;

            lblDescrição.Text = "É o resumo de mercadorias relacionadas para " + acerto.Pessoa.PrimeiroNome;

            if (acerto == null)
                throw new NullReferenceException("Acerto é nulo para janela de impressão");

            System.Data.DataSet ds = acerto.ObterImpressão(optResumido.Checked);

            relatório = new Relatório();

            relatório.SetDataSource(ds);

            vizualizador = InserirDocumento(relatório, acerto.Pessoa.PrimeiroNome);

            Apresentação.Formulários.AguardeDB.Fechar();
        }
Example #37
0
 private void InitializeComponent()
 {
     this.crv_Task = new CrystalReportViewer();
     base.SuspendLayout();
     this.crv_Task.ActiveViewIndex=-1;
     this.crv_Task.BorderStyle = BorderStyle.FixedSingle;
     this.crv_Task.Dock = DockStyle.Fill;
     this.crv_Task.Location = new Point(0, 0);
     this.crv_Task.Name = "crv_Task";
     this.crv_Task.SelectionFormula="";
     this.crv_Task.Size = new Size(0x200, 360);
     this.crv_Task.TabIndex = 0;
     this.crv_Task.ViewTimeSelectionFormula="";
     base.AutoScaleDimensions = new SizeF(6f, 12f);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.ClientSize = new Size(0x200, 360);
     base.Controls.Add(this.crv_Task);
     base.Name = "Frm_TaskList";
     base.ShowIcon = false;
     this.Text = "生产任务单打印";
     base.WindowState = FormWindowState.Maximized;
     base.Load += new EventHandler(this.Frm_TaskList_Load);
     base.ResumeLayout(false);
 }
Example #38
0
 private void InitializeComponent()
 {
     this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
     this.SuspendLayout();
     //
     // crystalReportViewer1
     //
     this.crystalReportViewer1.ActiveViewIndex = -1;
     this.crystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.crystalReportViewer1.DisplayGroupTree = false;
     this.crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
     this.crystalReportViewer1.Location = new System.Drawing.Point(0, 0);
     this.crystalReportViewer1.Name = "crystalReportViewer1";
     this.crystalReportViewer1.SelectionFormula = "";
     this.crystalReportViewer1.ShowExportButton = false;
     this.crystalReportViewer1.ShowGotoPageButton = false;
     this.crystalReportViewer1.ShowGroupTreeButton = false;
     this.crystalReportViewer1.ShowRefreshButton = false;
     this.crystalReportViewer1.ShowTextSearchButton = false;
     this.crystalReportViewer1.ShowZoomButton = false;
     this.crystalReportViewer1.Size = new System.Drawing.Size(702, 606);
     this.crystalReportViewer1.TabIndex = 0;
     this.crystalReportViewer1.ViewTimeSelectionFormula = "";
     //
     // FrmCrystalViewer
     //
     this.BackColor = System.Drawing.Color.SteelBlue;
     this.ClientSize = new System.Drawing.Size(702, 606);
     this.Controls.Add(this.crystalReportViewer1);
     this.ForeColor = System.Drawing.Color.White;
     this.Name = "FrmCrystalViewer";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text = "Impressão -  Documentos";
     this.Load += new System.EventHandler(this.FrmCrystalViewer_Load);
     this.ResumeLayout(false);
 }
Example #39
0
        public void addTrinhKy_OnFormLoad()
        {
            //Ham nay XuanDT them vao
            try
            {
                //doan gan cac bien: doan nay co the phai thay doi ten bien cho phu hop
                mv_oRptDoc = RptDoc;
                mv_oViewDoc = crptViewer;
                //ket thuc doan gan bien
                mv_oRptFieldObj = mv_oRptDoc.ReportDefinition.ReportObjects["Field150181"] as FieldObject;
                mv_oNguoiKy = new cls_SignInfor(mv_oRptDoc.ToString(), "", ReportSourceTable);

                //chkPrint_CheckedChanged(chkPrint, New System.EventArgs)
                if (mv_oNguoiKy._TonTai)
                {
                    mv_oNguoiKy.setValueToRPT(ref mv_oRptFieldObj);
                    if (mv_bSetContent)
                    {
                        mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + mv_oNguoiKy.mv_NOI_DUNG.Replace("&NHANVIEN", globalVariables.UserName).Replace("\t", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34);
                        //mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = string.Format("'{0}'", mv_oNguoiKy.mv_NOI_DUNG);
                    }
                    else
                    {
                        mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = "";
                    }
                    mv_oViewDoc.ReportSource = RptDoc;
                }
                else
                {
                    mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", RptDoc.ToString(),
                                                    mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text);
                }
            }
            catch (Exception ex)
            {
                mv_oRptText = null;
                //an nut tuy chon di
                cmdTrinhKy.Visible = false;
            }
        }
Example #40
0
        private void createCrystalViewer()
        {
            ctlViewer = new CrystalReportViewer();
            this.SuspendLayout();
            ctlViewer.Location = new Point(0, 0);
            ctlViewer.Size = new Size(this.ClientRectangle.Width, this.ClientRectangle.Height);
            ctlViewer.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom);
            ctlViewer.ToolPanelView = ToolPanelViewType.None;
            ctlViewer.ShowLogo = false;
            ctlViewer.ShowPageNavigateButtons = false;
            ctlViewer.DisplayStatusBar = false;
            ctlViewer.DisplayToolbar = false;
            ctlViewer.ForeColor = Color.FromArgb(0xff, 0x23, 0x23, 0xff);
            ctlViewer.BackColor = Color.FromArgb(0xff, 0x23, 0x23, 0xff);
            this.Controls.Add(ctlViewer);
            this.ResumeLayout();

            _lOk = new Button();
            _lOk.Size = new Size(256, 64);
            _lOk.Visible = false;
            _lOk.BackColor = SystemColors.ButtonFace;
            _lDisplay.Controls.Add(_lOk);
        }
Example #41
0
 private void InitializeComponent()
 {
     ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_SendList));
     this.crv_Send = new CrystalReportViewer();
     base.SuspendLayout();
     this.crv_Send.ActiveViewIndex=-1;
     this.crv_Send.BorderStyle = BorderStyle.FixedSingle;
     this.crv_Send.Dock = DockStyle.Fill;
     this.crv_Send.Location = new Point(0, 0);
     this.crv_Send.Name = "crv_Send";
     this.crv_Send.SelectionFormula="";
     this.crv_Send.Size = new Size(0x2b7, 0x1ac);
     this.crv_Send.TabIndex = 1;
     this.crv_Send.ViewTimeSelectionFormula="";
     base.AutoScaleDimensions = new SizeF(6f, 12f);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.ClientSize = new Size(0x2b7, 0x1ac);
     base.Controls.Add(this.crv_Send);
     base.Icon = (Icon) manager.GetObject("$this.Icon");
     base.Name = "Frm_SendList";
     this.Text = "送货单";
     base.WindowState = FormWindowState.Maximized;
     base.Load += new EventHandler(this.Frm_SendList_Load);
     base.ResumeLayout(false);
 }
        public static void ViewerStatusBar(CrystalReportViewer viewer, bool visible)
        {
            if (viewer == null) throw new ArgumentNullException("viewer");

            foreach (Control control in viewer.Controls)
            {
                if (string.Compare(control.GetType().Name, "StatusBar", true, CultureInfo.InvariantCulture) == 0)
                {
                    control.Visible = visible;
                }
            }
        }
        public static void ViewerTabs(CrystalReportViewer viewer, bool visible)
        {
            if (viewer == null) throw new ArgumentNullException("viewer");

            foreach (Control control in viewer.Controls)
            {
                if (string.Compare(control.GetType().Name, "PageView", true, CultureInfo.InvariantCulture) == 0)
                {
                    TabControl tab = (TabControl)((PageView)control).Controls[0];

                    if (!visible)
                    {
                        tab.ItemSize = new Size(0, 1);
                        tab.SizeMode = TabSizeMode.Fixed;
                        tab.Appearance = TabAppearance.Buttons;
                    }
                    else
                    {
                        tab.ItemSize = new Size(67, 18);
                        tab.SizeMode = TabSizeMode.Normal;
                        tab.Appearance = TabAppearance.Normal;
                    }
                }
            }
        }
Example #44
0
    /// <summary>
    /// ReportViewer初始化
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void Page_Init(object sender, EventArgs e)
    {
        Cview = (CrystalReportViewer)this.Parent.FindControl(CrvName);

        Cview.EnableDatabaseLogonPrompt = false;
        Cview.EnableParameterPrompt = false;
        Cview.HasCrystalLogo = false;
        Cview.HasToggleGroupTreeButton = false;
        Cview.HasToggleParameterPanelButton = false;
        Cview.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
        Cview.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX;
        Cview.DisplayToolbar = false;

        Cview.Navigate += new NavigateEventHandler(Cview_Navigate);
        Cview.ViewZoom += new ZoomEventHandler(Cview_ViewZoom);     
       
    }
Example #45
0
        public Boolean printReport(CrystalDecisions.CrystalReports.Engine.ReportClass crReport, CrystalReportViewer CrystalReportViewer1, String param, String ParamName)
        {
            bool success=false;
            if (PrinterName!="none")
            {
                try
                {
                    paramField.ParameterFieldName = ParamName;
                    discreteVal.Value = param;
                    paramField.CurrentValues.Add (discreteVal);
                    paramFields.Add (paramField);

                    crReport.DataDefinition.ParameterFields[0].CurrentValues.Add (discreteVal);
                    CrystalReportViewer1.ReportSource = crReport;
                    CrystalReportViewer1.ParameterFieldInfo = paramFields;
                    CrystalReportViewer1.RefreshReport();

                    ParameterValues tmpParam = new ParameterValues();
                    tmpParam.Add(discreteVal);
                    crReport.DataDefinition.ParameterFields[0].ApplyCurrentValues(tmpParam);
                    crReport.PrintOptions.PrinterName = PrinterName;
                    //crReport.PrintToPrinter(1,false,1,1);
                    crReport.PrintToPrinter(1,false,1,99);
                    success=true;
                }
                catch{}
            }
            return success;
        }
        public static void ReplaceReportName(CrystalReportViewer viewer, string oldName, string newName)
        {
            if (viewer == null) throw new ArgumentNullException("viewer");
            if (oldName == null || oldName.Length == 0) throw new ArgumentException("May not be empty.", "oldName");

            foreach (Control control in viewer.Controls)
            {
                if (string.Compare(control.GetType().Name, "PageView", true, CultureInfo.InvariantCulture) == 0)
                {
                    foreach (Control controlInPage in control.Controls)
                    {
                        if (string.Compare(controlInPage.GetType().Name, "TabControl", true, CultureInfo.InvariantCulture) == 0)
                        {
                            TabControl tabs = (TabControl)controlInPage;

                            foreach (TabPage tabPage in tabs.TabPages)
                            {
                                if (string.Compare(tabPage.Text, oldName, false, CultureInfo.InvariantCulture) == 0)
                                {
                                    tabPage.Text = newName;
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #47
0
 public static void ExportPDF(ReportDocument rpt, string sCaminhoSave)
 {
     CrystalReportViewer cryView = new CrystalReportViewer();
     ExportOptions CrExportOptions;
     DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
     PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
     CrDiskFileDestinationOptions.DiskFileName = sCaminhoSave;
     CrExportOptions = rpt.ExportOptions;
     {
         CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
         CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
         CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
         CrExportOptions.FormatOptions = CrFormatTypeOptions;
     }
     rpt.Export();
 }
Example #48
0
        public void ShowReport(CrystalReportViewer rptView, DataSet ds, int tblIndex, string path,
                                 string sSelectionFormula, ArrayList lstParam = null, ArrayList paramName = null)
        {
            //CrystalDecisions.CrystalReports.Engine.ReportDocument obj = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            int pCount;
            ParameterFields paramFields = new ParameterFields();
            try
            {
                objReport = new ReportDocument();
                objReport.Load(Application.StartupPath + "\\Report\\RptBom.Rpt");
                TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
                TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
                ConnectionInfo crConnectionInfo = new ConnectionInfo();
                Tables CrTables;

                crConnectionInfo.ServerName = path;
                crConnectionInfo.DatabaseName = path;
                crConnectionInfo.UserID = "";
                crConnectionInfo.Password = "";

                CrTables = objReport.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }
                if (lstParam != null)
                {
                    pCount = lstParam.Count;
                    for (int i = 0; i < pCount; i++)
                    {
                        ParameterField paramField = new ParameterField();
                        ParameterDiscreteValue discreteVal = new ParameterDiscreteValue();

                        paramField.ParameterFieldName = paramName[i].ToString();
                        // Set the discrete value and pass it to the parameter
                        discreteVal.Value = lstParam[i].ToString();
                        paramField.CurrentValues.Add(discreteVal);
                        // Add parameter to the parameter fields collection.
                        paramFields.Add(paramField);
                    }
                }

                if (sSelectionFormula.Length > 0)
                {
                    objReport.RecordSelectionFormula = sSelectionFormula;
                }

                rptView.ReportSource = null;
                rptView.ParameterFieldInfo = paramFields;
                rptView.ReuseParameterValuesOnRefresh = true;
                rptView.ReportSource = objReport;

                for (int i = 0; i < rptView.LogOnInfo.Count; i++)
                {
                    rptView.LogOnInfo[i].ConnectionInfo = crConnectionInfo;
                }
                rptView.Refresh();
                rptView.Show();
                //objReport.Database.Dispose();
                //objReport.Dispose();
                //objReport.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
            finally
            {
                //objReport.Database.Dispose();
                //objReport.Dispose();
                //objReport.Close();
                //paramFields = null;
            }
        }