예제 #1
0
        void UpdateMotivationDetail(object sender, EventArgs e)
        {
            String motivationGroup = cmbMotivGroup.GetSelectedString();

            TFinanceControls.ChangeMotivationDetailListFilter(ref cmbMotivDetail, motivationGroup);

            if (FsuppressChangeEvent == 0)
            {
                UpdateGrid(sender, e);
            }
        }
        private void ApplyMotivationDetailCodeFilter(out bool ADoTaxUpdate)
        {
            ADoTaxUpdate = false;

            //Refilter the combo with suppressed changes
            TFinanceControls.ChangeMotivationDetailListFilter(ref cmbMotivationDetailCode, FMotivationGroup, -1, FPetraUtilsObject);

            Int32 NumberOfFilteredMotivationDetails = cmbMotivationDetailCode.Count;

            if (FMotivationGroupChangedInProcess && (NumberOfFilteredMotivationDetails > 0))
            {
                //Highlight first item after refilter
                cmbMotivationDetailCode.SelectedIndex = 0;
                FMotivationDetail = cmbMotivationDetailCode.GetSelectedString();
                txtDetailMotivationDetailCode.Text = FMotivationDetail;
                txtMotivationDetailDesc.Text       = cmbMotivationDetailCode.GetSelectedDescription();
            }
            else if (NumberOfFilteredMotivationDetails > 0)
            {
                cmbMotivationDetailCode.SetSelectedString(FMotivationDetail, -1);
                txtMotivationDetailDesc.Text = cmbMotivationDetailCode.GetSelectedDescription();
                ADoTaxUpdate = false;
            }
            else
            {
                //No motivation details added to this motivation group as yet
                cmbMotivationDetailCode.SelectedIndex = -1;
                txtDetailMotivationDetailCode.Text    = string.Empty;
                txtMotivationDetailDesc.Text          = string.Empty;
                FMotivationDetail = string.Empty;
            }

            //The following code will handle an empty motivation details combo box
            DisplayMotivationDetailAccountCode();

            if ((txtDetailRecipientKey.Text == string.Empty) || (Convert.ToInt64(txtDetailRecipientKey.Text) == 0))
            {
                txtDetailRecipientKey.Text = String.Format("{0:0000000000}", 0);
                DisplayMotivationDetailCostCentreCode();
            }
        }