Пример #1
0
 ///<summary>Calculates the discount for a procedurecharge.  The count must be greater than 5.</summary>
 private void CreateDiscount(ProcedureCharge proc, int count)
 {
     //6-11 months gets a 5% discount.
     if (count < 12)           //We already know it is greater than 5
     {
         proc.ProcDiscount = .05 * proc.ProcFee;
     }
     //12-23 months gets a 10% discount.
     else if (count < 24)
     {
         proc.ProcDiscount = .1 * proc.ProcFee;
     }
     //24+ months gets a 15% discount.
     else if (count >= 24)
     {
         proc.ProcDiscount = .15 * proc.ProcFee;
     }
     proc.ProcDiscount = Math.Round(proc.ProcDiscount, 2);
     proc.Calc();
 }
Пример #2
0
        private void butPreviousProc_Click(object sender, EventArgs e)
        {
            FormProcSelect FormPS = new FormProcSelect(_patCur.PatNum, false);

            if (FormPS.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            //isMultiSelect is set to false so should only ever be one procedure, constructing in a way to handle multiple in case we ever want to change
            //isMultiSelect to be true.
            foreach (Procedure proc in FormPS.ListSelectedProcs)
            {
                //Use our list of ProcedureCodes so irrelevant codes result in a new ProcedureCode with blank values.
                ProcedureCode procCode = ProcedureCodes.GetProcCode(proc.CodeNum, _listPrePaySupportCodes);
                //Didn't exist in our list of ProcedureCodes, tell user it won't be added.
                if (procCode.CodeNum == 0)
                {
                    //Did not translate because HQ only.
                    MsgBox.Show(this, "Selected procedure cannot be used with the Prepayment Tool.");
                    continue;
                }
                ProcedureCharge procCharge    = new ProcedureCharge(procCode, proc.ProcFee);
                Adjustment      taxAdjustment = Adjustments.GetSalesTaxForProc(proc.ProcNum);
                if (taxAdjustment != null)
                {
                    procCharge.EstTax           = taxAdjustment.AdjAmt;
                    procCharge.HasTaxAdjustment = true;
                }
                else
                {
                    procCharge.EstTax = 0;
                }
                procCharge.Calc();
                _listPreviouslyCompProcedureCharges.Add(procCharge);
                _listCompletedProcs.Add(proc);
            }
            //This calls FillGridCompletedProcs()
            FillGridPrepayment();
        }
Пример #3
0
        ///<summary>Looks in the patient's repeating charges for a rate to use.  If the patient does not have a repeat charge setup
        ///for the procedurecode that is being added then a procedurecharge will not be created.
        ///This is then used to create one or more procedurecharges.</summary>
        private void CreateProcedureCharge(ProcedureCode ProcCode, int count, bool isNew = true)
        {
            List <RepeatCharge>    listRcForProc        = _listRcForPat.FindAll(x => x.ProcCode == ProcCode.ProcCode && x.IsEnabled);
            List <ProcedureCharge> listProcChargeInGrid = _listProcedureCharge.FindAll(x => x.ProcCode == ProcCode);

            if (listRcForProc.Count == 1)
            {
                //Discussed with accounting dept.  If there is only one repeat charge for a proc on an account it should never have a stop date.
                //If for some reason there is a stop date, it is a very special case that we can't currently handle with the prepayment tool.
                int index = _listProcedureCharge.FindIndex(x => x.BaseFee == listRcForProc[0].ChargeAmt && x.ProcCode == ProcCode);
                //Does not exist in our list, make a new one.
                if (index == -1)
                {
                    ProcedureCharge procCharge = new ProcedureCharge(ProcCode, listRcForProc.FirstOrDefault().ChargeAmt);
                    procCharge.ProcCount = count;
                    procCharge.Calc();
                    _listProcedureCharge.Add(procCharge);
                }
                else
                {
                    _listProcedureCharge[index].ProcCount += count;
                }
            }
            else if (listRcForProc.Count >= 2)
            {
                int remainder = count;
                foreach (RepeatCharge charge in listRcForProc)
                {
                    if (remainder <= 0)                   //Nothing left to add, kick out of loop.
                    {
                        break;
                    }
                    if (charge.DateStop.Year > 1880 && charge.DateStop < DateTimeOD.Today)
                    {
                        continue;                        //The charge has a stop date in the past (has been disabled).
                    }
                    //Look for existing procedurecharge.
                    int index = _listProcedureCharge.FindIndex(x => x.BaseFee == charge.ChargeAmt && x.ProcCode == ProcCode && x.HasReachedStopDate == false);
                    //Does not exist in our list, make a new one.
                    if (index == -1)
                    {
                        ProcedureCharge procCharge = new ProcedureCharge(ProcCode, charge.ChargeAmt);
                        //See if the months we are adding extends beyond this repeat charge's stop date.
                        DateTime dateToUse = charge.DateStart;
                        //Check if we should use start date or today.  Prevent old charges.
                        if (DateTimeOD.Today > charge.DateStart)
                        {
                            dateToUse = DateTimeOD.Today;
                        }
                        if (dateToUse.AddMonths(remainder) > charge.DateStop && charge.DateStop.Year > 1880)
                        {
                            procCharge.HasReachedStopDate = true;
                            //Difference is number of months between today and the stop date, this will become the count for our current procedurecharge
                            int difference = ((charge.DateStop.Year - dateToUse.Year) * 12) + (charge.DateStop.Month - dateToUse.Month);
                            if (DateTimeOD.Today < DateTimeOD.GetMostRecentValidDate(dateToUse.Year, dateToUse.Month, _patCur.BillingCycleDay))
                            {
                                difference += 1;
                            }
                            procCharge.ProcCount = difference;
                            remainder            = remainder - difference;
                        }
                        //Stop date was not reached
                        else
                        {
                            procCharge.ProcCount = remainder;
                            remainder            = 0;
                        }
                        procCharge.Calc();
                        _listProcedureCharge.Add(procCharge);
                    }
                    //Found a matching procedurecharge.
                    else
                    {
                        if (_listProcedureCharge[index].HasReachedStopDate)
                        {
                            //Already hit stopdate for this repeat charge so continue on to the next one.
                            continue;
                        }
                        //See if stop date is mindate, if it is then we can add to the count and exit the loop.
                        if (charge.DateStop.Year < 1880)
                        {
                            _listProcedureCharge[index].ProcCount += remainder;
                            remainder = 0;
                            continue;
                        }
                        //Has a stop date, see if we hit it.
                        else
                        {
                            //See if we should use today or the start date.
                            if (DateTimeOD.Today > charge.DateStart)
                            {
                                //See if the count exceeds the difference between today and stop date of this repeat charge.
                                int difference = ((charge.DateStop.Year - DateTimeOD.Today.Year) * 12) + (charge.DateStop.Month - DateTimeOD.Today.Month);
                                if (DateTimeOD.Today.Day < _patCur.BillingCycleDay)
                                {
                                    difference += 1;
                                }
                                int combinedCount = _listProcedureCharge[index].ProcCount + remainder;
                                if (DateTimeOD.Today.AddMonths(combinedCount) >= charge.DateStop)
                                {
                                    //Hit the stop date.
                                    _listProcedureCharge[index].HasReachedStopDate = true;
                                    remainder = combinedCount - difference;
                                    _listProcedureCharge[index].ProcCount = difference;
                                }
                                else
                                {
                                    _listProcedureCharge[index].ProcCount += remainder;
                                    remainder = 0;
                                }
                            }
                            else                              //Start date in future.
                                                              //See if the count exceeds the difference between the start and stop date of this repeat charge.
                            {
                                int difference    = ((charge.DateStop.Year - charge.DateStart.Year) * 12) + (charge.DateStop.Month - charge.DateStart.Month);
                                int combinedCount = _listProcedureCharge[index].ProcCount + remainder;
                                if (combinedCount > difference)
                                {
                                    //Hit the stop date.
                                    _listProcedureCharge[index].HasReachedStopDate = true;
                                    remainder = combinedCount - difference;
                                    _listProcedureCharge[index].ProcCount = difference;
                                }
                                else
                                {
                                    _listProcedureCharge[index].ProcCount += remainder;
                                    remainder = 0;
                                }
                            }
                        }
                    }
                }
            }
        }