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 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 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 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 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 calcularTotalVentas() { double suma = 0; double tic = 0; double fac = 0; utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); DataTable dato = conexiones_BD.clases.ventas.ventas.ventas_diarias(fe.fechaCortaMysql(fecha)); foreach (DataRow fila in dato.Rows) { suma += Convert.ToDouble(fila[3].ToString()); char[] ti = fila[0].ToString().ToArray(); if (ti[0] == 'T') { tic += Convert.ToDouble(fila[3].ToString()); } else if (ti[0] == 'F') { fac += Convert.ToDouble(fila[3].ToString()); } } lblTotal.Text = String.Format("{0:c}", suma); lblTic.Text = String.Format("{0:c}", tic); lblFac.Text = String.Format("{0:c}", fac); }
private void cargarTodo() { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); Reportes.Diseño.reporteVentasaldia repo = new Reportes.Diseño.reporteVentasaldia(); repo.SetDataSource(conexiones_BD.clases.ventas.ventas.ventas_diarias(fe.fechaCortaMysql(fecha), sesion.DatosRegistro[1])); ventas.ReportSource = repo; calcularTotalVentas(); }
private void ventas_diarias_Load(object sender, EventArgs e) { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); Reportes.Diseño.reporteVentasaldia repo = new Reportes.Diseño.reporteVentasaldia(); repo.SetDataSource(conexiones_BD.clases.ventas.ventas.ventas_diarias(fe.fechaCortaMysql(fecha))); ventas.ReportSource = repo; calcularTotalVentas(); }
private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); Reportes.Diseño.reporteVentasaldia repo = new Reportes.Diseño.reporteVentasaldia(); repo.SetDataSource(conexiones_BD.clases.ventas.ventas.ventas_diarias(fe.fechaCortaMysql(fecha), sesion.DatosRegistro[1])); ventas.ReportSource = repo; calcularTotalVentas(); }
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 cargarTablas() { if (listaDocumentos.SelectedIndex == 0) { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); tabla = new utilitarios.cargar_tablas(tablaDocumentos, txtBuscar, conexiones_BD.clases.ventas.tickets.datosTabla(fe.fechaCortaMysql(fecha), sesion.DatosRegistro[1]), "correlativo"); tabla.cargarSinContadorRegistros(); } else { tablaDocumentos.DataSource = null; } }
private void cargar() { utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas(); DataTable docu = conexiones_BD.clases.ventas.tickets.datosTabla(fe.fechaCortaMysql(fecha), sesion.DatosRegistro[1]); if (listaDocumentos.SelectedIndex == 0) { if (docu.Rows.Count != 0) { utilitarios.cargandoListas.cargarLista(docu, listaDocu, "correlativo", "idventa"); listaDocu.SelectedIndex = 0; } } else { } }
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 void enviandoTraslado() { DataTable existencia = conexiones_BD.clases.traslados.traslado.exitsenciaCorrelativo(tabla_traslados.CurrentRow.Cells[6].Value.ToString()); utilitarios.maneja_fechas fech = new utilitarios.maneja_fechas(); conexiones_BD.clases.traslados.traslado tras = new conexiones_BD.clases.traslados.traslado( tabla_traslados.CurrentRow.Cells[0].Value.ToString(), tabla_traslados.CurrentRow.Cells[1].Value.ToString(), tabla_traslados.CurrentRow.Cells[2].Value.ToString(), tabla_traslados.CurrentRow.Cells[3].Value.ToString(), tabla_traslados.CurrentRow.Cells[4].Value.ToString(), "1", tabla_traslados.CurrentRow.Cells[6].Value.ToString()); conexiones_BD.operaciones op = new conexiones_BD.operaciones(); actualizandoPresentaciones_productos(); if (existencia.Rows.Count != 0) { if (op.transaccionRecepcionTraslado2(existencia.Rows[0][0].ToString(), retornoProductos(), registro) > 0) { MessageBox.Show("El traslado se actualizo éxitosamente", "Éxito", MessageBoxButtons.OK, MessageBoxIcon.Information); registro.Clear(); quitandoPresentaciones_detalles(); } else { MessageBox.Show("El traslado no se actualizo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (op.transaccionRecepcionTraslado(tras, retornoProductos(), registro) > 0) { MessageBox.Show("El traslado se ingreso éxitosamente", "Éxito", MessageBoxButtons.OK, MessageBoxIcon.Information); registro.Clear(); quitandoPresentaciones_detalles(); } else { MessageBox.Show("El traslado no se ingreso", "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(); } } } }