///<summary>Do not call this until after determining if the repeate charge might generate a claim. This function checks current insurance and ///may not add claims if no insurance is found.</summary> private static List <Claim> AddClaimsHelper(RepeatCharge repeateCharge, Procedure proc) { //No remoting role check; no call to db List <PatPlan> patPlanList = PatPlans.Refresh(repeateCharge.PatNum); List <InsSub> subList = InsSubs.RefreshForFam(Patients.GetFamily(repeateCharge.PatNum)); List <InsPlan> insPlanList = InsPlans.RefreshForSubList(subList); List <Benefit> benefitList = Benefits.Refresh(patPlanList, subList); List <Claim> retVal = new List <Claim>(); Claim claimCur; if (patPlanList.Count == 0) //no current insurance, do not create a claim { return(retVal); } //create the claimprocs Procedures.ComputeEstimates(proc, proc.PatNum, new List <ClaimProc>(), true, insPlanList, patPlanList, benefitList, Patients.GetPat(proc.PatNum).Age, subList); //get claimprocs for this proc, may be more than one List <ClaimProc> claimProcList = ClaimProcs.GetForProc(ClaimProcs.Refresh(proc.PatNum), proc.ProcNum); string claimType = "P"; if (patPlanList.Count == 1 && PatPlans.GetOrdinal(PriSecMed.Medical, patPlanList, insPlanList, subList) > 0) //if there's exactly one medical plan { claimType = "Med"; } claimCur = Claims.CreateClaimForRepeatCharge(claimType, patPlanList, insPlanList, claimProcList, proc, subList); claimProcList = ClaimProcs.Refresh(proc.PatNum); if (claimCur.ClaimNum == 0) { return(retVal); } retVal.Add(claimCur); Claims.CalculateAndUpdate(new List <Procedure> { proc }, insPlanList, claimCur, patPlanList, benefitList, Patients.GetPat(proc.PatNum).Age, subList); if (PatPlans.GetOrdinal(PriSecMed.Secondary, patPlanList, insPlanList, subList) > 0 && //if there exists a secondary plan !CultureInfo.CurrentCulture.Name.EndsWith("CA")) //and not canada (don't create secondary claim for canada) { claimCur = Claims.CreateClaimForRepeatCharge("S", patPlanList, insPlanList, claimProcList, proc, subList); if (claimCur.ClaimNum == 0) { return(retVal); } retVal.Add(claimCur); ClaimProcs.Refresh(proc.PatNum); claimCur.ClaimStatus = "H"; Claims.CalculateAndUpdate(new List <Procedure> { proc }, insPlanList, claimCur, patPlanList, benefitList, Patients.GetPat(proc.PatNum).Age, subList); } return(retVal); }