예제 #1
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime vDateFrom  = Convert.ToDateTime("1/1/2000");
                DateTime vDateTo    = DateTime.Today.Date;
                string   vNarration = "";

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



                if (optRange.Checked == true)
                {
                    vDateFrom  = dt_From.Value;
                    vDateTo    = dt_ToDate.Value;
                    vNarration = "From " + dt_From.Value.ToShortDateString() + " To " + dt_ToDate.Value.ToShortDateString();
                }
                else
                {
                    vNarration = "For the Period Ended " + dt_ToDate.Value.ToString("dd-MMM-yyyy");
                }

                DataTable dt = objDAL.getProfitAndLoss(vDateFrom.ToShortDateString(), vDateTo.ToShortDateString(), true);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }



                vForm.ShowExenseSheet(vNarration, dt);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }