Exemple #1
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            message1.Clear();
            string  month            = cmbMonth.Text.Trim();
            string  year             = cmbYear.Text.Trim();
            DataSet dsReportData     = new DataSet();
            int     columnIndex      = 0;
            string  reportStatistics = string.Empty;
            string  message          = string.Empty;

            if (month.Equals("[SELECT]"))
            {
                message = MessageManager.GetMessage("44");
                errorProvider1.SetError(cmbMonth, message);
                message1.MessageText         = message;
                grpExpenseStatistics.Visible = false;
                grpReport.Visible            = false;
                return;
            }

            if (year.Equals("[SELECT]"))
            {
                message = MessageManager.GetMessage("44");
                errorProvider1.SetError(cmbYear, message);
                message1.MessageText         = message;
                grpExpenseStatistics.Visible = false;
                grpReport.Visible            = false;
                return;
            }

            if (rbnIndividual.Checked)
            {
                dsReportData = monthlyReport.MonthlyReportData(month, year, MonthlyReport.ReportType.Individual);
            }
            else
            {
                dsReportData = monthlyReport.MonthlyReportData(month, year, MonthlyReport.ReportType.ItemWise);
            }

            if (dsReportData.Tables[0].Rows.Count > 0)
            {
                lblMessage.Text              = monthlyReport.GeneralDetails(month, year);
                lblFinalizeDetails.Text      = GetReportFinalizationDetails(month, year);
                grpExpenseStatistics.Visible = true;
                grpReport.Visible            = true;
                dgrReport.DataSource         = dsReportData.Tables[0];

                if (rbnIndividual.Checked)
                {
                    dgrReport.Columns[0].Visible = false;
                }

                columnIndex = rbnIndividual.Checked == true ? 2 : 1;
                dgrReport.Columns[columnIndex].Width = 150;
                SetGridStyle();
            }
            else
            {
                grpExpenseStatistics.Visible = false;
                grpReport.Visible            = false;
                MessageManager.DisplayMessage("45", month, year);
            }
        }
Exemple #2
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            message1.Clear();
            MonthlyReport monthlyReport = new MonthlyReport();
            string        month         = cmbMonth.Text.Trim();
            string        year          = cmbYear.Text.Trim();
            DataSet       dsReportData  = new DataSet();
            string        message       = string.Empty;

            if (month.Equals("[SELECT]") && year.Equals("[SELECT]"))
            {
                message = MessageManager.GetMessage("44");
                message1.MessageText = message;
                errorProvider1.SetError(cmbYear, message);
                errorProvider1.SetError(cmbMonth, message);

                dgrAnalyticReport.Visible = false;
                return;
            }

            if (month.Equals("[SELECT]"))
            {
                message = MessageManager.GetMessage("44");
                message1.MessageText = message;
                errorProvider1.SetError(cmbMonth, message);

                dgrAnalyticReport.Visible = false;
                return;
            }

            if (year.Equals("[SELECT]"))
            {
                message = MessageManager.GetMessage("44");
                message1.MessageText = message;
                errorProvider1.SetError(cmbYear, message);

                dgrAnalyticReport.Visible = false;
                return;
            }

            dsReportData = monthlyReport.MonthlyReportData(month, year);
            Analytics analytics = new Analytics();
            DataTable table     = new DataTable();

            if (rbnItemWise.Checked)
            {
                table = analytics.AnalyticReport(month, year, Analytics.AnalyticReportType.ItemWise);
            }
            else
            {
                table = analytics.AnalyticReport(month, year, Analytics.AnalyticReportType.Individual);
            }

            if (table.Rows.Count > 0)
            {
                dgrAnalyticReport.Visible    = true;
                dgrAnalyticReport.DataSource = table;
                grpAnalyticReport.Visible    = true;
                SetGridStyle();
            }
            else
            {
                grpAnalyticReport.Visible = false;
                dgrAnalyticReport.Visible = false;
                MessageManager.DisplayMessage("45", month, year);
            }
        }