private void cargar_datos_sub_centro_costo() { tools _tools = new tools(); SecureQueryString QueryStringSeguro; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro(), Request["data"]); Decimal ID_SUB_C = Convert.ToDecimal(QueryStringSeguro["subcc"]); Panel_FORMULARIO.Visible = true; Panel_CONTROL_REGISTRO.Visible = false; subCentroCosto _subCentroCosto = new subCentroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaSubCentro = _subCentroCosto.ObtenerSubCentrosDeCostoPorIdSubCosto(ID_SUB_C); DataRow filaSubCentro = tablaSubCentro.Rows[0]; Panel_ID_SUB_C.Visible = true; Panel_ID_SUB_C.Enabled = false; TextBox_ID_SUB_C.Text = filaSubCentro["ID_SUB_C"].ToString(); TextBox_NOM_SUB_C.Text = filaSubCentro["NOM_SUB_C"].ToString().Trim(); Panel_OcultarSubC.Visible = true; CheckBox_OcultarSubC.Checked = false; }
protected DataTable ConsultarInventario(String centroCostos, String subcentroCosto, String ciudad, String[] datos, DataRow fila) { String id_Ciudad; DataTable tablaentregas = new DataTable(); tablaentregas.Columns.Add("ID_PRODUCTO"); tablaentregas.Columns.Add("ID_LOTE"); tablaentregas.Columns.Add("CANTIDAD"); tablaentregas.Columns.Add("TALLA"); DataRow entrega = tablaentregas.NewRow(); if (!(centroCostos.Equals("0"))) { centroCosto _centroC = new centroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaCentro = _centroC.ObtenerCentrosDeCostoPorIdCentroCosto(Convert.ToDecimal(centroCostos)); DataRow filaCentros = tablaCentro.Rows[0]; id_Ciudad = filaCentros["ID_CIUDAD"].ToString(); } else if (!(subcentroCosto.Equals("0"))) { subCentroCosto _SubCentroC = new subCentroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaSub = _SubCentroC.ObtenerSubCentrosDeCostoPorIdSubCosto(Convert.ToDecimal(subcentroCosto)); DataRow filaSubCentro = tablaSub.Rows[0]; centroCosto _centroC = new centroCosto(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaCentro = _centroC.ObtenerCentrosDeCostoPorIdCentroCosto(Convert.ToDecimal(filaSubCentro["ID_CENTRO_C"].ToString())); DataRow filaCentros = tablaCentro.Rows[0]; id_Ciudad = filaCentros["ID_CIUDAD"].ToString(); } else { id_Ciudad = ciudad; } int id_empresa = Convert.ToInt32(datos[3].ToString()); ciudad _ciudad = new ciudad(Session["idEmpresa"].ToString()); DataTable tablaCiudad = _ciudad.ObtenerCiudadPorIdCiudad(id_Ciudad); DataRow filaCiudad = tablaCiudad.Rows[0]; String id_regional = filaCiudad["ID_REGIONAL"].ToString(); bodega _bodega = new bodega(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablabodega = _bodega.ObtenerAlmRegBodegaPorIds(id_regional, id_Ciudad, id_empresa); if (tablabodega.Rows.Count <= 0) { Label_MENSAJE.Text = "ADVERTENCIA: No se encontraron bodegas para la empresa en la ubicación seleccionada. Valide por favor."; configurarMensajes(true, System.Drawing.Color.Red, Label_MENSAJE, Panel_MENSAJES); } else { DataRow filaBodega = tablabodega.Rows[0]; lote _lote = new lote(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); HiddenField_idBodega.Value = filaBodega["ID_BODEGA"].ToString(); DataTable tablaLote = _lote.ObtenerAlmLotePorIdProductoBodega(Convert.ToInt32(fila["ID_PRODUCTO"]), Convert.ToInt32(filaBodega["ID_BODEGA"].ToString())); if (tablaLote.Rows.Count <= 0) { Label_MENSAJE.Text = "ADVERTENCIA: No hay existencias del producto " + fila["NOMBRE"].ToString() + " para la empresa seleccionada. Valide por favor."; configurarMensajes(true, System.Drawing.Color.Red, Label_MENSAJE, Panel_MENSAJES); } else { int contLote; foreach (DataRow filalotes in tablaLote.Rows) { entrega = tablaentregas.NewRow(); contLote = Convert.ToInt32(filalotes["ENTRADAS"]) - Convert.ToInt32(filalotes["SALIDAS"]); entrega[0] = filalotes["ID_PRODUCTO"]; entrega[1] = filalotes["ID_LOTE"]; entrega[2] = contLote; entrega[3] = filalotes["TALLA"]; tablaentregas.Rows.Add(entrega); } } } return(tablaentregas); }