Exemplo n.º 1
0
        /// <summary>The FieldUpdated2 event handler for the <see cref="Document.BAccountID" /> field. When the BAccountID field value is changed, <see cref="Document.CuryID" /> is assigned the default
        /// value.</summary>
        /// <param name="e">Parameters of the event.</param>
        protected virtual void _(Events.FieldUpdated <Document, Document.bAccountID> e)
        {
            if (PXAccess.FeatureInstalled <FeaturesSet.multicurrency>())
            {
                if (e.Row == null)
                {
                    return;
                }

                if (e.ExternalCall || e.Row.CuryID == null)
                {
                    CurrencyInfo info    = CurrencyInfoAttribute.SetDefaults <Document.curyInfoID>(e.Cache, e.Row, e.Cache.GetMain(e.Row).GetType());
                    string       message = PXUIFieldAttribute.GetError <CurrencyInfo.curyEffDate>(e.Cache.Graph.Caches[typeof(CurrencyInfo)], info);
                    if (string.IsNullOrEmpty(message) == false)
                    {
                        Documents.Cache.RaiseExceptionHandling <Document.documentDate>(e.Row,
                                                                                       e.Row.DocumentDate,
                                                                                       new PXSetPropertyException(message, PXErrorLevel.Warning));
                    }

                    if (info != null)
                    {
                        Documents.Cache.SetValue <Document.curyID>(e.Row, info.CuryID);
                    }
                }
            }
        }
Exemplo n.º 2
0
 public virtual void _(Events.FieldUpdated <APAdjust, APAdjust.adjdLineNbr> args)
 {
     if (!Base.HasErrors())
     {
         Base.APDocumentList.View.RequestRefresh();
     }
 }
        protected virtual void _(Events.FieldUpdated <CROpportunity, FSxCROpportunity.sDEnabled> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CROpportunity    crOpportunityRow    = (CROpportunity)e.Row;
            FSxCROpportunity fsxCROpportunityRow = e.Cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            if (fsxCROpportunityRow.SDEnabled == true)
            {
                FSSetup fsSetupRow = GetFSSetup();

                if (fsSetupRow != null &&
                    fsSetupRow.DfltOpportunitySrvOrdType != null)
                {
                    fsxCROpportunityRow.SrvOrdType = fsSetupRow.DfltOpportunitySrvOrdType;
                }

                SetBranchLocationID(Base, crOpportunityRow, fsxCROpportunityRow);
                Base.Opportunity.SetValueExt <CROpportunity.allowOverrideContactAddress>(crOpportunityRow, true);
            }
            else
            {
                fsxCROpportunityRow.BranchLocationID = null;
            }
        }
Exemplo n.º 4
0
        protected virtual void _(Events.FieldUpdated <FSAdjust, FSAdjust.adjdOrderNbr> e)
        {
            try
            {
                FSAdjust fsAdjustRow = (FSAdjust)e.Row;

                var resultSet = PXSelectJoin <FSServiceOrder,
                                              InnerJoin <CurrencyInfo,
                                                         On <
                                                             CurrencyInfo.curyInfoID, Equal <FSServiceOrder.curyInfoID> > >,
                                              Where <
                                                  FSServiceOrder.srvOrdType, Equal <Required <FSServiceOrder.srvOrdType> >,
                                                  And <FSServiceOrder.refNbr, Equal <Required <FSServiceOrder.refNbr> > > > >
                                .Select(Base, fsAdjustRow.AdjdOrderType, fsAdjustRow.AdjdOrderNbr);

                foreach (PXResult <FSServiceOrder, CurrencyInfo> result in resultSet)
                {
                    FSAdjust_AdjdOrderNbr_FieldUpdated <FSServiceOrder>(result, fsAdjustRow);
                    return;
                }
            }
            catch (PXSetPropertyException ex)
            {
                throw new PXException(ex.Message);
            }
        }
Exemplo n.º 5
0
        //Change the status based on whether the Hold check box is selected or cleared.
        protected virtual void _(Events.FieldUpdated <RSSVWorkOrder, RSSVWorkOrder.hold> e)
        {
            //If Hold is selected, change the status to On Hold
            if (e.Row.Hold == true)
            {
                e.Row.Status = WorkOrderStatusConstants.OnHold;
            }
            else if (e.Row.ServiceID != null)
            {
                RSSVRepairService service = PXSelectorAttribute.Select <RSSVWorkOrder.serviceID>(
                    e.Cache, e.Row) as RSSVRepairService;

                //If Hold is cleared, specify the status
                // depending on the Prepayment field of the service
                if (service != null)
                {
                    string newStatus;
                    if (service.Prepayment == true)
                    {
                        newStatus = WorkOrderStatusConstants.PendingPayment;
                    }
                    else
                    {
                        newStatus = WorkOrderStatusConstants.ReadyForAssignment;
                    }
                    e.Row.Status = newStatus;
                }
            }
        }
