Exemplo n.º 1
0
        /// <summary>
        /// Refresh the data in the grid and the details after the database content was changed on the server
        /// </summary>
        public void RefreshAllData()
        {
            if ((FMainDS != null) && (FMainDS.ARecurringGiftBatch != null))
            {
                // Remove all data from our DataSet object - the grid will go empty!
                FMainDS.ARecurringGiftBatch.Rows.Clear();
            }

            try
            {
                FPetraUtilsObject.DisableDataChangedEvent();
                LoadRecurringBatches(FLedgerNumber);

                TUC_RecurringGiftTransactions TransactionForm = ((TFrmRecurringGiftBatch)ParentForm).GetTransactionsControl();

                if (TransactionForm != null)
                {
                    ((TFrmRecurringGiftBatch)ParentForm).EnableTransactions((grdDetails.Rows.Count > 1));

                    // if the batch number = -1 then this is not a valid instance of TUC_GiftTransactions and we do not need to refresh
                    if (TransactionForm.FBatchNumber != -1)
                    {
                        // This will update the transactions to match the current batch
                        TransactionForm.RefreshData();
                    }
                }
            }
            finally
            {
                FPetraUtilsObject.EnableDataChangedEvent();
            }
        }
        /// <summary>
        /// update the journal header fields from a batch
        /// </summary>
        /// <param name="ABatchRowToUpdate"></param>
        public void UpdateHeaderTotals(ARecurringBatchRow ABatchRowToUpdate)
        {
            decimal SumDebits  = 0.0M;
            decimal SumCredits = 0.0M;

            DataView JournalDV = new DataView(FMainDS.ARecurringJournal);

            JournalDV.RowFilter = String.Format("{0}={1}",
                                                ARecurringJournalTable.GetBatchNumberDBName(),
                                                ABatchRowToUpdate.BatchNumber);
            JournalDV.RowStateFilter = DataViewRowState.CurrentRows;

            foreach (DataRowView v in JournalDV)
            {
                ARecurringJournalRow r = (ARecurringJournalRow)v.Row;

                SumCredits += r.JournalCreditTotal;
                SumDebits  += r.JournalDebitTotal;
            }

            FPetraUtilsObject.DisableDataChangedEvent();

            txtDebit.NumberValueDecimal   = SumDebits;
            txtCredit.NumberValueDecimal  = SumCredits;
            txtControl.NumberValueDecimal = ABatchRowToUpdate.BatchControlTotal;

            FPetraUtilsObject.EnableDataChangedEvent();
        }
        /// <summary>
        /// Refresh the data in the grid and the details after the database content was changed on the server
        /// The current filter is not changed.  The highlighted row index remains the same (if possible) after the refresh.
        /// </summary>
        public void RefreshAllData()
        {
            // Remember our current row position
            int nCurrentRowIndex    = GetSelectedRowIndex();
            int nCurrentBatchNumber = -1;

            if (FPreviouslySelectedDetailRow != null)
            {
                nCurrentBatchNumber = FPreviouslySelectedDetailRow.BatchNumber;
            }

            TFrmGiftBatch parentForm = (TFrmGiftBatch)ParentForm;
            Cursor        prevCursor = parentForm.Cursor;

            parentForm.Cursor = Cursors.WaitCursor;

            if ((FMainDS != null) && (FMainDS.AGiftBatch != null))
            {
                // Remove all data from our DataSet object - the grid will go empty!
                FMainDS.AGiftBatch.Rows.Clear();
            }

            try
            {
                FPetraUtilsObject.DisableDataChangedEvent();

                // Calling ApplyFilter() will automatically load the data for the currently selected year
                //  because our ApplyFilterManual() code will do that for us
                FFilterAndFindObject.ApplyFilter();

                // Now we can select the gift batch we had before (if it still exists on the grid)
                if (!SelectBatchNumber(nCurrentBatchNumber))
                {
                    // If batch is no longer in the grid then select the batch that is in the same position
                    SelectRowInGrid(nCurrentRowIndex);
                }

                UpdateRecordNumberDisplay();

                TUC_GiftTransactions TransactionForm = parentForm.GetTransactionsControl();

                if (TransactionForm != null)
                {
                    parentForm.EnableTransactions(grdDetails.Rows.Count > 1);

                    // if the batch number = -1 then this is not a valid instance of TUC_GiftTransactions and we do not need to refresh
                    if (TransactionForm.FBatchNumber != -1)
                    {
                        // This will update the transactions to match the current batch
                        TransactionForm.RefreshAllData();
                    }
                }
            }
            finally
            {
                FPetraUtilsObject.EnableDataChangedEvent();
                parentForm.Cursor = prevCursor;
            }
        }
