/// <summary>
        /// executed by progress dialog thread
        /// </summary>
        private void PostGLBatch(int ABatchNumber, out TVerificationResultCollection AVerifications)
        {
            bool postedOk = TRemote.MFinance.GL.WebConnectors.PostGLBatch(FLedgerNumber, ABatchNumber, out AVerifications);

            if (postedOk && FMyForm.EnablePostingReport)
            {
                TLogging.Log("PostGLBatch is generating the Batch Posting Report...");
                TFrmBatchPostingRegister glReportGui = new TFrmBatchPostingRegister(null);
                glReportGui.PrintReportNoUi(FLedgerNumber, ABatchNumber);
            }
        }
Exemplo n.º 2
0
        private void BtnOK_Click(System.Object sender, System.EventArgs e)
        {
            if (chkGlReports.Checked)
            {
                TFrmBatchPostingRegister batchPostingGui = new TFrmBatchPostingRegister(null);

                foreach (Int32 glBatchNumber in glBatchNumbers)
                {
                    if (glBatchNumber > 0)
                    {
                        batchPostingGui.PrintReportNoUi(FLedgerNumber, glBatchNumber);
                    }
                }
            }

            if (chkIeStatement.Checked)
            {
                TFrmIncomeExpenseStmt incomeExpenseGui = new TFrmIncomeExpenseStmt(null);
                incomeExpenseGui.PrintPeriodEndReport(FLedgerNumber, FMonthMode);
            }

            if (chkBalanceSheet.Checked)
            {
                TFrmBalanceSheetStandard balanceSheetGui = new TFrmBalanceSheetStandard(null);
                balanceSheetGui.PrintPeriodEndReport(FLedgerNumber, FMonthMode);
            }

            if (chkAccountDetail.Checked)
            {
                TFrmAccountDetail accountDetailGui = new TFrmAccountDetail(null);
                accountDetailGui.PrintPeriodEndReport(FLedgerNumber, FMonthMode);
            }

            if (chkAfo.Checked)
            {
                TFrmAFO AfoGui = new TFrmAFO(null);
                AfoGui.PrintPeriodEndReport(FLedgerNumber, FMonthMode);
            }

            if (chkSurplusDeficit.Checked)
            {
                TFrmSurplusDeficit SDGui = new TFrmSurplusDeficit(null);
                SDGui.PrintPeriodEndReport(FLedgerNumber, FMonthMode);
            }

            if (chkExec.Checked)
            {
                TFrmExecutiveSummary ExecGui = new TFrmExecutiveSummary(null);
                ExecGui.PrintPeriodEndReport(FLedgerNumber, FMonthMode);
            }

            this.Close();
        }
        /// <summary>
        /// executed by progress dialog thread
        /// </summary>
        /// <param name="AVerifications"></param>
        private void PostGiftBatch(out TVerificationResultCollection AVerifications)
        {
            Int32 generatedGlBatchNumber;

            if (TRemote.MFinance.Gift.WebConnectors.PostGiftBatch(
                    FLedgerNumber, FSelectedBatchNumber, out generatedGlBatchNumber, out AVerifications) &&
                FMyForm.EnablePostingReport
                )
            {
                TFrmGiftBatchDetail giftReportForm = new TFrmGiftBatchDetail(null);
                giftReportForm.PrintReportNoUi(FLedgerNumber, FSelectedBatchNumber);

                TFrmBatchPostingRegister glReportForm = new TFrmBatchPostingRegister(null);
                glReportForm.PrintReportNoUi(FLedgerNumber, generatedGlBatchNumber);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Print out the selected batch using FastReports template.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FilePrint(object sender, EventArgs e)
        {
            if (!this.tpgJournals.Enabled)
            {
                MessageBox.Show(Catalog.GetString("No Batch is selected"), Catalog.GetString("Batch Posting Register"),
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ABatchRow BatchRow = ucoBatches.GetSelectedDetailRow();

//          PrintPostingRegister(FLedgerNumber, BatchRow.BatchNumber, ModifierKeys.HasFlag(Keys.Control));
            TFrmBatchPostingRegister ReportGui = new TFrmBatchPostingRegister(this);

            ReportGui.LedgerNumber = FLedgerNumber;
            ReportGui.BatchNumber  = BatchRow.BatchNumber;
            ReportGui.Show();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Print out the selected batch using FastReports template.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FilePrint(object sender, EventArgs e)
        {
            if (!this.tpgJournals.Enabled)
            {
                MessageBox.Show(Catalog.GetString("No Batch is selected"), Catalog.GetString("Batch Posting Register"),
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ABatchRow BatchRow = ucoBatches.GetSelectedDetailRow();

            TFrmBatchPostingRegister ReportGui = new TFrmBatchPostingRegister(this);

//          ReportGui.PrintReportNoUi(FLedgerNumber, BatchRow.BatchNumber); // This alternative doesn't show the UI

            ReportGui.LedgerNumber = FLedgerNumber;
            ReportGui.BatchNumber  = BatchRow.BatchNumber;
            ReportGui.Show();
        }
Exemplo n.º 6
0
        private void RunRevaluation(object btn, EventArgs e)
        {
            String ToCostCentre = cmbCostCentres.GetSelectedString();

            if (ToCostCentre == "")
            {
                MessageBox.Show(Catalog.GetString("You must select a revaluation Cost Centre."));
                return;
            }

            int intUsedEntries = 0;

            for (int i = 0; i < FcurrencyExchangeList.Count; ++i)
            {
                if (FcurrencyExchangeList[i].DoRevaluation && (FcurrencyExchangeList[i].mExchangeRate == 0))
                {
                    MessageBox.Show(String.Format(Catalog.GetString("Revaluation of {0} disabled because no exchange rate is available."),
                                                  FcurrencyExchangeList[i].AccountCode));
                    FcurrencyExchangeList[i].DoRevaluation = false;
                    grdDetails.Refresh();
                }

                if (FcurrencyExchangeList[i].DoRevaluation)
                {
                    ++intUsedEntries;
                }
            }

            if (intUsedEntries == 0)
            {
                MessageBox.Show(Catalog.GetString("No Revaluation operation required."));
                return;
            }

            string[]  foreignAccounts   = new string[intUsedEntries];
            string[]  foreignCurrencies = new string[intUsedEntries];
            decimal[] rates             = new decimal[intUsedEntries];
            int       j = 0;

            for (int i = 0; i < FcurrencyExchangeList.Count; ++i)
            {
                if (FcurrencyExchangeList[i].DoRevaluation)
                {
                    foreignAccounts[j]   = FcurrencyExchangeList[i].AccountCode;
                    foreignCurrencies[j] = FcurrencyExchangeList[i].Currency;
                    rates[j]             = FcurrencyExchangeList[i].mExchangeRate;
                    j++;
                }
            }

            this.Cursor = Cursors.WaitCursor;
            this.Refresh();
            TVerificationResultCollection verificationResult;
            Int32 forexBatchNumber;
            bool  blnRevalutationState =
                TRemote.MFinance.GL.WebConnectors.Revaluate(FLedgerNumber,
                                                            foreignAccounts, foreignCurrencies, rates, ToCostCentre, out forexBatchNumber, out verificationResult);

            this.Cursor = Cursors.Default;

            String Message = verificationResult.BuildVerificationResultString();

            if (blnRevalutationState)
            {
                TFrmBatchPostingRegister glReportGui = new TFrmBatchPostingRegister(this);
                glReportGui.PrintReportNoUi(FLedgerNumber, forexBatchNumber);

                // Notify the exchange rate screen, if it is there
                TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcGLOrGiftBatchSaved, this.ToString());
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
            }

            if (Message == "")
            {
                Message = Catalog.GetString("Revaluation Successful.");
            }

            MessageBox.Show(Message, Catalog.GetString("Revaluation"));

            this.Close();
        }
        /// <summary>
        /// Reverse all tagged rows
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ReverseAllTagged(object sender, EventArgs e)
        {
            // This will throw an exception if insufficient permissions
            TSecurityChecks.CheckUserModulePermissions("FINANCE-2", "ReverseAllTagged [raised by Client Proxy for ModuleAccessManager]");

            string MsgTitle = Catalog.GetString("Document Reversal");

            // I can only reverse invoices that are POSTED.
            // This method is only enabled when the grid shows rows for paying
            // This will include rows that are PARTPAID - we need to test for those
            List <int> ReverseTheseDocs = new List <int>();
            int        taggedCount      = 0;

            foreach (DataRowView rv in grdInvoices.PagedDataTable.DefaultView)
            {
                if (rv.Row["Selected"].Equals(true))
                {
                    taggedCount++;

                    if (MFinanceConstants.AP_DOCUMENT_POSTED == rv.Row["DocumentStatus"].ToString())
                    {
                        ReverseTheseDocs.Add(Convert.ToInt32(rv.Row["ApDocumentId"]));
                    }
                }
            }

            if (ReverseTheseDocs.Count < taggedCount)
            {
                string msg = Catalog.GetString("A document cannot be reversed if it has been part-paid.");

                if (ReverseTheseDocs.Count == 0)
                {
                    MessageBox.Show(msg, MsgTitle);
                }
                else
                {
                    msg += Environment.NewLine + Environment.NewLine;
                    msg += Catalog.GetString("Do you want to continue and reverse the 'Posted' documents?");

                    if (MessageBox.Show(msg, MsgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
            }

            if (ReverseTheseDocs.Count > 0)
            {
                TVerificationResultCollection Verifications;
                TDlgGLEnterDateEffective      dateEffectiveDialog = new TDlgGLEnterDateEffective(
                    FMainForm.LedgerNumber,
                    Catalog.GetString("Select reversal date"),
                    Catalog.GetString("The date effective for this reversal") + ":");

                if (dateEffectiveDialog.ShowDialog(FMainForm) != DialogResult.OK)
                {
                    MessageBox.Show(Catalog.GetString("Reversal was cancelled."), MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                DateTime PostingDate = dateEffectiveDialog.SelectedDate;

                this.Cursor = Cursors.WaitCursor;
                Int32 glBatchNumber;

                if (TRemote.MFinance.AP.WebConnectors.PostAPDocuments(
                        FMainForm.LedgerNumber,
                        ReverseTheseDocs,
                        PostingDate,
                        true,
                        out glBatchNumber,
                        out Verifications))
                {
                    if (glBatchNumber >= 0)
                    {
                        TFrmBatchPostingRegister ReportGui = new TFrmBatchPostingRegister(null);
                        ReportGui.PrintReportNoUi(FMainForm.LedgerNumber, glBatchNumber);
                    }

                    this.Cursor = Cursors.Default;
                    MessageBox.Show(Catalog.GetString("The tagged invoices have been reversed to 'Approved' status."), MsgTitle);
                    FMainForm.IsInvoiceDataChanged = true;

                    LoadInvoices();
                    return;
                }
                else
                {
                    this.Cursor = Cursors.Default;
                    string ErrorMessages = Verifications.BuildVerificationResultString();
                    MessageBox.Show(ErrorMessages, MsgTitle);
                }
            }
            else
            {
                MessageBox.Show(Catalog.GetString("There are no tagged invoices to be reversed."), MsgTitle);
            }
        }
        private void StewardshipCalculation(Object Sender, EventArgs e)
        {
            if (!ValidReportPeriod())
            {
                return;
            }

            TVerificationResultCollection VerificationResult = null;

            try
            {
                Cursor = Cursors.WaitCursor;
                List <Int32> glBatchNumbers;

                Boolean retVal = TRemote.MFinance.ICH.WebConnectors.PerformStewardshipCalculation(
                    FLedgerNumber,
                    cmbReportPeriod.GetSelectedInt32(),
                    out glBatchNumbers,
                    out VerificationResult);

                TFrmBatchPostingRegister ReportGui = new TFrmBatchPostingRegister(null);

                foreach (Int32 glBatchNumber in glBatchNumbers)
                {
                    if (glBatchNumber > 0)
                    {
                        ReportGui.PrintReportNoUi(FLedgerNumber, glBatchNumber);
                    }
                }

                Cursor = Cursors.Default;
                String ResultMsg =
                    (retVal ? Catalog.GetString("Stewardship Calculation Completed Successfully")
                     : Catalog.GetString("UNSUCCESSFUL Stewardship Calculation!"));

                MessageBox.Show(Messages.BuildMessageFromVerificationResult(ResultMsg, VerificationResult),
                                Catalog.GetString("Stewardship Calculation"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);

                if (retVal)
                {
                    Close();
                }
                else
                {
                    btnCancel.Text = "Close";
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                TLogging.LogException(ex, Utilities.GetMethodSignature());
                MessageBox.Show(String.Format(Catalog.GetString(
                                                  "An unexpected error occurred when trying to perform the Stewardship Calculation!{0}{0}Error: {1}"),
                                              Environment.NewLine, ex.Message),
                                Catalog.GetString("Stewardship Calculation"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }