/// <summary>
        /// Manage the overlay
        /// </summary>
        public static void SetTextBoxOverlayOnKeyMinistryCombo(GiftBatchTDSAGiftDetailRow ACurrentDetailRow, bool AActiveOnly,
            TCmbAutoPopulated ACmbKeyMinistries, TCmbAutoPopulated ACmbMotivationDetailCode, TextBox ATxtDetailRecipientKeyMinistry,
            ref string AMotivationDetail, bool AInEditModeFlag, bool ABatchUnpostedFlag, bool AReadComboValue = false)
        {
            ResetMotivationDetailCodeFilter(ACmbMotivationDetailCode, ref AMotivationDetail, AActiveOnly);

            // Always enabled initially. Combobox may be diabled later once populated.
            ACmbKeyMinistries.Enabled = true;

            ATxtDetailRecipientKeyMinistry.Visible = true;
            ATxtDetailRecipientKeyMinistry.BringToFront();
            ATxtDetailRecipientKeyMinistry.Parent.Refresh();

            if (AReadComboValue)
            {
                ReconcileKeyMinistryFromCombo(ACurrentDetailRow,
                    ACmbKeyMinistries,
                    ATxtDetailRecipientKeyMinistry,
                    AInEditModeFlag,
                    ABatchUnpostedFlag);
            }
            else
            {
                ReconcileKeyMinistryFromTextbox(ACurrentDetailRow,
                    ACmbKeyMinistries,
                    ATxtDetailRecipientKeyMinistry,
                    AInEditModeFlag,
                    ABatchUnpostedFlag);
            }
        }
        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");
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public TUC_GiftBatches_AccountAndCostCentre(Int32 ALedgerNumber,
            GiftBatchTDS AMainDS,
            TCmbAutoPopulated ACmbBankAccountCode,
            TCmbAutoPopulated ACmbCostCentreCode)
        {
            FLedgerNumber = ALedgerNumber;
            FMainDS = AMainDS;

            FCmbBankAccountCode = ACmbBankAccountCode;
            FCmbCostCentreCode = ACmbCostCentreCode;
        }
        /// <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;
        }
        /// <summary>
        /// Checks if the Publication that is selected in a ComboBox is valid. If it isn't valid,
        /// a warning is shown to the user, asking the user as to whether the user still wants to use
        /// this Publication for the Subscription that the user is working with.
        /// </summary>
        /// <param name="APublicationComboBox">ComboBox containing Publications.</param>
        public static void CheckPublicationComboValidValue(TCmbAutoPopulated APublicationComboBox)
        {
            DataTable DataCachePublicationListTable;
            PPublicationRow TmpRow;
            string SelectedPublication;

            if (APublicationComboBox == null)
            {
                throw new ArgumentNullException("APublicationComboBox must not be null");
            }

            SelectedPublication = APublicationComboBox.GetSelectedString();

            if (!String.IsNullOrWhiteSpace(SelectedPublication))
            {
                DataCachePublicationListTable = TDataCache.TMPartner.GetCacheableSubscriptionsTable(TCacheableSubscriptionsTablesEnum.PublicationList);
                TmpRow = (PPublicationRow)DataCachePublicationListTable.Rows.Find(
                    new Object[] { SelectedPublication });

                if (TmpRow != null)
                {
                    if (!TmpRow.ValidPublication)
                    {
                        if (MessageBox.Show(
                                Catalog.GetString(String.Format("Please note that Publication\r\n\r\n    {0}\r\n\r\n" +
                                        "is no longer available." + "\r\n\r\n" +
                                        "Would you still like to use it for a Subscription?",
                                        APublicationComboBox.GetSelectedString())),
                                Catalog.GetString("Publication Selection"),
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                MessageBoxDefaultButton.Button2) == DialogResult.No)
                        {
                            APublicationComboBox.cmbCombobox.SelectedIndex = -1;
                        }
                    }
                }
            }
        }
Beispiel #6
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 = "";
            }
        }
Beispiel #7
0
        /// <summary>
        /// change the filter of the motivation detail combobox when a different motivation group gets selected
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="AMotivationGroup"></param>
        /// <param name="AActiveOnly"></param>
        public static void ChangeFilterMotivationDetailList(ref TCmbAutoPopulated AControl, String AMotivationGroup, bool AActiveOnly)
        {
            string newFilter = String.Empty;

            if (AActiveOnly)
            {
                newFilter = AMotivationDetailTable.GetMotivationStatusDBName() + " = true And ";
            }

            newFilter += AMotivationDetailTable.GetMotivationGroupCodeDBName() + " = '" + AMotivationGroup + "'";

            AControl.Filter = newFilter;
        }
Beispiel #8
0
        /// <summary>
        /// change the filter of the motivation detail combobox when a different motivation group gets selected
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="AMotivationGroup"></param>
        public static void ChangeFilterMotivationDetailList(ref TCmbAutoPopulated AControl, String AMotivationGroup)
        {
            string newFilter = String.Empty;

            if ((AControl.Filter != null) && AControl.Filter.StartsWith(AMotivationDetailTable.GetMotivationStatusDBName() + " = true"))
            {
                newFilter = AMotivationDetailTable.GetMotivationStatusDBName() + " = true And ";
            }

            newFilter += AMotivationDetailTable.GetMotivationGroupCodeDBName() + " = '" + AMotivationGroup + "'";

            AControl.Filter = newFilter;
        }
