/// <summary>
        /// Sum cost data of equipments
        /// </summary>
        private void CounterCost()
        {
            InvertoryTimeVo maxInvertory = (InvertoryTimeVo)DefaultCbmInvoker.Invoke(new GetInvertoryTimeMaxCbm(), new InvertoryTimeVo());
            object          totalMachine = Vo.table.Compute("sum(Qty)", "");
            int             inventoried  = 0;
            double          aqui_cost    = 0;
            double          month_depr   = 0;
            double          curr_depr    = 0;
            double          accum_depr   = 0;
            double          net_value    = 0;

            foreach (DataGridViewRow dr in dgvAccountData.Rows)
            {
                if (dr != null)
                {
                    if (dr.Cells["Inventory_Time"].Value.ToString() == maxInvertory.invertory_time_name)
                    {
                        inventoried += int.Parse(dr.Cells["Qty"].Value.ToString());
                    }
                    aqui_cost  += double.Parse(dr.Cells["Acquisition_Cost"].Value.ToString());
                    month_depr += double.Parse(dr.Cells["Monthly_Depr"].Value.ToString());
                    curr_depr  += double.Parse(dr.Cells["Current_Depr"].Value.ToString());
                    accum_depr += double.Parse(dr.Cells["Accum_Depr"].Value.ToString());
                    net_value  += double.Parse(dr.Cells["Net_Value"].Value.ToString());
                }
            }
            dgvAccCounter.Rows.Clear();
            dgvAccCounter.Rows.Add(aqui_cost, month_depr, curr_depr, accum_depr, net_value, inventoried, totalMachine);
            dgvAccCounter.Refresh();
            grt_Option.SelectedTab = tab_TotalCost;
        }
Beispiel #2
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            InvertoryTimeVo inVo  = (InvertoryTimeVo)vo;
            InvertoryTimeVo outVo = new InvertoryTimeVo();
            StringBuilder   sql   = new StringBuilder();
            //CREATE SQL ADAPTER AND PARAMETER LIST
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("select invertory_time_id, invertory_time_cd, invertory_time_name from m_invertory_time ");
            sql.Append("where registration_date_time = (select max(registration_date_time) from m_invertory_time)");
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            sql.Clear();
            //EXECUTE READER FROM COMMAND
            IDataReader datareader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (datareader.Read())
            {
                outVo.invertory_time_id   = (int)datareader["invertory_time_id"];
                outVo.invertory_time_cd   = datareader["invertory_time_cd"].ToString();
                outVo.invertory_time_name = datareader["invertory_time_name"].ToString();
            }
            datareader.Close();
            return(outVo);
        }
Beispiel #3
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            InvertoryTimeVo inVo = (InvertoryTimeVo)vo;
            ValueObjectList <InvertoryTimeVo> voList = new ValueObjectList <InvertoryTimeVo>();
            StringBuilder sql = new StringBuilder();
            //CREATE SQL ADAPTER AND PARAMETER LIST
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("select invertory_time_id, invertory_time_cd, invertory_time_name from m_invertory_time where 1=1 ");
            if (!string.IsNullOrEmpty(inVo.invertory_time_cd))
            {
                sql.Append("and invertory_time_cd='").Append(inVo.invertory_time_cd).Append("' ");
            }
            if (!string.IsNullOrEmpty(inVo.invertory_time_name))
            {
                sql.Append("and invertory_time_name='").Append(inVo.invertory_time_name).Append("' ");
            }
            sql.Append("order by invertory_time_id");
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());
            sql.Clear();
            //EXECUTE READER FROM COMMAND
            IDataReader datareader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (datareader.Read())
            {
                InvertoryTimeVo outVo = new InvertoryTimeVo
                {
                    invertory_time_id   = (int)datareader["invertory_time_id"],
                    invertory_time_cd   = datareader["invertory_time_cd"].ToString(),
                    invertory_time_name = datareader["invertory_time_name"].ToString()
                };
                voList.add(outVo);
            }
            datareader.Close();
            return(voList);
        }