Пример #1
0
        public void LedgersTests_ComputeAgingProcLifo_DateLastPay()
        {
            string     suffix            = MethodBase.GetCurrentMethod().Name;
            Patient    pat               = PatientT.CreatePatient(fName: "Aging_DateLastPay", suffix: suffix);
            Procedure  proc95            = ProcedureT.CreateProcedure(pat, "D0270", ProcStat.C, "", 1000, DateTime.Today.AddDays(-95));
            Procedure  proc85            = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 100, DateTime.Today.AddDays(-85));
            Payment    pay50             = PaymentT.MakePayment(pat.PatNum, 50, DateTime.Today.AddDays(-50));
            Adjustment adj40_1           = AdjustmentT.MakeAdjustment(pat.PatNum, 4, DateTime.Today.AddDays(-40), proc85.ProcDate, proc85.ProcNum);
            Adjustment adj40_2           = AdjustmentT.MakeAdjustment(pat.PatNum, 6, DateTime.Today.AddDays(-40), proc85.ProcDate, proc85.ProcNum);
            Payment    pay2              = PaymentT.MakePayment(pat.PatNum, 50, DateTime.Today.AddDays(-2));
            int        agingProcLifoPrev = PrefC.GetInt(PrefName.AgingProcLifo);

            try {
                PrefT.UpdateInt(PrefName.AgingProcLifo, (int)YN.No);
                Dictionary <long, DataRow> dictAging = Ledgers.GetAgingGuarTransTable(DateTime.Today, new List <long> {
                    pat.Guarantor
                }, hasDateLastPay: true);
                Assert.AreEqual(PIn.Date(dictAging[pat.Guarantor]["DateLastPay"].ToString()), pay2.PayDate);
                PrefT.UpdateInt(PrefName.AgingProcLifo, (int)YN.Yes);
                dictAging = Ledgers.GetAgingGuarTransTable(DateTime.Today, new List <long> {
                    pat.Guarantor
                }, hasDateLastPay: true);
                Assert.AreEqual(PIn.Date(dictAging[pat.Guarantor]["DateLastPay"].ToString()), pay2.PayDate);
            }
            finally {
                PrefT.UpdateInt(PrefName.AgingProcLifo, agingProcLifoPrev);
            }
        }
Пример #2
0
        public void LedgersTests_ComputeAgingProcLifo_InsWoEst_And_InsPayEst()
        {
            string        suffix  = MethodBase.GetCurrentMethod().Name;
            Patient       pat     = PatientT.CreatePatient(fName: "Aging_InsEst", suffix: suffix);
            InsuranceInfo insInfo = InsuranceT.AddInsurance(pat, "AgingInsEst");
            Procedure     proc95  = ProcedureT.CreateProcedure(pat, "D0270", ProcStat.C, "", 1000, DateTime.Today.AddDays(-95));
            ClaimProc     cp95    = new ClaimProc();

            ClaimProcs.CreateEst(cp95, proc95, insInfo.PriInsPlan, insInfo.PriInsSub);
            cp95.Status      = ClaimProcStatus.NotReceived;
            cp95.InsEstTotal = 800;
            cp95.InsPayEst   = 800;
            cp95.WriteOffEst = 200;
            cp95.WriteOff    = 200;
            ClaimProcs.Update(cp95);
            Procedure proc85 = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 100, DateTime.Today.AddDays(-85));
            ClaimProc cp85   = new ClaimProc();

            ClaimProcs.CreateEst(cp85, proc85, insInfo.PriInsPlan, insInfo.PriInsSub);
            cp85.Status      = ClaimProcStatus.NotReceived;
            cp85.InsEstTotal = 60;
            cp85.InsPayEst   = 60;
            cp85.WriteOffEst = 40;
            cp85.WriteOff    = 40;
            ClaimProcs.Update(cp85);
            int agingProcLifoPrev = PrefC.GetInt(PrefName.AgingProcLifo);

            try {
                PrefT.UpdateInt(PrefName.AgingProcLifo, (int)YN.No);
                Dictionary <long, DataRow> dictAging = Ledgers.GetAgingGuarTransTable(DateTime.Today, new List <long> {
                    pat.Guarantor
                });
                Assert.AreEqual(PIn.Double(dictAging[pat.Guarantor]["InsPayEst"].ToString()), 860);
                Assert.AreEqual(PIn.Double(dictAging[pat.Guarantor]["InsWoEst"].ToString()), 240);
                PrefT.UpdateInt(PrefName.AgingProcLifo, (int)YN.Yes);
                dictAging = Ledgers.GetAgingGuarTransTable(DateTime.Today, new List <long> {
                    pat.Guarantor
                });
                Assert.AreEqual(PIn.Double(dictAging[pat.Guarantor]["InsPayEst"].ToString()), 860);
                Assert.AreEqual(PIn.Double(dictAging[pat.Guarantor]["InsWoEst"].ToString()), 240);
            }
            finally {
                PrefT.UpdateInt(PrefName.AgingProcLifo, agingProcLifoPrev);
            }
        }