Beispiel #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;
            }
        }
        /// <summary>
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager
                resources = new System.ComponentModel.ComponentResourceManager(
                typeof(TFrmGLBatch));

            lblAccountText = new Label();
            lblAccountValue = new Label();

            lblDateEnd = new Label();
            lblDateEndValue = new Label();

            lblRevCur = new Label();
            lblRevCurValue = new Label();

            lblCostCentre = new Label();
            cmbCostCentres = new TCmbAutoPopulated();

            grdDetails = new SourceGrid.DataGrid();

            btnRevaluate = new Button();
            btnCancel = new Button();
            SuspendLayout();

            int leftColStart = 32;
            int leftColWidth = 180;
            int colSpace = 15;
            int rowY = 5;
            int rowHeight = 25;
            int rightColWidth = 280;

            // int buttonTop = 210;
            int buttonLeft = 120;

            //
            // lblAccountText
            //
            lblAccountText.Location = new System.Drawing.Point(leftColStart, rowY);
            lblAccountText.Name = "lblAccountText";
            lblAccountText.Size = new System.Drawing.Size(leftColWidth, 21);
            lblAccountText.TextAlign = ContentAlignment.MiddleRight;

            //
            // lblAccountValue
            //
            lblAccountValue.Location = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY);
            lblAccountValue.Name = "lblAccountValue";
            lblAccountValue.Size = new System.Drawing.Size(144, 21);
            lblAccountValue.TextAlign = ContentAlignment.MiddleLeft;

            rowY = rowY + rowHeight;

            //
            // lblDateEnd
            //
            lblDateEnd.Location = new System.Drawing.Point(leftColStart, rowY);
            lblDateEnd.Name = "lblDateEnd";
            lblDateEnd.Size = new System.Drawing.Size(leftColWidth, 21);
            lblDateEnd.TextAlign = ContentAlignment.MiddleRight;

            //
            // lblDateEndValue
            //
            lblDateEndValue.Location = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY);
            lblDateEndValue.Name = "lblDateEndValue";
            lblDateEndValue.Size = new System.Drawing.Size(rightColWidth, 21);
            lblDateEndValue.TextAlign = ContentAlignment.MiddleLeft;

            rowY = rowY + rowHeight;

            //
            // lblRevCur
            //
            lblRevCur.Location = new System.Drawing.Point(leftColStart, rowY);
            lblRevCur.Name = "lblRevCur";
            lblRevCur.Size = new System.Drawing.Size(leftColWidth, 21);
            lblRevCur.TextAlign = ContentAlignment.MiddleRight;

            //
            // lblRevCurValue
            //
            lblRevCurValue.Location = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY);
            lblRevCurValue.Name = "lblRevCurValue";
            lblRevCurValue.Size = new System.Drawing.Size(rightColWidth, 21);
            lblRevCurValue.TextAlign = ContentAlignment.MiddleLeft;

            rowY = rowY + rowHeight;

            //
            // Cost Centre
            //

            lblCostCentre.Location = new System.Drawing.Point(leftColStart, rowY);
            lblCostCentre.Name = "lblCostCentre";
            lblCostCentre.Size = new System.Drawing.Size(leftColWidth, 21);
            lblCostCentre.TextAlign = ContentAlignment.MiddleRight;

            cmbCostCentres.Location = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY);
            cmbCostCentres.Name = "clbCostCentres";
            cmbCostCentres.Size = new System.Drawing.Size(rightColWidth, 22);
            cmbCostCentres.ListTable = TCmbAutoPopulated.TListTableEnum.UserDefinedList;

            rowY = rowY + rowHeight + 20;

            grdDetails.Location = new System.Drawing.Point(leftColStart, rowY);
            grdDetails.Size = new System.Drawing.Size(430, 200);
            grdDetails.BorderStyle = BorderStyle.FixedSingle;
            grdDetails.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            grdDetails.AutoStretchColumnsToFitWidth = true;

            rowY = rowY + 230;

            //
            // btnRevaluate
            //
            btnRevaluate.Location = new System.Drawing.Point(buttonLeft, rowY);
            btnRevaluate.Name = "btnRevaluate";
            btnRevaluate.Size = new System.Drawing.Size(95, 23);
            btnRevaluate.TabIndex = 2;
            btnRevaluate.Text = "Revalue";
            btnRevaluate.UseVisualStyleBackColor = true;
            //
            // btnCancel
            //
            btnCancel.Location = new System.Drawing.Point(150 + buttonLeft, rowY);
            btnCancel.Name = "btnCancel";
            btnCancel.Size = new System.Drawing.Size(95, 23);
            btnCancel.TabIndex = 3;
            btnCancel.Text = "Cancel";
            btnCancel.UseVisualStyleBackColor = true;
            //
            // GLRevaluation
            //
            AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            AutoScaleMode = AutoScaleMode.Font;
            Font = new System.Drawing.Font("Verdana", 8.25f);


            ClientSize = new System.Drawing.Size(500, rowY + 50);
            CancelButton = btnCancel;
            Controls.AddRange(new Control[] {
                    btnCancel,
                    btnRevaluate,
                    lblAccountText,
                    lblAccountValue,
                    lblDateEnd,
                    lblDateEndValue,
                    lblRevCur,
                    lblRevCurValue,
                    lblCostCentre,
                    cmbCostCentres,
                    this.grdDetails
                });

            Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");

            Name = "GLRevaluation";
            Text = "Revaluation ...";
            ResumeLayout(false);
        }
        private void SetupTaxDeductibilityControls()
        {
            // increase the width of the screen from the default width (760)
            if (ClientSize.Width == 760)
            {
                ClientSize = new System.Drawing.Size(920, ClientSize.Height);
            }

            // new label
            Label lblAccounts = new Label();
            lblAccounts.Name = "lblAccounts";
            lblAccounts.Location = lblDetailAccountCode.Location;
            lblAccounts.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
            lblAccounts.Size = lblDetailAccountCode.Size;
            lblAccounts.Text = "Accounts:";
            lblAccounts.TextAlign = System.Drawing.ContentAlignment.TopRight;
            pnlDetails.Controls.Add(lblAccounts);

            // changes to DetailAccountCode control
            lblDetailAccountCode.Location = new System.Drawing.Point(lblDetailAccountCode.Location.X + 90, lblDetailAccountCode.Location.Y);
            lblDetailAccountCode.Text = "Non-Deductible:";
            lblDetailAccountCode.Size = new System.Drawing.Size(102, 17);
            cmbDetailAccountCode.Location = new System.Drawing.Point(cmbDetailAccountCode.Location.X + 105, cmbDetailAccountCode.Location.Y);

            // create new label and combobox for the Tax-Deductible Account Code
            Label lblDeductibleAccountCode = new Label();
            lblDeductibleAccountCode.Name = "lblDeductibleAccountCode";
            lblDeductibleAccountCode.Location = new System.Drawing.Point(cmbDetailAccountCode.Location.X + 310, lblDetailAccountCode.Location.Y);
            lblDeductibleAccountCode.Anchor =
                ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
            lblDeductibleAccountCode.Size = new System.Drawing.Size(102, 17);
            lblDeductibleAccountCode.Text = "Tax-Deductible:";
            lblDeductibleAccountCode.TextAlign = System.Drawing.ContentAlignment.TopRight;
            pnlDetails.Controls.Add(lblDeductibleAccountCode);

            cmbDeductibleAccountCode = new TCmbAutoPopulated();
            cmbDeductibleAccountCode.Name = "cmbDeductibleAccountCode";
            cmbDeductibleAccountCode.Location = new System.Drawing.Point(cmbDetailAccountCode.Location.X + 415, cmbDetailAccountCode.Location.Y);
            cmbDeductibleAccountCode.Size = new System.Drawing.Size(300, 22);
            cmbDeductibleAccountCode.ListTable = TCmbAutoPopulated.TListTableEnum.UserDefinedList;
            cmbDeductibleAccountCode.TabIndex = cmbDetailAccountCode.TabIndex + 1;
            cmbDeductibleAccountCode.Validated += ControlValidatedHandler;
            pnlDetails.Controls.Add(cmbDeductibleAccountCode);

            TFinanceControls.InitialiseAccountList(ref cmbDeductibleAccountCode, FLedgerNumber, true, false, false, false);

            if (FMainDS.AMotivationDetail != null)
            {
                FPetraUtilsObject.ValidationControlsDict.Add(FMainDS.AMotivationDetail.Columns[(short)FMainDS.AMotivationDetail.GetType().GetField(
                                                                                                   "ColumnTaxDeductibleAccountCodeId",
                                                                                                   BindingFlags.Public | BindingFlags.Static |
                                                                                                   BindingFlags.FlattenHierarchy).GetValue(FMainDS.
                                                                                                   AMotivationDetail.GetType())],
                    new TValidationControlsData(cmbDeductibleAccountCode, Catalog.GetString("Tax Deductible Account")));
            }

            // add new column to grid (TaxDeductibleAccount)
            grdDetails.Columns.Clear();
            grdDetails.AddTextColumn(Catalog.GetString("Group"), FMainDS.AMotivationDetail.ColumnMotivationGroupCode);
            grdDetails.AddTextColumn(Catalog.GetString("Motivation Detail"), FMainDS.AMotivationDetail.ColumnMotivationDetailCode);
            grdDetails.AddTextColumn(Catalog.GetString("Description"), FMainDS.AMotivationDetail.ColumnMotivationDetailDesc);
            grdDetails.AddTextColumn(Catalog.GetString("Non-Deductible Account"), FMainDS.AMotivationDetail.ColumnAccountCode);
            grdDetails.AddTextColumn(Catalog.GetString("Tax-Deductible Account"), FMainDS.AMotivationDetail.ColumnTaxDeductibleAccountCode);
            grdDetails.AddTextColumn(Catalog.GetString("Cost Centre Code"), FMainDS.AMotivationDetail.ColumnCostCentreCode);
            grdDetails.AddCheckBoxColumn(Catalog.GetString("Active"), FMainDS.AMotivationDetail.ColumnMotivationStatus);
            grdDetails.AddCheckBoxColumn(Catalog.GetString("Print Receipt"), FMainDS.AMotivationDetail.ColumnReceipt);

            SelectRowInGrid(1);
        }
