Example #1
0
        private void TxtIDFactura_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                e.Handled = true;
            }
            else if (char.IsDigit(e.KeyChar))
            {
                e.Handled = false;
            }
            else if (char.IsControl(e.KeyChar))
            {
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
            if (TxtIDFactura.Text == "")
            {
                MessageBox.Show("INTRODUZCA EL ID DE LA VENTA");
                return;
            }
            else
            {
                MET_MostrarInformacionVenta();
                MET_MostrarDetalleVenta();

                if (DtvDatosFactura.Rows.Count > 0)
                {
                    TxtCliente.Text     = DtvDatosFactura.CurrentRow.Cells["NombreCliente"].Value.ToString();
                    TxtEmpleado.Text    = DtvDatosFactura.CurrentRow.Cells["NombreEmpleado"].Value.ToString();
                    TxtTipoVenta.Text   = DtvDatosFactura.CurrentRow.Cells["TipoVenta"].Value.ToString();
                    TxtFechaVenta.Text  = DtvDatosFactura.CurrentRow.Cells["FechaVenta"].Value.ToString();
                    V_IDCliente         = DtvDatosFactura.CurrentRow.Cells["ID_Cliente"].Value.ToString();
                    V_IDEmpleado        = DtvDatosFactura.CurrentRow.Cells["ID_Empleado"].Value.ToString();
                    BtnDevolver.Visible = true;
                    MET_CalcularITBIS_SUBTOTAL();
                }
            }
            if (DtvDatosFactura.Rows.Count != 0)
            {
                try
                {
                    CN_Acciones INST_InsertarDevolucion = new CN_Acciones();
                    INST_InsertarDevolucion.MET_InsertarDevolucion(Convert.ToInt32(TxtIDFactura.Text),
                                                                   Convert.ToInt32(V_IDCliente), Convert.ToInt32(V_IDEmpleado), LblFecha.Text,
                                                                   Convert.ToDouble(TxtCredito.Text));

                    MET_SacarIDDeolucion();
                    V_ID_Devolucion = DtvIDDevolucion.CurrentRow.Cells["ID"].Value.ToString();
                }
                catch (Exception)
                {
                    //MessageBox.Show("OCURRIO UN ERROR " + Error);
                    MessageBox.Show("Hay Un error en los datos introducidos.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Example #2
0
 private void MET_PrivilegiosUsuario()
 {
     if (Program.Cargo != 2)
     {
         BtnAgregar.Visible        = false;
         BtnBorrar.Visible         = false;
         BtnEditarProducto.Visible = false;
         CN_Acciones MostrarTablaDeProductos2 = new CN_Acciones();
         DtvProductos.DataSource = MostrarTablaDeProductos2.MostrarProductosCajero();
     }
 }
Example #3
0
        private void BtnCalcularDeuda_Click(object sender, EventArgs e)
        {
            if (TxtPago.Text == "")
            {
                LblErrorPago.Visible = true;
                return;
            }
            else if (Convert.ToDouble(TxtPago.Text) <= 0)
            {
                LblErrorPago.Text    = "CANTIDAD INCORECTA";
                LblErrorPago.Visible = true;
                return;
            }
            else if (Convert.ToDouble(TxtDeuda.Text) < Convert.ToDouble(TxtPago.Text))
            {
                LblErrorPago.Text    = "EL PAGO ES MAYOR QUE LA DEUDA";
                LblErrorPago.Visible = true;
                return;
            }
            else if (Convert.ToDouble(TxtPago.Text) <= Convert.ToDouble(TxtDeuda.Text))
            {
                Deuda                 = Convert.ToDouble(TxtDeuda.Text);
                Pago                  = Convert.ToDouble(TxtPago.Text);
                DeudaRestante         = Deuda - Pago;
                TxtDeudaRestante.Text = DeudaRestante.ToString();

                try
                {
                    CN_Acciones INST_InsertarPagoDeCuenta = new CN_Acciones();
                    INST_InsertarPagoDeCuenta.MET_InsertarPagoDeCuenta(Convert.ToInt32(V_IDCuentaPorCobrar),
                                                                       Convert.ToDouble(TxtDeudaRestante.Text));

                    MessageBox.Show("SE HA COMPLETADO LA TRANSACCION");
                    DtvClientes.Visible = true;
                    MET_MostrarClienteaDeudores();
                    MET_LimpiarTextBox();
                    DtvClientes.Visible             = true;
                    BtnEditarCliente.Visible        = true;
                    BtnBorrarCliente.Visible        = true;
                    BtnAgregarCliente.Visible       = true;
                    BtnClientes.Visible             = true;
                    BtnCalcularDeuda.Visible        = false;
                    DtvClientes.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                }
                catch (Exception)
                {
                    //MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + " LLAME A SOPORTE TECNICO");
                    MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Example #4
0
        public void MET_MostrarClientes()
        {
            CN_Acciones INST_MostrarTablaClientes = new CN_Acciones();

            DtvBusqueda.DataSource = INST_MostrarTablaClientes.MostrarCliente();
        }
Example #5
0
        private void BtnAgregarCliente_Click(object sender, EventArgs e)
        {
            if (DtvBusqueda.SelectedRows.Count > 0)
            {
                if (V_ConSaldo == true)
                {
                    TxtCliente.Text            = DtvBusqueda.CurrentRow.Cells["Nombre_Cliente"].Value.ToString();
                    TxtCedulaCliente.Text      = DtvBusqueda.CurrentRow.Cells["Cedula"].Value.ToString();
                    V_IDCliente                = DtvBusqueda.CurrentRow.Cells["ID_Cliente"].Value.ToString();
                    TxtSaldo.Text              = DtvBusqueda.CurrentRow.Cells["Credito"].Value.ToString();
                    V_IDCrediro                = DtvBusqueda.CurrentRow.Cells["ID_Devolucion"].Value.ToString();
                    TxtSaldo.Visible           = true;
                    LblSaldo.Visible           = true;
                    LspSaldo.Visible           = true;
                    BtnConDinero.Visible       = false;
                    BtnConSaldo.Visible        = false;
                    BtnAgregarProducto.Visible = true;
                }
                else if (V_ConSaldo == false)
                {
                    TxtCliente.Text            = DtvBusqueda.CurrentRow.Cells["Nombres"].Value.ToString() + " " + DtvBusqueda.CurrentRow.Cells["Apellidos"].Value.ToString();
                    TxtCedulaCliente.Text      = DtvBusqueda.CurrentRow.Cells["Cedula"].Value.ToString();
                    V_IDCliente                = DtvBusqueda.CurrentRow.Cells["ID_Cliente"].Value.ToString();
                    TxtSaldo.Visible           = false;
                    TxtSaldo.Text              = "0";
                    LblSaldo.Visible           = false;
                    LspSaldo.Visible           = false;
                    BtnConSaldo.Visible        = false;
                    BtnConDinero.Visible       = false;
                    BtnAgregarProducto.Visible = true;
                }
                if (V_EditarCliente == false)
                {
                    try
                    {
                        CN_Acciones INST_InsertarVenta = new CN_Acciones();
                        INST_InsertarVenta.MET_InsertarVenta(Program.ID_Empleados,
                                                             Convert.ToInt32(V_IDCliente),
                                                             RdbAlContado.Checked == true ? 1 : 2, LblFecha.Text,
                                                             Convert.ToDouble(TxtITBIS.Text),
                                                             Convert.ToDouble(TxtSUBTOTAL.Text),
                                                             Convert.ToDouble(TxtTotal.Text));

                        //MessageBox.Show("LOS DATOS FUERON INGRESADOS");
                        BtnAgregarProducto.Visible = true;
                        MET_SacarIDFactura();
                        TxtIDFactura.Text = DtvIDFactura.CurrentRow.Cells["ID"].Value.ToString();
                        V_IDFactura       = DtvIDFactura.CurrentRow.Cells["ID"].Value.ToString();

                        BtnAgregarCliente.Visible = false;
                        BtnCambiarCliente.Visible = true;
                        MET_MostrarProductos();
                    }
                    catch (Exception Error)
                    {
                        MessageBox.Show("OCURRIO UN ERROR " + Error);
                    }
                }
                else if (V_EditarCliente == true)
                {
                    try
                    {
                        CN_Acciones INST_EditarClienteFactura = new CN_Acciones();
                        if (DtvBusqueda.SelectedRows.Count > 0)
                        {
                            INST_EditarClienteFactura.MET_EditarClienteFactura(
                                Convert.ToInt32(V_IDCliente), V_IDFactura);
                            //MessageBox.Show("SE CAMBIO EL CLIENTE");
                            BtnAgregarCliente.Visible = false;
                            BtnCambiarCliente.Visible = true;
                            MET_MostrarProductos();
                            V_EditarCliente = false;
                        }
                    }
                    catch (Exception Error)
                    {
                        MessageBox.Show("OCURRIO UN ERROR " + Error);
                    }
                }
            }
            else
            {
                MessageBox.Show("POR FAVOR SELECCIONE AL CLIENTE AL QUE SE LE VA A VENDER");
            }
        }
Example #6
0
        private void BtnGuardarEmpleado_Click(object sender, EventArgs e)
        {
            if (V_Editar == false && V_Despedir == false)
            {
                try
                {
                    if (MtbCedula.MaskFull != true)
                    {
                        LblErrorCedula.Visible             = true;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        MtbCedula.Focus();
                        return;
                    }
                    else if (TxtNombreEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = true;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        TxtNombreEmpleado.Focus();
                        return;
                    }
                    else if (TxtApellidoEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = true;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        TxtApellidoEmpleado.Focus();
                        return;
                    }
                    else if (RdbMasculino.Checked != true && RdbFemenino.Checked != true)
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = true;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        return;
                    }
                    else if (MtbTelefono.MaskFull != true)
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = true;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        MtbTelefono.Focus();
                        return;
                    }
                    else if (TxtDireccionEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = true;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        TxtDireccionEmpleado.Focus();
                        return;
                    }
                    else if (V_Edad < 18)
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = true;
                        LblErrorFechaNacimiento.Text       = "EL EMPLEADO NO DEBES SER MENOR DE 18 AƑOS";
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        return;
                    }
                    else if (DtpFechaEntrada.Value.Date < DateTime.Now.Date)
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = true;
                        LblErrorFechaEntrada.Text          = "LA FECHA DE ENTRADA NO PUEDE SER MENOR A LA DE HOY";
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        return;
                    }
                    else if (TxtUsuarioEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = true;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        TxtUsuarioEmpleado.Focus();
                        return;
                    }
                    else if (TxtContrasenaEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = true;
                        LblErrorSueldo.Visible             = false;
                        TxtContrasenaEmpleado.Focus();
                        return;
                    }
                    else if (TxtSueldo.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = true;
                        TxtSueldo.Focus();
                        return;
                    }
                    else
                    {
                        MET_ActivarElementosDeInsertado_DesactivarElementosDeDespido();
                        CN_Acciones INST_InsertarEmpleado = new CN_Acciones();
                        INST_InsertarEmpleado.MET_InsertarDatosEmpleado(MtbCedula.Text,
                                                                        TxtNombreEmpleado.Text, TxtApellidoEmpleado.Text,
                                                                        RdbMasculino.Checked == true ? "M" : "F", MtbTelefono.Text,
                                                                        TxtDireccionEmpleado.Text, DtpFechaNacimiento.Text,
                                                                        Convert.ToInt32(CbbCargo.SelectedValue), DtpFechaEntrada.Text,
                                                                        TxtUsuarioEmpleado.Text, TxtContrasenaEmpleado.Text, DtpFechaSalida.Text,
                                                                        Convert.ToInt32(CbbStatus.SelectedValue), TxtSueldo.Text);

                        MessageBox.Show("SE INSERTO CORRECTAMENTE");

                        DtvEmpleados.Visible = true;
                        MET_LimpiarTextBox();
                        MET_LblInvisibles();
                        BtnGuardarEmpleado.Visible  = false;
                        BtnCancelarGuardado.Visible = false;
                        BtnAgregarEmpleado.Visible  = true;
                        BtnEditarEmpleado.Visible   = true;
                        BtnBorrarEmpleado.Visible   = true;
                        BtnDespedir.Visible         = true;
                        MET_MostrarEmpleados();
                    }
                }
                catch (Exception Error)
                {
                    MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + "/n LLAME A SOPORTE TECNICO");
                }
            }
            if (V_Editar == true)
            {
                try
                {
                    if (MtbCedula.MaskFull != true)
                    {
                        LblErrorCedula.Visible             = true;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        MtbCedula.Focus();
                        return;
                    }
                    else if (TxtNombreEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = true;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        TxtNombreEmpleado.Focus();
                        return;
                    }
                    else if (TxtApellidoEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = true;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        TxtApellidoEmpleado.Focus();
                        return;
                    }
                    else if (RdbMasculino.Checked != true && RdbFemenino.Checked != true)
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = true;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        return;
                    }
                    else if (MtbTelefono.MaskFull != true)
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = true;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        MtbTelefono.Focus();
                        return;
                    }
                    else if (TxtDireccionEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = true;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        TxtDireccionEmpleado.Focus();
                        return;
                    }
                    else if (V_Edad < 18)
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = true;
                        LblErrorFechaNacimiento.Text       = "EL EMPLEADO NO DEBES SER MENOR DE 18 AƑOS";
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        return;
                    }
                    else if (DtpFechaEntrada.Value.Date < DateTime.Now.Date)
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = true;
                        LblErrorFechaEntrada.Text          = "LA FECHA DE ENTRADA NO PUEDE SER MENOR A LA DE HOY";
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        return;
                    }
                    else if (TxtUsuarioEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = true;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = false;
                        TxtUsuarioEmpleado.Focus();
                        return;
                    }
                    else if (TxtContrasenaEmpleado.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = true;
                        LblErrorSueldo.Visible             = false;
                        TxtContrasenaEmpleado.Focus();
                        return;
                    }
                    else if (TxtSueldo.Text == "")
                    {
                        LblErrorCedula.Visible             = false;
                        LblErrorNombre.Visible             = false;
                        LblErrorApellido.Visible           = false;
                        LblErrorSexo.Visible               = false;
                        LblErrorTelefono.Visible           = false;
                        LblErrorFechaNacimiento.Visible    = false;
                        LblErrorDireccion.Visible          = false;
                        LblErrorStatus.Visible             = false;
                        LblErrorFechaEntrada.Visible       = false;
                        LblErrorCargo.Visible              = false;
                        LblErrorUsuarioEmpleado.Visible    = false;
                        LblErrorContrasenaEmpleado.Visible = false;
                        LblErrorSueldo.Visible             = true;
                        TxtSueldo.Focus();
                        return;
                    }
                    else
                    {
                        CN_Acciones INST_EditarEmpleado = new CN_Acciones();
                        if (DtvEmpleados.SelectedRows.Count > 0)
                        {
                            INST_EditarEmpleado.MET_EditarEmpleado(MtbCedula.Text,
                                                                   TxtNombreEmpleado.Text, TxtApellidoEmpleado.Text, RdbMasculino.Checked == true ? "M" : "F",
                                                                   MtbTelefono.Text, TxtDireccionEmpleado.Text, DtpFechaNacimiento.Text,
                                                                   Convert.ToInt32(CbbCargo.SelectedValue), DtpFechaEntrada.Text, TxtUsuarioEmpleado.Text,
                                                                   TxtContrasenaEmpleado.Text, DtpFechaSalida.Text,
                                                                   Convert.ToInt32(CbbStatus.SelectedValue), TxtSueldo.Text, V_IDEmpleado);

                            MessageBox.Show("SE EDITO CORRECTAMENTE");

                            DtvEmpleados.Visible = true;
                            MET_LimpiarTextBox();
                            MET_LblInvisibles();
                            V_Editar                    = false;
                            LblBuscar.Visible           = true;
                            TxtBuscarEmpleado.Visible   = true;
                            LspBuscar.Visible           = true;
                            BtnGuardarEmpleado.Visible  = false;
                            BtnCancelarGuardado.Visible = false;
                            BtnAgregarEmpleado.Visible  = true;
                            BtnEditarEmpleado.Visible   = true;
                            BtnBorrarEmpleado.Visible   = true;
                            BtnDespedir.Visible         = true;
                            MET_MostrarEmpleados();
                        }
                    }
                }
                catch (Exception Error)
                {
                    MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + "/n LLAME A SOPORTE TECNICO");
                }
            }
            if (V_Despedir == true)
            {
                try
                {
                    if (DtpFechaSalida.Value.Date > DateTime.Now.Date || DtpFechaSalida.Value.Date < DateTime.Now.Date)
                    {
                        LblErrorFechaSalida.Visible = true;
                        LblErrorFechaSalida.Text    = "LA FECHA DE SALIDA DEBE SER IGUAL A LA DE HOY";
                        return;
                    }
                    else if (CbbStatus.SelectedIndex <= 0)
                    {
                        LblErrorStatus.Visible      = true;
                        LblErrorFechaSalida.Visible = false;
                        return;
                    }
                    else
                    {
                        CN_Acciones INST_EditarEmpleado = new CN_Acciones();
                        if (DtvEmpleados.SelectedRows.Count > 0)
                        {
                            INST_EditarEmpleado.MET_EditarEmpleado(MtbCedula.Text,
                                                                   TxtNombreEmpleado.Text, TxtApellidoEmpleado.Text, RdbMasculino.Checked == true ? "M" : "F",
                                                                   MtbTelefono.Text, TxtDireccionEmpleado.Text, DtpFechaNacimiento.Text,
                                                                   Convert.ToInt32(CbbCargo.SelectedValue), DtpFechaEntrada.Text, TxtUsuarioEmpleado.Text,
                                                                   TxtContrasenaEmpleado.Text, DtpFechaSalida.Text,
                                                                   Convert.ToInt32(CbbStatus.SelectedValue), TxtSueldo.Text, V_IDEmpleado);

                            MessageBox.Show("EL EMPLEADO FUE DESPEDIDO");

                            DtvEmpleados.Visible = true;
                            MET_LimpiarTextBox();
                            MET_LblInvisibles();
                            V_Despedir                  = false;
                            LblBuscar.Visible           = true;
                            TxtBuscarEmpleado.Visible   = true;
                            LspBuscar.Visible           = true;
                            BtnGuardarEmpleado.Visible  = false;
                            BtnCancelarGuardado.Visible = false;
                            BtnAgregarEmpleado.Visible  = true;
                            BtnEditarEmpleado.Visible   = true;
                            BtnBorrarEmpleado.Visible   = true;
                            BtnDespedir.Visible         = true;
                            MET_MostrarEmpleados();
                        }
                    }
                }
                catch (Exception Error)
                {
                    MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + "/n LLAME A SOPORTE TECNICO");
                }
            }
        }
