コード例 #1
0
        private void OnPrintExpense()
        {
            if (TravelExpense.Id == 0)
            {
                NotificationRequest.Raise(new Notification()
                {
                    Title   = "QuantCo Deutschland GmbH",
                    Content = "Die Reisekosten müssen vor dem Druck erst gespeichert werden"
                });
                return;
            }

            NotificationRequest.Raise(new Notification()
            {
                Title   = "QuantCo Deutschland GmbH",
                Content = "Nicht gespeicherte Änderungen werden nicht ausgedruckt"
            });

            List <int> idList = new List <int>();

            idList.Add(TravelExpense.Id);

            TypeReportSource source = new TypeReportSource();

            source.TypeName = typeof(AccountingHelper.Reporting.TravelExpenses).AssemblyQualifiedName;
            source.Parameters.Add("TravelExpenseIds", idList);
            ViewerParameter parameter = new ViewerParameter()
            {
                typeReportSource = source
            };

            eventAggregator.GetEvent <ViewerParameterEvent>().Publish(parameter);
        }
コード例 #2
0
        private void OnContractBonus()
        {
            TypeReportSource source = new TypeReportSource();

            source.TypeName = typeof(AccountingHelper.Reporting.BonusYear).AssemblyQualifiedName;
            ViewerParameter parameter = new ViewerParameter()
            {
                typeReportSource = source
            };

            eventAggregator.GetEvent <ViewerParameterEvent>().Publish(parameter);
        }
コード例 #3
0
        private void OnSalaryOverview()
        {
            TypeReportSource source = new TypeReportSource();

            source.TypeName = typeof(AccountingHelper.Reporting.SalaryOverviewReport).AssemblyQualifiedName;
            DateTime reportDate = timeFunctions.MonthEnd(DateTime.Now);

            source.Parameters.Add("ReportDate", reportDate);
            ViewerParameter parameter = new ViewerParameter()
            {
                typeReportSource = source
            };

            eventAggregator.GetEvent <ViewerParameterEvent>().Publish(parameter);
        }
コード例 #4
0
        private void OnShowReportViewer(ViewerParameter obj)
        {
            ViewerParameter source = obj;

            if (source.reportBook != null)
            {
                Windows.Window_ReportViewer window = new Windows.Window_ReportViewer(source.reportBook);
                window.Owner = Application.Current.MainWindow;
                window.ShowDialog();
            }

            else
            {
                Windows.Window_ReportViewer window = new Windows.Window_ReportViewer(source.typeReportSource);
                window.Owner = Application.Current.MainWindow;
                window.ShowDialog();
            }
        }
コード例 #5
0
        private void PrintProtocolls(List <TravelExpense> travelExpensesToBeMoved)
        {
            List <int> idList = new List <int>();

            foreach (TravelExpense item in travelExpensesToBeMoved)
            {
                idList.Add(item.Id);

                if (CreateFiles)
                {
                    TravelExpense newItem = dbAccess.SetProvidedToDatev(item);
                    if (item == null)
                    {
                        NotificationRequest.Raise(new Notification()
                        {
                            Title   = "QuantCo Deutschland GmbH",
                            Content = $"Beim Setzen des Datums 'ProvidedToDatev' ({item.Id} ist ein Fehler aufgetreten"
                        });
                    }
                    else
                    {
                        // reload travelexpenses to show the updates made in SetProvidedToDatev

                        travelExpenses.Clear();
                        travelExpenses = new ObservableCollection <TravelExpense>(dbAccess.GetAllTravelExpenses());

                        ListOfTravelExpenses = CollectionViewSource.GetDefaultView(travelExpenses);

                        ListOfTravelExpenses.CurrentChanged -= ListOfTravelExpenses_CurrentChanged;
                        ListOfTravelExpenses.CurrentChanged += ListOfTravelExpenses_CurrentChanged;
                        RaisePropertyChanged("ListOfTravelExpenses");
                        if (travelExpenses.Count > 0)
                        {
                            selectedItem = travelExpenses[0];
                        }
                    }
                }
            }
            if (ShowReport)
            {
                TypeReportSource source = new TypeReportSource();
                source.TypeName = typeof(AccountingHelper.Reporting.TravelExpenses).AssemblyQualifiedName;
                source.Parameters.Add("TravelExpenseIds", idList);
                ViewerParameter parameter = new ViewerParameter()
                {
                    typeReportSource = source
                };
                eventaggregator.GetEvent <ViewerParameterEvent>().Publish(parameter);
            }


            if (CreateFiles)
            {
                // create Report as pdf file
                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.TravelExpenses).AssemblyQualifiedName;


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

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


                using (System.IO.FileStream fs = new System.IO.FileStream(Path.Combine(csvFolder, "ProtokollReisekosten.pdf"), System.IO.FileMode.Create))
                {
                    fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
                }
            }
        }
