private void btnGuardar_Click(object sender, EventArgs e) { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); if (!validar()) { pro = new conexiones_BD.clases.productos( txtCodigo.Text, txtnombreP.Text.ToUpper(), fe.fechaMysql(fecha), "60", "53"); sp = new conexiones_BD.clases.sucursales_productos( sesion.DatosRegistro[1], "0", "2", "4", "1", "1000", precio.Value.ToString(), "0.0", "0.0", "0.0", "1"); op = new conexiones_BD.operaciones(); if (op.transaccionProductos_Presentaciones_Proveedores(generaProveedores(), generaPresentaciones(), pro, sp) > 0) { MessageBox.Show("El producto se ingreso", "Exíto", MessageBoxButtons.OK, MessageBoxIcon.Information); ingresado = true; xm._AñadirProductos(txtCodigo.Text, txtnombreP.Text.ToUpper(), fe.fechaMysql(fecha), "60", "53", Convert.ToInt16(sesion.DatosRegistro[0])); xm._AñadirSucursal_productos(sesion.DatosRegistro[1], "0", "2", "4", "1", "1000", precio.Value.ToString(), "0.0", "0.0", "0.0", "1", txtCodigo.Text, Convert.ToInt16(sesion.DatosRegistro[0])); xm._AñadirProvedores_productos("2", "0", txtCodigo.Text, Convert.ToInt16(sesion.DatosRegistro[0])); xm._AñadirPrese_prod("0", "1", "1", precio.Value.ToString(), "2", "2", txtCodigo.Text, Convert.ToInt16(sesion.DatosRegistro[0])); this.Close(); } else { MessageBox.Show("El producto no se pudo ingresar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void modifica() { if (!validar()) { if (!validarExistencias()) { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); cliente = new conexiones_BD.clases.clientes( idcliente, txtCodigo.Text, txtNombres.Text, txtApellidos.Text, txtDire.Text, txtDui.Text, txtNit.Text, txtNcr.Text, txtRazon.Text, txtTel.Text, txtEmail.Text, listaDes.SelectedValue.ToString(), fe.fechaMysql(fecha), listaGenero.SelectedIndex.ToString()); if (cliente.modificar(true) > 0) { habilitar(false); vaciarDatos(); cargarTablas(); } } } }
private void guardar() { if (!validar()) { if (!validarExistencias()) { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); cliente = new conexiones_BD.clases.clientes(txtCodigo.Text, txtNombres.Text, txtApellidos.Text, txtDire.Text, txtDui.Text, txtNit.Text, txtNcr.Text, txtRazon.Text, txtTel.Text, txtEmail.Text, listaDes.SelectedValue.ToString(), fe.fechaMysql(fecha), listaGenero.SelectedIndex.ToString()); if (cliente.guardar(true) > 0) { vaciarDatos(); cargarTablas(); if (nuevoClientes) { ingresado = true; this.Close(); } else { txtNombres.Focus(); } } } } }
private void btnGuardar_Click(object sender, EventArgs e) { if (!validar()) { if (!validarExistencias()) { utilitarios.maneja_fechas fech = new utilitarios.maneja_fechas(); cliente = new conexiones_BD.clases.clientes( codigo(), txtNombres.Text, txtApellidos.Text, txtDire.Text, "-", "-", "-", "-", "-", "-", "1", fech.fechaMysql(fecha), listaGenero.SelectedValue.ToString()); if (cliente.guardar(true) > 0) { ingresado = true; nombre = txtNombres.Text; this.Close(); } } } }
private void modifica() { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); string kar = "2"; if (!validar()) { if (!validarExistencias()) { if (chkKardex.Checked) { kar = "1"; } sp = new conexiones_BD.clases.sucursales_productos( this.idsucusal_producto, listaSucursal.SelectedValue.ToString(), this.idproducto, listaMayoreo.SelectedValue.ToString(), listaUtilidadDetalle.SelectedValue.ToString(), listaEstante.SelectedValue.ToString(), existencias.Value.ToString(), precioVD.Value.ToString(), precioCD.Value.ToString(), precioVM.Value.ToString(), precioCM.Value.ToString(), kar); pro = new conexiones_BD.clases.productos( txtCodigo.Text, txtnombreP.Text.ToUpper(), fe.fechaMysql(fecha), listaCategoria.SelectedValue.ToString(), listaMarca.SelectedValue.ToString(), this.idproducto); op = new conexiones_BD.operaciones(); if (op.EjecutartransaccionModificarProducto(sp, pro) > 0) { cargarTablas(); MessageBox.Show("Se actualizo con exíto", "Exíto", MessageBoxButtons.OK, MessageBoxIcon.Information); vaciar(); habilitar(false); } } } }
private bool anulando() { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); bool anulado = false; conexiones_BD.clases.ventas.tickets anu = new conexiones_BD.clases.ventas.tickets(listaDocu.SelectedValue.ToString(), "2"); conexiones_BD.clases.ventas.anulaciones anula = new conexiones_BD.clases.ventas.anulaciones(listaDocu.SelectedValue.ToString(), txtJustificacion.Text, listaVendedor.SelectedValue.ToString(), fe.fechaMysql(fec) ); conexiones_BD.operaciones op = new conexiones_BD.operaciones(); if (op.transaccionAnulacionVentaTic(anu, anula, modificaExistencias(conexiones_BD.clases.productos.EXISTENCIAS_PRODUCTOS_X_IDVENTA(listaDocu.SelectedValue.ToString()))) > 0) { MessageBox.Show("Ticket anulado con éxito", "éxito", MessageBoxButtons.OK, MessageBoxIcon.Information); anulado = true; } else { MessageBox.Show("Se produjo algun error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); anulado = false; } return(anulado); }
private void btnIngresar_Click(object sender, EventArgs e) { if (!validar()) { DataTable correlativos = conexiones_BD.clases.ventas.correlativos_tickets.datosTabla(listaSucursal.SelectedValue.ToString()); if (correlativos.Rows.Count == 0) { string activo; if (chekActivo.Checked) { activo = "1"; } else { activo = "2"; } utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); conexiones_BD.clases.ventas.correlativos_tickets co = new conexiones_BD.clases.ventas.correlativos_tickets(listaSucursal.SelectedValue.ToString(), numInicio.Value.ToString(), numFinal.Value.ToString(), "1", fe.fechaMysql(fecha), txtDescripcion.Text, activo ); if (co.guardar(true) > 0) { listaSucursal.SelectedValue = sesion.DatosRegistro[1]; txtDescripcion.Text = ""; chekActivo.Checked = false; cargar(); } } else { MessageBox.Show("No puedes ingresar un nuevo correlativo\n porque ya hay activos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void guarda() { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); string kar = "2"; if (!validar()) { if (!validarExistencias()) { pro = new conexiones_BD.clases.productos( txtCodigo.Text, txtnombreP.Text.ToUpper(), fe.fechaMysql(fecha), listaCategoria.SelectedValue.ToString(), listaMarca.SelectedValue.ToString()); if (chkKardex.Checked) { kar = "1"; } sp = new conexiones_BD.clases.sucursales_productos( listaSucursal.SelectedValue.ToString(), "0", listaMayoreo.SelectedValue.ToString(), listaUtilidadDetalle.SelectedValue.ToString(), listaEstante.SelectedValue.ToString(), existencias.Value.ToString(), precioVD.Value.ToString(), precioCD.Value.ToString(), precioVM.Value.ToString(), precioCM.Value.ToString(), kar); op = new conexiones_BD.operaciones(); if (op.transaccionProductos_Presentaciones_Proveedores(generaProveedores(), generaPresentaciones(), pro, sp) > 0) { MessageBox.Show("Los productos se ingresarón", "Exíto", MessageBoxButtons.OK, MessageBoxIcon.Information); xm._AñadirProductos(txtCodigo.Text, txtnombreP.Text.ToUpper(), fe.fechaMysql(fecha), listaCategoria.SelectedValue.ToString(), listaMarca.SelectedValue.ToString(), Convert.ToInt16(sesion.DatosRegistro[0])); xm._AñadirSucursal_productos( listaSucursal.SelectedValue.ToString(), "0", listaMayoreo.SelectedValue.ToString(), listaUtilidadDetalle.SelectedValue.ToString(), listaEstante.SelectedValue.ToString(), existencias.Value.ToString(), precioVD.Value.ToString(), precioCD.Value.ToString(), precioVM.Value.ToString(), precioCM.Value.ToString(), kar, txtCodigo.Text, Convert.ToInt16(sesion.DatosRegistro[0])); this.generarProveedoresBase_datos(); this.generaPresentancionesBase(); vaciar(); } else { MessageBox.Show("Los productos no se pudierón ingresar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void btnGuardar_Click(object sender, EventArgs e) { if (!this.modificar) { if (!validar()) { if (!validarExistencias()) { utilitarios.maneja_fechas fech = new utilitarios.maneja_fechas(); cliente = new conexiones_BD.clases.clientes( codigo(), txtNombres.Text, txtApellidos.Text, txtDire.Text, "-", "-", "-", "-", "-", "-", "1", fech.fechaMysql(fecha), listaGenero.SelectedValue.ToString(), "1"); long res = cliente.ingresandoCliente(true); if (res > 0) { idcliente = res.ToString(); System.Console.Write("El codigo asignado al cliente es: " + res); ingresado = true; nombre = txtNombres.Text; this.Close(); } else { MessageBox.Show("No se pudo ingresar"); } } } } else { if (!validar()) { conexiones_BD.clases.clientes cl = new conexiones_BD.clases.clientes( idcliente, txtNombres.Text, txtApellidos.Text, txtDire.Text, listaGenero.SelectedValue.ToString(), "1" ); if (cl.actualizarCliente()) { ingresado = true; nombre = txtNombres.Text; this.Close(); } } } }