protected virtual void _(Events.RowUpdated <SOCarrierRate> e)
        {
            if (e.Row != null && e.OldRow != null && e.Row.Selected != e.OldRow.Selected)
            {
                if (e.Row.Selected == true)
                {
                    Documents.SetValueExt <Document.shipVia>(Documents.Current, e.Row.Method);

                    foreach (SOCarrierRate cr in e.Cache.Cached)
                    {
                        if (cr.LineNbr != e.Row.LineNbr)
                        {
                            cr.Selected = false;
                        }
                    }

                    CarrierRates.View.RequestRefresh();
                }
                else
                {
                    Documents.SetValueExt <Document.shipVia>(Documents.Current, null);
                }

                Documents.Cache.Update(Documents.Current);
            }
        }
        protected virtual void _(Events.RowUpdated <Document> e)
        {
            if (_InternalCall)
            {
                return;
            }

            try
            {
                _InternalCall = true;

                if ((int?)e.Cache.GetValue <Document.customerID>(e.Row) !=
                    (int?)e.Cache.GetValue <Document.customerID>(e.OldRow))
                {
                    e.Cache.RaiseExceptionHandling <Document.customerID>(e.Row, null, null);
                    e.Cache.RaiseExceptionHandling <Document.hold>(e.Row, null, null);
                }

                Verify(e.Cache, e.Row, e.Args);
            }
            finally
            {
                _InternalCall = false;
            }
        }
        protected virtual void _(Events.RowUpdated <INSiteBuilding> e)
        {
            if (!e.Cache.ObjectsEqual <INSiteBuilding.branchID>(e.Row, e.OldRow))
            {
                bool found = false;
                foreach (Address record in Address.Cache.Inserted)
                {
                    record.BAccountID = Branch.Current?.BAccountID;
                    record.CountryID  = Branch.Current?.CountryID;
                    found             = true;
                }

                if (!found)
                {
                    object  old_branch = Branch.View.SelectSingleBound(new object[] { e.OldRow });
                    Address addr       = (Address)Address.View.SelectSingleBound(new object[] { old_branch, e.OldRow }) ?? new Address();

                    addr.BAccountID = Branch.Current.BAccountID;
                    addr.CountryID  = Branch.Current.CountryID;
                    addr.AddressID  = null;
                    Address.Cache.Insert(addr);
                }
                else
                {
                    Address.Cache.Normalize();
                }
            }
        }
Exemplo n.º 4
0
        protected override void _(Events.RowUpdated <Document> e)
        {
            SOOrder row    = Document.Cache.GetMain((Document)e.Row) as SOOrder;
            SOOrder oldRow = Document.Cache.GetMain((Document)e.OldRow) as SOOrder;

            if (row != null && oldRow != null)
            {
                UpdateARBalances(e.Cache, e.Row, e.OldRow);
            }

            if (_InternalCall)
            {
                return;
            }

            if (oldRow != null && row.CustomerID == oldRow.CustomerID &&
                row.CreditHold != oldRow.CreditHold &&
                row.CreditHold == false &&
                row.Hold == false ||
                oldRow != null && row.IsCCAuthorized != oldRow.IsCCAuthorized &&
                row.IsCCAuthorized == true ||
                oldRow != null && row.IsCCCaptured != oldRow.IsCCCaptured &&
                row.IsCCCaptured == true)
            {
                e.Cache.SetValue <SOOrder.approvedCredit>(row, true);
                e.Cache.SetValue <SOOrder.approvedCreditAmt>(row, row.OrderTotal);
            }

            if (oldRow != null && row.Hold != oldRow.Hold && row.Hold == true)
            {
                e.Cache.SetValueExt <SOOrder.creditHold>(row, false);
            }

            base._(e);
        }
