Beispiel #1
0
        protected bool startSave()
        {
            try
            {
                FinishDataEditing();

                if (_checkLevel)
                {
                    DataRow row    = ToolRow.getFirstRealRow(_tableSchema);
                    double  amount = (double)ToolCell.isNull(row[TableDUMMY.AMOUNT], 0.0);
                    double  onhand = (double)ToolCell.isNull(_curMatRecord[TableDUMMY.ONHAND], 0.0);
                    if ((amount - onhand) > ConstValues.minPositive)
                    {
                        ToolMsg.show(this, MessageCollection.T_MSG_INVALID_QUANTITY, null);
                        return(false);
                    }
                }



                DataRow _rowActiveUnit = this.BindingContext.getBindingItemRecord(cUnit);

                //
                if (_rowActiveUnit != null)
                {
                    switch (handler.converCol(handler.column))
                    {
                    case TableDUMMY.AMOUNT:
                        ToolCell.set(handler.row, TableSTLINE.AMOUNT, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.AMOUNT]);
                        //
                        if (_rowActiveUnit != null)
                        {
                            ToolCell.set(handler.row, TableSTLINE.UNIT, _rowActiveUnit[TableDUMMY.UNIT]);
                            ToolCell.set(handler.row, TableSTLINE.UNITREF, _rowActiveUnit[TableDUMMY.UNITREF]);
                            ToolCell.set(handler.row, TableSTLINE.UINFO1, _rowActiveUnit[TableDUMMY.UNITCF01]);
                            ToolCell.set(handler.row, TableSTLINE.UINFO2, _rowActiveUnit[TableDUMMY.UNITCF02]);
                        }
                        //
                        return(true);

                    case TableDUMMY.PRICE:
                        ToolCell.set(handler.row, TableSTLINE.PRICE, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.PRICE]);
                        return(true);

                    case TableDUMMY.DISCPER:
                        ToolCell.set(handler.row, TableSTLINE.DISCPER, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.DISCPER]);
                        return(true);

                    case TableDUMMY.TOTAL:
                        ToolCell.set(handler.row, TableSTLINE.TOTAL, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.TOTAL]);
                        return(true);
                    }
                }
            }
            catch (Exception exc)
            {
                ToolMobile.setException(exc);
            }
            return(false);
        }
Beispiel #2
0
        public static string getNext(IEnvironment env, DateTime date, short mod, short docType, short firm, short div, short factory, short wh, short group, short role, short user)
        {
            DataRow rowNum;

            DataTable tabNum = getData(env, date, mod, docType, firm, div, factory, wh, group, role, user);
            //////////////////////////////////
            DataTable tabCopy = tabNum.Copy();

            tabNum.Clear();

            tabCopy.DefaultView.Sort = "USERID DESC";
            tabNum.Load(tabCopy.DefaultView.ToTable().CreateDataReader());
            //////////////////////////////////
            rowNum = ToolRow.getFirstRealRow(tabNum);
            ToolSeq.lockByUpdate(env, TableDOCNUM.TABLE_REAL_NAME, rowNum[TableDOCNUM.LOGICALREF]);
            rowNum = ToolRow.getFirstRealRow(getData(env, (int)rowNum[TableDOCNUM.LOGICALREF]));
            //
            string newDocNum = getNewDocNum(rowNum, env, date, mod, docType, firm, div, factory, wh, group, role, user);

            //
            rowNum[TableDOCNUM.LASTASGND] = newDocNum;
            IAdapterTable adapter = new AdapterTableDocNum(env, TableDOCNUM.LOGICALREF);

            adapter.set(rowNum.Table);
            return(newDocNum);
        }
Beispiel #3
0
        void refreshVal(double pValue, double pCf, string pCol, bool pReverse)
        {
            if (_blockPoint.block())
            {
                try
                {
                    if (pCf < ConstValues.minPositive)
                    {
                        pCf = 1.0;
                    }

                    DataRow rowMain = ToolRow.getFirstRealRow(_tableSchema);
                    double  mCf     = (double)rowMain[TableDUMMY.CONVFACT];
                    double  mAmount = pValue * (pReverse ? (mCf / pCf) : (pCf / mCf));

                    foreach (DataRow curRow in _tableSchema.Rows)
                    {
                        double curCf = (double)curRow[TableDUMMY.CONVFACT];
                        if (curCf < ConstValues.minPositive)
                        {
                            curCf = 1.0;
                        }
                        ToolCell.set(curRow, pCol, mAmount * (pReverse ? (curCf / mCf) : (mCf / curCf)));
                    }
                }
                finally
                {
                    _blockPoint.unblock();
                }
            }
        }
