Exemple #1
0
        internal bool MtdDesactivarDispositivos(DataTable ddisponibles, ClsEdetallecomprobante ed)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     command     = new SqlCommand();
                SqlDataAdapter adapter     = new SqlDataAdapter();
                command.Connection  = objConexion.Conectar();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "USP_U_ModificarEstadoDispositivo";
                command.Parameters.Add(new SqlParameter("lotser", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("est", SqlDbType.VarChar));
                for (int i = 0; i < ed.Cantidad; i++)
                {
                    command.Parameters["lotser"].Value = ddisponibles.Rows[i][0].ToString();
                    command.Parameters["est"].Value    = "0";
                    command.ExecuteNonQuery();
                }
                command.Connection = objConexion.Desconectar();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Exemple #2
0
        internal bool MtdGuardarClienteDispositivo(string dni, ClsEdetallecomprobante en, DataTable ddisponibles)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     command     = new SqlCommand();
                SqlDataAdapter adapter     = new SqlDataAdapter();
                command.Connection  = objConexion.Conectar();
                command.CommandText = "USP_I_AgregarClienteDispositivo";
                command.Parameters.Add(new SqlParameter("dcli", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("lotser", SqlDbType.VarChar));
                for (int i = 0; i < en.Cantidad; i++)
                {
                    ClsEclientedispositivo En = new ClsEclientedispositivo();
                    En.Serie_dispositivo               = ddisponibles.Rows[i][0].ToString();
                    En.Dni_cliente                     = dni;
                    command.CommandType                = CommandType.StoredProcedure;
                    command.Parameters["dcli"].Value   = En.Dni_cliente;
                    command.Parameters["lotser"].Value = En.Serie_dispositivo;
                    command.ExecuteNonQuery();
                }
                command.Connection = objConexion.Desconectar();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Exemple #3
0
        private void dgvComprobantes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Hizo doble clic en " + dgvComprobantes.Name + " para Listar los detales del comprobante en el " + dgvDetalleComprobante.Name);
            //listar detalle comprobante
            ClsNcomprobante        N = new ClsNcomprobante();
            ClsEdetallecomprobante E = ClsEdetallecomprobante.listar(dgvComprobantes.CurrentRow.Cells[0].Value.ToString(), dgvComprobantes.CurrentRow.Cells[1].Value.ToString());

            dgvDetalleComprobante.DataSource = N.listarDetallesComprobante(E);
        }
Exemple #4
0
        public object listarDetallesComprobante(ClsEdetallecomprobante detalleComprobante)
        {
            ArrayList detalleComprobantes = new ArrayList();

            foreach (var item in datos.listarDetalleComprobantes(detalleComprobante.Serie, detalleComprobante.Numero))
            {
                ClsEdetallecomprobante _DetalleComprobante = ClsEdetallecomprobante.crear(item.Serie, item.Numero, item.CodigoLote, item.Descripcion, item.Cantidad, item.Precio, item.Importe);
                detalleComprobantes.Add(_DetalleComprobante);
            }
            return(detalleComprobantes);
        }
        public bool agregarClienteDispositivo(string dni, ClsEdetallecomprobante detalleComprobante, DataTable disponibles)
        {
            bool result = true;

            for (int i = 0; i < detalleComprobante.Cantidad; i++)
            {
                ClsEclientedispositivo clienteDispositivo = ClsEclientedispositivo.crear(dni, disponibles.Rows[i][0].ToString());
                tbClienteDisposiivo    tbl = tbClienteDisposiivo.crear(clienteDispositivo.DniCliente, clienteDispositivo.SerieDispositivo);
                result = datos.agregarClienteDispositivo(tbl) && result;
            }
            return(result);
        }
Exemple #6
0
        public bool desactivarDispositivos(ClsEdetallecomprobante detalleComprobante, DataTable disponibles)
        {
            bool result = true;

            for (int i = 0; i < detalleComprobante.Cantidad; i++)
            {
                ClsEdispositivo dispositivo = ClsEdispositivo.crear(disponibles.Rows[i][0].ToString(), disponibles.Rows[i][1].ToString(), "0");
                tbDispositivos  tbl         = tbDispositivos.crear(dispositivo.SerieDispositivo, dispositivo.CodLote, dispositivo.Estado);
                result = datos.modificarEstado(tbl) && result;
            }
            return(result);
        }
Exemple #7
0
        internal DataTable MtdListarDisponibles(ClsEdetallecomprobante ed)
        {
            ClsConexionSQL conn    = new ClsConexionSQL();
            DataTable      result  = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlCommand     command = new SqlCommand();

            command.Connection  = conn.Conectar();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "USP_S_ListarDispositivosDisponibles";
            command.Parameters.Add(new SqlParameter("lot", SqlDbType.VarChar));
            command.Parameters["lot"].Value = ed.Codigo;
            command.ExecuteNonQuery();
            adapter.SelectCommand = command;
            adapter.Fill(result);
            command.Connection = conn.Desconectar();
            return(result);
        }
Exemple #8
0
        internal object MtdListarDetallesComprobante(ClsEdetallecomprobante e)
        {
            DataTable      data        = new DataTable();
            ClsConexionSQL objConexion = new ClsConexionSQL();
            SqlCommand     objComando  = new SqlCommand();
            SqlDataAdapter adapter     = new SqlDataAdapter();

            objComando.Connection  = objConexion.Conectar();
            objComando.CommandText = "USP_S_ListarDetallesComprobante";
            objComando.CommandType = CommandType.StoredProcedure;
            objComando.Parameters.Add(new SqlParameter("ser", SqlDbType.VarChar));
            objComando.Parameters.Add(new SqlParameter("num", SqlDbType.VarChar));
            objComando.Parameters["ser"].Value = e.Serie;
            objComando.Parameters["num"].Value = e.Numero;
            objComando.Connection = objConexion.Conectar();
            objComando.ExecuteNonQuery();
            adapter.SelectCommand = objComando;
            adapter.Fill(data);
            objComando.Connection = objConexion.Desconectar();

            return(data);
        }
Exemple #9
0
        internal Boolean MtdGuardarDetalleComprobante(ClsEdetallecomprobante ed)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     command     = new SqlCommand();
                SqlDataAdapter adapter     = new SqlDataAdapter();
                command.Connection  = objConexion.Conectar();
                command.CommandText = "USP_I_AgregarDetalleComprobante";
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("ser", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("num", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("cod", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("des", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("can", SqlDbType.Int));
                command.Parameters.Add(new SqlParameter("pre", SqlDbType.Decimal));
                command.Parameters.Add(new SqlParameter("imp", SqlDbType.Decimal));
                command.Parameters["ser"].Value = ed.Serie;
                command.Parameters["num"].Value = ed.Numero;
                command.Parameters["cod"].Value = ed.Codigo;
                command.Parameters["des"].Value = ed.Descripcion;
                command.Parameters["can"].Value = ed.Cantidad;
                command.Parameters["pre"].Value = ed.Precio_unitario;
                command.Parameters["imp"].Value = ed.Importe;
                command.ExecuteNonQuery();
                command.Connection = objConexion.Desconectar();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Exemple #10
0
        public Boolean agregarDetalleComprobante(ClsEdetallecomprobante detalleComprobante)
        {
            tbDetalleComprobante tbl = tbDetalleComprobante.crear(detalleComprobante.Serie, detalleComprobante.Numero, detalleComprobante.CodigoLote, detalleComprobante.Descripcion, detalleComprobante.Cantidad, detalleComprobante.Precio, detalleComprobante.Importe);

            return(datos.agregarDetalleComprobante(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");
            }
        }
Exemple #12
0
        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");
            }
        }