Ejemplo n.º 1
0
        /// <summary>
        /// Populates the Cost Centre, Account Code and DR Account Code ComboBoxes.
        /// </summary>
        /// <param name="ACostCentreComboBox">Cost Centre ComboBox Control</param>
        /// <param name="AAccountCodeComboBox">Account Code ComboBox Control</param>
        /// <param name="ADrAccountCodeComboBox">DR Account Code ComboBox Control</param>
        /// <param name="ALedgerNumber">Ledger Number</param>
        /// <param name="ACalledByReceivableScreen">Set this to true if the 'Admin Grants Receivable' screen is calling this Method.</param>
        public static void PopulateComboBoxes(TCmbAutoPopulated ACostCentreComboBox,
            TCmbAutoPopulated AAccountCodeComboBox,
            TCmbAutoPopulated ADrAccountCodeComboBox,
            Int32 ALedgerNumber,
            bool ACalledByReceivableScreen)
        {
            string filter = String.Empty;

            DataTable CostCentreListTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.CostCentreList, ALedgerNumber);

            CostCentreListTable.DefaultView.Sort = ACostCentreTable.GetCostCentreNameDBName() + " ASC";

            if (ACalledByReceivableScreen)
            {
                filter = ACostCentreTable.GetPostingCostCentreFlagDBName() + " = true AND " +
                         ACostCentreTable.GetCostCentreTypeDBName() + " = 'Local'";
            }
            else
            {
                filter = ACostCentreTable.GetPostingCostCentreFlagDBName() + " = true";
            }

            ACostCentreComboBox.InitialiseUserControl(CostCentreListTable,
                ACostCentreTable.GetCostCentreCodeDBName(), ACostCentreTable.GetCostCentreNameDBName(), null);
            ACostCentreComboBox.AppearanceSetup(new int[] { -1, 300 }, 20);
            ACostCentreComboBox.Filter = filter;

            DataTable AccountListTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountList, ALedgerNumber);
            AccountListTable.DefaultView.Sort = AAccountTable.GetAccountCodeDBName() + " ASC";
            filter = AAccountTable.GetPostingStatusDBName() + " = true AND " +
                     AAccountTable.GetAccountTypeDBName().ToUpper() + " = 'INCOME'";
            AAccountCodeComboBox.InitialiseUserControl(AccountListTable,
                AAccountTable.GetAccountCodeDBName(), AAccountTable.GetAccountCodeShortDescDBName(), null);
            AAccountCodeComboBox.AppearanceSetup(new int[] { -1, 300 }, 20);
            AAccountCodeComboBox.Filter = filter;

            DataTable DrAccountListTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountList, ALedgerNumber);
            DrAccountListTable.DefaultView.Sort = AAccountTable.GetAccountCodeDBName() + " ASC";
            filter = AAccountTable.GetPostingStatusDBName() + " = true AND " +
                     AAccountTable.GetAccountTypeDBName().ToUpper() + " = 'EXPENSE'";
            ADrAccountCodeComboBox.InitialiseUserControl(DrAccountListTable,
                AAccountTable.GetAccountCodeDBName(), AAccountTable.GetAccountCodeShortDescDBName(), null);
            ADrAccountCodeComboBox.AppearanceSetup(new int[] { -1, 300 }, 20);
            ADrAccountCodeComboBox.Filter = filter;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// fill combobox values with motivation detail list
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="AActiveOnly"></param>
        public static void InitialiseMotivationDetailList(ref TCmbAutoPopulated AControl,
            Int32 ALedgerNumber,
            bool AActiveOnly)
        {
            DataTable detailTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.MotivationList, ALedgerNumber);

            AControl.InitialiseUserControl(detailTable,
                AMotivationDetailTable.GetMotivationDetailCodeDBName(),
                AMotivationDetailTable.GetMotivationDetailDescDBName(),
                null);
            AControl.AppearanceSetup(new int[] { -1, 200 }, -1);

            if (AActiveOnly)
            {
                AControl.Filter = AMotivationDetailTable.GetMotivationStatusDBName() + " = true";
            }
            else
            {
                AControl.Filter = string.Empty;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// fill combobox values with motivation group list
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="AActiveOnly"></param>
        public static void InitialiseMotivationGroupList(ref TCmbAutoPopulated AControl,
            Int32 ALedgerNumber,
            bool AActiveOnly)
        {
            DataTable groupTable =
                (AMotivationGroupTable)TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.MotivationGroupList, ALedgerNumber);

            groupTable.Columns.Add("Active", typeof(Boolean));

            AControl.InitialiseUserControl(groupTable,
                AMotivationGroupTable.GetMotivationGroupCodeDBName(),
                AMotivationGroupTable.GetMotivationGroupDescriptionDBName(),
                null);

            AControl.AppearanceSetup(new int[] { -1, 200 }, -1);

            if (AActiveOnly)
            {
                DataTable detailTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.MotivationList, ALedgerNumber);

                // motivation group is deemed active if it contains at least one active motivation detail
                foreach (DataRow groupRow in groupTable.Rows)
                {
                    bool ContainsActive = false;

                    foreach (DataRow detailRow in detailTable.Rows)
                    {
                        if ((detailRow[AMotivationDetailTable.GetMotivationGroupCodeDBName()].ToString()
                             == groupRow[AMotivationGroupTable.GetMotivationGroupCodeDBName()].ToString())
                            && (Convert.ToBoolean(detailRow[AMotivationDetailTable.GetMotivationStatusDBName()]) == true))
                        {
                            ContainsActive = true;
                            break;
                        }
                    }

                    groupRow["Active"] = ContainsActive;
                }

                AControl.Filter = "Active = true";
            }
            else
            {
                AControl.Filter = string.Empty;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// fill combobox values with list of transaction types
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="ASubSystemCode"></param>
        public static void InitialiseTransactionTypeList(ref TCmbAutoPopulated AControl, Int32 ALedgerNumber, string ASubSystemCode)
        {
            TTypedDataTable Table;

            TRemote.MCommon.DataReader.WebConnectors.GetData(TTypedDataTable.GetTableNameSQL(ATransactionTypeTable.TableId),
                new TSearchCriteria[] {
                    new TSearchCriteria(TTypedDataTable.GetColumnNameSQL(ATransactionTypeTable.TableId,
                            ATransactionTypeTable.ColumnLedgerNumberId), ALedgerNumber),
                    new TSearchCriteria(TTypedDataTable.GetColumnNameSQL(ATransactionTypeTable.TableId,
                            ATransactionTypeTable.ColumnSubSystemCodeId), ASubSystemCode)
                },
                out Table);

            //
            // REVAL is not to be offered to the user as an option:
            Table.DefaultView.RowFilter = "a_transaction_type_code_c <> 'REVAL'";

            AControl.InitialiseUserControl(
                Table.DefaultView.ToTable(),
                ATransactionTypeTable.GetTransactionTypeCodeDBName(),
                ATransactionTypeTable.GetTransactionTypeDescriptionDBName(),
                null);

            AControl.AppearanceSetup(new int[] { -1, 150 }, -1);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Fill combobox values with account codes
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="APostingOnly"></param>
        /// <param name="AExcludePosting"></param>
        /// <param name="AActiveOnly"></param>
        /// <param name="ABankAccountOnly"></param>
        /// <param name="AForeignCurrencyName">If a value is defined, only base curreny or the defined currency are filtered</param>
        /// <param name="AIndicateInactive">Determines wether or not to indicate an account code as inactive</param>
        /// <param name="AAAccountListDataSource">If a reference to the AAccountList is available, pass it here.  Otherwise the method
        /// will get it from the data cache.</param>
        public static void InitialiseAccountList(ref TCmbAutoPopulated AControl,
            Int32 ALedgerNumber,
            bool APostingOnly,
            bool AExcludePosting,
            bool AActiveOnly,
            bool ABankAccountOnly,
            string AForeignCurrencyName,
            bool AIndicateInactive = false,
            DataTable AAAccountListDataSource = null)
        {
            DataTable Table;

            if (AAAccountListDataSource == null)
            {
                Table = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountList, ALedgerNumber);
            }
            else
            {
                Table = AAAccountListDataSource.Copy();
            }

            //Highlight inactive Accounts
            if (!AActiveOnly && AIndicateInactive)
            {
                foreach (DataRow rw in Table.Rows)
                {
                    if ((rw[AAccountTable.ColumnAccountActiveFlagId] != null) && (rw[AAccountTable.ColumnAccountActiveFlagId].ToString() == "False"))
                    {
                        rw[AAccountTable.ColumnAccountCodeShortDescId] = SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " " +
                                                                         rw[AAccountTable.ColumnAccountCodeShortDescId];
                    }
                }
            }

            AControl.InitialiseUserControl(Table,
                AAccountTable.GetAccountCodeDBName(),
                AAccountTable.GetAccountCodeShortDescDBName(),
                null);
            AControl.AppearanceSetup(new int[] { -1, 200 }, -1);

            AControl.Filter = PrepareAccountFilter(APostingOnly, AExcludePosting, AActiveOnly,
                ABankAccountOnly, AForeignCurrencyName);

            // We set the initial index to -1 because we always want to force the user to make a positive choice
            AControl.SelectedIndex = -1;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// fill combobox values with cost centre list
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="AReportsTo"></param>
        /// <param name="AACostCentreListDataSource">If a reference to the ACostCentreList is available, pass it here.  Otherwise the method
        /// will get it from the data cache.</param>
        public static void InitialiseLocalCostCentreList(ref TCmbAutoPopulated AControl,
            Int32 ALedgerNumber,
            Boolean AReportsTo = false,
            DataTable AACostCentreListDataSource = null)
        {
            DataTable Table;

            if (AACostCentreListDataSource == null)
            {
                Table = TRemote.MFinance.Setup.WebConnectors.LoadLocalCostCentres(ALedgerNumber);
            }
            else
            {
                Table = AACostCentreListDataSource.Copy();
            }

            AControl.InitialiseUserControl(Table,
                "CostCentreCode",
                "CostCentreName",
                null);
            AControl.AppearanceSetup(new int[] { -1, 200 }, -1);

            if (AReportsTo)
            {
                AControl.Filter = "Posting = false";
            }

            // We set the initial index to -1 because we always want to force the user to make a positive choice
            AControl.SelectedIndex = -1;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// fill combobox values with list of transaction types
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="ASubSystemCode"></param>
        public static void InitialiseTransactionTypeList(ref TCmbAutoPopulated AControl, Int32 ALedgerNumber, string ASubSystemCode)
        {
            // TODO: use cached table for transaction types? use filter to get only appropriate types for subsystem?
            TTypedDataTable Table;

            TRemote.MCommon.DataReader.WebConnectors.GetData(TTypedDataTable.GetTableNameSQL(ATransactionTypeTable.TableId),
                new TSearchCriteria[] {
                    new TSearchCriteria(TTypedDataTable.GetColumnNameSQL(ATransactionTypeTable.TableId,
                            ATransactionTypeTable.ColumnLedgerNumberId), ALedgerNumber),
                    new TSearchCriteria(TTypedDataTable.GetColumnNameSQL(ATransactionTypeTable.TableId,
                            ATransactionTypeTable.ColumnSubSystemCodeId), ASubSystemCode)
                },
                out Table);

            AControl.InitialiseUserControl(
                Table,
                ATransactionTypeTable.GetTransactionTypeCodeDBName(),
                ATransactionTypeTable.GetTransactionTypeDescriptionDBName(),
                null);

            AControl.AppearanceSetup(new int[] { -1, 150 }, -1);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// This function fills the available account hierarchies of a given ledger into a combobox
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNr"></param>
        public static void InitialiseAccountHierarchyList(ref TCmbAutoPopulated AControl, System.Int32 ALedgerNr)
        {
            DataTable Table = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountHierarchyList, ALedgerNr);

            AControl.InitialiseUserControl(Table,
                AAccountHierarchyTable.GetAccountHierarchyCodeDBName(),
                null,
                null);
            AControl.AppearanceSetup(new int[] { 150 }, -1);

            AControl.Filter = AAccountHierarchyTable.GetLedgerNumberDBName() + " = " + ALedgerNr.ToString();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// This function fills the available financial periods of a given ledger and financial year into a TCmbAutoPopulated combobox
        /// </summary>
        public static void InitialiseAvailableFinancialPeriodsList(
            ref TCmbAutoPopulated AControl,
            System.Int32 ALedgerNr,
            System.Int32 AYear,
            System.Int32 AInitialSelectedIndex,
            Boolean AShowCurrentAndForwarding,
            Boolean AShowZero = true)
        {
            DataTable periods = InitialiseAvailableFinancialPeriodsList(ALedgerNr, AYear, AShowCurrentAndForwarding, AShowZero);

            AControl.InitialiseUserControl(periods, "value", "display", "descr", null, null);

            if (AShowCurrentAndForwarding)
            {
                AControl.AppearanceSetup(new int[] { AControl.ComboBoxWidth }, -1);
            }
            else
            {
                AControl.AppearanceSetup(new int[] { -1, 200 }, -1);
            }

            if (AInitialSelectedIndex >= 0)
            {
                AControl.SelectedIndex = AInitialSelectedIndex;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// This function fills the available financial years of a given ledger into a TCmbAutoPopulated combobox
        /// </summary>
        public static void InitialiseAvailableFinancialYearsListHOSA(ref TCmbAutoPopulated AControl,
            Int32 ALedgerNumber,
            Boolean AIncludeNextYear = false)
        {
            string DisplayMember;
            string ValueMember;
            string DescriptionMember;

            DataTable Table = TRemote.MFinance.GL.WebConnectors.GetAvailableGLYearsHOSA(ALedgerNumber,
                out DisplayMember,
                out ValueMember,
                out DescriptionMember);

            Table.DefaultView.Sort = ValueMember + " DESC";

            AControl.InitialiseUserControl(Table,
                ValueMember,
                DisplayMember,
                DescriptionMember,
                null);

            AControl.AppearanceSetup(new int[] { 100, 150 }, -1);

            if (Table.DefaultView.Count > 0)
            {
                AControl.SelectedIndex = 0;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// This function fills the available financial years of a given ledger into a TCmbAutoPopulated combobox
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="AIncludeNextYear"></param>
        /// <param name="AShowYearEnds"></param>
        public static void InitialiseAvailableFinancialYearsList(ref TCmbAutoPopulated AControl,
            System.Int32 ALedgerNumber,
            bool AIncludeNextYear = false,
            bool AShowYearEnds = false)
        {
            string DisplayMember;
            string ValueMember;

            DataTable Table = null;

            if (AShowYearEnds)
            {
                Table = TRemote.MFinance.GL.WebConnectors.GetAvailableGLYearEnds(ALedgerNumber,
                    0,
                    AIncludeNextYear,
                    out DisplayMember,
                    out ValueMember);
            }
            else
            {
                Table = TRemote.MFinance.GL.WebConnectors.GetAvailableGLYears(ALedgerNumber,
                    0,
                    AIncludeNextYear,
                    out DisplayMember,
                    out ValueMember);
            }

            Table.DefaultView.Sort = ValueMember + " DESC";

            AControl.InitialiseUserControl(Table,
                ValueMember,
                DisplayMember,
                null,
                null);

            AControl.SelectedIndex = 0;

            AControl.AppearanceSetup(new int[] { -1 }, -1);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// This function fills the available financial years of a given ledger into a TCmbAutoPopulated combobox
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNr"></param>
        public static void InitialiseAvailableGiftYearsList(ref TCmbAutoPopulated AControl, System.Int32 ALedgerNr)
        {
            string DisplayMember;
            string ValueMember;
            DataTable Table = TRemote.MFinance.Gift.WebConnectors.GetAvailableGiftYears(ALedgerNr, out DisplayMember, out ValueMember);

            Table.DefaultView.Sort = ValueMember + " DESC";

            AControl.InitialiseUserControl(Table,
                ValueMember,
                DisplayMember,
                null,
                null);

            AControl.SelectedIndex = 0;

            AControl.AppearanceSetup(new int[] { -1 }, -1);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// This function fills the combobox for the key ministry depending on the partnerkey
        /// </summary>
        /// <param name="ACmbKeyMinistry"></param>
        /// <param name="APartnerKey"></param>
        /// <param name="AFieldNumber"></param>
        /// <param name="ARefreshData"></param>
        private static void GetRecipientData(ref TCmbAutoPopulated ACmbKeyMinistry,
            Int64 APartnerKey,
            out Int64 AFieldNumber,
            Boolean ARefreshData = false)
        {
            string CurrentRowFilter = string.Empty;

            AFieldNumber = 0;

            if ((FKeyMinTable != null) && !ARefreshData)
            {
                if (FindAndSelect(ref ACmbKeyMinistry, APartnerKey))
                {
                    return;
                }
            }
            else if ((FKeyMinTable != null) && ARefreshData)
            {
                FKeyMinTable.Clear();
                FKeyMinTable = null;
            }

            string DisplayMember = PUnitTable.GetUnitNameDBName();
            string ValueMember = PUnitTable.GetPartnerKeyDBName();

            try
            {
                FKeyMinTable = TRemote.MFinance.Gift.WebConnectors.LoadKeyMinistry(APartnerKey, out FFieldNumber);

                AFieldNumber = FFieldNumber;

                CurrentRowFilter = FKeyMinTable.DefaultView.RowFilter;
                FKeyMinTable.DefaultView.RowFilter = String.Format("{0}='{1}'",
                    PUnitTable.GetUnitTypeCodeDBName(),
                    MPartnerConstants.UNIT_TYPE_KEYMIN);

                FKeyMinTable.DefaultView.Sort = DisplayMember + " Desc";

                DataTable dt = FKeyMinTable.DefaultView.ToTable();

                ACmbKeyMinistry.InitialiseUserControl(dt,
                    ValueMember,
                    DisplayMember,
                    DisplayMember,
                    null);
                ACmbKeyMinistry.AppearanceSetup(new int[] { 500 }, -1);

                if (!FindAndSelect(ref ACmbKeyMinistry, APartnerKey))
                {
                    //Clear the combobox
                    ACmbKeyMinistry.SelectedIndex = -1;
                }
            }
            finally
            {
                FKeyMinTable.DefaultView.RowFilter = CurrentRowFilter;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// fill combobox values with motivation group list
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="AActiveOnly"></param>
        public static void InitialiseMotivationGroupList(ref TCmbAutoPopulated AControl,
            Int32 ALedgerNumber,
            bool AActiveOnly)
        {
            DataTable groupTable =
                (AMotivationGroupTable)TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.MotivationGroupList, ALedgerNumber);

            AControl.InitialiseUserControl(groupTable,
                AMotivationGroupTable.GetMotivationGroupCodeDBName(),
                AMotivationGroupTable.GetMotivationGroupDescriptionDBName(),
                null);

            AControl.AppearanceSetup(new int[] { -1, 200 }, -1);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// fill combobox values with method of payment list
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="AActiveOnly"></param>
        public static void InitialiseMethodOfPaymentCodeList(ref TCmbAutoPopulated AControl,
            bool AActiveOnly)
        {
            DataTable Table = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.MethodOfPaymentList);

            AControl.InitialiseUserControl(Table,
                AMethodOfPaymentTable.GetMethodOfPaymentCodeDBName(),
                AMethodOfPaymentTable.GetMethodOfPaymentCodeDBName(),
                AMethodOfPaymentTable.GetMethodOfPaymentDescDBName(),
                null,
                AMethodOfPaymentTable.GetActiveDBName()
                );
            AControl.AppearanceSetup(new int[] { -1, 150 }, -1);

            if (AActiveOnly)
            {
                AControl.Filter = AMethodOfPaymentTable.GetActiveDBName() + " = true";
            }
            else
            {
                AControl.Filter = "";
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// This function puts the ICH numbers used of a given ledger into a combobox
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="APeriodNumber"></param>
        /// <param name="AYearStart"></param>
        /// <param name="AYearEnding"></param>
        public static void InitialiseICHStewardshipList(
            ref TCmbAutoPopulated AControl,
            Int32 ALedgerNumber,
            Int32 APeriodNumber,
            String AYearStart,
            String AYearEnding)
        {
            DataTable ICHNumbers = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.ICHStewardshipList, ALedgerNumber);

            if (AYearStart != null)
            {
                //Filter for current period and date range
                ICHNumbers.DefaultView.RowFilter = String.Format("{0}={1} And {2}>'{3}' And {2}<='{4}'",
                    AIchStewardshipTable.GetPeriodNumberDBName(),
                    APeriodNumber,
                    AIchStewardshipTable.GetDateProcessedDBName(),
                    AYearStart,
                    AYearEnding);
            }
            else
            {
                //Filter for current period
                ICHNumbers.DefaultView.RowFilter = String.Format("{0}={1}",
                    AIchStewardshipTable.GetPeriodNumberDBName(),
                    APeriodNumber);
            }

            ICHNumbers.DefaultView.Sort = AIchStewardshipTable.GetIchNumberDBName();

            //Get the distinct ICH numbers for the specified period
            DataTable newDataTable = ICHNumbers.DefaultView.ToTable(true, AIchStewardshipTable.GetIchNumberDBName(),
                AIchStewardshipTable.GetDateProcessedDBName());

            // New column with date as a string. (We do not want time part of date.)
            newDataTable.Columns.Add("DateOnly");

            foreach (DataRow Row in newDataTable.Rows)
            {
                Row["DateOnly"] = Convert.ToDateTime(Row[AIchStewardshipTable.GetDateProcessedDBName()]).ToShortDateString();
            }

            // add empty row so that SetSelectedString for invalid string will not result in undefined behaviour
            DataRow emptyRow = newDataTable.NewRow();

            emptyRow[0] = 0;  //selecting 0 will mean full HOSA reports for all cost centres

            newDataTable.Rows.Add(emptyRow);

            AControl.InitialiseUserControl(newDataTable,
                AIchStewardshipTable.GetIchNumberDBName(),
                "DateOnly",
                null);
            AControl.AppearanceSetup(new int[] { -1, 80 }, -1);

            //Alternative way to filter the contents of the combo
            //AControl.Filter = AIchStewardshipTable.GetPeriodNumberDBName() + " = " + APeriodNumber.ToString();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// fill combobox values with the mailing codes
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="AActiveOnly"></param>
        public static void InitialisePMailingList(ref TCmbAutoPopulated AControl,
            bool AActiveOnly)
        {
            DataTable Table = TDataCache.TMPartner.GetCacheableMailingTable(TCacheableMailingTablesEnum.MailingList);

            // We need to add a row to the table that has a NULL value
            // We don't want to change the 'real' data table so we make a copy first
            Table = Table.Copy();

            // Allow NULL for the code in this table
            Table.Columns[PMailingTable.ColumnMailingCodeId].AllowDBNull = true;

            // Now add the row
            DataRow Dr = Table.NewRow();
            Dr[PMailingTable.GetMailingCodeDBName()] = DBNull.Value;
            Dr[PMailingTable.GetMailingDescriptionDBName()] = String.Empty;

            Table.Rows.InsertAt(Dr, 0);

            // Now use this table for the ComboBox data source
            AControl.InitialiseUserControl(Table,
                PMailingTable.GetMailingCodeDBName(),
                PMailingTable.GetMailingDescriptionDBName(),
                null);
            AControl.AppearanceSetup(new int[] { -1, 150 }, -1);

            if (AActiveOnly)
            {
                AControl.Filter = String.Format("({0}=true) OR ({1} IS NULL)", PMailingTable.GetViewableDBName(), PMailingTable.GetMailingCodeDBName());
                //TODO Add viewable until and date comparison
            }
            else
            {
                AControl.Filter = "";
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// This function fills the open financial periods of a given ledger into a combobox
        /// </summary>
        public static void InitialiseOpenFinancialPeriodsList(
            ref TCmbAutoPopulated AControl,
            System.Int32 ALedgerNumber)
        {
            DataTable AccountingPeriods = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountingPeriodList,
                ALedgerNumber);

            ALedgerRow Ledger =
                ((ALedgerTable)TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerDetails, ALedgerNumber))[0];

            int CurrentPeriod = Ledger.CurrentPeriod;
            int EndPeriod = CurrentPeriod + Ledger.NumberFwdPostingPeriods;

            AControl.InitialiseUserControl(AccountingPeriods,
                AAccountingPeriodTable.GetAccountingPeriodNumberDBName(),
                AAccountingPeriodTable.GetAccountingPeriodDescDBName(),
                null);

            AControl.AppearanceSetup(new int[] { -1, 200 }, -1);

            AControl.Filter = String.Format("{0} >= {1} And {0} <= {2}",
                AAccountingPeriodTable.GetAccountingPeriodNumberDBName(),
                CurrentPeriod,
                EndPeriod);
        }
Ejemplo n.º 19
0
        public void TestComboboxEmptyDescriptionBug()
        {
            TCmbAutoPopulated cmb = new TCmbAutoPopulated();

            DataTable detailTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.MotivationList, FLedgerNumber);

            Assert.AreNotEqual(0, detailTable.Rows.Count, "There should be a motivation detail in the cached table");

            cmb.Name = "TestCombobox";
            cmb.InitialiseUserControl(detailTable,
                AMotivationDetailTable.GetMotivationDetailCodeDBName(),
                AMotivationDetailTable.GetMotivationDetailDescDBName(),
                null);
            cmb.AppearanceSetup(new int[] { -1, 150 }, -1);

            Form TestForm = new Form();
            TestForm.Controls.Add(cmb);

            TestForm.Show();

            cmb.SelectedIndex = 1;
            Assert.AreEqual(cmb.GetSelectedString(), "KEYMIN");
            Assert.AreEqual(cmb.GetSelectedDescription(), "Key Ministry Gift");

            cmb.SelectedIndex = 0;
            Assert.AreEqual(cmb.GetSelectedString(), "FIELD");
            Assert.AreEqual(cmb.GetSelectedDescription(), "Field Gift");
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Fill combobox values with account codes
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="APostingOnly"></param>
        /// <param name="AExcludePosting"></param>
        /// <param name="AActiveOnly"></param>
        /// <param name="ABankAccountOnly"></param>
        /// <param name="AForeignCurrencyName">If a value is defined, only base curreny or the defined currency are filtered</param>
        /// <param name="AIndicateInactive">Determines wether or not to indicate an account code as inactive</param>
        /// <param name="AAAccountListDataSource">If a reference to the AAccountList is available, pass it here.  Otherwise the method
        /// will get it from the data cache.</param>
        public static void InitialiseAccountList(ref TCmbAutoPopulated AControl,
            Int32 ALedgerNumber,
            bool APostingOnly,
            bool AExcludePosting,
            bool AActiveOnly,
            bool ABankAccountOnly,
            string AForeignCurrencyName,
            bool AIndicateInactive = false,
            DataTable AAAccountListDataSource = null)
        {
            DataTable Table;

            if (AAAccountListDataSource == null)
            {
                Table = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountList, ALedgerNumber);
            }
            else
            {
                Table = AAAccountListDataSource.Copy();
            }

            // add empty row so that SetSelectedString for invalid string will not result in undefined behaviour (selecting the first account etc)
            DataRow emptyRow = Table.NewRow();

            emptyRow[AAccountTable.ColumnLedgerNumberId] = ALedgerNumber;
            emptyRow[AAccountTable.ColumnAccountCodeId] = string.Empty;
            emptyRow[AAccountTable.ColumnAccountCodeShortDescId] = Catalog.GetString("Select a valid account");
            Table.Rows.Add(emptyRow);

            //Highlight inactive Accounts
            if (!AActiveOnly && AIndicateInactive)
            {
                foreach (DataRow rw in Table.Rows)
                {
                    if ((rw[AAccountTable.ColumnAccountActiveFlagId] != null) && (rw[AAccountTable.ColumnAccountActiveFlagId].ToString() == "False"))
                    {
                        rw[AAccountTable.ColumnAccountCodeShortDescId] = SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " " +
                                                                         rw[AAccountTable.ColumnAccountCodeShortDescId];
                    }
                }
            }

            AControl.InitialiseUserControl(Table,
                AAccountTable.GetAccountCodeDBName(),
                AAccountTable.GetAccountCodeShortDescDBName(),
                null);
            AControl.AppearanceSetup(new int[] { -1, 200 }, -1);

            AControl.Filter = PrepareAccountFilter(APostingOnly, AExcludePosting, AActiveOnly,
                ABankAccountOnly, AForeignCurrencyName);
        }