Ejemplo n.º 1
0
        /// <summary>
        /// Warnung bevor Fixkonto ausgewählt wird
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chkbIsFixAccount_Checked(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBoxEnhanced.Warning(IniParser.GetSetting("ACCOUNTING", "warningCheckFixed"));

            if (result == MessageBoxResult.No)
            {
                chkbIsFixAccount.IsChecked = false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Löschen bestätigen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBoxEnhanced.Warning(IniParser.GetSetting("FORMLETTER", "questionDelete"));

            if (result == MessageBoxResult.Yes)
            {
                FormletterPatternModelDB formletterPatternModel = new FormletterPatternModelDB(this.formletterPatternID);
                formletterPatternModel.deleteThisFormletterPattern();

                // Generiere wieder die Hauptseite der SB-Verwaltung
                MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
                Type       pageType   = typeof(pFormletterAdministration);
                mainWindow.switchPage(IniParser.GetSetting("FORMLETTER", "formletterAdmin"), pageType);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Löscht eine Buchung
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int            bookingID      = (int)((Button)sender).CommandParameter;
                List <Booking> booking        = Booking.GetBookings(bookingID).ToList();
                Booking        currentBooking = booking[0];

                if (currentBooking == null)
                {
                    throw new Exception();
                }

                string date    = SafeStringParser.safeParseToStr(currentBooking.Date, true);
                string warning = IniParser.GetSetting("ACCOUNTING", "warningBookingDelete").Replace("{0}", date);

                if (MessageBoxEnhanced.Warning(warning) == MessageBoxResult.No)
                {
                    return;
                }

                if (currentBooking.Date <= BookingsHelper.getDateOfLastCashClosure())
                {
                    throw new Exception(IniParser.GetSetting("ERRORMSG", "bookingBeforeLastClosure"));
                }

                Booking.Delete(currentBooking.BookingID);

                // Refresh page
                generateDataGridDataUnfiltered();
                refreshDataGrid(this.bookingModelsUnchanged);
            }
            catch
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "deleteBooking"));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Kassenabschluss durchführen
        /// </summary>
        /// <param name="btn">sendender Button</param>
        private void submitCashClosure(Button btn)
        {
            MessageBoxResult result = MessageBoxEnhanced.Warning(IniParser.GetSetting("ACCOUNTING", "cashClosureWarning"));

            if (result == MessageBoxResult.No)
            {
                return;
            }

            string comment = tbComment.Text;

            int cashClosureID                   = -1;
            int cashClosureReportID             = -1;
            int cashClosureReceiptID            = -1;
            CashClosureHelper cashClosureHelper = new CashClosureHelper();

            try
            {
                // Lege CashClosure, CashClosureReport und CashClosureReceipt an
                cashClosureID        = CashClosure.Add(UserSession.userAccountID, DateTime.Now, this.revenuesTotal, this.expensesTotal, comment);
                cashClosureReportID  = CashClosureReport.Add(cashClosureID, false, null, false, null, null, null);
                cashClosureReceiptID = CashClosureReceipt.Add(cashClosureID, false, null, null);

                // Setze für Kassenabschluss-Konten NewBalance als LatestBalance
                foreach (var accModel in this.accountModels)
                {
                    double latestBalance = accModel.newBalanceDOUBLE;
                    Account.Update(accModel.account.AccountID, accModel.account.Name, accModel.account.Number, accModel.account.ZeroPeriodEnum, accModel.account.IsOfficial, accModel.account.Description, latestBalance, accModel.account.IsCapital, accModel.account.IsFixed);
                }

                // Setze für alle anderen Konten den LatestBalance auf 0 bei Überschreitung des Nullzeitraums
                List <Account> noClosureAccounts = Account.GetAccounts().Where(a => !(a.IsOfficial && a.IsCapital)).ToList();
                foreach (var account in noClosureAccounts)
                {
                    double latestBalance;
                    if (CashClosureHelper.exceededZeroPeriod(account.ZeroPeriodEnum))
                    {
                        latestBalance = 0.0;
                    }
                    else
                    {
                        latestBalance = account.LatestBalance;
                    }
                    Account.Update(account.AccountID, account.Name, account.Number, account.ZeroPeriodEnum, account.IsOfficial, account.Description, latestBalance, account.IsCapital, account.IsFixed);
                }

                MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
                Type       pageType   = typeof(pCashClosureManager);
                mainWindow.switchPage(IniParser.GetSetting("ACCOUNTING", "cashClosure"), pageType);
            }
            catch
            {
                try
                {
                    if (cashClosureID != -1)
                    {
                        CashClosure.Delete(cashClosureID);
                    }
                    if (cashClosureReportID != -1)
                    {
                        CashClosureReport.Delete(cashClosureReportID);
                    }
                    if (cashClosureReceiptID != 1)
                    {
                        CashClosureReceipt.Delete(cashClosureReceiptID);
                    }
                }
                catch
                {
                    MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "newCashClosure"));
                }
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "newCashClosure"));
            }
        }