protected virtual void ConfigureChecks(PXCache cache, TaxDetailDAC taxDetail, Tax tax) { bool areAccountAndSubaccountRequired = tax.TaxType != CSTaxType.PerUnit || tax.PerUnitTaxPostMode == PerUnitTaxPostOptions.TaxAccount; PXPersistingCheck persistingCheck = areAccountAndSubaccountRequired ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; cache.Adjust <PXDefaultAttribute>(taxDetail) .For <TaxTran.accountID>(a => a.PersistingCheck = persistingCheck) .SameFor <TaxTran.subID>(); }
protected virtual void INTran_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { if (e.Operation.Command() == PXDBOperation.Delete) { return; } INTran row = (INTran)e.Row; InventoryItem item = (InventoryItem)PXSelectorAttribute.Select <INTran.inventoryID>(sender, row); INLotSerClass itemclass = (INLotSerClass)PXSelectorAttribute.Select <InventoryItem.lotSerClassID>(this.Caches[typeof(InventoryItem)], item); PXPersistingCheck check = ((INTran)e.Row).InvtMult != 0 && ( (item != null && item.ValMethod == INValMethod.Specific) || (itemclass != null && itemclass.LotSerTrack != INLotSerTrack.NotNumbered && itemclass.LotSerAssign == INLotSerAssign.WhenReceived && ((INTran)e.Row).Qty != 0m)) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <INTran.subID>(sender, e.Row, PXPersistingCheck.Null); PXDefaultAttribute.SetPersistingCheck <INTran.locationID>(sender, e.Row, PXPersistingCheck.Null); PXDefaultAttribute.SetPersistingCheck <INTran.lotSerialNbr>(sender, e.Row, check); if (adjustment.Current != null && adjustment.Current.OrigModule != INRegister.origModule.PI && item != null && item.ValMethod == INValMethod.FIFO && ((INTran)e.Row).OrigRefNbr == null) { bool dropShipPO = false; if (row != null && row.POReceiptNbr != null && row.POReceiptLineNbr != null) { PO.POReceiptLine pOReceiptLine = PXSelect <PO.POReceiptLine, Where <PO.POReceiptLine.receiptNbr, Equal <Required <PO.POReceiptLine.receiptNbr> >, And <PO.POReceiptLine.lineNbr, Equal <Required <PO.POReceiptLine.lineNbr> > > > > .Select(this, row.POReceiptNbr, row.POReceiptLineNbr); dropShipPO = pOReceiptLine != null && (pOReceiptLine.LineType == PO.POLineType.GoodsForDropShip || pOReceiptLine.LineType == PO.POLineType.NonStockForDropShip); } if (!dropShipPO && sender.RaiseExceptionHandling <INTran.origRefNbr>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(INTran.origRefNbr).Name))) { throw new PXRowPersistingException(typeof(INTran.origRefNbr).Name, null, ErrorMessages.FieldIsEmpty, typeof(INTran.origRefNbr).Name); } } if (item != null && item.ValMethod == INValMethod.Standard && row.TranType == INTranType.Adjustment && row.InvtMult != 0 && row.BaseQty == 0m && row.TranCost != 0m) { if (sender.RaiseExceptionHandling <INTran.tranCost>(e.Row, row.TranCost, new PXSetPropertyException(Messages.StandardCostNoCostOnlyAdjust))) { throw new PXRowPersistingException(typeof(INTran.tranCost).Name, row.TranCost, Messages.StandardCostNoCostOnlyAdjust); } } }
protected virtual void AggregatedTax_RowPersisting(Events.RowPersisting <TAggregatedTax> e) { Tax tax = GetTax(e.Row); if (tax == null) { return; } bool areAccountAndSubaccountRequired = tax.TaxType != CSTaxType.PerUnit || tax.PerUnitTaxPostMode == PerUnitTaxPostOptions.TaxAccount; PXPersistingCheck persistingCheck = areAccountAndSubaccountRequired ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; e.Cache.Adjust <PXDefaultAttribute>(e.Row) .For <TaxTran.accountID>(a => a.PersistingCheck = persistingCheck) .SameFor <TaxTran.subID>(); }
public virtual void RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { object row = e.Row; Type conditionType = Condition; if (row == null || conditionType == null) { return; } PXPersistingCheck persistingCheck = GetConditionResult(sender, row, conditionType) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute defaultAttribute = sender.GetAttributesReadonly(_FieldName).OfType <PXDefaultAttribute>().FirstOrDefault(); if (defaultAttribute != null) { defaultAttribute.PersistingCheck = persistingCheck; defaultAttribute.RowPersisting(sender, e); defaultAttribute.PersistingCheck = PXPersistingCheck.Nothing; } }
public virtual void RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { object row = e.Row; Type conditionType = Condition; if (row == null || conditionType == null) { return; } PXDefaultAttribute defaultAttribute = GetDefaultAttribute(sender); if (defaultAttribute != null) { PXPersistingCheck persistingCheck = GetConditionResult(sender, row, conditionType) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; defaultAttribute.PersistingCheck = persistingCheck; defaultAttribute.RowPersisting(sender, e); defaultAttribute.PersistingCheck = PXPersistingCheck.Nothing; } }
protected virtual void INTran_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { InventoryItem item = (InventoryItem)PXSelectorAttribute.Select <INTran.inventoryID>(sender, e.Row); INLotSerClass itemclass = (INLotSerClass)PXSelectorAttribute.Select <InventoryItem.lotSerClassID>(this.Caches[typeof(InventoryItem)], item); PXPersistingCheck check = ((INTran)e.Row).InvtMult != 0 && ( (item != null && item.ValMethod == INValMethod.Specific) || (itemclass != null && itemclass.LotSerTrack != INLotSerTrack.NotNumbered && itemclass.LotSerAssign == INLotSerAssign.WhenReceived && ((INTran)e.Row).Qty != 0m)) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <INTran.subID>(sender, e.Row, PXPersistingCheck.Null); PXDefaultAttribute.SetPersistingCheck <INTran.locationID>(sender, e.Row, PXPersistingCheck.Null); PXDefaultAttribute.SetPersistingCheck <INTran.lotSerialNbr>(sender, e.Row, check); if (adjustment.Current != null && adjustment.Current.OrigModule != INRegister.origModule.PI && item != null && item.ValMethod == INValMethod.FIFO && ((INTran)e.Row).OrigRefNbr == null) { if (sender.RaiseExceptionHandling <INTran.origRefNbr>(e.Row, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(INTran.origRefNbr).Name))) { throw new PXRowPersistingException(typeof(INTran.origRefNbr).Name, null, ErrorMessages.FieldIsEmpty, typeof(INTran.origRefNbr).Name); } } if (item != null && item.ValMethod == INValMethod.Standard && ((INTran)e.Row).TranType == INTranType.Adjustment && ((INTran)e.Row).BaseQty == 0m && ((INTran)e.Row).TranCost != 0m) { if (sender.RaiseExceptionHandling <INTran.tranCost>(e.Row, ((INTran)e.Row).TranCost, new PXSetPropertyException(Messages.StandardCostNoCostOnlyAdjust))) { throw new PXRowPersistingException(typeof(INTran.tranCost).Name, ((INTran)e.Row).TranCost, Messages.StandardCostNoCostOnlyAdjust); } } }
private void SetPersistingChecks(IRUTROTable document, RUTROT rutrot) { PXPersistingCheck check = document.IsRUTROTDeductible == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXPersistingCheck rotCheck = document.IsRUTROTDeductible == true && rutrot?.RUTROTType == RUTROTTypes.ROT ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <RUTROT.rUTROTType>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTDeductionPct>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.curyROTPersonalAllowance>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.curyROTExtraAllowance>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.rUTDeductionPct>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.curyRUTPersonalAllowance>(Rutrots.Cache, rutrot, check); PXDefaultAttribute.SetPersistingCheck <RUTROT.curyRUTExtraAllowance>(Rutrots.Cache, rutrot, check); if (!String.IsNullOrWhiteSpace(rutrot?.ROTOrganizationNbr)) { PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTAppartment>(Rutrots.Cache, rutrot, rotCheck); PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTEstate>(Rutrots.Cache, rutrot, PXPersistingCheck.Nothing); } else { PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTEstate>(Rutrots.Cache, rutrot, rotCheck); PXDefaultAttribute.SetPersistingCheck <RUTROT.rOTAppartment>(Rutrots.Cache, rutrot, PXPersistingCheck.Nothing); } }
protected override void Master_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { base.Master_RowSelected(sender, e); ARTran row = (ARTran)e.Row; if (row == null) { return; } bool directLine = (row.InvtMult != 0), directStockLine = directLine && (row.LineType == SOLineType.Inventory); PXUIFieldAttribute.SetEnabled <ARTran.subItemID>(sender, row, directStockLine); PXUIFieldAttribute.SetEnabled <ARTran.siteID>(sender, row, directLine); PXUIFieldAttribute.SetEnabled <ARTran.locationID>(sender, row, directStockLine); PXPersistingCheck checkValues = directStockLine ? PXPersistingCheck.Null : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <ARTran.subItemID>(sender, row, checkValues); PXDefaultAttribute.SetPersistingCheck <ARTran.siteID>(sender, row, checkValues); PXDefaultAttribute.SetPersistingCheck <ARTran.locationID>(sender, row, checkValues); }
protected virtual void SOOrderType_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } SOOrderType ordertype = (SOOrderType)e.Row; SOOrderType link = references.SelectWindowed(0, 1, ordertype.OrderType); PXUIFieldAttribute.SetEnabled <SOOrderType.template>(sender, e.Row, link == null); bool isTemplateUpdatable = link == null && ordertype.OrderType != null && (ordertype.OrderType == ordertype.Template || ordertype.Template == null); SOOrderTypeOperation def = this.defaultOperation.Select(ordertype.OrderType, ordertype.DefaultOperation); if (def == null) { def = new SOOrderTypeOperation(); } PXUIFieldAttribute.SetEnabled <SOOrderType.billSeparately>(sender, e.Row, ordertype.ARDocType != ARDocType.NoUpdate); PXUIFieldAttribute.SetEnabled <SOOrderType.invoiceNumberingID>(sender, e.Row, ordertype.ARDocType != ARDocType.NoUpdate); if (ordertype.ARDocType == ARDocType.NoUpdate) { INTranType.CustomListAttribute listattr = new INTranType.SONonARListAttribute(); PXStringListAttribute.SetList <SOOrderTypeOperation.iNDocType>(this.operations.Cache, null, listattr.AllowedValues, listattr.AllowedLabels); } else { INTranType.CustomListAttribute listattr = new INTranType.SOListAttribute(); PXStringListAttribute.SetList <SOOrderTypeOperation.iNDocType>(this.operations.Cache, null, listattr.AllowedValues, listattr.AllowedLabels); } SOOrder order = PXSelectJoin <SOOrder, InnerJoin <INItemPlan, On <INItemPlan.refNoteID, Equal <SOOrder.noteID> > >, Where <SOOrder.orderType, Equal <Required <SOOrder.orderType> >, And <Where <INItemPlan.planType, Equal <INPlanConstants.plan60>, Or <INItemPlan.planType, Equal <INPlanConstants.plan66>, Or <INItemPlan.planType, Equal <INPlanConstants.plan68> > > > > > > .SelectWindowed(this, 0, 1, ordertype.OrderType); //PXUIFieldAttribute.SetEnabled<SOOrderType.requireLocation>(sender, ordertype, order == null && isTemplateUpdatable); //PXUIFieldAttribute.SetEnabled<SOOrderType.requireLocation>(sender, e.Row, def.INDocType != INTranType.NoUpdate && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.requireShipping>(sender, e.Row, def.INDocType != INTranType.NoUpdate && def.INDocType != INTranType.Transfer && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.aRDocType>(sender, e.Row, def.INDocType != INTranType.Transfer && isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.behavior>(sender, e.Row, isTemplateUpdatable); PXUIFieldAttribute.SetEnabled <SOOrderType.defaultOperation>(sender, e.Row, isTemplateUpdatable && ordertype.Behavior == SOBehavior.RM); PXUIFieldAttribute.SetVisible <SOOrderTypeOperation.active>(operations.Cache, null, ordertype.Behavior == SOBehavior.RM || ordertype.Behavior == SOBehavior.IN); PXUIFieldAttribute.SetVisible <SOOrderTypeOperation.autoCreateIssueLine>(operations.Cache, null, ordertype.Behavior == SOBehavior.RM); PXPersistingCheck activeCheck = ordertype.Active == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <SOOrderType.salesSubMask>(sender, ordertype, activeCheck); //PXDefaultAttribute.SetPersistingCheck<SOOrderType.cOGSSubMask>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.miscSubMask>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.freightSubMask>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.discSubMask>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.freightAcctID>(sender, ordertype, activeCheck); PXDefaultAttribute.SetPersistingCheck <SOOrderType.freightSubID>(sender, ordertype, activeCheck); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLineNotesToInvoiceOnlyNS>(sender, ordertype, ordertype.CopyLineNotesToInvoice == true); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLineFilesToInvoiceOnlyNS>(sender, ordertype, ordertype.CopyLineFilesToInvoice == true); PXUIFieldAttribute.SetEnabled <SOOrderType.requireAllocation>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.requireLotSerial>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.copyLotSerialFromShipment>(sender, ordertype, ordertype.RequireShipping == true); PXUIFieldAttribute.SetEnabled <SOOrderType.useDiscountSubFromSalesSub>(sender, ordertype, ordertype.PostLineDiscSeparately == true); bool allowUserDefinedOrderTypes = PXAccess.FeatureInstalled <FeaturesSet.userDefinedOrderTypes>(); soordertype.AllowInsert = allowUserDefinedOrderTypes; currentordertype.AllowInsert = allowUserDefinedOrderTypes; bool allowUpdateOrderTypes = allowUserDefinedOrderTypes || sender.GetStatus(e.Row) != PXEntryStatus.Inserted; soordertype.AllowUpdate = allowUpdateOrderTypes; currentordertype.AllowUpdate = allowUpdateOrderTypes; }
protected virtual void _(Events.FieldUpdated <UserPreferences, FSxUserPreferences.trackLocation> e) { if (e.Row == null) { return; } UserPreferences userPreferencesRow = e.Row as UserPreferences; FSxUserPreferences fsxUserPreferencesRow = e.Cache.GetExtension <FSxUserPreferences>(userPreferencesRow); if (fsxUserPreferencesRow != null && fsxUserPreferencesRow.TrackLocation != (bool)e.OldValue) { if (fsxUserPreferencesRow.TrackLocation == true && LocationTracking.Select().Count == 0) { List <FSGPSTrackingLocation> trackingLocations = new List <FSGPSTrackingLocation>(); CSCalendar csCalendarRow = UserCalendar.SelectSingle(); if (csCalendarRow?.SunWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay1 = true, WeekDay = 0, StartTime = csCalendarRow.SunStartTime, EndTime = csCalendarRow.SunEndTime }); } if (csCalendarRow?.MonWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay2 = true, WeekDay = 1, StartTime = csCalendarRow.MonStartTime, EndTime = csCalendarRow.MonEndTime }); } if (csCalendarRow?.TueWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay3 = true, WeekDay = 2, StartTime = csCalendarRow.TueStartTime, EndTime = csCalendarRow.TueEndTime }); } if (csCalendarRow?.WedWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay4 = true, WeekDay = 3, StartTime = csCalendarRow.WedStartTime, EndTime = csCalendarRow.WedEndTime }); } if (csCalendarRow?.ThuWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay5 = true, WeekDay = 4, StartTime = csCalendarRow.ThuStartTime, EndTime = csCalendarRow.ThuEndTime }); } if (csCalendarRow?.FriWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay6 = true, WeekDay = 5, StartTime = csCalendarRow.FriStartTime, EndTime = csCalendarRow.FriEndTime }); } if (csCalendarRow?.SatWorkDay == true) { trackingLocations.Add(new FSGPSTrackingLocation { WeeklyOnDay7 = true, WeekDay = 6, StartTime = csCalendarRow.SatStartTime, EndTime = csCalendarRow.SatEndTime }); } foreach (FSGPSTrackingLocation fsGPSTrackingLocationRow in trackingLocations) { fsGPSTrackingLocationRow.StartDate = Base.Accessinfo.BusinessDate; fsGPSTrackingLocationRow.EndDate = fsGPSTrackingLocationRow.StartDate.Value.AddYears(1000); fsGPSTrackingLocationRow.Interval = fsxUserPreferencesRow.Interval; fsGPSTrackingLocationRow.Distance = fsxUserPreferencesRow.Distance; LocationTracking.Insert(fsGPSTrackingLocationRow); } } else { foreach (FSGPSTrackingLocation fsGPSTrackingLocationRow in LocationTracking.Select()) { fsGPSTrackingLocationRow.IsActive = fsxUserPreferencesRow.TrackLocation; LocationTracking.Cache.Update(fsGPSTrackingLocationRow); } } PXPersistingCheck persistingCheck = fsxUserPreferencesRow.TrackLocation == true ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute.SetPersistingCheck <UserPreferences.timeZone>(e.Cache, userPreferencesRow, persistingCheck); } }