public ReportsViewModel()
        {
            this.Title = "Rapoarte";
            Mediator.Instance.Register(MediatorActionType.SetSelectedDate, SetSelectedDate);

            cashBookRepository = new CashBookRepository();
            cashBookEntryRepository = new CashBookEntryRepository();
            companyRepository = new CompanyRepository();

            this.NextPageCommand = new DelegateCommand(NextPage, CanNextPage);
            this.PreviousPageCommand = new DelegateCommand(PreviousPage, CanPreviousPage);
            this.BackCommand = new DelegateCommand(Back, CanBack);
        }
        public PrintControlVM()
        {
            InitializeCommands();
            Mediator.Instance.Register(MediatorActionType.SetPaymentInformationPopupMessage, SetPaymentInformationPopupMessage);
            Mediator.Instance.Register(MediatorActionType.SetPrintControlPrintModel, SetPrintControlPrintModel);
            this.Title = "Rapoarte";

            cashBookRepository = new CashBookRepository();
            cashBookEntryRepository = new CashBookEntryRepository();
            companyRepository = new CompanyRepository();

            LoadData();
        }
        public PrintPreviewVM()
        {
            this.Title = "Previzualizare Rapoarte";
            Mediator.Instance.Register(MediatorActionType.SetReportsToPreview, SetReportsToPreview);
            Mediator.Instance.Register(MediatorActionType.SetPrintPreviewPrintModel, SetPrintPreviewPrintModel);

            cashBookRepository = new CashBookRepository();
            cashBookEntryRepository = new CashBookEntryRepository();
            companyRepository = new CompanyRepository();

            this.NextPageCommand = new DelegateCommand(NextPage, CanNextPage);
            this.PreviousPageCommand = new DelegateCommand(PreviousPage, CanPreviousPage);
            this.BackCommand = new DelegateCommand(Back, CanBack);
            this.PrintCommand = new DelegateCommand(Print, CanPrint);
        }
        public CashBookViewModel()
        {
            this.Title = "Registru de casa";
            DeleteCommand = new DelegateCommand(Delete, CanDelete);
            SaveCommand = new DelegateCommand(Save, CanSave);

            this.LegalReglementationsCommand = new DelegateCommand(LegalReglementations, CanLegalReglementations);
            this.ViewReportsCommand = new DelegateCommand(ViewReports, CanViewReports);

            Mediator.Instance.Register(MediatorActionType.RefreshList, RefreshList);
            Mediator.Instance.Register(MediatorActionType.SetSelectedCashBook, SetSelectedCashBook);
            Mediator.Instance.Register(MediatorActionType.UpdateBalance, UpdateBalance);

            cashBookRepository = new CashBookRepository();
            cashBookEntryRepository = new CashBookEntryRepository();
            companyRepository = new CompanyRepository();

            canSave = true;
        }
        public List<ReportPageVM> GetPages(Company company, UserCashBook cashBook, DateTime dateTime, ICashBookRepository cashBookRepository, ICashBookEntryRepository cashBookEntryRepository, int maxEntriesPerPage)
        {
            //maxEntriesPerPage = 13;
            List<ReportPageVM> resultPages = new List<ReportPageVM>();
            try
            {

                this.MaxEntriesPerPage = maxEntriesPerPage;

                var MoneyExchangeRate = cashBookEntryRepository.GetExchangeRateForDay(cashBook.Id, dateTime);

                CashBookEntries = new ObservableCollection<CashBookEntryUI>();
                var tempCashBookEntries = new ObservableCollection<CashBookEntryUI>();

                var existingCashBookEntries = cashBookEntryRepository.GetEntriesForDay(cashBook.Id, dateTime);
                if (existingCashBookEntries != null)
                {
                    foreach (var item in existingCashBookEntries)
                    {
                        tempCashBookEntries.Add((CashBookEntryUI)item);
                    }
                }
                if (tempCashBookEntries.Count == 0)
                {
                    //no report to print for this day, return empty;
                    return resultPages;
                }

                //add incasari
                foreach (var item in tempCashBookEntries)
                {
                    if (item.Incasari != 0)
                    {
                        CashBookEntries.Add((CashBookEntryUI)item);
                    }
                }

                //add payments
                foreach (var item in tempCashBookEntries)
                {
                    if (item.Plati != 0)
                    {
                        CashBookEntries.Add((CashBookEntryUI)item);
                    }
                }
                var ReportTitle = cashBook.IsLei ? "REGISTRU DE CASA in LEI" : "REGISTRU DE CASA in VALUTA";
                var MoneyExchangeRateVisibility = cashBook.IsLei ? Visibility.Collapsed : Visibility.Visible;

                if (!cashBook.IsLei && MoneyExchangeRate.HasValue)
                {
                    foreach (var item in CashBookEntries)
                    {
                        if (item.Incasari != 0)
                        {
                            item.LeiValue = item.Incasari * MoneyExchangeRate.Value;
                        }
                        else
                        {
                            item.LeiValue = item.Plati * MoneyExchangeRate.Value;
                        }
                    }
                }

                var InitialBalanceForDayDecimal = cashBookRepository.GetInitialBalanceForDay(cashBook.Id, dateTime);

                AddExtraDetailsRows(InitialBalanceForDayDecimal, cashBook, MoneyExchangeRate);
                currentPage = 0;
                nrCrt = 1;
                while (HasNextPage())
                {
                    currentPage++;
                    LoadDataForCurrentPage();

                    ReportPageVM newPage = new ReportPageVM()
                    {
                        Company = company,
                        CurrentPageCashBookEntries = CurrentPageCashBookEntries,
                        InitialBalanceForDayDecimal = InitialBalanceForDayDecimal,
                        MoneyExchangeRate = MoneyExchangeRate,
                        MoneyExchangeRateVisibility = MoneyExchangeRateVisibility,
                        PageNumber = PageNumber,
                        ReportTitle = ReportTitle,
                        SelectedCashBook = cashBook,
                        SelectedDate = dateTime,
                    };
                    resultPages.Add(newPage);
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.Log.Error(ex);
            }
            return resultPages;
        }