Esempio n. 1
0
        //get data in case search with period of year
        public bool getForwardWithPeriod(int CreateMonth, int SearchPeriod, int CurrentMonth,
                                         int CreateYear, int SearchYear, int CurrentYear, short?StatusTask,
                                         DateTime CurrentDt, DateTime?DKHTDt, DateTime?HTDt, int TypeReport)
        {
            bool isForward = false;

            if (((VNPTHelper.getPeriodOfMonth(CreateMonth) < SearchPeriod && CreateYear == SearchYear) ||
                 (CreateYear < SearchYear)) && (CreateMonth >= 1 && CreateMonth <= 12))
            {
                if ((SearchPeriod == VNPTHelper.getPeriodOfMonth(CurrentMonth) && SearchYear == CurrentYear) ||
                    (SearchYear > CurrentYear))
                {
                    if (StatusTask != (int)EStatusIssueResolve.EndWithDoneProcess && StatusTask != (int)EStatusIssueResolve.EndWithNotProcess)
                    {
                        if ((DKHTDt > CurrentDt && TypeReport == (int)ETypeReport.Unexpired) ||
                            (DKHTDt <= CurrentDt && TypeReport == (int)ETypeReport.Expired))
                        {
                            isForward = true;
                        }
                    }
                    else if (StatusTask == (int)EStatusIssueResolve.EndWithDoneProcess || StatusTask == (int)EStatusIssueResolve.EndWithNotProcess)
                    {
                        if ((HTDt <= DKHTDt && TypeReport == (int)ETypeReport.Unexpired) ||
                            (HTDt > DKHTDt && TypeReport == (int)ETypeReport.Expired))
                        {
                            isForward = true;
                        }
                    }
                }
                else if ((SearchPeriod < VNPTHelper.getPeriodOfMonth(CurrentMonth) && SearchYear == CurrentYear) ||
                         (SearchYear < CurrentYear))
                {
                    if ((StatusTask != (int)EStatusIssueResolve.EndWithDoneProcess && StatusTask != (int)EStatusIssueResolve.EndWithNotProcess) ||
                        (VNPTHelper.getPeriodOfMonth(HTDt.Value.Month) > SearchPeriod))
                    {
                        if ((DKHTDt >= VNPTHelper.getLastDayOfPeriod(SearchPeriod, SearchYear) && TypeReport == (int)ETypeReport.Unexpired) ||
                            (DKHTDt < VNPTHelper.getLastDayOfPeriod(SearchPeriod, SearchYear) && TypeReport == (int)ETypeReport.Expired))
                        {
                            isForward = true;
                        }
                    }
                    else if (StatusTask == (int)EStatusIssueResolve.EndWithDoneProcess || StatusTask == (int)EStatusIssueResolve.EndWithNotProcess)
                    {
                        if ((HTDt <= DKHTDt && TypeReport == (int)ETypeReport.Unexpired) ||
                            (HTDt > DKHTDt && TypeReport == (int)ETypeReport.Expired))
                        {
                            isForward = true;
                        }
                    }
                }
            }
            return(isForward);
        }
Esempio n. 2
0
        public bool getStatusProcessIssueWithPeriod(int CreateMonth, int SearchPeriod, int CurrentMonth,
                                                    int CreateYear, int SearchYear, int CurrentYear, short?StatusTask,
                                                    DateTime CurrentDt, DateTime?DKHTDt, DateTime?HTDt, int TypeReport)
        {
            bool isStatus = false;

            if ((VNPTHelper.getPeriodOfMonth(CreateMonth) <= SearchPeriod && CreateYear == SearchYear) || (CreateYear < SearchYear))
            {
                if (SearchPeriod == VNPTHelper.getPeriodOfMonth(CurrentMonth) && SearchYear == CurrentYear)
                {
                    if (StatusTask != (int)EStatusIssueResolve.EndWithDoneProcess && StatusTask != (int)EStatusIssueResolve.EndWithNotProcess)
                    {
                        if ((DKHTDt >= CurrentDt && TypeReport == (int)ETypeReport.StillValid) ||
                            (DKHTDt < CurrentDt && TypeReport == (int)ETypeReport.OutDate1))
                        {
                            isStatus = true;
                        }
                    }
                    else if (StatusTask == (int)EStatusIssueResolve.EndWithDoneProcess || StatusTask == (int)EStatusIssueResolve.EndWithNotProcess)
                    {
                        if ((HTDt <= DKHTDt && TypeReport == (int)ETypeReport.OnTime) ||
                            (HTDt > DKHTDt && TypeReport == (int)ETypeReport.OutDate2))
                        {
                            isStatus = true;
                        }
                    }
                }
                else if ((SearchPeriod < VNPTHelper.getPeriodOfMonth(CurrentMonth) && SearchYear == CurrentYear) || (SearchYear < CurrentYear))
                {
                    if (HTDt == null)
                    {
                        if ((StatusTask != (int)EStatusIssueResolve.EndWithDoneProcess &&
                             StatusTask != (int)EStatusIssueResolve.EndWithNotProcess))
                        {
                            if ((DKHTDt >= VNPTHelper.getLastDayOfPeriod(SearchPeriod, SearchYear) && TypeReport == (int)ETypeReport.StillValid) ||
                                (DKHTDt < VNPTHelper.getLastDayOfPeriod(SearchPeriod, SearchYear) && TypeReport == (int)ETypeReport.OutDate1))
                            {
                                isStatus = true;
                            }
                        }
                    }
                    else
                    {
                        DateTime HTMonth2 = (DateTime)HTDt;
                        int      HTMonth  = HTMonth2.Month;
                        if (HTDt <= DKHTDt)
                        {
                            if ((VNPTHelper.getPeriodOfMonth(HTMonth) > SearchPeriod && TypeReport == (int)ETypeReport.StillValid) ||
                                (VNPTHelper.getPeriodOfMonth(HTMonth) <= SearchPeriod && TypeReport == (int)ETypeReport.OnTime))
                            {
                                isStatus = true;
                            }
                        }
                        else
                        {
                            if ((VNPTHelper.getPeriodOfMonth(HTMonth) > SearchPeriod && TypeReport == (int)ETypeReport.OutDate1) ||
                                (VNPTHelper.getPeriodOfMonth(HTMonth) <= SearchPeriod && TypeReport == (int)ETypeReport.OutDate2))
                            {
                                isStatus = true;
                            }
                        }
                    }
                }
            }
            return(isStatus);
        }