Exemplo n.º 6
0
 protected virtual void _(Events.FieldUpdated <PMLaborCostRate, PMLaborCostRate.annualSalary> e)
 {
     if (e.Row.EmploymentType == RateTypesAttribute.Salary || e.Row.EmploymentType == RateTypesAttribute.SalaryWithExemption)
     {
         e.Row.Rate = CalculateHourlyRate(e.Row.RegularHours, e.Row.AnnualSalary);
     }
 }
Exemplo n.º 7
0
        protected virtual void _(Events.FieldUpdated <InventoryItem, InventoryItem.dfltSiteID> eventArgs)
        {
            INSite site = INSite.PK.Find(this, ((InventoryItem)eventArgs.Row).DfltSiteID);

            eventArgs.Row.DfltShipLocationID    = site?.ShipLocationID;
            eventArgs.Row.DfltReceiptLocationID = site?.ReceiptLocationID;
        }
 protected virtual void _(Events.FieldUpdated <EPActivityApprove, EPActivityApprove.projectID> e)
 {
     e.Cache.SetDefaultExt <EPActivityApprove.unionID>(e.Row);
     e.Cache.SetDefaultExt <EPActivityApprove.certifiedJob>(e.Row);
     e.Cache.SetDefaultExt <EPActivityApprove.labourItemID>(e.Row);
     e.Cache.SetDefaultExt <EPActivityApprove.employeeRate>(e.Row);
 }
 protected virtual void _(Events.FieldUpdated <EPActivityApprove, EPActivityApprove.earningTypeID> e)
 {
     if (e.Row.ProjectID == null || ProjectDefaultAttribute.IsNonProject(e.Row.ProjectID))
     {
         e.Cache.SetDefaultExt <EPActivityApprove.projectID>(e.Row);
     }
 }
        protected virtual void _(Events.FieldUpdated <FSRouteContractSchedule, FSRouteContractSchedule.entityID> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSRouteContractSchedule fsRouteContractScheduleRow = (FSRouteContractSchedule)e.Row;

            if (fsRouteContractScheduleRow.EntityID != null)
            {
                FSServiceContract fsServiceContract = PXSelect <FSServiceContract,
                                                                Where <
                                                                    FSServiceContract.serviceContractID, Equal <Required <FSServiceContract.serviceContractID> > > >
                                                      .Select(this, fsRouteContractScheduleRow.EntityID);

                if (fsServiceContract != null)
                {
                    fsRouteContractScheduleRow.CustomerID         = fsServiceContract.CustomerID;
                    fsRouteContractScheduleRow.CustomerLocationID = fsServiceContract.CustomerLocationID;
                    fsRouteContractScheduleRow.BranchID           = fsServiceContract.BranchID;
                    fsRouteContractScheduleRow.BranchLocationID   = fsServiceContract.BranchLocationID;
                    fsRouteContractScheduleRow.StartDate          = fsServiceContract.StartDate;
                    fsRouteContractScheduleRow.EndDate            = fsServiceContract.EndDate;
                }
            }
        }
Exemplo n.º 11
0
        protected virtual void _(Events.FieldUpdated <DRSchedule, DRSchedule.isOverridden> e)
        {
            if (e.Row == null)
            {
                return;
            }

            if ((e.ExternalCall || e.Cache.Graph.IsImport) &&
                e.Row.IsOverridden == false && (bool)e.OldValue == true &&
                e.Row.DocType != null && e.Row.RefNbr != null)
            {
                SingleScheduleCreator.RecalculateSchedule(Base);
            }

            if ((e.ExternalCall || e.Cache.Graph.IsImport) &&
                e.Row.IsOverridden == true && (bool)e.OldValue == false &&
                e.Row.DocType != null && e.Row.RefNbr != null)
            {
                var copyRow = (DRSchedule)e.Cache.CreateCopy(e.Row);
                copyRow.IsRecalculated = false;
                e.Cache.Update(copyRow);
            }

            Base.ReallocationPool.View.RequestRefresh();
        }
