Exemplo n.º 1
0
        public List <EmployeesMonthlyPayments> GetMonthlyPayments(int month)
        {
            monthlyPayments = new List <EmployeesMonthlyPayments>();

            foreach (EmployeeSalaryOverview overviewItem in employeeSalaryOverviews)
            {
                if (!IsActiveEmployee(overviewItem, month))
                {
                    continue;
                }
                EmployeesForTravelExpenses employee = dbAccess.FindEmployeeById(overviewItem.EmployeeForTravelExpensesId);
                EmployeesMonthlyPayments   item     = new EmployeesMonthlyPayments();
                item.EmployeeForTravelExpensesId = employee.Id;
                item.MonthAndYear   = $"{periodto:MMMM} {periodto:yyyy}";
                item.Fullname       = employee.FullName;
                item.MonthlyPayment = SetMonthlySalary(overviewItem, month);
                item.BonusAmount    = SetBonusAmount(overviewItem, month);
                if (item.MonthlyPayment > 0)
                {
                    // calculate Social Security Premiim
                    item.SocialSecurity = (decimal)Math.Round((double)item.MonthlyPayment * 19.5 / 100, 2);
                    if (item.SocialSecurity > 1178m)
                    {
                        item.SocialSecurity = 1178m;
                    }
                }
                item.TotalCost = item.MonthlyPayment + item.BonusAmount + item.SocialSecurity;
                monthlyPayments.Add(item);
            }
            return(monthlyPayments);
        }
/// <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"
                    });
                }
            }
        }
Exemplo n.º 3
0
        private void ListOfEmployees_CurrentChanged(object sender, EventArgs e)
        {
            selectedItem = ListOfEmployees.CurrentItem as EmployeesForTravelExpenses;

            // read history of branch relations
            // if there is no record insert record

            ReadEmployeeBranches();
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        private void OnRowEditEnded()
        {
            if (selectedItem.Id == 0)
            {
                EmployeesForTravelExpenses e = dataAccess.InsertEmployee(selectedItem);
                if (e == null)
                {
                    // Fehler
                }
                else
                {
                    selectedItem.Id = e.Id;

                    if (selectedItem.QuantCoBranchId > 0)
                    {
                        EmployeeBranchRelation relation = new EmployeeBranchRelation
                        {
                            EmployeeId      = selectedItem.Id,
                            QuantCoBranchId = selectedItem.QuantCoBranchId,
                            ValidFrom       = new DateTime(DateTime.Now.Year, 1, 1)
                        };
                        dataAccess.InserEmployeeBranchRelation(relation);
                    }
                    CanSelectBranch = false;

                    return;
                }
            }
            else
            {
                if (selectedBranch.QuantCoBranchId > 0)
                {
                    selectedItem.QuantCoBranchId = selectedBranch.QuantCoBranchId;
                }
                EmployeesForTravelExpenses e = dataAccess.UpdateEmployee(selectedItem);
                if (e == null)
                {
                    // Fehler
                }
            }
        }
Exemplo n.º 6
0
        public override void OnNavigatedTo(NavigationContext navigationContext)
        {
            employees = new ObservableCollection <EmployeesForTravelExpenses>(dataAccess.GetAllEmployees());
            if (employees.Count == 0)
            {
                employees.Add(new EmployeesForTravelExpenses());
            }

            ListOfEmployees = CollectionViewSource.GetDefaultView(employees);
            ListOfEmployees.CurrentChanged -= ListOfEmployees_CurrentChanged;
            ListOfEmployees.CurrentChanged += ListOfEmployees_CurrentChanged;
            selectedItem = ListOfEmployees.CurrentItem as EmployeesForTravelExpenses;

            QuantCoBranches = new ObservableCollection <QuantCoBranch>(dataAccess.GetAllQuantCoBranches());


            RaisePropertyChanged("QuantCoBranches");
            RaisePropertyChanged("ListOfEmployees");
            UpdateEmployeeBranches();
            ReadEmployeeBranches();
        }
        private void Employees_CurrentChanged(object sender, EventArgs e)
        {
            if (hasBeenCalled)
            {
                return;
            }
            CanUserAddItems   = true;
            selectedEmployee  = Employees.CurrentItem as EmployeesForTravelExpenses;
            employeeDirectory = Path.Combine(documentRoot, selectedEmployee.FullName);
            Directory.CreateDirectory(employeeDirectory);
            employeeDocuments = new ObservableCollection <EmployeeDocument>(dbAccess.GetAllEmployeeDocumentsForEmployeeId(selectedEmployee.Id));
            ListOfDocuments   = CollectionViewSource.GetDefaultView(employeeDocuments);
            ListOfDocuments.CurrentChanged -= ListOfDocuments_CurrentChanged;
            ListOfDocuments.CurrentChanged += ListOfDocuments_CurrentChanged;
            RaisePropertyChanged("ListOfDocuments");
            if (ListOfDocuments.CurrentItem != null)
            {
                SelectedDocument = ListOfDocuments.CurrentItem as EmployeeDocument;
                FileInfo fileInfo = new FileInfo(Path.Combine(employeeDirectory, SelectedDocument.DocumentFileName));
                if (fileInfo.Exists)
                {
                    SelectedFileName = fileInfo.FullName;
                }
                else
                {
                    NotificationRequest.Raise(new Notification
                    {
                        Title   = "QuantCo Deutschland GmbH",
                        Content = $"Die Datei {fileInfo.FullName} wurde entweder gelöscht oder verschoben"
                    });
                    SelectedFileName = null;
                }
            }

            if (employeeDocuments.Count == 0)
            {
                OnAddDocument();
            }
            RaisePropertyChanged("SelectedFileName");
        }
        private void TaxableIncomeSendEmailsToEmployees()
        {
            List <int> employeeList = dbAccess.GetEmployeeIdsForOpenTaxableIncome();

            foreach (int employeeId in employeeList)
            {
                EmployeesForTravelExpenses employee = dbAccess.FindEmployeeById(employeeId);
                if (employee == null)
                {
                    continue;
                }
                if (string.IsNullOrEmpty(employee.EmailAddress))
                {
                    continue;
                }
                // Render Report
                var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();

                // set any deviceInfo settings if necessary
                var deviceInfo = new System.Collections.Hashtable();


                var reportSource = new Telerik.Reporting.TypeReportSource();

                // reportName is the Assembly Qualified Name of the report
                reportSource.TypeName = typeof(AccountingHelper.Reporting.TaxableIncomeByEmployee).AssemblyQualifiedName;


                // Pass parameter value with the Report Source if necessary
                reportSource.Parameters.Add("EmployeeId", employeeId);

                Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);


                // set Directory to Root/Datev/TaxableIncomeReports/ and Filename: Fullname + "Taxable Income" + Date
                string taxableIncomeFileName = Path.Combine(Properties.Settings.Default.RootDirectory, Properties.Settings.Default.DatevDirectory, "TaxableIncomeReports", $"{employee.FullName} TaxableIncome {DateTime.Now:d}.pdf");


                using (System.IO.FileStream fs = new System.IO.FileStream(taxableIncomeFileName, System.IO.FileMode.Create))
                {
                    fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
                }

                // prepare Email
                SendEmailClass sendEmail = new SendEmailClass();
                sendEmail.Subject   = "Besteuerung von geldwerten Vorteilen ";
                sendEmail.ToAddress = employee.EmailAddress;
                sendEmail.Attachments.Add(taxableIncomeFileName);
                sendEmail.Body = $"Lieber {employee.FullName},{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhältst Du eine Liste der geldwerten Vorteile, die in Kürze versteuert werden. " +
                                 $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH";

                bool success = sendEmail.SendEmailToServer();

                if (!success)
                {
                    NotificationRequest.Raise(new Notification()
                    {
                        Title   = "QuantCo Deutschland GmbH",
                        Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden"
                    });
                }

                //MailItem mailItem = outlookApp.CreateItem(OlItemType.olMailItem);

                //mailItem.BodyFormat = OlBodyFormat.olFormatHTML;
                //mailItem.SendUsingAccount = outlookUsingAccount;
                //mailItem.Subject = "Besteuerung von geldwerten Vorteilen ";

                //Recipient recipTo = mailItem.Recipients.Add(employee.EmailAddress);
                //recipTo.Type = (int)OlMailRecipientType.olTo;



                //if (!mailItem.Recipients.ResolveAll())
                //{
                //    NotificationRequest.Raise(new Notification()
                //    {
                //        Title = "QuantCo Deutschland GmbH",
                //        Content = $"Die E-Mail Adresse für {employee.FullName} ist ungültig"
                //    });
                //    continue;
                //}

                //mailItem.Body = $"Lieber {employee.FullName},{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhältst Du eine Liste der geldwerten Vorteile, die in Kürze versteuert werden. " +
                //    $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH";


                //    mailItem.Attachments.Add(taxableIncomeFileName, OlAttachmentType.olByValue);


                //mailItem.Save();
            }
        }
