Пример #1
0
        /// <summary>
        /// Check Accounts of Fact Lines
        /// </summary>
        /// <returns>true if success</returns>
        public bool CheckAccounts()
        {
            //  no lines -> nothing to distribute
            if (_lines.Count == 0)
            {
                return(true);
            }

            //	For all fact lines
            for (int i = 0; i < _lines.Count; i++)
            {
                FactLine line    = (FactLine)_lines[i];
                MAccount account = line.GetAccount();
                if (account == null)
                {
                    log.Warning("No Account for " + line);
                    return(false);
                }
                MElementValue ev = account.GetAccount();
                if (ev == null)
                {
                    log.Warning("No Element Value for " + account
                                + ": " + line);
                    return(false);
                }
                if (ev.IsSummary())
                {
                    log.Warning("Cannot post to Summary Account " + ev
                                + ": " + line);
                    return(false);
                }
                if (!ev.IsActive())
                {
                    log.Warning("Cannot post to Inactive Account " + ev
                                + ": " + line);
                    return(false);
                }
            }   //	for all lines

            return(true);
        }