Пример #1
0
        private void openAccountToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AccountForm form = new AccountForm(DataCache);

            form.MdiParent = this;
            form.Show();
        }
Пример #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            using (var core = new StandardBusinessLayer(DataCache))
            {
                core.Connect();

                int currentAccountingYear = 0;
                currentAccountingYear = core.GetCashBoxSettings(CashBoxSettingsNo.CurrentApplicationNo).AccountingYear;
                DataCache.Load(currentAccountingYear);
                CalculateBalance();

                Text = CurrentApplication.Name;
                if (Environment.CommandLine.Contains(" /developer"))
                {
                    Text += " - Developer";
                }

                AccountForm form = new AccountForm(DataCache);
                form.MdiParent     = this;
                form.StartPosition = FormStartPosition.Manual;
                form.Location      = new Point(0, 0);
                form.Size          = new Size(ClientArea.Width / 2, ClientArea.Height);
                form.Show();

                CashBookForm cashBookForm = new CashBookForm(DataCache);
                cashBookForm.MdiParent     = this;
                cashBookForm.StartPosition = FormStartPosition.Manual;
                cashBookForm.Location      = new Point(ClientArea.Width / 2, 0);
                cashBookForm.Size          = new Size(ClientArea.Width / 2, ClientArea.Height);
                cashBookForm.Show();

                Verification verification = DataCache.GetLastVerification();

                if (verification == null)
                {
                    verification = core.CreateNewVerification(currentAccountingYear);
                }
                else
                {
                    verification = DataCache.GetVerification(verification.No);
                }

                decimal a = verification.AccountTransactions.Sum(x => x.Amount);
                decimal c = verification.CashBookTransactions.Sum(x => x.Amount);

                CurrentApplication.CurrentVerification = verification;

                if (currentAccountingYear != CurrentApplication.DateTimeNow.Year)
                {
                    MessageBox.Show("Varning!\n\nSystemets bokföringsår står inställt på " + currentAccountingYear +
                                    ", vilket inte stämmer överrens med nuvarande år på din lokala klocka som står inställd på år " +
                                    CurrentApplication.DateTimeNow.Year +
                                    ".\n\nOm det precis har blivit ett nytt år, var noga med att avsluta det föregående året, och gå sedan in i Inställningar (under menyn Inställningar) och ändra aktuellt bokföringsår till aktuellt år, så att du får en ny nummerserie för det här årets affärshändelser.", "Varning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }