Esempio n. 1
0
        /// <summary>
        /// Load Invoice Line
        /// </summary>
        /// <param name="inventory"></param>
        /// <returns>DocLine Array</returns>
        private DocLine[] LoadLines(MInventory inventory)
        {
            List <DocLine> list = new List <DocLine>();

            MInventoryLine[] lines = inventory.GetLines(false);
            for (int i = 0; i < lines.Length; i++)
            {
                MInventoryLine line = lines[i];
                //	nothing to post
                if (line.GetQtyBook().CompareTo(line.GetQtyCount()) == 0 &&
                    Env.Signum(line.GetQtyInternalUse()) == 0)
                {
                    continue;
                }
                //
                DocLine docLine = new DocLine(line, this);
                Decimal Qty     = line.GetQtyInternalUse();
                if (Env.Signum(Qty) != 0)
                {
                    Qty = Decimal.Negate(Qty);          //	Internal Use entered positive
                }
                else
                {
                    Decimal QtyBook  = line.GetQtyBook();
                    Decimal QtyCount = line.GetQtyCount();
                    Qty = Decimal.Subtract(QtyCount, QtyBook);
                }
                docLine.SetQty(Qty, false);             // -5 => -5
                //
                log.Fine(docLine.ToString());
                list.Add(docLine);
            }

            //	Return Array
            DocLine[] dls = new DocLine[list.Count];
            dls = list.ToArray();
            return(dls);
        }