예제 #1
0
        ///<summary>This method converts the AccountEntry objects we get back from AccountModules.GetListUnpaidAccountCharges() to MultiAdjEntry objects.
        ///These are used to fill the grid and do all relevant logic in this form. This method will return a fresh list of procedures and will not show
        ///any existing adjustments that may have been made in this form already. Called on load and when checkShowImplicit is clicked.
        ///When called from checkShowImplicit any existing adjustments made will not be shown.(Ask Andrew about this functionality)</summary>
        private List <MultiAdjEntry> FillListGridEntries(CreditCalcType calc)
        {
            List <MultiAdjEntry> retVal = new List <MultiAdjEntry>();

            #region Get required data
            List <Procedure> listProcedures = Procedures.GetCompleteForPats(new List <long> {
                _patCur.PatNum
            });
            //Does not get charges for the future.
            List <PaySplit> listPaySplits = PaySplits.GetForPats(new List <long> {
                _patCur.PatNum
            }).Where(x => x.UnearnedType == 0).ToList();
            List <Adjustment> listAdjustments = Adjustments.GetAdjustForPats(new List <long> {
                _patCur.PatNum
            });
            //Might contain payplan payments. Do not include unearned.
            List <PayPlanCharge> listPayPlanCharges = PayPlanCharges.GetDueForPayPlans(PayPlans.GetForPats(null, _patCur.PatNum), _patCur.PatNum).ToList();
            List <ClaimProc>     listInsPayAsTotal  = ClaimProcs.GetByTotForPats(new List <long> {
                _patCur.PatNum
            });
            List <ClaimProc> listClaimProcs = ClaimProcs.GetForProcs(listProcedures.Select(x => x.ProcNum).ToList());
            #endregion
            List <AccountEntry> listAccountCharges = AccountModules.GetListUnpaidAccountCharges(listProcedures, listAdjustments
                                                                                                , listPaySplits, listClaimProcs, listPayPlanCharges, listInsPayAsTotal, calc, new List <PaySplit>());
            List <AccountEntry> listAccountChargesIncludeAll = null;
            if (calc == CreditCalcType.ExcludeAll)
            {
                //We need to get all credits so that our AmtRemBefore can reflect what has truly been allocated to the procedure.
                listAccountChargesIncludeAll = AccountModules.GetListUnpaidAccountCharges(listProcedures, listAdjustments
                                                                                          , listPaySplits, listClaimProcs, listPayPlanCharges, listInsPayAsTotal, CreditCalcType.IncludeAll, new List <PaySplit>());
            }
            MultiAdjEntry multiEntry = null;
            foreach (AccountEntry entry in listAccountCharges)
            {
                //We only want AccountEntries that are completed procedures.
                if (entry.GetType() != typeof(ProcExtended))
                {
                    continue;
                }
                ProcExtended procEntry = (ProcExtended)entry.Tag;
                if ((_listSelectedProcs != null && _listSelectedProcs.Any(x => x.ProcNum == procEntry.Proc.ProcNum)) ||        //Allow selected procs to show if paid off
                    entry.AmountEnd != 0)                     //All unpaid procedures should always show up per Nathan
                {
                    double amtRemBefore = (double)(listAccountChargesIncludeAll?.FirstOrDefault(x => x.Tag.GetType() == typeof(ProcExtended) &&
                                                                                                ((ProcExtended)x.Tag).Proc.ProcNum == procEntry.Proc.ProcNum) ?? entry).AmountStart;
                    multiEntry = new MultiAdjEntry(procEntry.Proc, (double)entry.AmountStart, (double)entry.AmountEnd, amtRemBefore);
                    retVal.Add(multiEntry);
                }
            }
            OrderListGridEntries();
            return(retVal);
        }
