Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
{
ProjectionsExcelMasterModels projectionsExcelMasterModels = new();
try
{
List<ProjectionsFooterModel> projectionsFooterModelList = new();
CostosMasterModel costosMasterModel = new();
List<CostosExcelModel> costosExcelModelList = 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 costosEmployeeDetails = await helperRepository.GetCandidatesRecordModelForCosts(startDate, endDate);
var companyCodesAsync = await helperRepository.GetCompanyCodesAsync();
var projectionIncomeExpensesHelperAsync = await GetProjectionIncomeExpensesHelperAsync(parsedStartDate, parsedEndDate);
var empForms = await helperRepository.GetDivisionCodesAsync();
if (parsedStartDate != DateTime.MinValue && parsedEndDate != DateTime.MinValue)
{
foreach (var item in costosEmployeeDetails.DistinctBy(x => new { x.CandidateId, x.SalaryStartId, x.SalaryRecId, x.EmpSalary }))
{
if (string.IsNullOrEmpty(item.SalaryEndDate) || (DateTime.TryParseExact(item.SalaryEndDate, AppConstants.SalaryEndDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime salaryEndDate) && salaryEndDate >= parsedStartDate))
{
if (item.EffectiveDate <= parsedEndDate && item.SalaryApproved == AppConstants.One)
{
if (item.CompanyId != InvoiceConstants.SMX && item.CompanyId != InvoiceConstants.SMXServicesConsultingInc && item.CompanyId != InvoiceConstants.SMXUSA && item.CompanyId != InvoiceConstants.SMXUSAFL && item.CompanyId != InvoiceConstants.InfolasticSMXSalesforce)
{
if (item.Division != "485791" && item.Division != "469942" && item.Division != "468692" && item.Division != "492341" && item.Division != "509597")
{
// Special logic for "EVERTEC Group, LLC"
if (item.Company == "EVERTEC Group, LLC")
{
// Split into two groups: ECSalaryDivisionCode and non-ECSalaryDivisionCode
var ecsSalaryDivisionConsultants = costosEmployeeDetails.Where(x => x.Company == "EVERTEC Group, LLC" && x.Status == AppConstants.ECSalaryDivisionCode).ToList();
var nonEcsSalaryDivisionConsultants = costosEmployeeDetails.Where(x => x.Company == "EVERTEC Group, LLC" && x.Status != AppConstants.ECSalaryDivisionCode).ToList();
// First record for ECSalaryDivisionCode consultants
if (ecsSalaryDivisionConsultants.Any())
{
var costosExcelModelECSalary = CreateProjectionExcelModel(item, parsedStartDate, parsedEndDate, empForms, companyCodesAsync, ecsSalaryDivisionConsultants);
costosExcelModelList.Add(costosExcelModelECSalary);
}
// Second record for non-ECSalaryDivisionCode consultants
if (nonEcsSalaryDivisionConsultants.Any())
{
var costosExcelModelNonECSalary = CreateProjectionExcelModel(item, parsedStartDate, parsedEndDate, empForms, companyCodesAsync, nonEcsSalaryDivisionConsultants);
costosExcelModelList.Add(costosExcelModelNonECSalary);
}
}
else
{
// For other companies, only one record
CostosExcelModel costosExcelModel = CreateProjectionExcelModel(item, parsedStartDate, parsedEndDate, empForms, companyCodesAsync);
costosExcelModelList.Add(costosExcelModel);
}
}
}
}
}
}
// Add the resulting CostosExcelModel list to the CostosMasterModel
costosMasterModel.CostosModelList = costosExcelModelList;
// Here you can add further logic to process the projection footer or totals if needed
projectionsExcelMasterModels.ProjectionsFooterModelList = projectionsFooterModelList;
}
}
catch (Exception ex)
{
Log.Error($"Error in GetProjectionDetailsList: {ex.Message}");
throw;
}
return projectionsExcelMasterModels;
}
public CostosExcelModel CreateProjectionExcelModel(CandidateModel item, DateTime parsedStartDate, DateTime parsedEndDate, List<EmpForm> empForms, List<CompanyCode> companyCodesAsync, List<CandidateModel> consultants = null)
{
var consultantList = consultants ?? new List<CandidateModel> { item };
// Process the logic here for generating the CostosExcelModel
CostosExcelModel costosExcelModel = new CostosExcelModel
{
CompanyId = item.CompanyId,
CandidateId = item.CandidateId,
StartDate = parsedStartDate,
EndDate = parsedEndDate,
// Add other necessary fields based on business logic
};
// If you need to process the consultant list:
foreach (var consultant in consultantList)
{
// Handle specific business logic for each consultant here
}
return costosExcelModel;
}
![]() |
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