Example #1
0
        /// <summary>
        /// Prüfe ob Nullzeitraum überschritten wurde
        /// true: Periode überschritten
        /// </summary>
        /// <param name="period">Nullzeitraum</param>
        /// <returns>ob überschritten</returns>
        public static bool exceededZeroPeriod(ZeroPeriod period)
        {
            try
            {
                switch (period)
                {
                case ZeroPeriod.EveryCashClosure:
                    return(true);

                case ZeroPeriod.Monthly:
                    int currentMonth     = DateTime.Now.Month;
                    int lastClosureMonth = BookingsHelper.getDateOfLastCashClosure().Month;
                    return(!(lastClosureMonth == currentMonth));

                case ZeroPeriod.Annually:
                    int currentYear     = DateTime.Now.Year;
                    int lastClosureYear = BookingsHelper.getDateOfLastCashClosure().Year;
                    return(!(lastClosureYear == currentYear));

                case ZeroPeriod.Never:
                    return(false);

                default:
                    return(true);
                }
            }
            catch
            {
                return(true);
            }
        }
Example #2
0
        /// <summary>
        /// Erzeugt Instanz und füllt Felder
        /// </summary>
        /// <param name="processOnlyBookingsFromCurrentClosure">Ob nur Buchungen des aktuellen Kassenschlusses verarbeitet werden sollen</param>
        public CashClosureHelper(bool processOnlyBookingsFromCurrentClosure = true)
        {
            this.closureAccounts = Account.GetAccounts().Where(a => a.IsOfficial && a.IsCapital).ToList();

            // Hole alle Buchungen, die nach dem letzten Kassenabschluss gebucht wurden
            DateTime lastCashClosure = BookingsHelper.getDateOfLastCashClosure();

            // Für Kassenabschluss filtere standardmäßig nur die Buchungen der akttuellen Periode
            if (processOnlyBookingsFromCurrentClosure)
            {
                this.bookings = Booking.GetBookings().Where(b => b.Date > lastCashClosure && b.Date <= DateTime.Now).ToList();
            }
            else
            {
                this.bookings = Booking.GetBookings().ToList();
            }
        }