Beispiel #12
0
        /// <summary>
        /// This function fills the combobox for the key ministry depending on the partnerkey
        /// </summary>
        /// <param name="ACmbMinistry"></param>
        /// <param name="ATxtField"></param>
        /// <param name="APartnerKey"></param>
        /// <param name="ARefreshData"></param>
        public static void GetRecipientData(ref TCmbAutoPopulated ACmbMinistry,
            ref TtxtAutoPopulatedButtonLabel ATxtField,
            System.Int64 APartnerKey,
            Boolean ARefreshData = false)
        {
            GetRecipientData(ref ACmbMinistry, APartnerKey, out FFieldNumber, ARefreshData);

            if (Convert.ToInt64(ATxtField.Text) != FFieldNumber)
            {
                ATxtField.Text = FFieldNumber.ToString();
            }
        }
Beispiel #13
0
        /// <summary>
        /// Equity accounts are any and all posting accounts that have a_account_type_c == 'Equity'
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        public static void InitialiseRetEarningsAccountAccountList(ref TCmbAutoPopulated AControl, Int32 ALedgerNumber)
        {
            AAccountTable Account = (AAccountTable)TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountList,
                ALedgerNumber);

            Account.DefaultView.RowFilter = "a_posting_status_l=TRUE AND a_account_type_c='Equity'";
            Account.DefaultView.Sort = "a_account_code_c";
            DataTable Options = Account.DefaultView.ToTable();

            AControl.InitialiseUserControl(Options,
                "a_account_code_c",
                "a_account_code_short_desc_c",
                null);
        }
