コード例 #1
0
        /// <summary>
        /// show the form for the gift reversal/adjustment
        /// </summary>
        /// <param name="AFunctionName">Which function shall be called on the server</param>
        public void ShowRevertAdjustForm(GiftAdjustmentFunctionEnum AFunctionName)
        {
            TFrmGiftBatch ParentGiftBatchForm = (TFrmGiftBatch)ParentForm;
            bool ReverseWholeBatch = (AFunctionName == GiftAdjustmentFunctionEnum.ReverseGiftBatch);
            bool AdjustGift = (AFunctionName == GiftAdjustmentFunctionEnum.AdjustGift);

            if (!ParentGiftBatchForm.SaveChangesManual())
            {
                return;
            }

            ParentGiftBatchForm.Cursor = Cursors.WaitCursor;

            AGiftBatchRow giftBatch = ((TFrmGiftBatch)ParentForm).GetBatchControl().GetSelectedDetailRow();
            int BatchNumber = giftBatch.BatchNumber;

            if (giftBatch == null)
            {
                MessageBox.Show(Catalog.GetString("Please select a Gift Batch to Reverse."));
                ParentGiftBatchForm.Cursor = Cursors.Default;
                return;
            }

            if (!giftBatch.BatchStatus.Equals(MFinanceConstants.BATCH_POSTED))
            {
                MessageBox.Show(Catalog.GetString("This function is only possible when the selected batch is already posted."));
                ParentGiftBatchForm.Cursor = Cursors.Default;
                return;
            }

            if (FPetraUtilsObject.HasChanges)
            {
                MessageBox.Show(Catalog.GetString("Please save first and than try again!"));
                ParentGiftBatchForm.Cursor = Cursors.Default;
                return;
            }

            if (ReverseWholeBatch && (FBatchNumber != BatchNumber))
            {
                ParentGiftBatchForm.SelectTab(TFrmGiftBatch.eGiftTabs.Transactions, true);
                ParentGiftBatchForm.SelectTab(TFrmGiftBatch.eGiftTabs.Batches);
                ParentGiftBatchForm.Cursor = Cursors.WaitCursor;
            }

            if (FPreviouslySelectedDetailRow == null)
            {
                MessageBox.Show(Catalog.GetString("Please select a Gift to Reverse."));
                ParentGiftBatchForm.Cursor = Cursors.Default;
                return;
            }

            TFrmGiftRevertAdjust revertForm = new TFrmGiftRevertAdjust(FPetraUtilsObject.GetForm());

            int workingLedgerNumber = FPreviouslySelectedDetailRow.LedgerNumber;
            int workingBatchNumber = FPreviouslySelectedDetailRow.BatchNumber;
            int workingTransactionNumber = FPreviouslySelectedDetailRow.GiftTransactionNumber;
            int workingDetailNumber = FPreviouslySelectedDetailRow.DetailNumber;

            if (FTaxDeductiblePercentageEnabled)
            {
                revertForm.CheckTaxDeductPctChange = true;
            }

            revertForm.CheckGiftDestinationChange = true;

            try
            {
                ParentForm.ShowInTaskbar = false;
                revertForm.LedgerNumber = FLedgerNumber;
                revertForm.CurrencyCode = ((AGiftBatchRow)FMainDS.AGiftBatch.Rows.Find(
                                               new object[] { workingLedgerNumber, workingBatchNumber })).CurrencyCode;

                // put spaces inbetween words
                revertForm.Text = Regex.Replace(AFunctionName.ToString(), "([a-z])([A-Z])", @"$1 $2");

                revertForm.AddParam("Function", AFunctionName);

                revertForm.GiftDetailRow = (AGiftDetailRow)FMainDS.AGiftDetail.Rows.Find(
                    new object[] { workingLedgerNumber, workingBatchNumber, workingTransactionNumber, workingDetailNumber });

                if (!revertForm.IsDisposed && (revertForm.ShowDialog() == DialogResult.OK))
                {
                    ParentGiftBatchForm.Cursor = Cursors.WaitCursor;

                    if ((revertForm.AdjustmentBatchNumber > 0) && (revertForm.AdjustmentBatchNumber != workingBatchNumber))
                    {
                        // select the relevant batch
                        ParentGiftBatchForm.InitialBatchNumber = revertForm.AdjustmentBatchNumber;
                    }

                    ParentGiftBatchForm.RefreshAll();
                }
            }
            finally
            {
                ParentGiftBatchForm.Cursor = Cursors.WaitCursor;
                revertForm.Dispose();
                ParentForm.ShowInTaskbar = true;
                ParentGiftBatchForm.Cursor = Cursors.Default;
            }

            if (AdjustGift && (ParentGiftBatchForm.ActiveTab() == TFrmGiftBatch.eGiftTabs.Transactions))
            {
                //Select first row for adjusting, i.e. first +ve amount
                foreach (DataRowView drv in FMainDS.AGiftDetail.DefaultView)
                {
                    AGiftDetailRow gdr = (AGiftDetailRow)drv.Row;

                    if (gdr.GiftTransactionAmount > 0)
                    {
                        grdDetails.SelectRowInGrid(grdDetails.Rows.DataSourceRowToIndex(drv) + 1);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Carry out the gift adjustment (field or tax deductible pct)
        /// </summary>
        /// <param name="AGiftBatchDS">Gift Batch containing GiftDetail rows for all gifts to be adjusted.</param>
        /// <param name="ANewPct">New Tax Deductible Percentage (null if not being used)</param>
        /// <param name="ANoReceipt">True if no receipt</param>
        /// <param name="AParentForm"></param>
        public static void GiftAdjustment(GiftBatchTDS AGiftBatchDS, decimal?ANewPct, bool ANoReceipt, Form AParentForm)
        {
            // sort gift batches so like batches are together
            AGiftBatchDS.AGiftBatch.DefaultView.Sort = AGiftBatchTable.GetLedgerNumberDBName() + " ASC, " +
                                                       AGiftBatchTable.GetCurrencyCodeDBName() + " ASC, " +
                                                       AGiftBatchTable.GetBankCostCentreDBName() + " ASC, " +
                                                       AGiftBatchTable.GetBankAccountCodeDBName() + " ASC, " +
                                                       AGiftBatchTable.GetGiftTypeDBName() + " ASC";

            GiftBatchTDS NewGiftDS = new GiftBatchTDS();

            NewGiftDS.AGiftDetail.Merge(new GiftBatchTDSAGiftDetailTable());

            for (int i = 0; i < AGiftBatchDS.AGiftBatch.Rows.Count; i++)
            {
                AGiftBatchRow OldGiftBatch  = (AGiftBatchRow)AGiftBatchDS.AGiftBatch.DefaultView[i].Row;
                AGiftBatchRow NextGiftBatch = null;

                // add batch's gift/s to dataset
                DataView Gifts = new DataView(AGiftBatchDS.AGift);
                Gifts.RowFilter = string.Format("{0}={1}",
                                                AGiftDetailTable.GetBatchNumberDBName(),
                                                OldGiftBatch.BatchNumber);

                foreach (DataRowView giftRows in Gifts)
                {
                    AGiftRow gR = (AGiftRow)giftRows.Row;
                    NewGiftDS.AGift.ImportRow(gR);
                }

                // add batch's gift detail/s to dataset
                DataView GiftDetails = new DataView(AGiftBatchDS.AGiftDetail);
                GiftDetails.RowFilter = string.Format("{0}={1}",
                                                      AGiftDetailTable.GetBatchNumberDBName(),
                                                      OldGiftBatch.BatchNumber);

                foreach (DataRowView giftDetailRows in GiftDetails)
                {
                    AGiftDetailRow gDR = (AGiftDetailRow)giftDetailRows.Row;
                    NewGiftDS.AGiftDetail.ImportRow(gDR);
                }

                // if not the last row
                if (i != AGiftBatchDS.AGiftBatch.Rows.Count - 1)
                {
                    NextGiftBatch = (AGiftBatchRow)AGiftBatchDS.AGiftBatch.DefaultView[i + 1].Row;
                }

                // if this is the last batch or if the next batch's gifts need to be added to a different new batch
                if ((NextGiftBatch == null) ||
                    (NextGiftBatch.LedgerNumber != OldGiftBatch.LedgerNumber) ||
                    (NextGiftBatch.CurrencyCode != OldGiftBatch.CurrencyCode) ||
                    (NextGiftBatch.BankCostCentre != OldGiftBatch.BankCostCentre) ||
                    (NextGiftBatch.BankAccountCode != OldGiftBatch.BankAccountCode) ||
                    (NextGiftBatch.GiftType != OldGiftBatch.GiftType))
                {
                    TFrmGiftRevertAdjust AdjustForm = new TFrmGiftRevertAdjust(AParentForm);

                    try
                    {
                        AParentForm.ShowInTaskbar = false;

                        AdjustForm.LedgerNumber = OldGiftBatch.LedgerNumber;
                        AdjustForm.CurrencyCode = OldGiftBatch.CurrencyCode;
                        AdjustForm.Text         = "Adjust Gift";
                        AdjustForm.AddParam("Function", GiftAdjustmentFunctionEnum.FieldAdjust);
                        AdjustForm.GiftMainDS = NewGiftDS;
                        AdjustForm.NoReceipt  = ANoReceipt;

                        AdjustForm.AddBatchDetailsToScreen(OldGiftBatch.LedgerNumber, OldGiftBatch.CurrencyCode,
                                                           OldGiftBatch.BankCostCentre, OldGiftBatch.BankAccountCode, OldGiftBatch.GiftType);

                        if (ANewPct != null)
                        {
                            AdjustForm.AddParam("Function", GiftAdjustmentFunctionEnum.TaxDeductiblePctAdjust);
                            AdjustForm.AddParam("NewPct", ANewPct);

                            // gift destination must be the original for tax deduct pct adjustments
                            AdjustForm.AddParam("FixedGiftDestination", true);

                            // comments will be auto completed
                            AdjustForm.AutoCompleteComments();
                        }
                        else
                        {
                            AdjustForm.AddParam("Function", GiftAdjustmentFunctionEnum.FieldAdjust);
                        }

                        AdjustForm.GiftDetailRow = NewGiftDS.AGiftDetail[0];

                        if (AdjustForm.IsDisposed || (AdjustForm.ShowDialog() != DialogResult.OK))
                        {
                            continue;
                        }
                    }
                    finally
                    {
                        AParentForm.Cursor = Cursors.WaitCursor;
                        AdjustForm.Dispose();
                        AParentForm.ShowInTaskbar = true;
                        NewGiftDS.AGiftDetail.Clear();
                        NewGiftDS.AGift.Clear();
                        AParentForm.Cursor = Cursors.Default;
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Carry out the gift adjustment (field or tax deductible pct)
        /// </summary>
        /// <param name="AGiftBatchDS">Gift Batch containing GiftDetail rows for all gifts to be adjusted.</param>
        /// <param name="ANewPct">New Tax Deductible Percentage (null if not being used)</param>
        /// <param name="ANoReceipt">True if no receipt</param>
        /// <param name="AParentForm"></param>
        public static void GiftAdjustment(GiftBatchTDS AGiftBatchDS, decimal? ANewPct, bool ANoReceipt, Form AParentForm)
        {
            // sort gift batches so like batches are together
            AGiftBatchDS.AGiftBatch.DefaultView.Sort = AGiftBatchTable.GetLedgerNumberDBName() + " ASC, " +
                                                       AGiftBatchTable.GetCurrencyCodeDBName() + " ASC, " +
                                                       AGiftBatchTable.GetBankCostCentreDBName() + " ASC, " +
                                                       AGiftBatchTable.GetBankAccountCodeDBName() + " ASC, " +
                                                       AGiftBatchTable.GetGiftTypeDBName() + " ASC";

            GiftBatchTDS NewGiftDS = new GiftBatchTDS();
            NewGiftDS.AGiftDetail.Merge(new GiftBatchTDSAGiftDetailTable());

            for (int i = 0; i < AGiftBatchDS.AGiftBatch.Rows.Count; i++)
            {
                AGiftBatchRow OldGiftBatch = (AGiftBatchRow)AGiftBatchDS.AGiftBatch.DefaultView[i].Row;
                AGiftBatchRow NextGiftBatch = null;

                // add batch's gift/s to dataset
                DataView Gifts = new DataView(AGiftBatchDS.AGift);
                Gifts.RowFilter = string.Format("{0}={1}",
                    AGiftDetailTable.GetBatchNumberDBName(),
                    OldGiftBatch.BatchNumber);

                foreach (DataRowView giftRows in Gifts)
                {
                    AGiftRow gR = (AGiftRow)giftRows.Row;
                    NewGiftDS.AGift.ImportRow(gR);
                }

                // add batch's gift detail/s to dataset
                DataView GiftDetails = new DataView(AGiftBatchDS.AGiftDetail);
                GiftDetails.RowFilter = string.Format("{0}={1}",
                    AGiftDetailTable.GetBatchNumberDBName(),
                    OldGiftBatch.BatchNumber);

                foreach (DataRowView giftDetailRows in GiftDetails)
                {
                    AGiftDetailRow gDR = (AGiftDetailRow)giftDetailRows.Row;
                    NewGiftDS.AGiftDetail.ImportRow(gDR);
                }

                // if not the last row
                if (i != AGiftBatchDS.AGiftBatch.Rows.Count - 1)
                {
                    NextGiftBatch = (AGiftBatchRow)AGiftBatchDS.AGiftBatch.DefaultView[i + 1].Row;
                }

                // if this is the last batch or if the next batch's gifts need to be added to a different new batch
                if ((NextGiftBatch == null)
                    || (NextGiftBatch.LedgerNumber != OldGiftBatch.LedgerNumber)
                    || (NextGiftBatch.CurrencyCode != OldGiftBatch.CurrencyCode)
                    || (NextGiftBatch.BankCostCentre != OldGiftBatch.BankCostCentre)
                    || (NextGiftBatch.BankAccountCode != OldGiftBatch.BankAccountCode)
                    || (NextGiftBatch.GiftType != OldGiftBatch.GiftType))
                {
                    TFrmGiftRevertAdjust AdjustForm = new TFrmGiftRevertAdjust(AParentForm);

                    try
                    {
                        AParentForm.ShowInTaskbar = false;

                        AdjustForm.LedgerNumber = OldGiftBatch.LedgerNumber;
                        AdjustForm.CurrencyCode = OldGiftBatch.CurrencyCode;
                        AdjustForm.Text = "Adjust Gift";
                        AdjustForm.AddParam("Function", GiftAdjustmentFunctionEnum.FieldAdjust);
                        AdjustForm.GiftMainDS = NewGiftDS;
                        AdjustForm.NoReceipt = ANoReceipt;

                        AdjustForm.AddBatchDetailsToScreen(OldGiftBatch.LedgerNumber, OldGiftBatch.CurrencyCode,
                            OldGiftBatch.BankCostCentre, OldGiftBatch.BankAccountCode, OldGiftBatch.GiftType);

                        if (ANewPct != null)
                        {
                            AdjustForm.AddParam("Function", GiftAdjustmentFunctionEnum.TaxDeductiblePctAdjust);
                            AdjustForm.AddParam("NewPct", ANewPct);

                            // gift destination must be the original for tax deduct pct adjustments
                            AdjustForm.AddParam("FixedGiftDestination", true);

                            // comments will be auto completed
                            AdjustForm.AutoCompleteComments();
                        }
                        else
                        {
                            AdjustForm.AddParam("Function", GiftAdjustmentFunctionEnum.FieldAdjust);
                        }

                        AdjustForm.GiftDetailRow = NewGiftDS.AGiftDetail[0];

                        if (AdjustForm.IsDisposed || (AdjustForm.ShowDialog() != DialogResult.OK))
                        {
                            return;
                        }
                    }
                    finally
                    {
                        AParentForm.Cursor = Cursors.WaitCursor;
                        AdjustForm.Dispose();
                        AParentForm.ShowInTaskbar = true;
                        NewGiftDS.AGiftDetail.Clear();
                        NewGiftDS.AGift.Clear();
                        AParentForm.Cursor = Cursors.Default;
                    }
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// show the form for the gift reversal/adjustment
        /// </summary>
        /// <param name="AFunctionName">Which function shall be called on the server</param>
        public void ShowRevertAdjustForm(String AFunctionName)
        {
            bool reverseWholeBatch = (AFunctionName == "Reverse Gift Batch");

            if (!((TFrmGiftBatch)ParentForm).SaveChangesManual())
            {
                return;
            }

            ((TFrmGiftBatch)ParentForm).Cursor = Cursors.WaitCursor;

            AGiftBatchRow giftBatch = ((TFrmGiftBatch)ParentForm).GetBatchControl().GetSelectedDetailRow();
            int BatchNumber = giftBatch.BatchNumber;

            if (giftBatch == null)
            {
                MessageBox.Show(Catalog.GetString("Please select a Gift Batch to Reverse."));
                ((TFrmGiftBatch)ParentForm).Cursor = Cursors.Default;
                return;
            }

            if (!giftBatch.BatchStatus.Equals(MFinanceConstants.BATCH_POSTED))
            {
                MessageBox.Show(Catalog.GetString("This function is only possible when the selected batch is already posted."));
                ((TFrmGiftBatch)ParentForm).Cursor = Cursors.Default;
                return;
            }

            if (FPetraUtilsObject.HasChanges)
            {
                MessageBox.Show(Catalog.GetString("Please save first and than try again!"));
                ((TFrmGiftBatch)ParentForm).Cursor = Cursors.Default;
                return;
            }

            if (reverseWholeBatch && (FBatchNumber != BatchNumber))
            {
                ((TFrmGiftBatch)ParentForm).SelectTab(TFrmGiftBatch.eGiftTabs.Transactions);
                ((TFrmGiftBatch)ParentForm).SelectTab(TFrmGiftBatch.eGiftTabs.Batches);
                ((TFrmGiftBatch)ParentForm).Cursor = Cursors.WaitCursor;
            }

            if (FPreviouslySelectedDetailRow == null)
            {
                MessageBox.Show(Catalog.GetString("Please select a Gift to Reverse."));
                ((TFrmGiftBatch)ParentForm).Cursor = Cursors.Default;
                return;
            }

            int workingLedgerNumber = FPreviouslySelectedDetailRow.LedgerNumber;
            int workingBatchNumber = FPreviouslySelectedDetailRow.BatchNumber;
            int workingTransactionNumber = FPreviouslySelectedDetailRow.GiftTransactionNumber;
            int workingDetailNumber = FPreviouslySelectedDetailRow.DetailNumber;

            TFrmGiftRevertAdjust revertForm = new TFrmGiftRevertAdjust(FPetraUtilsObject.GetForm());

            try
            {
                ParentForm.ShowInTaskbar = false;
                revertForm.LedgerNumber = FLedgerNumber;
                revertForm.Text = AFunctionName;

                revertForm.AddParam("Function", AFunctionName.Replace(" ", string.Empty));

                if (reverseWholeBatch)
                {
                    revertForm.GiftMainDS = FMainDS;
                }

                //revertForm.GiftBatchRow = giftBatch;   // TODO Decide whether to remove altogether

                revertForm.GiftDetailRow = (AGiftDetailRow)FMainDS.AGiftDetail.Rows.Find(
                    new object[] { workingLedgerNumber, workingBatchNumber, workingTransactionNumber, workingDetailNumber });

                if (revertForm.ShowDialog() == DialogResult.OK)
                {
                    ((TFrmGiftBatch)ParentForm).Cursor = Cursors.WaitCursor;
                    ((TFrmGiftBatch)ParentForm).RefreshAll();
                }
            }
            finally
            {
                ((TFrmGiftBatch)ParentForm).Cursor = Cursors.WaitCursor;
                revertForm.Dispose();
                ParentForm.ShowInTaskbar = true;
                ((TFrmGiftBatch)ParentForm).Cursor = Cursors.Default;
            }
        }
コード例 #5
0
        /// <summary>
        /// show the form for the gift reversal/adjustment
        /// </summary>
        /// <param name="AFunctionName">Which function shall be called on the server</param>
        private void ShowRevertAdjustForm(GiftAdjustmentFunctionEnum AFunctionName)
        {
            TFrmGiftBatch ParentGiftBatchForm = (TFrmGiftBatch)ParentForm;
            bool          ReverseWholeBatch   = (AFunctionName == GiftAdjustmentFunctionEnum.ReverseGiftBatch);
            bool          AdjustGift          = (AFunctionName == GiftAdjustmentFunctionEnum.AdjustGift);

            if (!ParentGiftBatchForm.SaveChangesManual())
            {
                return;
            }

            ParentGiftBatchForm.Cursor = Cursors.WaitCursor;

            AGiftBatchRow giftBatch   = ((TFrmGiftBatch)ParentForm).GetBatchControl().GetSelectedDetailRow();
            int           BatchNumber = giftBatch.BatchNumber;

            if (giftBatch == null)
            {
                MessageBox.Show(Catalog.GetString("Please select a Gift Batch to Reverse."));
                ParentGiftBatchForm.Cursor = Cursors.Default;
                return;
            }

            if (!giftBatch.BatchStatus.Equals(MFinanceConstants.BATCH_POSTED))
            {
                MessageBox.Show(Catalog.GetString("This function is only possible when the selected batch is already posted."));
                ParentGiftBatchForm.Cursor = Cursors.Default;
                return;
            }

            if (FPetraUtilsObject.HasChanges)
            {
                MessageBox.Show(Catalog.GetString("Please save first and than try again!"));
                ParentGiftBatchForm.Cursor = Cursors.Default;
                return;
            }

            if (ReverseWholeBatch && (FBatchNumber != BatchNumber))
            {
                ParentGiftBatchForm.SelectTab(TFrmGiftBatch.eGiftTabs.Transactions, true);
                ParentGiftBatchForm.SelectTab(TFrmGiftBatch.eGiftTabs.Batches);
                ParentGiftBatchForm.Cursor = Cursors.WaitCursor;
            }

            if (!ReverseWholeBatch && (FPreviouslySelectedDetailRow == null))
            {
                MessageBox.Show(Catalog.GetString("Please select a Gift to Adjust/Reverse."));
                ParentGiftBatchForm.Cursor = Cursors.Default;
                return;
            }

            TFrmGiftRevertAdjust revertForm = new TFrmGiftRevertAdjust(FPetraUtilsObject.GetForm());

            if (AdjustGift)
            {
                if (FSETUseTaxDeductiblePercentageFlag)
                {
                    revertForm.CheckTaxDeductPctChange = true;
                }

                revertForm.CheckGiftDestinationChange = true;
            }

            try
            {
                ParentForm.ShowInTaskbar = false;
                revertForm.LedgerNumber  = FLedgerNumber;
                revertForm.CurrencyCode  = giftBatch.CurrencyCode;

                // put spaces inbetween words
                revertForm.Text = Regex.Replace(AFunctionName.ToString(), "([a-z])([A-Z])", @"$1 $2");

                revertForm.AddParam("Function", AFunctionName);
                revertForm.AddParam("BatchNumber", giftBatch.BatchNumber);

                if (AdjustGift)
                {
                    int workingTransactionNumber = FPreviouslySelectedDetailRow.GiftTransactionNumber;
                    int workingDetailNumber      = FPreviouslySelectedDetailRow.DetailNumber;
                    revertForm.GiftDetailRow = (AGiftDetailRow)FMainDS.AGiftDetail.Rows.Find(
                        new object[] { giftBatch.LedgerNumber, giftBatch.BatchNumber, workingTransactionNumber, workingDetailNumber });
                }

                if (ReverseWholeBatch)
                {
                    revertForm.GetGiftsForReverseAdjust(); // Added Feb '17 Tim Ingham - previously, reversing a whole batch didn't work.
                }

                if (!revertForm.IsDisposed && (revertForm.ShowDialog() == DialogResult.OK))
                {
                    ParentGiftBatchForm.Cursor = Cursors.WaitCursor;

                    if ((revertForm.AdjustmentBatchNumber > 0) && (revertForm.AdjustmentBatchNumber != giftBatch.BatchNumber))
                    {
                        // select the relevant batch
                        ParentGiftBatchForm.InitialBatchNumber = revertForm.AdjustmentBatchNumber;
                    }

                    ParentGiftBatchForm.RefreshAll();
                }
            }
            finally
            {
                ParentGiftBatchForm.Cursor = Cursors.WaitCursor;
                revertForm.Dispose();
                ParentForm.ShowInTaskbar   = true;
                ParentGiftBatchForm.Cursor = Cursors.Default;
            }

            if (AdjustGift && (ParentGiftBatchForm.ActiveTab() == TFrmGiftBatch.eGiftTabs.Transactions))
            {
                //Select first row for adjusting, i.e. first +ve amount
                foreach (DataRowView drv in FMainDS.AGiftDetail.DefaultView)
                {
                    AGiftDetailRow gdr = (AGiftDetailRow)drv.Row;

                    if (gdr.GiftTransactionAmount > 0)
                    {
                        grdDetails.SelectRowInGrid(grdDetails.Rows.DataSourceRowToIndex(drv) + 1);
                    }
                }
            }
        }