Exemplo n.º 12
0
 /// <summary>The FieldUpdated2 event handler for the <see cref="Detail.UOM" /> field. When the UOM field value is changed, <see cref="Detail.CuryUnitPrice" /> is assinged a new value.</summary>
 /// <param name="e">Parameters of the event.</param>
 protected virtual void _(Events.FieldUpdated <Detail, Detail.uOM> e)
 {
     if (e.Row.ManualPrice != true && e.Row.IsFree != true && !e.Cache.Graph.IsCopyPasteContext)
     {
         e.Cache.SetValueExt <Detail.curyUnitPrice>(e.Row, GetPrice(e.Cache, e.Row));
     }
 }
Exemplo n.º 13
0
        protected void _(Events.FieldUpdated <SOShipLineExt.usrCartonQty> e)
        {
            SOShipLine    row    = e.Row as SOShipLine;
            SOShipLineExt rowExt = row.GetExtension <SOShipLineExt>();

            rowExt.UsrDimWeight = rowExt.UsrCartonQty * rowExt.UsrBaseItemVolume * 1000000M / 5000M;
        }
Exemplo n.º 14
0
        protected virtual void _(Events.FieldUpdated <FSSrvOrdType, FSSrvOrdType.postOrderType> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSSrvOrdType fsSrvOrdTypeRow = (FSSrvOrdType)e.Row;

            SOOrderType soOrderTypeRow = PXSelect <SOOrderType,
                                                   Where <
                                                       SOOrderType.orderType, Equal <Required <FSSrvOrdType.postOrderType> > > >
                                         .Select(this, fsSrvOrdTypeRow.PostOrderType);

            if (soOrderTypeRow == null)
            {
                return;
            }

            if (soOrderTypeRow.Behavior != SOBehavior.IN)
            {
                e.Cache.RaiseExceptionHandling <FSSrvOrdType.postOrderType>(
                    fsSrvOrdTypeRow,
                    fsSrvOrdTypeRow.PostOrderType,
                    new PXSetPropertyException(
                        TX.Warning.SALES_ORDER_NOT_INVOICE,
                        PXErrorLevel.Warning));
            }
        }
 protected virtual void _(Events.FieldUpdated <PMBudget, PMBudget.qty> e)
 {
     if (e.Row != null)
     {
         e.Row.RevisedQty = e.Row.Qty;
     }
 }
Exemplo n.º 16
0
        /// <summary> SOPackageDetailEx_qty Updated Event </summary>
        protected void _(Events.FieldUpdated <SOPackageDetail.qty> e)
        {
            var _splitLineNbr = e.Cache.GetExtension <SOPackageDetailExt>(e.Row).UsrShipmentSplitLineNbr;

            if (e.NewValue == null || _splitLineNbr == null)
            {
                return;
            }

            if ((decimal?)e.NewValue == 0)
            {
                e.Cache.SetValueExt <SOPackageDetail.weight>(e.Row, 0);
                return;
            }

            var row = (SOPackageDetailEx)e.Row;

            var _shipLine = Base.Transactions.Cache.Cached.RowCast <SOShipLine>().Where(x => x.LineNbr == _splitLineNbr).SingleOrDefault();
            PXResult <InventoryItem, CSAnswers> _sotockItemData = GetStockInfo(_shipLine.InventoryID.Value, _QTYINBOX);
            decimal _qtyInBox = 1;

            try
            {
                _qtyInBox = decimal.Parse(_sotockItemData.GetItem <CSAnswers>()?.Value);
            }
            catch (Exception)
            {
                _qtyInBox = 1;
            }

            e.Cache.SetValueExt <SOPackageDetail.weight>(e.Row, row.Qty * _sotockItemData.GetItem <InventoryItem>().BaseItemWeight / _qtyInBox);
        }
Exemplo n.º 17
0
        /// <summary>The FieldDefaulting2 event handler for the <see cref="Document.DocumentDate" /> field. When the DocumentDate field value is changed, <see cref="CurrencyInfo.curyEffDate"/> is changed to DocumentDate value.</summary>
        /// <param name="e">Parameters of the event.</param>
        protected virtual void _(Events.FieldUpdated <Document, Document.documentDate> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CurrencyInfo info = currencyinfo.Select();

            if (info != null)
            {
                CurrencyInfo copy = PXCache <CurrencyInfo> .CreateCopy(info);

                currencyinfo.SetValueExt <CurrencyInfo.curyEffDate>(info, e.Row.DocumentDate);
                string message = PXUIFieldAttribute.GetError <CurrencyInfo.curyEffDate>(currencyinfo.Cache, info);
                if (string.IsNullOrEmpty(message) == false)
                {
                    e.Cache.RaiseExceptionHandling <Document.documentDate>(e.Row, null, new PXSetPropertyException(message, PXErrorLevel.Warning));
                }

                currencyinfo.Cache.RaiseRowUpdated(info, copy);

                if (currencyinfo.Cache.GetStatus(info) != PXEntryStatus.Inserted)
                {
                    currencyinfo.Cache.SetStatus(info, PXEntryStatus.Updated);
                }
            }
        }