예제 #2
0
        private void FillGrid()
        {
            CreditCalcType credCalc;

            if (_isSimpleView)
            {
                credCalc = CreditCalcType.ExcludeAll;
                groupBreakdown.Visible   = false;
                groupCreditLogic.Visible = false;
            }
            else if (radioIncludeAllCredits.Checked)
            {
                credCalc = CreditCalcType.IncludeAll;
            }
            else if (radioOnlyAllocatedCredits.Checked)
            {
                credCalc = CreditCalcType.AllocatedOnly;
            }
            else
            {
                credCalc = CreditCalcType.ExcludeAll;
            }
            _listAccountCharges = AccountModules.GetListUnpaidAccountCharges(_listProcedures, _listAdjustments,
                                                                             _listPaySplits, _listClaimProcs, _listPayPlanCharges, _listInsPayAsTotal, credCalc, ListSplitsCur);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("TableProcSelect", "Date"), 70);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableProcSelect", "Prov"), 55);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableProcSelect", "Code"), 55);
            gridMain.ListGridColumns.Add(col);
            if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum))
            {
                col = new GridColumn(Lan.g("TableProcSelect", "Description"), 290);
                gridMain.ListGridColumns.Add(col);
            }
            else
            {
                col = new GridColumn(Lan.g("TableProcSelect", "Tooth"), 40);
                gridMain.ListGridColumns.Add(col);
                col = new GridColumn(Lan.g("TableProcSelect", "Description"), 250);
                gridMain.ListGridColumns.Add(col);
            }
            if (credCalc == CreditCalcType.ExcludeAll)
            {
                col = new GridColumn(Lan.g("TableProcSelect", "Amt"), 0, HorizontalAlignment.Right);
                gridMain.ListGridColumns.Add(col);
            }
            else
            {
                col = new GridColumn(Lan.g("TableProcSelect", "Amt Orig"), 60, HorizontalAlignment.Right);
                gridMain.ListGridColumns.Add(col);
                col = new GridColumn(Lan.g("TableProcSelect", "Amt Start"), 60, HorizontalAlignment.Right);
                gridMain.ListGridColumns.Add(col);
                col = new GridColumn(Lan.g("TableProcSelect", "Amt End"), 60, HorizontalAlignment.Right);
                gridMain.ListGridColumns.Add(col);
            }
            gridMain.ListGridRows.Clear();
            GridRow row;

            foreach (AccountEntry entry in _listAccountCharges)
            {
                if ((entry.GetType() != typeof(ProcExtended) || Math.Round(entry.AmountEnd, 3) == 0) && credCalc != CreditCalcType.ExcludeAll)
                {
                    continue;
                }
                Procedure     procCur     = ((ProcExtended)entry.Tag).Proc;
                ProcedureCode procCodeCur = ProcedureCodes.GetProcCode(procCur.CodeNum);
                row = new GridRow();
                row.Cells.Add(procCur.ProcDate.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(entry.ProvNum));
                row.Cells.Add(procCodeCur.ProcCode);
                if (!Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum))
                {
                    row.Cells.Add(procCur.ToothNum == "" ? Tooth.SurfTidyFromDbToDisplay(procCur.Surf, procCur.ToothNum) : Tooth.ToInternat(procCur.ToothNum));
                }
                string descriptionText = "";
                if (procCur.ProcStatus == ProcStat.TP)
                {
                    descriptionText = "(TP) ";
                }
                descriptionText += procCodeCur.Descript;
                row.Cells.Add(descriptionText);
                row.Cells.Add(entry.AmountOriginal.ToString("f"));
                if (credCalc != CreditCalcType.ExcludeAll)
                {
                    row.Cells.Add(entry.AmountStart.ToString("f"));
                    row.Cells.Add(entry.AmountEnd.ToString("f"));
                }
                row.Tag = entry;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
            if (!_isSimpleView)
            {
                RefreshBreakdown();
            }
        }
