private void OnRowEditEnded() { EmployeePaymentDetail detail = ListOfPaymentDetails.CurrentItem as EmployeePaymentDetail; if (detail == null) { return; } EmployeePayment payment = ListOfCurrentPayments.CurrentItem as EmployeePayment; // if Bonuspayment: set LastPayment = FirstPayment if (detail.PaymentType == PaymentType.Bonus) { detail.LastPayment = detail.FirstPayment; } if (detail.Id == 0) { detail = dbAccess.InsertEmployeePaymentDetail(detail); } else { dbAccess.UpdateEmployeePaymentDetail(detail); if (detail.PaymentType == PaymentType.CurrentSalary && payment.FirstPayment.Month == detail.FirstPayment.Month) { // update payment payment.LastPayment = detail.LastPayment; payment.MonthlySalary = detail.MonthlyAmount; payment.SocialSecurityPremium = detail.SocialSecurityPremium; dbAccess.UpdateEmployeePayment(payment); } } RefreshCurrentPayment(payment); }
private void OnSalaryItemDeleting(object obj) { EmployeePaymentDetail detail = ListOfPaymentDetails.CurrentItem as EmployeePaymentDetail; if (detail == null) { return; } Telerik.Windows.Controls.GridViewDeletingEventArgs e = obj as Telerik.Windows.Controls.GridViewDeletingEventArgs; if (e == null) { return; } ConfirmationRequest.Raise(new Confirmation() { Title = "QauntCo Deutschland GmbH", Content = $"Wollen Sie den Eintrag wirklich löschen?" }, respone => { if (respone.Confirmed) { dbAccess.RemoveEmployeePaymentDetail(detail); } else { e.Cancel = true; } }); }
/// <summary> /// Send E-Mails to Colleagues regarding open vacation days /// </summary> private void OnVacationLiability() { DateTime reportDate = timeFunctions.MonthEnd(timeFunctions.MonthEnd(MonthlySalaryDate)); CreateEmployeeSalaryOverview salaryOverview = new CreateEmployeeSalaryOverview(null, new DateTime(reportDate.Year, 1, 1), reportDate); List <EmployeesMonthlyPayments> monthlyPayments = salaryOverview.GetMonthlyPayments(reportDate.Month); foreach (EmployeesMonthlyPayments payment in monthlyPayments) { EmployeesForTravelExpenses employee = dbAccess.FindEmployeeById(payment.EmployeeForTravelExpensesId); if (employee == null) { continue; } EmployeePaymentDetail salarydetail = dbAccess.GetLatestSalary(payment.EmployeeForTravelExpensesId); // do not send emails to people whos contract expire if (salarydetail.LastPayment != null && salarydetail.LastPayment == reportDate) { continue; } // Send Email SendEmailClass sendEmail = new SendEmailClass(); sendEmail.Subject = "Urlaub / Vacation "; sendEmail.ToAddress = employee.EmailAddress; StringBuilder germanText = new StringBuilder(); germanText.Append($"Liebe(r) {employee.FirstName},{Environment.NewLine}{Environment.NewLine}"); germanText.Append("Wie einmal im Jahr üblich, bitte ich dich mir mitzuteilen, wieviele Urlaubstage zum Jahresende noch offen sein werden. Falls du deinen kompletten Urlaub genommen hast, kannst du diese E-Mail ignorieren." + Environment.NewLine + Environment.NewLine); germanText.Append($"Solltest du im Laufe des Jahres {reportDate.Year} bei QuantCo angefangen haben, errechnen sich die Urlaubstage nach der Formel 28 / 12 * Anzahl Monate bei QuantCo (Ergebnis bitte aufrunden)."); germanText.Append(Environment.NewLine + Environment.NewLine + "Vielen Dank für deine Unterstützung." + Environment.NewLine + Environment.NewLine); StringBuilder englishText = new StringBuilder(); englishText.Append($"Dear {employee.FirstName},{Environment.NewLine}{Environment.NewLine}"); englishText.Append("As usual once a year, I would like to ask you to tell me how many vacation days are left for this calendar year. Should you have taken all your vacation you can ignore this email." + Environment.NewLine + Environment.NewLine); englishText.Append($"In case you have joined QuantCo in {reportDate.Year} you can calculate the number of vacation days using the formula: 28 / 12 * number of months with QuantCo (result can be rounded up)."); englishText.Append(Environment.NewLine + Environment.NewLine + "Thank you for your support." + Environment.NewLine + Environment.NewLine); sendEmail.Body = $"{germanText.ToString()}{englishText.ToString()}" + $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen / Best regards {System.Environment.NewLine} {System.Environment.NewLine} Franz"; bool success = true; if (employee.FirstName.Contains("Sabrina") || employee.FirstName.Contains("Franz")) { success = sendEmail.SendEmailToServer(); } if (!success) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden" }); } } }
private void OnAddNewPaymentDetail() { EmployeePaymentDetail newDetail = new EmployeePaymentDetail(); newDetail.PaymentType = PaymentType.Salary; EmployeePayment currentPayment = ListOfCurrentPayments.CurrentItem as EmployeePayment; newDetail.EmployeeId = currentPayment.EmployeeId; employeePaymentDetails.Add(newDetail); ListOfPaymentDetails.MoveCurrentToLast(); }
private void OnRowDetailDeleting() { EmployeePaymentDetail detail = ListOfPaymentDetails.CurrentItem as EmployeePaymentDetail; if (detail == null) { return; } dbAccess.RemoveEmployeePaymentDetail(detail); }
private void OnEditCurrentSalary() { NoRecordView = Visibility.Collapsed; CurrentSalaryView = Visibility.Visible; BonusView = Visibility.Collapsed; SalaryHistoryView = Visibility.Collapsed; FinalPaymentDateView = Visibility.Collapsed; CurrentPaymentDetail = new EmployeePaymentDetail(); CurrentPaymentDetail.PaymentType = PaymentType.CurrentSalary; EmployeePayment employeePayment = ListOfCurrentPayments.CurrentItem as EmployeePayment; CurrentPaymentDetail.EmployeeId = employeePayment.EmployeeId; }
private void OnAddingNewDetail(object obj) { Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e = obj as Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs; if (e == null) { return; } EmployeePaymentDetail newDetail = new EmployeePaymentDetail(); EmployeePayment currentPayment = ListOfCurrentPayments.CurrentItem as EmployeePayment; newDetail.EmployeeId = currentPayment.EmployeeId; e.NewObject = newDetail; }
public List <EmployeeChangeLog> GetChangeLogItems(int month) { changeLogItems = new List <EmployeeChangeLog>(); foreach (EmployeeSalaryOverview overviewItem in employeeSalaryOverviews) { if (!IsActiveEmployee(overviewItem, month)) { continue; } // do not show employees located in Bulgaria as they do not affect German pay roll if (overviewItem.GermanPayroll == false) { continue; } EmployeesForTravelExpenses employee = dbAccess.FindEmployeeById(overviewItem.EmployeeForTravelExpensesId); EmployeePaymentDetail payment = dbAccess.GetLatestSalary(employee.Id); List <TaxableIncomeItem> taxableItems = dbAccess.GetOpenTaxableItemsByEmployeeId(overviewItem.EmployeeForTravelExpensesId); EmployeeChangeLog item = new EmployeeChangeLog(); item.FirstName = employee.FirstName; item.LastName = employee.ShortName; item.BonusAmount = SetBonusAmount(overviewItem, month); if (payment.FirstPayment.Year == periodfrom.Year && payment.FirstPayment.Month == month) // nur füllen, wenn eine Gehaltsänderung vorgenommen wurde { item.NewSalary = payment.MonthlyAmount; if (employee.EntitledToSurplus) { item.NewSalary -= 300; // Das Gehalt wird ohne den Essenszuschuss an BDO geliefert. } } // loop through taxableItems // if Description contains("VMA") set item.vma if (taxableItems.Count > 0) { item.VmaTaxable = taxableItems.Where(t => t.Description.ToUpper().Contains("VMA")).Sum(s => s.TaxableAmount); item.TaxableIncome = taxableItems.Where(t => !t.Description.ToUpper().Contains("VMA") && t.AdjustGrossIncome == false).Sum(s => s.TaxableAmount); item.TaxableIncomeWithNetAdjustment = taxableItems.Where(t => !t.Description.ToUpper().Contains("VMA") && t.AdjustGrossIncome == true).Sum(s => s.TaxableAmount); } changeLogItems.Add(item); } return(changeLogItems); }
private void OnSave(string obj) { EmployeePayment employeePayment = ListOfCurrentPayments.CurrentItem as EmployeePayment; switch (obj) { case "CurrentSalary": { EmployeePaymentDetail existingCurrentSalary = dbAccess.GetCurrentPayment(CurrentPaymentDetail.EmployeeId); if (existingCurrentSalary == null) { //there is no existing CurrentSalary ==> insert record and update EmployeePayment CurrentPaymentDetail = dbAccess.SetCurrentPayment(CurrentPaymentDetail); employeePaymentDetails.Add(CurrentPaymentDetail); employeePayment.FirstPayment = CurrentPaymentDetail.FirstPayment; employeePayment.LastPayment = CurrentPaymentDetail.LastPayment; employeePayment.PaymentDescription = CurrentPaymentDetail.PaymentDescription; employeePayment.MonthlySalary = CurrentPaymentDetail.MonthlyAmount; employeePayment.SocialSecurityPremium = CurrentPaymentDetail.SocialSecurityPremium; } else { if (existingCurrentSalary.FirstPayment.Month == CurrentPaymentDetail.FirstPayment.Month && existingCurrentSalary.FirstPayment.Year == CurrentPaymentDetail.FirstPayment.Year) { //update existingCurrentSalary with new data //update EmployeePayment existingCurrentSalary.LastPayment = CurrentPaymentDetail.LastPayment; existingCurrentSalary.PaymentDescription = CurrentPaymentDetail.PaymentDescription; existingCurrentSalary.Sequence = CurrentPaymentDetail.Sequence; existingCurrentSalary.SocialSecurityPremium = CurrentPaymentDetail.SocialSecurityPremium; existingCurrentSalary.MonthlyAmount = CurrentPaymentDetail.MonthlyAmount; dbAccess.UpdateEmployeePaymentDetail(existingCurrentSalary); employeePayment.MonthlySalary = existingCurrentSalary.MonthlyAmount; employeePayment.LastPayment = existingCurrentSalary.LastPayment; employeePayment.SocialSecurityPremium = existingCurrentSalary.SocialSecurityPremium; employeePayment.PaymentDescription = existingCurrentSalary.PaymentDescription; dbAccess.UpdateEmployeePayment(employeePayment); } else { //set PaymentType of existingCurrentSalary To Salary and set LastPaymentDate //insert record and update EmploymentPayment existingCurrentSalary.PaymentType = PaymentType.Salary; existingCurrentSalary.LastPayment = timeFunctions.MonthEnd(CurrentPaymentDetail.FirstPayment.AddMonths(-1)); dbAccess.UpdateEmployeePaymentDetail(existingCurrentSalary); CurrentPaymentDetail = dbAccess.SetCurrentPayment(CurrentPaymentDetail); employeePaymentDetails.Add(CurrentPaymentDetail); employeePayment.FirstPayment = CurrentPaymentDetail.FirstPayment; employeePayment.LastPayment = CurrentPaymentDetail.LastPayment; employeePayment.PaymentDescription = CurrentPaymentDetail.PaymentDescription; employeePayment.MonthlySalary = CurrentPaymentDetail.MonthlyAmount; employeePayment.SocialSecurityPremium = CurrentPaymentDetail.SocialSecurityPremium; } } break; } case "BonusPayment": { CurrentPaymentDetail = dbAccess.AddBonusPayment(CurrentPaymentDetail); employeePaymentDetails.Add(CurrentPaymentDetail); break; } case "LastPayment": { dbAccess.SetFinalPayment(CurrentPaymentDetail); employeePaymentDetails.Add(CurrentPaymentDetail); employeePayment.LastPayment = CurrentPaymentDetail.LastPayment; employeePayment.PaymentDescription = CurrentPaymentDetail.PaymentDescription; break; } case "Detail": { if (CurrentPaymentDetail == null) { return; } EmployeePayment payment = ListOfCurrentPayments.CurrentItem as EmployeePayment; // if Bonuspayment: set LastPayment = FirstPayment if (CurrentPaymentDetail.PaymentType == PaymentType.Bonus) { CurrentPaymentDetail.LastPayment = CurrentPaymentDetail.FirstPayment; } if (CurrentPaymentDetail.Id == 0) { CurrentPaymentDetail = dbAccess.InsertEmployeePaymentDetail(CurrentPaymentDetail); } else { dbAccess.UpdateEmployeePaymentDetail(CurrentPaymentDetail); if (CurrentPaymentDetail.PaymentType.Equals(PaymentType.CurrentSalary)) { // update payment payment.FirstPayment = CurrentPaymentDetail.FirstPayment; payment.LastPayment = CurrentPaymentDetail.LastPayment; payment.MonthlySalary = CurrentPaymentDetail.MonthlyAmount; payment.SocialSecurityPremium = CurrentPaymentDetail.SocialSecurityPremium; dbAccess.UpdateEmployeePayment(payment); } } RefreshCurrentPayment(payment); break; } default: { break; } } RefreshCurrentPayment(employeePayment); }