예제 #1
0
        /// <summary>
        /// Constructor to create FeeDeviationPayableFee from a given template
        /// </summary>
        /// <param name="prevFD">Previous FeeDeviationPayableFee template to copy necessary feilds from.</param>
        public FeeDeviationPayableFee(IPayableFee parent, FeeDeviationPayableFee prevFD)
        {
            if (prevFD == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create FeeDeviationPayableFee. " +
                    "Given template cannot be null.");

            if (prevFD.Validate().Count > 0)
                throw new ApasInvaidOperationException(
                     "Invalid Operation: Unable to create FeeDeviationPayableFee. " +
                     "Given template is not valid.");

            if (parent == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create FeeDeviationPayableFee. " +
                    "Parent PayableFee cannot be null.");

            IdPayableFee = prevFD.IdPayableFee;
            IdFeeDeviation = prevFD.IdFeeDeviation;
            Type = prevFD.Type;
            IsRecurring = prevFD.IsRecurring;
            Value = prevFD.Value;

            parent.AddFeeDeviation(this);
        }
예제 #2
0
        //DESIGN RECONSIDERATION
        public void AddFeeDeviation(IPayableFee curPF , int fdId)
        {
            FeeDeviationPayableFee newFD =
                new FeeDeviationPayableFee(curPF, fdId);

            newFD.IsRecurring = 1;
            newFD.Value = 0;
            newFD.Save();

            curPF.ComputeDynamicFields(CurrentPaymentAdvice);
            curPF.Save();

            //log
            CurrentPaymentAdvice.LastAction = "Add FeeDeviation";
            CurrentPaymentAdvice.LastModifiedBy =
                ApasAccessControlManager.GetCurrentInstance().LogonUser.Id;
            CurrentPaymentAdvice.LastModifiedTime = DateTime.Now;

            CurrentPaymentAdvice.Save();
        }
예제 #3
0
        /// <summary>
        /// Constructor to create new OtherFee based on a given template
        /// </summary>
        /// <param name="parentPA">Parent PaymentAdvice</param>
        /// <param name="param name="template">Template</param>
        public OtherFee(PaymentAdvice parentPA, OtherFee template)
        {
            if (parentPA == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create a OtherFee. " +
                    "Parent Paymentadivce cannot be null.");

            if (template == null || template.Validate().Count>0)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create a OtherFee. " +
                    "Given template is not valid.");

            OtherFeeType = template.OtherFeeType;
            Amount = template.Amount;
            PayableFee = template.PayableFee;
            PrivateRemark = template.PrivateRemark;
            PublicRemark = template.PublicRemark;
            PaymentAdviceText = template.PaymentAdviceText;
            IsRecurring = template.IsRecurring;
            IsExcluded = 0;
            IsPaid = 0;

            FeeDeviations = new Dictionary<int, FeeDeviationPayableFee>();

            parentPA.AddOtherFee(this);
            Save();

            foreach (FeeDeviationPayableFee fd in template.FeeDeviations.Values)
            {
                if (fd.IsRecurring == 1)
                {
                    FeeDeviationPayableFee newFD =
                        new FeeDeviationPayableFee(this, fd);
                    newFD.Save();

                }
            }
        }
예제 #4
0
 public virtual void RemoveFeeDeviation(FeeDeviationPayableFee childFD)
 {
     childFD.Delete();
     FeeDeviations.Remove(childFD.IdFeeDeviation);
 }
예제 #5
0
        public virtual void AddFeeDeviation(FeeDeviationPayableFee childFD)
        {
            if(Id<=0)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to add FeeDeviation to OtherFee " +
                    "before OtherFee is persisted.");

            childFD.IdPayableFee = Id;
            childFD.Type = "fixed";         //will only accept fixed fee deviations

            FeeDeviations.Add(childFD.IdFeeDeviation, childFD);
        }
예제 #6
0
        public virtual void AddFeeDeviation(FeeDeviationPayableFee childFD)
        {
            if (Id <= 0)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to add FeeDeviation to ClassFee " +
                    "before ClassFee is persisted.");

            childFD.IdPayableFee = Id;
            childFD.Type = "percentage";    //will only accept percentage type

            FeeDeviations.Add(childFD.IdFeeDeviation, childFD);
        }
예제 #7
0
        /// <summary>
        /// Create "new" ClassFee from a template previoius ClassFee
        /// </summary>
        /// <param name="parentPaymentAdvice">Parent PaymentAdvice: must assign to create ClassFee</param>
        /// <param name="prevClassFee">Template previous ClassFee to copy necessary fields from</param>
        public ClassFee(PaymentAdvice parentPaymentAdvice, ClassFee prevClassFee)
        {
            ApasConfigurationManager cfg = new ApasConfigurationManager();

            if (parentPaymentAdvice == null)
                throw new ApasInvaidOperationException(
                    "Invalid Operation: Unable to create a ClassFee without " +
                    "a vailid parent PaymentAdvice.");

            if (prevClassFee == null || prevClassFee.Validate().Count>0)
                throw new ApasInvaidOperationException(
                   "Invalid Operation: Unable to create a ClassFee. Given " +
                   "ClassFee template is not valid.");

            IdRegular = prevClassFee.IdRegular;

            Id = 0;
            PrivateRemark = prevClassFee.PrivateRemark;
            PublicRemark = prevClassFee.PublicRemark;
            ColorCode = prevClassFee.ColorCode ;

            Absence = 0;
            Prorate = 0;
            Makeup = 0;
            Forfeit = 0;
            Credit = 0;
            CreditAdjustment = 0;
            NextMonthCredit = 0;
            PayableCredit = 0;
            PerLessonFee = 0;
            PayableFee = 0;
            PaymentAdviceText = null;
            IsExcluded = 0;
            FeeDeviations = new Dictionary<int, FeeDeviationPayableFee>();

            if (prevClassFee.Status.Name == "Withdrawn: Unapproved" ||
                prevClassFee.Status.Name == "Withdrawn: Approved")
            {
                Status = ClassFeeStatus.ClassFeeStatusDictionary["New: Unapproved"];
                ColorCode = cfg.getConfigValue("DefaultNewColor");
            }
            else
                Status = ClassFeeStatus.ClassFeeStatusDictionary["Normal"];

            parentPaymentAdvice.AddClassFee(this);

            Save();

            foreach (FeeDeviationPayableFee fd in prevClassFee.FeeDeviations.Values)
            {
                if (fd.IsRecurring == 1)
                {
                    FeeDeviationPayableFee newFD =
                        new FeeDeviationPayableFee(this, fd);

                    newFD.Save();
                }
            }
        }
예제 #8
0
        public FeeDeviationPayableFeeView ConvertFeeDeviationPayableFee(FeeDeviationPayableFee input, decimal feePayable)
        {
            FeeDeviationPayableFeeView output = new FeeDeviationPayableFeeView();
            output.FeeDeviation =
                ConvertFeeDeviation(input.GetAssociatedFeeDeviation());
            output.IdPayableFee = input.IdPayableFee;
            output.IsRecurring = (input.IsRecurring==1);
            output.Type = input.Type;
            output.Value = input.Value;

            output.NetValue = input.ComputeNetDeviation(feePayable);//write out the exact amount. browser will display both exact amount and rounded amount

            return output;
        }