Beispiel #14
0
        /// <summary>
        /// Clearing accounts are any and all posting accounts that are descendants of 8500S
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="AAccountHierarchyCode"></param>
        public static void InitialiseClearingAccountList(ref TCmbAutoPopulated AControl, Int32 ALedgerNumber, String AAccountHierarchyCode)
        {
            GLSetupTDS DS = TRemote.MFinance.Setup.WebConnectors.LoadAccountHierarchies(ALedgerNumber);

            DS.AAccount.DefaultView.Sort = "a_account_code_c";
            DS.AAccountHierarchyDetail.DefaultView.RowFilter =
                "a_ledger_number_i=" + ALedgerNumber + " AND a_account_hierarchy_code_c='" + AAccountHierarchyCode + "'";
            DS.AAccountHierarchyDetail.DefaultView.Sort = "a_reporting_account_code_c";

            DataTable Options = new DataTable();
            Options.Columns.Add("AccountCode", typeof(String));
            Options.Columns.Add("AccountDescr", typeof(String));

            foreach (DataRowView rv in DS.AAccountHierarchyDetail.DefaultView)
            {
                AAccountHierarchyDetailRow Row = (AAccountHierarchyDetailRow)rv.Row;

                if (AccountIsDescendantOf(DS.AAccountHierarchyDetail.DefaultView, "8500S", Row))
                {
                    //
                    // This account is a descendant of 8500S. I also require it to be a Posting Account.
                    Int32 Idx = DS.AAccount.DefaultView.Find(Row.ReportingAccountCode);

                    if (Idx >= 0)
                    {
                        AAccountRow Account = (AAccountRow)DS.AAccount.DefaultView[Idx].Row;

                        if (Account.PostingStatus == true)
                        {
                            DataRow NewRow = Options.NewRow();
                            NewRow["AccountCode"] = Account.AccountCode;
                            NewRow["AccountDescr"] = Account.AccountCodeShortDesc;
                            Options.Rows.Add(NewRow);
                        }
                    }
                }
            }

            AControl.InitialiseUserControl(Options,
                "AccountCode",
                "AccountDescr",
                null);
        }
Beispiel #15
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;
        }
Beispiel #16
0
 /// Adapter for the modules which have been developed before multi-currency support
 /// was required
 public static void InitialiseAccountList(ref TCmbAutoPopulated AControl,
     Int32 ALedgerNumber,
     bool APostingOnly,
     bool AExcludePosting,
     bool AActiveOnly,
     bool ABankAccountOnly,
     bool AIndicateInactive = false,
     DataTable AAAccountListDataSource = null)
 {
     InitialiseAccountList(
         ref AControl, ALedgerNumber, APostingOnly,
         AExcludePosting, AActiveOnly, ABankAccountOnly, "", AIndicateInactive, AAAccountListDataSource);
 }
