///<summary>Gets all of the payplanlink entries for the given fKey and linkType.</summary> public static List <PayPlanLink> GetForFKeyAndLinkType(long fKey, PayPlanLinkType linkType) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <PayPlanLink> >(MethodBase.GetCurrentMethod(), fKey, linkType)); } return(GetForFKeysAndLinkType(new List <long> { fKey }, linkType)); }
///<summary>Gets a list of charges for the passed in fkey and link type (i.e. adjustment, procedure...)</summary> public static List <PayPlanCharge> GetForLinkTypeAndFKeys(PayPlanLinkType linkType, params long[] arrayFKeys) { if (arrayFKeys.IsNullOrEmpty()) { return(new List <PayPlanCharge>()); } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <PayPlanCharge> >(MethodBase.GetCurrentMethod(), linkType, arrayFKeys)); } string command = $"SELECT * FROM payplancharge " + $"WHERE payplancharge.FKey IN({string.Join(",",arrayFKeys.Select(x => POut.Long(x)))}) " + $"AND payplancharge.LinkType={POut.Int((int)linkType)}"; return(Crud.PayPlanChargeCrud.SelectMany(command)); }
///<summary>Construct a payplanproductionentry for an UNATTACHED adjustment (attached adjustments get treated as procedures).</summary> public PayPlanProductionEntry(Adjustment adj, PayPlanLink credit) { ProductionTag = adj; LinkedCredit = credit; ProductionDate = adj.AdjDate; PriKey = adj.AdjNum; ProvNum = adj.ProvNum; ClinicNum = adj.ClinicNum; PatNum = adj.PatNum; AmountOriginal = (decimal)adj.AdjAmt; AmountOverride = (decimal)credit.AmountOverride; AmountRemaining = (AmountOverride == 0)?AmountOriginal:AmountOverride; //Gets set when calculating CreditDate = credit.SecDateTEntry; Description = $"Adjustment - {Defs.GetName(DefCat.AdjTypes,adj.AdjType)}"; LinkType = PayPlanLinkType.Adjustment; }
///<summary>Construct a payplanproductionentry item for a procedure. Calculates pat portion.</summary> public PayPlanProductionEntry(Procedure proc, PayPlanLink credit, List <ClaimProc> listClaimProcs, List <Adjustment> listAdjustments) { ProductionTag = proc; LinkedCredit = credit; ProductionDate = proc.ProcDate; PriKey = proc.ProcNum; ProvNum = proc.ProvNum; ClinicNum = proc.ClinicNum; PatNum = proc.PatNum; AmountOriginal = ClaimProcs.GetPatPortion(proc, listClaimProcs, listAdjustments); AmountOverride = (decimal)credit.AmountOverride; AmountRemaining = (AmountOverride == 0)?AmountOriginal:AmountOverride; CreditDate = credit.SecDateTEntry; Description = $"{ProcedureCodes.GetStringProcCode(proc.CodeNum)} - {ProcedureCodes.GetLaymanTerm(proc.CodeNum)}"; LinkType = PayPlanLinkType.Procedure; }
///<summary>Gets all of the payplanlink entries for the given fKey and linkType.</summary> public static List <PayPlanLink> GetForFKeysAndLinkType(List <long> listFKeys, PayPlanLinkType linkType) { if (listFKeys.IsNullOrEmpty()) { return(new List <PayPlanLink>()); } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <PayPlanLink> >(MethodBase.GetCurrentMethod(), listFKeys, linkType)); } string command = $"SELECT * FROM payplanlink WHERE payplanlink.FKey IN ({string.Join(",",listFKeys.Select(x => POut.Long(x)))}) " + $"AND payplanlink.LinkType={POut.Int((int)linkType)} "; return(Crud.PayPlanLinkCrud.SelectMany(command)); }
///<summary>For use with Dynamic Payment Plans. Production (proceudres and adjustments) is attached via PayPlanLinks.</summary> public static PayPlanLink CreatePaymentPlanLink(PayPlan payplan, long procOrAdjNum, PayPlanLinkType linkType) { PayPlanLink link = new PayPlanLink(); link.PayPlanNum = payplan.PayPlanNum; link.AmountOverride = 0; link.FKey = procOrAdjNum; link.LinkType = linkType; PayPlanLinks.Insert(link); return(link); }