Esempio n. 1
0
        private void generate_purchase_report_Load(object sender, EventArgs e)
        {
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
            con.Open();

            DataSet3 ds = new DataSet3();

            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = j;
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(ds.DataTable1);
            da.Fill(dt);
            tot = 0;
            foreach (DataRow dr in dt.Rows)
            {
                tot += Convert.ToInt32(dr["product_total"].ToString());
            }

            CrystalReport3 myreport = new CrystalReport3();

            myreport.SetDataSource(ds);
            myreport.SetParameterValue("total", tot.ToString());
            crystalReportViewer1.ReportSource = myreport;
        }
Esempio n. 2
0
        private void Form14_Load(object sender, EventArgs e)
        {
            CrystalReport3 rapor = new CrystalReport3();

            CrystalDecisions.Shared.ParameterValues parametre = new
                                                                CrystalDecisions.Shared.ParameterValues();
            CrystalDecisions.Shared.ParameterDiscreteValue deger = new
                                                                   CrystalDecisions.Shared.ParameterDiscreteValue();
            deger.Value = Form12.kodx;
            parametre.Add(deger);
            rapor.DataDefinition.ParameterFields["tcno"].ApplyCurrentValues(parametre);
            crystalReportViewer1.ReportSource = rapor;
        }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            CrystalReport3 cr  = new CrystalReport3();
            SqlConnection  con = new SqlConnection();

            con.ConnectionString = ConfigurationManager.ConnectionStrings["ConnStringDb1"].ConnectionString;
            string         sql = "select * from QR WHERE ID =" + 3;
            DataSet        ds  = new DataSet();
            SqlDataAdapter ad  = new SqlDataAdapter(sql, con);

            ad.Fill(ds, "Table1");
            cr.SetDataSource(ds.Tables["Table1"]);
            crystalReportViewer1.ReportSource = cr;
            crystalReportViewer1.Refresh();
        }
