Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
{
try
{
PR480PayrollHrsExcelMasterModelForADP pr480PayrollHrsExcelMasterModelForADP = new();
List<PR480PayrollHrsExcelModelForADP> pr480PayrollHrsExcelModelListForADP = new();
DateTime.TryParseExact(startDate, AppConstants.DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime parsedStartDate);
DateTime.TryParseExact(endDate, AppConstants.DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime parsedEndDate);
var currentDate = DateTime.Now;
var employeeTimesheets = await helperRepository.GetApprovedEmployeeTimesheetsAsync(parsedStartDate, parsedEndDate);
var pr480EmployeeList = await helperRepository.GetCandidatesRecordModel();
Dictionary<string, CandidatesRecordModel> lastOccurrences = new Dictionary<string, CandidatesRecordModel>();
foreach (var item in pr480EmployeeList.DistinctBy(x => new { x.CandidateId, x.BillingStartId, x.BillingRecId }))
{
if (string.IsNullOrEmpty(item.SalaryEndDate) || item.SalaryEndDate.CompareTo(currentDate.ToString("MM-dd-yyyy")) >= 0)
{
if (item.SalaryApproved == AppConstants.One)
{
if (item.Division == AppConstants.PR480DivisionCode)
{
if (lastOccurrences.ContainsKey(item.CandidateId))
{
var lastOccurrence = lastOccurrences[item.CandidateId];
if (item.SalaryPer != null && item.EmpSalary != null)
{
decimal payRate = Convert.ToDecimal(objectCalculation.GetPayRate(item.SalaryPer, item.EmpSalary));
if (payRate != 0 && payRate != 1)
{
lastOccurrence.TemporaryRate = $"${payRate.ToString(AppConstants.DefaultTwoDigits)}";
}
}
}
lastOccurrences[item.CandidateId] = item;
PR480PayrollHrsExcelModelForADP pr480PayrollHrsExcelModelForADP = Create480PRPayrollDetailsForADPExcelModel(item, parsedStartDate, parsedEndDate, employeeTimesheets);
pr480PayrollHrsExcelModelListForADP.Add(pr480PayrollHrsExcelModelForADP);
}
}
}
}
pr480PayrollHrsExcelMasterModelForADP.PR480PayrollHrsExcelModelListForADP = pr480PayrollHrsExcelModelListForADP;
return pr480PayrollHrsExcelMasterModelForADP;
}
catch (Exception exception)
{
Log.Error($"Error in Get480PRPayrollDetailsList: {exception.Message}");
throw;
}
}
/// <summary>
/// Create 480-PR Payroll Details For ADP Excel Model
/// </summary>
/// <param name="item"></param>
/// <param name="parsedStartDate"></param>
/// <param name="parsedEndDate"></param>
/// <param name="employeeTimesheets"></param>
/// <returns></returns>
private PR480PayrollHrsExcelModelForADP Create480PRPayrollDetailsForADPExcelModel(CandidatesRecordModel item,
DateTime parsedStartDate, DateTime parsedEndDate, List<EmployeeTimesheet> employeeTimesheets)
{
try
{
PR480PayrollHrsExcelModelForADP pr480PayrollHrsExcelModelForADP = new();
pr480PayrollHrsExcelModelForADP.CoCode = "Y1C";
pr480PayrollHrsExcelModelForADP.BatchId = "Batch001";
pr480PayrollHrsExcelModelForADP.FileNumber = item.ADPFileNo.TrimStart('0');
pr480PayrollHrsExcelModelForADP.BatchDescription = "91522";
pr480PayrollHrsExcelModelForADP.Name = $"{item.FirstName} {item.LastName}";
if (!string.IsNullOrEmpty(item.TemporaryRate))
{
pr480PayrollHrsExcelModelForADP.TemporaryRate = item.TemporaryRate;
}
else
{
pr480PayrollHrsExcelModelForADP.TemporaryRate = "";
}
pr480PayrollHrsExcelModelForADP.AdjustDeductionMI = "";
pr480PayrollHrsExcelModelForADP.BonusEarningsB = "";
pr480PayrollHrsExcelModelForADP.AdjustDeductionL = "";
pr480PayrollHrsExcelModelForADP.FirstName = item.FirstName;
if (parsedStartDate != DateTime.MinValue && parsedEndDate != DateTime.MinValue)
{
var employeeTimesheet = employeeTimesheets.Where(x => x.StartId == item.BillingStartId).ToList();
decimal totalRegHours = employeeTimesheet.Where(x => x.TDATE >= parsedStartDate && x.TDATE <= parsedEndDate).Sum(x => Convert.ToDecimal(x.RegHours));
if (employeeTimesheet.Any() == true && totalRegHours != 0)
{
pr480PayrollHrsExcelModelForADP.RegularHours = Convert.ToString(totalRegHours.ToString(AppConstants.DefaultOneDigits));
}
}
return pr480PayrollHrsExcelModelForADP;
}
catch (Exception exception)
{
Log.Error($"Error in Create480PRPayrollExcelModel: {exception.Message}");
throw;
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team