private void btnFiltrar_Click(object sender, EventArgs e) { if (Convert.ToDateTime(dtFechaDesde.Text) > Convert.ToDateTime(dtFechaHasta.Text)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "La fecha final no debe ser superior a la fecha inicial."; ok.ShowDialog(); dtFechaHasta.Text = sFecha; return; } llenarGrid(); }
private void btnBuscar_Click(object sender, EventArgs e) { if (txtNumeroFactura.Text.Trim() == "") { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Favor ingrese el número de factura a buscar."; ok.ShowDialog(); txtNumeroFactura.Focus(); return; } buscarFactura(); }
//CARGAR EL DIRECTORIO DONDE SE GUARDARAN LOS XML GENERADOS private bool buscarDirectorio() { try { //DIRECTORIOS DE LA FACTURACION ELECTRONICA sSql = ""; sSql += "select id_directorio, id_tipo_comprobante, orden, codigo, nombres" + Environment.NewLine; sSql += "from cel_directorio" + Environment.NewLine; sSql += "where id_tipo_comprobante = 1" + Environment.NewLine; sSql += "and estado = 'A'" + Environment.NewLine; sSql += "order by orden"; dtConsulta = new DataTable(); dtConsulta.Clear(); bRespuesta = conexion.GFun_Lo_Busca_Registro(dtConsulta, sSql); if (bRespuesta == false) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); return(false); } if (dtConsulta.Rows.Count < 4) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Los directorios para los archivos de facturación no se encuentran configurados."; ok.ShowDialog(); return(false); } sDirGenerados = dtConsulta.Rows[0]["nombres"].ToString(); sDirFirmados = dtConsulta.Rows[1]["nombres"].ToString(); sDirAutorizados = dtConsulta.Rows[2]["nombres"].ToString(); sDirNoAutorizados = dtConsulta.Rows[3]["nombres"].ToString(); consultarDirectoriosExistentes(); return(true); } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); return(false); } }
//ELIMINAR LA CAJDA private void eliminarRegistro(int iIdPosCierreCajero_P) { try { //INICIAMOS UNA NUEVA TRANSACCION if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error al abrir transacción"; ok.ShowDialog(); return; } sSql = ""; sSql += "update pos_cierre_cajero set" + Environment.NewLine; sSql += "motivo_anulacion = '" + sMotivo + "'," + Environment.NewLine; sSql += "estado = 'E'," + Environment.NewLine; sSql += "fecha_anula = getdate()," + Environment.NewLine; sSql += "usuario_anula = '" + Program.sDatosMaximo[0] + "'," + Environment.NewLine; sSql += "terminal_anula = '" + Program.sDatosMaximo[1] + "'" + Environment.NewLine; sSql += "where id_pos_cierre_cajero = " + iIdPosCierreCajero_P; //EJECUTA EL QUERY DE ACTUALIZACION if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA INSTRUCCION:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); return; } conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "El registro de caja se ha eliminado con éxito. Se recomienda reiniciar la aplicación."; ok.ShowDialog(); llenarComboLocalidades(); dgvDatos.Rows.Clear(); txtDesde.Focus(); return; } catch (Exception ex) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); } }
//FUNCION PARA ACTUALIZAR EN LA BASE DE DATOS private void actualizarRegistro() { try { //SE INICIA UNA TRANSACCION if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error al abrir transacción."; ok.ShowDialog(); limpiar(); return; } sSql = ""; sSql += "update pos_area_consumo_empleados set" + Environment.NewLine; sSql += "descripcion = '" + txtDescripcion.Text.Trim() + "'," + Environment.NewLine; sSql += "is_active = " + iHabilitado + Environment.NewLine; sSql += "where id_pos_area_consumo_empleados = " + iIdRegistro + Environment.NewLine; //EJECUTAR LA INSTRUCCIÓN SQL if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); goto reversa; } //SI SE EJECUTA TODO REALIZA EL COMMIT conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Registro actualizado éxitosamente."; ok.ShowDialog(); limpiar(); return; } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); goto reversa; } reversa: { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); } }
//ACTUALIZAR UN REGISTRO private void actualizarRegistro() { try { if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error al abrir transacción."; ok.ShowDialog(); return; } sSql = ""; sSql += "update pos_terminal set" + Environment.NewLine; sSql += "descripcion = '" + txtDescripcion.Text.Trim() + "'," + Environment.NewLine; sSql += "nombre_maquina = '" + txtNombreEquipo.Text.Trim() + "'," + Environment.NewLine; sSql += "ip_maquina = '" + TxtIPAsignada.Text.Trim() + "'," + Environment.NewLine; sSql += "vista_aplicacion = " + iVistaPrograma + "," + Environment.NewLine; sSql += "is_active = " + iHabilitado + Environment.NewLine; sSql += "where id_pos_terminal = " + iIdTerminal; if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = conexion.sMensajeError; catchMensaje.ShowDialog(); goto reversa; } //si no se ejecuta bien hara un commit conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Registro actualizado éxitosamente."; ok.ShowDialog(); btnNuevo.Text = "Nuevo"; grupoDatos.Enabled = false; limpiarCajasTexto(); limpiarTodo(); return; } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); } reversa : { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); } }
//FUNCION PARA VALIDAR private void validar() { if (txtNombreMesa.Text == "") { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Debe ingresar un nombre para identificar la mesa."; ok.ShowDialog(); txtNombreMesa.Focus(); return; } sNombreMesa = txtNombreMesa.Text.Trim(); this.DialogResult = DialogResult.OK; }
private void btnNuevaLinea_Click(object sender, EventArgs e) { if (txtOrden.Text.Trim() == "") { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Favor ingrese el número de orden para imprimir el reporte."; ok.ShowDialog(); txtOrden.Focus(); return; } if (Convert.ToInt32(txtOrden.Text.Trim()) == 0) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "El número de orden debe ser diferente a cero."; ok.ShowDialog(); txtOrden.Clear(); txtOrden.Focus(); return; } iBandera = 0; for (int i = 0; i < dgvDatos.Rows.Count; i++) { if (Convert.ToInt32(cmbReportes.SelectedValue) == Convert.ToInt32(dgvDatos.Rows[i].Cells[0].Value)) { iBandera = 1; break; } } if (iBandera == 1) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "El reporte seleccionado ya se encuentra ingresado."; ok.ShowDialog(); } else { dgvDatos.Rows.Add(cmbReportes.SelectedValue, "0", cmbLocalidades.SelectedValue, cmbReportes.Text.ToUpper(), txtOrden.Text.Trim(), "0"); } dgvDatos.ClearSelection(); cmbReportes.SelectedIndex = 0; txtOrden.Clear(); cmbReportes.Focus(); }
//FUNCION PARA ACTUALIZAR EL REGISTRO private void actualizarValoresSistema() { try { if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error al abrir transacción."; ok.ShowDialog(); enviarParametro(); return; } sSql = ""; sSql += "update pos_parametro set" + Environment.NewLine; sSql += "id_producto_modificador = " + dBAyudaModificadores.iId + "," + Environment.NewLine; sSql += "id_producto_domicilio = " + dBAyudaMovilizacion.iId + "," + Environment.NewLine; sSql += "id_producto_item = " + dBAyudaNuevoItem.iId + Environment.NewLine; sSql += "where id_pos_parametro = " + iIdParametro + Environment.NewLine; sSql += "and estado = 'A'"; //EJECUTAR LA INSTRUCCIÓN SQL if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = conexion.sMensajeError; catchMensaje.ShowDialog(); return; } //SI SE EJECUTA TODO REALIZA EL COMMIT conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Registro actualizado éxitosamente. Los cambios se aplicarán al reiniciar el programa."; ok.ShowDialog(); parametros.cargarParametros(); cargarParametros(); enviarParametro(); return; } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); } }
//FUNCION PARA ACTUALIZAR EN LA BASE DE DATOS private void actualizarRegistro() { try { //SE INICIA UNA TRANSACCION if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error al iniciar la transacción de actualización."; ok.ShowDialog(); limpiar(); return; } sSql = ""; sSql = sSql + "update pos_administracion_claves set" + Environment.NewLine; sSql = sSql + "clave_acceso = '" + txtClave.Text.Trim() + "'" + Environment.NewLine; sSql = sSql + "where id_pos_administracion_claves = " + iIdRegistro + Environment.NewLine; sSql = sSql + "and estado = 'A'"; //EJECUTAR LA INSTRUCCIÓN SQL if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); goto reversa; } //SI SE EJECUTA TODO REALIZA EL COMMIT conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Registro actualizado éxitosamente."; ok.ShowDialog(); limpiar(); return; } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); goto reversa; } reversa : { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); return; } }
//FUNCION PARA INSERTAR EL REGISTRO DE CIERRE DE CAJA private bool insertarCierreCajero(int iJornada_P) { try { if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Ocurrió un problema en la transacción. No se guardarán los cambios"; ok.ShowDialog(); return(false); } sFechaCorta = Program.sFechaSistema.ToString("yyyy-MM-dd"); sHora = DateTime.Now.ToString("HH:mm:ss"); sSql = ""; sSql += "insert into pos_cierre_cajero (" + Environment.NewLine; sSql += "id_localidad, id_jornada, id_cajero, fecha_apertura," + Environment.NewLine; sSql += "hora_apertura, estado_cierre_cajero, porcentaje_iva, porcentaje_servicio," + Environment.NewLine; sSql += "estado, fecha_ingreso, usuario_ingreso, terminal_ingreso)" + Environment.NewLine; sSql += "values (" + Environment.NewLine; sSql += Program.iIdLocalidad + ", " + iJornada_P + "," + Environment.NewLine; sSql += Program.CAJERO_ID + ", '" + sFechaCorta + "', '" + sHora + "', 'Abierta'," + Environment.NewLine; sSql += (Program.iva * 100) + ", " + (Program.servicio * 100) + ", 'A', GETDATE()," + Environment.NewLine; sSql += "'" + Program.sDatosMaximo[0] + "', '" + Program.sDatosMaximo[1] + "')"; //EJECUTAMOS LA INSTRUCCIÒN SQL if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); return(false); } conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); return(true); } catch (Exception ex) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); return(false); } }
private void dgvDatos_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvDatos.Columns[e.ColumnIndex].Name == "btnVer") { sNombreEmpleado = dgvDatos.Rows[e.RowIndex].Cells["empleado"].Value.ToString().Trim().ToUpper(); iIdPedido = Convert.ToInt32(dgvDatos.Rows[e.RowIndex].Cells["id_pedido"].Value); Empresa.frmVerPedidoActual ver = new Empresa.frmVerPedidoActual(sNombreEmpresa, sNombreEmpleado, iIdPedido); ver.ShowDialog(); } else if (dgvDatos.Columns[e.ColumnIndex].Name == "btnModificar") { iIdPersona_Editar = Convert.ToInt32(dgvDatos.Rows[e.RowIndex].Cells["id_persona"].Value); iIdEmpleado_Editar = Convert.ToInt32(dgvDatos.Rows[e.RowIndex].Cells["id_persona_empleado"].Value); sNombreEmpleado = dgvDatos.Rows[e.RowIndex].Cells["empleado"].Value.ToString().Trim().ToUpper(); iIdPedido = Convert.ToInt32(dgvDatos.Rows[e.RowIndex].Cells["id_pedido"].Value); sEstadoOrden = dgvDatos.Rows[e.RowIndex].Cells["estado"].Value.ToString().Trim().ToUpper(); if (sEstadoOrden == "PAGADA") { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "La comanda ya se encuentra pagada."; ok.ShowDialog(); } else { Empresa.frmEditarComandaEmpresarial editar = new Empresa.frmEditarComandaEmpresarial(iIdPersona_Editar, sNombreEmpresa, sNombreEmpleado, iIdEmpleado_Editar, iIdPedido); editar.ShowDialog(); if (editar.DialogResult == DialogResult.OK) { llenarGrid(); } } } dgvDatos.ClearSelection(); } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); } }
//Funcion para comprobar campos private bool comprobarCampos() { int iBandera = 0; if (txtCodigo.Text.Trim() == "") { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error: Debe ingresar el código de la bodega."; ok.ShowDialog(); txtCodigo.Focus(); iBandera = 1; } else if (txtDescripcion.Text.Trim() == "") { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error: Debe ingresar la descirpción de la bodega."; ok.ShowDialog(); txtDescripcion.Focus(); iBandera = 1; } else if (dbAyudaResponsable.iId == 0) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error: Debe seleccionar el responsable de la bodega."; ok.ShowDialog(); dbAyudaResponsable.Focus(); iBandera = 1; } else if (dbAyudaCategoria.iId == 0) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error: Debe seleccionar la categoría de la bodega."; ok.ShowDialog(); dbAyudaCategoria.Focus(); iBandera = 1; } if (iBandera == 1) { return(false); } else { return(true); } }
private void btnBuscar_Click(object sender, EventArgs e) { DateTime dtInicio = Convert.ToDateTime(txtDesde.Text.Trim()); DateTime dtFinal = Convert.ToDateTime(txtHasta.Text.Trim()); if (dtFinal < dtInicio) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "La fecha final no puede ser superior a la fecha inicial."; ok.ShowDialog(); return; } llenarGrid(); }
private void btnRemover_Click(object sender, EventArgs e) { if (dgvDatos.SelectedRows.Count > 0) { dgvDatos.Rows.Remove(dgvDatos.CurrentRow); dgvDatos.ClearSelection(); } else { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "No ha seleccionado ningún registro para remover."; ok.ShowDialog(); } }
//Función para actualizar el registro private void actualizarRegistro(int iBandera) { try { string sFechaEnviar = Convert.ToDateTime(txtFechaAplicacion.Text).ToString("yyyy-MM-dd"); string sAnio = sFechaEnviar.Substring(0, 4); string sMes = sFechaEnviar.Substring(5, 2); int iActualizar; if (iBandera == 0) { iActualizar = 1; } else { iActualizar = 2; } if (movimientos.realizarEgreso("EG", Convert.ToInt32(cmbBodega.SelectedValue), sAnio, sMes, "MOV", Convert.ToInt32(cmbMotivo.SelectedValue), dBAyudaProveedor.iId, dBAyudaPersona.iId, Convert.ToInt32(cmbOficina.SelectedValue), sFechaEnviar, txtComentarios.Text.Trim().ToUpper(), txtOrdenFabricacion.Text.Trim().ToUpper(), txtOrdenDisenio.Text.Trim().ToUpper(), txtNotaEntrega.Text.Trim().ToUpper(), 0, iActualizar, dBAyudaIngresoNumeros.iId, dBAyudaIngresoNumeros.txtIdentificacion.Text.Trim(), 1, dgvDetalleVenta, 7999) == true) { if (iBandera == 0) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Registro actualizado éxitosamente"; ok.ShowDialog(); return; } ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Registro eliminado éxitosamente"; ok.ShowDialog(); return; } } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); ok.lblMensaje.Text = ex.Message; ok.ShowDialog(); } }
//FUNCION PARA CONCATENAR private void concatenarValores(string sValor) { try { txtCodigo.Text = txtCodigo.Text + sValor; txtCodigo.Focus(); txtCodigo.SelectionStart = txtCodigo.Text.Trim().Length; } catch (Exception) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Ocurrió un problema al concatenar los valores."; ok.ShowDialog(); } }
private void btnPegar_Click(object sender, EventArgs e) { IDataObject iData = Clipboard.GetDataObject(); if (iData.GetDataPresent(DataFormats.Text)) { pegarSerial(); } else { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "No se pudieron recuperar datos del portapapeles."; ok.ShowDialog(); } }
//FUNCION PARA CONSULTAR EL TIPO DE EMISION CONFIGURADO EN EL SISTEMA private void consultarTipoEmision() { try { sSql = ""; sSql += "select TE.codigo" + Environment.NewLine; sSql += "from sis_empresa E,cel_tipo_emision TE" + Environment.NewLine; sSql += "where E.id_tipo_emision = TE.id_tipo_emision" + Environment.NewLine; sSql += "and E.estado = 'A'" + Environment.NewLine; sSql += "and TE.estado = 'A'" + Environment.NewLine; sSql += "order By TE.codigo"; dtConsulta = new DataTable(); dtConsulta.Clear(); bRespuesta = conexion.GFun_Lo_Busca_Registro(dtConsulta, sSql); if (bRespuesta == true) { if (dtConsulta.Rows.Count > 0) { sIdTipoEmision = dtConsulta.Rows[0][0].ToString(); } else { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "No se encuentra información de configuración del Tipo de Emisión"; ok.ShowDialog(); } } else { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); } } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); } }
//FUNCION PARA ACTUALIZAR LA BASE DE DATOS private void actualizaRegistro(int iIdParametro_P) { try { logoImagen = imagenAByte(imgLogo.Image); //INICIAMOS UNA NUEVA TRANSACCION if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "No se pudo iniciar la transacción para guardar el registro. Consulte con el administardor del sistema."; ok.ShowDialog(); return; } sSql = ""; sSql += "update cel_parametro set" + Environment.NewLine; sSql += "logo_comprobantes = convert(varbinary(8000), " + logoImagen + ")" + Environment.NewLine; sSql += "where id_cel_parametro = " + iIdParametro_P + Environment.NewLine; sSql += "and estado = 'A'"; //EJECUTA EL QUERY DE ACTUALIZACION if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA INSTRUCCION:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); return; } conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Registro actualizado éxitosamente."; ok.ShowDialog(); return; } catch (Exception ex) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); } }
private void btnFiltrar_Click(object sender, EventArgs e) { if (Convert.ToDateTime(dtFechaDesde.Text) > Convert.ToDateTime(dtFechaHasta.Text)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "La fecha final no debe ser superior a la fecha inicial."; ok.ShowDialog(); dtFechaHasta.Text = sFecha; return; } iIdLocalidad = Convert.ToInt32(cmbLocalidades.SelectedValue); sFechaDesde = Convert.ToDateTime(dtFechaDesde.Text).ToString("yyyy-MM-dd"); sFechaHasta = Convert.ToDateTime(dtFechaHasta.Text).ToString("yyyy-MM-dd"); llenarGrid(); }
private void dgvDatos_CellClick(object sender, DataGridViewCellEventArgs e) { this.Cursor = Cursors.WaitCursor; if (dgvDatos.Columns[e.ColumnIndex].Name == "eliminar_caja") { iIdPosCierreCajero = Convert.ToInt32(dgvDatos.Rows[e.RowIndex].Cells["id_cierre_cajero"].Value); if (contarRegistros(iIdPosCierreCajero) == false) { this.Cursor = Cursors.Default; dgvDatos.ClearSelection(); return; } if ((iCuentaMovimientos == 0) && (iCuentaComandas == 0)) { Cancelar_Orden.frmMotivoEliminacionComanda motivo = new Cancelar_Orden.frmMotivoEliminacionComanda(); motivo.ShowDialog(); if (motivo.DialogResult == DialogResult.OK) { sMotivo = motivo.txtMotivo.Text.Trim().ToUpper(); motivo.Close(); eliminarRegistro(iIdPosCierreCajero); this.Cursor = Cursors.Default; dgvDatos.ClearSelection(); } else { this.Cursor = Cursors.Default; } } else { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Existen comandas o movimientos de caja asociadas al registro por eliminar. No se procederá a la eliminación del registro."; ok.ShowDialog(); this.Cursor = Cursors.Default; dgvDatos.ClearSelection(); return; } } }
private void txtNumeroTarjeta_KeyPress(object sender, KeyPressEventArgs e) { caracter.soloNumeros(e); if (e.KeyChar == (char)Keys.Enter) { if (txtNumeroTarjeta.Text.Trim() == "") { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Favor ingrese el número de tarjeta a buscar."; ok.ShowDialog(); return; } consultarTarjeta(Convert.ToInt32(txtNumeroTarjeta.Text)); } }
//FUNCION PARA RECUPERAR LA PRIMERA JORNADA private int recuperarJornada(int iOrden_P) { try { sSql = ""; sSql += "select id_pos_jornada" + Environment.NewLine; sSql += "from pos_jornada" + Environment.NewLine; sSql += "where estado = 'A'" + Environment.NewLine; sSql += "and orden = " + iOrden_P; dtConsulta = new DataTable(); dtConsulta.Clear(); bRespuesta = conexion.GFun_Lo_Busca_Registro(dtConsulta, sSql); if (bRespuesta == false) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); return(-1); } if (dtConsulta.Rows.Count == 0) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "No se encuentran configuradas las jornadas. Favor comuníquese con el administrador."; ok.ShowDialog(); return(0); } else { return(Convert.ToInt32(dtConsulta.Rows[0]["id_pos_jornada"].ToString())); } } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); return(-1); } }
private void btnGrabar_Click(object sender, EventArgs e) { if (comprobarCodigo() == true) { if (verificarIngresoCodigo() == true) { if (verificarNuevosRegistros() == false) { SiNo = new VentanasMensajes.frmMensajeNuevoSiNo(); SiNo.lblMensaje.Text = ""; SiNo.ShowDialog(); if (SiNo.DialogResult == DialogResult.OK) { grabarRegistros(); if (rbtnActivos.Checked == false) { rbtnActivos.Checked = true; } } } else { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "No existen columnas modificadas a grabar."; ok.ShowDialog(); } } else { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Por favor, ingrese un código."; ok.ShowDialog(); } } else { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "El código ingresado ya existe."; ok.ShowDialog(); } }
private void btnRemover_Click(object sender, EventArgs e) { if (chkTodos.Checked == true) { for (int i = 0; i < dgvPedido.Rows.Count; i++) { dgvPedido.Rows[i].Cells["id_mascara"].Value = "0"; DataRow[] dFila = dtConsulta.Select("id_producto = " + dgvPedido.Rows[i].Cells["id_producto"].Value.ToString().Trim()); if (dFila.Length != 0) { dgvPedido.Rows[i].Cells["nombre_producto"].Value = dFila[0][1].ToString().Trim().ToUpper(); } } } else { if (dgvPedido.SelectedRows.Count > 0) { iNumeroFila = dgvPedido.CurrentRow.Index; dgvPedido.Rows[iNumeroFila].Cells["id_mascara"].Value = "0"; DataRow[] dFila = dtConsulta.Select("id_producto = " + dgvPedido.Rows[iNumeroFila].Cells["id_producto"].Value.ToString().Trim()); if (dFila.Length != 0) { dgvPedido.Rows[iNumeroFila].Cells["nombre_producto"].Value = dFila[0][1].ToString().Trim().ToUpper(); } } else { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "No ha seleccionado ninguna fila."; ok.ShowDialog(); return; } } dgvPedido.ClearSelection(); iNumeroFila = -1; }
private void zkFprint_OnCapture(object sender, IZKFPEngXEvents_OnCaptureEvent e) { string template = zk_dispositivo.EncodeTemplate1(e.aTemplate); string regTemplateString = ""; int iBandera = 0; foreach (DataGridViewRow row in dgvDatos.Rows) { iIdPersonaEmpresa = Convert.ToInt32(row.Cells[0].Value.ToString()); sNombreEmpresa = row.Cells[1].Value.ToString().Trim().ToUpper(); iIdPersonaEmpleado = Convert.ToInt32(row.Cells[2].Value.ToString()); sNombreEmpleado = row.Cells[3].Value.ToString().Trim().ToUpper(); regTemplateString = row.Cells[4].Value.ToString(); if (zk_dispositivo.VerFingerFromStr(ref template, regTemplateString, false, ref Check)) { iBandera = 1; break; } } if (iBandera == 1) { lblEmpresa.Text = sNombreEmpresa; lblEmpleado.Text = sNombreEmpleado; btnAceptar.Visible = true; btnAceptar.Focus(); } else { zk_dispositivo.CancelCapture(); lblEmpresa.Text = "EMPRESA"; lblEmpleado.Text = "EMPLEADO"; btnAceptar.Visible = false; ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "No se encuentra el registro. Favor intente nuevamente."; ok.ShowDialog(); zk_dispositivo.BeginCapture(); } }
//FUNCION PARA ACTUALIZAR private void actualizarRegistro() { try { //AQUI INICIA PROCESO DE ACTUALIZACION if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error al abrir transacción."; ok.ShowDialog(); limpiar(); return; } sSql = ""; sSql += "update pos_numero_lote set" + Environment.NewLine; sSql += "lote = '" + txtNuevoLote.Text.Trim() + "'" + Environment.NewLine; sSql += "where id_pos_numero_lote = " + iIdRegistro; if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); return; } conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Número de lote actualizado éxitosamente."; ok.ShowDialog(); limpiar(); return; } catch (Exception ex) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); } }
//ACTUALIZAR LA HUELLA EN EL SISTEMA private void eliminarHuella() { try { if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION)) { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Error al iniciar la transacción para actualizar el registro."; ok.ShowDialog(); return; } sSql = ""; sSql += "update pos_empleado_cliente set" + Environment.NewLine; sSql += "huella_dactilar = null" + Environment.NewLine; sSql += "where id_pos_empleado_cliente = " + iIdRegistro; if (!conexion.GFun_Lo_Ejecuta_SQL(sSql)) { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = "ERROR EN LA INSTRUCCION:" + Environment.NewLine + sSql; catchMensaje.ShowDialog(); return; } conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION); ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Registro actualizado éxitosamente."; ok.ShowDialog(); limpiar(); return; } catch (Exception ex) { catchMensaje = new VentanasMensajes.frmMensajeNuevoCatch(); catchMensaje.lblMensaje.Text = ex.Message; catchMensaje.ShowDialog(); } }
private void btnActualizar_Click(object sender, EventArgs e) { if (txtClave.Text.Trim() == "") { ok = new VentanasMensajes.frmMensajeNuevoOk(); ok.lblMensaje.Text = "Favor ingrese una clave para actualizar el registro."; ok.ShowDialog(); return; } SiNo = new VentanasMensajes.frmMensajeNuevoSiNo(); SiNo.lblMensaje.Text = "¿Está seguro que desea actualizar el registro?"; SiNo.ShowDialog(); if (SiNo.DialogResult == DialogResult.OK) { actualizarRegistro(); } }