public virtual void OnPersist(IEnumerable <Organization> organizations) { OrganizationMaint organizationMaint = CreateInstance <OrganizationMaint>(); PXCache organizationCache = organizationMaint.OrganizationView.Cache; PXDBTimestampAttribute timestampAttribute = organizationCache .GetAttributesOfType <PXDBTimestampAttribute>(null, nameof(Organization.tstamp)) .First(); timestampAttribute.RecordComesFirst = true; foreach (Organization organization in organizations) { organizationMaint.Clear(); organizationMaint.BAccount.Current = organizationMaint.BAccount.Search <OrganizationBAccount.bAccountID>(organization.BAccountID); organizationCache.Clear(); organizationCache.ClearQueryCache(); if (organization.ActualLedgerID < 0) { organization.ActualLedgerID = LedgerIDMap[organization.ActualLedgerID].LedgerID; } organizationCache.Current = organization; organizationCache.SetStatus(organizationMaint.OrganizationView.Current, PXEntryStatus.Updated); organizationMaint.Actions.PressSave(); } }
protected override DecimalVerifyMode GetLineVerifyMode(PXCache cache, POReceiptLine line) { if (!IsDropShipLine(line)) { var cacheAttribute = cache.GetAttributesOfType <PXDBQuantityAttribute>(null, nameof(POReceiptLine.receiptQty)).FirstOrDefault(); if (cacheAttribute != null) { return(cacheAttribute.DecimalVerifyMode); } } return(DecimalVerifyMode.Off); }
public void UpdateVendorBalanceDisplayName(APRegister invoice, PXCache cache) { var isRetainageGroup = invoice.IsRetainageDocument.GetValueOrDefault() || invoice.RetainageApply.GetValueOrDefault(); var displayName = isRetainageGroup ? JointCheckLabels.MaxAvailableAmount : JointCheckLabels.VendorBalance; var fieldAttributes = cache.GetAttributesOfType <PXUIFieldAttribute>( invoice, typeof(APInvoiceJCExt.vendorBalance).Name); fieldAttributes.Where(attribute => attribute != null).ForEach(x => x.DisplayName = displayName); }
public virtual void RowSelected(PXCache sender, PXRowSelectedEventArgs e) { sender.GetAttributesOfType <PXUIFieldAttribute>(null, null).ForEach(attr => { attr.Visible = inventoryVisibleFields.Value.Contains(attr.FieldName); if (!attr.FieldName.Equals(typeof(MatrixInventoryItem.selected).Name, StringComparison.OrdinalIgnoreCase)) { attr.Enabled = false; } }); var row = (MatrixInventoryItem)e.Row; if (row != null) { PXUIFieldAttribute.SetEnabled <MatrixInventoryItem.selected>(sender, row, row.Exists != true && row.Duplicate != true); string warnMessage = (row.Exists == true) ? Messages.InventoryIDExists : (row.Duplicate == true) ? Messages.InventoryIDDuplicates : null; var warnExc = (warnMessage == null) ? null : new PXSetPropertyException(warnMessage, PXErrorLevel.Warning); sender.RaiseExceptionHandling <MatrixInventoryItem.selected>(row, false, warnExc); } }
public static bool GetEnabled <TField>(this PXCache cache, object data) where TField : IBqlField { return(cache.GetAttributesOfType <PXUIFieldAttribute>(data, typeof(TField).Name) .Single(attribute => attribute != null).Enabled); }