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

            rpt.Site = this.Site;
            return(rpt);
        }
Ejemplo n.º 2
0
        private void btnsubmit_income_Click(object sender, EventArgs e)
        {
            SqlConnection sqlcon  = new SqlConnection();
            SqlCommand    sqlcomm = new SqlCommand();

            try
            {
                branch_income_report name_report = new branch_income_report();

                sqlcon = new SqlConnection(ConfigurationSettings.AppSettings["photostudioConnectionString"].ToString());
                sqlcon.Open();
                sqlcomm             = new SqlCommand();
                sqlcomm.Connection  = sqlcon;
                sqlcomm.CommandType = CommandType.StoredProcedure;
                sqlcomm.CommandText = "branch_totalincome_report";
                sqlcomm.Parameters.Add(new SqlParameter("@branch", SqlDbType.VarChar, 50));
                sqlcomm.Parameters["@branch"].Value = combo_branchincome.Text;
                SqlDataAdapter dta = new SqlDataAdapter(sqlcomm);
                DataSet        ds1 = new DataSet();
                dta.Fill(ds1, "table");
                int row_count = ds1.Tables[0].Rows.Count;

                if (row_count == 0)
                {
                    branch_income_reportviewer.Refresh();
                    MessageBox.Show("No branch of such name!");
                    branch_income_reportviewer.ReportSource = null;
                    return;
                }
                name_report.SetDataSource(ds1.Tables[0]);
                branch_income_reportviewer.ReportSource = name_report;
                sqlcon.Close();
                sqlcon.Dispose();
                combo_branchincome.Text = "";
            }
            catch
            {
            }
            finally
            {
                sqlcon.Close();
                sqlcon.Dispose();
            }
        }