Example #1
0
        private void RecalcFormulas(RUTROT rutrot, DocExt document)
        {
            if (document.IsRUTROTDeductible == true)
            {
                foreach (Tran tran in Transactions.Select())
                {
                    if (PXCache <Tran> .GetExtension <TranExt>(tran)?.IsRUTROTDeductible == true)
                    {
                        Transactions.Cache.RaiseFieldUpdated("IsRUTROTDeductible", tran, false);                        //this is required for updating formula on ARTranRUTROT.CuryRUTROTAvailableAmt
                    }
                }
                foreach (RUTROTDistribution distribution in RRDistribution.Select())
                {
                    RRDistribution.Cache.RaiseFieldUpdated <RUTROTDistribution.extra>(distribution, !distribution.Extra);                   //this is required for updating formula on RUTROTDistribution.curyAllowance
                }

                PXUnboundFormulaAttribute.CalcAggregate <ARTranRUTROT.curyRUTROTTotal>(Transactions.Cache, rutrot);
                PXFormulaAttribute.CalcAggregate <ARTranRUTROT.curyRUTROTAvailableAmt>(Transactions.Cache, rutrot);

                PXUnboundFormulaAttribute.CalcAggregate <SOLineRUTROT.curyRUTROTTotal>(Transactions.Cache, rutrot);
                PXFormulaAttribute.CalcAggregate <SOLineRUTROT.curyRUTROTAvailableAmt>(Transactions.Cache, rutrot);

                PXFormulaAttribute.CalcAggregate <RUTROTDistribution.curyAllowance>(RRDistribution.Cache, rutrot);
            }
        }
Example #2
0
            public virtual SourceSpecificationItem Initialize()
            {
                if (BranchSourceFormulaType != null && BranchSourceFormula == null)
                {
                    BranchSourceFormula = PXFormulaAttribute.InitFormula(BranchSourceFormulaType);
                }

                return(this);
            }
Example #3
0
        /// <summary>
        /// It`s a work around for the <see cref="RUTROT.curyTotalAmt"/> field,
        /// which was calculated incorrectly when the document existed the group discount.
        /// </summary>
        protected virtual void ARTran_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            if (e.Row == null || Rutrots.Current == null)
            {
                return;
            }

            PXFormulaAttribute.CalcAggregate <ARTranRUTROT.curyRUTROTAvailableAmt>(Base.Transactions.Cache, Rutrots.Current);
        }
        protected static bool GetConditionResult(PXCache sender, object row, Type conditionType)
        {
            IBqlCreator condition = PXFormulaAttribute.InitFormula(conditionType);
            bool?       result    = null;
            object      value     = null;

            BqlFormula.Verify(sender, row, condition, ref result, ref value);
            return((value as bool?) == true);
        }
Example #5
0
 protected virtual void FARegister_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
 {
     if (e.Row != null && PXLongOperation.GetCurrentItem() == null)             //Calculate totals only not in long operation
     {
         using (new PXConnectionScope())
         {
             PXFormulaAttribute.CalcAggregate <FATran.tranAmt>(Trans.Cache, e.Row, true);
         }
     }
 }
Example #6
0
 protected virtual void FARegister_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
 {
     if (e.Row != null)
     {
         using (new PXConnectionScope())
         {
             PXFormulaAttribute.CalcAggregate <FATran.tranAmt>(Trans.Cache, e.Row, true);
         }
     }
 }
        public PXBaseConditionAttribute(Type conditionType)
            : this()
        {
            Type condition = conditionType;

            if (typeof(IBqlWhere).IsAssignableFrom(condition))
            {
                condition = BqlCommand.MakeGenericType(typeof(Switch <,>), typeof(Case <,>), conditionType, typeof(True), typeof(False));
            }
            _Condition = PXFormulaAttribute.InitFormula(condition);
        }
