예제 #1
0
        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);
        }
예제 #2
0
 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;
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
                }
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
 public AllocationSourceDetail(GLAllocationSource aSrc)
 {
     this.CopyFrom(aSrc);
 }
예제 #8
0
 protected virtual void GLAllocationSource_BranchID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
 {
     GLAllocationSource row = (GLAllocationSource)e.Row;
 }
예제 #9
0
        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);
        }