public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            LagerReport rpt = new LagerReport();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text == "" || textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Fill up all fields correctly.");
            }
            else
            {
                try
                {

                    string q = "select sum(quantity) as quantity from challanIn where itemCode='" + comboBox1.Text + "' and cdate>='" + textBox1.Text + "' and cdate <='" + textBox2.Text + "'";
                    string q2 = "select distinct itemCode,itemName,pPrice,sPrice from challanIn where itemCode='" + comboBox1.Text + "' and cdate>='" + textBox1.Text + "' and cdate <='" + textBox2.Text + "'";
                    string q3 = "select sum(quantity) as squantity from Sales where itemCode='" + comboBox1.Text + "' and sDate>='" + textBox1.Text + "' and sDate <='" + textBox2.Text + "'";
                    con.Open();

                    SqlDataAdapter da = new SqlDataAdapter();
                    da.SelectCommand = new SqlCommand(q, con);
                    DataTable dt = new DataTable();

                    ILdataset mydataset = new ILdataset();
                    da.Fill(mydataset, "Qty");
                    da.Dispose();

                    SqlDataAdapter da2 = new SqlDataAdapter();
                    da2.SelectCommand = new SqlCommand(q2, con);
                    da2.Fill(mydataset, "itemInfo");
                    da2.Dispose();

                    SqlDataAdapter da3 = new SqlDataAdapter();
                    da3.SelectCommand = new SqlCommand(q3, con);
                    da3.Fill(mydataset, "salesQty");
                    da3.Dispose();

                    LagerReport myreport = new LagerReport();
                    myreport.SetDataSource(mydataset);
                    crystalReportViewer1.ReportSource = myreport;

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text == "" || textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Fill up all fields correctly.");
            }
            else
            {
                try
                {
                    string q  = "select sum(quantity) as quantity from challanIn where itemCode='" + comboBox1.Text + "' and cdate>='" + textBox1.Text + "' and cdate <='" + textBox2.Text + "'";
                    string q2 = "select distinct itemCode,itemName,pPrice,sPrice from challanIn where itemCode='" + comboBox1.Text + "' and cdate>='" + textBox1.Text + "' and cdate <='" + textBox2.Text + "'";
                    string q3 = "select sum(quantity) as squantity from Sales where itemCode='" + comboBox1.Text + "' and sDate>='" + textBox1.Text + "' and sDate <='" + textBox2.Text + "'";
                    con.Open();


                    SqlDataAdapter da = new SqlDataAdapter();
                    da.SelectCommand = new SqlCommand(q, con);
                    DataTable dt = new DataTable();

                    ILdataset mydataset = new ILdataset();
                    da.Fill(mydataset, "Qty");
                    da.Dispose();

                    SqlDataAdapter da2 = new SqlDataAdapter();
                    da2.SelectCommand = new SqlCommand(q2, con);
                    da2.Fill(mydataset, "itemInfo");
                    da2.Dispose();

                    SqlDataAdapter da3 = new SqlDataAdapter();
                    da3.SelectCommand = new SqlCommand(q3, con);
                    da3.Fill(mydataset, "salesQty");
                    da3.Dispose();

                    LagerReport myreport = new LagerReport();
                    myreport.SetDataSource(mydataset);
                    crystalReportViewer1.ReportSource = myreport;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     LagerReport rpt = new LagerReport();
     rpt.Site = this.Site;
     return rpt;
 }