Esempio n. 1
0
        ///<summary>Changes the DiscountPlanNum of all patients that have _planFrom.DiscountPlanNum to _planInto.DiscountPlanNum</summary>
        public static void MergeTwoPlans(DiscountPlan planInto, DiscountPlan planFrom)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), planInto, planFrom);
            }
            string command = "UPDATE patient SET DiscountPlanNum=" + POut.Long(planInto.DiscountPlanNum)
                             + " WHERE DiscountPlanNum=" + POut.Long(planFrom.DiscountPlanNum);

            Db.NonQ(command);
            //Delete the discount plan from the database.
            Crud.DiscountPlanCrud.Delete(planFrom.DiscountPlanNum);
        }
Esempio n. 2
0
        ///<summary>Creates a new discount adjustment for the given procedure using the discount plan fee.</summary>
        public static void CreateAdjustmentForDiscountPlan(Procedure procedure)
        {
            //No need to check RemotingRole; no call to db.
            DiscountPlan discountPlan = DiscountPlans.GetPlan(Patients.GetPat(procedure.PatNum).DiscountPlanNum);

            if (discountPlan == null)
            {
                return;                //No discount plan.
            }
            //Figure out how much the patient saved and make an adjustment for the difference so that the office find how much money they wrote off.
            double discountAmt = Fees.GetAmount(procedure.CodeNum, discountPlan.FeeSchedNum, procedure.ClinicNum, procedure.ProvNum);

            if (discountAmt == -1)
            {
                return;                //No fee entered, don't make adjustment.
            }
            double adjAmt = procedure.ProcFee - discountAmt;

            if (adjAmt <= 0)
            {
                return;                //We do not need to create adjustments for 0 dollars.
            }
            Adjustment adjustmentCur = new Adjustment();

            adjustmentCur.DateEntry = DateTime.Today;
            adjustmentCur.AdjDate   = DateTime.Today;
            adjustmentCur.ProcDate  = procedure.ProcDate;
            adjustmentCur.ProvNum   = procedure.ProvNum;
            adjustmentCur.PatNum    = procedure.PatNum;
            adjustmentCur.AdjType   = discountPlan.DefNum;
            adjustmentCur.ClinicNum = procedure.ClinicNum;
            adjustmentCur.AdjAmt    = (-adjAmt);
            adjustmentCur.ProcNum   = procedure.ProcNum;
            Insert(adjustmentCur);
            TsiTransLogs.CheckAndInsertLogsIfAdjTypeExcluded(adjustmentCur);
            SecurityLogs.MakeLogEntry(Permissions.AdjustmentCreate, procedure.PatNum, "Adjustment made for discount plan: " + adjustmentCur.AdjAmt.ToString("f"));
        }