示例#1
0
        ///<summary>Creates a snapshot for the claimprocs passed in.  Used for reporting purposes.
        ///If called from Open Dental Service, ignore passed in claimprocs and make snapshots for the entire day of completed procedures in a different method.
        ///When passing in claimprocs, the implementor will need to ensure that only primary claimprocs are being saved.
        ///Only creates snapshots if the feature is enabled and if the claimproc is of certain statuses.</summary>
        public static void CreateClaimSnapshot(List <ClaimProc> listClaimProcs, ClaimSnapshotTrigger triggerType, string claimType)
        {
            //No need to check RemotingRole; no call to db.
            if (!PrefC.GetBool(PrefName.ClaimSnapshotEnabled) ||
                PIn.Enum <ClaimSnapshotTrigger>(PrefC.GetString(PrefName.ClaimSnapshotTriggerType), true) != triggerType)
            {
                return;
            }
            if (triggerType == ClaimSnapshotTrigger.Service)
            {
                CreateClaimSnapShotService();
                return;
            }
            Dictionary <long, double> dictCompletedProcFees = Procedures.GetProcsFromClaimProcs(listClaimProcs).ToDictionary(x => x.ProcNum, x => x.ProcFee);
            //This list will be used to check for existing claimsnapshots for the claimprocs passed in. We will update exisiting snapshots.
            List <ClaimSnapshot> listClaimSnapshotsOld = GetByClaimProcNums(listClaimProcs.Select(x => x.ClaimProcNum).ToList());

            //Loop through all the claimprocs and create a claimsnapshot entry for each.
            foreach (ClaimProc cp in listClaimProcs)
            {
                //only create snapshots for 0=NotReceived, 1=Received, 4=Supplemental, 5=CapClaim, 6=Estimate (only if triggerType=Service),
                //7=CapComplete, and 8=CapEstimate (only if triggerType=Service)
                if (cp.Status.In(ClaimProcStatus.Preauth, ClaimProcStatus.Adjustment, ClaimProcStatus.Estimate, ClaimProcStatus.CapEstimate))
                {
                    continue;
                }
                //get the procfee
                double procFee;
                if (!dictCompletedProcFees.TryGetValue(cp.ProcNum, out procFee))
                {
                    procFee = 0;
                }
                //If there is an existing claimsnapshot created Today for the current cp.ProcNum, cp.ClaimProcNum, claimType, and the ClaimSnapshotTrigger
                //is not Service, then update it. Otherwise, create a new one.
                //This fixes an issue with reports not showing the correct writeoffs. Ex. A procedure was completed, a claim was created, the claim was deleted,
                //the writeoff was modified on the claimproc, then a new claim was created.
                ClaimSnapshot existingSnapshot = listClaimSnapshotsOld.FirstOrDefault(x => x.DateTEntry.Date == DateTime.Today.Date && x.ProcNum == cp.ProcNum &&
                                                                                      x.ClaimProcNum == cp.ClaimProcNum && x.ClaimType == claimType && x.SnapshotTrigger != ClaimSnapshotTrigger.Service);
                if (existingSnapshot != null)
                {
                    SetSnapshotFields(existingSnapshot, cp, procFee, triggerType, claimType);
                    ClaimSnapshots.Update(existingSnapshot);
                    continue;
                }
                ClaimSnapshot snapshot = new ClaimSnapshot();
                SetSnapshotFields(snapshot, cp, procFee, triggerType, claimType);
                ClaimSnapshots.Insert(snapshot);
            }
        }
示例#2
0
        ///<summary>Creates a snapshot for the claimprocs passed in.  Used for reporting purposes.
        ///If called from Open Dental Service, ignore passed in claimprocs and make snapshots for the entire day of completed procedures in a different method.
        ///When passing in claimprocs, the implementor will need to ensure that only primary claimprocs are being saved.
        ///Only creates snapshots if the feature is enabled and if the claimproc is of certain statuses.</summary>
        public static void CreateClaimSnapshot(List <ClaimProc> listClaimProcs, ClaimSnapshotTrigger triggerType, string claimType)
        {
            //No need to check RemotingRole; no call to db.
            if (!PrefC.GetBool(PrefName.ClaimSnapshotEnabled) ||
                PIn.Enum <ClaimSnapshotTrigger>(PrefC.GetString(PrefName.ClaimSnapshotTriggerType), true) != triggerType)
            {
                return;
            }
            if (triggerType == ClaimSnapshotTrigger.Service)
            {
                CreateClaimSnapShotService();
                return;
            }
            Dictionary <long, double> dictCompletedProcFees = Procedures.GetProcsFromClaimProcs(listClaimProcs).ToDictionary(x => x.ProcNum, x => x.ProcFee);

            //Loop through all the claimprocs and create a claimsnapshot entry for each.
            foreach (ClaimProc cp in listClaimProcs)
            {
                //only create snapshots for 0=NotReceived, 1=Received, 4=Supplemental, 5=CapClaim, 6=Estimate (only if triggerType=Service),
                //7=CapComplete, and 8=CapEstimate (only if triggerType=Service)
                if (cp.Status.In(ClaimProcStatus.Preauth, ClaimProcStatus.Adjustment, ClaimProcStatus.Estimate, ClaimProcStatus.CapEstimate))
                {
                    continue;
                }
                //get the procfee
                double procFee;
                if (!dictCompletedProcFees.TryGetValue(cp.ProcNum, out procFee))
                {
                    procFee = 0;
                }
                ClaimSnapshot snapshot = new ClaimSnapshot();
                snapshot.ProcNum         = cp.ProcNum;
                snapshot.Writeoff        = cp.WriteOff;
                snapshot.InsPayEst       = cp.InsEstTotal;
                snapshot.Fee             = procFee;
                snapshot.ClaimProcNum    = cp.ClaimProcNum;
                snapshot.SnapshotTrigger = triggerType;
                snapshot.ClaimType       = claimType;
                ClaimSnapshots.Insert(snapshot);
            }
        }
示例#3
0
 private static void SetSnapshotFields(ClaimSnapshot snapshot, ClaimProc cp, double procFee, ClaimSnapshotTrigger triggerType, string claimType)
 {
     snapshot.ProcNum         = cp.ProcNum;
     snapshot.Writeoff        = cp.WriteOff;
     snapshot.InsPayEst       = cp.InsEstTotal;
     snapshot.Fee             = procFee;
     snapshot.ClaimProcNum    = cp.ClaimProcNum;
     snapshot.SnapshotTrigger = triggerType;
     snapshot.ClaimType       = claimType;
 }