Exemple #1
0
        /// <summary>
        /// Loads all available AnalTypeCodes into the Combo, ensuring that the current value is allowed!
        ///
        /// Any types for which there are currently no values are already excluded.
        /// </summary>
        private void LoadCmbAnalType(String AalwaysAllow)
        {
            FAnalysisTypesForCombo              = new DataView(FMainDS.AAnalysisType);
            FAnalysisTypesForCombo.Sort         = AAnalysisTypeTable.GetAnalysisTypeCodeDBName();
            cmbDetailAnalTypeCode.DisplayMember = "a_analysis_type_code_c";
            cmbDetailAnalTypeCode.ValueMember   = "a_analysis_type_code_c";
            String Filter = "";

            foreach (DataRowView rv in FMainDS.AAnalysisAttribute.DefaultView)
            {
                AAnalysisAttributeRow AttrRow = (AAnalysisAttributeRow)rv.Row;

                if (AttrRow.AnalysisTypeCode == AalwaysAllow) // The currently assigned value is always allowed!
                {
                    continue;
                }

                if (Filter != "")
                {
                    Filter += ",";
                }

                Filter += "'" + AttrRow.AnalysisTypeCode + "'";
            }

            if (Filter != "")
            {
                FAnalysisTypesForCombo.RowFilter = "a_analysis_type_code_c NOT IN (" + Filter + ")";
            }

            cmbDetailAnalTypeCode.DataSource = FAnalysisTypesForCombo;
        }
Exemple #2
0
 private void NewRowManual(ref AAnalysisAttributeRow ARow)
 {
     ARow.LedgerNumber     = FLedgerNumber;
     ARow.Active           = true;
     ARow.AccountCode      = FAccountCode;
     ARow.AnalysisTypeCode = "Unassigned";
 }
Exemple #3
0
 private void PostDeleteManual(AAnalysisAttributeRow ARowToDelete,
                               bool AAllowDeletion,
                               bool ADeletionPerformed,
                               string ACompletionMessage)
 {
     if (ADeletionPerformed)
     {
         //Warn the user that if either GL Batch or Recurring GL Batch forms are open
         // they must be closed and reopened for the changes to apply.
         WarnUserAboutAffects();
     }
 }
Exemple #4
0
        private bool DeleteRowManual(AAnalysisAttributeRow ARowToDelete, ref string ACompletionMessage)
        {
            bool success = false;

            try
            {
                ARowToDelete.Delete();
                success = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error trying to delete current row:" + Environment.NewLine + Environment.NewLine + ex.Message);
            }

            return(success);
        }
Exemple #5
0
 private void ShowDetailsManual(AAnalysisAttributeRow ARow)
 {
     if ((ARow != null) && !FIamUpdating)  // How can ARow ever be null!!
     {
         FIamUpdating = true;
         LoadCmbAnalType(ARow.AnalysisTypeCode);
         cmbDetailAnalTypeCode.Text = ARow.AnalysisTypeCode;
         String  ServerMessage;
         Boolean CanBeChanged = TRemote.MFinance.Setup.WebConnectors.CanDetachTypeCodeFromAccount(ARow.LedgerNumber,
                                                                                                  ARow.AccountCode,
                                                                                                  ARow.AnalysisTypeCode,
                                                                                                  out ServerMessage);
         btnDelete.Enabled             = CanBeChanged;
         cmbDetailAnalTypeCode.Enabled = CanBeChanged;
         FIamUpdating = false;
     }
 }
Exemple #6
0
        void RemoveUnassignedRecords()
        {
            for (Int32 i = FMainDS.AAnalysisAttribute.Rows.Count; i > 0; i--)
            {
                AAnalysisAttributeRow Row = FMainDS.AAnalysisAttribute[i - 1];

                if (Row.RowState != DataRowState.Deleted)
                {
                    if (Row.AnalysisTypeCode.StartsWith("Unassigned"))
                    {
                        Row.Delete();
                    }
                }
            }

            if ((FPreviouslySelectedDetailRow != null) && (FPreviouslySelectedDetailRow.RowState == DataRowState.Detached))
            {
                FPreviouslySelectedDetailRow = null;
            }
        }