Esempio n. 4
0
        private void CRReloader()
        {
            calendar1.Visible = true;
            try
            {
                if (comboBox1.Text == "View all readings in a selected date" || comboBox1.Text == "Average Per Hour")
                {
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vmMonth, MonthCalendar.ViewMode.vmYear);
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vmMonth, MonthCalendar.ViewMode.vm12Years);
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vmMonth, MonthCalendar.ViewMode.vm120Years);
                    calendar1.OnlyMonthMode = true;
                    if (comboBox1.Text == "View all readings in a selected date")
                    {
                        PictureLoad();
                        string          source = "SELECT [Systolic],[Diastolic],[CDate],[CTime],[Status] from Record WHERE [PatientID] = '" + MainForm.patientID + "' and [CDate] = #" + calendar1.SelectedDate + "#";
                        OleDbConnection con    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\Patient\'s Record.accdb");
                        con.Open();
                        OleDbDataAdapter adapt = new OleDbDataAdapter(source, con);
                        DataSet          ds    = new DataSet();
                        ds.Tables.Add();
                        adapt.Fill(ds.Tables[0]);
                        con.Close();

                        source = "SELECT * from Profile";
                        con    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\Patient\'s Record.accdb");
                        con.Open();
                        adapt = new OleDbDataAdapter(source, con);
                        ds.Tables.Add();
                        adapt.Fill(ds.Tables[1]);
                        con.Close();

                        CrystalReport1 rep = new CrystalReport1();
                        rep.Database.Tables[0].SetDataSource(ds.Tables[0]);
                        rep.Database.Tables[1].SetDataSource(ds.Tables[1]);

                        crystalReportViewer1.ReportSource = rep;
                        crystalReportViewer1.Refresh();
                    }
                    else if (comboBox1.Text == "Average Per Hour")
                    {
                        PictureLoad();
                        string          source = "SELECT Sys, Dias, Hour, CDate, Stat From HourTable Where PatientID ='" + MainForm.patientID + "' and CDate = #" + calendar1.SelectedDate + "#";
                        OleDbConnection con    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\Patient\'s Record.accdb");
                        con.Open();
                        OleDbDataAdapter adapt = new OleDbDataAdapter(source, con);
                        DataSet          ds    = new DataSet();
                        ds.Tables.Add();
                        adapt.Fill(ds.Tables[0]);
                        con.Close();

                        source = "SELECT * from Profile WHERE PatientID ='" + MainForm.patientID + "'";
                        con    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\Patient\'s Record.accdb");
                        con.Open();
                        adapt = new OleDbDataAdapter(source, con);
                        ds.Tables.Add();
                        adapt.Fill(ds.Tables[1]);
                        con.Close();

                        CrystalReport2 rep = new CrystalReport2();
                        rep.Database.Tables[0].SetDataSource(ds.Tables[0]);
                        rep.Database.Tables[1].SetDataSource(ds.Tables[1]);

                        crystalReportViewer1.ReportSource = rep;
                        crystalReportViewer1.Refresh();
                    }
                }
                else if (comboBox1.Text == "Average Per Month")
                {
                    PictureLoad();
                    calendar1.OnlyMonthMode = false;
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vmYear, MonthCalendar.ViewMode.vmYear);
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vmYear, MonthCalendar.ViewMode.vm12Years);
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vmYear, MonthCalendar.ViewMode.vm120Years);

                    string          source = "SELECT Sys, Dias, Month, Year, Stat From MonthTable Where PatientID ='" + MainForm.patientID + "' and Year = " + calendar1.SelectedDate.Year;
                    OleDbConnection con    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\Patient\'s Record.accdb");
                    con.Open();
                    OleDbDataAdapter adapt = new OleDbDataAdapter(source, con);
                    DataSet          ds    = new DataSet();
                    ds.Tables.Add();
                    adapt.Fill(ds.Tables[0]);
                    con.Close();

                    source = "SELECT * from Profile WHERE PatientID ='" + MainForm.patientID + "'";
                    con    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\Patient\'s Record.accdb");
                    con.Open();
                    adapt = new OleDbDataAdapter(source, con);
                    ds.Tables.Add();
                    adapt.Fill(ds.Tables[1]);
                    con.Close();

                    CrystalReport3 rep = new CrystalReport3();
                    rep.Database.Tables[0].SetDataSource(ds.Tables[0]);
                    rep.Database.Tables[1].SetDataSource(ds.Tables[1]);

                    crystalReportViewer1.ReportSource = rep;
                    crystalReportViewer1.Refresh();
                }
                else if (comboBox1.Text == "Average Per Year")
                {
                    PictureLoad();
                    calendar1.OnlyMonthMode = false;
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vm12Years, MonthCalendar.ViewMode.vmYear);
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vm12Years, MonthCalendar.ViewMode.vm12Years);
                    calendar1.SetViewMode(MonthCalendar.ViewMode.vm12Years, MonthCalendar.ViewMode.vm120Years);
                    string          source = "SELECT Sys, Dias, Year, Stat From YearTable Where PatientID ='" + MainForm.patientID + "' and Year BETWEEN " + calendar1.year1 + " and " + calendar1.year12;
                    OleDbConnection con    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\Patient\'s Record.accdb");
                    con.Open();
                    OleDbDataAdapter adapt = new OleDbDataAdapter(source, con);
                    DataSet          ds    = new DataSet();
                    ds.Tables.Add();
                    adapt.Fill(ds.Tables[0]);
                    con.Close();

                    source = "SELECT * from Profile WHERE PatientID ='" + MainForm.patientID + "'";
                    con    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\Patient\'s Record.accdb");
                    con.Open();
                    adapt = new OleDbDataAdapter(source, con);
                    ds.Tables.Add();
                    adapt.Fill(ds.Tables[1]);
                    con.Close();

                    CrystalReport4 rep = new CrystalReport4();
                    rep.Database.Tables[0].SetDataSource(ds.Tables[0]);
                    rep.Database.Tables[1].SetDataSource(ds.Tables[1]);

                    crystalReportViewer1.ReportSource = rep;
                    crystalReportViewer1.Refresh();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid operation has been detected!");
                Application.Exit();
            }
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     CrystalReport3 rpt = new CrystalReport3();
     rpt.Site = this.Site;
     return rpt;
 }
        private void button9_Click(object sender, EventArgs e)
        {
            string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; " +
                                      "Data Source=Kyrsovaya.mdb";
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = ConnectionString;
            OleDbCommand myCommand;
            string sq1;

            sq1 = "SELECT * FROM Клиенты";
            myCommand = new OleDbCommand(sq1, connection);
            connection.Open();
            OleDbDataAdapter da = new OleDbDataAdapter(myCommand);
            DataSet ds = new DataSet();
            da.Fill(ds, "Результат");
            ds.WriteXmlSchema("schema3.xml");

            CrystalReport3 rpt = new CrystalReport3();
            rpt.SetDataSource(ds);
            crystalReportViewer3.ReportSource = rpt;

            connection.Close();
        }