Пример #1
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime vDateFrom = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo   = DateTime.Today.Date; // DateTime.Today.Date.Month.ToString() + "/" + DateTime.Today.Date.Day.ToString() + "/" + DateTime.Today.Date.Year.ToString();

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();



                if (optRange.Checked == true)
                {
                    vDateFrom = dt_From.Value;   //dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString();
                    vDateTo   = dt_ToDate.Value; //dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString();
                }

                DataTable dt = objDAL.getCashBook(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString());
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }
                vForm.ShowCashBook(vDateFrom, vDateTo, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }