protected virtual void PriceCostInfoFieldsDependOnStkItemFlag(PXCache cache, InventoryItem row, bool isStock) { cache.Adjust <PXUIFieldAttribute>(row).For <InventoryItem.accrueCost>(fa => fa.Visible = !isStock) .SameFor <InventoryItem.costBasis>() .SameFor <InventoryItem.percentOfSalesPrice>() .SameFor("DfltEarningType"); // Field Service }
protected virtual void INTran_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { InventoryItem item = InventoryItem.PK.Find(this, ((INTran)e.Row)?.InventoryID); bool noItemOrNonStandard = item == null || item.ValMethod != INValMethod.Standard; bool isPIAdjustment = !string.IsNullOrEmpty(adjustment.Current?.PIID); bool isFIFOCreditLineFromPI = isPIAdjustment && ((INTran)e.Row)?.Qty < 0 && item?.ValMethod == INValMethod.FIFO; bool isDebitLineFromPI = isPIAdjustment && ((INTran)e.Row)?.Qty > 0; PXUIFieldAttribute.SetEnabled <INTran.branchID>(sender, e.Row, !isPIAdjustment); PXUIFieldAttribute.SetEnabled <INTran.inventoryID>(sender, e.Row, !isPIAdjustment); PXUIFieldAttribute.SetEnabled <INTran.siteID>(sender, e.Row, !isPIAdjustment); PXUIFieldAttribute.SetEnabled <INTran.locationID>(sender, e.Row, !isPIAdjustment); PXUIFieldAttribute.SetEnabled <INTran.qty>(sender, e.Row, !isPIAdjustment); PXUIFieldAttribute.SetEnabled <INTran.uOM>(sender, e.Row, !isPIAdjustment); PXUIFieldAttribute.SetEnabled <INTran.unitCost>(sender, e.Row, !isPIAdjustment && noItemOrNonStandard || isDebitLineFromPI); PXUIFieldAttribute.SetEnabled <INTran.tranCost>(sender, e.Row, !isPIAdjustment || isDebitLineFromPI); PXUIFieldAttribute.SetEnabled <INTran.expireDate>(sender, e.Row, !isPIAdjustment); PXUIFieldAttribute.SetEnabled <INTran.origRefNbr>(sender, e.Row, !isPIAdjustment || isFIFOCreditLineFromPI); PXUIFieldAttribute.SetEnabled <INTran.reasonCode>(sender, e.Row, !isPIAdjustment); PXUIFieldAttribute.SetEnabled <INTran.tranDesc>(sender, e.Row, !isPIAdjustment); // To force field disabling as INLotSerialNbrAttribute overrides enable\disable logic of PXUIFieldAttribute sender.Adjust <INLotSerialNbrAttribute>(e.Row).For <INTran.lotSerialNbr>(a => a.ForceDisable = isPIAdjustment); PXUIFieldAttribute.SetVisible <INTran.manualCost>(sender, null, isPIAdjustment); PXUIFieldAttribute.SetVisible <INTran.pILineNbr>(sender, null, isPIAdjustment); }
protected virtual void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } InventoryItem row = (InventoryItem)e.Row; if (PXAccess.FeatureInstalled <FeaturesSet.distributionModule>()) { PXUIFieldAttribute.SetWarning <InventoryItem.weightUOM>(sender, row, string.IsNullOrEmpty(commonsetup.Current.WeightUOM) ? Messages.BaseCompanyUomIsNotDefined : null); PXUIFieldAttribute.SetWarning <InventoryItem.volumeUOM>(sender, row, string.IsNullOrEmpty(commonsetup.Current.VolumeUOM) ? Messages.BaseCompanyUomIsNotDefined : null); } sender.Adjust <PXUIFieldAttribute>().For <InventoryItem.itemClassID>(a => a.Enabled = row.TemplateItemID == null) .SameFor <InventoryItem.baseUnit>() .SameFor <InventoryItem.decimalBaseUnit>() .SameFor <InventoryItem.purchaseUnit>() .SameFor <InventoryItem.decimalPurchaseUnit>() .SameFor <InventoryItem.salesUnit>() .SameFor <InventoryItem.decimalSalesUnit>() .SameFor <InventoryItem.itemType>() .SameFor <InventoryItem.taxCategoryID>(); }
protected virtual void GLAccountsFieldsDependOnStkItemFlag(PXCache cache, InventoryItem row, bool isStock) { cache.Adjust <PXUIFieldAttribute>(row).For <InventoryItem.stdCstRevAcctID>(fa => fa.Visible = isStock) .SameFor <InventoryItem.stdCstRevSubID>() .SameFor <InventoryItem.stdCstVarAcctID>() .SameFor <InventoryItem.stdCstVarSubID>() .SameFor <InventoryItem.lCVarianceAcctID>() .SameFor <InventoryItem.lCVarianceSubID>() .SameFor <InventoryItem.invtAcctID>() .SameFor <InventoryItem.invtSubID>() .SameFor <InventoryItem.cOGSAcctID>() .SameFor <InventoryItem.cOGSSubID>(); cache.Adjust <PXUIFieldAttribute>(row).For <InventoryItem.expenseAccrualAcctID>(fa => fa.Visible = !isStock) .SameFor <InventoryItem.expenseAccrualSubID>() .SameFor <InventoryItem.expenseAcctID>() .SameFor <InventoryItem.expenseSubID>(); }
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 GeneralSettingsFieldsDependOnStkItemFlag(PXCache cache, InventoryItem row, bool isStock) { cache.Adjust <PXUIFieldAttribute>(row).For <InventoryItem.valMethod>(fa => fa.Visible = isStock) .SameFor <InventoryItem.lotSerClassID>() .SameFor <InventoryItem.countryOfOrigin>() .SameFor <InventoryItem.cycleID>() .SameFor <InventoryItem.aBCCodeID>() .SameFor <InventoryItem.aBCCodeIsFixed>() .SameFor <InventoryItem.movementClassID>() .SameFor <InventoryItem.movementClassIsFixed>() .SameFor <InventoryItem.dfltShipLocationID>() .SameFor <InventoryItem.dfltReceiptLocationID>() .SameFor <InventoryItem.defaultSubItemID>(); cache.Adjust <PXUIFieldAttribute>(row).For <InventoryItem.completePOLine>(fa => fa.Visible = !isStock) .SameFor <InventoryItem.nonStockReceipt>() .SameFor <InventoryItem.nonStockShip>() .SameFor("EstimatedDuration"); // Field Service ItemClass.Cache.Adjust <PXUIFieldAttribute>().For("Mem_RouteService", fa => fa.Visible = !isStock); // Field Service }
protected override void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { base.InventoryItem_RowSelected(sender, e); var item = e.Row as InventoryItem; if (item == null) { return; } //Multiple Components are not supported for CashReceipt Deferred Revenue: DRDeferredCode dc = PXSelect <DRDeferredCode, Where <DRDeferredCode.deferredCodeID, Equal <Current <InventoryItem.deferredCode> > > > .Select(this); PXUIFieldAttribute.SetEnabled <POVendorInventory.isDefault>(this.VendorItems.Cache, null, true); //Initial State for Components: Components.Cache.AllowDelete = false; Components.Cache.AllowInsert = false; Components.Cache.AllowUpdate = false; SetDefaultTermControlsState(sender, item); if (item.IsSplitted == true) { Components.Cache.AllowDelete = true; Components.Cache.AllowInsert = true; Components.Cache.AllowUpdate = true; item.TotalPercentage = SumComponentsPercentage(); PXUIFieldAttribute.SetEnabled <InventoryItem.useParentSubID>(sender, item, true); } else { PXUIFieldAttribute.SetEnabled <InventoryItem.useParentSubID>(sender, item, false); item.UseParentSubID = false; item.TotalPercentage = 100; } if (item.NonStockReceipt == true) { PXUIFieldAttribute.SetRequired <InventoryItem.postClassID>(sender, true); } else { PXUIFieldAttribute.SetRequired <InventoryItem.postClassID>(sender, false); } InventoryHelper.CheckZeroDefaultTerm <InventoryItem.deferredCode, InventoryItem.defaultTerm>(sender, item); PXUIFieldAttribute.SetVisible <InventoryItem.taxCalcMode>(sender, item, item.ItemType == INItemTypes.ExpenseItem); sender.Adjust <PXUIFieldAttribute>(item).For <InventoryItem.completePOLine>(fa => fa.Enabled = (item.TemplateItemID == null)) .SameFor <InventoryItem.nonStockReceipt>() .SameFor <InventoryItem.nonStockShip>(); }
protected virtual void GenerationRuleRowSelected(PXCache cache, INMatrixGenerationRule row) { if (row == null) { return; } bool isAttriubte = row.SegmentType.IsIn(INMatrixGenerationRule.segmentType.AttributeCaption, IDGenerationRule.segmentType.AttributeValue); bool isConstant = row.SegmentType == INMatrixGenerationRule.segmentType.Constant; bool isAutonumber = row.SegmentType == INMatrixGenerationRule.segmentType.AutoNumber; cache.Adjust <PXUIFieldAttribute>(row) .For <INMatrixGenerationRule.attributeID>(a => a.Enabled = isAttriubte) .For <INMatrixGenerationRule.constant>(a => a.Enabled = isConstant) .For <IDGenerationRule.numberingID>(a => a.Enabled = isAutonumber) .For <INMatrixGenerationRule.separator>(a => a.Enabled = row.UseSpaceAsSeparator != true); }
public static void CopyTranslations <TSourceField, TDestinationField>( PXCache sourceCache, object sourceData, PXCache destinationCache, object destinationData, Func <string, string> processTranslation) where TSourceField : IBqlField where TDestinationField : IBqlField { if (IsEnabled) { var translationAttribute = sourceCache.GetAttributesReadonly <TSourceField>(sourceData) .OfType <DBMatrixLocalizableDescriptionAttribute>().FirstOrDefault(); string[] translations = translationAttribute.GetTranslations(sourceCache, sourceData) .Select(t => processTranslation(t)).ToArray(); destinationCache.Adjust <DBMatrixLocalizableDescriptionAttribute>(destinationData).For <TDestinationField>(a => a.SetTranslations(destinationCache, destinationData, translations)); } }
protected virtual void FulfillmentFieldsDependOnStkItemFlag(PXCache cache, InventoryItem row, bool isStock) { cache.Adjust <PXUIFieldAttribute>(row).For <InventoryItem.hSTariffCode>(fa => fa.Visible = isStock) .SameFor <InventoryItem.packageOption>() .SameFor <InventoryItem.packSeparately>(); }
protected override void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { base.InventoryItem_RowSelected(sender, e); InventoryItem row = (InventoryItem)e.Row; if (row == null) { return; } PXUIFieldAttribute.SetEnabled <InventoryItem.cOGSSubID>(sender, row, (postclass.Current != null && postclass.Current.COGSSubFromSales == false)); PXUIFieldAttribute.SetEnabled <InventoryItem.stdCstVarAcctID>(sender, row, row?.ValMethod == INValMethod.Standard); PXUIFieldAttribute.SetEnabled <InventoryItem.stdCstVarSubID>(sender, row, row?.ValMethod == INValMethod.Standard); PXUIFieldAttribute.SetEnabled <InventoryItem.stdCstRevAcctID>(sender, row, row?.ValMethod == INValMethod.Standard); PXUIFieldAttribute.SetEnabled <InventoryItem.stdCstRevSubID>(sender, row, row?.ValMethod == INValMethod.Standard); PXUIFieldAttribute.SetEnabled <InventoryItem.pendingStdCost>(sender, row, row?.ValMethod == INValMethod.Standard); PXUIFieldAttribute.SetEnabled <InventoryItem.pendingStdCostDate>(sender, row, row?.ValMethod == INValMethod.Standard); PXUIFieldAttribute.SetVisible <InventoryItem.defaultSubItemOnEntry>(sender, null, insetup.Current.UseInventorySubItem == true); PXUIFieldAttribute.SetEnabled <POVendorInventory.isDefault>(this.VendorItems.Cache, null, true); INAcctSubDefault.Required(sender, new PXRowSelectedEventArgs(row)); PXUIFieldAttribute.SetVisible <InventoryItem.defaultSubItemOnEntry>(sender, null, insetup.Current.UseInventorySubItem == true); Boxes.Cache.AllowInsert = row.PackageOption != INPackageOption.Manual && PXAccess.FeatureInstalled <FeaturesSet.autoPackaging>(); Boxes.Cache.AllowUpdate = row.PackageOption != INPackageOption.Manual && PXAccess.FeatureInstalled <FeaturesSet.autoPackaging>(); Boxes.Cache.AllowSelect = PXAccess.FeatureInstalled <FeaturesSet.autoPackaging>(); if (row.PackageOption == INPackageOption.Quantity) { PXUIFieldAttribute.SetEnabled <InventoryItem.packSeparately>(Item.Cache, Item.Current, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.qty>(Boxes.Cache, null, true); PXUIFieldAttribute.SetVisible <INItemBoxEx.uOM>(Boxes.Cache, null, true); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxQty>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxWeight>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxVolume>(Boxes.Cache, null, false); } else if (row.PackageOption == INPackageOption.Weight) { PXUIFieldAttribute.SetEnabled <InventoryItem.packSeparately>(Item.Cache, Item.Current, true); PXUIFieldAttribute.SetVisible <INItemBoxEx.qty>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.uOM>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxQty>(Boxes.Cache, null, true); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxWeight>(Boxes.Cache, null, true); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxVolume>(Boxes.Cache, null, false); } else if (row.PackageOption == INPackageOption.WeightAndVolume) { PXUIFieldAttribute.SetEnabled <InventoryItem.packSeparately>(Item.Cache, Item.Current, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.qty>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.uOM>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxQty>(Boxes.Cache, null, true); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxWeight>(Boxes.Cache, null, true); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxVolume>(Boxes.Cache, null, true); } else if (row.PackageOption == INPackageOption.Manual) { Boxes.Cache.AllowSelect = false; PXUIFieldAttribute.SetEnabled <InventoryItem.packSeparately>(Item.Cache, Item.Current, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.qty>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.uOM>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxQty>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxWeight>(Boxes.Cache, null, false); PXUIFieldAttribute.SetVisible <INItemBoxEx.maxVolume>(Boxes.Cache, null, false); } if (PXAccess.FeatureInstalled <FeaturesSet.autoPackaging>()) { ValidatePackaging(row); } FieldsDependOnStkItemFlag(sender, row); var hasChildObject = sender.GetValueExt <InventoryItem.hasChild>(row); bool hasChild = ((hasChildObject is PXFieldState s) ? (bool?)s.Value : (bool?)hasChildObject) == true; sender.Adjust <PXUIFieldAttribute>().For <InventoryItem.itemClassID>(a => a.Enabled = !hasChild) .SameFor <InventoryItem.stkItem>() .SameFor <InventoryItem.baseUnit>() .SameFor <InventoryItem.decimalBaseUnit>() .SameFor <InventoryItem.purchaseUnit>() .SameFor <InventoryItem.decimalPurchaseUnit>() .SameFor <InventoryItem.salesUnit>() .SameFor <InventoryItem.decimalSalesUnit>(); }
public virtual void SetDecimalVerifyMode(PXCache cache, TLine line) { var decimalVerifyMode = GetLineVerifyMode(cache, line); cache.Adjust <PXDBQuantityAttribute>(line).ForAllFields(a => a.SetDecimalVerifyMode(line, decimalVerifyMode)); }