Ejemplo n.º 1
0
 private void invoicesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form f = new StatementReportForm();
     activateForm(f, FormWindowState.Normal, FormStartPosition.Manual);
 }
Ejemplo n.º 2
0
        private void bntProcess_Click(object sender, EventArgs e)
        {
            // Disable button, to avoid repeat pressing.
            this.btnCloseBooks.Enabled = false;
            this.bntProcess.Enabled = false;
            Vectra.DataSet2TableAdapters.configurationTableAdapter da = new Vectra.DataSet2TableAdapters.configurationTableAdapter();
            da.UpdateStatementDate(getFridaysDate().ToString("dd-MMM-yyyy"));
            da.Update(this.dataSet2);

            //-- Backup before updating
            logProgress("Daily backup");
            BackupSimple.doBackup(1);  // The 1 for daily

            try
            {
                logProgress("Processing Transactions");
                doWeeklyUpdate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace, ex.Message);
            }

            logProgress("Prepare Statements");
            using (Form f = new StatementReportForm())
            {
                f.WindowState = FormWindowState.Minimized;
                f.Show();
            }

            logProgress("Prepare Aged-Trial-Balance");
            using (Form f = new ATBReportForm())
            {
                f.WindowState = FormWindowState.Minimized;
                f.Show();
            }

            logProgress("Prepare Product Sales Details");
            using (Form f = new SalesProdReportForm())
            {
                f.WindowState = FormWindowState.Minimized;
                f.Show();
            }

            logProgress("Prepare Sales Summary");
            using (Form f = new SalesSummaryReportForm())
            {
                f.WindowState = FormWindowState.Minimized;
                f.Show();
            }

            logProgress("Prepare Receipts And Adjustments");
            using (Form f = new ReceiptAndAdjReportForm())
            {
                f.WindowState = FormWindowState.Minimized;
                f.Show();
            }

            logProgress("Prepare Customer Transaction");
            using (Form f = new CustomerTransactionReportForm())
            {
                f.WindowState = FormWindowState.Minimized;
                f.Show();
            }

            if (btnCloseBooks.Checked) // This closing the books.
            {
                logProgress("Reset Accounting Period");
                resetAccountingPeriod();

                sqLiteConnection1.Open();
                SQLiteCommand cmd = new SQLiteCommand();
                cmd.Connection = sqLiteConnection1;

                cmd.CommandText = "update invoice_header set invoice_locked = 1 where invoice_locked = 0";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "update invoice_items set current_flag = '0' where current_flag = 1";
                cmd.ExecuteNonQuery();
                sqLiteConnection1.Close();
            }

            logProgress("Weekly backup");
            BackupSimple.doBackup(2);  // The 2 for Weekly

            logProgress("Finished.");
        }