Exemplo n.º 9
0
        private EmployeeSalaryOverview GetEmployeeSalaryOverview(int id)
        {
            EmployeesForTravelExpenses   employee = dbAccess.FindEmployeeById(id);
            List <EmployeePaymentDetail> details  = dbAccess.GetAllPaymentDetails(id);
            QuantCoBranch          branch         = dbAccess.GetBranchById(employee.QuantCoBranchId);
            EmployeeSalaryOverview overview       = new EmployeeSalaryOverview();

            if (details.Count == 0)
            {
                return(overview);
            }

            overview.EmployeeForTravelExpensesId = id;
            overview.EmployeeName = employee.FullName;
            if (branch != null)
            {
                overview.OfficeLocation = branch.LocationName;
                overview.GermanPayroll  = branch.GermanPayroll;
            }

            overview.CalenderYear = periodfrom.Year.ToString();


            foreach (EmployeePaymentDetail detail in details)
            {
                if (detail.PaymentType == PaymentType.Bonus && detail.LastPayment == null)
                {
                    detail.LastPayment = detail.FirstPayment;
                }
                else
                if (detail.LastPayment == null)
                {
                    detail.LastPayment = periodto;                                 //set LastPayment
                }
                if (detail.LastPayment < periodfrom)
                {
                    continue;                                   // payment was before reporting period
                }
                if (detail.FirstPayment > periodto)
                {
                    continue;                                   // payment is after reporting period
                }
                DateTime periodStart = periodfrom;


                if (detail.PaymentType == PaymentType.Bonus)
                {
                    AddBonusPayment(overview, detail.FirstPayment, detail.MonthlyAmount);
                }
                else if (detail.PaymentType == PaymentType.Salary)
                {
                    AddSalary(overview, detail.FirstPayment, detail.LastPayment, detail.MonthlyAmount);
                }
                else if (detail.PaymentType == PaymentType.CurrentSalary)
                {
                    AddSalary(overview, detail.FirstPayment, detail.LastPayment, detail.MonthlyAmount);
                }
                else
                {
                }
            }

            return(overview);
        }