Esempio n. 1
0
 /// <summary>
 /// Balance all segments.
 /// - For all balancing segments
 /// - For all segment values
 /// - If balance <> 0 create dueTo/dueFrom line
 /// overwriting the segment value
 /// </summary>
 public void BalanceSegments()
 {
     MAcctSchemaElement[] elements = _acctSchema.GetAcctSchemaElements();
     //  check all balancing segments
     for (int i = 0; i < elements.Length; i++)
     {
         MAcctSchemaElement ase = elements[i];
         if (ase.IsBalanced())
         {
             BalanceSegment(ase.GetElementType());
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Are all segments balanced
        /// </summary>
        /// <returns>true if segments are balanced</returns>
        public bool IsSegmentBalanced()
        {
            if (_lines.Count == 0)
            {
                return(true);
            }

            MAcctSchemaElement[] elements = _acctSchema.GetAcctSchemaElements();
            //  check all balancing segments
            for (int i = 0; i < elements.Length; i++)
            {
                MAcctSchemaElement ase = elements[i];
                if (ase.IsBalanced() && !IsSegmentBalanced(ase.GetElementType()))
                {
                    return(false);
                }
            }
            return(true);
        }