Exemple #1
0
        public DataTable MonthlyTrendReport(string month, string year)
        {
            DataTable data = new DataTable();

            //Checks that Data exist for present month or not?
            string presentMMYYYY = arch.DecodeMonthYear(month, year);
            bool dataExistForPresntMonth = commonReportArch.DataExistForMonth(month, year);

            //Checks that Data exist for prev month or not?            
            string previousMonth = arch.GetPreviousMonth(month);
            string previousMonthYear = arch.GetPrevMonthsYear(month, year);
            string prevMMYYYY = arch.DecodeMonthYear(previousMonth, previousMonthYear);
            bool dataExistForPrevMonth = commonReportArch.DataExistForMonth(previousMonth, previousMonthYear);

            //Checks that Data exist for next month or not?
            string nextMonth = arch.GetNextMonth(month);
            string nextMonthYear = arch.GetNextMonthsYear(month, year);
            string nextMMYYYY = arch.DecodeMonthYear(nextMonth, nextMonthYear);
            bool dataExistForNextMonth = commonReportArch.DataExistForMonth(nextMonth, nextMonthYear);

            string[,] reportData = null;

            string[] columnName = null ;

            if (dataExistForPresntMonth && dataExistForPrevMonth && dataExistForNextMonth)
            {
                columnName = new string[] { "Expensed By", previousMonth + " (Prev.)", "Trend1", month + " (Pres.)", "Trend2", nextMonth + " (Nxt.)" };
                reportData = new string[reportArch.GetAllUsers().Length, 6];
                reportData = GetReportData1(prevMMYYYY, presentMMYYYY, nextMMYYYY);
                data = arch.GetDataTableFrom2DArray(columnName, reportData);
            }
            else if (dataExistForPresntMonth && dataExistForPrevMonth && !dataExistForNextMonth)
            {
                columnName = new string[] { "Expensed By", previousMonth + " (Prev.)", "Trend", month + " (Pres.)" };
                reportData = new string[reportArch.GetAllUsers().Length, 4];
                reportData = GetReportData2(prevMMYYYY, presentMMYYYY);
                data = arch.GetDataTableFrom2DArray(columnName, reportData);
            }
            else if (dataExistForPresntMonth && !dataExistForPrevMonth && !dataExistForNextMonth)
            {
                columnName = new string[] { "Expensed By", month + " (Pres.)" };
                data = reportArch.MonthlyReportData(month, year);
            }
            else if (dataExistForPresntMonth && !dataExistForPrevMonth && dataExistForNextMonth)
            {
                columnName = new string[] { "Expensed By", month + " (Pres.)", "Trend", nextMonth + " (Nxt.)" };
                reportData = new string[reportArch.GetAllUsers().Length, 4];
                reportData = GetReportData2(presentMMYYYY, nextMMYYYY);
                data = arch.GetDataTableFrom2DArray(columnName, reportData);
            }

            return data;
        }
        public DataTable GetDataTableForDisplay()
        {
            DataTable table = new DataTable();
            Arch      arch  = new Arch();

            string[] columnName = { "Sl", "expby", "HasPaid", "PayGet", "Amount" };
            string[,] reportData = GetReportArray();

            if (reportData != null)
            {
                table = arch.GetDataTableFrom2DArray(columnName, reportData);
            }

            return(table);
        }