Exemple #1
0
        public static PayPlan CreatePayPlanNoCharges(long patNum, double totalAmt, DateTime payPlanDate, long guarantorNum)
        {
            PayPlan payPlan = new PayPlan();

            payPlan.Guarantor   = patNum;
            payPlan.PatNum      = patNum;
            payPlan.PayAmt      = totalAmt;
            payPlan.PayPlanDate = payPlanDate;
            payPlan.PayAmt      = totalAmt;
            payPlan.Guarantor   = guarantorNum;
            PayPlans.Insert(payPlan);
            return(payPlan);
        }
Exemple #2
0
        public static PayPlan CreatePayPlan(long patNum, double totalAmt, double payAmt, DateTime datePayStart, long provNum)
        {
            PayPlan payPlan = new PayPlan();

            payPlan.Guarantor   = patNum;
            payPlan.PatNum      = patNum;
            payPlan.PayAmt      = totalAmt;
            payPlan.PayPlanDate = datePayStart;
            payPlan.PayAmt      = totalAmt;
            PayPlans.Insert(payPlan);
            PayPlanCharge charge = new PayPlanCharge();

            charge.PayPlanNum = payPlan.PayPlanNum;
            charge.PatNum     = patNum;
            charge.ChargeDate = datePayStart;
            charge.Principal  = totalAmt;
            charge.ChargeType = PayPlanChargeType.Credit;
            double sumCharges    = 0;
            int    countPayments = 0;

            while (sumCharges < totalAmt)
            {
                charge            = new PayPlanCharge();
                charge.ChargeDate = datePayStart.AddMonths(countPayments);
                charge.PatNum     = patNum;
                charge.Guarantor  = patNum;
                charge.PayPlanNum = payPlan.PayPlanNum;
                charge.Principal  = Math.Min(payAmt, totalAmt - sumCharges);
                charge.ProvNum    = provNum;
                sumCharges       += charge.Principal;
                charge.ChargeType = PayPlanChargeType.Debit;
                PayPlanCharges.Insert(charge);
                countPayments++;
            }
            return(payPlan);
        }