Exemplo n.º 1
0
        static double getStockDocLineAmount(DataRow docLine)
        {
            double        amount      = 0;
            ConstBool     isCancelled = (ConstBool)(short)ToolCell.isNull(docLine[TableSTLINE.CANCELLED], (short)ConstBool.yes);
            ConstLineType lineType    = (ConstLineType)(short)ToolCell.isNull(docLine[TableSTLINE.LINETYPE], (short)ConstLineType.undef);


            if (isCancelled == ConstBool.not && (lineType == ConstLineType.material || lineType == ConstLineType.promotion))
            {
                amount = (double)ToolCell.isNull(docLine[TableSTLINE.AMOUNT], 0.0);
                ConstIOCode ioCode = (ConstIOCode)(short)ToolCell.isNull(docLine[TableSTLINE.IOCODE], (short)0);
                switch (ioCode)
                {
                case ConstIOCode.input:
                case ConstIOCode.inputFromWarehouse:
                    amount = +amount;
                    break;

                case ConstIOCode.output:
                case ConstIOCode.outputFromWarehouse:
                    amount = -amount;
                    break;

                default:
                    amount = 0;
                    break;
                }
            }
            return(amount);
        }
Exemplo n.º 2
0
        double getIOSign(ConstIOCode ioCode)
        {
            // double sign = 0;
            switch (ioCode)
            {
            case ConstIOCode.input:
            case ConstIOCode.inputFromWarehouse:
                return(+1);

            case ConstIOCode.output:
            case ConstIOCode.outputFromWarehouse:
                return(-1);
            }
            return(0);
        }
Exemplo n.º 3
0
        double getFix(object lref, DataRow lRow, DataRowVersion vers)
        {
            double fix = 0;

            if ((string)lref == (string)lRow[TableSTLINE.STOCKREF, vers])
            {
                ConstBool isCancelled = (ConstBool)(short)ToolCell.isNull(lRow[TableSTLINE.CANCELLED, vers], (short)ConstBool.yes);
                if (isCancelled == ConstBool.not)
                {
                    ConstLineType lineType = (ConstLineType)(short)ToolCell.isNull(lRow[TableSTLINE.LINETYPE, vers], (short)ConstLineType.undef);
                    double        amount   = (double)ToolCell.isNull(lRow[TableSTLINE.AMOUNT, vers], (double)0.0);
                    ConstIOCode   ioCode   = (ConstIOCode)(short)ToolCell.isNull(lRow[TableSTLINE.IOCODE, vers], (short)0);
                    if (lineType == ConstLineType.material || lineType == ConstLineType.promotion)
                    {
                        fix += (amount * getIOSign(ioCode));
                    }
                }
            }
            return(fix);
        }