Exemplo n.º 18
0
        protected void _(Events.FieldUpdated <APInvoice.vendorID> e)
        {
            var row    = e.Row as APInvoice;
            var vendor = Base.vendor.Current;

            if (vendor == null || activateGUI == false)
            {
                return;
            }

            switch (row.DocType)
            {
            case APDocType.DebitAdj:
                PXCache <APRegister> .GetExtension <APRegisterExt>(row).UsrVATInCode = TWGUIFormatCode.vATInCode23;

                break;

            case APDocType.Invoice:
                CSAnswers cSAnswers = SelectCSAnswers(Base, vendor.NoteID);

                PXCache <APRegister> .GetExtension <APRegisterExt>(row).UsrVATInCode = cSAnswers?.Value;

                break;
            }
        }
Exemplo n.º 19
0
        protected virtual void _(Events.FieldUpdated <InventoryItem, InventoryItem.postClassID> eventArgs)
        {
            eventArgs.Cache.SetDefaultExt <InventoryItem.invtAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.invtSubID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.salesAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.salesSubID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.cOGSAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.cOGSSubID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.stdCstVarAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.stdCstVarSubID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.stdCstRevAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.stdCstRevSubID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.pPVAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.pPVSubID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.pOAccrualAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.pOAccrualSubID>(eventArgs.Row);

            eventArgs.Cache.SetDefaultExt <InventoryItem.reasonCodeSubID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.lCVarianceAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.lCVarianceSubID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.deferralAcctID>(eventArgs.Row);
            eventArgs.Cache.SetDefaultExt <InventoryItem.deferralSubID>(eventArgs.Row);

            if (eventArgs.Row != null && eventArgs.Row.StkItem != true)
            {
                eventArgs.Cache.SetDefaultExt <InventoryItem.expenseAccrualAcctID>(eventArgs.Row);
                eventArgs.Cache.SetDefaultExt <InventoryItem.expenseAccrualSubID>(eventArgs.Row);
                eventArgs.Cache.SetDefaultExt <InventoryItem.expenseAcctID>(eventArgs.Row);
                eventArgs.Cache.SetDefaultExt <InventoryItem.expenseSubID>(eventArgs.Row);
            }
        }
 protected virtual void _(Events.FieldUpdated <ARPriceWorksheet, ARPriceWorksheet.isFairValue> e)
 {
     if (((bool?)e.OldValue) == true && e.Row?.IsFairValue == false)
     {
         e.Row.IsProrated = false;
     }
 }
Exemplo n.º 21
0
        protected virtual void _(Events.FieldUpdated <FeaturesSet, FeaturesSet.centralizedPeriodsManagement> e)
        {
            if (e.Row == null)
            {
                return;
            }

            if ((bool?)e.OldValue != true &&
                e.Row.CentralizedPeriodsManagement == true &&
                EtalonOrganization != null)
            {
                foreach (PXResult <MasterFinPeriod, OrganizationFinPeriod> res in MasterFinPeriods.Select(EtalonOrganization.OrganizationID))
                {
                    MasterFinPeriod       masterFinPeriod       = res;
                    OrganizationFinPeriod organizationFinPeriod = res;

                    masterFinPeriod.DateLocked = organizationFinPeriod.DateLocked;
                    masterFinPeriod.Status     = organizationFinPeriod.Status;
                    masterFinPeriod.APClosed   = organizationFinPeriod.APClosed;
                    masterFinPeriod.ARClosed   = organizationFinPeriod.ARClosed;
                    masterFinPeriod.INClosed   = organizationFinPeriod.INClosed;
                    masterFinPeriod.CAClosed   = organizationFinPeriod.CAClosed;
                    masterFinPeriod.FAClosed   = organizationFinPeriod.FAClosed;

                    MasterFinPeriods.Cache.Update(masterFinPeriod);
                }
            }
        }
 protected virtual void _(Events.FieldUpdated <CopyPricesFilter, CopyPricesFilter.isFairValue> e)
 {
     if (((bool?)e.OldValue) == true && e.Row?.IsFairValue == false)
     {
         e.Row.IsProrated = false;
     }
 }
