public static decimal GetLineCostAuditFriendlyVersion(ToolLineCostParameters p) { var auditResult = UserUsageAudit.GetUserUsageAuditResult(new UserUsageAuditItem { ResourceID = p.ResourceID, ResourceName = p.ResourceName, RoomID = p.RoomID, BillingTypeID = p.BillingTypeID, IsStarted = p.IsStarted, IsCancelledBeforeAllowedTime = p.IsCancelledBeforeAllowedTime, RatePeriod = p.RatePeriod, Uses = p.Uses, PerUseRate = p.PerUseRate, // stored as decimal in database ResourceRate = p.ResourceRate, // stored as decimal in database ReservationRate = p.ReservationRate, // stored as decimal in database OverTimePenaltyPercentage = p.OverTimePenaltyPercentage, OverTimePenaltyFee = p.OverTimePenaltyFee, // stored as decimal in the database UncancelledPenaltyPercentage = p.UncancelledPenaltyPercentage, UncancelledPenaltyFee = p.UncancelledPenaltyFee, // stored as decimal in the database BookingFee = p.BookingFee, // stored as decimal in the database ReservationFee2 = p.ReservationFee2, // stored as decimal in the database SchedDuration = p.SchedDuration, ChargeDuration = p.ChargeDuration, OverTime = p.OverTime, // stored as decimal in database TransferredDuration = p.TransferredDuration, ChargeMultiplier = p.ChargeMultiplier, UsageFeeCharged = p.UsageFeeCharged, // stored as decimal in database }); return(auditResult.LineCost); }
public decimal GetLineCost(ToolLineCostParameters parameters) { throw new NotImplementedException(); }
public decimal GetLineCost(ToolLineCostParameters parameters) => ToolBillingUtility.GetLineCost(parameters);
/// <summary> /// This method computes the total amount charged for tool usage. This is used in all billing reports sent to UofM FinOps /// </summary> public static decimal GetLineCost(ToolLineCostParameters p) { // [2015-11-13 jg] this is identical to the logic originally in: // 1) sselFinOps.AppCode.BLL.FormulaBL.ApplyToolFormula (for External Invoice) // 2) sselIndReports.AppCode.Bll.ToolBillingBL.GetToolBillingDataByClientID20110701 (for User Usage Summary) // 3) LNF.WebApi.Billing.Models.ReportUtility.ApplyToolFormula (for SUB reports, note: this is the replacement for the Billing WCF service) // // I think at this point all the formulas can be replaced by GetTotalCharge() // because each value used by the formula should correctly reflect the rules // in place during the given period (or at least that is the goal). decimal result; //if rates are 0 everything must be 0 (this was at the end, but why not do it at the beginning?) if (p.ResourceRate + p.PerUseRate == 0) { return(0); } int cleanRoomId = 6; int maskMakerId = 56000; if (BillingTypes.IsMonthlyUserBillingType(p.BillingTypeID)) //not used at this point but maybe in the future { // Monthly User, charge mask maker for everyone if (p.RoomID == cleanRoomId) //Clean Room { if (p.ResourceID == maskMakerId) //Mask Maker { if (p.IsStarted) { result = p.UsageFeeCharged + p.OverTimePenaltyFee + (p.ResourceRate == 0 ? 0 : p.ReservationFee2); } else { result = p.UncancelledPenaltyFee + p.ReservationFee2; } } else { result = 0; } } else { //non clean room tools are always charged for usage fee if (p.IsStarted) { result = p.UsageFeeCharged + p.OverTimePenaltyFee + (p.ResourceRate == 0 ? 0 : p.ReservationFee2); } else { result = p.UncancelledPenaltyFee + p.ReservationFee2; } } } else if (p.BillingTypeID == BillingTypes.Other) { //based on sselIndReports.AppCode.BLL.ToolBillingBL.GetToolBillingDataByClientID20110701 the Other billing type is not set to zero any longer result = ToolBillingItem.GetTotalCharge(p.UsageFeeCharged, p.OverTimePenaltyFee, p.BookingFee, p.UncancelledPenaltyFee, p.ReservationFee2); } else { //Per Use types if (p.Period >= new DateTime(2010, 7, 1)) { //2022-04 New tool billing started on 2022-03 if (p.Period >= new DateTime(2022, 3, 1)) { // [2022-04-08 jg] Use the new "audit friendly" method. This way of calculating makes it easy to break out the constituent parts and // do the math to verify the line cost. The User Usage Summary report has been updated to display these parts. result = GetLineCostAuditFriendlyVersion(p); } //2011-05 New tool billing started on 2011-04 else if (p.Period >= new DateTime(2011, 4, 1)) { if (!p.IsCancelledBeforeAllowedTime) { result = p.UsageFeeCharged + p.OverTimePenaltyFee + p.BookingFee; //should be the same as GetTotalCharge() } else { result = p.BookingFee; //Cancelled before two hours - should be the same as GetTotalCharge() } } else { if (p.IsStarted) { result = p.UsageFeeCharged + p.OverTimePenaltyFee + (p.ResourceRate == 0 ? 0 : p.ReservationFee2); //should be the same as GetTotalCharge() } else { result = p.UncancelledPenaltyFee; //should be the same as GetTotalCharge() } } } else { if (p.IsStarted) { result = p.UsageFeeCharged + p.OverTimePenaltyFee + (p.ResourceRate == 0 ? 0 : p.ReservationFee2); //should be the same as GetTotalCharge() } else { result = p.UncancelledPenaltyFee + p.ReservationFee2; //should be the same as GetTotalCharge() } } } return(result); }