コード例 #1
0
ファイル: Report.aspx.cs プロジェクト: thanyaammyy/data-entry
        private void ShowMonthlyReport(string monthlyDate, int propertyId)
        {
            if (string.IsNullOrEmpty(monthlyDate) || propertyId <= 0)
            {
                lbCompany2.Visible    = true;
                lbMonthlyDate.Visible = true;
                lbError2.Visible      = true;
            }
            else
            {
                lbCompany2.Visible    = false;
                lbMonthlyDate.Visible = false;
                lbError2.Visible      = false;

                divJqGridMonthlyReport.Attributes["style"] = "display:";
                divExportData2.Attributes["style"]         = "display:";

                var sesseionDateFrom = monthlyDate;
                var strFrom          = sesseionDateFrom.Split('/');
                var fromMonth        = Convert.ToInt32(strFrom[0]);
                var fromYear         = Convert.ToInt32(strFrom[1]);
                var endDate          = RevenueHelper.GetLastDayOfMonth(fromMonth, fromYear);

                //MTD
                var dateTimeFromThisMonth = new DateTime(fromYear, fromMonth, 1);
                var dateTimeToThisMonth   = new DateTime(fromYear, fromMonth, endDate);

                //MTD-LY
                var dateTimeFromThisMonthLY = dateTimeFromThisMonth.AddYears(-1);
                var dateTimeToThisMonthLY   = dateTimeToThisMonth.AddYears(-1);

                //YTD
                var dateTimeFromYtd = new DateTime(fromYear, 1, 1);
                var dateTimeToYtd   = new DateTime(fromYear, fromMonth, endDate);

                //YTD-LY
                var dateTimeFromYtdLY = dateTimeFromYtd.AddYears(-1);
                var dateTimeToTtdLY   = dateTimeToYtd.AddYears(-1);

                var listActualThisMonth   = ReportHelper.CalculateMonthlyReport(dateTimeFromThisMonth, dateTimeToThisMonth, propertyId);
                var listActualThisMonthLY = ReportHelper.CalculateMonthlyReport(dateTimeFromThisMonthLY, dateTimeToThisMonthLY, propertyId);

                var listActual = ListActual(listActualThisMonth, listActualThisMonthLY);


                var listYtd   = ReportHelper.CalculateMonthlyReport(dateTimeFromYtd, dateTimeToYtd, propertyId);
                var listYtdLY = ReportHelper.CalculateMonthlyReport(dateTimeFromYtdLY, dateTimeToTtdLY, propertyId);

                var listActualYtd = ListActualYtd(listYtd, listYtdLY);

                var listRow = ListMonthly(listActual, listActualYtd);
                BindRowToDataTableMonthlyReport(listRow);
            }
        }