private MiscBillingByAccount CreateMiscBillingByAccount(IGrouping <MiscBillingGroupByKeySelector, IMiscBillingCharge> grp, IEnumerable <IHoliday> holidays, IBillingTypeRepository mgr) { var period = grp.Key.Period; var clientId = grp.Key.ClientID; var accountId = grp.Key.AccountID; IClient client = ServiceProvider.Current.Data.Client.GetClient(clientId); IAccount acct = ServiceProvider.Current.Data.Account.GetAccount(accountId); IBillingType bt = mgr.GetBillingType(period, clientId, acct.OrgID, holidays); BillingCategory bc = (BillingCategory)Enum.Parse(typeof(BillingCategory), grp.Key.SubType, true); decimal totalMisc = grp.Sum(g => Convert.ToDecimal(g.Quantity) * g.UnitCost); decimal totalSubsidy = grp.Sum(g => g.SubsidyDiscount); return(new MiscBillingByAccount(period, client, acct, bt, bc, totalMisc, totalSubsidy)); }
public IBillingType GetBillingType(IToolData item) { return(_billingType.GetBillingType(item.ClientID, item.AccountID, item.Period)); }