Exemple #7
0
        private TSubmitChangesResult StoreManualCode(ref GLSetupTDS ASubmitDS, out TVerificationResultCollection AVerificationResult)
        {
            //
            // I need to remove any AnalysisAttribute records that are still set to "Unassigned"
            //
            if ((ASubmitDS.AAnalysisAttribute != null) && (ASubmitDS.AAnalysisAttribute.Rows.Count > 0))
            {
                for (int Idx = ASubmitDS.AAnalysisAttribute.Rows.Count - 1; Idx >= 0; Idx--)
                {
                    AAnalysisAttributeRow Row = ASubmitDS.AAnalysisAttribute[Idx];

                    if ((Row.RowState != DataRowState.Deleted) && (Row.AnalysisTypeCode.IndexOf("Unassigned") == 0))
                    {
                        Row.Delete();
                    }
                }
            }

            //
            // I'll take this opportunity to remove any similar records in my own TDS
            //
            for (int Idx = FMainDS.AAnalysisAttribute.Rows.Count - 1; Idx >= 0; Idx--)
            {
                AAnalysisAttributeRow Row = FMainDS.AAnalysisAttribute[Idx];

                if ((Row.RowState != DataRowState.Deleted) && (Row.AnalysisTypeCode.IndexOf("Unassigned") == 0))
                {
                    Row.Delete();
                }
            }

            ucoAccountsTree.MarkAllNodesCommitted();
            TSubmitChangesResult ServerResult =
                TRemote.MFinance.Setup.WebConnectors.SaveGLSetupTDS(FLedgerNumber, ref ASubmitDS, out AVerificationResult);

            TDataCache.TMFinance.RefreshCacheableFinanceTable(Shared.TCacheableFinanceTablesEnum.AccountList, FLedgerNumber);
            return(ServerResult);
        }
Exemple #8
0
        private bool PreDeleteManual(AAnalysisAttributeRow ARowToDelete, ref string ADeletionQuestion)
        {
            // I can't delete any Analysis Type code that's been used in transactions.
            if ((ARowToDelete != null) && (ARowToDelete.RowState != DataRowState.Deleted))
            {
                String ServerMessage;

                if (TRemote.MFinance.Setup.WebConnectors.CanDetachTypeCodeFromAccount(ARowToDelete.LedgerNumber, ARowToDelete.AccountCode,
                                                                                      ARowToDelete.AnalysisTypeCode, out ServerMessage))
                {
                    ADeletionQuestion = String.Format(
                        Catalog.GetString("Confirm you want to Remove {0} from this account."),
                        ARowToDelete.AnalysisTypeCode);
                    return(true);
                }
                else // The server reports that this can't be deleted.
                {
                    MessageBox.Show(ServerMessage, Catalog.GetString("Delete Analysis Type"));
                }
            }

            return(false);
        }
        private static bool DetailLineAttributesRequired(ref bool AllPresent, AccountsPayableTDS Atds, AApDocumentDetailRow DetailRow)
        {
            Atds.AAnalysisAttribute.DefaultView.RowFilter =
                String.Format("{0}='{1}'", AAnalysisAttributeTable.GetAccountCodeDBName(), DetailRow.AccountCode);

            if (Atds.AAnalysisAttribute.DefaultView.Count > 0)
            {
                bool IhaveAllMyAttributes = true;

                //
                // It's possible that my TDS doesn't even have an AnalAttrib table...

                if (Atds.AApAnalAttrib == null)
                {
                    Atds.Merge(new AApAnalAttribTable());
                }

                foreach (DataRowView rv in Atds.AAnalysisAttribute.DefaultView)
                {
                    AAnalysisAttributeRow AttrRow = (AAnalysisAttributeRow)rv.Row;

                    Atds.AApAnalAttrib.DefaultView.RowFilter =
                        String.Format("{0}={1} AND {2}='{3}'",
                                      AApAnalAttribTable.GetDetailNumberDBName(), DetailRow.DetailNumber,
                                      AApAnalAttribTable.GetAccountCodeDBName(), AttrRow.AccountCode);

                    if (Atds.AApAnalAttrib.DefaultView.Count == 0)
                    {
                        IhaveAllMyAttributes = false;
                        break;
                    }

                    foreach (DataRowView rv2 in Atds.AApAnalAttrib.DefaultView)
                    {
                        AApAnalAttribRow AttribValueRow = (AApAnalAttribRow)rv2.Row;

                        if (AttribValueRow.AnalysisAttributeValue == "")
                        {
                            IhaveAllMyAttributes = false;
                            break;
                        }

                        // Is the referenced AttribValue active?
                        AFreeformAnalysisRow referencedRow = (AFreeformAnalysisRow)Atds.AFreeformAnalysis.Rows.Find(
                            new Object[] { AttribValueRow.LedgerNumber, AttribValueRow.AnalysisTypeCode, AttribValueRow.AnalysisAttributeValue }
                            );

                        if ((referencedRow == null) || !referencedRow.Active)
                        {
                            IhaveAllMyAttributes = false;
                            break;
                        }
                    }

                    if (IhaveAllMyAttributes == false)  // because of the test above..
                    {
                        break;
                    }
                }

                AllPresent = IhaveAllMyAttributes;
                return(true);
            }
            else
            {
                AllPresent = true; // This detail line is fully specified
                return(false);     // No attributes are required
            }
        }
 private void GetDetailDataFromControlsManual(AAnalysisAttributeRow ARow)
 {
 }
 private void PostDeleteManual(AAnalysisAttributeRow ARowToDelete,
     bool AAllowDeletion,
     bool ADeletionPerformed,
     string ACompletionMessage)
 {
 }
        private bool DeleteRowManual(AAnalysisAttributeRow ARowToDelete, ref string ACompletionMessage)
        {
            bool success = false;

            try
            {
                ARowToDelete.Delete();
                success = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error trying to delete current row:" + Environment.NewLine + Environment.NewLine + ex.Message);
            }

            return success;
        }
        private bool PreDeleteManual(AAnalysisAttributeRow ARowToDelete, ref string ADeletionQuestion)
        {
            // I can't delete any Analysis Type code that's been used in transactions.
            if ((ARowToDelete != null) && (ARowToDelete.RowState != DataRowState.Deleted))
            {
                String ServerMessage;

                if (TRemote.MFinance.Setup.WebConnectors.CanDetachTypeCodeFromAccount(ARowToDelete.LedgerNumber, ARowToDelete.AccountCode,
                        ARowToDelete.AnalysisTypeCode, out ServerMessage))
                {
                    ADeletionQuestion = String.Format(
                        Catalog.GetString("Confirm you want to Remove {0} from this account."),
                        ARowToDelete.AnalysisTypeCode);
                    return true;
                }
                else // The server reports that this can't be deleted.
                {
                    MessageBox.Show(ServerMessage, Catalog.GetString("Delete Analysis Type"));
                }
            }

            return false;
        }
 private void NewRowManual(ref AAnalysisAttributeRow ARow)
 {
     ARow.LedgerNumber = FLedgerNumber;
     ARow.Active = true;
     ARow.AccountCode = FAccountCode;
     ARow.AnalysisTypeCode = "Unassigned";
 }
