protected virtual void CATransfer_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            CATransfer transfer = (CATransfer)e.Row;

            if (transfer == null)
            {
                return;
            }
            CMSetup setup = cmsetup.Current;

            transfer.RGOLAmt = transfer.TranIn - transfer.TranOut;

            bool transferOnHold      = (transfer.Hold == true);
            bool transferNotReleased = (transfer.Released != true);
            bool transferReleased    = (transfer.Released == true);
            bool msActivated         = (setup.MCActivated == true);

            PXUIFieldAttribute.SetVisible <CATransfer.inCuryID>                             (sender, transfer, msActivated);
            PXUIFieldAttribute.SetVisible <CATransfer.outCuryID>                            (sender, transfer, msActivated);
            PXUIFieldAttribute.SetVisible <CATransfer.rGOLAmt>                              (sender, transfer, msActivated);
            PXUIFieldAttribute.SetVisible <CATransfer.inGLBalance>                          (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.outGLBalance>                     (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.cashBalanceIn>                    (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.cashBalanceOut>                   (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.tranIDIn_CATran_batchNbr> (sender, transfer, transferReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.tranIDOut_CATran_batchNbr>(sender, transfer, transferReleased);

            PXUIFieldAttribute.SetEnabled(sender, transfer, false);


            AddTrxFilter filter = AddFilter.Current;

            if (filter != null)
            {
                PXUIFieldAttribute.SetEnabled(AddFilter.Cache, filter, transferNotReleased);
                AddFilter.Cache.AllowUpdate = transferNotReleased;
            }

            sender.AllowDelete             = transferNotReleased;
            sender.AllowUpdate             = transferNotReleased;
            TransferTran.Cache.AllowDelete = transferNotReleased;


            CashAccount cashaccountOut = (CashAccount)PXSelectorAttribute.Select <CATransfer.outAccountID>(sender, e.Row);
            CashAccount cashaccountIn  = (CashAccount)PXSelectorAttribute.Select <CATransfer.inAccountID>(sender, e.Row);

            bool clearEnabledIn  = transferNotReleased && (cashaccountIn != null) && (cashaccountIn.Reconcile == true);
            bool clearEnabledOut = transferNotReleased && (cashaccountOut != null) && (cashaccountOut.Reconcile == true);

            PXUIFieldAttribute.SetEnabled <CATransfer.hold>        (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.transferNbr> (sender, transfer, true);
            PXUIFieldAttribute.SetEnabled <CATransfer.descr>       (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.curyTranIn>  (sender, transfer, transferNotReleased && (transfer.OutCuryID != transfer.InCuryID));
            PXUIFieldAttribute.SetEnabled <CATransfer.inAccountID> (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.inDate>      (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.inExtRefNbr> (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.curyTranOut> (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.outAccountID>(sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.outDate>     (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.outExtRefNbr>(sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.clearedOut>  (sender, transfer, clearEnabledOut);
            PXUIFieldAttribute.SetEnabled <CATransfer.clearDateOut>(sender, transfer, clearEnabledOut && transfer.ClearedOut == true);
            PXUIFieldAttribute.SetEnabled <CATransfer.clearedIn>   (sender, transfer, clearEnabledIn);
            PXUIFieldAttribute.SetEnabled <CATransfer.clearDateIn> (sender, transfer, clearEnabledIn && transfer.ClearedIn == true);


            TransferTran.Cache.AllowInsert = false;
            TransferTran.Cache.AllowUpdate = false;

            AddFilter.Cache.RaiseRowSelected(AddFilter.Current);

            Release.SetEnabled(transferNotReleased && !transferOnHold);
            PrepareAdd.SetEnabled(transferNotReleased);
        }
示例#2
0
        protected virtual void CATransfer_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            CATransfer transfer = (CATransfer)e.Row;

            if (transfer == null)
            {
                return;
            }

            transfer.RGOLAmt = transfer.TranIn - transfer.TranOut;

            bool transferOnHold      = (transfer.Hold == true);
            bool transferNotReleased = (transfer.Released != true);
            bool transferReleased    = (transfer.Released == true);
            bool msFeatureInstalled  = PXAccess.FeatureInstalled <FeaturesSet.multicurrency>();

            PXUIFieldAttribute.SetVisible <CATransfer.inCuryID>                             (sender, transfer, msFeatureInstalled);
            PXUIFieldAttribute.SetVisible <CATransfer.outCuryID>                            (sender, transfer, msFeatureInstalled);
            PXUIFieldAttribute.SetVisible <CATransfer.rGOLAmt>                              (sender, transfer, msFeatureInstalled);
            PXUIFieldAttribute.SetVisible <CATransfer.inGLBalance>                          (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.outGLBalance>                     (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.cashBalanceIn>                    (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.cashBalanceOut>                   (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.tranIDIn_CATran_batchNbr> (sender, transfer, transferReleased);
            PXUIFieldAttribute.SetVisible <CATransfer.tranIDOut_CATran_batchNbr>(sender, transfer, transferReleased);

            PXUIFieldAttribute.SetEnabled(sender, transfer, false);


            AddTrxFilter filter = AddFilter.Current;

            if (filter != null)
            {
                PXUIFieldAttribute.SetEnabled(AddFilter.Cache, filter, transferNotReleased);
                AddFilter.Cache.AllowUpdate = transferNotReleased;
            }

            sender.AllowDelete             = transferNotReleased;
            sender.AllowUpdate             = transferNotReleased;
            TransferTran.Cache.AllowDelete = transferNotReleased;


            CashAccount cashaccountOut = (CashAccount)PXSelectorAttribute.Select <CATransfer.outAccountID>(sender, e.Row);
            CashAccount cashaccountIn  = (CashAccount)PXSelectorAttribute.Select <CATransfer.inAccountID>(sender, e.Row);

            bool clearEnabledIn  = transferNotReleased && (cashaccountIn != null) && (cashaccountIn.Reconcile == true);
            bool clearEnabledOut = transferNotReleased && (cashaccountOut != null) && (cashaccountOut.Reconcile == true);

            PXUIFieldAttribute.SetEnabled <CATransfer.hold>        (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.transferNbr> (sender, transfer, true);
            PXUIFieldAttribute.SetEnabled <CATransfer.descr>       (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.curyTranIn>  (sender, transfer, transferNotReleased && (transfer.OutCuryID != transfer.InCuryID));
            PXUIFieldAttribute.SetEnabled <CATransfer.inAccountID> (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.inDate>      (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.inExtRefNbr> (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.curyTranOut> (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.outAccountID>(sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.outDate>     (sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.outExtRefNbr>(sender, transfer, transferNotReleased);
            PXUIFieldAttribute.SetEnabled <CATransfer.clearedOut>  (sender, transfer, clearEnabledOut);
            PXUIFieldAttribute.SetEnabled <CATransfer.clearDateOut>(sender, transfer, clearEnabledOut && transfer.ClearedOut == true);
            PXUIFieldAttribute.SetEnabled <CATransfer.clearedIn>   (sender, transfer, clearEnabledIn);
            PXUIFieldAttribute.SetEnabled <CATransfer.clearDateIn> (sender, transfer, clearEnabledIn && transfer.ClearedIn == true);


            TransferTran.Cache.AllowInsert = false;
            TransferTran.Cache.AllowUpdate = false;

            AddFilter.Cache.RaiseRowSelected(AddFilter.Current);
            Release.SetEnabled(transferNotReleased && !transferOnHold);
            PrepareAdd.SetEnabled(transferNotReleased && cashaccountIn != null && cashaccountOut != null && !(String.IsNullOrEmpty(transfer.InExtRefNbr)) && !(String.IsNullOrEmpty(transfer.OutExtRefNbr)) && transfer.InDate.HasValue && transfer.OutDate.HasValue);

            if (transfer.Released != true && transfer.OutDate > transfer.InDate)
            {
                sender.RaiseExceptionHandling <CATransfer.inDate>(transfer, transfer.InDate, new PXSetPropertyException(Messages.EarlyInDate, PXErrorLevel.Warning));
            }
            else
            {
                sender.RaiseExceptionHandling <CATransfer.inDate>(transfer, transfer.InDate, null);
            }
        }