public String adicionarEntregasTemp(int idempleado, DateTime fecha, int idBodega, DataTable tablaConfigurados, String[] datos) { int NumerosEntregas = 0; Decimal idDocumento = 0; Decimal idOrdenEntrega = 0; Brainsbits.LLB.almacen.documento_temp _documento = new almacen.documento_temp(Empresa, Usuario); Inventario_temp _inventario = new Inventario_temp(Empresa, Usuario); Conexion _dato = new LDA.Conexion(Empresa); _dato.IniciarTransaccion(); #region validaciones idDocumento = _documento.AdicionarAlmDocumentosTemp(idempleado, "ENTREGA", "", fecha, Convert.ToDateTime("01/01/1900"), 0, "CONFIGURADO", "", _dato); if (idDocumento == 0) { _dato.DeshacerTransaccion(); MensajeError += "ADVERTENCIA: No fue posible crear el documento, por la siguiente razón \n" + _documento.MensajeError + " \ncomuniquese con el administrador"; } else { foreach (DataRow filaConf in tablaConfigurados.Rows) { int idproducto = Convert.ToInt32(filaConf["ID_PRODUCTO"]); int cantidad = Convert.ToInt32(filaConf["CANTIDAD"]); int idlote = Convert.ToInt32(filaConf["ID_LOTE"]); lote _lote = new lote(Empresa, Usuario); DataTable tablalo = _lote.ObtenerAlmLotePorId(idlote); DataRow filalo = tablalo.Rows[0]; Decimal costo = Convert.ToInt32(filalo["COSTO"]); String talla = filaConf["TALLA"].ToString(); Decimal idinventario = 0; idinventario = _inventario.AdicionarAlmInventarioTemp(Convert.ToInt32(idDocumento), idproducto, idBodega, idlote, 0, talla, cantidad, costo, fecha, "SALIDA", _dato); if (idinventario == 0) { _dato.DeshacerTransaccion(); MensajeError += "El registro de inventario no fue posible crearlo por: " + _inventario.MensajeError + " Valide con el Administrador"; } else { NumerosEntregas++; } } } if (NumerosEntregas == tablaConfigurados.Rows.Count) { _dato.AceptarTransaccion(); } else { _dato.DeshacerTransaccion(); NumerosEntregas = 0; } #endregion if (NumerosEntregas <= 0) { return(""); } return(idDocumento.ToString()); }
public String adicionarEntregasTemp(int idempleado, DateTime fecha, int idBodega, DataTable tablaConfigurados, String[] datos) { int NumerosEntregas = 0; Decimal idDocumento = 0; Decimal idOrdenEntrega = 0; Brainsbits.LLB.almacen.documento_temp _documento = new almacen.documento_temp(Empresa, Usuario); Inventario_temp _inventario = new Inventario_temp(Empresa, Usuario); Conexion _dato = new LDA.Conexion(Empresa); _dato.IniciarTransaccion(); #region validaciones idDocumento = _documento.AdicionarAlmDocumentosTemp(idempleado, "ENTREGA", "", fecha, Convert.ToDateTime("01/01/1900"), 0, "CONFIGURADO", "", _dato); if (idDocumento == 0) { _dato.DeshacerTransaccion(); MensajeError += "ADVERTENCIA: No fue posible crear el documento, por la siguiente razón \n" + _documento.MensajeError + " \ncomuniquese con el administrador"; } else { foreach (DataRow filaConf in tablaConfigurados.Rows) { int idproducto = Convert.ToInt32(filaConf["ID_PRODUCTO"]); int cantidad = Convert.ToInt32(filaConf["CANTIDAD"]); int idlote = Convert.ToInt32(filaConf["ID_LOTE"]); lote _lote = new lote(Empresa, Usuario); DataTable tablalo = _lote.ObtenerAlmLotePorId(idlote); DataRow filalo = tablalo.Rows[0]; Decimal costo = Convert.ToInt32(filalo["COSTO"]); String talla = filaConf["TALLA"].ToString(); Decimal idinventario = 0; idinventario = _inventario.AdicionarAlmInventarioTemp(Convert.ToInt32(idDocumento), idproducto, idBodega, idlote, 0, talla, cantidad, costo, fecha, "SALIDA", _dato); if (idinventario == 0) { _dato.DeshacerTransaccion(); MensajeError += "El registro de inventario no fue posible crearlo por: " + _inventario.MensajeError + " Valide con el Administrador"; } else { NumerosEntregas++; } } } if (NumerosEntregas == tablaConfigurados.Rows.Count) { _dato.AceptarTransaccion(); } else { _dato.DeshacerTransaccion(); NumerosEntregas = 0; } #endregion if (NumerosEntregas <= 0) return ""; return idDocumento.ToString(); }