Beispiel #17
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;
        }
Beispiel #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);
        }
Beispiel #19
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();
        }
Beispiel #20
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 = "";
            }
        }
Beispiel #21
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();
        }
Beispiel #22
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);
        }
Beispiel #23
0
 /// <summary>
 /// This function fills the combobox for the key ministry depending on the partnerkey
 /// </summary>
 /// <param name="cmbMinistry"></param>
 /// <param name="APartnerKey"></param>
 public static void GetRecipientData(ref TCmbAutoPopulated cmbMinistry, System.Int64 APartnerKey)
 {
     GetRecipientData(ref cmbMinistry, APartnerKey, out FFieldNumber);
 }
 /// <summary>
 /// This method must be called in order to correctly populate the ComboBoxes on the filter panel (by cloning from the main details panel)
 /// </summary>
 /// <param name="ACmbCostCentre"></param>
 /// <param name="ACmbAccountCode"></param>
 public void InitialiseDataSources(TCmbAutoPopulated ACmbCostCentre, TCmbAutoPopulated ACmbAccountCode)
 {
     // We have to do these because the filter/find panel is displayed when the screen is loaded, so they do not get populated
     InitFilterFindComboBox(ACmbCostCentre,
         (TCmbAutoComplete)FFilterFindPanelObject.FilterPanelControls.FindControlByName(ACmbCostCentre.Name));
     InitFilterFindComboBox(ACmbAccountCode,
         (TCmbAutoComplete)FFilterFindPanelObject.FilterPanelControls.FindControlByName(ACmbAccountCode.Name));
     InitFilterFindComboBox(ACmbCostCentre,
         (TCmbAutoComplete)FFilterFindPanelObject.FindPanelControls.FindControlByName(ACmbCostCentre.Name));
     InitFilterFindComboBox(ACmbAccountCode,
         (TCmbAutoComplete)FFilterFindPanelObject.FindPanelControls.FindControlByName(ACmbAccountCode.Name));
 }
        /// <summary>
        /// Sets up the value cell(s) for a specific data label
        ///
        /// </summary>
        /// <returns>void</returns>
        private void SetupGridValueCell(Int32 ARowIndex, PDataLabelRow ADataLabelRow)
        {
            Control cellControl;

            System.Windows.Forms.TextBox TextBoxEditor;
            TtxtPetraDate DateEditor;
            System.Windows.Forms.CheckBox CheckBoxEditor;
            TTxtNumericTextBox TextBoxNumericEditor;
            TTxtCurrencyTextBox TextBoxCurrencyEditor;
            TCmbAutoPopulated LookupValueEditor;
            TtxtAutoPopulatedButtonLabel PartnerKeyEditor;
            SourceGrid.Cells.Views.Cell ValueModel;
            SourceGrid.Cells.Views.Cell SuffixModel;
            PDataLabelValuePartnerRow DataLabelValuePartnerRow;
            PDataLabelValueApplicationRow DataLabelValueApplicationRow;

            // prepare model for the value cells
            ValueModel = new SourceGrid.Cells.Views.Cell();
            ValueModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft;
            ValueModel.Font = new Font(FLocalDataLabelValuesGrid.Font.FontFamily.Name, FLocalDataLabelValuesGrid.Font.Size, FontStyle.Bold);

            // prepare model for suffix cells (e.g. for currency)
            SuffixModel = new SourceGrid.Cells.Views.Cell();
            SuffixModel.BackColor = FLocalDataLabelValuesGrid.BackColor;
            SuffixModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft;

            // In this case the data value rows will only be created once a value is entered
            GetOrCreateDataLabelValueRow(false, ADataLabelRow, out DataLabelValuePartnerRow, out DataLabelValueApplicationRow);

            // initialize cell control
            cellControl = null;

            // Create field, according to specified data type
            // Create character field
            if (ADataLabelRow.DataType == MCommonConstants.OFFICESPECIFIC_DATATYPE_CHAR)
            {
                TextBoxEditor = new System.Windows.Forms.TextBox();
                cellControl = TextBoxEditor;

                if (DataLabelValuePartnerRow != null)
                {
                    TextBoxEditor.Text = DataLabelValuePartnerRow.ValueChar;
                }
                else if (DataLabelValueApplicationRow != null)
                {
                    TextBoxEditor.Text = DataLabelValueApplicationRow.ValueChar;
                }
                else
                {
                    // Default value if no Label data exists for the Partner
                    TextBoxEditor.Text = "";
                }

                // enable save button in editor when cell contents have changed
                TextBoxEditor.TextChanged += new EventHandler(this.ControlValueHasChanged);

                FLocalDataLabelValuesGrid[ARowIndex, 1] = new SourceGrid.Cells.Cell();
                FLocalDataLabelValuesGrid.LinkedControls.Add(new LinkedControlValue((Control)TextBoxEditor, new Position(ARowIndex, 1)));
                FLocalDataLabelValuesGrid[ARowIndex, 1].Tag = TextBoxEditor;
            }
            // Create float field
            else if (ADataLabelRow.DataType == MCommonConstants.OFFICESPECIFIC_DATATYPE_FLOAT)
            {
                TextBoxNumericEditor = new TTxtNumericTextBox();

                if (ADataLabelRow.NumDecimalPlaces == 0)
                {
                    TextBoxNumericEditor.ControlMode = TTxtNumericTextBox.TNumericTextBoxMode.LongInteger;
                    TextBoxNumericEditor.MaxLength = 14;
                }
                else
                {
                    TextBoxNumericEditor.ControlMode = TTxtNumericTextBox.TNumericTextBoxMode.Decimal;
                    TextBoxNumericEditor.DecimalPlaces = ADataLabelRow.NumDecimalPlaces;

                    // limit text length. 14 for number of digits, 5 for decimal and thousands separators
                    TextBoxNumericEditor.MaxLength = 14 + 5 + ADataLabelRow.NumDecimalPlaces;
                }

                TextBoxNumericEditor.NullValueAllowed = true;
                cellControl = TextBoxNumericEditor;

                if (ADataLabelRow.NumDecimalPlaces == 0)
                {
                    if (DataLabelValuePartnerRow != null)
                    {
                        TextBoxNumericEditor.NumberValueLongInt = (long)DataLabelValuePartnerRow.ValueNum;
                    }
                    else if (DataLabelValueApplicationRow != null)
                    {
                        TextBoxNumericEditor.NumberValueLongInt = (long)DataLabelValueApplicationRow.ValueNum;
                    }
                    else
                    {
                        // Default value if no Label data exists for the Partner
                        TextBoxNumericEditor.NumberValueLongInt = null;
                    }
                }
                else
                {
                    if (DataLabelValuePartnerRow != null)
                    {
                        TextBoxNumericEditor.NumberValueDecimal = DataLabelValuePartnerRow.ValueNum;
                    }
                    else if (DataLabelValueApplicationRow != null)
                    {
                        TextBoxNumericEditor.NumberValueDecimal = DataLabelValueApplicationRow.ValueNum;
                    }
                    else
                    {
                        // Default value if no Label data exists for the Partner
                        TextBoxNumericEditor.NumberValueDecimal = null;
                    }
                }

                // enable save button in editor when cell contents have changed
                TextBoxNumericEditor.TextChanged += new EventHandler(this.ControlValueHasChanged);

                FLocalDataLabelValuesGrid[ARowIndex, 1] = new SourceGrid.Cells.Cell();
                FLocalDataLabelValuesGrid.LinkedControls.Add(new LinkedControlValue((Control)TextBoxNumericEditor, new Position(ARowIndex, 1)));
                FLocalDataLabelValuesGrid[ARowIndex, 1].Tag = TextBoxNumericEditor;
            }
            // Create data field
            else if (ADataLabelRow.DataType == MCommonConstants.OFFICESPECIFIC_DATATYPE_DATE)
            {
                DateEditor = new TtxtPetraDate();
                DateEditor.Date = null;
                cellControl = DateEditor;

                if (DataLabelValuePartnerRow != null)
                {
                    if (!DataLabelValuePartnerRow.IsValueDateNull())
                    {
                        DateEditor.Date = DataLabelValuePartnerRow.ValueDate;
                    }
                }
                else if (DataLabelValueApplicationRow != null)
                {
                    if (!DataLabelValueApplicationRow.IsValueDateNull())
                    {
                        DateEditor.Date = DataLabelValueApplicationRow.ValueDate;
                    }
                }

                // enable save button in editor when cell contents have changed
                DateEditor.DateChanged += new TPetraDateChangedEventHandler(this.ControlValueHasChanged);

                FLocalDataLabelValuesGrid[ARowIndex, 1] = new SourceGrid.Cells.Cell();
                FLocalDataLabelValuesGrid.LinkedControls.Add(new LinkedControlValue((Control)DateEditor, new Position(ARowIndex, 1)));
                FLocalDataLabelValuesGrid[ARowIndex, 1].Tag = DateEditor;
            }
            // Create integer field
            else if (ADataLabelRow.DataType == MCommonConstants.OFFICESPECIFIC_DATATYPE_INTEGER)
            {
                TextBoxNumericEditor = new TTxtNumericTextBox();
                TextBoxNumericEditor.ControlMode = TTxtNumericTextBox.TNumericTextBoxMode.Integer;
                TextBoxNumericEditor.NullValueAllowed = true;
                cellControl = TextBoxNumericEditor;

                if (DataLabelValuePartnerRow != null)
                {
                    TextBoxNumericEditor.NumberValueInt = DataLabelValuePartnerRow.ValueInt;
                }
                else if (DataLabelValueApplicationRow != null)
                {
                    TextBoxNumericEditor.NumberValueInt = DataLabelValueApplicationRow.ValueInt;
                }
                else
                {
                    // Default value if no Label data exists for the Partner
                    TextBoxNumericEditor.NumberValueInt = null;
                }

                // enable save button in editor when cell contents have changed
                TextBoxNumericEditor.TextChanged += new EventHandler(this.ControlValueHasChanged);

                FLocalDataLabelValuesGrid[ARowIndex, 1] = new SourceGrid.Cells.Cell();
                FLocalDataLabelValuesGrid.LinkedControls.Add(new LinkedControlValue((Control)TextBoxNumericEditor, new Position(ARowIndex, 1)));
                FLocalDataLabelValuesGrid[ARowIndex, 1].Tag = TextBoxNumericEditor;
            }
            // Create currency field
            else if (ADataLabelRow.DataType == MCommonConstants.OFFICESPECIFIC_DATATYPE_CURRENCY)
            {
                TextBoxCurrencyEditor = new TTxtCurrencyTextBox();
                TextBoxCurrencyEditor.DecimalPlaces = 2;
                TextBoxCurrencyEditor.CurrencyCode = ADataLabelRow.CurrencyCode;
                TextBoxCurrencyEditor.NullValueAllowed = true;
                cellControl = TextBoxCurrencyEditor;

                if (DataLabelValuePartnerRow != null)
                {
                    TextBoxCurrencyEditor.NumberValueDecimal = DataLabelValuePartnerRow.ValueCurrency;
                }
                else if (DataLabelValueApplicationRow != null)
                {
                    TextBoxCurrencyEditor.NumberValueDecimal = DataLabelValueApplicationRow.ValueCurrency;
                }
                else
                {
                    // Default value if no Label data exists for the Partner
                    TextBoxCurrencyEditor.NumberValueDecimal = null;
                }

                // enable save button in editor when cell contents have changed
                TextBoxCurrencyEditor.TextChanged += new EventHandler(this.ControlValueHasChanged);

                FLocalDataLabelValuesGrid[ARowIndex, 1] = new SourceGrid.Cells.Cell();
                FLocalDataLabelValuesGrid.LinkedControls.Add(new LinkedControlValue((Control)TextBoxCurrencyEditor, new Position(ARowIndex, 1)));
                FLocalDataLabelValuesGrid[ARowIndex, 1].Tag = TextBoxCurrencyEditor;
            }
            // Create boolean field
            else if (ADataLabelRow.DataType == MCommonConstants.OFFICESPECIFIC_DATATYPE_BOOLEAN)
            {
                CheckBoxEditor = new System.Windows.Forms.CheckBox();
                cellControl = CheckBoxEditor;

                if (DataLabelValuePartnerRow != null)
                {
                    CheckBoxEditor.Checked = DataLabelValuePartnerRow.ValueBool;
                }
                else if (DataLabelValueApplicationRow != null)
                {
                    CheckBoxEditor.Checked = DataLabelValueApplicationRow.ValueBool;
                }
                else
                {
                    // Default value if no Label data exists for the Partner
                    CheckBoxEditor.Checked = false;
                }

                // enable save button in editor when cell contents have changed
                CheckBoxEditor.CheckedChanged += new EventHandler(this.ControlValueHasChanged);

                FLocalDataLabelValuesGrid[ARowIndex, 1] = new SourceGrid.Cells.Cell();
                FLocalDataLabelValuesGrid.LinkedControls.Add(new LinkedControlValue((Control)CheckBoxEditor, new Position(ARowIndex, 1)));
                FLocalDataLabelValuesGrid[ARowIndex, 1].Tag = CheckBoxEditor;
            }
            // Create partner key field
            else if (ADataLabelRow.DataType == MCommonConstants.OFFICESPECIFIC_DATATYPE_PARTNERKEY)
            {
                PartnerKeyEditor = new TtxtAutoPopulatedButtonLabel();
                PartnerKeyEditor.ASpecialSetting = true;
                PartnerKeyEditor.ButtonText = ADataLabelRow.Text + ':';
                PartnerKeyEditor.ButtonTextAlign = System.Drawing.ContentAlignment.MiddleRight;
                PartnerKeyEditor.ListTable = TtxtAutoPopulatedButtonLabel.TListTableEnum.PartnerKey;
                PartnerKeyEditor.TabStop = false;
                cellControl = PartnerKeyEditor;

                // AutomaticallyUpdateDataSource: very rare, but needed here
                PartnerKeyEditor.AutomaticallyUpdateDataSource = true;

                if (DataLabelValuePartnerRow != null)
                {
                    PartnerKeyEditor.Text = StringHelper.PartnerKeyToStr(DataLabelValuePartnerRow.ValuePartnerKey);
                }
                else if (DataLabelValueApplicationRow != null)
                {
                    PartnerKeyEditor.Text = StringHelper.PartnerKeyToStr(DataLabelValueApplicationRow.ValuePartnerKey);
                }
                else
                {
                    // Default value if no Label data exists for the Partner
                    PartnerKeyEditor.Text = StringHelper.PartnerKeyToStr(0);
                }

                // display partner name linked to partner key
                PartnerKeyEditor.ResetLabelText();

                // enable save button in editor when cell contents have changed
                PartnerKeyEditor.ValueChanged += new TDelegatePartnerChanged(this.PartnerKeyControlValueHasChanged);
                PartnerKeyEditor.TextChanged += new System.EventHandler(this.ControlValueHasChanged);


                FLocalDataLabelValuesGrid[ARowIndex, 0] = new SourceGrid.Cells.Cell();
                FLocalDataLabelValuesGrid.LinkedControls.Add(new LinkedControlValue(PartnerKeyEditor, new Position(ARowIndex, 0)));
                FLocalDataLabelValuesGrid[ARowIndex, 0].Tag = PartnerKeyEditor;
                FLocalDataLabelValuesGrid[ARowIndex, 0].ColumnSpan = 3;
            }
            // Create lookup field
            else if (ADataLabelRow.DataType == MCommonConstants.OFFICESPECIFIC_DATATYPE_LOOKUP)
            {
                // Get the instance of the combobox (created in the actual user interface class)
                LookupValueEditor = new TCmbAutoPopulated();
                LookupValueEditor.Filter = PDataLabelLookupTable.GetCategoryCodeDBName() + " = '" + ADataLabelRow.LookupCategoryCode + "'";
                LookupValueEditor.ListTable = TCmbAutoPopulated.TListTableEnum.DataLabelLookupList;
                LookupValueEditor.InitialiseUserControl();
                cellControl = LookupValueEditor;

                if (DataLabelValuePartnerRow != null)
                {
                    LookupValueEditor.SetSelectedString(DataLabelValuePartnerRow.ValueLookup);
                }
                else if (DataLabelValueApplicationRow != null)
                {
                    LookupValueEditor.SetSelectedString(DataLabelValueApplicationRow.ValueLookup);
                }
                else
                {
                    // Default value if no Label data exists for the Partner
                    LookupValueEditor.Text = "";
                }

                // enable save button in editor when cell contents have changed
                LookupValueEditor.SelectedValueChanged += new EventHandler(this.ControlValueHasChanged);
                LookupValueEditor.TextChanged += new EventHandler(this.ControlValueHasChanged);

                FLocalDataLabelValuesGrid[ARowIndex, 1] = new SourceGrid.Cells.Cell();
                FLocalDataLabelValuesGrid.LinkedControls.Add(new LinkedControlValue((Control)LookupValueEditor, new Position(ARowIndex, 1)));
                FLocalDataLabelValuesGrid[ARowIndex, 1].Tag = LookupValueEditor;
                FLocalDataLabelValuesGrid[ARowIndex, 1].ColumnSpan = 2;
            }

            // perform actions that need to be done for each control
            if (cellControl != null)
            {
                // remember the added control to get the value back lateron
                FGridRowInfo.SetControl(ARowIndex, cellControl);

                // handle focus change when field is entered
                cellControl.Enter += new EventHandler(this.UpdateGridFocusFromExternalControl);

                // set help text for control
                PetraUtilsObject.SetStatusBarText(cellControl, ADataLabelRow.Description);
            }

            // check if value is editable
            if (!ADataLabelRow.Editable)
            {
                FLocalDataLabelValuesGrid[ARowIndex, 1].Editor.EnableEdit = false;
            }
        }
