예제 #1
0
        public void Show()
        {
            Form frm = new Form();

            CrystalDecisions.Windows.Forms.CrystalReportViewer Cry = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
            frm.WindowState = FormWindowState.Maximized;
            frm.Controls.Add(Cry);
            Cry.Refresh();
            Cry.Dock         = DockStyle.Fill;
            Cry.ReportSource = DEC;
            Cry.Refresh();
            //Cry.DisplayGroupTree = false;
            //Cry.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
            frm.Show();
        }
예제 #2
0
        public void ViewReport(CrystalDecisions.Windows.Forms.CrystalReportViewer CrViewer, string Reportname, string rsSelectionformula, string paraname1, string paraname2, string paraname3, string paraname4, string paraname5, string paraname6, string paraname7, string paravalue1, string paravalue2, string paravalue3, string paravalue4, string paravalue5, string paravalue6, string paravalue7, int SendToPrinter, Form frm)
        {
            rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            string REPORTSPATH = Application.StartupPath + ConfigurationManager.AppSettings["ShareFolder"];

            rpt.Load((REPORTSPATH + ("\\" + Reportname)));
            rpt.SetParameterValue(paraname1, paravalue1);
            rpt.SetParameterValue(paraname2, paravalue2);
            rpt.SetParameterValue(paraname3, paravalue3);
            rpt.SetParameterValue(paraname4, paravalue4);
            rpt.SetParameterValue(paraname5, paravalue5);
            rpt.SetParameterValue(paraname6, paravalue6);
            rpt.SetParameterValue(paraname7, paravalue7);
            //  CrystalDecisions.CrystalReports.Engine.Table tdCurr;

            foreach (CrystalDecisions.CrystalReports.Engine.Table tdCurr in rpt.Database.Tables)
            {
                rptTLInfo = new CrystalDecisions.Shared.TableLogOnInfo();
                rptTLInfo = tdCurr.LogOnInfo;
                // With...
                //SERVERNAME.Password = "******";
                //dataBaseName.ServerName = "SA";
                rptTLInfo.ConnectionInfo.DatabaseName = "IMS";
                tdCurr.ApplyLogOnInfo(rptTLInfo);
            }
            rpt.SetDatabaseLogon("", "", ".", "IMS");
            rpt.SummaryInfo.ReportAuthor = RptAuthor;
            if ((rsSelectionformula != ""))
            {
                rpt.RecordSelectionFormula = rsSelectionformula;
            }

            if ((SendToPrinter == 1))
            {
                try
                {
                    rpt.PrintToPrinter(1, true, 1, 1);
                }
                catch (Exception ex)
                {
                    //  MsgBox(ex.Message);
                }
            }
            else
            {
                //if (((Para1 == null)
                //            == false)) {
                //    CrViewer.ParameterFieldInfo = parameters;
                //}

                CrViewer.ReportSource = rpt;
                CrViewer.Refresh();
                if ((frm.Tag != "ALL BILL REPORT"))
                {
                    //    frm.Show();
                    //   SHOW_PLEASE_WAIT(false);
                }
            }
        }
예제 #3
0
        public bool ShowDocument(string strNomFichierLocal)
        {
            //Masque tous les contrôles de visualisation
            foreach (Control ctrl in this.Controls)
            {
                ctrl.Hide();
            }

            if (File.Exists(strNomFichierLocal))
            {
                try
                {
                    //PDF
                    //Un fichier PDF commence par '%PDF'
                    if (VerifieSignature(strNomFichierLocal, new char[] { '%', 'P', 'D', 'F' }))
                    {
                        //A implémenter : le pdf
                        return(false);
                    }
                }
                catch {}
                try
                {
                    //RPT
                    //Un rpt commence par 00 CF 11 e0 a1 b1 1a e1
                    //mais je n'en suis pas sûr !
                    char[] sgn = new char[] { '\xD0', '\xCF', '\x11', '\xe0', '\xa1', '\xb1', '\x1a', '\xe1' };
                    if (VerifieSignature(strNomFichierLocal, sgn))
                    {
                        ReportDocument document = new ReportDocument();
                        document.Load(strNomFichierLocal);
                        m_viewerCrystal.Dock         = DockStyle.Fill;
                        m_viewerCrystal.Visible      = true;
                        m_viewerCrystal.ReportSource = document;
                        m_viewerCrystal.Refresh();
                        return(true);
                    }
                }
                catch {}
                try
                {
                    //Image
                    Image img = Image.FromFile(strNomFichierLocal);
                    if (img != null)
                    {
                        m_wndImageViewer.Dock    = DockStyle.Fill;
                        m_wndImageViewer.Image   = img;
                        m_wndImageViewer.Visible = true;
                        return(true);
                    }
                }
                catch
                {}
            }

            return(false);
        }
