public async Task <List <TransactionTypeAmounts> > GetEarnings(long ukprn, short academicYear, byte collectionPeriod, CancellationToken cancellationToken) { using (await BeginTransaction(cancellationToken)) { return(await Earnings.FromSql(BaseDcEarningsQuery + UkprnFilterSelect, new SqlParameter("@ukprn", ukprn), new SqlParameter("@collectionperiod", collectionPeriod)).ToListAsync(cancellationToken)); } }
public List <Earnings> AddNonServerEarnings(List <Earnings> earnings) { List <EarningsEntity> addedEarningsEntities = new List <EarningsEntity>(); List <Earnings> mappedEarnings = new List <Earnings>(); foreach (Earnings e in earnings) { if (earningsRepository.EarningExists(e.StaffMember.Id, e.ShiftDate, e.LunchOrDinner)) { EarningsEntity earn = earningsRepository.GetEarning(e.StaffMember.Id, e.ShiftDate, e.LunchOrDinner); earningsRepository.DeleteEarning(earn.Id); } EarningsEntity earningToAdd = Mapper.Map <EarningsEntity>(e); earningsRepository.AddEarning(earningToAdd); addedEarningsEntities.Add(earningToAdd); } UtilityMethods.VerifyDatabaseSaveSuccess(earningsRepository); foreach (EarningsEntity e in addedEarningsEntities) { Earnings finalEarning = Mapper.Map <Earnings>(e); mappedEarnings.Add(finalEarning); } return(mappedEarnings); }
public ActionResult Edit(Earnings obj) { if (ModelState.IsValid) { try { var result = iEarnings.Update(obj, "u"); return(Json(new { ErrorCode = result.ErrorCode, Message = result.Msg, Id = result.Id, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { return(Json(new { ErrorCode = 1, Message = ex.Message }, JsonRequestBehavior.AllowGet)); } } Response.TrySkipIisCustomErrors = true; string messages = string.Join("; ", ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage)); return(Json(new { ErrorCode = 1, Message = messages }, JsonRequestBehavior.AllowGet)); }
public PaycheckContext(EmployeeInfo employeeInfo, Earnings earnings, Deductions deductions, Taxes taxes, Benefits benefits) { EmployeeInfo = employeeInfo; Earnings = earnings; Deductions = deductions; Taxes = taxes; Benefits = benefits; }
private DataUpdates(DateTime occuredutc, DataPoint[] dataPoints, Delistings delistings, Dividends dividends, Earnings earnings, Financials financials, KeyStats keystats, QuoteBars quotebars, Splits splits, TradeBars tradebars, TradingStatusUpdates tradingStatusUpdates, Ticks ticks) { //TODO: for cloning this object (so it becomes immutable) throw new NotImplementedException(); }
public void earnings_with_from_and_to_date_returns_result() { EODHistoricalDataClient client = new EODHistoricalDataClient(Consts.ApiToken, true); Earnings earnings = client.GetEarnings(Consts.OptionsStartDate, Consts.OptionsEndDate); Assert.IsNotNull(earnings); Assert.IsTrue(earnings.EarningsData.Count > 0); }
public void earnings_no_parameters_returns_prices() { EODHistoricalDataClient client = new EODHistoricalDataClient(Consts.ApiToken, true); Earnings earnings = client.GetEarnings(); Assert.IsNotNull(earnings); Assert.IsTrue(earnings.EarningsData.Count > 0); }
public void earnings_with_symbols_list_returns_result() { EODHistoricalDataClient client = new EODHistoricalDataClient(Consts.ApiToken, true); Earnings earnings = client.GetEarnings(null, null, Consts.MultipleSymbolEarnings); Assert.IsNotNull(earnings); Assert.IsTrue(earnings.EarningsData.Count > 0); }
public IActionResult GetEarnings() { string userId = m_userManager.GetUserId(HttpContext.User); Earnings earnings = m_context.Earnings.Find(userId); if (earnings == null) { return(NotFound()); } return(Ok(new EarningsViewModel(earnings))); }
public async Task WhenAnEarningEventIsReceived() { var startTime = DateTimeOffset.UtcNow; var earnings = Earnings.GroupBy(p => p.LearnerId).Select(CreateEarningEvent).ToList(); await CreateTestEarningsJob(startTime, earnings.Cast <IPaymentsEvent>().ToList()); foreach (var earningEvent in earnings) { await MessageSession.Send(earningEvent).ConfigureAwait(false); } }
public ActionResult Edit(string id) { try { Earnings obj = iEarnings.GetById(id); return(PartialView(obj)); } catch (Exception ex) { return(Json(new { ErrorCode = 1, Message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public List <Earnings> CalculateEarnings(List <Checkout> checkouts, TipOut tipout, DateTime shiftDate, string lunchOrDinner) { decimal teamTotalTipout = tipout.BarTipOut + tipout.SaTipOut; decimal teamTotalCcTips = 0; decimal teamTotalAutoGrat = 0; decimal teamTotalCashTips = 0; foreach (Checkout c in checkouts) { teamTotalCcTips += c.CcTips + c.CashAutoGrat; teamTotalAutoGrat += c.CcAutoGrat; teamTotalCashTips += c.CashTips; } Earnings individualEarnings = new Earnings(shiftDate, "server", lunchOrDinner); if (teamTotalCcTips >= teamTotalTipout) { decimal TeamCcTipsAfterCheckout = teamTotalCcTips - teamTotalTipout; individualEarnings.CcTips = Math.Round(TeamCcTipsAfterCheckout / checkouts.Count, 2); individualEarnings.AutoGratuity = Math.Round(teamTotalAutoGrat / checkouts.Count, 2); individualEarnings.CashTips = Math.Round(teamTotalCashTips / checkouts.Count, 2); individualEarnings.TotalTipsForPayroll = Math.Round(individualEarnings.CcTips + individualEarnings.CashTips + individualEarnings.AutoGratuity, 2); } else if (teamTotalCcTips + teamTotalAutoGrat > teamTotalTipout) { individualEarnings.CcTips = 0; decimal combinedAutoGratAndCC = teamTotalCcTips + teamTotalAutoGrat; individualEarnings.AutoGratuity = Math.Round(combinedAutoGratAndCC - teamTotalTipout, 2); individualEarnings.CashTips = Math.Round(teamTotalCashTips / checkouts.Count, 2); individualEarnings.TotalTipsForPayroll = Math.Round(individualEarnings.CashTips + individualEarnings.AutoGratuity, 2); } else { decimal teamTotalCCandAutoG = teamTotalCcTips + teamTotalAutoGrat; decimal remainingTipOutOwed = teamTotalTipout - teamTotalCCandAutoG; decimal remaingTeamCashTips = teamTotalCashTips - remainingTipOutOwed; individualEarnings.CcTips = 0; individualEarnings.AutoGratuity = 0; individualEarnings.OwedCashForTipOut = true; individualEarnings.CashPayedForTipOut = remainingTipOutOwed; individualEarnings.CashTips = Math.Round(remaingTeamCashTips / checkouts.Count, 2); individualEarnings.TotalTipsForPayroll = (individualEarnings.CashTips); } List <Earnings> teamEarnings = new List <Earnings>(); foreach (Checkout c in checkouts) { teamEarnings.Add(individualEarnings); } return(teamEarnings); }
public Earnings MapViewModelToEarnings(EarningsViewModel earningsViewModel) { var earning = new Earnings(); earning.UserId = earningsViewModel.UserId; earning.Earning = earningsViewModel.Earning; earning.Expenditure = earningsViewModel.Expenditure; earning.ShiftDate = earningsViewModel.ShiftDate; earning.IncomeEarned = CalculateIncome(earningsViewModel); earning.DriverId = earningsViewModel.DriverId; earning.TaxiId = earningsViewModel.TaxiId; return(earning); }
public Earnings GetById(string Id) { SqlParameter[] param = { new SqlParameter("@flag", SqlDbType.VarChar, 50) { Value = "s" } , new SqlParameter("@Id", SqlDbType.Int) { Value = Id } }; DataRow result = SqlHelper.ExecuteDataRow("spEarnings", param); Earnings obj = new Earnings(); obj.Id = Convert.ToInt32(result["Id"]); obj.Name = result["Name"].ToString(); obj.IsActive = Convert.ToBoolean(result["IsActive"].ToString()); return(obj); }
{ //Dont forget to update TipOuts across the board with BarBackTipOut public List <Earnings> CalculateEarnings(List <Checkout> checkouts, TipOut tipout, decimal serverTips, DateTime shiftDate, string lunchOrDinner) { var teamEarnings = new List <Earnings>(); decimal totalTips = serverTips; decimal totalAutoGratuity = 0; decimal totalCashTips = 0; decimal totalTeamHours = 0; // Add up all the total team numbers foreach (Checkout c in checkouts) { totalTips += c.CcAutoGrat + c.CcTips + c.CashAutoGrat; totalAutoGratuity += c.CcAutoGrat; totalCashTips += c.CashTips; totalTeamHours += c.Hours; } //Take out the tipout and split up auto grat and cc decimal totalNetTips = totalTips - tipout.BarBackTipOut; totalNetTips = totalNetTips - totalAutoGratuity; //Determine team hourly pay decimal teamCcHourly = Math.Round(totalNetTips / totalTeamHours, 2); decimal teamAutoGHourly = Math.Round(totalAutoGratuity / totalTeamHours, 2); decimal teamCashHourly = Math.Round(totalCashTips / totalTeamHours, 2); foreach (Checkout c in checkouts) { var earning = new Earnings(shiftDate, "bartender", lunchOrDinner) { CcTips = Math.Round(c.Hours * teamCcHourly, 2), CashTips = Math.Round(c.Hours * teamCashHourly, 2), AutoGratuity = Math.Round(c.Hours * teamAutoGHourly, 2), StaffMember = c.StaffMember }; earning.TotalTipsForPayroll = earning.CcTips + earning.AutoGratuity + earning.CashTips; teamEarnings.Add(earning); } return(teamEarnings); }
public IActionResult Set([FromBody] EarningsViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string userId = m_userManager.GetUserId(HttpContext.User); Earnings earnings = m_context.Earnings.Find(userId); if (earnings == null) { earnings = new Earnings(userId); m_context.Earnings.Add(earnings); } earnings.Update(model.AnnualIncome, model.Region); m_context.SaveChanges(); return(Ok()); }
/// <summary> /// This method opens the earnings report file /// and loads data for each employee into an array /// </summary> private void LoadEarningsReports() { try { if (earningsFile.OpenRead()) { while (!earningsFile.IsEOF) { earningsFile.ReadRecord(); Earnings earnings = new Earnings(); foreach (PropertyInfo property in typeof(Earnings).GetProperties()) { property.SetValue(earnings, property.GetValue(earningsFile.Data, null), null); } earningsReports.Add(earnings); } } } catch (IOException e) { MessageBox.Show(e.Message); } }
public DbResult Update(Earnings obj, string flag) { SqlParameter[] param = { new SqlParameter("@flag", SqlDbType.VarChar, 20) { Value = flag == "i"? "i":"u" } , new SqlParameter("@Name", SqlDbType.VarChar, 50) { Value = obj.Name } , new SqlParameter("@IsActive", SqlDbType.Bit) { Value = obj.IsActive } , new SqlParameter("@Id", SqlDbType.Int) { Value = obj.Id } }; return(SqlHelper.ParseDbResult("spEarnings", param)); }
public EarningDto RunServerTeamCheckout(RunServerTeamCheckoutDto data, List <CheckoutEntity> checkouts) { TeamEntity teamEntity = teamRepository.GetTeamById(data.ServerTeamId); //Check for the team to have an existing tipout, if it does remove it to not have incorrect tipout data. if (teamEntity.CheckoutHasBeenRun == true) { teamRepository.DeleteTipOut(data.ServerTeamId); teamEntity.CheckoutHasBeenRun = false; } ServerTeam team = new ServerTeam(teamEntity.ShiftDate); Mapper.Map(teamEntity, team); foreach (CheckoutEntity c in checkouts) { Checkout x = Mapper.Map <Checkout>(c); team.CheckOuts.Add(x); } //The earning is returned from the method called, and a tipout property is set on the team Earnings earning = team.RunCheckout()[0]; //The teams tipout is accessed here and saved to the database //The earning is tied to the server and not the checkout, so the earning //gets added and saved once this method returns an earning DTO TipOutEntity tipOutEntity = Mapper.Map <TipOutEntity>(team.TipOut); tipOutEntity.Team = teamEntity; teamRepository.AddTipOut(tipOutEntity); teamEntity.CheckoutHasBeenRun = true; if (!teamRepository.Save()) { throw new Exception("An unexpected error occured while saving the tipout for the team's checkout"); } return(Mapper.Map <EarningDto>(earning)); }
private bool MatchUnexpectedRequiredPayment(OnProgrammeEarningType?type) { var result = Earnings.Where(x => !type.HasValue || x.Type == type).ToList().All(earning => !ApprenticeshipContractType2Handler.ReceivedEvents.Any(receivedEvent => TestSession.JobId == receivedEvent.JobId && earning.Amount == receivedEvent.AmountDue && TestSession.Learners.Any(l => l.LearnRefNumber == receivedEvent.Learner?.ReferenceNumber) && earning.Type == receivedEvent.OnProgrammeEarningType && TestSession.Ukprn == receivedEvent.Ukprn && earning.DeliveryPeriod == receivedEvent.DeliveryPeriod && receivedEvent.CollectionPeriod.AcademicYear == AcademicYear) ); #if DEBUG //TODO: why is this debug? if (!result) { Debug.WriteLine("Found unexpected events. Trace:"); TraceMismatch(Earnings.ToArray(), ApprenticeshipContractType2Handler.ReceivedEvents.ToArray()); } #endif return(result); }
public List <Earnings> List() { List <Earnings> lst = new List <Earnings>(); SqlParameter[] param = { new SqlParameter("@flag", SqlDbType.VarChar, 50) { Value = "a" } }; DataTable result = SqlHelper.ExecuteDataTable("spEarnings", param); if (result != null && result.Rows.Count > 0) { foreach (DataRow drow in result.Rows) { Earnings obj = new Earnings(); obj.Id = Convert.ToInt32(drow["Id"]); obj.Name = drow["Name"].ToString(); obj.IsActive = Convert.ToBoolean(drow["IsActive"]); lst.Add(obj); } } return(lst); }
public JsonResult SomaResult() { Earnings earnings = new Earnings() { StationId = 1 }; try { using (sedatContext db = new sedatContext()) { db.EarningMonthly.Where(x => x.StationId == earnings.StationId).ToList().ForEach(x => earnings.monthList.Add(new Earnings.List() { Earning = x.Earning.GetValueOrDefault(), Month = x.Month.GetValueOrDefault() })); } } catch { throw; } return(Json(new { earnings = earnings })); }
// ProcessMatch method. static void ProcessMatch() { // This is where you put the steps when both are equal. //paysumFile.Data.DisplayData(); Earnings earn = new Earnings(); earn.DepartmentNumber = employeeFile.Data.DepartmentNumber; earn.EmployeeNumber = employeeFile.Data.EmployeeNumber; earn.RegularHours = paysumFile.Data.RegularHours; earn.OvertimeHours = paysumFile.Data.OvertimeHours; earn.Shift2Hours = paysumFile.Data.Shift2Hours; earn.Shift3Hours = paysumFile.Data.Shift3Hours; earn.WeekendHours = paysumFile.Data.WeekendHours; earn.RegularPay = PRLib.CalculatePay(earn.RegularHours, employeeFile.Data.HourlyRate); earn.OvertimePay = PRLib.CalculatePay(earn.OvertimeHours, employeeFile.Data.HourlyRate, 1.5f); earn.Shift2Pay = GetShiftRate('2') * earn.Shift2Hours; earn.Shift3Pay = GetShiftRate('3') * earn.Shift3Hours; earn.WeekendPay = GetShiftRate('W') * earn.WeekendHours; earn.GrossPay = PRLib.CalculateGrossPay(earn.RegularPay, earn.OvertimePay, earn.Shift2Pay, earn.Shift3Pay, earn.WeekendPay); earn.FederalWithholding = PRLib.CalculateFederalWithholdingTax(earn.GrossPay, employeeFile.Data.TaxMaritalStatus, employeeFile.Data.NumExemptions); earn.SsWithholding = PRLib.CalculateSocialSecurityTax(earn.GrossPay, employeeFile.Data.YtdGrossEarnings, employeeFile.Data.YtdSSTaxes); earn.MedicareWithholding = PRLib.CalculateMedicareTax(earn.GrossPay); earn.StateWithholding = PRLib.CalculateStateTax(earn.GrossPay, employeeFile.Data.StateWithholdingPercentage); float deductionOne = PRLib.CalculateDeduction(earn.GrossPay, employeeFile.Data.DeductionCodeOne, employeeFile.Data.DeductionValueOne); float deductionTwo = 0; float deductionThree = 0; if (earn.GrossPay - deductionOne > 0) { deductionTwo = PRLib.CalculateDeduction(earn.GrossPay, employeeFile.Data.DeductionCodeTwo, employeeFile.Data.DeductionValueTwo); if (earn.GrossPay - (deductionOne + deductionTwo) >= 0) { deductionThree = PRLib.CalculateDeduction(earn.GrossPay, employeeFile.Data.DeductionCodeThree, employeeFile.Data.DeductionValueThree); if (earn.GrossPay - (deductionOne + deductionTwo + deductionThree) < 0) { deductionThree = 0; } } else { deductionTwo = 0; } } else { deductionOne = 0; } earn.TotalVoluntaryDeductions = deductionOne + deductionTwo + deductionThree; earn.NetPay = PRLib.CalculateNetPay(earn.GrossPay, earn.FederalWithholding, earn.SsWithholding, earn.MedicareWithholding, deductionOne, deductionTwo, deductionThree); earn.CheckDate = "5/5/2019"; earn.CheckNumber = checkNumber; checkNumber++; earningsFile.Data = earn; earningsFile.WriteRecord(); DisplayChecks.DisplayChecks.AddIDName(earn.EmployeeNumber, employeeFile.Data.FirstName + " " + employeeFile.Data.LastName); earn.DisplayData(); Console.WriteLine("\n\n\n\n\n"); employeeFile.ReadRecord(); paysumFile.ReadRecord(); }
private List <Earning> MonthlyEarning() { return(Earnings.Where(e => e.Datetime.Month == DateTime.Now.Month).ToList()); }
private List <Earning> YearlyEarning() { return(Earnings.Where(e => e.Datetime.Year == DateTime.Now.Year).ToList()); }
public void GivenTheEarningEventsComponentGeneratesMoreEarningEvents(Table payments) { Earnings.AddRange(payments.CreateSet <OnProgrammeEarning>().ToList()); }
private void onEnterVehicleRequeseted(Player pl, InteractableVehicle vehicle, ref bool shouldAllow) { if (vehicle.asset.id == Configuration.Instance.BusID) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(pl); if ((GetDriver(vehicle, player) == player) && (!Colectivero.Contains(player.CSteamID))) { ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("ARENT_DRIVER").Replace('(', '<').Replace(')', '>')), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true); shouldAllow = false; return; } else if (Colectivero.Contains(player.CSteamID)) { Earnings.Add(player.CSteamID, 0); return; } UnturnedPlayer driver = GetDriver(vehicle, player); var cob = (UInt32)pluginInstance.Configuration.Instance.Payment; if (pluginInstance.Configuration.Instance.UseXP) { if (player.Experience > cob) { player.Experience = player.Experience - (cob * 2); driver.Experience = driver.Experience + cob; } else { ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("NOT_ENOUGH_MONEY", cob).Replace('(', '<').Replace(')', '>')), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true); shouldAllow = false; } } else { try { ExecuteDependencyCode("Uconomy", (IRocketPlugin plugin) => { Uconomy Uconomy = (Uconomy)plugin; if ((uint)Uconomy.Database.GetBalance(player.CSteamID.m_SteamID.ToString()) < cob) { AutoBusPlugin.Balance.Add(player.CSteamID, Uconomy.Database.GetBalance(player.CSteamID.m_SteamID.ToString())); } else { Uconomy.Database.IncreaseBalance(player.CSteamID.m_SteamID.ToString(), (cob * -1)); Uconomy.Database.IncreaseBalance(driver.CSteamID.m_SteamID.ToString(), (cob)); } }); if (AutoBusPlugin.Balance[player.CSteamID] < cob) { ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("NOT_ENOUGH_MONEY", cob).Replace('(', '<').Replace(')', '>')), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true); AutoBusPlugin.Balance.Remove(player.CSteamID); shouldAllow = false; return; } } catch (Exception e) { Logger.Log($"error at try execute a trasaction{e.Message}"); } Earnings[player.CSteamID] += Configuration.Instance.Payment; EffectManager.sendUIEffect(5463, 5464, true, pluginInstance.Translate("UI_WON"), Earnings[player.CSteamID].ToString(), Configuration.Instance.Payment.ToString()); ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("PAY_TO_DRIVER", driver.CharacterName, cob).Replace('(', '<').Replace(')', '>')), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true); ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("WON_DRIVER", cob).Replace('(', '<').Replace(')', '>')), Color.white, null, driver.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true); shouldAllow = true; return; } shouldAllow = true; return; } }
/// <summary> /// Ключ для валидации уведомления - хэш от проданного ключа и прибыли продавца /// </summary> private string GetValidationKey(OrderInfo order, Earnings earnings) => hashService.CreateHash(new string[] { order.Key, earnings.Income.ToString() });
public EarningsViewModel(Earnings earnings) { AnnualIncome = earnings.AnnualIncome; Region = earnings.Region; }
public DbResult Update(Earnings entity, string flag) { return(repo.Update(entity, flag)); }