예제 #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         if (cmbCurrency.Text == "")
         {
             MessageBox.Show("Selectati moneda", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
             cmbCurrency.Focus();
             return;
         }
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         rptVanzari rpt = new rptVanzari();
         //The report you created.
         cmd = new SqlCommand();
         SqlDataAdapter myDA = new SqlDataAdapter();
         DataSet        myDS = new DataSet();
         //The DataSet you created.
         con             = new SqlConnection(cs.DBConn);
         cmd.Connection  = con;
         cmd.CommandText = "SELECT Nr_plata,Data_plata,Valoare_TVA,Valoare_reducere,Total_general,Nume_moneda from Informatii_facturi,Moneda where Informatii_facturi.Id_moneda=Id_moneda and Data_plata between @d1 and @d2 and Nume_moneda='" + cmbCurrency.Text + "' order by Data_plata";
         cmd.Parameters.Add("@d1", SqlDbType.DateTime, 30, "Data_plata").Value = dateTimePicker2.Value.Date;
         cmd.Parameters.Add("@d2", SqlDbType.DateTime, 30, "Data_plata").Value = dateTimePicker1.Value.Date;
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "Informatii_facturi");
         myDA.Fill(myDS, "Moneda");
         rpt.SetDataSource(myDS);
         crystalReportViewer2.ReportSource = rpt;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptVanzari rpt = new rptVanzari();

            rpt.Site = this.Site;
            return(rpt);
        }