예제 #3
0
        ///<summary>This method converts the AccountEntry objects we get back from AccountModules.GetListUnpaidAccountCharges() to MultiAdjEntry objects.
        ///These are used to fill the grid and do all relevant logic in this form. This method will return a fresh list of procedures and will not show
        ///any existing adjustments that may have been made in this form already. Called on load and when checkShowImplicit is clicked.
        ///When called from checkShowImplicit any existing adjustments made will not be shown.(Ask Andrew about this functionality)</summary>
        private List <MultiAdjEntry> FillListGridEntries(CreditCalcType calc)
        {
            //CONSIDER ANY CHANGES MADE HERE MAY ALSO NEED TO BE ADDED TO FormProcSelect.
            List <MultiAdjEntry> retVal = new List <MultiAdjEntry>();

            #region Get required data
            List <Procedure> listProcedures = Procedures.GetCompleteForPats(new List <long> {
                _patCur.PatNum
            });
            //Does not get charges for the future.
            List <PaySplit> listPaySplits = PaySplits.GetForPats(new List <long> {
                _patCur.PatNum
            }).Where(x => x.UnearnedType == 0).ToList();
            List <Adjustment> listAdjustments = Adjustments.GetAdjustForPats(new List <long> {
                _patCur.PatNum
            });
            //Might contain payplan payments. Do not include unearned.
            List <PayPlanCharge> listPayPlanCharges = PayPlanCharges.GetDueForPayPlans(PayPlans.GetForPats(null, _patCur.PatNum), _patCur.PatNum).ToList();
            List <ClaimProc>     listInsPayAsTotal  = ClaimProcs.GetByTotForPats(new List <long> {
                _patCur.PatNum
            });
            List <ClaimProc> listClaimProcs = ClaimProcs.GetForProcs(listProcedures.Select(x => x.ProcNum).ToList());
            #endregion
            List <AccountEntry> listAccountCharges = AccountModules.GetListUnpaidAccountCharges(listProcedures, listAdjustments, listPaySplits, listClaimProcs
                                                                                                , listPayPlanCharges, listInsPayAsTotal, calc, new List <PaySplit>());
            List <AccountEntry> listAccountChargesIncludeAll = null;
            if (calc == CreditCalcType.ExcludeAll)
            {
                //We need to get all credits so that our AmtRemBefore can reflect what has truly been allocated to the procedure.
                listAccountChargesIncludeAll = AccountModules.GetListUnpaidAccountCharges(listProcedures, listAdjustments
                                                                                          , listPaySplits, listClaimProcs, listPayPlanCharges, listInsPayAsTotal, CreditCalcType.IncludeAll, new List <PaySplit>());
            }
            MultiAdjEntry multiEntry = null;
            foreach (AccountEntry entry in listAccountCharges)
            {
                //We only want AccountEntries that are completed procedures.
                if (entry.GetType() != typeof(ProcExtended))
                {
                    continue;
                }
                ProcExtended procEntry = (ProcExtended)entry.Tag;
                bool         isProcSelectedInAccount = false;
                if (_listSelectedProcs != null && _listSelectedProcs.Any(x => x.ProcNum == procEntry.Proc.ProcNum))
                {
                    isProcSelectedInAccount = true;
                }
                if (calc == CreditCalcType.ExcludeAll)               //show everything. Regardless of procs loading window or amount remaining.
                {
                    double amtRemBefore = (double)(listAccountChargesIncludeAll?.FirstOrDefault(x => x.Tag.GetType() == typeof(ProcExtended) &&
                                                                                                ((ProcExtended)x.Tag).Proc.ProcNum == procEntry.Proc.ProcNum) ?? entry).AmountStart;
                    multiEntry = new MultiAdjEntry(procEntry.Proc, (double)entry.AmountStart, (double)entry.AmountEnd, amtRemBefore);
                    retVal.Add(multiEntry);
                }
                else if (calc.In(CreditCalcType.IncludeAll, CreditCalcType.AllocatedOnly) && (entry.AmountEnd != 0 || isProcSelectedInAccount))
                {
                    //Unpaid procedures should always show per Nathan. If proc was specifically selected before entering window, show it anyways.
                    multiEntry = new MultiAdjEntry(procEntry.Proc, (double)entry.AmountStart, (double)entry.AmountEnd, (double)entry.AmountStart);
                    retVal.Add(multiEntry);
                }
            }
            OrderListGridEntries();
            return(retVal);
        }