Exemple #15
0
 private void GetDetailDataFromControlsManual(AAnalysisAttributeRow ARow)
 {
 }
        //
        // Called from cmbDetailAccountCode.SelectedValueChanged,
        // I need to load the Analysis Types Pane with the required attributes for this account,
        // and show any assignments already made.

        void ShowAnalysisAttributesForAccount(object sender, EventArgs e)
        {
            //
            // It's possible that my TDS doesn't even have an AnalAttrib table...

            if (FMainDS.AApAnalAttrib == null)
            {
                FMainDS.Merge(new AApAnalAttribTable());
            }

            if (FPetraUtilsObject.SuppressChangeDetection || (FPreviouslySelectedDetailRow == null))
            {
                return;
            }

            //Empty the grid
            FMainDS.AApAnalAttrib.DefaultView.RowFilter = "1=2";
            FPSAttributesRow = null;

            if (grdAnalAttributes.Columns.Count < 2) // This is initialisation but I moved it here because sometimes this is called before Show().
            {
                grdAnalAttributes.SpecialKeys = GridSpecialKeys.Default | GridSpecialKeys.Tab;

                cmbAnalAttribValues = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
                cmbAnalAttribValues.Control.DropDownStyle         = ComboBoxStyle.DropDownList;
                cmbAnalAttribValues.EnableEdit                    = true;
                cmbAnalAttribValues.EditableMode                  = EditableMode.Focus;
                cmbAnalAttribValues.Control.SelectedValueChanged += new EventHandler(AnalysisAttributeValueChanged);
                grdAnalAttributes.AddTextColumn("Value",
                                                FMainDS.AApAnalAttrib.Columns[AApAnalAttribTable.GetAnalysisAttributeValueDBName()], 120,
                                                cmbAnalAttribValues);

                grdAnalAttributes.Selection.SelectionChanged += new RangeRegionChangedEventHandler(AnalysisAttributesGrid_RowSelected);
            }

            grdAnalAttributes.Columns[0].Width = 90; // for some unknown reason, this doesn't work.
            grdAnalAttributes.Columns[1].Width = 120;

            AccountsPayableTDSAApDocumentDetailRow DetailRow = GetSelectedDetailRow();

            DetailRow.AccountCode = cmbDetailAccountCode.GetSelectedString();

            //
            // So I want to remove any attributes attached to this row that don't have the new account code...
            FMainDS.AApAnalAttrib.DefaultView.RowFilter = String.Format("{0}={1} AND {2}={3} AND {4}={5} AND {6}<>'{7}'",
                                                                        AApAnalAttribTable.GetLedgerNumberDBName(), DetailRow.LedgerNumber,
                                                                        AApAnalAttribTable.GetApDocumentIdDBName(), DetailRow.ApDocumentId,
                                                                        AApAnalAttribTable.GetDetailNumberDBName(), DetailRow.DetailNumber,
                                                                        AApAnalAttribTable.GetAccountCodeDBName(), DetailRow.AccountCode);

            for (Int32 RowIdx = FMainDS.AApAnalAttrib.DefaultView.Count; RowIdx > 0; RowIdx--)
            {
                FMainDS.AApAnalAttrib.DefaultView[RowIdx - 1].Row.Delete();
            }

            FMainDS.AAnalysisAttribute.DefaultView.RowFilter =
                String.Format("{0}='{1}'", AAnalysisAttributeTable.GetAccountCodeDBName(), DetailRow.AccountCode);

            String AccountCodeRowFilter = String.Format("{0}={1} AND {2}={3} AND {4}={5} AND {6}='{7}'",
                                                        AApAnalAttribTable.GetLedgerNumberDBName(), DetailRow.LedgerNumber,
                                                        AApAnalAttribTable.GetApDocumentIdDBName(), DetailRow.ApDocumentId,
                                                        AApAnalAttribTable.GetDetailNumberDBName(), DetailRow.DetailNumber,
                                                        AApAnalAttribTable.GetAccountCodeDBName(), DetailRow.AccountCode);

            foreach (DataRowView rv in FMainDS.AAnalysisAttribute.DefaultView) // List of attributes required for this account
            {
                AAnalysisAttributeRow AttrRow = (AAnalysisAttributeRow)rv.Row;

                FMainDS.AApAnalAttrib.DefaultView.RowFilter = AccountCodeRowFilter +
                                                              String.Format(" AND {0}='{1}'",
                                                                            AApAnalAttribTable.GetAnalysisTypeCodeDBName(), AttrRow.AnalysisTypeCode);

                if (FMainDS.AApAnalAttrib.DefaultView.Count == 0)   // No Entry yet for this attribute. This is likely, given I just deleted everything...
                {
                    AApAnalAttribRow AARow = FMainDS.AApAnalAttrib.NewRowTyped();
                    AARow.LedgerNumber     = DetailRow.LedgerNumber;
                    AARow.ApDocumentId     = DetailRow.ApDocumentId;
                    AARow.DetailNumber     = DetailRow.DetailNumber;
                    AARow.AnalysisTypeCode = AttrRow.AnalysisTypeCode;
                    AARow.AccountCode      = DetailRow.AccountCode;
                    FMainDS.AApAnalAttrib.Rows.Add(AARow);
                }
            }

            FMainDS.AApAnalAttrib.DefaultView.RowFilter = AccountCodeRowFilter;
            FMainDS.AApAnalAttrib.DefaultView.Sort      = AApAnalAttribTable.GetAnalysisTypeCodeDBName();

            grdAnalAttributes.DataSource = null;
            grdAnalAttributes.DataSource = new DevAge.ComponentModel.BoundDataView(FMainDS.AApAnalAttrib.DefaultView);
            UpdateAttributeLabel(DetailRow);

            if (grdAnalAttributes.Rows.Count > 2)
            {
                grdAnalAttributes.Enabled = true;
                grdAnalAttributes.SelectRowWithoutFocus(1);
                AnalysisAttributesGrid_RowSelected(null, null);
            }
            else
            {
                grdAnalAttributes.Enabled = false;
            }
        }
 private void ShowDetailsManual(AAnalysisAttributeRow ARow)
 {
     if ((ARow != null) && !FIamUpdating)  // How can ARow ever be null!!
     {
         FIamUpdating = true;
         LoadCmbAnalType(ARow.AnalysisTypeCode);
         cmbDetailAnalTypeCode.Text = ARow.AnalysisTypeCode;
         String ServerMessage;
         Boolean CanBeChanged = TRemote.MFinance.Setup.WebConnectors.CanDetachTypeCodeFromAccount(ARow.LedgerNumber,
             ARow.AccountCode,
             ARow.AnalysisTypeCode,
             out ServerMessage);
         btnDelete.Enabled = CanBeChanged;
         cmbDetailAnalTypeCode.Enabled = CanBeChanged;
         FIamUpdating = false;
     }
 }
Exemple #18
0
 private void PostDeleteManual(AAnalysisAttributeRow ARowToDelete,
                               bool AAllowDeletion,
                               bool ADeletionPerformed,
                               string ACompletionMessage)
 {
 }