Exemplo n.º 5
0
        protected override void _(Events.RowUpdated <Invoice> e)
        {
            base._(e);

            if (ShouldUpdateAdjustmentsOnDocumentUpdated(e))
            {
                foreach (Adjust2 adjust in AppliedAdjustments.Select())
                {
                    if (!e.Cache.ObjectsEqual <Invoice.branchID>(e.Row, e.OldRow))
                    {
                        AppliedAdjustments.Cache.SetDefaultExt <Adjust2.adjdBranchID>(adjust);
                    }

                    if (!e.Cache.ObjectsEqual <Invoice.headerTranPeriodID>(e.Row, e.OldRow))
                    {
                        FinPeriodIDAttribute.DefaultPeriods <Adjust2.adjgFinPeriodID>(AppliedAdjustments.Cache, adjust);
                        FinPeriodIDAttribute.DefaultPeriods <Adjust2.adjdFinPeriodID>(AppliedAdjustments.Cache, adjust);
                    }

                    (AppliedAdjustments.Cache as PXModelExtension <Adjust2>)?.UpdateExtensionMapping(adjust);

                    AppliedAdjustments.Cache.MarkUpdated(adjust);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>The RowUpdated event handler for the <see cref="Discount" /> mapped cache extension.</summary>
        /// <param name="e">Parameters of the event.</param>
        protected virtual void _(Events.RowUpdated <Discount> e)
        {
            if (!DiscountEngineGraph.IsInternalDiscountEngineCall && e.Row != null)
            {
                if (!Discounts.Cache.ObjectsEqual <Discount.skipDiscount>(e.Row, e.OldRow))
                {
                    DiscountEngineGraph.UpdateDocumentDiscount(Details.Cache, Details, Discounts, Documents.Current.BranchID, Documents.Current.LocationID ?? 0, Documents.Current.DocumentDate, e.Row.Type != DiscountType.Document, DiscountEngine.DefaultARDiscountCalculationParameters);
                    RefreshTotalsAndFreeItems(Discounts.Cache);
                    (Discounts.Cache as PXModelExtension <Discount>)?.UpdateExtensionMapping(e.Row);
                }
                if (!Discounts.Cache.ObjectsEqual <Discount.discountID>(e.Row, e.OldRow) || !Discounts.Cache.ObjectsEqual <Discount.discountSequenceID>(e.Row, e.OldRow))
                {
                    e.Row.IsManual = true;
                    DiscountEngineGraph.InsertManualDocGroupDiscount(Details.Cache, Details, Discounts, e.Row, e.Row.DiscountID, Discounts.Cache.ObjectsEqual <Discount.discountID>(e.Row, e.OldRow) ? e.Row.DiscountSequenceID : null,
                                                                     Documents.Current.BranchID, Documents.Current.LocationID ?? 0, Documents.Current.DocumentDate, DiscountEngine.DefaultARDiscountCalculationParameters);
                    RefreshTotalsAndFreeItems(Discounts.Cache);
                    (Discounts.Cache as PXModelExtension <Discount>)?.UpdateExtensionMapping(e.Row);
                }

                if (DiscountEngineGraph.SetExternalManualDocDiscount(Details.Cache, Details, Discounts, e.Row, e.OldRow, DiscountEngine.DefaultARDiscountCalculationParameters))
                {
                    RefreshTotalsAndFreeItems(Discounts.Cache);
                    (Discounts.Cache as PXModelExtension <Discount>)?.UpdateExtensionMapping(e.Row);
                }
            }
        }
        /// <summary>The RowUpdated event handler for the <see cref="Detail" /> mapped cache extension. When the value of any field of <see cref="Detail"/> is changed, the discount is recalulated for the current line.</summary>
        /// <param name="e">Parameters of the event.</param>
        protected virtual void _(Events.RowUpdated <Detail> e)
        {
            if (!Details.Cache.ObjectsEqual <Detail.branchID>(e.Row, e.OldRow) && !Details.Cache.ObjectsEqual <Detail.inventoryID>(e.Row, e.OldRow) ||
                !Details.Cache.ObjectsEqual <Detail.siteID>(e.Row, e.OldRow) || !Details.Cache.ObjectsEqual <Detail.quantity>(e.Row, e.OldRow) ||
                !Details.Cache.ObjectsEqual <Detail.curyUnitPrice>(e.Row, e.OldRow) || !Details.Cache.ObjectsEqual <Detail.curyExtPrice>(e.Row, e.OldRow) ||
                !Details.Cache.ObjectsEqual <Detail.curyDiscAmt>(e.Row, e.OldRow) || !Details.Cache.ObjectsEqual <Detail.discPct>(e.Row, e.OldRow) ||
                !Details.Cache.ObjectsEqual <Detail.manualDisc>(e.Row, e.OldRow) || !Details.Cache.ObjectsEqual <Detail.discountID>(e.Row, e.OldRow))
            {
                if (e.Row.ManualDisc != true)
                {
                    if (e.OldRow.ManualDisc == true)//Manual Discount Unckecked
                    {
                        if (e.Row.IsFree == true)
                        {
                            ResetQtyOnFreeItem(e.Cache.Graph, e.Row);
                        }
                    }
                    if (e.Row.IsFree == true)
                    {
                        DiscountEngine <Detail> .ClearDiscount(e.Cache, e.Row);
                    }
                }
            }

            RecalculateDiscounts(e.Cache, e.Row, e.Row);
        }
Exemplo n.º 8
0
 protected virtual void _(Events.RowUpdated <CurrencyInfo> e)
 {
     if ((String.IsNullOrEmpty(e.Row.CuryID) || String.IsNullOrEmpty(e.Row.BaseCuryID)))
     {
         e.Row.BaseCuryID = e.OldRow.BaseCuryID;
         e.Row.CuryID     = e.OldRow.CuryID;
     }
     if (currencyInfoDirty == false &&
         e.Row.CuryID == e.OldRow.CuryID &&
         e.Row.CuryRateTypeID == e.OldRow.CuryRateTypeID &&
         e.Row.CuryEffDate == e.OldRow.CuryEffDate &&
         e.Row.CuryMultDiv == e.OldRow.CuryMultDiv &&
         e.Row.CuryRate == e.OldRow.CuryRate)
     {
         e.Cache.IsDirty   = false;
         currencyInfoDirty = null;
     }
     foreach (Tuple <PXSelectBase, List <Tuple <string, string> > > child in CurytoBase)
     {
         if (child.Item1.Cache.GetItemType() == GetDocumentMapping().Table)
         {
             recalculateRowBaseValues(Documents.Cache, Documents.Current, child.Item2);
         }
         else
         {
             foreach (object result in child.Item1.View.SelectMulti())
             {
                 object row = result is PXResult ? ((PXResult)result)[0] : result;
                 recalculateRowBaseValues(child.Item1.Cache, row, child.Item2);
             }
         }
     }
 }
 public virtual void AmtFieldUpdated(PXCache cache, Events.RowUpdated <EPExpenseClaimDetails> e)
 {
     if (e.Row != null)
     {
         RecalcAmountInClaimCury(e.Row);
     }
 }
        protected virtual void _(Events.RowUpdated <FSAppointmentDet> e)
        {
            //if any of the fields that was saved in avalara has changed mark doc as TaxInvalid.
            if (Base.AppointmentRecords.Current != null && IsExternalTax(Base.AppointmentRecords.Current.TaxZoneID))
            {
                if (!e.Cache.ObjectsEqual <
                        FSAppointmentDet.acctID,
                        FSAppointmentDet.inventoryID,
                        FSAppointmentDet.tranDesc,
                        FSAppointmentDet.curyBillableTranAmt,
                        FSAppointmentDet.tranDate,
                        FSAppointmentDet.taxCategoryID,
                        FSAppointmentDet.siteID
                        >(e.Row, e.OldRow))
                {
                    InvalidateExternalTax(Base.AppointmentRecords.Current);
                }

                /*if (!e.Cache.ObjectsEqual<FSAppointmentDet.openAmt>(e.Row, e.OldRow))
                 * {
                 *  Base.AppointmentRecords.Current.IsOpenTaxValid = false;
                 * }*/

                /*if (!e.Cache.ObjectsEqual<FSAppointmentDet.unbilledAmt>(e.Row, e.OldRow))
                 * {
                 *  Base.AppointmentRecords.Current.IsUnbilledTaxValid = false;
                 * }*/
            }
        }
 protected virtual void _(Events.RowUpdated <ARCashSale> e)
 {
     if (e.Row.Released != true && IsDocumentExtTaxValid(e.Row) && !e.Cache.ObjectsEqual <ARCashSale.avalaraCustomerUsageType, ARCashSale.curyDiscountedTaxableTotal, ARCashSale.adjDate, ARCashSale.taxZoneID>(e.Row, e.OldRow))
     {
         e.Row.IsTaxValid = false;
     }
 }
 public virtual void _(Events.RowUpdated <EPExpenseClaimDetails> e)
 {
     if (e.OldRow.CuryTranAmt != e.Row.CuryTranAmt)
     {
         AmtFieldUpdated(e.Cache, e);
     }
     if (e.OldRow.CuryTranAmtWithTaxes != e.Row.CuryTranAmtWithTaxes)
     {
         AmtFieldUpdated(e.Cache, e);
     }
     if (e.OldRow.TranAmtWithTaxes != e.Row.TranAmtWithTaxes)
     {
         AmtFieldUpdated(e.Cache, e);
     }
     if (e.OldRow.CuryTaxTotal != e.Row.CuryTaxTotal)
     {
         AmtFieldUpdated(e.Cache, e);
     }
     if (e.OldRow.CuryTaxRoundDiff != e.Row.CuryTaxRoundDiff)
     {
         AmtFieldUpdated(e.Cache, e);
     }
     if (e.OldRow.CuryVatTaxableTotal != e.Row.CuryVatTaxableTotal)
     {
         AmtFieldUpdated(e.Cache, e);
     }
     if (e.OldRow.CuryVatExemptTotal != e.Row.CuryVatExemptTotal)
     {
         AmtFieldUpdated(e.Cache, e);
     }
 }
Exemplo n.º 13
0
        protected virtual void _(Events.RowUpdated <CurrencyInfo> e)
        {
            if (e.Row == null)
            {
                return;
            }

            foreach (ARTran tran in Base.Transactions.Select())
            {
                decimal newTranAmt = 0;
                if (e.Row.CuryRate != null)
                {
                    PXCurrencyAttribute.CuryConvBase(e.Cache, e.Row, tran.CuryTranAmt.GetValueOrDefault(), out newTranAmt);
                }
                var newTran = Base.Transactions.Cache.CreateCopy(tran) as ARTran;
                newTran.TranAmt = newTranAmt;

                decimal oldTranAmt = 0;
                if (e.OldRow.CuryRate != null)
                {
                    PXCurrencyAttribute.CuryConvBase(e.Cache, e.OldRow, tran.CuryTranAmt.GetValueOrDefault(), out oldTranAmt);
                }
                var oldTran = Base.Transactions.Cache.CreateCopy(tran) as ARTran;
                oldTran.TranAmt = oldTranAmt;

                SyncBudgets(newTran, oldTran);
            }
        }
Exemplo n.º 14
0
 protected virtual void _(Events.RowUpdated <ARInvoice> e)
 {
     if (IsDocumentExtTaxValid(e.Row) && e.Row.Released != true &&
         !e.Cache.ObjectsEqual <ARInvoice.avalaraCustomerUsageType, ARInvoice.curyDiscTot, ARInvoice.customerLocationID, ARInvoice.docDate, ARInvoice.taxZoneID>(e.Row, e.OldRow))
     {
         e.Row.IsTaxValid = false;
     }
 }
Exemplo n.º 15
0
 protected virtual void _(Events.RowUpdated <APInvoice> e)
 {
     if (!e.Cache.ObjectsEqual <APInvoice.paySel>(e.Row, e.OldRow))
     {
         var bal = (Accessinfo.CuryViewState ? (e.Row.DocBal ?? 0m) : (e.Row.CuryDocBal ?? 0m));
         Filter.Current.CuryApprovedTotal += e.Row.PaySel == true ? bal : -bal;
     }
 }
 protected virtual void _(Events.RowUpdated <PMQuote> e)
 {
     if (IsExternalTax(e.Row.TaxZoneID) && !e.Cache.ObjectsEqual <PMQuote.contactID, PMQuote.taxZoneID, PMQuote.branchID, PMQuote.locationID,
                                                                  PMQuote.curyAmount, PMQuote.opportunityAddressID>(e.Row, e.OldRow))
     {
         e.Row.IsTaxValid = false;
     }
 }
 protected virtual void _(Events.RowUpdated <CAAdj> e)
 {
     //Recalculate taxes when document date or tax zone changed
     if (!e.Cache.ObjectsEqual <CAAdj.tranDate, CAAdj.taxZoneID>(e.Row, e.OldRow))
     {
         e.Row.IsTaxValid = false;
     }
 }
 protected virtual void _(Events.RowUpdated <CRShippingAddress> e)
 {
     if (e.Row != null &&
         e.Cache.ObjectsEqual <CRShippingAddress.postalCode, CRShippingAddress.countryID, CRShippingAddress.state>(e.Row, e.OldRow) == false)
     {
         InvalidateExternalTax(Base.Opportunity.Current);
     }
 }
Exemplo n.º 19
0
        protected virtual void _(Events.RowUpdated <FSAppointment> e)
        {
            if (!e.Cache.ObjectsEqual <FSAppointment.srvOrdType>(e.Row, e.OldRow) && ((FSAppointment)e.OldRow).SrvOrdType == null)
            {
                InitServiceOrderRelated((FSAppointment)e.Row);
            }

            FSAppointment fsAppointmentRow = (FSAppointment)e.Row;
        }
 protected virtual void _(Events.RowUpdated <ARTran> e)
 {
     //if any of the fields that was saved in avalara has changed mark doc as TaxInvalid.
     if (IsDocumentExtTaxValid(Base.Document.Current) &&
         !e.Cache.ObjectsEqual <ARTran.accountID, ARTran.inventoryID, ARTran.tranDesc, ARTran.tranAmt, ARTran.tranDate, ARTran.taxCategoryID>(e.Row, e.OldRow))
     {
         InvalidateExternalTax(Base.Document.Current);
     }
 }
        protected virtual void _(Events.RowUpdated <CurrencyInfo> e)
        {
            EPExpenseClaimDetails receipt = Receipts.Current;

            if (receipt != null)
            {
                RecalcAmountInClaimCury(receipt);
            }
        }
 protected virtual void _(Events.RowUpdated <APTran> e)
 {
     //if any of the fields that was saved in External Tax Provider has changed mark doc as TaxInvalid.
     if (IsDocumentExtTaxValid(Base.Document.Current) && !e.Cache.ObjectsEqual <APTran.accountID, APTran.inventoryID, APTran.tranAmt, APTran.tranDate, APTran.taxCategoryID>(e.Row, e.OldRow))
     {
         Base.Document.Current.IsTaxValid = false;
         Base.Document.Update(Base.Document.Current);
     }
 }
 protected virtual void _(Events.RowUpdated <CASplit> e)
 {
     if (IsDocumentExtTaxValid(Base.CAAdjRecords.Current) &&
         !e.Cache.ObjectsEqual <CASplit.accountID, CASplit.inventoryID, CASplit.tranDesc, CASplit.tranAmt, CASplit.taxCategoryID, CASplit.qty, CASplit.taxCategoryID, CASplit.curyUnitPrice>(e.Row, e.OldRow))
     {
         Base.CAAdjRecords.Current.IsTaxValid = false;
         Base.CAAdjRecords.Update(Base.CAAdjRecords.Current);
     }
 }
        protected override void _(Events.RowUpdated <Document> e)
        {
            if (e.Row != null && e.OldRow != null)
            {
                UpdateARBalances(e.Cache, e.Row, e.OldRow);
            }

            base._(e);
        }
        protected virtual void _(Events.RowUpdated <RouteAppointmentGPSLocationFilter> e)
        {
            if (e.Row == null)
            {
                return;
            }

            RouteAppointmentGPSLocationFilter.Current.LoadData = false;
        }
 /// <summary>The RowUpdated event handler for the <see cref="Detail" /> mapped cache extension.</summary>
 /// <param name="e">Parameters of the event.</param>
 protected virtual void _(Events.RowUpdated <Detail> e)
 {
     if ((e.ExternalCall || e.Cache.Graph.IsImport) &&
         e.Cache.ObjectsEqual <Detail.inventoryID>(e.Row, e.OldRow) && e.Cache.ObjectsEqual <Detail.uOM>(e.Row, e.OldRow) &&
         e.Cache.ObjectsEqual <Detail.quantity>(e.Row, e.OldRow) && e.Cache.ObjectsEqual <Detail.branchID>(e.Row, e.OldRow) &&
         (!e.Cache.ObjectsEqual <Detail.curyUnitPrice>(e.Row, e.OldRow) || !e.Cache.ObjectsEqual <Detail.curyLineAmount>(e.Row, e.OldRow)))
     {
         e.Cache.SetValueExt <Detail.manualPrice>(e.Row, true);
     }
 }
 protected virtual void _(Events.RowUpdated <POLine> e)
 {
     //if any of the fields that was saved in avalara has changed mark doc as TaxInvalid.
     if (Base.Document.Current != null && IsExternalTax(Base.Document.Current.TaxZoneID) &&
         !e.Cache.ObjectsEqual <POLine.inventoryID, POLine.tranDesc, POLine.extCost, POLine.promisedDate, POLine.taxCategoryID>(e.Row, e.OldRow))
     {
         Base.Document.Current.IsTaxValid = false;
         Base.Document.Update(Base.Document.Current);
     }
 }
Exemplo n.º 28
0
        protected void _(Events.RowUpdated <ARInvoice> e, PXRowUpdated baseHandler)
        {
            baseHandler?.Invoke(e.Cache, e.Args);

            /// When using the copy and paste feature, don't bring the source GUI number into the new one.
            if (Base.IsCopyPasteContext.Equals(true))
            {
                PXCache <ARRegister> .GetExtension <ARRegisterExt>(e.Row).UsrGUINbr = null;
            }
        }
        protected override void ProcessLineOnDocumentUpdated(Events.RowUpdated <TInvoice> e,
                                                             DocumentLine line)
        {
            base.ProcessLineOnDocumentUpdated(e, line);;

            if (!e.Cache.ObjectsEqual <Invoice.headerDocDate, Invoice.curyID>(e.Row, e.OldRow))
            {
                Lines.Cache.MarkUpdated(line);
            }
        }
 protected virtual void _(Events.RowUpdated <CASplit> e)
 {
     //if any of the fields that was saved in avalara has changed mark doc as TaxInvalid.
     if (Base.CAAdjRecords.Current != null && IsExternalTax(Base.CAAdjRecords.Current.TaxZoneID) &&
         !e.Cache.ObjectsEqual <CASplit.accountID, CASplit.inventoryID, CASplit.tranDesc, CASplit.tranAmt, CASplit.taxCategoryID>(e.Row, e.OldRow))
     {
         Base.CAAdjRecords.Current.IsTaxValid = false;
         Base.CAAdjRecords.Update(Base.CAAdjRecords.Current);
     }
 }