Exemple #1
0
        ///<summary>Gets one OrthoProcLink of the specified OrthoProcType for an OrthoCase. This should only be used to get procedures of the
        ///Banding or Debond types as only one of each can be linked to an Orthocase.</summary>
        public static OrthoProcLink GetByType(long orthoCaseNum, OrthoProcType linkType)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <OrthoProcLink>(MethodBase.GetCurrentMethod(), orthoCaseNum, linkType));
            }
            string command = $@"SELECT * FROM orthoproclink WHERE orthoproclink.OrthoCaseNum={POut.Long(orthoCaseNum)}
				AND orthoproclink.ProcLinkType={POut.Int((int)linkType)}"                ;

            return(Crud.OrthoProcLinkCrud.SelectOne(command));
        }
Exemple #2
0
        ///<summary>Does not insert it in the DB. Returns an OrthoProcLink of the specified type for the OrthoCaseNum and procNum passed in.</summary>
        public static OrthoProcLink CreateHelper(long orthoCaseNum, long procNum, OrthoProcType procType)
        {
            //No remoting role check; no call to db
            OrthoProcLink orthoProcLink = new OrthoProcLink();

            orthoProcLink.OrthoCaseNum    = orthoCaseNum;
            orthoProcLink.ProcNum         = procNum;
            orthoProcLink.ProcLinkType    = procType;
            orthoProcLink.SecUserNumEntry = Security.CurUser.UserNum;
            return(orthoProcLink);
        }
Exemple #3
0
        ///<summary>Determines whether the passed in procedure is a Banding, Visit, or Debond procedure and
        ///sets the ProcFee accordingly. Does not update the procedure in the database.</summary>
        public static void SetProcFeeForLinkedProc(OrthoCase orthoCase, Procedure proc, OrthoProcType procType, List <OrthoProcLink> listVisitProcLinks,
                                                   OrthoPlanLink scheduleOrthoPlanLink = null, OrthoSchedule orthoSchedule = null)
        {
            //No remoting role check; no call to db
            if (scheduleOrthoPlanLink == null && orthoSchedule == null)
            {
                scheduleOrthoPlanLink = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCase.OrthoCaseNum, OrthoPlanLinkType.OrthoSchedule);
            }
            if (orthoSchedule == null)
            {
                orthoSchedule = OrthoSchedules.GetOne(scheduleOrthoPlanLink.FKey);
            }
            double procFee = 0;

            switch (procType)
            {
            case OrthoProcType.Banding:
                procFee = orthoSchedule.BandingAmount;
                break;

            case OrthoProcType.Debond:
                procFee = orthoSchedule.DebondAmount;
                break;

            case OrthoProcType.Visit:
                double allVisitsAmount   = Math.Round((orthoCase.Fee - orthoSchedule.BandingAmount - orthoSchedule.DebondAmount) * 100) / 100;
                int    plannedVisitCount = OrthoSchedules.CalculatePlannedVisitsCount(orthoSchedule.BandingAmount, orthoSchedule.DebondAmount
                                                                                      , orthoSchedule.VisitAmount, orthoCase.Fee);
                if (listVisitProcLinks.Count == plannedVisitCount)
                {
                    procFee = Math.Round((allVisitsAmount - orthoSchedule.VisitAmount * (plannedVisitCount - 1)) * 100) / 100;
                }
                else if (listVisitProcLinks.Count < plannedVisitCount)
                {
                    procFee = orthoSchedule.VisitAmount;
                }
                break;
            }
            proc.ProcFee   = procFee;
            proc.BaseUnits = 0;
            proc.UnitQty   = 1;
        }