コード例 #6
0
        private void OnPrepareTaxableExpenses()
        {
            List <int> employeeList = dbAccess.GetEmployeeIdsForOpenTaxableIncome();

            if (employeeList.Count == 0)
            {
                NotificationRequest.Raise(new Notification()
                {
                    Title   = "QuantCo Deutschland GmbH",
                    Content = "Es sind keine Datensätze vorhanden, die noch nicht versendet wurden"
                });
                return;
            }
            TypeReportSource source = new TypeReportSource();

            source.TypeName = typeof(AccountingHelper.Reporting.TaxableIncomeReport).AssemblyQualifiedName;
            ViewerParameter parameter = new ViewerParameter()
            {
                typeReportSource = source
            };

            eventaggregator.GetEvent <ViewerParameterEvent>().Publish(parameter);

            #region Save Report as File
            // pdf Datei erzeugen und in Datev speichern

            // specify foldername  .../Datev/TaxableIncomeReports/Report yyyyMMdd

            string foldername = Path.Combine(Properties.Settings.Default.RootDirectory, Properties.Settings.Default.DatevDirectory, "TaxableIncomeReports");
            Directory.CreateDirectory(foldername);
            string filename = $"Report {DateTime.Now.Date:yyyyMMdd}.pdf";
            filename = Path.Combine(foldername, filename);

            // create Report as pdf file
            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.TaxableIncomeReport).AssemblyQualifiedName;


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


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

            #region Send File To Taxadvisor
            // send file to taxAdvisor

            // prepare Email

            SendEmailClass sendEmail = new SendEmailClass();
            sendEmail.Subject   = "Besteuerung von geldwerten Vorteilen ";
            sendEmail.ToAddress = Properties.Settings.Default.BdoHr;
            sendEmail.Attachments.Add(filename);
            sendEmail.Body = $"Sehr geehrte Damen und Herren,{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhalten Sie eine Aufstellung über die geldwerten Vorteile aus den Reisekostenabrechnungen. " +
                             $"{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 ";

            //string BdoHr = Properties.Settings.Default.BdoHr;

            //string[] emails = BdoHr.Split(';');

            //foreach (string email in emails)
            //{
            //    Recipient recipTo = mailItem.Recipients.Add(email);
            //    recipTo.Type = (int)OlMailRecipientType.olTo;
            //}


            //if (!mailItem.Recipients.ResolveAll())
            //{
            //    NotificationRequest.Raise(new Notification()
            //    {
            //        Title = "QuantCo Deutschland GmbH",
            //        Content = $"Die E-Mail-Adressen '{BdoHr}' enthalten mindestens einen falschen Eintrag"
            //    });

            //}
            //else
            //{
            //    mailItem.Body = $"Sehr geehrte Damen und Herren,{System.Environment.NewLine} {System.Environment.NewLine} als Anlage erhalten Sie eine Aufstellung über die geldwerten Vorteile aus den Reisekostenabrechnungen. " +
            //  $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH";


            //    mailItem.Attachments.Add(filename, OlAttachmentType.olByValue);
            //    mailItem.Save();

            //}
            #endregion

            ConfirmationRequest.Raise(new Confirmation()
            {
                Title   = "QuantCo Deutschland GmbH",
                Content = "Sollen die Einträge als 'gesendet' gekennzeichnet werden? "
            }, response =>
            {
                if (response.Confirmed)
                {
                    // send Emails to Employees
                    TaxableIncomeSendEmailsToEmployees();

                    // mark records as sent
                    int nrOfAmendments = dbAccess.SetProvidedToTaxableIncome();

                    NotificationRequest.Raise(new Notification()
                    {
                        Title   = "QuantCo Deutschland GmbH",
                        Content = $"Es wurden {nrOfAmendments} Datensätze geändert."
                    });
                }
            });
        }
コード例 #7
0
        private void OnPayrollCost()
        {
            //TypeReportSource source = new TypeReportSource();
            //source.TypeName = typeof(AccountingHelper.Reporting.MonthlySalary).AssemblyQualifiedName;

            //source.Parameters.Add("EndDate", reportDate);
            //source.Parameters.Add("StartDate", new DateTime(reportDate.Year, reportDate.Month, 1));
            //source.Parameters.Add("MonthYear", $"{reportDate: MMMM yyyy}");


            // new Version of MonthlySalary
            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);

            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
            settings.MissingMemberHandling = MissingMemberHandling.Ignore;

            string jsonContent = JsonConvert.SerializeObject(monthlyPayments, settings);

            string jsonfile = $"C:\\Users\\Public\\Documents\\MonthlyOverview.json";

            System.IO.File.WriteAllText(jsonfile, jsonContent);
            Telerik.Reporting.Processing.ReportProcessor 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.MonthlySalaryOverview).AssemblyQualifiedName;


            // Pass parameter value with the Report Source if necessary
            reportSource.Parameters.Add("Source", jsonfile);
            reportSource.Parameters.Add("DataSelector", string.Empty);

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

            string xlsxFile = jsonfile.Replace("json", "xlsx");

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

            ConfirmationRequest.Raise(new Confirmation()
            {
                Content = $"Es wurde eine Excel-Datei ({xlsxFile}) erstellt" + Environment.NewLine + Environment.NewLine + "Soll die Excel-Datei als E-Mail verschickt werden?",
                Title   = "QuantCo Deutschland GmbH"
            }, response =>
            {
                if (response.Confirmed)
                {
                    // send E-mail to Property 'CEOto'
                    SendEmailToCEO(xlsxFile);
                }
            });

            ViewerParameter parameter = new ViewerParameter()
            {
                typeReportSource = reportSource
            };

            eventAggregator.GetEvent <ViewerParameterEvent>().Publish(parameter);
        }