public static WageSubmissionViewModel ValidateManualEntrySubmission(WageSubmissionViewModel wageDetail) { wageDetail.ListWageEmployerUnitSummary = new List <WageSubmissionViewModel.WageDetailSummaryViewModel>(); wageDetail.FilingMethod = LookupTable_WageDetailFilingMethod.ManualEntry; wageDetail.ListWageUnitDetailDto.Where(x => x.Ssn != null).ToList().ForEach(assign => assign.FilingMethod = wageDetail.FilingMethod); wageDetail.ListWageUnitDetailDto.Where(x => x.Ssn != null).ToList().ForEach(assign => assign.AdjReasonCode = wageDetail.AdjReasonCode); wageDetail.ListWageUnitDetailDto.Where(x => x.Ssn != null).ToList().ForEach(assign => assign.ReportingQuarter = wageDetail.ReportingQuarter); wageDetail.ListWageUnitDetailDto.Where(x => x.Ssn != null).ToList().ForEach(assign => assign.ReportingYear = wageDetail.ReportingYear); wageDetail.ListWageUnitDetailDto.Where(x => x.Ssn != null && x.EmployerUnitId == 0).ToList().ForEach(assign => assign.EmployerUnitId = Constants.DefaultUnitId); foreach (var unit in wageDetail.ListWageUnitDetailDto.Select(x => x.EmployerUnitId).Distinct()) { if (unit > 0) { Decimal grossWage = wageDetail.ListWageUnitDetailDto.Where(x => x.EmployerUnitId == unit).Select(x => x.WageAmount).Sum(); int month1 = wageDetail.ListWageUnitDetailDto.Where(x => x.IsEmploymentMonth1 == true && x.EmployerUnitId == unit).Count(); int month2 = wageDetail.ListWageUnitDetailDto.Where(x => x.IsEmploymentMonth2 == true && x.EmployerUnitId == unit).Count(); int month3 = wageDetail.ListWageUnitDetailDto.Where(x => x.IsEmploymentMonth3 == true && x.EmployerUnitId == unit).Count(); int NumberofRecords = wageDetail.ListWageUnitDetailDto.Where(x => x.Ssn != null && x.EmployerUnitId == unit).Count(); wageDetail.ListWageEmployerUnitSummary.Add(new WageSubmissionViewModel.WageDetailSummaryViewModel { EmployerUnitNo = unit, EntityName = wageDetail.Employer.EntityName, NumberofRecords = NumberofRecords, GrossWage = grossWage, QtrMonth1RecordsCount = month1, QtrMonth2RecordsCount = month2, QtrMonth3RecordsCount = month3 }); } } wageDetail.GrossWages = wageDetail.ListWageEmployerUnitSummary.Select(x => x.GrossWage).Sum(); wageDetail.NumberofRecords = wageDetail.ListWageUnitDetailDto.Where(x => x.Ssn != null).Count(); wageDetail.EmployerAccountTransactionDto.OwedAmount = Decimal.Multiply(wageDetail.GrossWages, Decimal.Multiply(wageDetail.ContributionRate, (decimal)0.01)); wageDetail.EmployerAccountTransactionDto.UnpaidAmount = wageDetail.EmployerAccountTransactionDto.OwedAmount; return(wageDetail); }
public static WageSubmissionViewModel ValidateManualEntrySubmission(WageSubmissionViewModel wageDetail) { int NumberofRecords = 0; //To do in Linq Query foreach (var wageRow in wageDetail.ListWageUnitDetailDto) { string Ssn = wageRow.Ssn; if (!string.IsNullOrWhiteSpace(Ssn)) { NumberofRecords++; } } wageDetail.ListWageEmployerUnitSummary = new List <WageSubmissionViewModel.WageDetailSummary>(); Decimal grossWage = wageDetail.ListWageUnitDetailDto.Select(x => x.WageAmount).Sum(); int month1 = wageDetail.ListWageUnitDetailDto.Where(x => x.IsEmploymentMonth1 == true).Count(); int month2 = wageDetail.ListWageUnitDetailDto.Where(x => x.IsEmploymentMonth2 == true).Count(); int month3 = wageDetail.ListWageUnitDetailDto.Where(x => x.IsEmploymentMonth3 == true).Count(); wageDetail.ListWageEmployerUnitSummary.Add(new WageSubmissionViewModel.WageDetailSummary { EmployerUnitNo = 1, EntityName = wageDetail.Employer.EntityName, NumberofRecords = NumberofRecords, GrossWage = grossWage, QtrMonth1RecordsCount = month1, QtrMonth2RecordsCount = month2, QtrMonth3RecordsCount = month3 }); wageDetail.GrossWages = wageDetail.ListWageEmployerUnitSummary.Select(x => x.GrossWage).Sum(); wageDetail.NumberofRecords = NumberofRecords; wageDetail.EmployerAccountTransactionDto.OwedAmount = Decimal.Multiply(wageDetail.GrossWages, (decimal)0.0040); wageDetail.EmployerAccountTransactionDto.UnpaidAmount = wageDetail.EmployerAccountTransactionDto.OwedAmount; return(wageDetail); }
public static WageSubmissionViewModel GetWagePeriod() { WageSubmissionViewModel wage = new WageSubmissionViewModel(); wage.ReportingYear = (short)DateTimeUtil.Now.Year; wage.ContributionRate = GetCurrentContributionRate(); using (DbContext context = new DbContext()) { //To do Map the Employerid from context. //wage.Employer = context.Employers.FirstOrDefault(emp => emp.EmployerId == 19).ToDto(); wage.Employer = context.Employers.FirstOrDefault().ToDto(); } for (int i = 1; i <= 25; i++) { WageSubmissionViewModel.WageUnitCustomDto wageUnitDetailDto = new WageSubmissionViewModel.WageUnitCustomDto(); wageUnitDetailDto.SrNo = i; wageUnitDetailDto.EmployerId = wage.Employer.EmployerId; wageUnitDetailDto.Employer = wage.Employer; wage.ListWageUnitDetailDto.Add(wageUnitDetailDto); } return(wage); }
public static WageSubmissionViewModel ValidateSelectionMethod(WageSubmissionViewModel wageDetail) { FACTS.Framework.Lookup.LookupValue item = LookupUtil.GetLookupValue(LookupTable.WageDetailAdjReasonCode, LookupTable_WageDetailAdjReasonCode.Original, "Display"); wageDetail.AdjReasonDisplay = item.Value; wageDetail.AdjReasonCode = LookupTable_WageDetailAdjReasonCode.Original; return(wageDetail); }
public static WageSubmissionViewModel GetWagePeriod() { WageSubmissionViewModel wage = new WageSubmissionViewModel(); wage.Employer.EmployerId = 1; //To do wage.Employer.EntityName = "MARCON EXCAVATING INC"; //To do for (int i = 1; i <= 25; i++) { WageUnitDetailDto wageUnitDetailDto = new WageUnitDetailDto(); wageUnitDetailDto.EmployerId = wage.Employer.EmployerId; wage.ListWageUnitDetailDto.Add(wageUnitDetailDto); } return(wage); }
public static WageSubmissionViewModel ValidateSelectionMethod(WageSubmissionViewModel wageDetail) { using (DbContext context = new DbContext()) { if (context.TaxableAmountSums.Any(x => x.ReportingQuarter == wageDetail.ReportingQuarter && x.ReportingYear == wageDetail.ReportingYear && x.EmployerId == wageDetail.Employer.EmployerId)) { Context.ValidationMessages.AddError("Original Employment and Wage Detail Report for this year " + wageDetail.ReportingYear + " and quarter " + LookupUtil.GetLookupCode(LookupTable.Quarter, wageDetail.ReportingQuarter).Display + " has already been submitted"); } } wageDetail.AdjReasonDisplay = LookupUtil.GetLookupCode(LookupTable.WageDetailAdjReasonCode, LookupTable_WageDetailAdjReasonCode.Original).Display.ToString(); wageDetail.AdjReasonCode = LookupTable_WageDetailAdjReasonCode.Original; return(wageDetail); }
public static WageSubmissionViewModel Add(WageSubmissionViewModel wageDetail) { int rowCount = wageDetail.ListWageUnitDetailDto.Count; for (int i = rowCount + 1; i <= rowCount + 25; i++) { WageSubmissionViewModel.WageUnitCustomDto wageUnitDetailDto = new WageSubmissionViewModel.WageUnitCustomDto(); wageUnitDetailDto.SrNo = i; wageUnitDetailDto.EmployerId = wageDetail.Employer.EmployerId; wageUnitDetailDto.Employer = wageDetail.Employer; wageDetail.ListWageUnitDetailDto.Add(wageUnitDetailDto); } return(wageDetail); }
/// <summary> /// Validates Add' functionality step /// </summary> public void ManualEntryAdd() { WageSubmissionViewModel wageSubmissionViewModel = new WageSubmissionViewModel(); wageSubmissionViewModel.ListWageUnitDetailDto = (List <WageSubmissionViewModel.WageUnitCustomDto>)Machine["WageUnitDetail.ListWageUnitDetailDto"]; foreach (var wageUnitDetail in wageSubmissionViewModel.ListWageUnitDetailDto) { if ((String.IsNullOrWhiteSpace(wageUnitDetail.Ssn) && String.IsNullOrWhiteSpace(wageUnitDetail.LastName) && String.IsNullOrWhiteSpace(wageUnitDetail.FirstName) && !(wageUnitDetail.IsEmploymentMonth1 ?? false) && !(wageUnitDetail.IsEmploymentMonth2 ?? false) && !(wageUnitDetail.IsEmploymentMonth3 ?? false) && !wageUnitDetail.HoursWorked.HasValue && String.IsNullOrWhiteSpace(wageUnitDetail.MiddleInitialName) && String.IsNullOrWhiteSpace(wageUnitDetail.Occupation) && !wageUnitDetail.IsOwnerOrOfficer.HasValue && wageUnitDetail.WageAmount == 0)) { Context.ValidationMessages.AddError(String.Format("You must complete page in full, before selecting 'Add'. If you have finished adding employees select 'Save' or 'Next'.", wageUnitDetail.SrNo)); return; } } }
public static WageSubmissionViewModel ValidateTax(WageSubmissionViewModel wageDetail) { return(wageDetail); }
public static WageSubmissionViewModel GetEmpWageDetails() { WageSubmissionViewModel wage = new WageSubmissionViewModel(); return(wage); }
public void ManualEntryNext() { WageSubmissionViewModel wageSubmissionViewModel = new WageSubmissionViewModel(); wageSubmissionViewModel.ListWageUnitDetailDto = (List <WageSubmissionViewModel.WageUnitCustomDto>)Machine["WageUnitDetail.ListWageUnitDetailDto"]; if (wageSubmissionViewModel.ListWageUnitDetailDto.Where(x => x.Ssn != null).Count() == 0) { Context.ValidationMessages.AddError("Please enter atleast one record."); } foreach (var wageUnitDetail in wageSubmissionViewModel.ListWageUnitDetailDto) { if (wageSubmissionViewModel.ListWageUnitDetailDto.Where((x => (x.Ssn != null) && (x.Ssn == wageUnitDetail.Ssn) && (x.EmployerUnitId == wageUnitDetail.EmployerUnitId) && x.SrNo != wageUnitDetail.SrNo)).Count() > 0) { Context.ValidationMessages.AddError(String.Format("Duplicate Social Security Number {0} within Unit {1} on line {2}.", wageUnitDetail.Ssn, wageUnitDetail.EmployerUnitId, wageUnitDetail.SrNo)); } if ((String.IsNullOrWhiteSpace(wageUnitDetail.Ssn)) && (!String.IsNullOrWhiteSpace(wageUnitDetail.LastName) || !String.IsNullOrWhiteSpace(wageUnitDetail.FirstName) || wageUnitDetail.IsEmploymentMonth1 == true || wageUnitDetail.IsEmploymentMonth2 == true || wageUnitDetail.IsEmploymentMonth3 == true || wageUnitDetail.HoursWorked.HasValue || !String.IsNullOrWhiteSpace(wageUnitDetail.MiddleInitialName) || !String.IsNullOrWhiteSpace(wageUnitDetail.Occupation) || wageUnitDetail.IsOwnerOrOfficer.HasValue || wageUnitDetail.WageAmount > 0)) { Context.ValidationMessages.AddError(String.Format("Missing SSN on line {0}.", wageUnitDetail.SrNo)); } if ((String.IsNullOrWhiteSpace(wageUnitDetail.LastName)) && (!String.IsNullOrWhiteSpace(wageUnitDetail.Ssn) || !String.IsNullOrWhiteSpace(wageUnitDetail.FirstName) || wageUnitDetail.IsEmploymentMonth1 == true || wageUnitDetail.IsEmploymentMonth2 == true || wageUnitDetail.IsEmploymentMonth3 == true || wageUnitDetail.HoursWorked.HasValue || !String.IsNullOrWhiteSpace(wageUnitDetail.MiddleInitialName) || !String.IsNullOrWhiteSpace(wageUnitDetail.Occupation) || wageUnitDetail.IsOwnerOrOfficer.HasValue || wageUnitDetail.WageAmount > 0)) { Context.ValidationMessages.AddWarning(String.Format("Missing last name on line {0}.", wageUnitDetail.SrNo)); } if ((String.IsNullOrWhiteSpace(wageUnitDetail.FirstName)) && (!String.IsNullOrWhiteSpace(wageUnitDetail.Ssn) || !String.IsNullOrWhiteSpace(wageUnitDetail.LastName) || wageUnitDetail.IsEmploymentMonth1 == true || wageUnitDetail.IsEmploymentMonth2 == true || wageUnitDetail.IsEmploymentMonth3 == true || wageUnitDetail.HoursWorked.HasValue || !String.IsNullOrWhiteSpace(wageUnitDetail.MiddleInitialName) || !String.IsNullOrWhiteSpace(wageUnitDetail.Occupation) || wageUnitDetail.IsOwnerOrOfficer.HasValue || wageUnitDetail.WageAmount > 0)) { Context.ValidationMessages.AddWarning(String.Format("Missing first name on line {0}.", wageUnitDetail.SrNo)); } if ((wageUnitDetail.WageAmount == 0) && (!String.IsNullOrWhiteSpace(wageUnitDetail.Ssn) || !String.IsNullOrWhiteSpace(wageUnitDetail.LastName) || wageUnitDetail.IsEmploymentMonth1 == true || wageUnitDetail.IsEmploymentMonth2 == true || wageUnitDetail.IsEmploymentMonth3 == true || wageUnitDetail.HoursWorked.HasValue || !String.IsNullOrWhiteSpace(wageUnitDetail.MiddleInitialName) || !String.IsNullOrWhiteSpace(wageUnitDetail.Occupation) || wageUnitDetail.IsOwnerOrOfficer.HasValue || !String.IsNullOrWhiteSpace(wageUnitDetail.FirstName))) { Context.ValidationMessages.AddError(String.Format("Missing Gross Wages on line {0}.", wageUnitDetail.SrNo)); } if ((!(wageUnitDetail.IsEmploymentMonth1 ?? false) && !(wageUnitDetail.IsEmploymentMonth2 ?? false) && !(wageUnitDetail.IsEmploymentMonth3 ?? false)) && (!String.IsNullOrWhiteSpace(wageUnitDetail.LastName) || !String.IsNullOrWhiteSpace(wageUnitDetail.FirstName) || wageUnitDetail.HoursWorked.HasValue || !String.IsNullOrWhiteSpace(wageUnitDetail.MiddleInitialName) || !String.IsNullOrWhiteSpace(wageUnitDetail.Ssn) || !String.IsNullOrWhiteSpace(wageUnitDetail.Occupation) || wageUnitDetail.IsOwnerOrOfficer.HasValue || wageUnitDetail.WageAmount > 0)) { Context.ValidationMessages.AddError(String.Format("Select atleast one Employment Month on line {0}.", wageUnitDetail.SrNo)); } if (wageUnitDetail.WageAmount > Convert.ToDecimal(999999999.99)) { Context.ValidationMessages.AddError(String.Format("Gross Wages cannot exceed 999999999.99 on line {0}.", wageUnitDetail.SrNo)); } } if (Context.ValidationMessages.Count(ValidationMessageSeverity.Error) > 0) { return; } Machine["CurrentSection"] = LookupUtil.GetLookupCode(LookupTable.WizEmployerWageFiling, LookupTable_WizEmployerWageFiling.ConfirmSubmission); }
public static WageSubmissionViewModel ValidateTax(WageSubmissionViewModel wageDetail) { wageDetail.EmployerAccountTransactionDto.EmployerId = wageDetail.Employer.EmployerId; wageDetail.EmployerAccountTransactionDto.ReportingQuarter = wageDetail.ReportingQuarter; wageDetail.EmployerAccountTransactionDto.ReportingYear = wageDetail.ReportingYear; wageDetail.EmployerAccountTransactionDto.TypeCode = LookupTable_TransactionType.ContributionsPrinciple; wageDetail.EmployerAccountTransactionDto.StatusCode = LookupTable_PaymentStatus.PaymentStatusUnpaid; wageDetail.EmployerAccountTransactionDto.DueDate = DateTimeUtil.Now.AddDays(Convert.ToDouble(LookupTable_PremiumPaymentDueDays.PremiumPaymentDueDays)); wageDetail.TaxableAmountSumDto.EmployerId = wageDetail.Employer.EmployerId; wageDetail.TaxableAmountSumDto.ReportingQuarter = wageDetail.ReportingQuarter; wageDetail.TaxableAmountSumDto.ReportingYear = wageDetail.ReportingYear; wageDetail.TaxableAmountSumDto.StatusCode = LookupTable_TaxableAmSumStatus.Submitted; wageDetail.TaxableAmountSumDto.TaxableAmountSeqNo = GetMaxTaxableAmountSumSeqNu(wageDetail.Employer.EmployerId, wageDetail.ReportingYear); int quaterNumber = Convert.ToInt16(wageDetail.ReportingQuarter.ToString().Remove(0, 1)); if (quaterNumber == 1) { wageDetail.TaxableAmountSumDto.Quarter1TaxableAmt = wageDetail.GrossWages; wageDetail.TaxableAmountSumDto.Quarter1GrossAmt = wageDetail.GrossWages; } if (quaterNumber == 2) { wageDetail.TaxableAmountSumDto.Quarter2TaxableAmt = wageDetail.GrossWages; wageDetail.TaxableAmountSumDto.Quarter2GrossAmt = wageDetail.GrossWages; } if (quaterNumber == 3) { wageDetail.TaxableAmountSumDto.Quarter3TaxableAmt = wageDetail.GrossWages; wageDetail.TaxableAmountSumDto.Quarter3GrossAmt = wageDetail.GrossWages; } if (quaterNumber == 4) { wageDetail.TaxableAmountSumDto.Quarter4TaxableAmt = wageDetail.GrossWages; wageDetail.TaxableAmountSumDto.Quarter4GrossAmt = wageDetail.GrossWages; } using (DbContext context = new DbContext()) { using (var dbContextTransaction = context.Database.BeginTransaction()) { try { foreach (var wageUnitDetails in wageDetail.ListWageUnitDetailDto.Where(x => x.Ssn != null)) { wageUnitDetails.Employer = null; WageUnitDetail.FromDto(context, wageUnitDetails); context.SaveChanges(); } EmployerAccountTransaction.FromDto(context, wageDetail.EmployerAccountTransactionDto); context.SaveChanges(); TaxableAmountSum.FromDto(context, wageDetail.TaxableAmountSumDto); context.SaveChanges(); dbContextTransaction.Commit(); } catch (Exception) { dbContextTransaction.Rollback(); } } } return(wageDetail); }