Example #7
0
        private void MET_MostrarDeudaCliente()
        {
            CN_Acciones MostrarTablaDeudaCliente = new CN_Acciones();

            DtvDeuda.DataSource = MostrarTablaDeudaCliente.MostrarDeudaCliente(V_IDCuentaPorCobrar);
        }
Example #8
0
        //
        public void MET_MostrarMarca()
        {
            CN_Acciones INST_MostrarMarcas = new CN_Acciones();

            DtvAnadir.DataSource = INST_MostrarMarcas.MET_MostrarMarcas();
        }
Example #9
0
        public void MET_MostrarCargo()
        {
            CN_Acciones INST_MostrarCargo = new CN_Acciones();

            DtvAnadir.DataSource = INST_MostrarCargo.MET_MostrarCargos();
        }
Example #10
0
        public void MET_MostrarStock()
        {
            CN_Acciones INST_MostrarStock = new CN_Acciones();

            DtvStock.DataSource = INST_MostrarStock.MET_MostrarStock(V_IDProducto);
        }
Example #11
0
        private void Txtcontrasena_KeyPress(object sender, KeyPressEventArgs e)
        {
            Txtcontrasena.PasswordChar = '*';
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                try
                {
                    CN_Acciones   LoguearUsuario = new CN_Acciones();
                    SqlDataReader Loguear;
                    LoguearUsuario.Usuario    = Txtusuario.Text;
                    LoguearUsuario.Contrasena = Txtcontrasena.Text;
                    if (LoguearUsuario.Usuario == Txtusuario.Text)
                    {
                        Lblerrorusuario.Visible = false;

                        if (LoguearUsuario.Contrasena == Txtcontrasena.Text)
                        {
                            Lblerrorcontrasena.Visible = false;

                            Loguear = LoguearUsuario.IniciarSesion();

                            if (Loguear.Read() == true)
                            {
                                this.Hide();
                                P_MenuPrincipal Pantalla = new P_MenuPrincipal();
                                Program.Cargo          = Convert.ToInt32(Loguear["Cargo"].ToString());
                                Program.Status         = Convert.ToInt32(Loguear["Estado"].ToString());
                                Program.NombreEmpleado = (Loguear["Nombre"].ToString() + " " + Loguear["Apellido"].ToString());
                                Program.ID_Empleados   = Convert.ToInt32(Loguear["ID_Empleado"].ToString());
                                if (Program.Status != 2)
                                {
                                    MessageBox.Show("USTED NO TIENE ACCESO AL SISTEMA");
                                    P_Login P = new P_Login();
                                    P.Show();
                                    return;
                                }
                                Pantalla.Show();
                            }
                            else
                            {
                                Lblerrorlogin.Text    = "Usuario o contraseƱa incorrectos. Intentelo de nuevo";
                                Lblerrorlogin.Visible = true;
                                Txtcontrasena.Clear();
                                BtnMostrarContrasena.Visible = false;
                                BtnocultarContrasena.Visible = false;
                                Txtcontrasena_Leave(null, e);
                                Txtusuario.Clear();
                                Txtusuario.Focus();
                            }
                        }
                        else
                        {
                            Lblerrorcontrasena.Text    = "Por favor ingrese su contraseƱa";
                            Lblerrorcontrasena.Visible = true;
                            Lblerrorlogin.Visible      = false;
                            Txtcontrasena.Focus();
                        }
                    }
                    else
                    {
                        Lblerrorusuario.Text    = "Por favor ingrese su nombre de usuario";
                        Lblerrorusuario.Visible = true;
                        Lblerrorlogin.Visible   = false;
                        Txtusuario.Focus();
                    }
                }
                catch (Exception Error)
                {
                    MessageBox.Show("No se pudo hacer la coneccion, comuniquese con servicio tecnico" + Error);
                }
            }
            else if (Txtcontrasena.Text == "")
            {
                BtnMostrarContrasena.Visible = false;
                BtnocultarContrasena.Visible = false;
            }
            else if (Txtcontrasena.Text != "")
            {
                BtnMostrarContrasena.Visible = true;
                BtnocultarContrasena.Visible = false;
            }
            else if (char.IsSeparator(e.KeyChar))
            {
                e.Handled = true;
            }
        }
