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

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        private void btnsubmit_sheet_Click(object sender, EventArgs e)
        {
            SqlConnection sqlcon  = new SqlConnection();
            SqlCommand    sqlcomm = new SqlCommand();

            try
            {
                balanced_sheet_report name_report = new balanced_sheet_report();

                sqlcon = new SqlConnection(ConfigurationSettings.AppSettings["photostudioConnectionString"].ToString());
                sqlcon.Open();
                sqlcomm             = new SqlCommand();
                sqlcomm.Connection  = sqlcon;
                sqlcomm.CommandType = CommandType.StoredProcedure;
                sqlcomm.CommandText = "balanced_sheet ";
                sqlcomm.Parameters.Add(new SqlParameter("@branch", SqlDbType.VarChar, 50));
                sqlcomm.Parameters.Add(new SqlParameter("@from", SqlDbType.DateTime, 50));
                sqlcomm.Parameters.Add(new SqlParameter("@to", SqlDbType.DateTime, 50));
                sqlcomm.Parameters["@branch"].Value = combo_branch_sheet.Text;
                sqlcomm.Parameters["@from"].Value   = dtpickfrom_expense.Text;
                sqlcomm.Parameters["@to"].Value     = dtpickto_expense.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)
                {
                    balanced_reportviewer.Refresh();
                    MessageBox.Show("No branch of such name!");
                    balanced_reportviewer.ReportSource = null;
                    return;
                }
                name_report.SetDataSource(ds1.Tables[0]);
                balanced_reportviewer.ReportSource = name_report;
                SqlCommand com = new SqlCommand();
                com.Connection  = sqlcon;
                com.CommandText = "drop table tbltemp";
                com.ExecuteNonQuery();
                ds1.Clear();
                sqlcon.Close();
                sqlcon.Dispose();
                combo_branch_sheet.Text = "";
            }
            catch
            {
            }
            finally
            {
                sqlcon.Close();
                sqlcon.Dispose();
            }
        }