Exemplo n.º 4
0
 private void ClearDetailControls()
 {
     FPetraUtilsObject.DisableDataChangedEvent();
     txtDetailBatchDescription.Text = string.Empty;
     txtDetailBatchControlTotal.NumberValueDecimal = 0;
     dtpDetailDateEffective.Date = FDefaultDate;
     FPetraUtilsObject.EnableDataChangedEvent();
 }
        private void ClearControls()
        {
            FPetraUtilsObject.DisableDataChangedEvent();

            txtDetailJournalDescription.Clear();
            cmbDetailTransactionTypeCode.SelectedIndex = -1;
            cmbDetailTransactionCurrency.SelectedIndex = -1;

            FPetraUtilsObject.EnableDataChangedEvent();
        }
Exemplo n.º 6
0
 private void ClearControls()
 {
     FPetraUtilsObject.DisableDataChangedEvent();
     txtLedgerNumber.Clear();
     txtBatchNumber.Clear();
     txtJournalNumber.Clear();
     txtTransactionNumber.Clear();
     txtReadonlyAnalysisTypeCode.Clear();
     txtReadonlyDescription.Clear();
     cmbDetailAnalysisAttributeValue.Enabled = false;
     FPetraUtilsObject.EnableDataChangedEvent();
 }
Exemplo n.º 7
0
        private void ShowDetailsManual(GLSetupTDSAAccountRow ARow)
        {
            if (ARow != null)
            {
                strOldDetailAccountCode = txtDetailAccountCode.Text;

                ucoAccountAnalysisAttributes.Enabled = ARow.PostingStatus;
                // This call to an external user control resets change detection suppression so we need to re-enable it
                ucoAccountAnalysisAttributes.AccountCode = ARow.AccountCode;
                FPetraUtilsObject.DisableDataChangedEvent();

                chkDetailForeignCurrencyFlag.Enabled = (ARow.PostingStatus && !ARow.SystemAccountFlag);
                chkDetailBankAccountFlag.Enabled     = !ARow.SystemAccountFlag;
                chkDetailBudgetControlFlag.Enabled   = !ARow.SystemAccountFlag &&
                                                       FMainDS.ALedger[0].BudgetControlFlag;
                lblDetailBudgetControlFlag.Enabled = FMainDS.ALedger[0].BudgetControlFlag;

                cmbDetailForeignCurrencyCode.Enabled = (ARow.PostingStatus && !ARow.SystemAccountFlag && ARow.ForeignCurrencyFlag);

                chkDetailIsSummary.Checked = !ARow.PostingStatus;
                chkDetailIsSummary.Enabled = !ARow.SystemAccountFlag;

                //
                // Reporting Order is in AAccountHierarchyDetail

                FMainDS.AAccountHierarchyDetail.DefaultView.RowFilter = String.Format("{0}='{1}'",
                                                                                      AAccountHierarchyDetailTable.GetReportingAccountCodeDBName(), ARow.AccountCode);
                String txtReportingOrder = "";

                if (FMainDS.AAccountHierarchyDetail.DefaultView.Count > 0)
                {
                    txtReportingOrder = ((AAccountHierarchyDetailRow)FMainDS.AAccountHierarchyDetail.DefaultView[0].Row).ReportOrder.ToString();
                }

                txtRptOrder.Text = txtReportingOrder;
//              txtRptOrder.Enabled = !ARow.SystemAccountFlag;

                if (!ARow.ForeignCurrencyFlag)
                {
                    cmbDetailForeignCurrencyCode.SelectedIndex = -1;
                    ARow.ForeignCurrencyCode = "";
                }

                chkDetailAccountActiveFlag.Enabled = !ARow.SystemAccountFlag;

                // I allow the user to attempt to change the primary key,
                // but if the selected record is not new, AND they have made any other changes,
                // the txtDetailAccountCode _TextChanged method will disallow any change.
                SetPrimaryKeyReadOnly(false);
                btnRename.Visible = false;
            }
        }
