public virtual void SetActualLedgerIDNullInRelatedCompanies(Ledger ledger, int?[] organizationIDs) { IEnumerable <Organization> organizations = OrganizationMaint.FindOrganizationByIDs(Base, organizationIDs, isReadonly: false); foreach (Organization organization in organizations) { Organization organizationCopy = PXCache <Organization> .CreateCopy(organization); organizationCopy.ActualLedgerID = null; OrganizationViewBase.Update(organizationCopy); } }
protected virtual void OrganizationLedgerLink_RowDeleted(PXCache cache, PXRowDeletedEventArgs e) { var link = e.Row as OrganizationLedgerLink; if (link == null) { return; } Ledger ledger = GeneralLedgerMaint.FindLedgerByID(Base, link.LedgerID, isReadonly: false); Organization organization = GetUpdatingOrganization(link.OrganizationID); PXEntryStatus organizationEntryStatus = OrganizationViewBase.Cache.GetStatus(organization); if (ledger.BalanceType == LedgerBalanceType.Actual && organizationEntryStatus != PXEntryStatus.Deleted && organizationEntryStatus != PXEntryStatus.InsertedDeleted) { Organization organizationCopy = PXCache <Organization> .CreateCopy(organization); organizationCopy.ActualLedgerID = null; OrganizationViewBase.Update(organizationCopy); } }