Esempio n. 1
0
        public double GetTotalLateFees(School school, DateTime date, FeeCycle feeCycle)
        {
            if (date.Date > feeCycle.LastDueDate.ToLocalTime().Date&& GetTotalFees() > 0)
            {
                var totalLatefee = 0.0;
                switch (school.LateFeeType)
                {
                case LateFeeType.Daily:
                    var days = DateTime.Today.Subtract(feeCycle.LastDueDate).Days;
                    totalLatefee = school.LateFeeAmount * days;
                    break;

                case LateFeeType.Weekly:
                    var weeks = Convert.ToInt32(Math.Ceiling(((decimal)(DateTime.Today.Subtract(feeCycle.LastDueDate).Days)) / 7));
                    totalLatefee = school.LateFeeAmount * weeks;
                    break;

                case LateFeeType.Monthly:
                    var month = Convert.ToInt32(Math.Ceiling(((decimal)(DateTime.Today.Subtract(feeCycle.LastDueDate).Days)) / 30));
                    totalLatefee = school.LateFeeAmount * month;
                    break;

                default:
                    totalLatefee = school.LateFeeAmount;
                    break;
                }

                if (this.LateFee.HasValue)
                {
                    totalLatefee = this.LateFee.Value;
                }
                return(totalLatefee);
            }
            return(0.0);
        }
Esempio n. 2
0
        public double GetPendingFee(DateTime date, FeeCycle feeCycle, School school, DateTime?joiningDate)
        {
            var totalAmount = GetTotalFees();

            if (totalAmount <= 0)
            {
                return(0);
            }
            double totalLatefee = 0;

            if (date.Date > feeCycle.LastDueDate.ToLocalTime().Date&& joiningDate > feeCycle.LastDueDate.ToLocalTime().Date)
            {
                //totalLatefee = GetTotalLateFees(school, date.Date, feeCycle);
                totalLatefee = Math.Round(GetTotalLateFeesOfLateJoinedStudent(school, date.Date, feeCycle, Convert.ToDateTime(joiningDate).ToLocalTime().Date), 2);
            }
            else
            {
                totalLatefee = GetTotalLateFees(school, date.Date, feeCycle);
            }
            if (Transactions == null || Transactions.Length == 0)
            {
                if (date.Date > feeCycle.LastDueDate.ToLocalTime().Date)
                {
                    var existingLateFee = LateFee;
                    if (existingLateFee != null && LateFeeDate != null || existingLateFee == 0)
                    {
                        return(totalAmount + LateFee.Value);
                    }


                    return(totalAmount + totalLatefee);
                }
                else
                {
                    return(totalAmount);
                }
            }

            var totalPaid      = Transactions.Sum(x => x.Amount);
            var totalRemaining = totalAmount - totalPaid;

            if (date.Date > feeCycle.LastDueDate.ToLocalTime().Date)
            {
                if (LateFee != null)
                {
                    totalRemaining = totalRemaining + LateFee.Value;
                }
                else
                {
                    totalRemaining = totalRemaining + totalLatefee;
                }
            }
            if (totalRemaining <= 0)
            {
                return(0);
            }
            return(totalRemaining);
        }
Esempio n. 3
0
        public double GetOldPendingFee(DateTime date, FeeCycle feeCycle, School school)
        {
            var totalAmount = GetTotalFees();

            if (totalAmount <= 0)
            {
                return(0);
            }
            double totalLatefee = 0;

            if (date.Date > feeCycle.LastDueDate.ToLocalTime().Date)
            {
                totalLatefee = GetTotalLateFees(school, date.Date, feeCycle);
            }

            if (Transactions == null || Transactions.Length == 0)
            {
                if (date.Date > feeCycle.LastDueDate.ToLocalTime().Date)
                {
                    var existingLateFee = LateFee;
                    if (existingLateFee != null && LateFeeDate != null || existingLateFee == 0)
                    {
                        return(totalAmount + LateFee.Value);
                    }


                    return(totalAmount + totalLatefee);
                }
                else
                {
                    return(totalAmount);
                }
            }

            var totalPaid      = Transactions.Sum(x => x.Amount);
            var totalRemaining = totalAmount - totalPaid;

            if (date.Date > feeCycle.LastDueDate.ToLocalTime().Date)
            {
                if (LateFee != null)
                {
                    totalRemaining = totalRemaining + LateFee.Value;
                }
                else
                {
                    totalRemaining = totalRemaining + totalLatefee;
                }
            }
            if (totalRemaining <= 0)
            {
                return(0);
            }
            return(totalRemaining);
        }
Esempio n. 4
0
 public School()
 {
     SuperAdmins         = new Collection <string>();
     ParentInvites       = new ParentInvite[] { };
     Testimonials        = new Testimonial[] { };
     Teams               = new Team[] { };
     Blogs               = new Collection <ObjectId>();
     SchoolFeeComponents = new SchoolFeeComponent[] { };
     FeeCycles           = new FeeCycle[] { };
     Sessions            = new Session[] { };
     Reviews             = new Review[] { };
     Activities          = new ActivityMaster[] { };
     DayCareMenus        = new DayCareMenu[] { };
     VirtualTour         = new VirtualTourImage[] { };
     MonthlyReports      = new Collection <string>();
     CreditHistory       = new CreditLog[] { };
     News                    = new NewsFeed[] { };
     AboutUs                 = new AboutUs[] { };
     MasterSubjects          = new MasterSubject[] { };
     MasterGradedDisciplines = new MasterGradedDiscipline[] { };
 }