Example #12
0
        private void MET_MostrarProductos()
        {
            CN_Acciones MostrarTablaDeProductos = new CN_Acciones();

            DtvProductos.DataSource = MostrarTablaDeProductos.MostrarProductos();
        }
Example #13
0
        //METODO PARA MOSTRAR A LOS CLIENTES QUE TIENEN DEUDAS
        private void MET_MostrarClienteaDeudores()
        {
            CN_Acciones MostrarTablaClientesDeudores = new CN_Acciones();

            DtvClientes.DataSource = MostrarTablaClientesDeudores.MostrarClientesDeudores();
        }
Example #14
0
        private void BtnGuardad_Click(object sender, EventArgs e)
        {
            if (V_Editar == false)
            {
                try
                {
                    if (CbbCategoriaProducto.SelectedIndex <= 0)
                    {
                        LblErrorCategoria.Visible    = true;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        return;
                    }
                    else if (CbbMarcaProducto.SelectedIndex <= 0)
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = true;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        return;
                    }
                    else if (TxtModeloProducto.Text == "")
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = true;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        TxtModeloProducto.Focus();
                        return;
                    }
                    else if (TxtStockProducto.Text == "")
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = true;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        TxtStockProducto.Focus();
                        return;
                    }
                    else if (TxtPrecioCompraProducto.Text == "")
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = true;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        TxtPrecioCompraProducto.Focus();
                        return;
                    }
                    else if (TxtPrecioVentaProducto.Text == "")
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = true;
                        LblErrorProveedor.Visible    = false;
                        TxtPrecioVentaProducto.Focus();
                        return;
                    }
                    else if (CbbProveedor.SelectedIndex <= 0)
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = true;
                        return;
                    }
                    else
                    {
                        CN_Acciones InsertarProducto = new CN_Acciones();
                        InsertarProducto.InsertarDatosProductos(
                            Convert.ToInt32(CbbCategoriaProducto.SelectedValue),
                            Convert.ToInt32(CbbMarcaProducto.SelectedValue),
                            TxtModeloProducto.Text,
                            TxtDescripcionProducto.Text,
                            TxtStockProducto.Text,
                            Convert.ToDouble(TxtPrecioCompraProducto.Text),
                            Convert.ToDouble(TxtPrecioVentaProducto.Text),
                            Convert.ToInt32(CbbProveedor.SelectedValue));

                        MessageBox.Show("SE INSERTO CORRECTAMENTE");

                        DtvProductos.Visible = true;
                        MET_LimpiarTextBox();
                        MET_LblInvisibles();
                        BtnGuardar.Visible           = false;
                        BtnCancelarInsertado.Visible = false;
                        BtnAgregar.Visible           = true;
                        BtnEditarProducto.Visible    = true;
                        BtnBorrar.Visible            = true;
                        LblBuscar.Visible            = true;
                        LspBuscar.Visible            = true;
                        TxtBuscarProducto.Visible    = true;
                        MET_MostrarProductos();
                    }
                }
                catch (Exception)
                {
                    //MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + "/n LLAME A SOPORTE TECNICO");
                    MessageBox.Show("Hay Un error en los datos introducidos.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            if (V_Editar == true)
            {
                try
                {
                    if (CbbCategoriaProducto.SelectedIndex <= 0)
                    {
                        LblErrorCategoria.Visible    = true;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        return;
                    }
                    else if (CbbMarcaProducto.SelectedIndex <= 0)
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = true;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        return;
                    }
                    else if (TxtModeloProducto.Text == "")
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = true;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        TxtModeloProducto.Focus();
                        return;
                    }
                    else if (TxtStockProducto.Text == "")
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = true;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        TxtStockProducto.Focus();
                        return;
                    }
                    else if (TxtPrecioCompraProducto.Text == "")
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = true;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = false;
                        TxtPrecioCompraProducto.Focus();
                        return;
                    }
                    else if (TxtPrecioVentaProducto.Text == "")
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = true;
                        LblErrorProveedor.Visible    = false;
                        TxtPrecioVentaProducto.Focus();
                        return;
                    }
                    else if (CbbProveedor.SelectedIndex <= 0)
                    {
                        LblErrorCategoria.Visible    = false;
                        LblErrorMarca.Visible        = false;
                        LblErrorModelo.Visible       = false;
                        LblErrorStock.Visible        = false;
                        LblErrorPrecioCompra.Visible = false;
                        LblErrorPrecioVenta.Visible  = false;
                        LblErrorProveedor.Visible    = true;
                        return;
                    }
                    else
                    {
                        CN_Acciones EditarProducto = new CN_Acciones();
                        if (DtvProductos.SelectedRows.Count > 0)
                        {
                            EditarProducto.EditarDatosProducto(Convert.ToInt32(CbbCategoriaProducto.SelectedValue),
                                                               Convert.ToInt32(CbbMarcaProducto.SelectedValue),
                                                               TxtModeloProducto.Text,
                                                               TxtDescripcionProducto.Text,
                                                               TxtStockProducto.Text,
                                                               Convert.ToDouble(TxtPrecioCompraProducto.Text),
                                                               Convert.ToDouble(TxtPrecioVentaProducto.Text),
                                                               Convert.ToInt32(CbbProveedor.SelectedValue), V_IDProducto);

                            MessageBox.Show("SE EDITO CORRECTAMENTE");

                            DtvProductos.Visible = true;
                            MET_LimpiarTextBox();
                            MET_LblInvisibles();
                            BtnGuardar.Visible         = false;
                            BtnCancelarEditado.Visible = false;
                            V_Editar = false;
                            MET_MostrarProductos();
                        }
                    }
                }
                catch (Exception)
                {
                    //MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + "/n LLAME A SOPORTE TECNICO");
                    MessageBox.Show("Hay Un error en los datos introducidos.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Example #15
0
        private void BtnGuardarProveedor_Click(object sender, EventArgs e)
        {
            if (V_Editar == false)
            {
                try
                {
                    if (TxtNombreContacto.Text == "")
                    {
                        LblErrorNombre.Visible           = true;
                        LblErrorNombreContacto.Visible   = false;
                        LblErrorTelefonoContacto.Visible = false;
                        LblErrorDireccionWeb.Visible     = false;
                        TxtNombreProveedor.Focus();
                        return;
                    }
                    else if (TxtNombreContacto.Text == "")
                    {
                        LblErrorNombre.Visible           = false;
                        LblErrorNombreContacto.Visible   = true;
                        LblErrorTelefonoContacto.Visible = false;
                        LblErrorDireccionWeb.Visible     = false;
                        TxtNombreContacto.Focus();
                        return;
                    }
                    else if (MtbTelefonoContacto.MaskFull != true)
                    {
                        LblErrorNombre.Visible           = false;
                        LblErrorNombreContacto.Visible   = false;
                        LblErrorTelefonoContacto.Visible = true;
                        LblErrorDireccionWeb.Visible     = false;
                        MtbTelefonoContacto.Focus();
                        return;
                    }
                    else if (TxtDireccionWeb.Text == "")
                    {
                        LblErrorNombre.Visible           = false;
                        LblErrorNombreContacto.Visible   = false;
                        LblErrorTelefonoContacto.Visible = false;
                        LblErrorDireccionWeb.Visible     = true;
                        TxtDireccionWeb.Focus();
                        return;
                    }
                    else
                    {
                        CN_Acciones INST_InsertarProveedor = new CN_Acciones();
                        INST_InsertarProveedor.MET_InsertarDatosProveedor(TxtNombreProveedor.Text,
                                                                          TxtNombreContacto.Text, MtbTelefonoContacto.Text, TxtDireccionWeb.Text);

                        MessageBox.Show("SE INSERTO CORRECTAMENTE");

                        MET_Limpiar();
                        MET_LblInvisibles();
                        DtvProveedor.Visible        = true;
                        BtnGuardarProveedor.Visible = false;
                        BtnEditarProveedor.Visible  = true;
                        BtnBorrarProveedor.Visible  = true;
                        BtnCancelarGuardado.Visible = false;
                        BtnAgregarProveedor.Visible = true;
                        MET_MostrarProveedor();
                    }
                }
                catch (Exception)
                {
                    //MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + " LLAME A SOPORTE TECNICO");
                    MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            if (V_Editar == true)
            {
                try
                {
                    if (TxtNombreContacto.Text == "")
                    {
                        LblErrorNombre.Visible           = true;
                        LblErrorNombreContacto.Visible   = false;
                        LblErrorTelefonoContacto.Visible = false;
                        LblErrorDireccionWeb.Visible     = false;
                        TxtNombreProveedor.Focus();
                        return;
                    }
                    else if (TxtNombreContacto.Text == "")
                    {
                        LblErrorNombre.Visible           = false;
                        LblErrorNombreContacto.Visible   = true;
                        LblErrorTelefonoContacto.Visible = false;
                        LblErrorDireccionWeb.Visible     = false;
                        TxtNombreContacto.Focus();
                        return;
                    }
                    else if (MtbTelefonoContacto.MaskFull != true)
                    {
                        LblErrorNombre.Visible           = false;
                        LblErrorNombreContacto.Visible   = false;
                        LblErrorTelefonoContacto.Visible = true;
                        LblErrorDireccionWeb.Visible     = false;
                        MtbTelefonoContacto.Focus();
                        return;
                    }
                    else if (TxtDireccionWeb.Text == "")
                    {
                        LblErrorNombre.Visible           = false;
                        LblErrorNombreContacto.Visible   = false;
                        LblErrorTelefonoContacto.Visible = false;
                        LblErrorDireccionWeb.Visible     = true;
                        TxtDireccionWeb.Focus();
                        return;
                    }
                    else
                    {
                        CN_Acciones INST_EditaProveedor = new CN_Acciones();
                        if (DtvProveedor.SelectedRows.Count > 0)
                        {
                            INST_EditaProveedor.MET_EditarDatosProveedor(TxtNombreProveedor.Text,
                                                                         TxtNombreContacto.Text, MtbTelefonoContacto.Text, TxtDireccionWeb.Text,
                                                                         V_IDProveedor);

                            MessageBox.Show("SE EDITO CORRECTAMENTE");

                            MET_Limpiar();
                            MET_LblInvisibles();
                            DtvProveedor.Visible        = true;
                            BtnGuardarProveedor.Visible = false;
                            BtnEditarProveedor.Visible  = true;
                            BtnBorrarProveedor.Visible  = true;
                            BtnCancelarGuardado.Visible = false;
                            BtnAgregarProveedor.Visible = true;
                            MET_MostrarProveedor();
                            V_Editar = false;
                        }
                    }
                }
                catch (Exception)
                {
                    //MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + " LLAME A SOPORTE TECNICO");
                    MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Example #16
0
        public void MET_MostrarProveedor()
        {
            CN_Acciones INST_MostrarProveedor = new CN_Acciones();

            DtvProveedor.DataSource = INST_MostrarProveedor.MET_MostrarTablaProveedor();
        }
Example #17
0
        public void MET_MostrarDetalleVenta()
        {
            CN_Acciones INST_MostrarTablaDetalleVenta = new CN_Acciones();

            DtvFactura.DataSource = INST_MostrarTablaDetalleVenta.MET_MostrarDetallesVentas(V_IDFactura);
        }
Example #18
0
        public void MET_MostrarClientesConCredito()
        {
            CN_Acciones INST_MostrarClientesConCredito = new CN_Acciones();

            DtvBusqueda.DataSource = INST_MostrarClientesConCredito.MET_MostrarClientesConCredito();
        }
Example #19
0
        private void BtnFacturar_Click(object sender, EventArgs e)
        {
            if (TxtIDFactura.Text == "")
            {
                MessageBox.Show("NO SE HA SELECCIONADO AL CLIENTE");
                return;
            }
            if (DtvFactura.Rows.Count > 0)
            {
                if (TxtIDFactura.Text == "")
                {
                    MessageBox.Show("NO SE HA GENERADO LA FACTURA");
                    return;
                }
                if (Convert.ToDouble(TxtITBIS.Text) == 0)
                {
                    MessageBox.Show("NO SE HA ELEGIDO NINGUN PRODUCTO");
                    return;
                }
                if (V_ConSaldo == false)
                {
                    if (TxtPago.Text == "")
                    {
                        LblErrorPago.Text    = "INTRODUZCA LA CANTIDAD A PAGAR";
                        LblErrorPago.Visible = true;
                        return;
                    }
                    if (Convert.ToDouble(TxtPago.Text) == 0)
                    {
                        LblErrorPago.Visible = true;
                        return;
                    }
                    else if (Convert.ToDouble(TxtPago.Text) <= 0)
                    {
                        LblErrorPago.Text    = "LA CANTIDAD A PAGAR NO DEBE SER 0";
                        LblErrorPago.Visible = true;
                        return;
                    }
                    else if (Convert.ToDouble(TxtPago.Text) < Convert.ToDouble(TxtTotal.Text))
                    {
                        LblErrorPago.Text    = "LA CANTIDAD A PAGAR NO PUEDE SER MENOR";
                        LblErrorPago.Visible = true;
                        return;
                    }
                    else if (Convert.ToDouble(TxtPago.Text) >= Convert.ToDouble(TxtTotal.Text))
                    {
                        V_Pago              = Convert.ToDouble(TxtPago.Text);
                        TotalVenta          = Convert.ToDouble(TxtTotal.Text);
                        Devuelta            = V_Pago - TotalVenta;
                        TxtDebuelta.Text    = Devuelta.ToString();
                        LblDevuelta.Visible = true;
                        LspDevuelta.Visible = true;
                        TxtDebuelta.Visible = true;

                        if (RdbACredito.Checked == true)
                        {
                            try
                            {
                                CN_Acciones INST_EditarFacturaFinal = new CN_Acciones();
                                INST_EditarFacturaFinal.MET_EditarFacturaFinal(
                                    RdbACredito.Checked == true ? 2 : 1,
                                    Convert.ToDouble(TxtITBIS.Text),
                                    Convert.ToDouble(TxtSUBTOTAL.Text),
                                    Convert.ToDouble(TxtTotal.Text),
                                    V_IDFactura);

                                MessageBox.Show("INGRESO FACTURA");
                                MET_MostrarFacturaImpresa();
                            }
                            catch (Exception)
                            {
                                //MessageBox.Show("OCURRIO UN ERROR " + Error);
                                MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                            try
                            {
                                CN_Acciones INST_InsertarCuentaPorCobrar = new CN_Acciones();
                                INST_InsertarCuentaPorCobrar.MET_InsertarCuentasProdCobrar(
                                    Convert.ToInt32(V_IDFactura), Convert.ToInt32(V_IDCliente),
                                    Convert.ToInt32(Program.ID_Empleados), LblFecha.Text,
                                    Convert.ToInt32(TxtTotal.Text));

                                MessageBox.Show("INGRESO CUENTA POR COBRAR");
                            }
                            catch (Exception)
                            {
                                //MessageBox.Show("OCURRIO UN ERROR " + Error);
                                MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                        else if (RdbAlContado.Checked == true)
                        {
                            try
                            {
                                CN_Acciones INST_EditarFacturaFinal = new CN_Acciones();
                                INST_EditarFacturaFinal.MET_EditarFacturaFinal(
                                    RdbAlContado.Checked == true ? 1 : 2,
                                    Convert.ToDouble(TxtITBIS.Text),
                                    Convert.ToDouble(TxtSUBTOTAL.Text),
                                    Convert.ToDouble(TxtTotal.Text),
                                    V_IDFactura);

                                MessageBox.Show("INGRESO FACTURA");
                                MET_MostrarFacturaImpresa();
                            }
                            catch (Exception)
                            {
                                //MessageBox.Show("OCURRIO UN ERROR " + Error);
                                MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                    }
                }
                else if (V_ConSaldo == true)
                {
                    if (TxtPago.Text == "")
                    {
                        MessageBox.Show("NO HA INTRODUCIDO EL PAGO");
                        return;
                    }
                    else if (Convert.ToDouble(TxtPago.Text) <= 0)
                    {
                        LblErrorPago.Text    = "LA CANTIDAD A PAGAR NO DEBE SER NEGATIVA O IGUAL A 0";
                        LblErrorPago.Visible = true;
                        return;
                    }
                    else if ((Convert.ToDouble(TxtPago.Text) + Convert.ToDouble(TxtSaldo.Text)) < Convert.ToDouble(TxtTotal.Text))
                    {
                        LblErrorPago.Text    = "LA CANTIDAD INTRODUCIDA NO ES SUFICIENTE PARA PAGAR";
                        LblErrorPago.Visible = true;
                        return;
                    }
                    else if ((Convert.ToDouble(TxtSaldo.Text) + Convert.ToDouble(TxtPago.Text)) >= Convert.ToDouble(TxtTotal.Text))
                    {
                        V_SALDO             = Convert.ToDouble(TxtSaldo.Text);
                        V_Pago              = Convert.ToDouble(TxtPago.Text);
                        TotalVenta          = Convert.ToDouble(TxtTotal.Text);
                        PagoMasCredito      = V_Pago + V_SALDO;
                        TxtSaldo.Text       = "0";
                        Devuelta            = PagoMasCredito - TotalVenta;
                        TxtDebuelta.Text    = Devuelta.ToString();
                        LblDevuelta.Visible = true;
                        LspDevuelta.Visible = true;
                        TxtDebuelta.Visible = true;
                    }
                    else if (Convert.ToDouble(TxtSaldo.Text) > Convert.ToDouble(TxtTotal.Text))
                    {
                        V_SALDO        = Convert.ToDouble(TxtSaldo.Text);
                        V_Pago         = Convert.ToDouble(TxtPago.Text);
                        TotalVenta     = Convert.ToDouble(TxtTotal.Text);
                        PagoMasCredito = V_Pago + V_SALDO;
                        TxtSaldo.Text  = Convert.ToString(TotalVenta - V_SALDO);
                        MessageBox.Show("EL CREDITO RESTANTE ES " + Convert.ToString(TotalVenta - V_SALDO));
                    }
                    if (RdbACredito.Checked == true)
                    {
                        try
                        {
                            CN_Acciones INST_EditarFacturaFinal = new CN_Acciones();
                            INST_EditarFacturaFinal.MET_EditarFacturaFinal(
                                RdbACredito.Checked == true ? 2 : 1,
                                Convert.ToDouble(TxtITBIS.Text),
                                Convert.ToDouble(TxtSUBTOTAL.Text),
                                Convert.ToDouble(TxtTotal.Text),
                                V_IDFactura);

                            MessageBox.Show("INGRESO FACTURA");
                            MET_MostrarFacturaImpresa();
                        }
                        catch (Exception)
                        {
                            //MessageBox.Show("OCURRIO UN ERROR " + Error);
                            MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        try
                        {
                            CN_Acciones INST_InsertarCuentaPorCobrar = new CN_Acciones();
                            INST_InsertarCuentaPorCobrar.MET_InsertarCuentasProdCobrar(
                                Convert.ToInt32(V_IDFactura), Convert.ToInt32(V_IDCliente),
                                Convert.ToInt32(Program.ID_Empleados), LblFecha.Text,
                                Convert.ToInt32(TxtTotal.Text));

                            MessageBox.Show("INGRESO CUENTA POR COBRAR");
                        }
                        catch (Exception)
                        {
                            //MessageBox.Show("OCURRIO UN ERROR " + Error);
                            MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                    else if (RdbAlContado.Checked == true)
                    {
                        try
                        {
                            CN_Acciones INST_EditarFacturaFinal = new CN_Acciones();
                            INST_EditarFacturaFinal.MET_EditarFacturaFinal(
                                RdbAlContado.Checked == true ? 1 : 2,
                                Convert.ToDouble(TxtITBIS.Text),
                                Convert.ToDouble(TxtSUBTOTAL.Text),
                                Convert.ToDouble(TxtTotal.Text),
                                V_IDFactura);

                            MessageBox.Show("INGRESO FACTURA");
                            MET_MostrarFacturaImpresa();
                        }
                        catch (Exception)
                        {
                            //MessageBox.Show("OCURRIO UN ERROR " + Error);
                            MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        try
                        {
                            CN_Acciones INST_EditarCrediro = new CN_Acciones();
                            INST_EditarCrediro.MET_EditarCredito(Convert.ToDouble(TxtSaldo.Text),
                                                                 Convert.ToInt32(V_IDCrediro));

                            MessageBox.Show("SE REDUJO EL CREDITO");
                        }
                        catch (Exception)
                        {
                            //MessageBox.Show("OCURRIO UN ERROR " + Error);
                            MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("NO HAY NINGUN PRODUCTO SELECCIONADO");
                return;
            }
            MET_NuevaFactura();
        }
Example #20
0
        private void Btnacceder_Click(object sender, EventArgs e)
        {
            try
            {
                CN_Acciones   LoguearUsuario = new CN_Acciones();
                SqlDataReader Loguear;
                LoguearUsuario.Usuario    = Txtusuario.Text;
                LoguearUsuario.Contrasena = Txtcontrasena.Text;
                if (LoguearUsuario.Usuario == Txtusuario.Text)
                {
                    Lblerrorusuario.Visible = false;

                    if (LoguearUsuario.Contrasena == Txtcontrasena.Text)
                    {
                        Lblerrorcontrasena.Visible = false;

                        Loguear = LoguearUsuario.IniciarSesion();
                        if (Loguear.Read() == true)
                        {
                            this.Hide();
                            P_MenuPrincipal Pantalla = new P_MenuPrincipal();
                            Program.Cargo  = Convert.ToInt32(Loguear["Cargo"].ToString());
                            Program.Status = Convert.ToInt32(Loguear["Estado"].ToString());
                            if (Program.Status != 2)
                            {
                                MessageBox.Show("USTED NO TIENE ACCESO AL SISTEMA");
                                P_Login P = new P_Login();
                                P.Show();
                                return;
                            }
                            Pantalla.Show();
                        }
                        else
                        {
                            Lblerrorlogin.Text    = "Usuario o contraseƱa incorrectos. Intentelo de nuevo";
                            Lblerrorlogin.Visible = true;
                            Txtcontrasena.Clear();
                            BtnMostrarContrasena.Visible = false;
                            BtnocultarContrasena.Visible = false;
                            Txtcontrasena_Leave(null, e);
                            Txtusuario.Clear();
                            Txtusuario.Focus();
                        }
                    }
                    else
                    {
                        Lblerrorcontrasena.Text    = "Por favor ingrese su contraseƱa";
                        Lblerrorcontrasena.Visible = true;
                        Lblerrorlogin.Visible      = false;
                        Txtcontrasena.Focus();
                    }
                }
                else
                {
                    Lblerrorusuario.Text    = "Por favor ingrese su nombre de usuario";
                    Lblerrorusuario.Visible = true;
                    Lblerrorlogin.Visible   = false;
                    Txtusuario.Focus();
                }
            }
            catch (Exception Error)
            {
                MessageBox.Show("No se pudo hacer la coneccion, comuniquese con servicio tecnico" + Error);
            }
        }
Example #21
0
        public void MET_MostrarProductos()
        {
            CN_Acciones MostrarTablaDeProductos2 = new CN_Acciones();

            DtvBusqueda.DataSource = MostrarTablaDeProductos2.MostrarProductosCajero();
        }
Example #22
0
        public void MET_MostrarInformacionVenta()
        {
            CN_Acciones INST_MostrarTablaInformacionVenta = new CN_Acciones();

            DtvDatosFactura.DataSource = INST_MostrarTablaInformacionVenta.MET_MostrarInformacionDeLaVenta(TxtIDFactura.Text);
        }
Example #23
0
        private void BtnConfirmarCantidad_Click(object sender, EventArgs e)
        {
            V_CantidadNuevaProducto = TxtCantidad.Text;
            V_IDProducto            = DtvFactura.CurrentRow.Cells["ID_Producto"].Value.ToString();
            MET_MostrarStock();
            V_Stock = DtvStock.CurrentRow.Cells["Stock"].Value.ToString();
            double PrecioProducto   = Convert.ToDouble(V_PrecioProducto);
            int    CantidadProducto = Convert.ToInt32(TxtCantidad.Text);

            V_ITBIS    = PrecioProducto * CantidadProducto * 0.18;
            V_SUBTOTAL = PrecioProducto * CantidadProducto;

            if (Convert.ToInt32(V_CantidadNuevaProducto) > Convert.ToInt32(V_CantidadProductoDetalle))
            {
                try
                {
                    CN_Acciones INST_AumentarCantidadProductoVenta = new CN_Acciones();
                    INST_AumentarCantidadProductoVenta.MET_InsertarMayorCantidadProducto(
                        Convert.ToInt32(V_IDProducto), Convert.ToInt32(V_CantidadNuevaProducto),
                        Convert.ToDouble(V_ITBIS), Convert.ToDouble(V_SUBTOTAL),
                        Convert.ToInt32(V_IDDetalleVenta));

                    TxtCantidad.Text = "1";
                    MET_MostrarDetalleVenta();
                    MET_MostrarProductos();
                    BtnConfirmarCantidad.Visible = false;
                    LblErrorCantidad.Visible     = false;
                    TotalITBIS    = 0;
                    TotalSUBTOTAL = 0;
                    TotalVenta    = 0;
                    MET_CalcularITBIS_SUBTOTAL();
                }
                catch (Exception)
                {
                    //MessageBox.Show("OCURRIO UN ERROR " + Error);
                    MessageBox.Show("Hay Un error en los datos introducidos.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else if (Convert.ToInt32(V_CantidadNuevaProducto) < Convert.ToInt32(V_CantidadProductoDetalle))
            {
                if (TxtCantidad.Text != "")
                {
                    try
                    {
                        CN_Acciones INST_DisminuirCantidadProductoVenta = new CN_Acciones();
                        INST_DisminuirCantidadProductoVenta.MET_InsertarMenorCantidadProducto(
                            Convert.ToInt32(V_IDProducto), Convert.ToInt32(V_CantidadNuevaProducto),
                            Convert.ToDouble(V_ITBIS), Convert.ToDouble(V_SUBTOTAL),
                            Convert.ToInt32(V_IDDetalleVenta));

                        TxtCantidad.Text = "1";
                        MET_MostrarDetalleVenta();
                        MET_MostrarProductos();
                        //DtvStock.Rows.Clear();
                        BtnConfirmarCantidad.Visible = false;
                        LblErrorCantidad.Visible     = false;
                        TotalITBIS    = 0;
                        TotalSUBTOTAL = 0;
                        TotalVenta    = 0;
                        MET_CalcularITBIS_SUBTOTAL();
                    }
                    catch (Exception)
                    {
                        //MessageBox.Show("OCURRIO UN ERROR " + Error);
                        MessageBox.Show("Hay Un error en los datos introducidos.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
        }
Example #24
0
        public void MET_SacarIDDeolucion()
        {
            CN_Acciones INST_SacarIDDevolucion = new CN_Acciones();

            DtvIDDevolucion.DataSource = INST_SacarIDDevolucion.MET_Mostrar_IDDevolucion();
        }
Example #25
0
        public void MET_MostrarCategoria()
        {
            CN_Acciones INST_MostrarCategoria = new CN_Acciones();

            DtvAnadir.DataSource = INST_MostrarCategoria.MET_MostrarCategoria();
        }
Example #26
0
        private void BtnDevolver_Click(object sender, EventArgs e)
        {
            BtnBuscar.Visible     = false;
            BtnListo.Visible      = true;
            TxtIDFactura.ReadOnly = true;

            if (DtvDetallesVenta.SelectedRows.Count > 0)
            {
                V_IDDetalleVenta          = DtvDetallesVenta.CurrentRow.Cells["ID_DetalleVenta"].Value.ToString();
                V_IDProducto              = DtvDetallesVenta.CurrentRow.Cells["ID_Producto"].Value.ToString();
                V_CantidadProductoDetalle = DtvDetallesVenta.CurrentRow.Cells["Cantidad"].Value.ToString();
                V_PrecioProducto          = DtvDetallesVenta.CurrentRow.Cells["Precio"].Value.ToString();

                if (Convert.ToInt32(TxtCantidadADevolver.Text) == Convert.ToInt32(V_CantidadProductoDetalle))
                {
                    //ELIMINA EL PRODUCTO DE LOS DETALLES DE VENTA SI SE DEVUELVE TODO
                    CN_Acciones INST_DevolverTodoProductoDetalleVenta = new CN_Acciones();
                    INST_DevolverTodoProductoDetalleVenta.MET_EliminarProductoDetalleVenta(V_IDDetalleVenta,
                                                                                           V_IDProducto, V_CantidadProductoDetalle);

                    try
                    {
                        CN_Acciones INST_Insertar_Detalle_Devolucion = new CN_Acciones();
                        INST_Insertar_Detalle_Devolucion.MET_InsertarDetalleDevolucion(Convert.ToInt32(V_ID_Devolucion),
                                                                                       Convert.ToInt32(TxtIDFactura.Text), Convert.ToInt32(V_IDDetalleVenta),
                                                                                       Convert.ToInt32(V_IDProducto), Convert.ToDouble(V_PrecioProducto),
                                                                                       Convert.ToInt32(TxtCantidadADevolver.Text));

                        MET_MostrarDetalleVenta();
                        MET_CalcularITBIS_SUBTOTAL();
                    }
                    catch (Exception Error)
                    {
                        MessageBox.Show("OCURRIO UN ERROR " + Error);
                    }
                    try
                    {
                        //EDITA LA FACTURA SI SE ELIMINA SI SE DEVUELDE UN EL PRODUCTO
                        CN_Acciones INST_EditarFacturaDevolucion = new CN_Acciones();
                        INST_EditarFacturaDevolucion.MET_EditarFacturaDevolucion(
                            Convert.ToDouble(TxtITBIS.Text),
                            Convert.ToDouble(TxtSUBTOTAL.Text),
                            Convert.ToDouble(TxtTotal.Text),
                            TxtIDFactura.Text);

                        MessageBox.Show("SE EDITO LA FACTURA");
                    }
                    catch (Exception Error)
                    {
                        MessageBox.Show("OCURRIO UN ERROR " + Error);
                    }

                    TotalCredito   += (Convert.ToDouble(V_PrecioProducto) * Convert.ToInt32(TxtCantidadADevolver.Text));
                    TxtCredito.Text = Convert.ToString(TotalCredito);

                    try
                    {
                        CN_Acciones INST_EditarDevolucionAgregarCredito = new CN_Acciones();
                        INST_EditarDevolucionAgregarCredito.MET_EditarDevolucionAgregarCredito(
                            Convert.ToDouble(TxtCredito.Text), Convert.ToInt32(V_ID_Devolucion));
                    }
                    catch (Exception Error)
                    {
                        MessageBox.Show("OCURRIO UN ERROR " + Error);
                    }
                }
                else if (Convert.ToInt32(TxtCantidadADevolver.Text) > Convert.ToInt32(V_CantidadProductoDetalle))
                {
                    MessageBox.Show("LA ANTIDAD A DEVOLVER NO PUEDE SER MAYOR QUE LA CANTIDAD DE PRODUCTO VENDIDA");
                    return;
                }
                else if (Convert.ToInt32(TxtCantidadADevolver.Text) < Convert.ToInt32(V_CantidadProductoDetalle))
                {
                    try
                    {
                        CN_Acciones INST_DevolverMenosProductoDetalleVenta = new CN_Acciones();
                        INST_DevolverMenosProductoDetalleVenta.MET_InsertarDetalleDevolucionCuandoNoSeDevuelveTodo(
                            Convert.ToInt32(V_ID_Devolucion), Convert.ToInt32(TxtIDFactura.Text),
                            Convert.ToInt32(V_IDDetalleVenta), Convert.ToInt32(V_IDProducto),
                            Convert.ToDouble(V_PrecioProducto), Convert.ToInt32(TxtCantidadADevolver.Text));

                        MET_MostrarDetalleVenta();
                        MET_CalcularITBIS_SUBTOTAL();
                    }
                    catch (Exception Error)
                    {
                        MessageBox.Show("OCURRIO UN ERROR " + Error);
                    }
                    try
                    {
                        //EDITA LA FACTURA SI SE ELIMINA SI SE DEVUELDE UN EL PRODUCTO
                        CN_Acciones INST_EditarFacturaDevolucion = new CN_Acciones();
                        INST_EditarFacturaDevolucion.MET_EditarFacturaDevolucion(
                            Convert.ToDouble(TxtITBIS.Text),
                            Convert.ToDouble(TxtSUBTOTAL.Text),
                            Convert.ToDouble(TxtTotal.Text),
                            TxtIDFactura.Text);

                        MessageBox.Show("SE EDITO LA FACTURA");
                    }
                    catch (Exception Error)
                    {
                        MessageBox.Show("OCURRIO UN ERROR " + Error);
                    }
                }

                TotalCredito   += (Convert.ToDouble(V_PrecioProducto) * Convert.ToInt32(TxtCantidadADevolver.Text));
                TxtCredito.Text = Convert.ToString(TotalCredito);

                try
                {
                    CN_Acciones INST_EditarDevolucionAgregarCredito = new CN_Acciones();
                    INST_EditarDevolucionAgregarCredito.MET_EditarDevolucionAgregarCredito(
                        Convert.ToDouble(TxtCredito.Text), Convert.ToInt32(V_ID_Devolucion));
                }
                catch (Exception Error)
                {
                    MessageBox.Show("OCURRIO UN ERROR " + Error);
                }

                MessageBox.Show("SE DEVOLVIO EL PRODUCTO");
                //MET_MostrarDetalleVenta();
                //MET_CalcularITBIS_SUBTOTAL();
            }
            else
            {
                MessageBox.Show("SELECCIONE EL PRODUCTO QUE DESEA ELIMINAR DE LA FACTURA");
            }
            MET_MostrarDevolucionImpresa();
        }
Example #27
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            BtnAgregar.Visible  = true;
            BtnCancelar.Visible = false;
            BtnGuardar.Visible  = false;

            if (Marca == true)
            {
                if (TxtAnadir.Text != "")
                {
                    try
                    {
                        CN_Acciones INST_InsertarMarca = new CN_Acciones();
                        INST_InsertarMarca.MET_InsertarMarca(TxtAnadir.Text);
                        MET_MostrarMarca();
                    }
                    catch (Exception)
                    {
                        //MessageBox.Show("OCURRIO UN ERROR" + Error);
                        MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    LblErrorElemento.Visible = true;
                    LblErrorElemento.Text    = "ESTE CAMPO NO PUEDE ESTAR VACIO";
                    return;
                }
            }
            else if (Categoria == true)
            {
                if (TxtAnadir.Text != "")
                {
                    try
                    {
                        CN_Acciones INST_InsertarCategoria = new CN_Acciones();
                        INST_InsertarCategoria.MET_InsertarCategoria(TxtAnadir.Text);
                        MET_MostrarCategoria();
                    }
                    catch (Exception)
                    {
                        //MessageBox.Show("OCURRIO UN ERROR" + Error);
                        MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    LblErrorElemento.Visible = true;
                    LblErrorElemento.Text    = "ESTE CAMPO NO PUEDE ESTAR VACIO";
                    return;
                }
            }
            else if (Cargo == true)
            {
                if (TxtAnadir.Text != "")
                {
                    try
                    {
                        CN_Acciones INST_InsertarCargo = new CN_Acciones();
                        INST_InsertarCargo.MET_InsertarCargo(TxtAnadir.Text);
                        MET_MostrarCargo();
                    }
                    catch (Exception)
                    {
                        //MessageBox.Show("OCURRIO UN ERROR" + Error);
                        MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    LblErrorElemento.Visible = true;
                    LblErrorElemento.Text    = "ESTE CAMPO NO PUEDE ESTAR VACIO";
                    return;
                }
            }
            TxtAnadir.Clear();
        }
Example #28
0
        public void MET_SacarIDFactura()
        {
            CN_Acciones INST_SacarIDFactura = new CN_Acciones();

            DtvIDFactura.DataSource = INST_SacarIDFactura.MET_Mostrar_IDFactura();
        }
Example #29
0
        public void MET_MostrarEmpleadoDespedido()
        {
            CN_Acciones INST_MostrarEmpleadosDespedidos = new CN_Acciones();

            DtvEmpleados.DataSource = INST_MostrarEmpleadosDespedidos.MET_MostrarTablaEmpleadosDespedidos();
        }
Example #30
0
        private void BtnAgregarProducto_Click(object sender, EventArgs e)
        {
            if (DtvBusqueda.SelectedRows.Count > 0)
            {
                V_IDProducto     = DtvBusqueda.CurrentRow.Cells["ID_Producto"].Value.ToString();
                V_Stock          = DtvBusqueda.CurrentRow.Cells["Stock"].Value.ToString();
                V_PrecioProducto = DtvBusqueda.CurrentRow.Cells["PrecioVenta"].Value.ToString();
                TxtCantidad.Text = "1";
                TotalITBIS       = 0;
                TotalSUBTOTAL    = 0;
                TotalVenta       = 0;
                MET_CalcularITBIS_SUBTOTAL();
            }
            else
            {
                MessageBox.Show("SELECCIONE EL PRODUCTO QUE DESEA VENDER");
                return;
            }
            try
            {
                int    Stock            = Convert.ToInt32(V_Stock);
                double PrecioProducto   = Convert.ToDouble(V_PrecioProducto);
                int    CantidadProducto = Convert.ToInt32(TxtCantidad.Text);

                if (TxtCantidad.Text == "" || CantidadProducto == 0)
                {
                    LblErrorCantidad.Text = "ESTE CAMPO NO PUEDE ESTAR VACIO NI SER IGUAL A 0";
                    return;
                }
                else if (TxtCantidad.Text != "")
                {
                    if (Stock < CantidadProducto)
                    {
                        MessageBox.Show("LA CANTIDAD DEL PRODUCTO NO PUEDE SER MAYOR QUE LA DEL STOCK");
                        return;
                    }
                    else
                    {
                        V_ITBIS    = PrecioProducto * CantidadProducto * 0.18;
                        V_SUBTOTAL = PrecioProducto * CantidadProducto;

                        CN_Acciones INST_InsertarDetalleVenta = new CN_Acciones();
                        INST_InsertarDetalleVenta.MET_InsertarDetallesVenta(
                            Convert.ToInt32(V_IDFactura),
                            Convert.ToInt32(V_IDProducto),
                            TxtCantidad.Text,
                            Convert.ToDouble(V_ITBIS),
                            Convert.ToDouble(V_SUBTOTAL));

                        //MET_MostrarDetalleVenta();
                        BtnAgregarCliente.Visible = false;
                        MET_MostrarDetalleVenta();
                        MET_MostrarProductos();
                        TotalITBIS    = 0;
                        TotalSUBTOTAL = 0;
                        TotalVenta    = 0;
                        MET_CalcularITBIS_SUBTOTAL();
                    }
                }
            }
            catch (Exception Error)
            {
                MessageBox.Show("OCURRIO UN ERROR" + Error);
            }
        }