Ejemplo n.º 1
0
 public ActionResult Index(TipCalculation model)
 {
     model.TenPercent     = decimal.Multiply(model.Total, 0.10M);
     model.FifteenPercent = decimal.Multiply(model.Total, 0.15M);
     model.TwentyPercent  = decimal.Multiply(model.Total, 0.20M);
     return(View("CalculationResults", model));
 }
Ejemplo n.º 2
0
        public IActionResult Index(TipCalculation request)
        {
            _logger.LogTrace($"Received tip calculation request for cost of meal {request.CostOfMeal}.");
            if (ModelState.IsValid)
            {
                return(View(_calculator.Calculate(request.CostOfMeal.Value)));
            }

            return(Index());
        }
Ejemplo n.º 3
0
 public Transaction ConvertTipRow(AlohaDataset.adjtimeRow adjtimeRow, TipCalculation tipCalculationStrategy)
 {
     return(new Transaction
     {
         Type = TransactionType.PayCode,
         PeriodType = PeriodType.Unknown,
         EmpId = adjtimeRow.employee,
         SSN = adjtimeRow.ssn,
         JobCode = adjtimeRow.jobcode,
         Hours = 0m,
         PayCode = "T",
         ClockIn = adjtimeRow.date.AddHours(12),
         Tips = (tipCalculationStrategy == TipCalculation.Auto) ?
                (adjtimeRow.dectips > adjtimeRow.cctips) ? adjtimeRow.dectips : adjtimeRow.cctips :
                (tipCalculationStrategy == TipCalculation.CCTips) ? adjtimeRow.cctips : adjtimeRow.dectips
     });
 }
        public List <Employee> ConvertPayroll(AlohaDataset alohaData, TipCalculation tipStrategy)
        {
            var employees     = _payrollConverterUtils.GetEmployees(alohaData);
            var ignoreJobList = new List <int> {
                11, 33, 90, 91
            };
            var shifts = _payrollConverterUtils.GetShifts(alohaData, ignoreJobList);
            var tips   = _payrollConverterUtils.GetTips(alohaData, ignoreJobList, tipStrategy);
            var breaks = _payrollConverterUtils.GetBreaks(alohaData, ignoreJobList);

            _employeeRepositoryService.LoadEmployees(employees);
            _employeeRepositoryService.LoadTransactions(shifts);
            _employeeRepositoryService.LoadTransactions(tips);
            _employeeRepositoryService.LoadTransactions(breaks);

            _employeeRepositoryService.AdjustPaycodesForMultipleShifts();

            return(_employeeRepositoryService.Employees.Values.ToList <Employee>());
        }
Ejemplo n.º 5
0
        public List <Transaction> GetTips(AlohaDataset data, List <int> ignoreJobCodeList, TipCalculation tipCalculationStrategy)
        {
            _logger.Debug("GetTips called");
            var transactions = new List <Transaction>();

            foreach (var adjtimeRow in data.adjtime.Where(t => t.cctips > 0m || t.dectips > 0m))
            {
                if (ignoreJobCodeList.Contains(adjtimeRow.jobcode))
                {
                    continue;
                }
                transactions.Add(ConvertTipRow(adjtimeRow, tipCalculationStrategy));
            }

            return(transactions);
        }
Ejemplo n.º 6
0
        // GET: Home
        public ActionResult Index()
        {
            TipCalculation model = new TipCalculation();

            return(View(model));
        }