Exemplo n.º 8
0
 private void ClearControls()
 {
     try
     {
         FPetraUtilsObject.DisableDataChangedEvent();
         txtDetailBatchDescription.Clear();
         txtDetailBatchControlTotal.NumberValueDecimal = 0;
     }
     finally
     {
         FPetraUtilsObject.EnableDataChangedEvent();
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Call this method when the Contact Attribute changes in the Contact Attribute grid on the parent Form.
        /// </summary>
        /// <param name="ANewCode">The Contact Attribute code as in the parent Form.</param>
        public void SetContactAttribute(string ANewCode)
        {
            // Save the current data
            ValidateAllData(true, TErrorProcessingMode.Epm_None);

            // Save the current contact attribute in our member variable
            FContactAttribute = ANewCode;

            FPetraUtilsObject.DisableDataChangedEvent();

            pnlDetails.Enabled = false;

            if (FMainDS.PContactAttributeDetail != null)
            {
                FilterOnCode(ANewCode, GetSelectedRowIndex());
            }

            FPetraUtilsObject.EnableDataChangedEvent();

            UpdateRecordNumberDisplay();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Call this method when the Contact Category changes in the Contact Category grid on the parent Form.
        /// </summary>
        /// <param name="ANewCode">The Contact Category code as in the parent Form.</param>
        public void SetCategoryCode(string ANewCode)
        {
            // Save the current data
            ValidateAllData(true, false);

            // Save the current contact attribute in our member variable
            FContactCategory = ANewCode;

            FPetraUtilsObject.DisableDataChangedEvent();

            pnlDetails.Enabled = false;

            if (FMainDS.PPartnerAttributeType != null)
            {
                FilterOnCode(ANewCode, GetSelectedRowIndex());
            }

            FPetraUtilsObject.EnableDataChangedEvent();

            UpdateRecordNumberDisplay();
        }
Exemplo n.º 11
0
        /// <summary>
        /// Refresh the data in the grid and the details after the database content was changed on the server
        /// </summary>
        public void RefreshAllData(bool AShowStatusDialogOnLoad = true, bool AIsMessageRefresh = false)
        {
            TFrmRecurringGiftBatch myParentForm = (TFrmRecurringGiftBatch)ParentForm;

            // Remember our current row position
            int nCurrentRowIndex    = GetSelectedRowIndex();
            int nCurrentBatchNumber = -1;

            if ((myParentForm != null) && (myParentForm.InitialBatchNumber > 0))
            {
                nCurrentBatchNumber             = myParentForm.InitialBatchNumber;
                myParentForm.InitialBatchNumber = -1;
            }
            else if (AIsMessageRefresh)
            {
                if (FPetraUtilsObject.HasChanges && !myParentForm.SaveChanges())
                {
                    string msg = String.Format(Catalog.GetString("A validation error has occured on the Recurring Gift Batches" +
                                                                 " form while trying to refresh.{0}{0}" +
                                                                 "You will need to close and reopen the Recurring Gift Batches form to see the new batch" +
                                                                 " after you have fixed the validation error."),
                                               Environment.NewLine);

                    MessageBox.Show(msg, "Refresh Recurring Gift Batches");
                    return;
                }

                nCurrentBatchNumber = 1;
            }
            else if (FPreviouslySelectedDetailRow != null)
            {
                nCurrentBatchNumber = FPreviouslySelectedDetailRow.BatchNumber;
            }

            TFrmRecurringGiftBatch parentForm = (TFrmRecurringGiftBatch)ParentForm;
            Cursor prevCursor = null;

            if (parentForm != null)
            {
                prevCursor = parentForm.Cursor;
            }
            else
            {
                prevCursor = this.Cursor;
            }

            parentForm.Cursor = Cursors.WaitCursor;

            if ((FMainDS != null) && (FMainDS.ARecurringGiftBatch != null))
            {
                // Remove all data from our DataSet object - the grid will go empty!
                FMainDS.ARecurringGiftBatch.Rows.Clear();
            }

            try
            {
                FPetraUtilsObject.DisableDataChangedEvent();

                FMainDS.Merge(TRemote.MFinance.Gift.WebConnectors.LoadARecurringGiftBatch(FLedgerNumber));

                // Now we can select the gift batch we had before (if it still exists on the grid)
                for (int i = 0; (i < FMainDS.ARecurringGiftBatch.Rows.Count); i++)
                {
                    if (FMainDS.ARecurringGiftBatch[i].BatchNumber == nCurrentBatchNumber)
                    {
                        DataView dv            = ((DevAge.ComponentModel.BoundDataView)grdDetails.DataSource).DataView;
                        Int32    RowNumberGrid = DataUtilities.GetDataViewIndexByDataTableIndex(dv, FMainDS.ARecurringGiftBatch, i) + 1;

                        nCurrentRowIndex = RowNumberGrid;
                        break;
                    }
                }

                ShowDetails(nCurrentRowIndex);

                UpdateRecordNumberDisplay();

                TUC_RecurringGiftTransactions TransactionForm = parentForm.GetTransactionsControl();

                if (TransactionForm != null)
                {
                    parentForm.EnableTransactions(grdDetails.Rows.Count > 1);

                    // if the batch number = -1 then this is not a valid instance of TUC_GiftTransactions and we do not need to refresh
                    if (TransactionForm.FBatchNumber != -1)
                    {
                        TransactionForm.ShowStatusDialogOnLoad = AShowStatusDialogOnLoad;

                        // This will update the transactions to match the current batch
                        TransactionForm.RefreshData();

                        TransactionForm.ShowStatusDialogOnLoad = true;
                    }
                }
            }
            finally
            {
                FPetraUtilsObject.EnableDataChangedEvent();
                parentForm.Cursor = prevCursor;
            }
        }