Beispiel #4
0
        protected override void onNewAdded(EditingTools pTool, object pLref)
        {
            var ds_ = pTool.adapter.getDataSet();

            if (ds_ != null)
            {
                var tab_ = ds_.Tables[TableINVOICE.TABLE];
                if (tab_ != null)
                {
                    tab_ = tab_.Copy();
                    DataRow row_ = ToolRow.getFirstRealRow(tab_);
                    if (row_ != null)
                    {
                        var ext_  = row_[TableINVOICE.GENEXP1].ToString().ToLowerInvariant();
                        var text_ = environment.getSysSettings().getString(SettingsSysMob.MOB_SYS_DOPAYMENTEXP, "").ToLowerInvariant().Trim();

                        if (!string.IsNullOrEmpty(text_) && ext_ == text_)
                        {
                            var x = new Action(() =>
                            {
                                doCash(row_);
                            });

                            addActionOnResume(x);
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public virtual DataTable getLast()
        {
            reverseSort();
            DataTable table = getFirst();

            reverseSort();
            setBorder(ToolRow.getFirstRealRow(table));
            return(ToolTable.createReversed(table));
        }
Beispiel #6
0
 void refreshVal()
 {
     if (!_blockPoint.isBlocked())
     {
         DataRow rowMain = ToolRow.getFirstRealRow(_tableSchema);
         refreshVal((double)rowMain[TableDUMMY.AMOUNT], (double)rowMain[TableDUMMY.CONVFACT], TableDUMMY.AMOUNT, false);
         refreshVal((double)rowMain[TableDUMMY.PRICE], (double)rowMain[TableDUMMY.CONVFACT], TableDUMMY.PRICE, true);
         refreshVal((double)rowMain[TableDUMMY.TOTAL], TableDUMMY.TOTAL);
         refreshVal((double)rowMain[TableDUMMY.DISCPER], TableDUMMY.DISCPER);
     }
 }
        public static DataRow getItemData(IEnvironment pEnv, object lref)
        {
            DataTable tab_ = SqlExecute.execute(pEnv, "SELECT * FROM LG_$FIRM$_ITEMS WHERE LOGICALREF = @P1", new object[] { lref });

            tab_.TableName = TableITEMS.TABLE;
            return(ToolRow.getFirstRealRow(tab_));

            //IPagedSource ps = new PagedSourceMaterial(pEnv);
            //ps.getBuilder().addParameterValue(TableITEMS.LOGICALREF, lref);
            //DataTable table = ps.getAll();
            //return ToolRow.getFirstRealRow(table);
        }
Beispiel #8
0
        public static void syncWithClTran(DataTable tabPayTrans, DataTable tabClTrans)
        {
            DataRow rowTran = ToolRow.getFirstRealRow(tabClTrans);

            if (rowTran != null)
            {
                DataRow rowPay = ToolRow.getFirstRealRow(tabPayTrans);
                if (rowPay == null)
                {
                    tabPayTrans.Rows.Add(rowPay = ToolRow.initTableNewRow(tabPayTrans.NewRow()));
                }

                ToolCell.set(rowPay, TablePAYTRANS.PAYNO, 1);
                ToolCell.set(rowPay, TablePAYTRANS.PROCDATE, rowTran[TableCLFLINE.DATE_]);
                ToolCell.set(rowPay, TablePAYTRANS.DISCDUEDATE, rowTran[TableCLFLINE.DATE_]);
                ToolCell.set(rowPay, TablePAYTRANS.DATE_, rowTran[TableCLFLINE.DATE_]);
                ToolCell.set(rowPay, TablePAYTRANS.TOTAL, rowTran[TableCLFLINE.AMOUNT]);
                ToolCell.set(rowPay, TablePAYTRANS.REPORTRATE, rowTran[TableCLFLINE.REPORTRATE]);
                ToolCell.set(rowPay, TablePAYTRANS.CARDREF, rowTran[TableCLFLINE.CLIENTREF]);
                ToolCell.set(rowPay, TablePAYTRANS.DISCDUEDATE, rowTran[TableCLFLINE.DATE_]);
                ToolCell.set(rowPay, TablePAYTRANS.TRCURR, rowTran[TableCLFLINE.TRCURR]);
                ToolCell.set(rowPay, TablePAYTRANS.TRNET, rowTran[TableCLFLINE.TRNET]);
            }
        }
Beispiel #9
0
 public virtual DataRow getHeaderRecord()
 {
     return(ToolRow.getFirstRealRow(getHeaderTable()));
 }