예제 #4
0
파일: Utility.cs 프로젝트: taiab/POS
        public static CrystalDecisions.Windows.Forms.CrystalReportViewer ViewReport(string reportName, List <KeyValuePair <string, object> > Param_Values)
        {
            ReportDocument _reportDocument = new ReportDocument();

            CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
            crystalReportViewer1.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo  crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo  crConnectionInfo  = new ConnectionInfo();
            Tables          crTables;

            // load report

            _reportDocument.Load(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\Reports\\" + reportName);
            // set report Connection info
            string[] LoginData = ConfigurationManager.ConnectionStrings["Local"].ConnectionString.ToString().Split(';');
            if (!string.IsNullOrEmpty(LoginData[3].ToString()) && LoginData[3].ToString() != "")
            {
                crConnectionInfo.Password = LoginData[3].Split('=')[1].ToString();
            }

            crConnectionInfo.UserID       = LoginData[2].Split('=')[1].ToString();
            crConnectionInfo.DatabaseName = LoginData[1].Split('=')[1];
            crConnectionInfo.ServerName   = LoginData[0].Split('=')[1];
            crTables = _reportDocument.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in crTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            _reportDocument.Refresh();
            // set report Parameter
            if (Param_Values != null)
            {
                foreach (KeyValuePair <string, object> Param_Value in Param_Values)
                {
                    // _reportDocument.SetParameterValue("SalesHeaderID",Param_Value.Value);
                    _reportDocument.SetParameterValue((string)Param_Value.Key, (object)Param_Value.Value);
                }
            }
            crystalReportViewer1.ReportSource = _reportDocument;
            crystalReportViewer1.Refresh();

            crystalReportViewer1.Name = "crystalReportViewer1";

            return(crystalReportViewer1);
        }
예제 #5
0
        private void m_mthSetData(cls3DItem[] arrItems)
        {
            if (arrItems == null)
            {
                return;
            }

            DataSet   objSet = m_objCreateDS();
            DataTable objDT  = objSet.Tables["tbReport"];

            for (int i = 0; i < arrItems.Length; i++)
            {
                DataRow objRow = objDT.NewRow();
                arrItems[i].ToDataRow(ref objRow);
                objDT.Rows.Add(objRow);
            }

            m_objDocument.SetDataSource(objSet);
            m_objDocument.Refresh();
            crystalReportViewer1.ReportSource = m_objDocument;
            crystalReportViewer1.Refresh();
        }
예제 #6
0
        public FRM_reportViewer(SortedList pSqlCommand, DataSet pDataSet, ReportClass pReport)
        {
            InitializeComponent();
            try
            {
                System.Data.SqlClient.SqlDataAdapter vSqlDataAdapter = new System.Data.SqlClient.SqlDataAdapter();
                IDictionaryEnumerator vEnum = pSqlCommand.GetEnumerator();
                DataSet vReportDs           = new DataSet();
                while (vEnum.MoveNext())
                {
                    vSqlDataAdapter.SelectCommand            = (SqlCommand)vEnum.Value;
                    vSqlDataAdapter.SelectCommand.Connection = BasicClass.vSqlConn;
                    string vTableName = "";
                    vTableName = vEnum.Key.ToString();
                    DataTable vTable = new DataTable();
                    // vTable = vReportDs.Tables[vTableName];


                    if (vTable != null)
                    {
                        vTable.Clear();
                    }

                    vTable.TableName = vTableName;
                    vSqlDataAdapter.Fill(vTable);
                    vReportDs.Tables.Add(vTable);
                }
                pReport.SetDataSource(vReportDs);
                crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                crystalReportViewer1.ReportSource = pReport;
                crystalReportViewer1.Refresh();
                //crystalReportViewer1.ReportSource = pReport;
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex.Message, this.Name, "FRM_reportViewer");
            }
        }
예제 #7
0
 private void GenerarNotaTerminacion(string numeroPedido)
 {
     crystalReportViewer1.ReportSource = GeneararNotaConfirmacion(numeroPedido);
     crystalReportViewer1.Refresh();
 }
예제 #8
0
파일: Utility.cs 프로젝트: kimboox44/POS
        public static CrystalDecisions.Windows.Forms.CrystalReportViewer ViewReport(string reportName, List<KeyValuePair<string, object>> Param_Values)
        {
            ReportDocument _reportDocument = new ReportDocument();
            CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
            crystalReportViewer1.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            Tables crTables;
            // load report      

            _reportDocument.Load(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\Reports\\" + reportName);
            // set report Connection info
            string[] LoginData = ConfigurationManager.ConnectionStrings["Local"].ConnectionString.ToString().Split(';');
            if (!string.IsNullOrEmpty(LoginData[3].ToString()) && LoginData[3].ToString() != "")
                crConnectionInfo.Password = LoginData[3].Split('=')[1].ToString();

            crConnectionInfo.UserID = LoginData[2].Split('=')[1].ToString();
            crConnectionInfo.DatabaseName = LoginData[1].Split('=')[1];
            crConnectionInfo.ServerName = LoginData[0].Split('=')[1];
            crTables = _reportDocument.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in crTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            _reportDocument.Refresh();
            // set report Parameter          
            if (Param_Values != null)
            {
                foreach (KeyValuePair<string, object> Param_Value in Param_Values)
                {
                    // _reportDocument.SetParameterValue("SalesHeaderID",Param_Value.Value);
                    _reportDocument.SetParameterValue((string)Param_Value.Key, (object)Param_Value.Value);
                }
            }
            crystalReportViewer1.ReportSource = _reportDocument;
            crystalReportViewer1.Refresh();
            
            crystalReportViewer1.Name = "crystalReportViewer1";

            return crystalReportViewer1;

        }