/// <summary>Only used once in Claims.cs. Gets insurance benefits remaining for one benefit year. Returns actual remaining insurance based on ClaimProc data, taking into account inspaid and ins pending. Must supply all claimprocs for the patient. Date used to determine which benefit year to calc. Usually today's date. The insplan.PlanNum is the plan to get value for. ExcludeClaim is the ClaimNum to exclude, or enter -1 to include all. This does not yet handle calculations where ortho max is different from regular max. Just takes the most general annual max, and subtracts all benefits used from all categories.</summary> public static double GetInsRem(ClaimProc[] ClaimProcList, DateTime date, int planNum, int patPlanNum, int excludeClaim, InsPlan[] PlanList, Benefit[] benList) { double insUsed = GetInsUsed(ClaimProcList, date, planNum, patPlanNum, excludeClaim, PlanList, benList); double insPending = GetPending(ClaimProcList, date, planNum, patPlanNum, excludeClaim, PlanList, benList); double annualMax = Benefits.GetAnnualMax(benList, planNum, patPlanNum); if (annualMax < 0) { return(999999); } if (annualMax - insUsed - insPending < 0) { return(0); } return(annualMax - insUsed - insPending); }
///<summary>raised for each page to be printed. One page per appointment.</summary> private void pd_PrintPage(object sender, PrintPageEventArgs ev) { if (ApptNum != 0) //just for one appointment { date = Appointments.DateSelected; } Graphics g = ev.Graphics; float y = 50; float x = 0; string str; float sizeW; //used when measuring text for placement Font fontTitle = new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold); Font fontHeading = new Font(FontFamily.GenericSansSerif, 9, FontStyle.Bold); Font font = new Font(FontFamily.GenericSansSerif, 8); SolidBrush brush = new SolidBrush(Color.Black); //Title---------------------------------------------------------------------------------------------------------- str = Lan.g(this, "Routing Slip"); sizeW = g.MeasureString(str, fontTitle).Width; x = 425 - sizeW / 2; g.DrawString(str, fontTitle, brush, x, y); y += 35; x = 75; //Today's appointment, including procedures----------------------------------------------------------------------- Family fam = Patients.GetFamily(Appts[pagesPrinted].PatNum); Patient pat = fam.GetPatient(Appts[pagesPrinted].PatNum); str = pat.GetNameFL(); g.DrawString(str, fontHeading, brush, x, y); y += 18; str = Appts[pagesPrinted].AptDateTime.ToShortTimeString() + " " + Appts[pagesPrinted].AptDateTime.ToShortDateString(); g.DrawString(str, fontHeading, brush, x, y); y += 18; str = (Appts[pagesPrinted].Pattern.Length * 5).ToString() + " " + Lan.g(this, "minutes"); g.DrawString(str, font, brush, x, y); y += 15; str = Providers.GetAbbr(Appts[pagesPrinted].ProvNum); g.DrawString(str, font, brush, x, y); y += 15; if (Appts[pagesPrinted].ProvHyg != 0) { str = Providers.GetAbbr(Appts[pagesPrinted].ProvHyg); g.DrawString(str, font, brush, x, y); y += 15; } str = Lan.g(this, "Procedures:"); g.DrawString(str, font, brush, x, y); y += 15; Procedure[] procsAll = Procedures.Refresh(pat.PatNum); Procedure[] procsApt = Procedures.GetProcsOneApt(Appts[pagesPrinted].AptNum, procsAll); for (int i = 0; i < procsApt.Length; i++) { str = " " + Procedures.GetDescription(procsApt[i]); g.DrawString(str, font, brush, x, y); y += 15; } str = Lan.g(this, "Note:") + " " + Appts[pagesPrinted].Note; g.DrawString(str, font, brush, x, y); y += 25; //Patient/Family Info--------------------------------------------------------------------------------------------- g.DrawLine(Pens.Black, 75, y, 775, y); str = Lan.g(this, "Patient Info"); g.DrawString(str, fontHeading, brush, x, y); y += 18; str = Lan.g(this, "PatNum:") + " " + pat.PatNum.ToString(); g.DrawString(str, font, brush, x, y); y += 15; str = Lan.g(this, "Age:") + " "; if (pat.Age > 0) { str += pat.Age.ToString(); } g.DrawString(str, font, brush, x, y); y += 15; str = Lan.g(this, "Date of First Visit:") + " "; if (pat.DateFirstVisit.Year < 1880) { str += "?"; } else if (pat.DateFirstVisit == Appts[pagesPrinted].AptDateTime.Date) { str += Lan.g(this, "New Patient"); } else { str += pat.DateFirstVisit.ToShortDateString(); } g.DrawString(str, font, brush, x, y); y += 15; str = Lan.g(this, "Billing Type:") + " " + DefB.GetName(DefCat.BillingTypes, pat.BillingType); g.DrawString(str, font, brush, x, y); y += 15; Recall[] recallList = Recalls.GetList(new int[] { pat.PatNum }); str = Lan.g(this, "Recall Due Date:") + " "; if (recallList.Length > 0) { str += recallList[0].DateDue.ToShortDateString(); } g.DrawString(str, font, brush, x, y); y += 15; str = Lan.g(this, "Medical notes:") + " " + pat.MedUrgNote; g.DrawString(str, font, brush, x, y); y += 25; //Other Family Members str = Lan.g(this, "Other Family Members"); g.DrawString(str, fontHeading, brush, x, y); y += 18; for (int i = 0; i < fam.List.Length; i++) { if (fam.List[i].PatNum == pat.PatNum) { continue; } str = fam.List[i].GetNameFL(); if (fam.List[i].Age > 0) { str += ", " + fam.List[i].Age.ToString(); } g.DrawString(str, font, brush, x, y); y += 15; } y += 10; //Insurance Info-------------------------------------------------------------------------------------------------- g.DrawLine(Pens.Black, 75, y, 775, y); str = Lan.g(this, "Insurance"); g.DrawString(str, fontHeading, brush, x, y); y += 18; PatPlan[] patPlanList = PatPlans.Refresh(pat.PatNum); InsPlan[] plans = InsPlans.Refresh(fam); ClaimProc[] claimProcList = ClaimProcs.Refresh(pat.PatNum); Benefit[] benefits = Benefits.Refresh(patPlanList); InsPlan plan; Carrier carrier; string subscriber; double max; double deduct; if (patPlanList.Length == 0) { str = Lan.g(this, "none"); g.DrawString(str, font, brush, x, y); y += 15; } for (int i = 0; i < patPlanList.Length; i++) { plan = InsPlans.GetPlan(patPlanList[i].PlanNum, plans); carrier = Carriers.GetCarrier(plan.CarrierNum); str = carrier.CarrierName; g.DrawString(str, fontHeading, brush, x, y); y += 18; subscriber = fam.GetNameInFamFL(plan.Subscriber); if (subscriber == "") //subscriber from another family { subscriber = Patients.GetLim(plan.Subscriber).GetNameLF(); } str = Lan.g(this, "Subscriber:") + " " + subscriber; g.DrawString(str, font, brush, x, y); y += 15; bool isFamMax = Benefits.GetIsFamMax(benefits, plan.PlanNum); str = ""; if (isFamMax) { str += Lan.g(this, "Family "); } str += Lan.g(this, "Annual Max:") + " "; max = Benefits.GetAnnualMax(benefits, plan.PlanNum, patPlanList[i].PatPlanNum); if (max != -1) { str += max.ToString("n0") + " "; } str += " "; bool isFamDed = Benefits.GetIsFamDed(benefits, plan.PlanNum); if (isFamDed) { str += Lan.g(this, "Family "); } str += Lan.g(this, "Deductible:") + " "; deduct = Benefits.GetDeductible(benefits, plan.PlanNum, patPlanList[i].PatPlanNum); if (deduct != -1) { str += deduct.ToString("n0"); } g.DrawString(str, font, brush, x, y); y += 15; str = ""; for (int j = 0; j < benefits.Length; j++) { if (benefits[j].PlanNum != plan.PlanNum) { continue; } if (benefits[j].BenefitType != InsBenefitType.Percentage) { continue; } if (str != "") { str += ", "; } str += CovCats.GetDesc(benefits[j].CovCatNum) + " " + benefits[j].Percent.ToString() + "%"; } if (str != "") { g.DrawString(str, font, brush, x, y); y += 15; } double pend = 0; double used = 0; if (isFamMax || isFamDed) { ClaimProc[] claimProcsFam = ClaimProcs.RefreshFam(plan.PlanNum); used = InsPlans.GetInsUsed(claimProcsFam, date, plan.PlanNum, patPlanList[i].PatPlanNum, -1, plans, benefits); pend = InsPlans.GetPending(claimProcsFam, date, plan, patPlanList[i].PatPlanNum, -1, benefits); } else { used = InsPlans.GetInsUsed(claimProcList, date, plan.PlanNum, patPlanList[i].PatPlanNum, -1, plans, benefits); pend = InsPlans.GetPending(claimProcList, date, plan, patPlanList[i].PatPlanNum, -1, benefits); } str = Lan.g(this, "Ins Used:") + " " + used.ToString("n"); g.DrawString(str, font, brush, x, y); y += 15; str = Lan.g(this, "Ins Pending:") + " " + pend.ToString("n"); g.DrawString(str, font, brush, x, y); y += 15; } y += 10; //Account Info--------------------------------------------------------------------------------------------------- g.DrawLine(Pens.Black, 75, y, 775, y); str = Lan.g(this, "Account Info"); g.DrawString(str, fontHeading, brush, x, y); y += 18; str = Lan.g(this, "Guarantor:") + " " + fam.List[0].GetNameFL(); g.DrawString(str, font, brush, x, y); y += 15; str = Lan.g(this, "Balance:") + (fam.List[0].BalTotal - fam.List[0].InsEst).ToString("c"); if (fam.List[0].InsEst > .01) { str += " (" + fam.List[0].BalTotal.ToString("c") + " - " + fam.List[0].InsEst.ToString("c") + " " + Lan.g(this, "InsEst") + ")"; } g.DrawString(str, font, brush, x, y); y += 15; str = Lan.g(this, "Aging:") + " 0-30:" + fam.List[0].Bal_0_30.ToString("c") + " 31-60:" + fam.List[0].Bal_31_60.ToString("c") + " 61-90:" + fam.List[0].Bal_61_90.ToString("c") + " 90+:" + fam.List[0].BalOver90.ToString("c"); g.DrawString(str, font, brush, x, y); y += 15; str = Lan.g(this, "Fam Urgent Fin Note:") + fam.List[0].FamFinUrgNote; g.DrawString(str, font, brush, x, y); y += 15; y += 10; //Treatment Plan-------------------------------------------------------------------------------------------------- g.DrawLine(Pens.Black, 75, y, 775, y); str = Lan.g(this, "Treatment Plan"); g.DrawString(str, fontHeading, brush, x, y); y += 18; for (int i = 0; i < procsAll.Length; i++) { if (procsAll[i].ProcStatus != ProcStat.TP) { continue; } str = Procedures.GetDescription(procsAll[i]); g.DrawString(str, font, brush, x, y); y += 15; } pagesPrinted++; if (pagesPrinted == Appts.Length) { ev.HasMorePages = false; pagesPrinted = 0; } else { ev.HasMorePages = true; } }