public Boolean ActualizarConRegExamenesEmpleadoConArchivo(Decimal REGISTRO, Decimal ID_ORDEN, Decimal ID_EXAMEN, Decimal COSTO, String VALIDADO, DateTime FECHA_EXAMEN, byte[] ARCHIVO_EXAMEN, String ARCHIVO_EXTENSION, Decimal ARCHIVO_TAMANO, String ARCHIVO_TYPE, Conexion conexion) { String informacion = null; Boolean ejecutar = true; Int32 registro = 0; tools _tools = new tools(); String sql = "USP_CON_REG_EXAMENES_EMPLEADO_ACTUALIZAR "; #region validaciones if (REGISTRO != 0) { sql += REGISTRO + ", "; informacion += "REGISTRO = '" + REGISTRO.ToString() + "', "; } else { MensajeError += "El campo REGISTRO no puede ser nulo\n"; ejecutar = false; } if (ID_ORDEN != 0) { sql += ID_ORDEN + ", "; informacion += "ID_ORDEN = '" + ID_ORDEN.ToString() + "', "; } else { MensajeError += "El campo ID_ORDEN no puede ser nulo\n"; ejecutar = false; } if (ID_EXAMEN != 0) { sql += ID_EXAMEN + ", "; informacion += "ID_EXAMEN = '" + ID_EXAMEN.ToString() + "', "; } else { MensajeError += "El campo ID_EXAMEN no puede ser nulo\n"; ejecutar = false; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO = '" + COSTO.ToString() + "', "; } else { sql += "0, "; informacion += "COSTO = '0', "; } if (!(String.IsNullOrEmpty(VALIDADO))) { sql += "'" + VALIDADO + "', "; informacion += "VALIDADO = '" + VALIDADO.ToString() + "', "; } else { sql += "'N', "; informacion += "VALIDADO = 'N', "; } if (!(String.IsNullOrEmpty(FECHA_EXAMEN.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EXAMEN) + "', "; informacion += "FECHA_EXAMEN = '" + FECHA_EXAMEN.ToString() + "', "; } sql += "'" + Usuario + "' "; informacion += "USU_MOD = '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { try { registro = conexion.ExecuteNonQueryParaActualizarConRegExamenesEmpleadoConArchivo(REGISTRO, ID_ORDEN, ID_EXAMEN, COSTO, VALIDADO, FECHA_EXAMEN, Usuario, ARCHIVO_EXAMEN, ARCHIVO_EXTENSION, ARCHIVO_TAMANO, ARCHIVO_TYPE); if (registro == 0) { return false; } else { #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria return true; } } catch (Exception e) { MensajeError = e.Message; return false; } } else { return false; } }
public Boolean ActualizarNomEmpleados(int ID_EMPLEADO, int ID_CONTRATO, int ID_SOLICITUD, int ID_EMPRESA, int ID_CENTRO_C, int ID_SUB_C, DateTime FCH_INGRESO, Decimal SALARIO, String PENSIONADO, String ACTIVO, String LIQUIDADO, Decimal RIESGO, int ID_ARP, int ID_CAJA_C, int ID_EPS, int ID_F_PENSIONES, String TIP_PAGO, int ID_ENTIDAD, String NUM_CUENTA, String SAL_INT, String ID_CIUDAD, int ID_PERFIL, string formaPago, Conexion conexion) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_nom_empleados_actualizar "; #region validaciones if (ID_EMPLEADO != 0) { sql += ID_EMPLEADO + ", "; informacion += "ID_EMPLEADO = '" + ID_EMPLEADO.ToString() + "', "; } else { MensajeError += "El campo ID_EMPLEADO no puede ser nulo\n"; ejecutar = false; } if (ID_CONTRATO != 0) { sql += ID_CONTRATO + ", "; informacion += "ID_CONTRATO = '" + ID_CONTRATO.ToString() + "', "; } else { sql += "0, "; informacion += "ID_CONTRATO = '0', "; } if (ID_SOLICITUD != 0) { sql += ID_SOLICITUD + ", "; informacion += "ID_SOLICITUD = '" + ID_SOLICITUD.ToString() + "', "; } else { MensajeError += "El campo ID_SOLICITUD no puede ser nulo\n"; ejecutar = false; } if (ID_EMPRESA != 0) { sql += ID_EMPRESA + ", "; informacion += "ID_EMPRESA = '" + ID_EMPRESA.ToString() + "', "; } else { MensajeError += "El campo ID_EMPRESA no puede ser nulo\n"; ejecutar = false; } if (ID_CENTRO_C != 0) { sql += ID_CENTRO_C + ", "; informacion += "ID_CENTRO_C = '" + ID_CENTRO_C.ToString() + "', "; } else { sql += ID_CENTRO_C + ", "; informacion += "ID_CENTRO_C = '" + ID_CENTRO_C.ToString() + "', "; } if (ID_SUB_C != 0) { sql += ID_SUB_C + ", "; informacion += "ID_SUB_C= '" + ID_SUB_C.ToString() + "', "; } else { sql += ID_SUB_C + ", "; informacion += "ID_SUB_C= '" + ID_SUB_C.ToString() + "', "; } if (!(String.IsNullOrEmpty(FCH_INGRESO.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_INGRESO) + "', "; informacion += "FCH_INGRESO= '" + FCH_INGRESO.ToString() + "', "; } else { MensajeError += "El campo FCH_INGRESO no puede ser nulo\n"; ejecutar = false; } if (SALARIO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(SALARIO) + ", "; informacion += "SALARIO= '" + SALARIO.ToString() + "', "; } else { MensajeError += "El campo SALARIO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(PENSIONADO.ToString()))) { sql += "'" + PENSIONADO + "', "; informacion += "PENSIONADO= '" + PENSIONADO.ToString() + "', "; } else { MensajeError += "El campo PENSIONADO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(ACTIVO.ToString()))) { sql += "'" + ACTIVO + "', "; informacion += "ACTIVO = '" + ACTIVO.ToString() + "', "; } else { MensajeError += "El campo ACTIVO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(LIQUIDADO.ToString()))) { sql += "'" + LIQUIDADO + "', "; informacion += "LIQUIDADO = '" + LIQUIDADO.ToString() + "', "; } else { MensajeError += "El campo LIQUIDADO no puede ser nulo\n"; ejecutar = false; } if (RIESGO != 0) { sql += RIESGO + ", "; informacion += "RIESGO= '" + RIESGO.ToString() + "', "; } else { MensajeError += "El campo RIESGO no puede ser nulo\n"; ejecutar = false; } if (ID_ARP != 0) { sql += ID_ARP + ", "; informacion += "ID_ARP = '" + ID_ARP.ToString() + "', "; } else { sql += "0, "; informacion += "ID_ARP = '0', "; } if (ID_CAJA_C != 0) { sql += ID_CAJA_C + ", "; informacion += "ID_CAJA_C = '" + ID_CAJA_C.ToString() + "', "; } else { sql += "0, "; informacion += "ID_CAJA_C = 0, "; } if (ID_EPS != 0) { sql += ID_EPS + ", "; informacion += "ID_EPS = '" + ID_EPS.ToString() + "', "; } else { MensajeError += "El campo ID_EPS no puede ser nulo\n"; ejecutar = false; } if (ID_F_PENSIONES != 0) { sql += ID_F_PENSIONES + ", "; informacion += "ID_F_PENSIONES = '" + ID_F_PENSIONES.ToString() + "', "; } else { sql += "0, "; informacion += "ID_F_PENSIONES = 0, "; } if (!(String.IsNullOrEmpty(TIP_PAGO))) { sql += "'" + TIP_PAGO + "', "; informacion += "TIP_PAGO = '" + TIP_PAGO.ToString() + "', "; } else { sql += "null, "; informacion += "TIP_PAGO = ' ', "; } if (ID_ENTIDAD != 0) { sql += ID_ENTIDAD + ", "; informacion += "ID_ENTIDAD = '" + ID_ENTIDAD.ToString() + "', "; } else { sql += "0, "; informacion += "ID_ENTIDAD = 0, "; } if (!(String.IsNullOrEmpty(NUM_CUENTA))) { sql += "'" + NUM_CUENTA + "', "; informacion += "NUM_CUENTA = '" + NUM_CUENTA.ToString() + "', "; } else { sql += "null, "; informacion += "NUM_CUENTA = 'null', "; } if (!(String.IsNullOrEmpty(SAL_INT))) { sql += "'" + SAL_INT + "', "; informacion += "SAL_INT = '" + SAL_INT.ToString() + "', "; } else { MensajeError += "El campo SAL_INT no puede ser nulo\n"; ejecutar = false; } sql += "'" + NombreUsuario + "', "; informacion += "USU_MOD = '" + NombreUsuario + "', "; if (!(String.IsNullOrEmpty(ID_CIUDAD))) { sql += "'" + ID_CIUDAD + "', "; informacion += "ID_CIUDAD = '" + ID_CIUDAD.ToString() + "', "; } else { sql += "Null,"; informacion += "ID_CIUDAD = 'null', "; } if (ID_PERFIL != 0) { sql += ID_PERFIL + ", "; informacion += "ID_PERFIL = '" + ID_PERFIL.ToString() + "', "; } else { MensajeError += "El campo ID_PERFIL no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(formaPago))) { sql += "'" + formaPago + "'"; informacion += "FORMA_PAGO = '" + formaPago.ToString() + "'"; } else { sql += "NULL"; informacion += "FORMA_PAGO = 'null'"; } #endregion validaciones if (ejecutar) { try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(NombreUsuario, tabla.NOM_CONCEPTOS_EMPLEADO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Decimal Adicionar(Decimal ID_EMPLEADO, Int32 ID_CONCEPTO, Int32 ID_PERIODO, Decimal CANTIDAD, Decimal VALOR, String ORIGEN, String ESTADO, DateTime FECHA, Conexion conexion) { Decimal id = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_nom_nomina_novedades_adicionar "; #region validaciones if (ID_EMPLEADO != 0) { sql += "'" + ID_EMPLEADO.ToString() + "', "; informacion += "ID_EMPLEADO= '" + ID_EMPLEADO.ToString() + ", "; } else { MensajeError = "El campo ID_EMPLEADO es requerido para la consulta."; ejecutar = false; } if (ID_CONCEPTO != 0) { sql += "'" + ID_CONCEPTO.ToString() + "', "; informacion += "ID_CONCEPTO= '" + ID_CONCEPTO.ToString() + ", "; } else { MensajeError = "El campo ID_CONCEPTO es requerido para la consulta."; ejecutar = false; } if (ID_PERIODO != 0) { sql += "'" + ID_PERIODO.ToString() + "', "; informacion += "ID_PERIODO= '" + ID_PERIODO.ToString() + ", "; } else { MensajeError = "El campo ID_PERIODO es requerido para la consulta."; ejecutar = false; } sql += "'" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(CANTIDAD).ToString() + "', "; informacion += "CANTIDAD= '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(CANTIDAD).ToString() + ", "; sql += "'" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR).ToString() + "', "; informacion += "VALOR= '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR).ToString() + ", "; if (!(String.IsNullOrEmpty(ORIGEN))) { sql += "'" + ORIGEN + "', "; informacion += "ORIGEN = '" + ORIGEN.ToString() + "', "; } else { MensajeError += "El campo ORIGEN no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(ESTADO))) { sql += "'" + ESTADO + "', "; informacion += "ESTADO = '" + ESTADO.ToString() + "', "; } else { MensajeError += "El campo ESTADO no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "' "; informacion += "USU_CRE = '" + Usuario.ToString() + "'"; #endregion if (ejecutar) { try { id = Convert.ToDecimal(conexion.ExecuteScalar(sql)); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.NOM_NOMINA_NOVEDADES, tabla.ACCION_ELIMINAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; id = 0; } } return id; }
public Boolean ActualizarConRegContratosAuditoria(Decimal REGISTRO, String TIPO_CONTRATO, String PAGO_DIAS_PRODUCTIVIDAD, Decimal VALOR_NOMINA, Decimal VALOR_CONTRATO, DateTime FECHA_INICIO_PERIODO, DateTime FECHA_FIN_PERIODO, String PERIODO_PAGO, String CLASE_CONTRATO, String CONTROL_CONTRATO, Conexion conexion) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_con_reg_contratos_actualizar_auditoria_v3 "; #region validaciones if (REGISTRO != 0) { sql += REGISTRO + ", "; informacion += "REGISTRO = '" + REGISTRO.ToString() + "', "; } else { MensajeError += "El campo REGISTRO no puede ser nulo\n"; ejecutar = false; } if (String.IsNullOrEmpty(TIPO_CONTRATO) == false) { sql += "'" + TIPO_CONTRATO + "', "; informacion += "TIPO_CONTRATO = '" + TIPO_CONTRATO + "', "; } else { MensajeError += "El campo TIPO_CONTRATO no puede ser nulo\n"; ejecutar = false; } if (String.IsNullOrEmpty(PAGO_DIAS_PRODUCTIVIDAD) == false) { sql += "'" + PAGO_DIAS_PRODUCTIVIDAD + "', "; informacion += "PAGO_DIAS_PRODUCTIVIDAD = '" + PAGO_DIAS_PRODUCTIVIDAD + "', "; } else { MensajeError += "El campo PAGO_DIAS_PRODUCTIVIDAD no puede ser nulo\n"; ejecutar = false; } if (VALOR_NOMINA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_NOMINA) + ", "; informacion += "VALOR_NOMINA = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_NOMINA) + "', "; } else { sql += "NULL, "; informacion += "VALOR_NOMINA = 'NULL', "; } if (VALOR_CONTRATO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_CONTRATO) + ", "; informacion += "VALOR_CONTRATO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_CONTRATO) + "', "; } else { sql += "NULL, "; informacion += "VALOR_CONTRATO = 'NULL', "; } if (!string.IsNullOrEmpty(FECHA_INICIO_PERIODO.ToString())) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIO_PERIODO) + "', "; informacion += "FECHA_INICIO_PERIODO = '" + FECHA_INICIO_PERIODO.ToString() + "', "; } else { sql += "NULL, "; informacion += "FECHA_INICIO_PERIODO = 'NULL', "; } if (!string.IsNullOrEmpty(FECHA_FIN_PERIODO.ToString())) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_FIN_PERIODO) + "', "; informacion += "FECHA_FIN_PERIODO = '" + FECHA_FIN_PERIODO.ToString() + "', "; } else { sql += "NULL, "; informacion += "FECHA_FIN_PERIODO = 'NULL', "; } sql += "'" + Usuario + "', "; informacion += "USU_MOD = '" + Usuario.ToString() + "', "; if (String.IsNullOrEmpty(PERIODO_PAGO) == false) { sql += "'" + PERIODO_PAGO + "', "; informacion += "PERIODO_PAGO = '" + PERIODO_PAGO.ToString() + "', "; } else { MensajeError += "El campo PERIODO_PAGO no puede ser nulo\n"; ejecutar = false; } if (String.IsNullOrEmpty(CLASE_CONTRATO) == false) { sql += "'" + CLASE_CONTRATO + "', "; informacion += "CLASE_CONTRATO = '" + CLASE_CONTRATO + "', "; } else { MensajeError += "El campo CLASE_CONTRATO no puede ser nulo\n"; ejecutar = false; } if (String.IsNullOrEmpty(CONTROL_CONTRATO) == false) { sql += "'" + CONTROL_CONTRATO + "'"; informacion += "CONTROL_CONTRATO = '" + CONTROL_CONTRATO + "'"; } else { MensajeError += "El campo CONTROL_CONTRATO no puede ser nulo\n"; ejecutar = false; } #endregion validaciones if (ejecutar) { try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_CONTRATOS, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Decimal AdicionarInvDetalleCierre(int ID_CIERRE, int ID_PRODUCTO, int CANTIDAD_INVENTARIO, int CANTIDAD_FISICA, int ID_BODEGA, String TALLA, Decimal COSTO_PROMEDIO, String ESTADO, Conexion conexion) { String sql = null; String identificador = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_INV_DETALLE_CIERRE_ADICIONAR "; #region validaciones if (ID_CIERRE != 0) { sql += ID_CIERRE + ", "; informacion += "ID_CIERRE= '" + ID_CIERRE.ToString() + "', "; } else { MensajeError += "El campo ID_CIERRE no puede ser nulo\n"; ejecutar = false; } if (ID_PRODUCTO != 0) { sql += ID_PRODUCTO + ", "; informacion += "ID_PRODUCTO= '" + ID_PRODUCTO.ToString() + "', "; } else { MensajeError += "El campo ID_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (CANTIDAD_INVENTARIO != 0) { sql += CANTIDAD_INVENTARIO + ", "; informacion += "CANTIDAD_INVENTARIO= '" + CANTIDAD_INVENTARIO.ToString() + "', "; } else { MensajeError += "El campo CANTIDAD_INVENTARIO no puede ser nulo\n"; ejecutar = false; } if (CANTIDAD_FISICA != 0) { sql += CANTIDAD_FISICA + ", "; informacion += "CANTIDAD_FISICA= '" + CANTIDAD_FISICA.ToString() + "', "; } else { sql += "0, "; informacion += "CANTIDAD_FISICA= '0', "; } if (ID_BODEGA != 0) { sql += ID_BODEGA + ", "; informacion += "ID_BODEGA= '" + ID_BODEGA.ToString() + "', "; } else { MensajeError += "El campo ID_BODEGA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(TALLA))) { sql += "'" + TALLA + "', "; informacion += "TALLA= '" + TALLA.ToString() + "', "; } else { sql += "'" + TALLA + "', "; informacion += "TALLA= '" + TALLA.ToString() + "', "; } if (COSTO_PROMEDIO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO_PROMEDIO) + ", "; informacion += "COSTO_PROMEDIO = '" + COSTO_PROMEDIO.ToString() + "', "; } else { MensajeError += "El campo COSTO_PROMEDIO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(ESTADO))) { sql += "'" + ESTADO + "', "; informacion += "ESTADO= '" + ESTADO.ToString() + "', "; } else { sql += "'" + ESTADO + "', "; informacion += "ESTADO= '" + ESTADO.ToString() + "', "; } sql += "'" + Usuario + "' "; informacion += "USU_CRE= '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { try { identificador = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.INV_DETALLE_CIERRE, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador); else return 0; }
public Decimal AdicionarDetalleOrdenCompra(Decimal ID_ORDEN_COMPRA, Decimal ID_PRODUCTO_PARAM, String REFERENCIA_PRODUCTO_PARAM, String TALLA_PARAM, String DESCRIPCION_PARAM, int CANTIDAD_PARAM, Decimal VALOR_UNITARIO_PARAM, Decimal VALOR_TOTAL_PARAM, Decimal DESCUENTO_PARAM, Decimal IVA_APLICADO_PARAM, Conexion conexion) { String sql = null; String identificador = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_ALM_DETALLE_ORDEN_ADICIONAR "; #region validaciones if (ID_ORDEN_COMPRA != 0) { sql += ID_ORDEN_COMPRA + ", "; informacion += "ID_ORDEN_COMPRA = '" + ID_ORDEN_COMPRA + "', "; } else { MensajeError += "El campo ID_ORDEN_COMPRA no puede ser nulo\n"; ejecutar = false; } if (ID_PRODUCTO_PARAM != 0) { sql += ID_PRODUCTO_PARAM + ", "; informacion += "ID_PRODUCTO = '" + ID_PRODUCTO_PARAM + "', "; } else { MensajeError += "El campo ID_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(REFERENCIA_PRODUCTO_PARAM))) { sql += "'" + REFERENCIA_PRODUCTO_PARAM + "', "; informacion += "REFERENCIA_PRODUCTO = '" + REFERENCIA_PRODUCTO_PARAM + "', "; } else { MensajeError += "El campo REFERENCIA_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(TALLA_PARAM))) { if (TALLA_PARAM == "N/A") { sql += "'N/A', "; informacion += "TALLA = 'N/A', "; } else { sql += "'" + TALLA_PARAM + "', "; informacion += "TALLA = '" + TALLA_PARAM + "', "; } } else { sql += "'N/A', "; informacion += "TALLA = 'N/A', "; } if (!(String.IsNullOrEmpty(DESCRIPCION_PARAM))) { sql += "'" + DESCRIPCION_PARAM + "', "; informacion += "DESCRIPCION_PARAM = '" + DESCRIPCION_PARAM + "', "; } else { MensajeError += "El campo DESCRIPCION_PARAM no puede ser nulo\n"; ejecutar = false; } sql += CANTIDAD_PARAM + ", "; informacion += "CANTIDAD = '" + CANTIDAD_PARAM + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_UNITARIO_PARAM) + ", "; informacion += "VALOR_UNITARIO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_UNITARIO_PARAM) + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_TOTAL_PARAM) + ", "; informacion += "VALOR_TOTAL = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_TOTAL_PARAM) + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(DESCUENTO_PARAM) + ", "; informacion += "DESCUENTO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(DESCUENTO_PARAM) + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA_APLICADO_PARAM) + ", "; informacion += "IVA_APLICADO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA_APLICADO_PARAM) + "', "; sql += "'" + Usuario + "' "; informacion += "USU_CRE = '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { try { identificador = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_DETALLE_ORDEN, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador); else return 0; }
public Boolean ActualizarAlmLote(int ID_LOTE, int ID_DOCUMENTO, int ID_PRODUCTO, int ID_BODEGA, DateTime FECHA_REGISTRO, int ENTRADAS, int SALIDAS, Decimal COSTO, String TALLA, String ACTIVO, Conexion conexion) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_ALM_LOTE_ACTUALIZAR "; #region validaciones if (ID_LOTE != 0) { sql += ID_LOTE + ", "; informacion += "ID_LOTE= '" + ID_LOTE.ToString() + "', "; } else { MensajeError += "El campo ID_LOTE no puede ser nulo\n"; ejecutar = false; } if (ID_DOCUMENTO != 0) { sql += ID_DOCUMENTO + ", "; informacion += "ID_DOCUMENTO= '" + ID_DOCUMENTO.ToString() + "', "; } else { MensajeError += "El campo ID_DOCUMENTO no puede ser nulo\n"; ejecutar = false; } if (ID_PRODUCTO != 0) { sql += ID_PRODUCTO + ", "; informacion += "ID_PRODUCTO= '" + ID_PRODUCTO.ToString() + "', "; } else { MensajeError += "El campo ID_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (ID_BODEGA != 0) { sql += ID_BODEGA + ", "; informacion += "ID_BODEGA= '" + ID_BODEGA.ToString() + "', "; } else { MensajeError += "El campo ID_BODEGA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(FECHA_REGISTRO.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_REGISTRO) + "', "; informacion += "FECHA_REGISTRO= '" + FECHA_REGISTRO.ToString() + "', "; } else { MensajeError += "El campo FECHA_REGISTRO no puede ser nulo\n"; ejecutar = false; } if (ENTRADAS != 0) { sql += ENTRADAS + ", "; informacion += "ENTRADAS= '" + ENTRADAS.ToString() + "', "; } else { MensajeError += "El campo ENTRADAS no puede ser nulo\n"; ejecutar = false; } if (SALIDAS != 0) { sql += SALIDAS + ", "; informacion += "SALIDAS= '" + SALIDAS.ToString() + "', "; } else { sql += "0, "; informacion += "SALIDAS= '0', "; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO= '" + COSTO.ToString() + "', "; } else { MensajeError += "El campo COSTO no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "', "; informacion += "USU_MOD= '" + Usuario.ToString() + "', "; if (!(String.IsNullOrEmpty(TALLA))) { sql += "'" + TALLA + "', "; informacion += "TALLA= '" + TALLA.ToString() + "', "; } else { sql += "'N/A', "; informacion += "TALLA= 'N/A', "; } if (!(String.IsNullOrEmpty(ACTIVO))) { sql += "'" + ACTIVO + "' "; informacion += "ACTIVO= '" + ACTIVO + "' "; } else { sql += "'S' "; informacion += "ACTIVO = 'S' "; } #endregion validaciones if (ejecutar) { try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_LOTE, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
private void Adicionar(Conexion Datos) { tools Tools = new tools(); string sql = null; sql = "usp_lps_adicionar "; sql += IdEmpleado.ToString(); sql += ", '" + TipoLps + "'"; sql += ", " + IdPeriodo.ToString(); sql += ", '" + Tools.obtenerStringConFormatoFechaSQLServer(FechaLiquidacion) + "'"; sql += ", " + DiasVinculacion.ToString(); sql += ", " + PeriodoContableCesantias.ToString(); sql += ", " + PeriodoContablePrima.ToString(); sql += ", " + PeriodoContablePrima.ToString(); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(AcumuladoCesantias); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(AcumuladoPrima); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(AcumuladoVacaciones); sql += ", " + DiasLiquidacionCesantias.ToString(); sql += ", " + DiasLiquidacionPrima.ToString(); sql += ", " + DiasLiquidacionVacaciones.ToString(); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(BaseCesantias); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(BasePrima); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(BaseVacaciones); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(LiquidacionCesantias); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(LiquidacionInteresesCesantias); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(LiquidacionPrima); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(LiquidacionVacaciones); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalLiquidacion); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalDevengadoMemo); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalDeducidoMemo); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(NetoLiquidacion); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalAnticipos); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalCreditos); sql += ", " + Tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalPagar); sql += ", '" + Usuario + "'"; sql += ", '" + Estado + "'"; sql += ", " + NoLaboro; IdLpsEmpleado = Convert.ToInt32(Datos.ExecuteScalar(sql)); }
public Boolean Actualizar(int ID_PAR_INCAPACIDADES, String CLASE_INCAPACIDAD, Decimal ID_CONCEPTO, Decimal ID_CONCEPTO_TRES_DIAS, Decimal PORCENTAJE) { String sql = null; String informacion = null; Boolean ejecutar = true; Boolean ejecutadoCorrectamente = true; sql = "usp_par_incapacidades_actualizar "; #region validaciones if (ID_PAR_INCAPACIDADES != 0) { sql += ID_PAR_INCAPACIDADES + ", "; informacion += "ID_PAR_INCAPACIDADES = " + ID_PAR_INCAPACIDADES + ", "; } else { MensajeError += "El campo ID_PAR_INCAPACIDADES no puede ser 0\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(CLASE_INCAPACIDAD))) { sql += "'" + CLASE_INCAPACIDAD + "', "; informacion += "CLASE_INCAPACIDAD = '" + CLASE_INCAPACIDAD + "', "; } else { MensajeError += "El campo CLASE_INCAPACIDAD no puede ser nulo\n"; ejecutar = false; } if (ID_CONCEPTO != 0) { sql += "'" + ID_CONCEPTO + "', "; informacion += "ID_CONCEPTO = '" + ID_CONCEPTO + "', "; } else { MensajeError += "El campo ID_CONCEPTO no puede ser cero\n"; ejecutar = false; } if (ID_CONCEPTO_TRES_DIAS != 0) { sql += "'" + ID_CONCEPTO_TRES_DIAS + "', "; informacion += "ID_CONCEPTO_TRES_DIAS = '" + ID_CONCEPTO_TRES_DIAS + "', "; } else { MensajeError += "El campo ID_CONCEPTO_TRES_DIAS no puede ser cero\n"; ejecutar = false; } tools _tools = new tools(); if (PORCENTAJE != 0) { sql += "'" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(PORCENTAJE) + "', "; informacion += "PORCENTAJE = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(PORCENTAJE) + "', "; } else { MensajeError += "El campo PORCENTAJE no puede ser cero\n"; ejecutar = false; } sql += "'" + Usuario + "' "; informacion += "USU_CRE = '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { #region actualizar if (conexion.ExecuteNonQuery(sql) == 0) ejecutadoCorrectamente = false; #endregion actualizar #region auditoria auditoria _auditoria = new auditoria(Empresa); if (!(_auditoria.Adicionar(Usuario, tabla.PAR_INCAPACIDADES, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion))) ejecutadoCorrectamente = false; #endregion auditoria conexion.AceptarTransaccion(); } catch (Exception e) { conexion.DeshacerTransaccion(); MensajeError = e.Message; ejecutadoCorrectamente = false; } finally { conexion.Desconectar(); } } else ejecutadoCorrectamente = false; if (ejecutadoCorrectamente) return true; else return false; }
public Decimal AdicionarAlmLote(int ID_DOCUMENTO, int ID_PRODUCTO, int ID_BODEGA, DateTime FECHA_REGISTRO, int ENTRADAS, int SALIDAS, Decimal COSTO, String TALLA, String ACTIVO, Conexion conexion, String REEMBOLSO) { String sql = null; String identificador = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_ALM_LOTE_ADICIONAR "; #region validaciones if (ID_DOCUMENTO != 0) { sql += ID_DOCUMENTO + ", "; informacion += "ID_DOCUMENTO = '" + ID_DOCUMENTO.ToString() + "', "; } else { MensajeError += "El campo ID_DOCUMENTO no puede ser nulo\n"; ejecutar = false; } if (ID_PRODUCTO != 0) { sql += ID_PRODUCTO + ", "; informacion += "ID_PRODUCTO= '" + ID_PRODUCTO.ToString() + "', "; } else { MensajeError += "El campo ID_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (ID_BODEGA != 0) { sql += ID_BODEGA + ", "; informacion += "ID_BODEGA= '" + ID_BODEGA.ToString() + "', "; } else { MensajeError += "El campo ID_BODEGA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(FECHA_REGISTRO.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_REGISTRO) + "', "; informacion += "FECHA_REGISTRO = '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_REGISTRO) + "', "; } else { MensajeError += "El campo FECHA_REGISTRO no puede ser nulo\n"; ejecutar = false; } if (ENTRADAS != 0) { sql += ENTRADAS + ", "; informacion += "ENTRADAS = '" + ENTRADAS.ToString() + "', "; } else { sql += "0, "; informacion += "ENTRADAS = '0', "; } if (SALIDAS != 0) { sql += SALIDAS + ", "; informacion += "SALIDAS = '" + SALIDAS.ToString() + "', "; } else { sql += "0, "; informacion += "SALIDAS = '0', "; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + "', "; } else { MensajeError += "El campo COSTO no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "', "; informacion += "USU_CRE = '" + Usuario.ToString() + "', "; if (!(String.IsNullOrEmpty(TALLA))) { if ((TALLA == "N/A") || (TALLA == "NA")) { sql += "'N/A', "; informacion += "TALLA= 'N/A', "; } else { sql += "'" + TALLA + "', "; informacion += "TALLA = '" + TALLA.ToString() + "', "; } } else { sql += "'N/A', "; informacion += "TALLA= 'N/A', "; } if (!(String.IsNullOrEmpty(ACTIVO))) { sql += "'" + ACTIVO + "', "; informacion += "ACTIVO= '" + ACTIVO + "', "; } else { sql += "'S', "; informacion += "ACTIVO = 'S', "; } if (String.IsNullOrEmpty(REEMBOLSO) == false) { sql += "'" + REEMBOLSO + "'"; } else { ejecutar = false; MensajeError = "El campo REEMBOLSO no puede ser vacio."; } #endregion validaciones if (ejecutar) { try { identificador = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_LOTE, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador); else return 0; }
public Decimal AdicionarNomConceptosEmpleados(int ID_EMPLEADO, int ID_CONCEPTO, int CAN_PRE, Decimal VAL_PRE, String LIQ_Q_1, String LIQ_Q_2) { String sql = null; String identificador = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_nom_conceptos_empleados_adicionar "; if (ID_EMPLEADO != 0) { sql += ID_EMPLEADO + ", "; informacion += "ID_EMPLEADO = '" + ID_EMPLEADO.ToString() + "', "; } else { MensajeError += "El campo ID_EMPLEADO no puede ser nulo\n"; ejecutar = false; } if (ID_CONCEPTO != 0) { sql += ID_CONCEPTO + ", "; informacion += "ID_CONCEPTO = '" + ID_CONCEPTO.ToString() + "', "; } else { MensajeError += "El campo ID_CONCEPTO no puede ser nulo\n"; ejecutar = false; } if (CAN_PRE != 0) { sql += CAN_PRE + ", "; informacion += "CAN_PRE = '" + CAN_PRE.ToString() + "', "; } else { MensajeError += "El campo CAN_PRE no puede ser nulo\n"; ejecutar = false; } if (VAL_PRE != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VAL_PRE) + ", "; informacion += "VAL_PRE = '" + VAL_PRE.ToString() + "', "; } else { MensajeError += "El campo VAL_PRE no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(LIQ_Q_1))) { sql += "'" + LIQ_Q_1 + "', "; informacion += "LIQ_Q_1= '" + LIQ_Q_1.ToString() + "', "; } else { MensajeError += "El campo LIQ_Q_1 no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(LIQ_Q_2))) { sql += "'" + LIQ_Q_2 + "', "; informacion += "LIQ_Q_2= '" + LIQ_Q_2.ToString() + "', "; } else { MensajeError += "El campo LIQ_Q_2 no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "' "; informacion += "USU_CRE= '" + Usuario.ToString() + "' "; if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { identificador = conexion.ExecuteScalar(sql); auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.NOM_CONCEPTOS_EMPLEADO, tabla.ACCION_ADICIONAR, sql, informacion, conexion); } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador); else return 0; }
public Boolean ActualizarNomConceptosEmpleados(int REGISTRO, int ID_EMPLEADO, int ID_CONCEPTO, int CAN_PRE, Decimal VAL_PRE, String LIQ_Q_1, String LIQ_Q_2) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_nom_conceptos_empleados_actualizar "; if (REGISTRO != 0) { sql += REGISTRO + ", "; informacion += "REGISTRO= '" + REGISTRO.ToString() + "', "; } else { MensajeError += "El campo REGISTRO no puede ser nulo\n"; ejecutar = false; } if (ID_EMPLEADO != 0) { sql += ID_EMPLEADO + ", "; informacion += "ID_EMPLEADO = '" + ID_EMPLEADO.ToString() + "', "; } else { MensajeError += "El campo ID_EMPLEADO no puede ser nulo\n"; ejecutar = false; } if (ID_CONCEPTO != 0) { sql += ID_CONCEPTO + ", "; informacion += "ID_CONCEPTO = '" + ID_CONCEPTO.ToString() + "', "; } else { MensajeError += "El campo ID_CONCEPTO no puede ser nulo\n"; ejecutar = false; } if (CAN_PRE != 0) { sql += CAN_PRE + ", "; informacion += "CAN_PRE = '" + CAN_PRE.ToString() + "', "; } else { MensajeError += "El campo CAN_PRE no puede ser nulo\n"; ejecutar = false; } if (VAL_PRE != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VAL_PRE) + ", "; informacion += "VAL_PRE = '" + VAL_PRE.ToString() + "', "; } else { MensajeError += "El campo VAL_PRE no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(LIQ_Q_1))) { sql += "'" + LIQ_Q_1 + "', "; informacion += "LIQ_Q_1= '" + LIQ_Q_1.ToString() + "', "; } else { MensajeError += "El campo LIQ_Q_1 no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(LIQ_Q_2))) { sql += "'" + LIQ_Q_2 + "', "; informacion += "LIQ_Q_2= '" + LIQ_Q_2.ToString() + "', "; } else { MensajeError += "El campo LIQ_Q_2 no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "' "; informacion += "USU_MOD = '" + Usuario.ToString() + "' "; if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.NOM_CONCEPTOS_EMPLEADO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Decimal Adicionar(Decimal ID_EMPRESA, String FACTURA, String REGIMEN, String SOLO_DEV, String VAC_PARAF, int DIAS_VNC, Decimal AD_NOM, Decimal AD_PENSION, Decimal AD_SALUD, Decimal AD_RIESGOS, Decimal AD_APO_SENA, Decimal AD_APO_ICBF, Decimal AD_APO_CAJA, Decimal AD_VACACIONES, Decimal AD_CESANTIA, Decimal AD_INT_CES, Decimal AD_PRIMA, Decimal AD_SEG_VID, String SUB_PENSION, String SUB_SALUD, String SUB_RIESGOS, String SUB_SENA, String SUB_ICBF, String SUB_CAJA, String SUB_VACACIONES, String SUB_CESANTIAS, String SUB_INT_CES, String SUB_PRIMA, String SUB_SEG_VID, String MOD_SOPORTE, String MOD_FACTURA, String OBS_FACT, String RET_VAC, String RET_CES, String RET_INT_CES, String RET_PRIM, String USU_CRE, String APL_MTZ, String ID_CIUDAD, Decimal ID_CENTRO_C, Decimal ID_SUB_C, List<servicio> SERVICIO, List<detalleServicio> DETALLE_SERVICIO) { String registro = null; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_ven_p_facturacion_adicionar "; #region validaciones if (ID_EMPRESA != 0) { sql += ID_EMPRESA + ", "; informacion += "ID_EMPRESA = " + ID_EMPRESA.ToString() + ", "; } else { MensajeError = "El campo ID EMPRESA no puede ser 0\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(FACTURA))) { sql += "'" + FACTURA + "', "; informacion += "FACTURA = '" + FACTURA.ToString() + "', "; } else { MensajeError += "El campo FACTURA NOMINA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(REGIMEN))) { sql += "'" + REGIMEN + "', "; informacion += "REGIMEN = '" + REGIMEN.ToString() + "', "; } else { MensajeError += "El campo REGIMEN no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SOLO_DEV))) { sql += "'" + SOLO_DEV + "', "; informacion += "SOLO_DEV = '" + SOLO_DEV.ToString() + "', "; } else { MensajeError += "El campo ADMINISTRACION SOLO DEVENGADO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(VAC_PARAF))) { sql += "'" + VAC_PARAF + "', "; informacion += "VAC_PARAF = '" + VAC_PARAF.ToString() + "', "; } else { MensajeError += "El campo VACACIONES PARAFISCALES no puede ser nulo\n"; ejecutar = false; } if (DIAS_VNC != 0) { sql += DIAS_VNC + ", "; informacion += "DIAS_VNC = " + DIAS_VNC.ToString() + ", "; } else { MensajeError = "El campo PLAZO FACTURA no puede ser 0\n"; ejecutar = false; } if (AD_NOM != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_NOM) + ", "; informacion += "AD_NOM = " + AD_NOM.ToString() + ", "; } else { sql += "0, "; informacion += "AD_NOM = '" + AD_NOM.ToString() + "', "; } if (AD_PENSION != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_PENSION) + ", "; informacion += "AD_PENSION = " + AD_PENSION.ToString() + ", "; } else { sql += "0, "; informacion += "AD_PENSION = '" + AD_PENSION.ToString() + "', "; } if (AD_SALUD != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_SALUD) + ", "; informacion += "AD_SALUD = " + AD_SALUD.ToString() + ", "; } else { sql += "0, "; informacion += "AD_SALUD = '" + AD_SALUD.ToString() + "', "; } if (AD_RIESGOS != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_RIESGOS) + ", "; informacion += "AD_RIESGOS = " + AD_RIESGOS.ToString() + ", "; } else { sql += "0, "; informacion += "AD_RIESGOS = '" + AD_RIESGOS.ToString() + "', "; } if (AD_APO_SENA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_APO_SENA) + ", "; informacion += "AD_RIESGOS = " + AD_APO_SENA.ToString() + ", "; } else { sql += "0, "; informacion += "AD_RIESGOS = '" + AD_APO_SENA.ToString() + "', "; } if (AD_APO_ICBF != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_APO_ICBF) + ", "; informacion += "AD_APO_ICBF = " + AD_APO_ICBF.ToString() + ", "; } else { sql += "0, "; informacion += "AD_APO_ICBF = '" + AD_APO_ICBF.ToString() + "', "; } if (AD_APO_CAJA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_APO_CAJA) + ", "; informacion += "AD_APO_CAJA = " + AD_APO_CAJA.ToString() + ", "; } else { sql += "0, "; informacion += "AD_APO_CAJA = '" + AD_APO_CAJA.ToString() + "', "; } if (AD_VACACIONES != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_VACACIONES) + ", "; informacion += "AD_VACACIONES = " + AD_VACACIONES.ToString() + ", "; } else { sql += "0, "; informacion += "AD_VACACIONES = '" + AD_VACACIONES.ToString() + "', "; } if (AD_CESANTIA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_CESANTIA) + ", "; informacion += "AD_CESANTIA = " + AD_CESANTIA.ToString() + ", "; } else { sql += "0, "; informacion += "AD_CESANTIA = '" + AD_CESANTIA.ToString() + "', "; } if (AD_INT_CES != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_INT_CES) + ", "; informacion += "AD_INT_CES = " + AD_INT_CES.ToString() + ", "; } else { sql += "0, "; informacion += "AD_INT_CES = '" + AD_INT_CES.ToString() + "', "; } if (AD_PRIMA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_PRIMA) + ", "; informacion += "AD_PRIMA = " + AD_PRIMA.ToString() + ", "; } else { sql += "0, "; informacion += "AD_PRIMA = '" + AD_PRIMA.ToString() + "', "; } if (AD_SEG_VID != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AD_SEG_VID) + ", "; informacion += "AD_SEG_VID = " + AD_SEG_VID.ToString() + ", "; } else { sql += "0, "; informacion += "AD_SEG_VID = '" + AD_SEG_VID.ToString() + "', "; } if (!(String.IsNullOrEmpty(SUB_PENSION))) { sql += "'" + SUB_PENSION + "', "; informacion += "SUB_PENSION = '" + SUB_PENSION.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA PENSION no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_SALUD))) { sql += "'" + SUB_SALUD + "', "; informacion += "SUB_SALUD = '" + SUB_SALUD.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA SALUD no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_RIESGOS))) { sql += "'" + SUB_RIESGOS + "', "; informacion += "SUB_RIESGOS = '" + SUB_RIESGOS.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA RIESGOS PROFESIONALES no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_SENA))) { sql += "'" + SUB_SENA + "', "; informacion += "SUB_SENA = '" + SUB_SENA.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA SENA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_ICBF))) { sql += "'" + SUB_ICBF + "', "; informacion += "SUB_ICBF = '" + SUB_ICBF.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA ICBF no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_CAJA))) { sql += "'" + SUB_CAJA + "', "; informacion += "SUB_CAJA = '" + SUB_CAJA.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA CAJA DE COMPENSACION FAMILIAR no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_VACACIONES))) { sql += "'" + SUB_VACACIONES + "', "; informacion += "SUB_VACACIONES = '" + SUB_VACACIONES.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA VACACIONES no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_CESANTIAS))) { sql += "'" + SUB_CESANTIAS + "', "; informacion += "SUB_CESANTIAS = '" + SUB_CESANTIAS.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA CESANTIAS no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_INT_CES))) { sql += "'" + SUB_INT_CES + "', "; informacion += "SUB_INT_CES = '" + SUB_INT_CES.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA INTERESES DE CESANTIAS no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_PRIMA))) { sql += "'" + SUB_PRIMA + "', "; informacion += "SUB_PRIMA = '" + SUB_PRIMA.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA PRIMA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SUB_SEG_VID))) { sql += "'" + SUB_SEG_VID + "', "; informacion += "SUB_SEG_VID = '" + SUB_SEG_VID.ToString() + "', "; } else { MensajeError += "El campo INCLUYE SUBSIDIO DE TRANSPORTE PARA SEGURO DE VIDA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(MOD_SOPORTE))) { sql += "'" + MOD_SOPORTE + "', "; informacion += "MOD_SOPORTE = '" + MOD_SOPORTE.ToString() + "', "; } else { MensajeError += "El campo MODELOS DE SOPORTE no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(MOD_FACTURA))) { sql += "'" + MOD_FACTURA + "', "; informacion += "MOD_FACTURA = '" + MOD_FACTURA.ToString() + "', "; } else { MensajeError += "El campo MODELOS DE FACTURA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(OBS_FACT))) { sql += "'" + OBS_FACT + "', "; informacion += "OBS_FACT = '" + OBS_FACT.ToString() + "', "; } else { sql += "null, "; informacion += "OBS_FACT = 'null', "; } if (!(String.IsNullOrEmpty(RET_VAC))) { sql += "'" + RET_VAC + "', "; informacion += "RET_VAC = '" + RET_VAC.ToString() + "', "; } else { MensajeError += "El campo SE COBRA AL RETIRO VACACIONES no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(RET_CES))) { sql += "'" + RET_CES + "', "; informacion += "RET_CES = '" + RET_CES.ToString() + "', "; } else { MensajeError += "El campo SE COBRA AL RETIRO CESANTIAS no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(RET_INT_CES))) { sql += "'" + RET_INT_CES + "', "; informacion += "RET_INT_CES = '" + RET_INT_CES.ToString() + "', "; } else { MensajeError += "El campo SE COBRA AL RETIRO INTERESES CESANTIAS no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(RET_PRIM))) { sql += "'" + RET_PRIM + "', "; informacion += "RET_PRIM = '" + RET_PRIM.ToString() + "', "; } else { MensajeError += "El campo SE COBRA AL RETIRO PRIMA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(USU_CRE))) { sql += "'" + USU_CRE + "', "; informacion += "USU_CRE = '" + USU_CRE.ToString() + "', "; } else { MensajeError += "El campo USUARIO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(APL_MTZ))) { sql += "'" + APL_MTZ + "', "; informacion += "APL_MTZ = '" + APL_MTZ.ToString() + "', "; } else { MensajeError += "El campo MONETIZACION no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(ID_CIUDAD))) { sql += "'" + ID_CIUDAD + "', "; informacion += "ID_CIUDAD = '" + ID_CIUDAD.ToString() + "', "; } else { sql += "null, "; informacion += "ID_CIUDAD = Null, "; } if (ID_CENTRO_C != 0) { sql += ID_CENTRO_C + ", "; informacion += "ID_CENTRO_C = " + ID_CENTRO_C.ToString() + ", "; } else { sql += "null, "; informacion += "ID_CENTRO_C = Null, "; } if (ID_SUB_C != 0) { sql += ID_SUB_C; informacion += "ID_SUB_C = " + ID_SUB_C.ToString(); } else { sql += "null"; informacion += "ID_SUB_C = Null"; } #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { registro = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(USU_CRE, tabla.VEN_P_FACTURACION, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria validarLista(SERVICIO, DETALLE_SERVICIO, ID_EMPRESA, ID_CIUDAD, ID_CENTRO_C, ID_SUB_C, conexion); } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (!(String.IsNullOrEmpty(registro))) return Convert.ToDecimal(registro); else return 0; }
public Decimal AdicionarDetalleServicio(Decimal ID_Servicio, Decimal ID_Servicio_Completario, Decimal AIU, Decimal IVA, Decimal VALOR, Conexion conexion) { String sql = null; String ID_SERVICIO = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_detalle_servicio_adicionar "; #region validaciones sql += ID_Servicio + ", "; informacion += "ID_SERVICIO = '" + ID_Servicio + "' "; if (ID_Servicio_Completario != 0) { sql += ID_Servicio_Completario + ", "; informacion += "ID_SERVICIO_COMPLETARIO = '" + ID_Servicio_Completario + "' "; } else { MensajeError += "El campo ID_SERVICIO_COMPLETARIO no puede ser nulo\n"; ejecutar = false; } if (AIU != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AIU) + ", "; informacion += "AIU = '" + AIU + "' "; } else { sql += "0, "; informacion += "AIU = 0 "; } if (IVA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA) + ", "; informacion += "IVA = '" + IVA + "' "; } else { sql += "0, "; informacion += "IVA = 0 "; } if (VALOR != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR) + ", "; informacion += "VALOR = '" + VALOR + "' "; } else { sql += "0, "; informacion += "VALOR = 0 "; } sql += "'S', null"; informacion += "ACIVO = 'S', FECHA_INACTIVO = NULL "; #endregion validaciones if (ejecutar) { try { ID_SERVICIO = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.VEN_DETALLE_SERVICIO, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (!(String.IsNullOrEmpty(ID_SERVICIO))) return Convert.ToDecimal(ID_SERVICIO); else return 0; }
public Decimal AdicionarAlmDocumentosParaFactura(int ID_EMPLEADO, int DOCUMENTO_ORIGEN, String TIPO_DOC, String ORIGEN, String NUMERO_DOCUMENTO, DateTime FECHA_DOCUMENTO, DateTime FECHA_VENCE, int ID_BODEGA_DESTINO, Decimal VALOR, String ESTADO, String OBSERVACION_JUSTIFICACION, Conexion _dato, int ID_PROVEEDOR) { String sql = null; String identificador = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_ALM_DOCUMENTOS_ADICIONAR_PARA_FACTURA "; #region validaciones if (ID_EMPLEADO != 0) { sql += ID_EMPLEADO + ", "; informacion += "ID_EMPLEADO = '" + ID_EMPLEADO.ToString() + "', "; } else { sql += "0, "; informacion += "ID_EMPLEADO = '0', "; } if (DOCUMENTO_ORIGEN != 0) { sql += DOCUMENTO_ORIGEN + ", "; informacion += "DOCUMENTO_ORIGEN = '" + DOCUMENTO_ORIGEN.ToString() + "', "; } else { sql += "0, "; informacion += "DOCUMENTO_ORIGEN = '0', "; } if (!(String.IsNullOrEmpty(TIPO_DOC))) { sql += "'" + TIPO_DOC + "', "; informacion += "TIPO_DOC= '" + TIPO_DOC.ToString() + "', "; } else { MensajeError += "El campo TIPO_DOC no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(ORIGEN))) { sql += "'" + ORIGEN + "', "; informacion += "ORIGEN= '" + ORIGEN.ToString() + "', "; } else { sql += "'null', "; informacion += "ORIGEN= 'null', "; } if (!(String.IsNullOrEmpty(NUMERO_DOCUMENTO))) { sql += "'" + NUMERO_DOCUMENTO + "', "; informacion += "NUMERO_DOCUMENTO= '" + NUMERO_DOCUMENTO.ToString() + "', "; } else { sql += "'null', "; informacion += "NUMERO_DOCUMENTO= 'null', "; } if (!(String.IsNullOrEmpty(FECHA_DOCUMENTO.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_DOCUMENTO) + "', "; informacion += "FECHA_DOCUMENTO= '" + FECHA_DOCUMENTO.ToString() + "', "; } else { MensajeError += "El campo FECHA_DOCUMENTO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(FECHA_VENCE.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_VENCE) + "', "; informacion += "FECHA_VENCE= '" + FECHA_VENCE.ToString() + "', "; } else { sql += "'01011990', "; informacion += "FECHA_VENCE= '01011990', "; } if (ID_BODEGA_DESTINO != 0) { sql += ID_BODEGA_DESTINO + ", "; informacion += "ID_BODEGA_DESTINO= '" + ID_BODEGA_DESTINO.ToString() + "', "; } else { sql += "0, "; informacion += "ID_BODEGA_DESTINO = 0, "; } if (VALOR != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR) + ", "; informacion += "VALOR = '" + VALOR.ToString() + "', "; } else { sql += "0, "; informacion += "VALOR = 0, "; } if (!(String.IsNullOrEmpty(ESTADO))) { sql += "'" + ESTADO + "', "; informacion += "ESTADO= '" + ESTADO.ToString() + "', "; } else { sql += "null, "; informacion += "ESTADO= 'null', "; } if (!(String.IsNullOrEmpty(OBSERVACION_JUSTIFICACION))) { sql += "'" + OBSERVACION_JUSTIFICACION + "', "; informacion += "OBSERVACION_JUSTIFICACION= '" + OBSERVACION_JUSTIFICACION.ToString() + "', "; } else { sql += "null, "; informacion += "OBSERVACION_JUSTIFICACION= 'null', "; } sql += "'" + Usuario + "', "; informacion += "USU_CRE= '" + Usuario.ToString() + "', "; if (ID_PROVEEDOR != 0) { sql += ID_PROVEEDOR; informacion += "ID_PROVEEDOR = '" + ID_PROVEEDOR.ToString() + "'"; } else { sql += "0"; informacion += "ID_PROVEEDOR = '0'"; } #endregion validaciones if (ejecutar) { try { identificador = _dato.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_DOCUMENTOS, tabla.ACCION_ADICIONAR, sql, informacion, _dato); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador); else return 0; }
private void Adicionar(Decimal ID_EMPLEADO, DateTime FECHA_LIQUIDACION, String CASO_SEVERO, Conexion conexion, Boolean PAZYSALVO, Int32 DIAS_DESCONTAR_LPS, Decimal VALOR_DESCONTAR_BASES, String OBSERVACIONES, Boolean NO_LABORO) { tools _tools = new tools(); String sql = null; sql = "usp_liq_lps_empleado_adicionar "; sql += ID_EMPLEADO.ToString() + ", "; sql += ID_PERIODO.ToString() + ", "; sql += "'" + Liquidaciones.LIQUIDACION + "', "; sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_LIQUIDACION) + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(BaseCesantias) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(BasePrima) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(BaseVacaciones) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(Cesantias) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(InteresesCesantias) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(Prima) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(Vacaciones) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalLiquidacion) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalDevengadoMemorando) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalDeduccionesMemorando) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(NetoLiquidado) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalAnticipos) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(TotalDescuentos) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(NetoPagar) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(PromedioCesantias) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(DiasCesantias) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(PromedioPrima) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(DiasPrima) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(PromedioVacaciones) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(DiasVacaciones) + ", "; sql += "'" + CASO_SEVERO + "', "; sql += "'" + Estados.LIQUIDADO.ToString() + "',"; sql += "'" + PAZYSALVO + "', "; sql += "'" + Usuario + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(DIAS_DESCONTAR_LPS) + ", "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_DESCONTAR_BASES) + ", "; sql += "'" + OBSERVACIONES + "', "; sql += "'" + NO_LABORO + "'"; try { IDLPSEMPLEADO = Convert.ToInt32(conexion.ExecuteScalar(sql)); } catch (Exception e) { throw new Exception(e.Message); } }
public Boolean ActualizarCondicionContratacion(Decimal ID_PERFIL, Decimal ID_EMPRESA, String DOC_TRAB, Decimal RIESGO, String OBS_CTE) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_ven_p_contratacion_actualizar "; if (ID_PERFIL != 0) { sql += ID_PERFIL + ", "; informacion += "ID_PERFIL = " + ID_PERFIL.ToString() + ","; } else { MensajeError = "El campo ID_PERFIL no puede ser 0\n"; ejecutar = false; } if (ID_EMPRESA != 0) { sql += ID_EMPRESA + ", "; informacion += "ID_EMPRESA = " + ID_EMPRESA.ToString() + ", "; } else { MensajeError = "El campo ID EMPRESA no puede ser 0\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(DOC_TRAB))) { sql += "'" + DOC_TRAB + "', "; informacion += "DOC_TRAB = '" + DOC_TRAB.ToString() + "', "; } else { MensajeError += "El campo DOC_TRAB no puede ser nulo. \n"; ejecutar = false; } if (RIESGO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(RIESGO) + ", "; informacion += "RIESGO = " + _tools.convierteComaEnPuntoParaDecimalesEnSQL(RIESGO) + ","; } else { MensajeError = "El campo RIESGO no puede ser 0\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(OBS_CTE))) { sql += "'" + OBS_CTE + "', "; informacion += "OBS_CTE = '" + OBS_CTE.ToString() + "', "; } else { MensajeError += "El campo OBS_CTE no puede ser nulo. \n"; ejecutar = false; } sql += "'" + Usuario + "' "; informacion += "USU_MOD = '" + Usuario.ToString() + "'"; if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.VEN_P_CONTRATACION, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Boolean ActualizarAlmInventarioTemp(int ID_INVENTARIO, int ID_DOCUMENTO, int ID_PRODUCTO, int ID_BODEGA, int ID_LOTE, int ID_EQUIPO, String TALLA, int CANTIDAD, Decimal COSTO, DateTime FECHA, String MOVIMIENTO, Conexion conexion) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_ALM_INVENTARIO_TEMP_ACTUALIZAR "; #region validaciones if (ID_INVENTARIO != 0) { sql += ID_INVENTARIO + ", "; informacion += "ID_INVENTARIO= '" + ID_INVENTARIO.ToString() + "', "; } else { MensajeError += "El campo ID_INVENTARIO no puede ser nulo\n"; ejecutar = false; } if (ID_DOCUMENTO != 0) { sql += ID_DOCUMENTO + ", "; informacion += "ID_DOCUMENTO= '" + ID_DOCUMENTO.ToString() + "', "; } else { MensajeError += "El campo ID_DOCUMENTO no puede ser nulo\n"; ejecutar = false; } if (ID_PRODUCTO != 0) { sql += ID_PRODUCTO + ", "; informacion += "ID_PRODUCTO= '" + ID_PRODUCTO.ToString() + "', "; } else { MensajeError += "El campo ID_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (ID_BODEGA != 0) { sql += ID_BODEGA + ", "; informacion += "ID_BODEGA= '" + ID_BODEGA.ToString() + "', "; } else { MensajeError += "El campo ID_BODEGA no puede ser nulo\n"; ejecutar = false; } if (ID_LOTE != 0) { sql += ID_LOTE + ", "; informacion += "ID_LOTE = '" + ID_LOTE.ToString() + "', "; } else { MensajeError += "El campo ID_LOTE no puede ser nulo\n"; ejecutar = false; } if (ID_EQUIPO != 0) { sql += ID_EQUIPO + ", "; informacion += "ID_EQUIPO= '" + ID_EQUIPO.ToString() + "', "; } else { sql += "0, "; informacion += "ID_EQUIPO= '0', "; } if (!(String.IsNullOrEmpty(TALLA))) { sql += "'" + TALLA + "', "; informacion += "TALLA= '" + TALLA.ToString() + "', "; } else { MensajeError += "El campo TALLA no puede ser nulo\n"; ejecutar = false; } if (CANTIDAD != 0) { sql += CANTIDAD + ", "; informacion += "CANTIDAD= '" + CANTIDAD.ToString() + "', "; } else { sql += "0, "; informacion += "CANTIDAD= '0', "; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO= '" + COSTO.ToString() + "', "; } else { sql += "0, "; informacion += "COSTO= '0', "; } if (!(String.IsNullOrEmpty(FECHA.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA) + "', "; informacion += "FECHA= '" + FECHA.ToString() + "', "; } else { MensajeError += "El campo FECHA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(MOVIMIENTO))) { sql += "'" + MOVIMIENTO + "', "; informacion += "MOVIMIENTO= '" + MOVIMIENTO.ToString() + "', "; } else { MensajeError += "El campo MOVIMIENTO no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "' "; informacion += "USU_CRE= '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_INVENTARIO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Decimal Adicionar(String COD_CONCEPTO, String DESC_CONCEPTO, String DESC_ABREV, String TIPO_CONCEPTO, Int32 ID_IVA, Int32 ID_RETEFUENTE, Boolean BASE_SALARIO, Boolean BASE_FACTURACION, Boolean BASE_HERRAMIENTAS, Boolean COCEPTO_FIJO, Boolean BASE_AJUSTE_SMMLV, Boolean BASE_RETEFTE, Boolean APORTE_VOLUNTARIO_PENSION, Boolean BASE_RETEICA, String COD_CONTABLE, Boolean PAGO_CONDICIONAL, Boolean PAGO_PROPORCIONAL, Boolean BASE_PROMEDIO_DOMINICAL, Int32 ID_UNIDAD_REPORTE, Boolean ACTIVO, Int32 CANT_MAX_MES, Boolean INCAPACIDAD, Decimal PORCENTAJE, Boolean AUTOMATICO, Boolean AUSENTISMO, Boolean BASE_CALC_HORAS, Boolean LIQ_POR_VALOR, Boolean EXIGIR_CANTIDAD, Boolean BASE_PRIMA, Boolean BASE_CESANTIAS, Boolean BASE_VACACIONES, Boolean ANTICIPO_CESANTIAS, Boolean DESC_DIAS_LPS, Boolean DESC_TERCEROS, Decimal VALOR_MAX_MES, List<String> listaTarifas, Boolean POR_DESTAJO, Boolean EXCLUIR_CUARENTA, Boolean MULTIPLO_OCHO, Boolean autol_base_pension, Boolean autol_base_salud, Boolean autol_base_arl, Boolean autol_base_sena, Boolean autol_base_icbf, Boolean autol_base_caja, Boolean autol_dias_base, Boolean autol_dias_irp, Boolean autol_dias_eg, Boolean autol_cree, Boolean autol_ley_1393, Boolean autol_dias_sln, Boolean autol_licencia_maternidad, Boolean autol_base_salario, Boolean autol_dias_vacaciones_disfrutadas) { String sql = null; String ID = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); Boolean ejecutadoCorrectamente = true; if (CodigoExiste(COD_CONCEPTO)) { MensajeError += "El COD_CONCEPTO ya se encuentra registrado\n"; ejecutar = false; } else { #region validaciones sql = "usp_nom_conceptos_nomina_adicionar_V2 "; if (!(String.IsNullOrEmpty(COD_CONCEPTO))) { sql += "'" + COD_CONCEPTO + "', "; informacion += "COD_CONCEPTO = '" + COD_CONCEPTO + "', "; } else { MensajeError += "El campo COD_CONCEPTO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(DESC_CONCEPTO))) { sql += "'" + DESC_CONCEPTO + "', "; informacion += "DESC_CONCEPTO = '" + DESC_CONCEPTO + "', "; } else { MensajeError += "El campo DESC_CONCEPTO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(DESC_ABREV))) { sql += "'" + DESC_ABREV + "', "; informacion += "DESC_ABREV = '" + DESC_ABREV + "', "; } else { MensajeError += "El campo DESC_ABREV no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(TIPO_CONCEPTO))) { sql += "'" + TIPO_CONCEPTO + "', "; informacion += "TIPO_CONCEPTO = '" + TIPO_CONCEPTO + "', "; } else { MensajeError += "El campo TIPO_CONCEPTO no puede ser nulo\n"; ejecutar = false; } if (ID_IVA != 0) { sql += "'" + ID_IVA + "', "; informacion += "ID_IVA = '" + ID_IVA + "', "; } else { sql += "Null, "; informacion += "ID_IVA = 'Null', "; } if (ID_RETEFUENTE != 0) { sql += "'" + ID_RETEFUENTE + "', "; informacion += "ID_RETEFUENTE = '" + ID_RETEFUENTE + "', "; } else { sql += "Null, "; informacion += "ID_RETEFUENTE = 'Null', "; } if (BASE_SALARIO) { sql += "1, "; informacion += "BASE_SALARIO = 'True', "; } else { sql += "0, "; informacion += "BASE_SALARIO = 'False', "; } if (BASE_FACTURACION) { sql += "1, "; informacion += "BASE_FACTURACION = 'True', "; } else { sql += "0, "; informacion += "BASE_FACTURACION = 'False', "; } if (BASE_HERRAMIENTAS) { sql += "1, "; informacion += "BASE_HERRAMIENTAS = 'True', "; } else { sql += "0, "; informacion += "BASE_HERRAMIENTAS = 'False', "; } if (COCEPTO_FIJO) { sql += "1, "; informacion += "COCEPTO_FIJO = 'True', "; } else { sql += "0, "; informacion += "COCEPTO_FIJO = 'False', "; } if (BASE_AJUSTE_SMMLV) { sql += "1, "; informacion += "BASE_AJUSTE_SMMLV = 'True', "; } else { sql += "0, "; informacion += "BASE_AJUSTE_SMMLV = 'False', "; } if (BASE_RETEFTE) { sql += "1, "; informacion += "BASE_RETEFTE = 'True', "; } else { sql += "0, "; informacion += "BASE_RETEFTE = 'False', "; } if (APORTE_VOLUNTARIO_PENSION) { sql += "1, "; informacion += "APORTE_VOLUNTARIO_PENSION = 'True', "; } else { sql += "0, "; informacion += "APORTE_VOLUNTARIO_PENSION = 'False', "; } if (BASE_RETEICA) { sql += "1, "; informacion += "BASE_RETEICA = 'True', "; } else { sql += "0, "; informacion += "BASE_RETEICA = 'False', "; } if (!(String.IsNullOrEmpty(COD_CONTABLE))) { sql += "'" + COD_CONTABLE + "', "; informacion += "COD_CONTABLE = '" + COD_CONTABLE + "', "; } else { MensajeError += "El campo COD_CONTABLE no puede ser nulo\n"; ejecutar = false; } if (PAGO_CONDICIONAL) { sql += "1, "; informacion += "PAGO_CONDICIONAL = 'True', "; } else { sql += "0, "; informacion += "PAGO_CONDICIONAL = 'False', "; } if (PAGO_PROPORCIONAL) { sql += "1, "; informacion += "PAGO_PROPORCIONAL = 'True', "; } else { sql += "0, "; informacion += "PAGO_PROPORCIONAL = 'False', "; } if (BASE_PROMEDIO_DOMINICAL) { sql += "1, "; informacion += "BASE_PROMEDIO_DOMINICAL = 'True', "; } else { sql += "0, "; informacion += "BASE_PROMEDIO_DOMINICAL = 'False', "; } if (ID_UNIDAD_REPORTE != 0) { sql += "'" + ID_UNIDAD_REPORTE + "', "; informacion += "ID_UNIDAD_REPORTE = '" + ID_UNIDAD_REPORTE + "', "; } else { sql += "Null, "; informacion += "ID_UNIDAD_REPORTE = 'Null', "; } if (ACTIVO) { sql += "1, "; informacion += "ACTIVO = 'True', "; } else { sql += "0, "; informacion += "ACTIVO = 'False', "; } if (CANT_MAX_MES != 0) { sql += "'" + CANT_MAX_MES + "', "; informacion += "CANT_MAX_MES = '" + CANT_MAX_MES + "', "; } else { sql += "Null, "; informacion += "CANT_MAX_MES = 'Null', "; } if (INCAPACIDAD) { sql += "1, "; informacion += "INCAPACIDAD = 'True', "; } else { sql += "0, "; informacion += "INCAPACIDAD = 'False', "; } if (PORCENTAJE != 0) { sql += "'" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(PORCENTAJE).ToString() + "', "; informacion += "PORCENTAJE = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(PORCENTAJE).ToString() + "', "; } else { sql += "Null, "; informacion += "PORCENTAJE = 'Null', "; } if (AUTOMATICO) { sql += "1, "; informacion += "AUTOMATICO = 'True', "; } else { sql += "0, "; informacion += "AUTOMATICO = 'False', "; } if (AUSENTISMO) { sql += "1, "; informacion += "AUSENTISMO = 'True', "; } else { sql += "0, "; informacion += "AUSENTISMO = 'False', "; } if (BASE_CALC_HORAS) { sql += "1, "; informacion += "BASE_CALC_HORAS = 'True', "; } else { sql += "0, "; informacion += "BASE_CALC_HORAS = 'False', "; } if (LIQ_POR_VALOR) { sql += "1, "; informacion += "LIQ_POR_VALOR = 'True', "; } else { sql += "0, "; informacion += "LIQ_POR_VALOR = 'False', "; } if (EXIGIR_CANTIDAD) { sql += "1, "; informacion += "EXIGIR_CANTIDAD = 'True', "; } else { sql += "0, "; informacion += "EXIGIR_CANTIDAD = 'False', "; } sql += "'" + Usuario + "', "; informacion += "USU_CRE = '" + Usuario.ToString() + "', "; if (BASE_PRIMA) { sql += "1, "; informacion += "BASE_PRIMA = 'True', "; } else { sql += "0, "; informacion += "BASE_PRIMA = 'False', "; } if (BASE_CESANTIAS) { sql += "1, "; informacion += "BASE_CESANTIAS = 'True', "; } else { sql += "0, "; informacion += "BASE_CESANTIAS = 'False', "; } if (BASE_VACACIONES) { sql += "1, "; informacion += "BASE_VACACIONES = 'True', "; } else { sql += "0, "; informacion += "BASE_VACACIONES = 'False', "; } if (ANTICIPO_CESANTIAS) { sql += "1, "; informacion += "ANTICIPO_CESANTIAS = 'True', "; } else { sql += "0, "; informacion += "ANTICIPO_CESANTIAS = 'False', "; } if (DESC_DIAS_LPS) { sql += "1, "; informacion += "DESC_DIAS_LPS = 'True', "; } else { sql += "0, "; informacion += "DESC_DIAS_LPS = 'False', "; } if (DESC_TERCEROS) { sql += "1, "; informacion += "DESC_TERCEROS = 'True', "; } else { sql += "0, "; informacion += "DESC_TERCEROS = 'False', "; } if (VALOR_MAX_MES != 0) { sql += "'" + VALOR_MAX_MES + "', "; informacion += "VALOR_MAX_MES = '" + VALOR_MAX_MES + "', "; } else { sql += "Null, "; informacion += "VALOR_MAX_MES = 'Null', "; } if (POR_DESTAJO == false) { sql += "'False', "; } else { sql += "'True', "; } if (EXCLUIR_CUARENTA == false) { sql += "'False', "; } else { sql += "'True', "; } if (MULTIPLO_OCHO == false) { sql += "'False', "; } else { sql += "'True', "; } if (autol_base_pension == true) { sql += "true, "; informacion += "autol_base_pension = 'true', "; } else { sql += "false, "; informacion += "autol_base_pension = 'false', "; } if (autol_base_salud == true) { sql += "true, "; informacion += "autol_base_salud = 'true', "; } else { sql += "false, "; informacion += "autol_base_salud = 'false', "; } if (autol_base_arl == true) { sql += "true, "; informacion += "autol_base_arl = 'true', "; } else { sql += "false, "; informacion += "autol_base_arl = 'false', "; } if (autol_base_sena == true) { sql += "true, "; informacion += "autol_base_sena = 'true', "; } else { sql += "false, "; informacion += "autol_base_sena = 'false', "; } if (autol_base_icbf == true) { sql += "true, "; informacion += "autol_base_icbf = 'true', "; } else { sql += "false, "; informacion += "autol_base_icbf = 'false', "; } if (autol_base_caja == true) { sql += "true, "; informacion += "autol_base_caja = 'true', "; } else { sql += "false, "; informacion += "autol_base_caja = 'false', "; } if (autol_dias_base == true) { sql += "true, "; informacion += "autol_dias_base = 'true', "; } else { sql += "false, "; informacion += "autol_dias_base = 'false', "; } if (autol_dias_irp == true) { sql += "true, "; informacion += "autol_dias_irp = 'true', "; } else { sql += "false, "; informacion += "autol_dias_irp = 'false', "; } if (autol_dias_eg == true) { sql += "true, "; informacion += "autol_dias_eg = 'true', "; } else { sql += "false, "; informacion += "autol_dias_eg = 'false', "; } if (autol_cree == true) { sql += "true, "; informacion += "autol_cree = 'true', "; } else { sql += "false, "; informacion += "autol_cree = 'false', "; } if (autol_ley_1393 == true) { sql += "true, "; informacion += "autol_ley_1393 = 'true', "; } else { sql += "false, "; informacion += "autol_ley_1393 = 'false', "; } if (autol_dias_sln == true) { sql += "true, "; informacion += "autol_dias_sln = 'true', "; } else { sql += "false, "; informacion += "autol_dias_sln = 'false', "; } if (autol_licencia_maternidad == true) { sql += "true, "; informacion += "autol_licencia_maternidad = 'true', "; } else { sql += "false, "; informacion += "autol_licencia_maternidad = 'false', "; } if (autol_base_salario == true) { sql += "true, "; informacion += "autol_base_salario = 'true', "; } else { sql += "false, "; informacion += "autol_base_salario = 'false', "; } if (autol_dias_vacaciones_disfrutadas == true) { sql += "true"; informacion += "autol_dias_vacaciones_disfrutadas = 'true'"; } else { sql += "false"; informacion += "autol_dias_vacaciones_disfrutadas = 'false'"; } #endregion validaciones } if (ejecutar) { Conexion conexion = new Conexion(Empresa); conexion.IniciarTransaccion(); try { #region adicionar ID = conexion.ExecuteScalar(sql); if (ID == null) { ejecutadoCorrectamente = false; } #endregion adicionar #region auditoria if (ejecutadoCorrectamente == true) { auditoria _auditoria = new auditoria(Empresa); if (!(_auditoria.Adicionar(Usuario, tabla.NOM_CONCEPTOS_NOMINA, tabla.ACCION_ADICIONAR, sql, informacion, conexion))) { ejecutadoCorrectamente = false; } #endregion auditoria } #region TARIFAS if (ejecutadoCorrectamente == true) { if (EliminarTarifasAsociadasAConcepto(Convert.ToDecimal(ID), conexion) == false) { ejecutadoCorrectamente = false; } else { foreach (String t in listaTarifas) { String[] infoTarifa = t.Split('-'); if (AdicionarTarifaConcepto(Convert.ToDecimal(ID), Convert.ToDecimal(infoTarifa[0]), infoTarifa[1], conexion) <= 0) { ejecutadoCorrectamente = false; break; } } } } #endregion TARIFAS if (ejecutadoCorrectamente == true) { conexion.AceptarTransaccion(); } else { conexion.DeshacerTransaccion(); } } catch (Exception e) { conexion.DeshacerTransaccion(); MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (!(String.IsNullOrEmpty(ID))) { return Convert.ToDecimal(ID); } else { return 0; } }
public Boolean ActualizarOrdenCompra(Decimal ID_ORDEN, DateTime FECHA, String ARTICULO, String MOTIVO, String PROCESO_AREA, Decimal ID_EMPRESA, Decimal ID_PROVEEDOR_PARAM, int PERIODOENTREGA, int GARANTIA, String FORMA_PAGO, Decimal ID_ENTIDAD_BANCARIA, String CUENTA_BANCARIA, String CONDICIONES_ENTREGA, Decimal SUBTOTAL, Decimal DESCUENTO_APLICADO, Decimal IVA_APLICADO, Decimal VALOR_TOTAL, String ESPECIFICACIONES_TECNICAS, String OBSERVACIONES, String TIPO_COMPRA, String NOMBRE_SOLICITO, String CARGO_SOLICITO, String FACTURAR_A, Conexion conexion) { String sql = null; int numRegistrosAfectados = 0; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_ALM_ORDEN_COMPRA_ACTUALIZAR "; #region validaciones if (ID_ORDEN != 0) { sql += ID_ORDEN + ", "; informacion += "ID_ORDEN = '" + ID_ORDEN + "', "; } else { MensajeError += "El campo ID_ORDEN no puede ser nulo\n"; ejecutar = false; } sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA) + "', "; informacion += "FECHA = '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA) + "', "; if (!(String.IsNullOrEmpty(ARTICULO))) { sql += "'" + ARTICULO + "', "; informacion += "ARTICULO = '" + ARTICULO + "', "; } else { MensajeError += "El campo ARTICULO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(MOTIVO))) { sql += "'" + MOTIVO + "', "; informacion += "MOTIVO = '" + MOTIVO + "', "; } else { MensajeError += "El campo MOTIVO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(PROCESO_AREA))) { sql += "'" + PROCESO_AREA + "', "; informacion += "PROCESO_AREA = '" + PROCESO_AREA + "', "; } else { sql += "NULL, "; informacion += "PROCESO_AREA = 'NULL', "; } if (ID_EMPRESA != 0) { sql += ID_EMPRESA + ", "; informacion += "ID_EMPRESA = '" + ID_EMPRESA + "', "; } else { MensajeError += "El campo ID_EMPRESA no puede ser nulo\n"; ejecutar = false; } if (ID_PROVEEDOR_PARAM != 0) { sql += ID_PROVEEDOR_PARAM + ", "; informacion += "ID_PROVEEDOR = '" + ID_PROVEEDOR_PARAM + "', "; } else { MensajeError += "El campo ID_PROVEEDOR no puede ser nulo\n"; ejecutar = false; } sql += PERIODOENTREGA + ", "; informacion += "PERIODOENTREGA = '" + PERIODOENTREGA + "', "; sql += GARANTIA + ", "; informacion += "GARANTIA = '" + GARANTIA + "', "; if (!(String.IsNullOrEmpty(FORMA_PAGO))) { sql += "'" + FORMA_PAGO + "', "; informacion += "FORMA_PAGO = '" + FORMA_PAGO + "', "; } else { MensajeError += "El campo FORMA_PAGO no puede ser nulo\n"; ejecutar = false; } if (ID_ENTIDAD_BANCARIA != 0) { sql += ID_ENTIDAD_BANCARIA + ", "; informacion += "ID_ENTIDAD_BANCARIA = '" + ID_ENTIDAD_BANCARIA + "', "; } else { sql += "NULL, "; informacion += "ID_ENTIDAD_BANCARIA = 'NULL', "; } if (!(String.IsNullOrEmpty(CUENTA_BANCARIA))) { sql += "'" + CUENTA_BANCARIA + "', "; informacion += "CUENTA_BANCARIA = '" + CUENTA_BANCARIA + "', "; } else { sql += "NULL, "; informacion += "CUENTA_BANCARIA = 'NULL', "; } if (!(String.IsNullOrEmpty(CONDICIONES_ENTREGA))) { sql += "'" + CONDICIONES_ENTREGA + "', "; informacion += "CONDICIONES_ENTREGA = '" + CONDICIONES_ENTREGA + "', "; } else { MensajeError += "El campo CONDICIONES_ENTREGA no puede ser nulo\n"; ejecutar = false; } sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(SUBTOTAL) + ", "; informacion += "SUBTOTAL = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(SUBTOTAL) + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(DESCUENTO_APLICADO) + ", "; informacion += "DESCUENTO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(DESCUENTO_APLICADO) + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA_APLICADO) + ", "; informacion += "IVA_APLICADO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA_APLICADO) + "', "; sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_TOTAL) + ", "; informacion += "VALOR_TOTAL = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR_TOTAL) + "', "; if (!(String.IsNullOrEmpty(ESPECIFICACIONES_TECNICAS))) { sql += "'" + ESPECIFICACIONES_TECNICAS + "', "; informacion += "ESPECIFICACIONES_TECNICAS = '" + ESPECIFICACIONES_TECNICAS + "', "; } else { MensajeError += "El campo ESPECIFICACIONES_TECNICAS no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(OBSERVACIONES))) { sql += "'" + OBSERVACIONES + "', "; informacion += "OBSERVACIONES = '" + OBSERVACIONES + "', "; } else { sql += "NULL, "; informacion += "OBSERVACIONES = 'NULL', "; } sql += "'" + Usuario + "', "; informacion += "USU_MOD = '" + Usuario.ToString() + "', "; if (!(String.IsNullOrEmpty(TIPO_COMPRA))) { sql += "'" + TIPO_COMPRA + "', "; informacion += "TIPO_COMPRA = '" + TIPO_COMPRA + "', "; } else { MensajeError += "El campo TIPO_COMPRA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(NOMBRE_SOLICITO))) { sql += "'" + NOMBRE_SOLICITO + "', "; informacion += "NOMBRE_SOLICITO = '" + NOMBRE_SOLICITO + "', "; } else { MensajeError += "El campo NOMBRE_SOLICITO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(CARGO_SOLICITO))) { sql += "'" + CARGO_SOLICITO + "', "; informacion += "CARGO_SOLICITO = '" + CARGO_SOLICITO + "', "; } else { MensajeError += "El campo CARGO_SOLICITO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(FACTURAR_A))) { sql += "'" + FACTURAR_A + "'"; informacion += "FACTURAR_A = '" + FACTURAR_A + "'"; } else { sql += "NULL"; informacion += "FACTURAR_A = 'NULL'"; } #endregion validaciones if (ejecutar) { try { numRegistrosAfectados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_ORDEN_COMPRA, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; numRegistrosAfectados = 0; } } if (numRegistrosAfectados > 0) { return true; } else { return false; } }
public Boolean ActualizarConRegEntregasServiciosComplementarios(int ID_ENTREGAS, int ID_ASIGNACION_SC, int ID_PRODUCTO, DateTime FECHA, String TALLA, int CANTIDAD_ENTREGADA, int CANTIDAD_A_ENTREGAR, String ESTADO, Decimal COSTO, Decimal AIU, Decimal IVA, Decimal VALOR, String FACTURADO, String NUMERO_FACTURA) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_CON_REG_ENTREGAS_SERVICIOS_COMPLEMENTARIOS_ACTUALIZAR "; #region validaciones if (ID_ENTREGAS != 0) { sql += ID_ENTREGAS + ", "; informacion += "ID_ENTREGAS = '" + ID_ENTREGAS.ToString() + "', "; } else { MensajeError += "El campo ID_ENTREGAS no puede ser nulo\n"; ejecutar = false; } if (ID_ASIGNACION_SC != 0) { sql += ID_ASIGNACION_SC + ", "; informacion += "ID_ASIGNACION_SC = '" + ID_ASIGNACION_SC.ToString() + "', "; } else { MensajeError += "El campo ID_ASIGNACION_SC no puede ser nulo\n"; ejecutar = false; } if (ID_PRODUCTO != 0) { sql += ID_PRODUCTO + ", "; informacion += "ID_PRODUCTO = '" + ID_PRODUCTO.ToString() + "', "; } else { MensajeError += "El campo ID_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(FECHA.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA) + "', "; informacion += "FECHA= '" + FECHA.ToString() + "', "; } else { MensajeError += "El campo FECHA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(TALLA))) { sql += "'" + TALLA + "', "; informacion += "TALLA= '" + TALLA.ToString() + "', "; } else { MensajeError += "El campo TALLA no puede ser nulo\n"; ejecutar = false; } if (CANTIDAD_ENTREGADA != 0) { sql += CANTIDAD_ENTREGADA + ", "; informacion += "CANTIDAD_ENTREGADA = '" + CANTIDAD_ENTREGADA.ToString() + "', "; } else { MensajeError += "El campo CANTIDAD_ENTREGADA no puede ser nulo\n"; ejecutar = false; } if (CANTIDAD_A_ENTREGAR != 0) { sql += CANTIDAD_A_ENTREGAR + ", "; informacion += "CANTIDAD_A_ENTREGAR = '" + CANTIDAD_A_ENTREGAR.ToString() + "', "; } else { MensajeError += "El campo CANTIDAD_A_ENTREGAR no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(ESTADO))) { sql += "'" + ESTADO + "', "; informacion += "ESTADO= '" + ESTADO.ToString() + "', "; } else { MensajeError += "El campo ESTADO no puede ser nulo\n"; ejecutar = false; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO = '" + COSTO.ToString() + "', "; } else { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO = '" + COSTO.ToString() + "', "; } if (AIU != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AIU) + ", "; informacion += "AIU = '" + AIU.ToString() + "', "; } else { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AIU) + ", "; informacion += "AIU = '" + AIU.ToString() + "', "; } if (IVA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA) + ", "; informacion += "IVA = '" + IVA.ToString() + "', "; } else { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA) + ", "; informacion += "IVA = '" + IVA.ToString() + "', "; } if (VALOR != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR) + ", "; informacion += "VALOR = '" + VALOR.ToString() + "', "; } else { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR) + ", "; informacion += "VALOR = '" + VALOR.ToString() + "', "; } if (!(String.IsNullOrEmpty(FACTURADO))) { sql += "'" + FACTURADO + "', "; informacion += "FACTURADO= '" + FACTURADO.ToString() + "', "; } else { MensajeError += "El campo FACTURADO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(NUMERO_FACTURA))) { sql += "'" + NUMERO_FACTURA + "', "; informacion += "NUMERO_FACTURA= '" + NUMERO_FACTURA.ToString() + "', "; } else { sql += "null, "; informacion += "NUMERO_FACTURA= '" + NUMERO_FACTURA.ToString() + "', "; } sql += "'" + Usuario + "' "; informacion += "USU_CRE= '" + Usuario.ToString() + "', "; #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_ENTREGAS_SERVICIOS_COMPLEMENTARIOS, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Boolean ActualizarSueldoConRequerimientos(int ID_REQUERIMIENTO, Decimal SALARIO) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_con_requerimientos_actualizar_sueldo "; #region validaciones if (ID_REQUERIMIENTO != 0) { sql += ID_REQUERIMIENTO + ", "; informacion += "ID_REQUERIMIENTO= '" + ID_REQUERIMIENTO.ToString() + "', "; } else { MensajeError += "El campo ID_REQUERIMIENTO no puede ser nulo\n"; ejecutar = false; } if (SALARIO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(SALARIO); informacion += "SALARIO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(SALARIO) + "'"; } else { MensajeError += "El campo SALARIO no puede ser nulo\n"; ejecutar = false; } #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REQUERIMIENTOS, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Decimal AdicionarAlmInventario(int ID_DOCUMENTO, int ID_PRODUCTO, int ID_BODEGA, int CANTIDAD, Decimal COSTO, DateTime FECHA, String MOVIMIENTO, Conexion conexion, int ID_LOTE, String TALLA, int ID_EQUIPO, Decimal ID_DETELLE_ENTREGA, String DETALLE_MOVIMIENTO, String REEMBOLSO) { String sql = null; String identificador = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_ALM_INVENTARIO_ADICIONAR "; #region validaciones if (ID_DOCUMENTO != 0) { sql += ID_DOCUMENTO + ", "; informacion += "ID_DOCUMENTO= '" + ID_DOCUMENTO.ToString() + "', "; } else { MensajeError += "El campo ID_DOCUMENTO no puede ser nulo\n"; ejecutar = false; } if (ID_PRODUCTO != 0) { sql += ID_PRODUCTO + ", "; informacion += "ID_PRODUCTO= '" + ID_PRODUCTO.ToString() + "', "; } else { MensajeError += "El campo ID_PRODUCTO no puede ser nulo\n"; ejecutar = false; } if (ID_BODEGA != 0) { sql += ID_BODEGA + ", "; informacion += "ID_BODEGA= '" + ID_BODEGA.ToString() + "', "; } else { MensajeError += "El campo ID_BODEGA no puede ser nulo\n"; ejecutar = false; } if (CANTIDAD != 0) { sql += CANTIDAD + ", "; informacion += "CANTIDAD= '" + CANTIDAD.ToString() + "', "; } else { sql += "0, "; informacion += "CANTIDAD= '0', "; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO= '" + COSTO.ToString() + "', "; } else { sql += "0, "; informacion += "COSTO= '0', "; } if (!(String.IsNullOrEmpty(FECHA.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA) + "', "; informacion += "FECHA= '" + FECHA.ToString() + "', "; } else { MensajeError += "El campo FECHA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(MOVIMIENTO))) { sql += "'" + MOVIMIENTO + "', "; informacion += "MOVIMIENTO= '" + MOVIMIENTO.ToString() + "', "; } else { MensajeError += "El campo MOVIMIENTO no puede ser nulo\n"; ejecutar = false; } sql += "'" + Usuario + "', "; informacion += "USU_CRE= '" + Usuario.ToString() + "', "; if (ID_LOTE != 0) { sql += ID_LOTE + ", "; informacion += "ID_LOTE = '" + ID_LOTE.ToString() + "', "; } else { MensajeError += "El campo ID_LOTE no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(TALLA))) { sql += "'" + TALLA + "', "; informacion += "TALLA= '" + TALLA.ToString() + "', "; } else { MensajeError += "El campo TALLA no puede ser nulo\n"; ejecutar = false; } if (ID_EQUIPO != 0) { sql += ID_EQUIPO + ", "; informacion += "ID_EQUIPO = '" + ID_EQUIPO.ToString() + "', "; } else { sql += "0, "; informacion += "ID_EQUIPO= '0', "; } if (ID_DETELLE_ENTREGA != 0) { sql += ID_DETELLE_ENTREGA + ", "; informacion += "ID_DETELLE_ENTREGA = '" + ID_DETELLE_ENTREGA + "', "; } else { sql += "NULL, "; informacion += "ID_DETELLE_ENTREGA = 'NULL', "; } if (String.IsNullOrEmpty(DETALLE_MOVIMIENTO) == false) { sql += "'" + DETALLE_MOVIMIENTO + "', "; informacion += "DETALLE_MOVIMIENTO = '" + DETALLE_MOVIMIENTO + "', "; } else { sql += "NULL, "; informacion += "ID_DETELLE_ENTREGA = 'NULL', "; } if (String.IsNullOrEmpty(REEMBOLSO) == false) { sql += "'" + REEMBOLSO + "'"; } else { ejecutar = false; MensajeError = "El campo REEMBOLSO no puede ser vacio."; } #endregion validaciones if (ejecutar) { try { identificador = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.ALM_INVENTARIO, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador); else return 0; }
public Boolean ActualizarNomEmpleadosAuditoria(Decimal ID_EMPLEADO, Decimal SALARIO, Decimal RIESGO, Decimal ID_ENTIDAD, String NUM_CUENTA, String SAL_INT, Decimal ID_PERFIL, String FORMA_PAGO, String ID_CIUDAD, Decimal ID_CENTRO_C, Decimal ID_SUB_C, Conexion conexion, String TIPO_CUENTA, DateTime FECHA_INICIO_PERIODO, String CHEQUE_REG) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_nom_empleados_actualizar_auditoria_V3 "; #region validaciones if (ID_EMPLEADO != 0) { sql += ID_EMPLEADO + ", "; informacion += "ID_EMPLEADO = '" + ID_EMPLEADO.ToString() + "', "; } else { MensajeError += "El campo ID_EMPLEADO no puede ser nulo\n"; ejecutar = false; } if (SALARIO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(SALARIO) + ", "; informacion += "SALARIO = '" + _tools.convierteComaEnPuntoParaDecimalesEnSQL(SALARIO) + "', "; } else { sql += "0, "; informacion += "SALARIO = '0', "; } if (RIESGO != 0) { sql += RIESGO + ", "; informacion += "RIESGO = '" + RIESGO + "', "; } else { sql += "0, "; informacion += "RIESGO = '0', "; } if (ID_ENTIDAD != 0) { sql += ID_ENTIDAD + ", "; informacion += "ID_ENTIDAD = '" + ID_ENTIDAD.ToString() + "', "; } else { sql += "NULL, "; informacion += "ID_ENTIDAD = 'NULL', "; } if (String.IsNullOrEmpty(NUM_CUENTA) == false) { sql += "'" + NUM_CUENTA + "', "; informacion += "NUM_CUENTA = '" + NUM_CUENTA + "', "; } else { sql += "NULL, "; informacion += "NUM_CUENTA = 'NULL', "; } if (String.IsNullOrEmpty(SAL_INT) == false) { sql += "'" + SAL_INT + "', "; informacion += "SAL_INT = '" + SAL_INT + "', "; } else { MensajeError += "El campo SAL_INT no puede ser nulo\n"; ejecutar = false; } if (ID_PERFIL != 0) { sql += ID_PERFIL + ", "; informacion += "ID_PERFIL = '" + ID_PERFIL + "', "; } else { MensajeError += "El campo ID_PERFIL no puede ser nulo\n"; ejecutar = false; } if (String.IsNullOrEmpty(FORMA_PAGO) == false) { sql += "'" + FORMA_PAGO + "', "; informacion += "FORMA_PAGO = '" + FORMA_PAGO + "', "; } else { sql += "NULL, "; informacion += "FORMA_PAGO = 'NULL', "; } if (String.IsNullOrEmpty(ID_CIUDAD) == false) { sql += "'" + ID_CIUDAD + "', "; informacion += "ID_CIUDAD = '" + ID_CIUDAD + "', "; } else { sql += "NULL, "; informacion += "ID_CIUDAD = 'NULL', "; } if (ID_CENTRO_C != 0) { sql += ID_CENTRO_C + ", "; informacion += "ID_CENTRO_C = '" + ID_CENTRO_C + "', "; } else { sql += "NULL, "; informacion += "ID_CENTRO_C = 'NULL', "; } if (ID_SUB_C != 0) { sql += ID_SUB_C + ", "; informacion += "ID_SUB_C = '" + ID_SUB_C + "', "; } else { sql += "NULL, "; informacion += "ID_SUB_C = 'NULL', "; } sql += "'" + Usuario + "', "; informacion += "USU_MOD = '" + Usuario.ToString() + "', "; if (String.IsNullOrEmpty(TIPO_CUENTA) == false) { sql += "'" + TIPO_CUENTA + "', "; informacion += "TIPO_CUENTA = '" + TIPO_CUENTA + "', "; } else { sql += "NULL, "; informacion += "ID_CIUDAD = 'NULL', "; } if (!(String.IsNullOrEmpty(FECHA_INICIO_PERIODO.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_INICIO_PERIODO) + "', "; informacion += "FECHA_INICIO_PERIODO = '" + FECHA_INICIO_PERIODO.ToString() + "', "; } else { sql += "NULL, "; informacion += "FECHA_INICIO_PERIODO = null, "; } if (String.IsNullOrEmpty(CHEQUE_REG) == false) { sql += "'" + CHEQUE_REG + "'"; informacion += "CHEQUE_REG = '" + CHEQUE_REG.ToString() + "'"; } else { sql += "NULL"; informacion += "CHEQUE_REG = 'NULL'"; } #endregion validaciones if (ejecutar) { try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.NOM_EMPLEADOS, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Decimal AdicionarServicio(String Nombre_Servicio, Decimal AIU, Decimal IVA, Decimal VALOR, String observaciones, Conexion conexion) { String sql = null; String ID_SERVICIO = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_servicio_adicionar "; #region validaciones if (!(String.IsNullOrEmpty(Nombre_Servicio))) { sql += "'" + Nombre_Servicio + "', "; informacion += "NOMBRE_SERVICIO = '" + Nombre_Servicio.ToString() + "', "; } else { MensajeError += "El campo NOMBRE_SERVICIO no puede ser nulo\n"; ejecutar = false; } if (AIU != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AIU) + ", "; informacion += "AIU = '" + AIU + "' "; } else { sql += "0, "; informacion += "AIU = 0 "; } if (IVA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA) + ", "; informacion += "IVA = '" + IVA + "' "; } else { sql += "0, "; informacion += "IVA = 0 "; } if (VALOR != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR) + ","; informacion += "VALOR = '" + VALOR + "' "; } else { sql += "0,"; informacion += "VALOR = 0 "; } if (!(String.IsNullOrEmpty(observaciones))) { sql += "'" + observaciones + "'"; informacion += "observaciones = '" + observaciones.ToString() + "', "; } else { MensajeError += "El campo observaciones no puede ser nulo\n"; ejecutar = false; } #endregion validaciones if (ejecutar) { try { ID_SERVICIO = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.VEN_SERVICIO, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (!(String.IsNullOrEmpty(ID_SERVICIO))) return Convert.ToDecimal(ID_SERVICIO); else return 0; }
public Boolean ActualizarConRegExamenesEmpleado(int REGISTRO, int ID_ORDEN, int ID_EXAMEN, Decimal COSTO, String VALIDADO, DateTime FECHA_EXAMEN) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_CON_REG_EXAMENES_EMPLEADO_ACTUALIZAR "; #region validaciones if (REGISTRO != 0) { sql += REGISTRO + ", "; informacion += "REGISTRO = '" + REGISTRO.ToString() + "', "; } else { MensajeError += "El campo REGISTRO no puede ser nulo\n"; ejecutar = false; } if (ID_ORDEN != 0) { sql += ID_ORDEN + ", "; informacion += "ID_ORDEN = '" + ID_ORDEN.ToString() + "', "; } else { MensajeError += "El campo ID_ORDEN no puede ser nulo\n"; ejecutar = false; } if (ID_EXAMEN != 0) { sql += ID_EXAMEN + ", "; informacion += "ID_EXAMEN = '" + ID_EXAMEN.ToString() + "', "; } else { MensajeError += "El campo ID_EXAMEN no puede ser nulo\n"; ejecutar = false; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO = '" + COSTO.ToString() + "', "; } else { sql += "0, "; informacion += "COSTO = '0', "; } if (!(String.IsNullOrEmpty(VALIDADO))) { sql += "'" + VALIDADO + "', "; informacion += "VALIDADO = '" + VALIDADO.ToString() + "', "; } else { sql += "'N', "; informacion += "VALIDADO = 'N', "; } if (!(String.IsNullOrEmpty(FECHA_EXAMEN.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EXAMEN) + "', "; informacion += "FECHA_EXAMEN = '" + FECHA_EXAMEN.ToString() + "', "; } sql += "'" + Usuario + "' "; informacion += "USU_MOD= '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Boolean ActualizarDetalleServicio(Decimal ID_DETALLE_SERVICIO, Decimal ID_SERVICIO, Decimal ID_SERVICIO_COMPLEMENTARIO, Decimal AIU, Decimal IVA, Decimal VALOR, String ACTIVO, Conexion conexion) { Int32 cantidadRegistrosActualizados = 0; String sql = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_detalle_servicio_actualizar "; #region validaciones if (ID_DETALLE_SERVICIO != 0) { sql += ID_DETALLE_SERVICIO + ", "; informacion += "ID_DETALLE_SERVICIO = " + ID_DETALLE_SERVICIO.ToString() + ", "; } else { MensajeError = "El campo ID_DETALLE_SERVICIO no puede ser 0\n"; ejecutar = false; } if (ID_SERVICIO != 0) { sql += ID_SERVICIO + ", "; informacion += "ID_SERVICIO = " + ID_SERVICIO.ToString() + ", "; } else { MensajeError = "El campo ID_SERVICIO no puede ser 0\n"; ejecutar = false; } if (ID_SERVICIO_COMPLEMENTARIO != 0) { sql += ID_SERVICIO_COMPLEMENTARIO + ", "; informacion += "ID_SERVICIO_COMPLEMENTARIO = " + ID_SERVICIO_COMPLEMENTARIO.ToString() + ", "; } else { MensajeError = "El campo ID_SERVICIO_COMPLEMENTARIO no puede ser 0\n"; ejecutar = false; } if (AIU != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(AIU) + ", "; informacion += "AIU = '" + AIU + "' "; } else { sql += "0, "; informacion += "AIU = 0 "; } if (IVA != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(IVA) + ", "; informacion += "IVA = '" + IVA + "' "; } else { sql += "0, "; informacion += "IVA = 0 "; } if (VALOR != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(VALOR) + ", "; informacion += "VALOR = '" + VALOR + "' "; } else { sql += "0, "; informacion += "VALOR = 0 "; } sql += "'" + ACTIVO + "', "; informacion += "ACTIVO = '" + ACTIVO + "' "; if (ACTIVO.Equals("N")) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(System.DateTime.Now) + "'"; informacion += "FECHA_INACTIVO = '" + _tools.obtenerStringConFormatoFechaSQLServer(System.DateTime.Now) + "'"; } #endregion validaciones if (ejecutar) { try { cantidadRegistrosActualizados = conexion.ExecuteNonQuery(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.VEN_DETALLE_SERVICIO, tabla.ACCION_ACTUALIZAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } } if (cantidadRegistrosActualizados > 0) return true; else return false; }
public Decimal AdicionarConRegExamenesEmpleado(int ID_ORDEN, int ID_EXAMEN, Decimal COSTO, String VALIDADO, DateTime FECHA_EXAMEN, Conexion conexion) { String sql = null; Decimal identificador = 0; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "USP_CON_REG_EXAMENES_EMPLEADO_ADICIONAR "; #region validaciones if (ID_ORDEN != 0) { sql += ID_ORDEN + ", "; informacion += "ID_ORDEN = '" + ID_ORDEN.ToString() + "', "; } else { MensajeError += "El campo ID_ORDEN no puede ser nulo\n"; ejecutar = false; } if (ID_EXAMEN != 0) { sql += ID_EXAMEN + ", "; informacion += "ID_EXAMEN = '" + ID_EXAMEN.ToString() + "', "; } else { MensajeError += "El campo ID_EXAMEN no puede ser nulo\n"; ejecutar = false; } if (COSTO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(COSTO) + ", "; informacion += "COSTO = '" + COSTO.ToString() + "', "; } else { sql += "0, "; informacion += "COSTO = '0', "; } if (!(String.IsNullOrEmpty(VALIDADO))) { sql += "'" + VALIDADO + "', "; informacion += "VALIDADO = '" + VALIDADO.ToString() + "', "; } else { sql += "'N', "; informacion += "VALIDADO = 'N', "; } if (!(String.IsNullOrEmpty(FECHA_EXAMEN.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_EXAMEN) + "', "; informacion += "FECHA_EXAMEN = '" + FECHA_EXAMEN.ToString() + "', "; } sql += "'" + Usuario + "' "; informacion += "USU_CRE= '" + Usuario.ToString() + "' "; #endregion validaciones if (ejecutar) { try { identificador = Convert.ToDecimal(conexion.ExecuteScalar(sql)); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(Usuario, tabla.CON_REG_EXAMENES_EMPLEADO, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; identificador = 0; } } return identificador; }
public Decimal AdicionarNomEmpleados(int ID_CONTRATO, int ID_SOLICITUD, int ID_EMPRESA, int ID_CENTRO_C, int ID_SUB_C, DateTime FCH_INGRESO, Decimal SALARIO, String PENSIONADO, String ACTIVO, String LIQUIDADO, Decimal RIESGO, int ID_ARP, int ID_CAJA_C, int ID_EPS, int ID_F_PENSIONES, String TIP_PAGO, int ID_ENTIDAD, String NUM_CUENTA, String SAL_INT, int ID_PERFIL) { String sql = null; String identificador = null; String informacion = null; Boolean ejecutar = true; tools _tools = new tools(); sql = "usp_nom_empleados_adicionar "; #region validaciones if (ID_CONTRATO != 0) { sql += ID_CONTRATO + ", "; informacion += "ID_CONTRATO = '" + ID_CONTRATO.ToString() + "', "; } else { sql += "0, "; informacion += "ID_CONTRATO = '0', "; } if (ID_SOLICITUD != 0) { sql += ID_SOLICITUD + ", "; informacion += "ID_SOLICITUD = '" + ID_SOLICITUD.ToString() + "', "; } else { MensajeError += "El campo ID_SOLICITUD no puede ser nulo\n"; ejecutar = false; } if (ID_EMPRESA != 0) { sql += ID_EMPRESA + ", "; informacion += "ID_EMPRESA = '" + ID_EMPRESA.ToString() + "', "; } else { MensajeError += "El campo ID_EMPRESA no puede ser nulo\n"; ejecutar = false; } if (ID_CENTRO_C != 0) { sql += ID_CENTRO_C + ", "; informacion += "ID_CENTRO_C = '" + ID_CENTRO_C.ToString() + "', "; } else { sql += ID_CENTRO_C + ", "; informacion += "ID_CENTRO_C = '" + ID_CENTRO_C.ToString() + "', "; } if (ID_SUB_C != 0) { sql += ID_SUB_C + ", "; informacion += "ID_SUB_C= '" + ID_SUB_C.ToString() + "', "; } else { sql += ID_SUB_C + ", "; informacion += "ID_SUB_C= '" + ID_SUB_C.ToString() + "', "; } if (!(String.IsNullOrEmpty(FCH_INGRESO.ToString()))) { sql += "'" + _tools.obtenerStringConFormatoFechaSQLServer(FCH_INGRESO) + "', "; informacion += "FCH_INGRESO= '" + FCH_INGRESO.ToString() + "', "; } else { MensajeError += "El campo FCH_INGRESO no puede ser nulo\n"; ejecutar = false; } if (SALARIO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(SALARIO) + ", "; informacion += "SALARIO= '" + SALARIO.ToString() + "', "; } else { MensajeError += "El campo SALARIO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(PENSIONADO.ToString()))) { sql += "'" + PENSIONADO + "', "; informacion += "PENSIONADO= '" + PENSIONADO.ToString() + "', "; } else { MensajeError += "El campo PENSIONADO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(ACTIVO.ToString()))) { sql += "'" + ACTIVO + "', "; informacion += "ACTIVO = '" + ACTIVO.ToString() + "', "; } else { MensajeError += "El campo ACTIVO no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(LIQUIDADO.ToString()))) { sql += "'" + LIQUIDADO + "', "; informacion += "LIQUIDADO = '" + LIQUIDADO.ToString() + "', "; } else { MensajeError += "El campo LIQUIDADO no puede ser nulo\n"; ejecutar = false; } if (RIESGO != 0) { sql += _tools.convierteComaEnPuntoParaDecimalesEnSQL(RIESGO) + ", "; informacion += "RIESGO= '" + RIESGO.ToString() + "', "; } else { MensajeError += "El campo RIESGO no puede ser nulo\n"; ejecutar = false; } if (ID_ARP != 0) { sql += ID_ARP + ", "; informacion += "ID_ARP = '" + ID_ARP.ToString() + "', "; } else { MensajeError += "El campo ID_ARP no puede ser nulo\n"; ejecutar = false; } if (ID_CAJA_C != 0) { sql += ID_CAJA_C + ", "; informacion += "ID_CAJA_C = '" + ID_CAJA_C.ToString() + "', "; } else { sql += "0, "; informacion += "ID_CAJA_C = '0'"; } if (ID_EPS != 0) { sql += ID_EPS + ", "; informacion += "ID_EPS = '" + ID_EPS.ToString() + "', "; } else { MensajeError += "El campo ID_EPS no puede ser nulo\n"; ejecutar = false; } if (ID_F_PENSIONES != 0) { sql += ID_F_PENSIONES + ", "; informacion += "ID_F_PENSIONES = '" + ID_F_PENSIONES.ToString() + "', "; } else { MensajeError += "El campo ID_F_PENSIONES no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(TIP_PAGO))) { sql += "'" + TIP_PAGO + "', "; informacion += "TIP_PAGO = '" + TIP_PAGO.ToString() + "', "; } else { MensajeError += "El campo TIP_PAGO no puede ser nulo\n"; ejecutar = false; } if (ID_ENTIDAD != 0) { sql += ID_ENTIDAD + ", "; informacion += "ID_ENTIDAD = '" + ID_ENTIDAD.ToString() + "', "; } else { MensajeError += "El campo ID_ENTIDAD no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(NUM_CUENTA))) { sql += "'" + NUM_CUENTA + "', "; informacion += "NUM_CUENTA = '" + NUM_CUENTA.ToString() + "', "; } else { MensajeError += "El campo NUM_CUENTA no puede ser nulo\n"; ejecutar = false; } if (!(String.IsNullOrEmpty(SAL_INT))) { sql += "'" + SAL_INT + "', "; informacion += "SAL_INT = '" + SAL_INT.ToString() + "', "; } else { MensajeError += "El campo SAL_INT no puede ser nulo\n"; ejecutar = false; } sql += "'" + NombreUsuario + "', "; informacion += "USU_CRE= 'null', "; if (ID_PERFIL != 0) { sql += ID_PERFIL + " "; informacion += "ID_PERFIL = '" + ID_PERFIL.ToString() + "' "; } else { MensajeError += "El campo ID_PERFIL no puede ser nulo\n"; ejecutar = false; } #endregion validaciones if (ejecutar) { Conexion conexion = new Conexion(Empresa); try { identificador = conexion.ExecuteScalar(sql); #region auditoria auditoria _auditoria = new auditoria(Empresa); _auditoria.Adicionar(NombreUsuario, tabla.NOM_EMPLEADOS, tabla.ACCION_ADICIONAR, sql, informacion, conexion); #endregion auditoria } catch (Exception e) { MensajeError = e.Message; } finally { conexion.Desconectar(); } } if (!(String.IsNullOrEmpty(identificador))) return Convert.ToDecimal(identificador); else return 0; }