private void dgvDispositivos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Hizo doble clic para modificar dispositivo "); ClsElote E = new ClsElote(); ClsNlote N = new ClsNlote(); ClsNproveedor Np = new ClsNproveedor(); DataTable data = N.MtdBusquedaLote(dgvLotes.CurrentRow.Cells[0].Value.ToString()); E.Codigo = data.Rows[0][0].ToString(); E.Nombre = data.Rows[0][1].ToString(); E.Color = data.Rows[0][2].ToString(); //para proveedor foreach (DataRow item in Np.MtdListarProveedores().Rows) { if (data.Rows[0][3].ToString() == item[0].ToString()) { E.Proveedor = item[1].ToString(); break; } } E.SistemaOperativo = data.Rows[0][4].ToString(); E.Cantidad = Convert.ToInt32(data.Rows[0][5].ToString()); E.Precio_unitario = Convert.ToDouble(data.Rows[0][6].ToString()); E.Forma = data.Rows[0][7].ToString(); E.Memoria = data.Rows[0][8].ToString(); E.Peso = Convert.ToDouble(data.Rows[0][9].ToString()); frmRegistroLote f = new frmRegistroLote(E.Codigo, E.Nombre, E.Color, E.Proveedor, E.SistemaOperativo, E.Cantidad, E.Precio_unitario, E.Forma, E.Memoria, E.Peso); f.ShowDialog(); dgvLotes.DataSource = N.MtdListarLotes(); }
private void dgvDispositivos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { string proveedor = ""; frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Hizo doble clic para modificar dispositivo "); ClsNlote N = new ClsNlote(); ClsNproveedor Np = new ClsNproveedor(); ClsElote E = null; foreach (ClsElote item in N.busquedaLote(dgvLotes.CurrentRow.Cells[0].Value.ToString())) { foreach (ClsEproveedor item1 in Np.listarProveedores()) { if (item.Ruc.Equals(item1.Ruc)) { proveedor = item1.Nombre; break; } } E = ClsElote.crear(item.CodLote, item.Nombre, item.Color, proveedor, item.Sistema_Operativo, item.Cantidad, item.Precio_Unitario, item.Forma, item.Memoria, item.Peso); } //para proveedor frmRegistroLote f = new frmRegistroLote(E); f.ShowDialog(); dgvLotes.DataSource = N.listarLotes(); }
private void btnModificar_Click(object sender, EventArgs e) { if (MtdValidarCampos()) { ClsElote E = ClsElote.crear(txtCodigo.Text, txtNombre.Text, txtColor.Text, lblProveedor.Text, txtSistemaOperativo.Text, Convert.ToInt32(txtCantidad.Text), Convert.ToDecimal(txtPrecio.Text), txtForma.Text, txtMemoriaInterna.Text, Convert.ToDecimal(txtPeso.Text)); ClsNlote N = new ClsNlote(); if (N.modificarLote(E)) { if (MessageBox.Show("Lote modificado correctamente, ¿Desea continuar en el formulario de registro de lotes?", "JeaNet - Informa", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { //generar codigo ClsNlote Ne = new ClsNlote(); //generar codigo frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Lote modificado satisfactoriamente " + btnModificar.Name); btnGuardar.Enabled = true; btnModificar.Enabled = false; MtdLimpiar(); MtdObtenerCodigo(); } else { this.Close(); } } else { MessageBox.Show("No se pudo modificar el lote, intente de nuevo o comuniquese con soporte.", "JeaNet - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Error al modificar dispositivo " + btnModificar.Name); } } }
private void btnGuardar_Click(object sender, EventArgs e) { if (MtdValidarCampos()) { ClsElote E = ClsElote.crear(txtCodigo.Text, txtNombre.Text, txtColor.Text, lblProveedor.Text, txtSistemaOperativo.Text, Convert.ToInt32(txtCantidad.Text), Convert.ToDecimal(txtPrecio.Text), txtForma.Text, txtMemoriaInterna.Text, Convert.ToDecimal(txtPeso.Text)); ClsNlote N = new ClsNlote(); if (N.agregarLote(E)) { ClsNdispositivo Ne = new ClsNdispositivo(); Ne.agregarDispositivos(E); //para guardar kardex ClsEkardex objEKardex = ClsEkardex.crear(txtCodigo.Text, frmAdministrador.data.Rows[0][0].ToString(), "ENTRADA", Convert.ToInt32(txtCantidad.Text), Convert.ToDecimal(txtPrecio.Text), "1", DateTime.Now.ToShortTimeString(), Convert.ToDateTime(DateTime.Now.ToShortDateString())); ClsNcomprobante objN = new ClsNcomprobante(); ClsNkardex nK = new ClsNkardex(); nK.agregarKardex(objEKardex); if (MessageBox.Show("Lote registrado correctamente, ¿Desea registrar otro lote?", "JeaNet - Informa", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Lote agregado satisfactoriamente " + btnGuardar.Name); //generar codigo MtdLimpiar(); MtdObtenerCodigo(); btnModificar.Enabled = false; } else { this.Close(); } } else { MessageBox.Show("No se pudo registrar el lote, intente de nuevo o comuniquese con soporte.", "JeaNet - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
internal bool MtdGuardarDispositivo(ClsElote en) { try { ClsConexionSQL objConexion = new ClsConexionSQL(); SqlCommand command = new SqlCommand(); SqlDataAdapter adapter = new SqlDataAdapter(); command.Connection = objConexion.Conectar(); command.CommandText = "USP_I_AgregarDispositivo"; command.Parameters.Add(new SqlParameter("lotser", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("lot", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("est", SqlDbType.VarChar)); for (int i = 1; i <= en.Cantidad; i++) { ClsEdispositivo En = new ClsEdispositivo(); En.Serie = MtdCalcularSerieDispositivo(en.Codigo, i); En.Lote = en.Codigo; En.Estado = "1"; command.CommandType = CommandType.StoredProcedure; command.Parameters["lotser"].Value = En.Serie; command.Parameters["lot"].Value = En.Lote; command.Parameters["est"].Value = En.Estado; command.ExecuteNonQuery(); } command.Connection = objConexion.Desconectar(); return(true); } catch (Exception ex) { return(false); throw ex; } }
public ArrayList busquedaLote(string codigoLote) { ArrayList lotes = new ArrayList(); foreach (var item in datos.busquedaLote(codigoLote)) { ClsElote lote = ClsElote.crear(item.CodLote, item.Nombre, item.Color, item.Ruc, item.Sistema_Operativo, item.Cantidad, item.Precio_Unitario, item.Forma, item.Memoria, item.Peso); lotes.Add(lote); } return(lotes); }
public ArrayList filtrarLotes(string filtro) { ArrayList lotes = new ArrayList(); foreach (var item in datos.filtrarLotes(filtro)) { ClsElote lote = ClsElote.crear(item.CodLote, item.Nombre, item.Color, item.Ruc, item.Sistema_Operativo, item.Cantidad, item.Precio_Unitario, item.Forma, item.Memoria, item.Peso); lotes.Add(lote); } return(lotes); }
private void btnGuardar_Click(object sender, EventArgs e) { if (MtdValidarCampos() == 0) { ClsElote E = new ClsElote(); ClsNlote N = new ClsNlote(); E.Codigo = txtCodigo.Text; E.Nombre = txtNombre.Text; E.Color = txtColor.Text; E.Proveedor = lblProveedor.Text; E.SistemaOperativo = txtSistemaOperativo.Text; E.Cantidad = Convert.ToInt32(txtCantidad.Text); E.Precio_unitario = Convert.ToDouble(txtPrecio.Text); E.Forma = txtForma.Text; E.Memoria = txtMemoriaInterna.Text; E.Peso = Convert.ToDouble(txtPeso.Text); if (N.MtdAgregarLote(E)) { ClsNdispositivo Ne = new ClsNdispositivo(); Ne.MtdGuardarDispositivo(E); //para guardar kardex ClsEkardex objEKardex = new ClsEkardex(); objEKardex.Codlote = txtCodigo.Text; objEKardex.DniEmpleado = frmAdministrador.data.Rows[0][0].ToString(); objEKardex.Descripcion = "ENTRADA"; objEKardex.Cantidad = Convert.ToInt32(txtCantidad.Text); objEKardex.PrecioUnitario = Convert.ToDouble(txtPrecio.Text); objEKardex.Estado = "1"; objEKardex.Hora = DateTime.Now.ToShortTimeString(); objEKardex.Fecha = Convert.ToDateTime(DateTime.Now.ToShortDateString()); ClsNcomprobante objN = new ClsNcomprobante(); objN.MtdAgregarKardex(objEKardex, "ENTRADA"); if (MessageBox.Show("Lote registrado correctamente, ¿Desea registrar otro lote?", "JeaNet - Informa", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Lote agregado satisfactoriamente " + btnGuardar.Name); //generar codigo MtdLimpiar(); MtdObtenerCodigo(); btnModificar.Enabled = false; } else { this.Close(); } } else { MessageBox.Show("No se pudo registrar el lote, intente de nuevo o comuniquese con soporte.", "JeaNet - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public bool agregarDispositivos(ClsElote en) { bool result = true; for (int i = 0; i < en.Cantidad; i++) { ClsEdispositivo dispositivo = ClsEdispositivo.crear(MtdCalcularSerieDispositivo(en.CodLote, i), en.CodLote, "1"); tbDispositivos tbl = tbDispositivos.crear(dispositivo.SerieDispositivo, dispositivo.CodLote, dispositivo.Estado); result = datos.agregarDispositivo(tbl) && result; } return(result); }
private void llenarCamposRegistroLote(ClsElote E) { txtCodigo.Text = E.CodLote; txtNombre.Text = E.Nombre; txtColor.Text = E.Color; cmbProveedor.Text = E.Ruc; txtSistemaOperativo.Text = E.Sistema_Operativo; txtCantidad.Text = E.Cantidad.ToString(); txtPrecio.Text = E.Precio_Unitario.ToString(); txtForma.Text = E.Forma; txtMemoriaInterna.Text = E.Memoria; txtPeso.Text = E.Peso.ToString(); txtCodigo.Enabled = false; btnGuardar.Enabled = false; }
internal void MtdDecrementarLote(ClsElote en) { ClsConexionSQL objConexion = new ClsConexionSQL(); SqlCommand objComando = new SqlCommand(); objComando.Connection = objConexion.Conectar(); objComando.CommandText = "USP_U_DecrementarCantidad"; objComando.CommandType = CommandType.StoredProcedure; objComando.Parameters.Add(new SqlParameter("cod", SqlDbType.VarChar)); objComando.Parameters.Add(new SqlParameter("can", SqlDbType.Int)); objComando.Parameters["cod"].Value = en.Codigo; objComando.Parameters["can"].Value = en.Cantidad; objComando.ExecuteNonQuery(); objComando.Connection = objConexion.Desconectar(); }
internal Boolean MtdAgregarLote(ClsElote e) { try { ClsConexionSQL objConexion = new ClsConexionSQL(); SqlCommand command = new SqlCommand(); SqlDataAdapter adapter = new SqlDataAdapter(); command.Connection = objConexion.Conectar(); command.CommandText = "USP_I_AgregarLote"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("cod", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("nom", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("col", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("pro", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("so", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("can", SqlDbType.Int)); command.Parameters.Add(new SqlParameter("pre", SqlDbType.Decimal)); command.Parameters.Add(new SqlParameter("for", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("mem", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("pes", SqlDbType.Decimal)); command.Parameters["cod"].Value = e.Codigo; command.Parameters["nom"].Value = e.Nombre; command.Parameters["col"].Value = e.Color; command.Parameters["pro"].Value = e.Proveedor; command.Parameters["so"].Value = e.SistemaOperativo; command.Parameters["can"].Value = e.Cantidad; command.Parameters["pre"].Value = e.Precio_unitario; command.Parameters["for"].Value = e.Forma; command.Parameters["mem"].Value = e.Memoria; command.Parameters["pes"].Value = e.Peso; command.ExecuteNonQuery(); command.Connection = objConexion.Desconectar(); return(true); } catch (Exception ex) { return(false); throw ex; } }
public bool agregarLote(ClsElote lote) { tbLotes tbl = tbLotes.crear(lote.CodLote, lote.Nombre, lote.Color, lote.Ruc, lote.Sistema_Operativo, lote.Cantidad, lote.Precio_Unitario, lote.Forma, lote.Memoria, lote.Peso); return(datos.agregarLote(tbl)); }
public bool decrementarCantidad(ClsElote lote) { tbLotes tbl = tbLotes.decrementar(lote.CodLote, lote.Cantidad); return(datos.decrementarLote(tbl)); }
private void pictureBox1_Click(object sender, EventArgs e) { if (MessageBox.Show("¿Seguro que desea concluir la venta?", "JeaNET - Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //para la venta ClsEcomprobante E = new ClsEcomprobante(); ClsNcomprobante N = new ClsNcomprobante(); E.Serie = lblSerie.Text; E.Numero = lblNumero.Text; E.Empleado = lblDNI.Text; E.Fecha = DateTime.Now.ToShortDateString(); if (lblCliente.Text.Length == 8) { E.Cliente = lblCliente.Text; } else { E.Cliente = txtCliente.Text; } E.Subtotal = lblSubtotal.Text; E.Igv = lblIGV.Text; E.Total = lblTotal.Text; E.Estado = "1"; N.MtdGuardarComprobante(E); //para el detalle foreach (DataGridViewRow item in dgvVenta.Rows) { //para guardar detalle ClsEdetallecomprobante Ed = new ClsEdetallecomprobante(); Ed.Serie = lblSerie.Text; Ed.Numero = lblNumero.Text; Ed.Codigo = item.Cells[0].Value.ToString(); Ed.Descripcion = item.Cells[1].Value.ToString(); Ed.Cantidad = Convert.ToInt32(item.Cells[2].Value); Ed.Precio_unitario = Convert.ToDecimal(item.Cells[3].Value); Ed.Importe = Convert.ToDecimal(item.Cells[4].Value); N.MtdGuardarDetalleComprobante(Ed); //listar dispositivos disponibles ClsNdispositivo Ne = new ClsNdispositivo(); DataTable Ddisponibles = Ne.MtdListarDisponibles(Ed); //para agreagar en cliente_dispositivo ClsNclientedispositivo Neg = new ClsNclientedispositivo(); Neg.MtdGuardarClienteDispositivo(E.Cliente, Ed, Ddisponibles); //para guardar kardex ClsEkardex objEKardex = new ClsEkardex(); objEKardex.Codlote = item.Cells[0].Value.ToString(); objEKardex.DniEmpleado = lblDNI.Text; objEKardex.Descripcion = "SALIDA"; objEKardex.Cantidad = Convert.ToInt32(item.Cells[2].Value); objEKardex.PrecioUnitario = Convert.ToDouble(item.Cells[3].Value); objEKardex.Estado = "1"; objEKardex.Hora = DateTime.Now.ToShortTimeString(); objEKardex.Fecha = Convert.ToDateTime(DateTime.Now.ToShortDateString()); N.MtdAgregarKardex(objEKardex, "SALIDA"); //para cambiar el estado de cada dispositivo Ne.MtdDesactivarDispositivos(Ddisponibles, Ed); } //para el decremento int cantidad = 0; foreach (DataGridViewRow fila in dgvVenta.Rows) { ClsElote En = new ClsElote(); ClsNlote Neg = new ClsNlote(); En.Codigo = fila.Cells[0].Value.ToString(); foreach (DataRow filas in Neg.MtdListarLotes().Rows) { if (filas[0].ToString() == fila.Cells[0].Value.ToString()) { cantidad = Convert.ToInt32(filas[5].ToString()); break; } } En.Cantidad = cantidad - Convert.ToInt32(fila.Cells[2].Value.ToString()); Neg.MtdDecrementarLote(En); } MtdReiniciar(); MessageBox.Show("Venta registrada con exito", "JeaNET - Informa", MessageBoxButtons.OK, MessageBoxIcon.Information); frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Realizo una venta"); } else { frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "No pudo realizar una venta"); } }
private void pictureBox1_Click(object sender, EventArgs e) { if (MessageBox.Show("¿Seguro que desea concluir la venta?", "JeaNET - Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //para la venta string cliente = (lblCliente.Text.Length == 8) ? lblCliente.Text : txtCliente.Text; ClsEcomprobante E = ClsEcomprobante.crear(lblSerie.Text, lblNumero.Text, lblDNI.Text, Convert.ToDateTime(DateTime.Now.ToShortDateString()), cliente, Convert.ToDecimal(lblSubtotal.Text), Convert.ToDecimal(lblIGV.Text), Convert.ToDecimal(lblTotal.Text), "1"); ClsNcomprobante N = new ClsNcomprobante(); N.agregarComprobante(E); //para el detalle foreach (DataGridViewRow item in dgvVenta.Rows) { //para guardar detalle ClsEdetallecomprobante Ed = ClsEdetallecomprobante.crear(lblSerie.Text, lblNumero.Text, item.Cells[0].Value.ToString(), item.Cells[1].Value.ToString(), Convert.ToInt32(item.Cells[2].Value), Convert.ToDecimal(item.Cells[3].Value), Convert.ToDecimal(item.Cells[4].Value)); N.agregarDetalleComprobante(Ed); //listar dispositivos disponibles ClsNdispositivo Ne = new ClsNdispositivo(); ArrayList disponibles = Ne.listarDispositivosDisponibles(Ed.CodigoLote); DataTable Ddisponibles = new DataTable(); Ddisponibles.Columns.Add("SerieDispositivo"); Ddisponibles.Columns.Add("CodLote"); Ddisponibles.Columns.Add("Estado"); foreach (ClsEdispositivo dispositivo in disponibles) { Ddisponibles.Rows.Add(dispositivo.SerieDispositivo, dispositivo.CodLote, dispositivo.Estado); } //para agregar en cliente_dispositivo ClsNclientedispositivo Neg = new ClsNclientedispositivo(); Neg.agregarClienteDispositivo(E.DniCliente, Ed, Ddisponibles); //para guardar kardex ClsNkardex Nk = new ClsNkardex(); ClsEkardex objEKardex = ClsEkardex.crear(item.Cells[0].Value.ToString(), lblDNI.Text, "SALIDA", Convert.ToInt32(item.Cells[2].Value), Convert.ToDecimal(item.Cells[3].Value), "1", DateTime.Now.ToShortTimeString(), Convert.ToDateTime(DateTime.Now.ToShortDateString())); Nk.agregarKardex(objEKardex); //para cambiar el estado de cada dispositivo Ne.desactivarDispositivos(Ed, Ddisponibles); } //para el decremento int cantidad = 0; foreach (DataGridViewRow fila in dgvVenta.Rows) { ClsNlote Neg = new ClsNlote(); foreach (ClsElote item in Neg.listarLotes()) { if (item.CodLote.Equals(fila.Cells[0].Value.ToString())) { cantidad = Convert.ToInt32(item.Cantidad); break; } } ClsElote En = ClsElote.decrementar(fila.Cells[0].Value.ToString(), cantidad - Convert.ToInt32(fila.Cells[2].Value.ToString())); Neg.decrementarCantidad(En); } MtdReiniciar(); MessageBox.Show("Venta registrada con exito", "JeaNET - Informa", MessageBoxButtons.OK, MessageBoxIcon.Information); frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Realizo una venta"); } else { frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "No pudo realizar una venta"); } }
public frmRegistroLote(ClsElote E) { InitializeComponent(); MtdCargarProveedores(); llenarCamposRegistroLote(E); }