private void ValidaTabladetallemovmov(String xrollo) { var rowrollo = Tabladetallemov.Select("rollo='" + xrollo + "'"); if (rowrollo.Length > 0) { MessageBox.Show("Rollo Ya Existe !!!!!!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Decimal xstocklibros = 0, xstockfisico = 0, xdiferencia = 0; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["productname"].Value = string.Empty; if (xrollo.Trim().Length == 10) { var BL2 = new tb_60local_stock_inventario_rollo_cargaBL(); var BE2 = new tb_60local_stock_inventario_rollo_carga(); var dt2 = new DataTable(); BE2.rollo = xrollo; dt2 = BL2.GetAll_rollo(EmpresaID, BE2).Tables[0]; if (dt2.Rows.Count > 0) { var Mensaje = "» ROLLO: " + dt2.Rows[0]["rollo"].ToString() + "\n\n" + " »» TipDoc: " + dt2.Rows[0]["tipodoc"].ToString() + "\n" + " »» SerDoc: " + dt2.Rows[0]["serdoc"].ToString() + "\n" + " »» NumDoc: " + dt2.Rows[0]["numdoc"].ToString(); MessageBox.Show(Mensaje, "» Rollos Existentes ..."); return; } var BE = new tb_60local_stock_inventario_rollo(); var BL = new tb_60local_stock_inventario_rolloBL(); var dt = new DataTable(); BE.rollo = xrollo; dt = BL.GetAll_Rollo(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["rollo"].Value = dt.Rows[0]["rollo"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["productid"].Value = dt.Rows[0]["productid"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["productname"].Value = dt.Rows[0]["productname"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["stocklibros"].Value = dt.Rows[0]["stocklibros"].ToString().Trim(); griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["stockfisico"].Value = dt.Rows[0]["stockfisico"].ToString().Trim(); xstocklibros = Convert.ToDecimal(dt.Rows[0]["stocklibros"].ToString()); xstockfisico = Convert.ToDecimal(dt.Rows[0]["stockfisico"].ToString()); xdiferencia = xstocklibros - xstockfisico; griddetallemov.Rows[griddetallemov.CurrentCell.RowIndex].Cells["diferencia"].Value = xdiferencia; Tabladetallemov.AcceptChanges(); griddetallemov.CurrentCell = griddetallemov.Rows[griddetallemov.RowCount - 1].Cells["stockfisico"]; } else { MessageBox.Show("Rollo no Existe en Tabla Inventario !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Rollo no Existe !!! ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Recibedetallemov(DataTable resultado) { if (resultado.Rows.Count > 0) { if (Tabladetallemov.Rows.Count > 0) { Tabladetallemov.Rows.Clear(); } foreach (DataRow fila in resultado.Rows) { var BL = new tb_60local_stock_inventario_rollo_cargaBL(); var BE = new tb_60local_stock_inventario_rollo_carga(); var dt = new DataTable(); BE.rollo = fila["rollo"].ToString(); dt = BL.GetAll_rollo(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { row = DataError.NewRow(); row["error"] = "» ROLLO: " + dt.Rows[0]["rollo"].ToString() + " --> " + dt.Rows[0]["tipodoc"].ToString() + " - " + dt.Rows[0]["serdoc"].ToString() + " - " + dt.Rows[0]["numdoc"].ToString(); DataError.Rows.Add(row); } else { row = Tabladetallemov.NewRow(); row["rollo"] = fila["rollo"].ToString(); row["productid"] = fila["productid"].ToString(); row["productname"] = fila["productname"].ToString(); row["stocklibros"] = fila["stocklibros"].ToString(); row["stockfisico"] = fila["stockfisico"].ToString(); row["diferencia"] = fila["diferencia"].ToString(); Tabladetallemov.Rows.Add(row); } } griddetallemov.DataSource = Tabladetallemov; calcular_totales(); } }