Example #8
0
        protected virtual void INRegister_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            release.SetEnabled(e.Row != null && ((INRegister)e.Row).Hold == false && ((INRegister)e.Row).Released == false);
            iNEdit.SetEnabled(e.Row != null && ((INRegister)e.Row).Hold == false && ((INRegister)e.Row).Released == false);
            iNRegisterDetails.SetEnabled(e.Row != null && ((INRegister)e.Row).Released == true);

            PXUIFieldAttribute.SetEnabled(sender, e.Row, ((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN);
            PXUIFieldAttribute.SetEnabled <INRegister.refNbr>(sender, e.Row, true);
            PXUIFieldAttribute.SetEnabled <INRegister.totalQty>(sender, e.Row, false);
            PXUIFieldAttribute.SetEnabled <INRegister.totalAmount>(sender, e.Row, false);
            PXUIFieldAttribute.SetEnabled <INRegister.totalCost>(sender, e.Row, false);
            PXUIFieldAttribute.SetEnabled <INRegister.status>(sender, e.Row, false);

            sender.AllowInsert = true;
            sender.AllowUpdate = (((INRegister)e.Row).Released == false);
            sender.AllowDelete = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN);

            lsselect.AllowInsert = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN);
            lsselect.AllowUpdate = (((INRegister)e.Row).Released == false);
            lsselect.AllowDelete = (((INRegister)e.Row).Released == false && ((INRegister)e.Row).OrigModule == GL.BatchModule.IN);

            addInvBySite.SetEnabled(lsselect.AllowInsert);

            PXUIFieldAttribute.SetVisible <INRegister.controlQty>(sender, e.Row, (bool)insetup.Current.RequireControlTotal);
            PXUIFieldAttribute.SetVisible <INRegister.controlAmount>(sender, e.Row, (bool)insetup.Current.RequireControlTotal);
            PXUIFieldAttribute.SetVisible <INTran.projectID>(transactions.Cache, null, IsPMVisible);
            PXUIFieldAttribute.SetVisible <INTran.taskID>(transactions.Cache, null, IsPMVisible);
            PXUIFieldAttribute.SetVisible <INRegister.totalCost>(sender, e.Row, ((INRegister)e.Row).Released == true);

            /// added because IN Transfer is created via INIssueEntry in
            /// <see cref="SO.SOShipmentEntry.PostShipment(INIssueEntry, PXResult{SO.SOOrderShipment, SO.SOOrder}, DocumentList{INRegister}, AR.ARInvoice)"/>
            // TODO: move it to the Ctor or CacheAttached in 2019R1 after AC-118791
            switch (((INRegister)e.Row).DocType)
            {
            case INDocType.Issue:
                PXFormulaAttribute.SetAggregate <INTran.tranAmt>(transactions.Cache, typeof(SumCalc <INRegister.totalAmount>));
                break;

            default:
                PXFormulaAttribute.SetAggregate <INTran.tranAmt>(transactions.Cache, null);
                break;
            }
        }
Example #9
0
 public void RecalcFormulas(RUTROT rowRR, ARInvoiceRUTROT row)
 {
     if (row.IsRUTROTDeductible == true)
     {
         foreach (ARTran tran in Base.Transactions.Select())
         {
             if (PXCache <ARTran> .GetExtension <ARTranRUTROT>(tran).IsRUTROTDeductible == true)
             {
                 Base.Transactions.Cache.RaiseFieldUpdated <ARTranRUTROT.isRUTROTDeductible>(tran, false);                       //this is required for updating formula on ARTranRUTROT.CuryRUTROTAvailableAmt
                 Base.Transactions.Update(tran);
             }
         }
         PXUnboundFormulaAttribute.CalcAggregate <ARTranRUTROT.curyRUTROTTotal>(Base.Transactions.Cache, rowRR);
         PXFormulaAttribute.CalcAggregate <ARTranRUTROT.curyRUTROTAvailableAmt>(Base.Transactions.Cache, rowRR);
     }
 }
 public PXBaseConditionAttribute(Type conditionType)
     : this()
 {
     _Condition = PXFormulaAttribute.InitFormula(conditionType);
 }
Example #11
0
 public FormulaDefaultAttribute(Type formulaType)
 {
     Formula = PXFormulaAttribute.InitFormula(formulaType);
 }
Example #12
0
 protected virtual void _(Events.RowSelected <APInvoice> e)
 {
     PXFormulaAttribute.SetAggregate <APTran.curyTranAmt>(Base.Transactions.Cache,
                                                          (e.Row.DocType == APDocType.Prepayment) ? typeof(SumCalc <POOrderPrepayment.curyLineTotal>) : null);
 }
Example #13
0
 public virtual void RecalcApplAmounts(PXCache sender, APPayment row, bool aReadOnly, Action <PXCache, APPayment, bool> baseMethod)
 {
     PXFormulaAttribute.CalcAggregate <POAdjust.curyAdjgAmt>(POAdjustments.Cache, row, aReadOnly);
     baseMethod?.Invoke(sender, row, aReadOnly);
 }