Esempio n. 1
0
        public override object getResult()
        {
            double x_ = Convert.ToDouble(values[indxX]);
            double y_ = Convert.ToDouble(values[indxY]);

            y_ = (zeroYto1 && ToolDouble.isZero(y_)) ? 1 : y_; //if FlagY enabled Y will be set to 1

            return(ToolDouble.isZero(y_) ? 0 : x_ / y_);
        }
Esempio n. 2
0
        public override object getResult()
        {
            double x_ = Convert.ToDouble(values[indxX]);
            double y_ = Convert.ToDouble(values[indxY]);

            y_ = (zeroYto1 && ToolDouble.isZero(y_)) ? 1 : y_;

            return(x_ * y_ * _coif);
        }
Esempio n. 3
0
        private void fillSchema(DataRow rowDocLine)
        {
            _curMatRecord = ToolStockLine.getItemData(environment, rowDocLine[TableSTLINE.STOCKREF]);

            //

            //if (_checkLevel)
            {
                //object docLRef = rowDocHeader[TableINVOICE.LOGICALREF];
                object lref   = rowDocLine[TableSTLINE.STOCKREF];
                double onhand = (double)ToolCell.isNull(_curMatRecord[TableITEMS.ONHAND], 0.0);
                onhand += environment.getMatIOAmount(lref);
                //onhand += ToolStockLine.itemAmountInDoc(lref, rowDocLine.Table);
                //onhand += ToolStockLine.itemAmountInDB(environment, lref, docLRef);
                ToolCell.set(_curMatRecord, TableITEMS.ONHAND, onhand);
            }


            //
            if (handler.report != null)
            {
                handler.report.setDataSource(_curMatRecord.Table);
                handler.report.refreshSource();
            }
            //
            _tableSchema.Clear();



            string unit   = string.Empty;
            double amount = (double)ToolCell.isNull(rowDocLine[TableSTLINE.AMOUNT], 0.0);

            if (ToolDouble.isZero(amount) && CurrentVersion.ENV.getEnvBool("STOCKAMOUNTONE", false))
            {
                amount = 1.0;
            }

            double  price   = (double)ToolCell.isNull(rowDocLine[TableSTLINE.PRICE], 0.0);
            double  total   = (double)ToolCell.isNull(rowDocLine[TableSTLINE.TOTAL], 0.0);
            double  disperc = (double)ToolCell.isNull(rowDocLine[TableSTLINE.DISCPER], 0.0);
            double  uinfo1  = 0.0;
            double  uinfo2  = 0.0;
            DataRow newRow;

            //
            newRow = ToolRow.initTableNewRow(_tableSchema.NewRow());
            newRow[TableDUMMY.UNIT]     = unit = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNIT1], string.Empty);
            newRow[TableDUMMY.UNITREF]  = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNITREF1], string.Empty);
            newRow[TableDUMMY.UNITCF01] = uinfo1 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF1], 0.0);
            newRow[TableDUMMY.UNITCF02] = uinfo2 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF1], 0.0);
            newRow[TableDUMMY.CONVFACT] = (uinfo1 > ConstValues.minPositive ? uinfo2 / uinfo1 : 1.0);

            newRow[TableDUMMY.AMOUNT]  = amount;
            newRow[TableDUMMY.PRICE]   = price;
            newRow[TableDUMMY.TOTAL]   = total;
            newRow[TableDUMMY.DISCPER] = disperc;

            _tableSchema.Rows.Add(newRow);
            //
            newRow = ToolRow.initTableNewRow(_tableSchema.NewRow());
            newRow[TableDUMMY.UNIT]     = unit = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNIT2], string.Empty);
            newRow[TableDUMMY.UNITREF]  = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNITREF2], string.Empty);
            newRow[TableDUMMY.UNITCF01] = uinfo1 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF1], 0.0);
            newRow[TableDUMMY.UNITCF02] = uinfo2 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF2], 0.0);
            newRow[TableDUMMY.CONVFACT] = (uinfo1 > ConstValues.minPositive ? uinfo2 / uinfo1 : 1.0);
            if ((unit != string.Empty))
            {
                _tableSchema.Rows.Add(newRow);
            }

            //
            newRow = ToolRow.initTableNewRow(_tableSchema.NewRow());
            newRow[TableDUMMY.UNIT]     = unit = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNIT3], string.Empty);
            newRow[TableDUMMY.UNITREF]  = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNITREF3], string.Empty);
            newRow[TableDUMMY.UNITCF01] = uinfo1 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF1], 0.0);
            newRow[TableDUMMY.UNITCF02] = uinfo2 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF3], 0.0);
            newRow[TableDUMMY.CONVFACT] = (uinfo1 > ConstValues.minPositive ? uinfo2 / uinfo1 : 1.0);
            if ((unit != string.Empty))
            {
                _tableSchema.Rows.Add(newRow);
            }
            //
            refreshVal();
            //
            //check
            //string userUnitRef = (string)ToolCell.isNull(rowDocLine[TableSTLINE.UNITREF], string.Empty);
            //for (int i = 0; i < _tableSchema.Rows.Count; ++i)
            //{
            //    DataRow row = _tableSchema.Rows[i];
            //    string unitRef = (string)row[TableDUMMY.UNITREF];
            //    if (userUnitRef == unitRef)
            //        cBoxUnits.SelectedIndex = i;
            //}
        }