NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

using Microsoft.AspNetCore.Mvc.Rendering;
using SMXServicesConsulting.DataModel.EntityData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SMXServicesConsulting.DataModel.Models
{
public class InvoiceModelForSalariedEmployee
{
public InvoiceModelForSalariedEmployee()
{
ExpenseModelListForSalariedEmployee = new List<ExpenseListModel>();
}
public string? Form { get; set; }
public string? Status { get; set; }
public string? Customer { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? ITEM { get; set; }
public string? QuantityTotalHours { get; set; }
public string? PriceBillRate { get; set; }
public string? Amount { get; set; }
public string? LineTaxCodeName { get; set; }
public string? Tax { get; set; }
public string? PONumber { get; set; }
public string? ClientContact { get; set; }
public string? InvoiceNumber { get; set; }
public string? InvoiceDate { get; set; }
public string? ServiceDate { get; set; }
public string? LineDescription { get; set; }
public string? ARAccount { get; set; }
public string? Terms { get; set; }
public string? ClassName { get; set; }
public string? AcceptanceCode { get; set; }
public string? EmailCC { get; set; }
public string? CostTotal { get; set; }
public string? Margen { get; set; }
public string? Coeff5Percent { get; set; }
public string? Eber { get; set; }
public string? Mirlan { get; set; }
public string? Anna { get; set; }
public string? Vicky { get; set; }
public string? LuisZambrano { get; set; }
public string? Amneris { get; set; }
public string? Valeria { get; set; }
public string? Paula { get; set; }
public string? Email { get; set; }
public string? EmployeeId { get; set; }
public string? StartId { get; set; }
public string? RecId { get; set; }
public int? InvoiceSalaryHelperTableId { get; set; }
public string? ExtraExpenses { get; set; }
public List<ExpenseListModel>? ExpenseModelListForSalariedEmployee { get; set; }
}

public class ExpenseListModel
{
public string? ExpenseCode { get; set; }
public string? ExpenseAmount { get; set; }
}


public class SalariedInvoiceCompanyGroupModel
{
public List<InvoiceModelForSalariedEmployee>? SalariedInvoiceModel { get; set; }
public string? Customer { get; set; }
public int CustomerCount => SalariedInvoiceModel?.Count ?? 0;
public int ClassNameCount => SalariedInvoiceModel?.Count ?? 0;
public decimal TotalQuantityHours { get; set; }
public decimal TotalPriceBillRate { get; set; }
public decimal TotalAmount { get; set; }
public decimal TotalTax { set; get; }
}

public class SalariedInvoiceCompanyGroupModelMasterModel
{
public SalariedInvoiceCompanyGroupModelMasterModel()
{
SalariedInvoiceCompanyGroupModelList = new List<SalariedInvoiceCompanyGroupModel>();
}
public List<SalariedInvoiceCompanyGroupModel>? SalariedInvoiceCompanyGroupModelList { get; set; }

public SelectList? CompanyList { get; set; }
public string? StartDate { get; set; }
public string? EndDate { get; set; }
public int? InvoiceNumber { get; set; }
}
}


public async Task<List<SalariedInvoiceCompanyGroupModel>> GetSalariedEmployeeListForInvoices(string startDate, string endDate, string companyId, int invoiceNumber)
{
try
{
List<SalariedInvoiceCompanyGroupModel> salariedInvoiceCompanyGroupModels = new();
List<InvoiceModelForSalariedEmployee> invoiceModelListForSalariedEmployee = 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 empForms = await helperRepository.GetDivisionCodesAsync();
var invoiceSalaryHelper = await helperRepository.GetInvoiceSalaryHelperAsync();
var getExternalConsultingSalaryList = await helperRepository.GetCandidatesRecordModelForInvoices(startDate, endDate);
var getHRDetailsAsync = await helperRepository.GetHRDetailsAsync();
var getBillingContacts = await helperRepository.GetBillingContactsAsync();

if (parsedStartDate != DateTime.MinValue && parsedEndDate != DateTime.MinValue)
{
foreach (var item in getExternalConsultingSalaryList.DistinctBy(x => new { x.CandidateId, x.BillingStartId, x.BillingRecId }))
{
List<ExpenseListModel> expenseListModeltForSalariedEmployee = new();

if (string.IsNullOrEmpty(item.SalaryEndDate) || (DateTime.TryParseExact(item.SalaryEndDate, AppConstants.SalaryEndDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime salaryEndDate) && salaryEndDate >= parsedStartDate))
{
if (item.EffectiveDate <= parsedEndDate)
{
if (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 == AppConstants.ECSalaryDivisionCode || item.Division == AppConstants.W2SalaryDivisionCode || item.Division == AppConstants.USA1099DivisionCode)
{
if (companyId != AppConstants.Zeros)
{
if (item.CompanyId == companyId)
{
if (item.Division == AppConstants.USA1099DivisionCode)
{
if (item.SalaryPer != AppConstants.Hourly)
{
InvoiceModelForSalariedEmployee invoiceModelForSalariedEmployee = CreateInvoiceForSalariedEmployee(item, startDate, endDate, parsedStartDate, parsedEndDate, empForms, invoiceSalaryHelper, getHRDetailsAsync, invoiceNumber, getBillingContacts);
invoiceModelForSalariedEmployee.ExpenseModelListForSalariedEmployee = await GetInvoiceEmployeeExpensesList(item.CandidateId, item.BillingStartId);
invoiceModelListForSalariedEmployee.Add(invoiceModelForSalariedEmployee);



}
}
else
{
InvoiceModelForSalariedEmployee invoiceModelForSalariedEmployee = CreateInvoiceForSalariedEmployee(item, startDate, endDate, parsedStartDate, parsedEndDate, empForms, invoiceSalaryHelper, getHRDetailsAsync, invoiceNumber, getBillingContacts);
invoiceModelForSalariedEmployee.ExpenseModelListForSalariedEmployee = await GetInvoiceEmployeeExpensesList(item.CandidateId, item.BillingStartId);
invoiceModelListForSalariedEmployee.Add(invoiceModelForSalariedEmployee);
}
}
}
else
{
if (item.Division == AppConstants.USA1099DivisionCode)
{
if (item.SalaryPer != AppConstants.Hourly)
{
InvoiceModelForSalariedEmployee invoiceModelForSalariedEmployee = CreateInvoiceForSalariedEmployee(item, startDate, endDate, parsedStartDate, parsedEndDate, empForms, invoiceSalaryHelper, getHRDetailsAsync, invoiceNumber, getBillingContacts);
invoiceModelForSalariedEmployee.ExpenseModelListForSalariedEmployee = await GetInvoiceEmployeeExpensesList(item.CandidateId, item.BillingStartId);
invoiceModelListForSalariedEmployee.Add(invoiceModelForSalariedEmployee);
}
}
else
{
InvoiceModelForSalariedEmployee invoiceModelForSalariedEmployee = CreateInvoiceForSalariedEmployee(item, startDate, endDate, parsedStartDate, parsedEndDate, empForms, invoiceSalaryHelper, getHRDetailsAsync, invoiceNumber, getBillingContacts);
invoiceModelForSalariedEmployee.ExpenseModelListForSalariedEmployee = await GetInvoiceEmployeeExpensesList(item.CandidateId, item.BillingStartId);
invoiceModelListForSalariedEmployee.Add(invoiceModelForSalariedEmployee);
}
}
}
}
}
}
}
}
}
var groupedSalariedInvoice = invoiceModelListForSalariedEmployee.GroupBy(x => x.Customer).ToList();

foreach (var item in groupedSalariedInvoice)
{
var groupModel = new SalariedInvoiceCompanyGroupModel
{
Customer = item.Key,
SalariedInvoiceModel = item.ToList(),
TotalQuantityHours = item.Sum(x => Convert.ToDecimal(x.QuantityTotalHours?.Replace("$", string.Empty))),
TotalPriceBillRate = item.Sum(x => Convert.ToDecimal(x.PriceBillRate?.Replace("$", string.Empty))),
TotalAmount = item.Sum(x => Convert.ToDecimal(x.Amount?.Replace("$", string.Empty)) + Convert.ToDecimal(x.ExpenseModelListForSalariedEmployee?.Where(x => x.ExpenseAmount == x.ExpenseAmount?.Replace("$", string.Empty)))),
TotalTax = item.Sum(x => Convert.ToDecimal(x.Tax?.Replace("$", string.Empty))),
};
salariedInvoiceCompanyGroupModels.Add(groupModel);
}
return salariedInvoiceCompanyGroupModels;

}
catch (Exception exception)
{
Log.Error($"Error in GetSalariedEmployeeListForInvoice: {exception.Message}");
throw;
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for 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 12 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

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.