Beispiel #26
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;
            }
        }
Beispiel #27
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;
            }
        }
Beispiel #28
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;
            }
        }
        /// <summary>
        /// Helper method that we can call to initialise each of the filter/find comboBoxes
        /// </summary>
        private void InitFilterFindComboBox(TCmbAutoPopulated AClonedFromComboBox,
            TCmbAutoComplete AFFInstance)
        {
            AFFInstance.DisplayMember = AClonedFromComboBox.DisplayMember;
            AFFInstance.ValueMember = AClonedFromComboBox.ValueMember;

            if (AClonedFromComboBox.Name.Contains("Account"))
            {
                // This is quicker than getting the cached table again
                AFFInstance.DataSource = FAccountTable.Copy().DefaultView;
                //AFFInstance.DataSource = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountList, FLedgerNumber).DefaultView;
            }
            else if (AClonedFromComboBox.Name.Contains("CostCentre"))
            {
                // This is quicker than getting the cached table again
                AFFInstance.DataSource = FCostCentreTable.Copy().DefaultView;
                //AFFInstance.DataSource = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.CostCentreList, FLedgerNumber).DefaultView;
            }
            else
            {
                throw new Exception("Unexpected ComboBox name");
            }

            AFFInstance.DrawMode = DrawMode.OwnerDrawFixed;
            AFFInstance.DrawItem += new DrawItemEventHandler(DrawComboBoxItem);
        }
Beispiel #30
0
 /// <summary>
 /// change the filter of the motivation detail combobox when a different motivation group gets selected
 /// </summary>
 /// <param name="AControl"></param>
 /// <param name="AActiveOnly"></param>
 public static void ChangeFilterMotivationGroupList(ref TCmbAutoPopulated AControl, bool AActiveOnly)
 {
     if (AActiveOnly)
     {
         AControl.Filter = "Active = true";
     }
     else
     {
         AControl.Filter = string.Empty;
     }
 }