protected void _(Events.FieldDefaulting <TWNManualGUIExpense, TWNManualGUIExpense.deduction> e) { var row = (TWNManualGUIExpense)e.Row; /// If user doesn't choose a vendor then bring the fixed default value from Attribure "DEDUCTCODE" first record. e.NewValue = row.VendorID == null ? "1" : e.NewValue; }
/// <summary> SOPackageDetailEx_BoxID Defaulting </summary> protected void _(Events.FieldDefaulting <SOPackageDetailEx.boxID> e) { var row = (SOPackageDetailEx)e.Row; var boxsInfo = GetBoxsInfo(row.InventoryID); e.NewValue = string.IsNullOrEmpty(boxsInfo.stockItemBox) ? boxsInfo.sBoxID : boxsInfo.stockItemBox; }
protected virtual void _(Events.FieldDefaulting <PMBudget, PMBudget.inventoryID> e) { if (CostCodeAttribute.UseCostCode()) { e.NewValue = PMInventorySelectorAttribute.EmptyInventoryID; } }
protected void _(Events.FieldDefaulting <SOLineExt.usrProjectNbr> e) { var row = e.Row as SOLine; if (row == null) { return; } SOLineExt extension = row.GetExtension <SOLineExt>(); List <FLXProject> list = SelectFrom <FLXProject> .Where <FLXProject.status.IsNotEqual <ProjectStatus.hold> .And <FLXProject.customerID.IsEqual <P.AsInt> .And <FLXProject.endCustomerID.IsEqual <P.AsInt> .And <FLXProject.nonStockItem.IsEqual <P.AsInt> > > > > .View.Select(Base, row.CustomerID, extension.UsrEndCustomerID, extension.UsrNonStockItem).RowCast <FLXProject>().ToList <FLXProject>(); e.NewValue = list.Count == 1 ? list[0].ProjectNbr : null; ///<remarks> The following modification is added due to customizing the new standard that affects SO upgrades using drop-ship logic. </remarks> if (e.NewValue == null && extension.UsrNonStockItem != null && extension.UsrEndCustomerID != null) { Base.Transactions.SetValueExt <SOLine.pOCreate>(row, false); } }
protected virtual void _(Events.FieldDefaulting <CalendarWeekCodeGeneration, CalendarWeekCodeGeneration.startDate> e) { if (e.Row == null) { return; } FSWeekCodeDate fsWeekCodeDateRow = PXSelectOrderBy <FSWeekCodeDate, OrderBy <Desc <FSWeekCodeDate.weekCodeDate> > > .SelectWindowed(this, 0, 1); if (fsWeekCodeDateRow != null) { e.NewValue = fsWeekCodeDateRow.WeekCodeDate.Value.AddDays(1); } else { e.NewValue = new DateTime(2008, 12, 29); } CalendarWeekCodeGeneration calendarWeekCodeGenrationRow = (CalendarWeekCodeGeneration)e.Row; if (calendarWeekCodeGenrationRow.StartDate != null) { DateTime?newValue = SharedFunctions.TryParseHandlingDateTime(e.Cache, e.NewValue); if (newValue.HasValue == true) { calendarWeekCodeGenrationRow.EndDate = newValue.Value.AddYears(1); } } }
protected virtual void _(Events.FieldDefaulting <PMLaborCostRate, PMLaborCostRate.employeeID> e) { if (Filter.Current != null && Filter.Current.EmployeeID != null) { e.NewValue = Filter.Current.EmployeeID; } }
protected virtual void _(Events.FieldDefaulting <PMBudget, PMBudget.description> e) { if (e.Row == null) { return; } if (CostCodeAttribute.UseCostCode()) { if (e.Row.CostCodeID != null && e.Row.CostCodeID != CostCodeAttribute.GetDefaultCostCode()) { PMCostCode costCode = PXSelectorAttribute.Select <PMBudget.costCodeID>(e.Cache, e.Row) as PMCostCode; if (costCode != null) { e.NewValue = costCode.Description; } } } else { if (e.Row.InventoryID != null && e.Row.InventoryID != PMInventorySelectorAttribute.EmptyInventoryID) { InventoryItem item = PXSelectorAttribute.Select <PMBudget.inventoryID>(e.Cache, e.Row) as InventoryItem; if (item != null) { e.NewValue = item.Descr; } } } }
protected virtual void _(Events.FieldDefaulting <PMCommitment, PMCommitment.costCodeID> e) { if (!CostCodeAttribute.UseCostCode()) { e.NewValue = CostCodeAttribute.GetDefaultCostCode(); } }
public void _(Events.FieldDefaulting <APTran.inventoryID> args) { if (Base.Document.Current?.VendorID != null) { args.NewValue = GetVendorDefaultInventoryId(); } }
protected virtual void _(Events.FieldDefaulting <CROpportunityProducts, FSxCROpportunityProducts.billingRule> e) { if (e.Row == null) { return; } CROpportunityProducts crOpportunityProductsRow = (CROpportunityProducts)e.Row; FSxCROpportunityProducts fsxCROpportunityProductsRow = e.Cache.GetExtension <FSxCROpportunityProducts>(crOpportunityProductsRow); if (crOpportunityProductsRow.InventoryID != null) { InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(Base, crOpportunityProductsRow.InventoryID); if (inventoryItemRow.ItemType == INItemTypes.ServiceItem) { FSxService fsxServiceRow = PXCache <InventoryItem> .GetExtension <FSxService>(inventoryItemRow); e.NewValue = fsxServiceRow?.BillingRule; e.Cancel = true; } else { e.NewValue = ID.BillingRule.FLAT_RATE; e.Cancel = true; } } }
protected virtual void _(Events.FieldDefaulting <PMTimeActivity, PMTimeActivity.projectTaskID> e) { if (e.Row == null) { return; } if (e.Row.ParentTaskNoteID != null) { EPActivityApprove rowParentTask = PXSelect <EPActivityApprove> .Search <EPActivityApprove.noteID>(this, e.Row.ParentTaskNoteID); if (rowParentTask != null && rowParentTask.ProjectID == e.Row.ProjectID) { e.NewValue = rowParentTask.ProjectTaskID; e.Cancel = true; } } EPEarningType earningRow = (EPEarningType)PXSelectorAttribute.Select <EPActivityApprove.earningTypeID>(e.Cache, e.Row); if (e.NewValue == null && earningRow != null && earningRow.ProjectID == e.Row.ProjectID) { PMTask defTask = PXSelectorAttribute.Select(e.Cache, e.Row, e.Cache.GetField(typeof(EPTimeCardSummary.projectTaskID)), earningRow.TaskID) as PMTask; if (defTask != null && defTask.VisibleInTA == true) { e.NewValue = earningRow.TaskID; e.Cancel = true; } } }
protected virtual void _(Events.FieldDefaulting <CROpportunityProducts, FSxCROpportunityProducts.estimatedDuration> e) { if (e.Row == null) { return; } CROpportunityProducts crOpportunityProductsRow = (CROpportunityProducts)e.Row; FSxCROpportunityProducts fsxCROpportunityProductsRow = e.Cache.GetExtension <FSxCROpportunityProducts>(crOpportunityProductsRow); if (fsxCROpportunityProductsRow != null) { InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(Base, crOpportunityProductsRow.InventoryID); if (inventoryItemRow != null) { FSxService fsxServiceRow = PXCache <InventoryItem> .GetExtension <FSxService>(inventoryItemRow); if (inventoryItemRow.ItemType == INItemTypes.ServiceItem || inventoryItemRow.ItemType == INItemTypes.NonStockItem) { e.NewValue = fsxServiceRow?.EstimatedDuration; e.Cancel = true; } } } }
protected virtual void _(Events.FieldDefaulting <Address, Address.bAccountID> e) { if (Branch.Current != null) { e.NewValue = Branch.Current.BAccountID; e.Cancel = true; } }
protected void _(Events.FieldDefaulting <TWNManualGUIExpense, TWNManualGUIExpense.ourTaxNbr> e) { var row = (TWNManualGUIExpense)e.Row; TWNGUIPreferences preferences = SelectFrom <TWNGUIPreferences> .View.Select(Base); e.NewValue = row.VendorID == null ? preferences.OurTaxNbr : e.NewValue; }
protected void _(Events.FieldDefaulting <INTranSplitExt.usrCOO> e) { if (!(e.Row is INTranSplit row) || !(row.DocType == "R")) { return; } e.NewValue = (object)INReceiptEntry_Extension.RetriveFromPOReceipt((PXGraph)this.Base, (object)row.InventoryID, (object)row.LotSerialNbr, (object)row.POLineType, (object)AdditionalInfo.COO); }
protected virtual void _(Events.FieldDefaulting <DRBalanceValidationFilter.finPeriodID> e) { if (PendingFullValidation) { e.NewValue = FinPeriodRepository.FindFirstPeriod(FinPeriod.organizationID.MasterValue).FinPeriodID; e.Cancel = true; } }
protected virtual void _(Events.FieldDefaulting <PMLaborCostRate, PMLaborCostRate.regularHours> e) { if (e.Row != null && e.Row.EmployeeID != null && e.Row.Type == PMLaborCostRateType.Employee) { EmployeeCostEngine engine = new EmployeeCostEngine(this); e.NewValue = engine.GetEmployeeHoursFromCalendar(e.Row.EmployeeID); } }
protected virtual void _(Events.FieldDefaulting <PMBudget, PMBudget.inventoryID> e) { if (e.Row == null) { return; } e.NewValue = PM.PMInventorySelectorAttribute.EmptyInventoryID; }
protected virtual void _(Events.FieldDefaulting <InventoryItem, FSxService.billingRule> e) { if (e.Row == null) { return; } e.NewValue = ID.BillingRule.FLAT_RATE; }
protected virtual void _(Events.FieldDefaulting <FSSetup, FSSetup.rOLunchBreakEndTimeFrame> e) { if (e.Row == null) { return; } e.NewValue = new DateTime(1900, 1, 1, 14, 0, 0); }
/// <summary> FieldDefaulting CROpportunity.workgroupID </summary> public void _(Events.FieldDefaulting <CROpportunity.workgroupID> e, PXFieldDefaulting baseMethod) { baseMethod?.Invoke(e.Cache, e.Args); e.NewValue = SelectFrom <EPCompanyTreeMember> .InnerJoin <EPCompanyTree> .On <EPCompanyTreeMember.workGroupID.IsEqual <EPCompanyTree.workGroupID> .And <EPCompanyTree.parentWGID.IsEqual <P.AsInt> > > .Where <EPCompanyTreeMember.userID.IsEqual <AccessInfo.userID.FromCurrent> > .View.Select(Base, library.GetCRMWorkGroupID()).RowCast <EPCompanyTreeMember>().FirstOrDefault()?.WorkGroupID; }
protected virtual void _(Events.FieldDefaulting <SOInvoice, SOInvoice.refNbr> e) { if (!(e.Row is SOInvoice invoice)) { return; } invoice.RefNbr = "<NEW>"; }
protected virtual void _(Events.FieldDefaulting <JointPayee.billLineNumber> args) { var isPaymentsByLinesAllowed = Base.CurrentDocument.Current.PaymentsByLinesAllowed.GetValueOrDefault(); if (!isPaymentsByLinesAllowed) { args.NewValue = 0; } }
/// <summary>The FieldDefaulting2 event handler for the <see cref="CurrencyInfo.CuryEffDate" /> field. The CuryEffDate field takes the current value of <see cref="Document.DocumentDate"/>.</summary> /// <param name="e">Parameters of the event.</param> protected virtual void _(Events.FieldDefaulting <CurrencyInfo, CurrencyInfo.curyEffDate> e) { if (PXAccess.FeatureInstalled <FeaturesSet.multicurrency>()) { e.NewValue = Documents.Cache.Current != null && Documents.Current.DocumentDate != null ? Documents.Current.DocumentDate : e.Cache.Graph.Accessinfo.BusinessDate; } }
protected virtual void _(Events.FieldDefaulting <CalendarWeekCodeGeneration, CalendarWeekCodeGeneration.defaultStartDate> e) { if (e.Row == null) { return; } e.NewValue = new DateTime(2008, 12, 29); }
/// <summary>The FieldDefaulting2 event handler for the <see cref="Detail.CuryUnitPrice" /> field.</summary> /// <param name="e">Parameters of the event.</param> protected virtual void _(Events.FieldDefaulting <Detail, Detail.curyUnitPrice> e) { Detail row = e.Row; if (row != null) { decimal?price = GetPrice(e.Cache, row); e.NewValue = price ?? 0m; } }
/// <summary>The FieldDefaulting2 event handler for the <see cref="Detail.Descr" /> field.</summary> /// <param name="e">Parameters of the event.</param> protected virtual void _(Events.FieldDefaulting <Detail, Detail.descr> e) { Document doc = Documents.Current; Customer customer = PXSelectReadonly <Customer, Where <Customer.bAccountID, Equal <Required <Customer.bAccountID> > > > .Select(Base, doc.BAccountID); InventoryItem item = (InventoryItem)PXSelectorAttribute.Select <Detail.inventoryID>(Details.Cache, e.Row); e.NewValue = PXDBLocalizableStringAttribute.GetTranslation(Base.Caches[typeof(InventoryItem)], item, nameof(InventoryItem.Descr), customer?.LocaleName); }
/// <summary> Set opprid value </summary> public void _(Events.FieldDefaulting <ENGineering.opprid> e) { var AutoOppID = SelectFrom <ENGProjectType> .Where <ENGProjectType.prjtype.IsEqual <P.AsString> > .View.Select(Base, (e.Row as ENGineering).Prjtype).RowCast <ENGProjectType>().FirstOrDefault()?.LinkOppr ?? false; if (AutoOppID) { e.NewValue = (Base.Opportunity.Cache.Current as CROpportunity).OpportunityID; } }
protected virtual void _(Events.FieldDefaulting <PMLaborCostRate, PMLaborCostRate.type> e) { if (Filter.Current != null && Filter.Current.Type != PMLaborCostRateType.All) { e.NewValue = Filter.Current.Type; } else { e.NewValue = PMLaborCostRateType.Employee; } }
protected virtual void _(Events.FieldDefaulting <FSStaffSchedule, FSStaffSchedule.endTime> e) { DateTime?bussinessDatePlusCurrentHours = new DateTime(Accessinfo.BusinessDate.Value.Year, Accessinfo.BusinessDate.Value.Month, Accessinfo.BusinessDate.Value.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); e.NewValue = bussinessDatePlusCurrentHours.Value.AddHours(1); }