Exemplo n.º 23
0
        public virtual void _(Events.FieldUpdated <FALocationHistory.buildingID> e)
        {
            var row = e.Row as FALocationHistory;
            var ext = row.GetExtension <FALocationHistoryExtension>();

            if (row.BuildingID != null)
            {
                if (ext.UsrKodeArea != null)
                {
                    var kodeAreaMaster = PXSelect <KodeAreaMaster,
                                                   Where <KodeAreaMaster.roomCD,
                                                          Equal <Required <KodeAreaMaster.roomCD> > > >
                                         .Select(Base, ext.UsrKodeArea).First().GetItem <KodeAreaMaster>();

                    if (row.BuildingID == kodeAreaMaster.BuildingID)
                    {
                        return;
                    }
                    else
                    {
                        e.Cache.SetValueExt <FALocationHistoryExtension.usrKodeArea>(row, null);
                        e.Cache.SetValueExt <FALocationHistoryExtension.usrDeskripsiArea>(row, null);
                    }
                }
            }
            else
            {
                e.Cache.SetValueExt <FALocationHistoryExtension.usrKodeArea>(row, null);
                e.Cache.SetValueExt <FALocationHistoryExtension.usrDeskripsiArea>(row, null);
            }
        }
 protected virtual void _(Events.FieldUpdated <ARInvoice, ARInvoice.hold> eventArgs)
 {
     if (eventArgs.Row?.Hold == true && eventArgs.Row.Released != true)
     {
         eventArgs.Cache.SetValue <ARInvoice.creditHold>(eventArgs.Row, false);
     }
 }
Exemplo n.º 25
0
 public virtual void _(Events.FieldUpdated <APInvoice, APInvoiceJCExt.amountToPay> args)
 {
     if (args.Row is APInvoice invoice)
     {
         SetAmountToPay(invoice, Base.APDocumentList.Current);
     }
 }
Exemplo n.º 26
0
        protected virtual void _(Events.FieldUpdated <CRCase, FSxCRCase.sDEnabled> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CRCase    crCaseRow    = (CRCase)e.Row;
            FSxCRCase fsxCRCaseRow = e.Cache.GetExtension <FSxCRCase>(crCaseRow);

            if (fsxCRCaseRow.SDEnabled == true)
            {
                FSSetup fsSetupRow = GetFSSetup();

                if (fsSetupRow != null &&
                    fsSetupRow.DfltCasesSrvOrdType != null)
                {
                    fsxCRCaseRow.SrvOrdType = fsSetupRow.DfltCasesSrvOrdType;
                }

                SetBranchLocationID(Base, fsxCRCaseRow);
            }
            else
            {
                fsxCRCaseRow.SrvOrdType       = null;
                fsxCRCaseRow.BranchLocationID = null;
            }
        }
 /// <summary>The FieldUpdated2 event handler for the <see cref="Detail.Quantity" /> field. When the Quantity field value is changed, <see cref="Detail.CuryUnitPrice" /> is assinged a new value.</summary>
 /// <param name="e">Parameters of the event.</param>
 protected virtual void _(Events.FieldUpdated <Detail, Detail.quantity> e)
 {
     if (e.Row.ManualPrice != true && e.Row.IsFree != true && !e.Cache.Graph.IsCopyPasteContext)
     {
         e.Cache.SetDefaultExt <Detail.curyUnitPrice>(e.Row);
     }
 }
 protected virtual void _(Events.FieldUpdated <PMBudget, PMBudget.amount> e)
 {
     if (e.Row != null)
     {
         e.Row.RevisedAmount = e.Row.Amount;
     }
 }
Exemplo n.º 29
0
 protected virtual void _(Events.FieldUpdated <CSAttributeGroup, CSAttributeGroup.attributeCategory> eventArgs)
 {
     if (eventArgs.Row?.AttributeCategory == CSAttributeGroup.attributeCategory.Variant)
     {
         eventArgs.Row.Required = false;
     }
 }
Exemplo n.º 30
0
 protected virtual void _(Events.FieldUpdated <APTran, APTran.pONbr> e)
 {
     if (e.Row.TranType == APDocType.Prepayment)
     {
         e.Cache.SetDefaultExt <APTran.prepaymentPct>(e.Row);
     }
 }