private void CounterCost() { InventoryTimeFAWHVo maxInvertory = (InventoryTimeFAWHVo)DefaultCbmInvoker.Invoke(new GetInventoryTimeMaxFAWHCbm(), new InventoryTimeFAWHVo()); 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; }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { InventoryTimeFAWHVo inVo = (InventoryTimeFAWHVo)vo; InventoryTimeFAWHVo outVo = new InventoryTimeFAWHVo(); 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); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { InventoryTimeFAWHVo inVo = (InventoryTimeFAWHVo)vo; ValueObjectList <InventoryTimeFAWHVo> voList = new ValueObjectList <InventoryTimeFAWHVo>(); 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()) { InventoryTimeFAWHVo outVo = new InventoryTimeFAWHVo { 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); }