protected virtual bool IsSourceInterlacingWithDictionary(GLAllocationSource aSrc, Dictionary <AllocationProcess.BranchAccountSubKey, AllocationSourceDetail> aSrcDict) { string acctCDWildCard = SubCDUtils.CreateSubCDWildcard(aSrc.AccountCD, AccountAttribute.DimensionName); string subCDWildCard = SubCDUtils.CreateSubCDWildcard(aSrc.SubCD, SubAccountAttribute.DimensionName); foreach (Account iAcct in PXSelect <Account, Where <Account.accountCD, Like <Required <Account.accountCD> > > > .Select(this, acctCDWildCard)) { foreach (Sub iSub in PXSelect <Sub, Where <Sub.subCD, Like <Required <Sub.subCD> > > > .Select(this, subCDWildCard)) { AllocationProcess.BranchAccountSubKey key = new AllocationProcess.BranchAccountSubKey(aSrc.BranchID.Value, iAcct.AccountID.Value, iSub.SubID.Value); if (aSrcDict.ContainsKey(key)) { return(true); } else { AllocationSourceDetail detail = new AllocationSourceDetail(aSrc); detail.AccountID = iAcct.AccountID; detail.SubID = iSub.SubID; if (detail.ContraAccountID != null && detail.ContraSubID == null) { detail.ContraSubID = detail.SubID; } aSrcDict[key] = detail; } } } return(false); }
public virtual void CopyFrom(GLAllocationSource aSrc) { this.LineID = aSrc.LineID; this.BranchID = aSrc.BranchID; this.ContraAccountID = aSrc.ContrAccountID; this.ContraSubID = aSrc.ContrSubID; this.LimitAmount = aSrc.LimitAmount; this.LimitPercent = aSrc.LimitPercent; }
protected virtual void GLAllocationSource_LimitAmount_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { GLAllocationSource src = (GLAllocationSource)e.Row; if (src.LimitAmount.HasValue) { src.LimitPercent = null; //this.Source.Cache.Update(src); } }
protected virtual void GLAllocationSource_RowPersisting(PXCache cache, PXRowPersistingEventArgs e) { GLAllocationSource row = (GLAllocationSource)e.Row; if (string.IsNullOrEmpty(row.AccountCD.Trim())) { if (cache.RaiseExceptionHandling <GLAllocationSource.accountCD>(e.Row, row.AccountCD, new PXSetPropertyException(Messages.AllocationSrcEmptyAccMask, PXErrorLevel.Error))) { throw new PXRowPersistingException(typeof(GLAllocationSource.accountCD).Name, row.AccountCD, Messages.AllocationSrcEmptyAccMask); } } }
protected virtual bool ValidateSrcAccountsForInterlacing(out GLAllocationSource aRow) { aRow = null; Dictionary <AllocationProcess.BranchAccountSubKey, AllocationSourceDetail> sources = new Dictionary <AllocationProcess.BranchAccountSubKey, AllocationSourceDetail>(); foreach (GLAllocationSource iSrc in this.Source.Select()) { if (IsSourceInterlacingWithDictionary(iSrc, sources)) { aRow = iSrc; return(false); } } return(true); }
protected virtual void GLAllocationSource_RowPersisting(PXCache cache, PXRowPersistingEventArgs e) { GLAllocationSource row = (GLAllocationSource)e.Row; if (string.IsNullOrEmpty(row.AccountCD.Trim())) { if (cache.RaiseExceptionHandling <GLAllocationSource.accountCD>(e.Row, row.AccountCD, new PXSetPropertyException(Messages.AllocationSrcEmptyAccMask, PXErrorLevel.Error))) { throw new PXRowPersistingException(typeof(GLAllocationSource.accountCD).Name, row.AccountCD, Messages.AllocationSrcEmptyAccMask); } } else { VerifyAccountIDToBeNoControl <GLAllocationSource.accountCD, GLAllocationSource.accountCD>(cache, e, row.AccountCD, Allocation.Current?.SourceLedgerID); VerifyAccountIDToBeNoControl <GLAllocationSource.contrAccountID, Account.accountID>(cache, e, row.ContrAccountID, Allocation.Current?.SourceLedgerID); } }
public AllocationSourceDetail(GLAllocationSource aSrc) { this.CopyFrom(aSrc); }
protected virtual void GLAllocationSource_BranchID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { GLAllocationSource row = (GLAllocationSource)e.Row; }
protected virtual void GLAllocationSource_LimitAmount_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { GLAllocationSource src = (GLAllocationSource)e.Row; src.LimitPercent = (src.LimitAmount == decimal.Zero ? 100.00m : decimal.Zero); }