Example #1
0
 private void cmdEliminar_Click(object sender, EventArgs e)
 {
     if (dgRegistros.SelectedRows.Count != 0)
     {
         var ps = new CTRL.Persistencia();
         ps.IniciarTransaccion();
         int errores = 0;
         foreach (DataGridViewRow item in dgRegistros.SelectedRows)
         {
             var fila = (dsSysLab.PACIENTERow)((DataRowView)item.DataBoundItem).Row;
             if (!CTRL.Administracion.Pacientes.EliminarPaciente(ps.DB, fila.ID_PACIENTE))
             {
                 errores++;
             }
         }
         if (errores > 0)
         {
             ps.RevertirTransaccion();
         }
         else
         {
             ps.FinalizarTransaccion();
             frmPacientes_Load(sender, e);
         }
     }
 }
Example #2
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombres.Text.Length < 3 || txtApellidos.Text.Length < 3)
            {
                MessageBox.Show("Los nombres y los apellidos deben tener una longitud mínima "
                                + "de 3 caracteres.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtContra.Text.Length < 8 || txtIdentificador.Text.Length < 8)
            {
                MessageBox.Show("El identificador y la contraseña deben tener una longitud mínima"
                                + "de 8 caraceres.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                var ps = new CTRL.Persistencia();
                ps.IniciarTransaccion();

                if (!this._EDITANDO) // AGREGANDO
                {
                    if (CTRL.Administracion.Usuarios.AgregarUsuario(ps.DB, txtContra.Text.Trim(),
                                                                    txtTelefono.Text.Trim(), txtIdentificador.Text.Trim(), txtNombres.Text.Trim(),
                                                                    txtCorreo.Text.Trim(), txtApellidos.Text.Trim(), cbTipo.Text))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.",
                                        "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else // EDITANDO
                {
                    if (CTRL.Administracion.Usuarios.EditarUsuario(ps.DB, _ID_EDITANDO,
                                                                   (txtContra.Text.Trim() == "(Sin Cambios)") ? "" : txtContra.Text.Trim(),
                                                                   txtTelefono.Text.Trim(), txtNombres.Text.Trim(),
                                                                   txtCorreo.Text.Trim(), txtApellidos.Text.Trim(), cbTipo.Text))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }
Example #3
0
        private void btDesasignar_Click(object sender, EventArgs e)
        {
            if (dgRegistros.SelectedRows.Count > 0)
            {
                var ps = new CTRL.Persistencia();
                ps.IniciarTransaccion();

                foreach (DataGridViewRow F in dgRegistros.SelectedRows)
                {
                    var fila = (dsSysLab.PACIENTERow)((DataRowView)F.DataBoundItem).Row;
                    if (CTRL.Administracion.Pacientes.AsignarPaciente(ps.DB, fila.ID_PACIENTE, null))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("Los pacientes se asignaron satisfactoriamente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.pACIENTETableAdapter.Fill(this.dsSysLab.PACIENTE);
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar al menos un paciente a desasignar", "SysLab",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #4
0
        public frmAgregarUsuario(string idEditando)
        {
            InitializeComponent();

            this._ID_EDITANDO         = idEditando;
            _EDITANDO                 = true;
            txtIdentificador.ReadOnly = true;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <USUARIO>(idEditando);

            this.Text = this.lblProd.Text = "Editando Usuario";

            txtNombres.Text       = reg.NOMBRES;
            txtApellidos.Text     = reg.APELLIDOS;
            txtTelefono.Text      = reg.TELEFONO;
            txtCorreo.Text        = reg.CORREO;
            txtIdentificador.Text = reg.ID_USUARIO;
            cbTipo.SelectedIndex  = cbTipo.Items.IndexOf(reg.TIPO);
            txtContra.Text        = "(Sin Cambios)";
            ps.CerrarConexion();
            cbTipo.SelectedIndex = 0;
        }
Example #5
0
        public frmAgregarTalonario(long ID)
        {
            InitializeComponent();

            this.dOCTORESTableAdapter.Fill(this.dsSysLab.DOCTORES);

            this._ID_EDITAR = ID;
            this._EDITANDO  = true;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <TALONARIO>(ID.ToString());

            this.Text = this.lblTitulo.Text = "Editando Entrega de Talonario";

            nudCantidad.Value = (decimal)reg.CANTIDAD;
            dtpFecha.Value    = reg.FECHA ?? dtpFecha.Value;

            if (_EDITANDO)
            {
                this.cbDoctor.SelectedValue = reg.ID_DOCTOR;
            }

            ps.CerrarConexion();
        }
Example #6
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombres.Text.Trim() == string.Empty)
            {
                MessageBox.Show("El nombre no es válido.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                var ps = new CTRL.Persistencia();
                ps.IniciarTransaccion();

                if (!this._EDITANDO)
                {
                    if (CTRL.Administracion.Empresas.AgregarEmpresa(ps.DB, txtNombres.Text.Trim(), txtGiro.Text.Trim(),
                                                                    txtDireccion.Text.Trim(), txtMunicipio.Text.Trim(), txtDepartamento.Text.Trim(), txtNIT.Text.Trim(), txtNRC.Text.Trim(),
                                                                    ckGranContribuyente.Checked, ckCredito.Checked, (int)nudDiasCredito.Value, txtCorreo.Text.Trim(),
                                                                    txtContactoNombre.Text.Trim(), txtContactoNIT.Text.Trim(), txtContactoCorreo.Text.Trim(),
                                                                    txtContactoTelefono.Text.Trim()))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (CTRL.Administracion.Empresas.EditarEmpresa(ps.DB, this._ID_EDITAR, txtNombres.Text.Trim(), txtGiro.Text.Trim(),
                                                                   txtDireccion.Text.Trim(), txtMunicipio.Text.Trim(), txtDepartamento.Text.Trim(), txtNIT.Text.Trim(), txtNRC.Text.Trim(),
                                                                   ckGranContribuyente.Checked, ckCredito.Checked, (int)nudDiasCredito.Value, txtCorreo.Text.Trim(),
                                                                   txtContactoNombre.Text.Trim(), txtContactoNIT.Text.Trim(), txtContactoCorreo.Text.Trim(),
                                                                   txtContactoTelefono.Text.Trim()))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }
Example #7
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombres.Text.Trim() == string.Empty)
            {
                MessageBox.Show("El nombre no es válido.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                var ps = new CTRL.Persistencia();
                ps.IniciarTransaccion();

                if (!this._EDITANDO)
                {
                    if (CTRL.Administracion.Doctores.AgregarDoctores(ps.DB, txtNombres.Text.Trim(), txtDireccion.Text.Trim(),
                                                                     txtTelefono.Text.Trim(), txtNIT.Text.Trim(), txtDUI.Text.Trim(), txtCorreo.Text.Trim(),
                                                                     txtClinicaNombre.Text.Trim(), txtClinicaTelefono.Text.Trim()))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (CTRL.Administracion.Doctores.EditarDoctores(ps.DB, this._ID_EDITAR, txtNombres.Text.Trim(), txtDireccion.Text.Trim(),
                                                                    txtTelefono.Text.Trim(), txtNIT.Text.Trim(), txtDUI.Text.Trim(), txtCorreo.Text.Trim(),
                                                                    txtClinicaNombre.Text.Trim(), txtClinicaTelefono.Text.Trim()))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }
Example #8
0
        public frmAgregarPaciente(long ID, bool Visor = false)
        {
            InitializeComponent();

            this._ID_EDITAR = ID;
            this._EDITANDO  = true;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <PACIENTE>(ID.ToString());

            this.Text = this.lblProd.Text = "Editando paciente";

            txtNombres.Text      = reg.NOMBRES;
            txtTelefono.Text     = reg.TELEFONO;
            dtpFecha.Value       = reg.FECHA_NAC.Value;
            txtGiro.Text         = reg.GIRO;
            txtDireccion.Text    = reg.DIRECCION;
            txtMunicipio.Text    = reg.MUNICIPIO;
            txtDepartamento.Text = reg.DEPARTAMENTO;
            txtNIT.Text          = reg.NIT;
            txtCorreo.Text       = reg.CORREO;

            ckCredito.Checked           = reg.CREDITO;
            ckCFiscal.Checked           = reg.CREDITO_FISCAL;
            ckExento.Checked            = reg.EXENTO;
            ckTasaCero.Checked          = reg.TASA_CERO;
            ckGranContribuyente.Checked = reg.GRAN_CONTRIBUYENTE;
            nudDiasCredito.Value        = reg.CREDITO_DIAS;
            nudPrecioSel.Value          = reg.PRECIO_SEL;

            if (Visor)
            {
                this.ControlBox = true;
                this.Text       = this.lblProd.Text = "Visualizando cliente";

                txtNombres.ReadOnly        = txtTelefono.ReadOnly = txtGiro.ReadOnly = txtDireccion.ReadOnly =
                    txtMunicipio.ReadOnly  = txtDepartamento.ReadOnly = txtNIT.ReadOnly = txtNRC.ReadOnly =
                        txtCorreo.ReadOnly = true;

                nudPrecioSel.Enabled       = dtpFecha.Enabled = ckCredito.Enabled = ckExento.Enabled = ckGranContribuyente.Enabled = ckTasaCero.Enabled =
                    nudDiasCredito.Enabled = cmdGuardar.Visible = cmdCancelar.Visible = false;
            }

            ps.CerrarConexion();
        }
Example #9
0
        public frmResultadoAnalisis(long ID_SOLICITUD, long ID_ANALISIS, bool visor)
        {
            InitializeComponent();

            this.ID_SOL      = ID_SOLICITUD;
            this.ID_ANALISIS = ID_ANALISIS;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <ANALISI>(ID_ANALISIS.ToString());

            txtNombre.Text        = reg.NOMBRE;
            txtDesc.Text          = reg.DESCRIPCION;
            txtObservaciones.Text = ps.DB.SOLICITUD_RESULTADOs.Where(c => c.ID_ANALISIS == ID_ANALISIS && c.ID_SOLICITUD == ID_SOLICITUD)
                                    .Select(c => c.OBSERVACIONES).SingleOrDefault();

            foreach (ANALISIS_DATO item in reg.ANALISIS_DATOs)
            {
                var fila = dgCampos.Rows[
                    dgCampos.Rows.Add(new object[] { item.CAMPO, item.UMEDIDA, item.REF, item.RMIN, item.RMAX,
                                                     item.SOLICITUD_RESULTADO_DETALLEs.Where(
                                                         c => c.SOLICITUD_RESULTADO.ID_SOLICITUD == ID_SOLICITUD &&
                                                         c.SOLICITUD_RESULTADO.ID_ANALISIS == ID_ANALISIS).Select(c => c.VALOR).SingleOrDefault(),
                                                     item.SOLICITUD_RESULTADO_DETALLEs.Where(
                                                         c => c.SOLICITUD_RESULTADO.ID_SOLICITUD == ID_SOLICITUD &&
                                                         c.SOLICITUD_RESULTADO.ID_ANALISIS == ID_ANALISIS).Select(c => c.COMENTARIOS).SingleOrDefault(), })
                           ];
                fila.Tag = item.ID_ANALISIS_DATO;
            }

            ps.CerrarConexion();

            if (visor)
            {
                dgCampos.ReadOnly      = true;
                colValor.ReadOnly      = true;
                colComentario.ReadOnly = true;

                txtObservaciones.ReadOnly = true;

                this.Text = lblTitulo.Text = "Visualizando resultado de análisis clínico";
                this.cmdCancelar.Visible = this.cmdGuardar.Visible = false;

                this.ControlBox = true;
            }
        }
Example #10
0
        public frmAgregarEmpresa(long ID_EMPRESA, bool Visor = false)
        {
            InitializeComponent();

            this._ID_EDITAR = ID_EMPRESA;
            this._EDITANDO  = true;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <EMPRESA>(ID_EMPRESA.ToString());

            this.Text = this.lblTitulo.Text = "Editando empresa";

            txtNombres.Text             = reg.NOMBRE;
            txtGiro.Text                = reg.GIRO;
            txtDireccion.Text           = reg.DIRECCION;
            txtMunicipio.Text           = reg.MUNICIPIO;
            txtDepartamento.Text        = reg.DEPARTAMENTO;
            txtNIT.Text                 = reg.NIT;
            txtNRC.Text                 = reg.NRC;
            txtCorreo.Text              = reg.CORREO;
            ckCredito.Checked           = reg.CREDITO;
            ckGranContribuyente.Checked = reg.GRAN_CONTRIBUYENTE;
            nudDiasCredito.Value        = reg.CREDITO_DIAS;

            txtContactoNombre.Text   = reg.CONTACTO_NOMBRE;
            txtContactoTelefono.Text = reg.CONTACTO_TELEFONO;
            txtContactoNIT.Text      = reg.CONTACTO_NIT;
            txtContactoCorreo.Text   = reg.CONTACTO_CORREO;

            if (Visor)
            {
                this.ControlBox = true;
                this.Text       = this.lblTitulo.Text = "Visualizando empresa";

                txtNombres.ReadOnly        = txtGiro.ReadOnly = txtDireccion.ReadOnly =
                    txtMunicipio.ReadOnly  = txtDepartamento.ReadOnly = txtNIT.ReadOnly = txtNRC.ReadOnly =
                        txtCorreo.ReadOnly = txtContactoCorreo.ReadOnly = txtContactoNIT.ReadOnly = txtContactoNombre.ReadOnly =
                            txtContactoTelefono.ReadOnly = true;

                ckCredito.Enabled          = ckGranContribuyente.Enabled =
                    nudDiasCredito.Enabled = cmdGuardar.Visible = cmdCancelar.Visible = false;
            }

            ps.CerrarConexion();
        }
Example #11
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            if (cbDoctor.SelectedIndex < 0)
            {
                MessageBox.Show("Debe seleccionar un doctor.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                var ps = new CTRL.Persistencia();
                ps.IniciarTransaccion();

                if (!this._EDITANDO)
                {
                    if (CTRL.Administracion.Talonarios.AgregarTalonario(ps.DB, (long)cbDoctor.SelectedValue,
                                                                        dtpFecha.Value, (int)nudCantidad.Value))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (CTRL.Administracion.Talonarios.EditarTalonario(ps.DB, this._ID_EDITAR, (long)cbDoctor.SelectedValue,
                                                                       (int)nudCantidad.Value, dtpFecha.Value))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("La operación no pudo ser completada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }
Example #12
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombres.Text.Trim() == string.Empty)
            {
                MessageBox.Show("El nombre de la familia no es válido.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                var ps = new CTRL.Persistencia();
                ps.IniciarTransaccion();

                if (!this._EDITANDO)
                {
                    if (CTRL.Administracion.Clasificaciones.AgregarFamilia(ps.DB, this._ID__CATEG, txtNombres.Text.Trim(), txtDesc.Text.Trim()))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("Ha ocurrido un error, la operación fue cancelada.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (CTRL.Administracion.Clasificaciones.EditarFamilia(ps.DB, this._ID_EDITAR, txtNombres.Text.Trim(), txtDesc.Text.Trim()))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("Ha ocurrido un error, la operación fue cancelada.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
            }
        }
Example #13
0
        private void cmdEliminar_Click(object sender, EventArgs e)
        {
            if (dgRegistros.SelectedRows.Count > 0)
            {
                if (MessageBox.Show("Los registros seleccionados serán eliminados. ¿Desesa continuar?", "SysLab", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    var ps = new CTRL.Persistencia();
                    ps.IniciarTransaccion();

                    int errores = 0;

                    foreach (DataGridViewRow item in dgRegistros.SelectedRows)
                    {
                        var fila = (dsSysLab.USUARIORow)((DataRowView)item.DataBoundItem).Row;

                        if (!CTRL.Administracion.Usuarios.EliminarUsuario(ps.DB, fila.ID_USUARIO))
                        {
                            errores++;
                        }
                    }

                    if (errores > 0)
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("Los registros no pudieron ser eliminados porque "
                                        + "tienen operaciones relacionadas.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                    else
                    {
                        ps.FinalizarTransaccion();

                        MessageBox.Show("Los registros fueron eliminados satisfactoriamente.",
                                        "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        frmAdminUsuarios_Load(sender, e);
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar al menos un usuario a eliminar.",
                                "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #14
0
        private void cmdEliminar_Click(object sender, EventArgs e)
        {
            if (dgRegistros.SelectedRows.Count == 0)
            {
                MessageBox.Show("Por favor, seleccione un registro.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (MessageBox.Show("Los registros seleccionados serán eliminados permanentemente. ¿Desea continuar?.", "SysLab",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    var ps = new CTRL.Persistencia();
                    ps.IniciarTransaccion();

                    int errores = 0;

                    foreach (DataGridViewRow item in dgRegistros.SelectedRows)
                    {
                        var fila = (dsSysLab.COTIZACIONRow)((DataRowView)item.DataBoundItem).Row;

                        if (!CTRL.Examenes.Cotizaciones.EliminarCotizacion(ps.DB, fila.ID_COTIZACION))
                        {
                            errores++;
                        }
                    }

                    if (errores > 0)
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("Los registros no pudieron ser eliminados porque tienen operaciones relacionadas.",
                                        "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        ps.FinalizarTransaccion();

                        MessageBox.Show("Los registros fueron eliminados satisfactoriamente.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                        frmCotizaciones_Load(sender, e);
                    }
                }
            }
        }
Example #15
0
        public frmAgregarAnalisis(long ID)
        {
            InitializeComponent();

            this.fAMILIATableAdapter.Fill(this.dsSysLab.FAMILIA);
            this.cATEGORIATableAdapter.Fill(this.dsSysLab.CATEGORIA);

            this._ID_EDITAR = ID;
            this._EDITANDO  = true;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <ANALISI>(ID.ToString());

            this.Text = this.lblTitulo.Text = "Editando Tipo de Análisis";

            cmbCateg.SelectedValue = reg.FAMILIA.ID_CATEGORIA;
            cmbFam.SelectedValue   = reg.ID_FAMILIA;

            txtNombre.Text = reg.NOMBRE;
            txtDesc.Text   = reg.DESCRIPCION;

            nudP1.Value = reg.PRECIO1;
            nudP2.Value = reg.PRECIO2;
            nudP3.Value = reg.PRECIO3;

            foreach (ANALISIS_DATO item in reg.ANALISIS_DATOs)
            {
                var fila = dgCampos.Rows[
                    dgCampos.Rows.Add(new object[] { item.CAMPO, null, item.UMEDIDA, item.REF, item.RMIN, item.RMAX })
                           ];

                var cmb = ((DataGridViewComboBoxCell)fila.Cells[1]);

                cmb.DataSource = this.TipoDato;
                cmb.Value      = this.TipoDato[item.TIPO];
            }

            ps.CerrarConexion();
        }
Example #16
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            var detalle = new List <SOLICITUD_RESULTADO_DETALLE>();

            foreach (DataGridViewRow fila in dgCampos.Rows)
            {
                if (fila.IsNewRow || fila.Index < 0)
                {
                    continue;
                }

                detalle.Add(
                    new SOLICITUD_RESULTADO_DETALLE
                {
                    ID_ANALISIS_DATO = (string)fila.Tag,
                    VALOR            = fila.Cells[5].EditedFormattedValue.ToString(),
                    COMENTARIOS      = fila.Cells[6].EditedFormattedValue.ToString()
                }
                    );
            }

            var ps = new CTRL.Persistencia();

            ps.IniciarTransaccion();

            if (CTRL.Examenes.Resultados.ProcesarResultados(ps.DB, this.ID_SOL, this.ID_ANALISIS, txtObservaciones.Text.Trim(),
                                                            detalle))
            {
                ps.FinalizarTransaccion();

                MessageBox.Show("El resultado fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Dispose();
            }
            else
            {
                ps.RevertirTransaccion();
                MessageBox.Show("El resultado no pudo ser procesado. La operación fue cancelada.", "SysLab", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
        }
Example #17
0
        public frmAgregarCategoria(long ID)
        {
            InitializeComponent();

            this._ID_EDITAR = ID;
            this._EDITANDO  = true;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <CATEGORIA>(ID.ToString());

            this.Text = this.lblTitulo.Text = "Editando Categoría";

            txtNombres.Text = reg.NOMBRE;
            txtDesc.Text    = reg.DESCRIPCION;

            ps.CerrarConexion();
        }
Example #18
0
        public frmAgregarSector(long ID, long ID_EMPRESA)
        {
            InitializeComponent();

            this._ID_EDITAR = ID;
            this._EDITANDO  = true;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <EMPRESA_SECTOR>(ID.ToString());

            this.Text = this.lblTitulo.Text = "Editando Sector";

            txtNombres.Text = reg.NOMBRE;
            txtDesc.Text    = reg.DESCRIPCION;

            ps.CerrarConexion();
        }
Example #19
0
        void Cargar()
        {
            dgRegistros.Rows.Clear();

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <SOLICITUD>(ID_SOLICITUD.ToString());

            if (reg != null)
            {
                dtpFecha.Value     = reg.FECHA_EMISION;
                dtpRequerido.Value = reg.FECHA_ENTREGA.Value;

                txtNombres.Text = reg.NOMBRES;

                decimal A = reg.SOLICITUD_RESULTADOs.Count();
                decimal B = reg.SOLICITUD_DETALLEs.Count();

                var progreso = (int)((A / B) * 100);

                pbProgreso.Value = progreso;

                foreach (var item in reg.SOLICITUD_DETALLEs)
                {
                    dgRegistros.Rows.Add(
                        new object[] {
                        item.ID_ANALISIS.ToString(), item.ANALISI.NOMBRE,
                        reg.SOLICITUD_RESULTADOs.Where(c => c.ID_ANALISIS == item.ID_ANALISIS)
                        .Select(c => c.OBSERVACIONES).SingleOrDefault()
                    }
                        );
                }
            }

            ps.CerrarConexion();
        }
Example #20
0
        private void cmdSeleccionar_Click(object sender, EventArgs e)
        {
            if (dgRegistros.SelectedRows.Count > 0)
            {
                var ps = new CTRL.Persistencia();
                ps.IniciarTransaccion();

                int errores = 0;

                foreach (DataGridViewRow F in dgRegistros.SelectedRows)
                {
                    var fila = (dsSysLab.PACIENTERow)((DataRowView)F.DataBoundItem).Row;
                    if (!CTRL.Administracion.Pacientes.AsignarPaciente(ps.DB, fila.ID_PACIENTE, this._ID_SECTOR))
                    {
                        errores++;
                    }
                }

                if (errores == 0)
                {
                    ps.FinalizarTransaccion();
                    MessageBox.Show("Los pacientes se asignaron satisfactoriamente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Dispose();
                }
                else
                {
                    ps.RevertirTransaccion();
                    MessageBox.Show("La operación no pudo ser completada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Por favor, seleccione un registro.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #21
0
        public frmAgregarDoctor(long ID, bool Visor = false)
        {
            InitializeComponent();

            this._ID_EDITAR = ID;
            this._EDITANDO  = true;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <DOCTORE>(ID.ToString());

            this.Text = this.lblTitulo.Text = "Editando doctor";

            txtNombres.Text         = reg.NOMBRES;
            txtTelefono.Text        = reg.TELEFONO;
            txtDireccion.Text       = reg.DIRECCION;
            txtNIT.Text             = reg.NIT;
            txtDUI.Text             = reg.DUI;
            txtCorreo.Text          = reg.CORREO;
            txtClinicaNombre.Text   = reg.CLINICA_NOMBRE;
            txtClinicaTelefono.Text = reg.CLINICA_TELEFONO;

            if (Visor)
            {
                this.ControlBox = true;
                this.Text       = this.lblTitulo.Text = "Visualizando doctor";

                txtNombres.ReadOnly           = txtTelefono.ReadOnly = txtDUI.ReadOnly = txtDireccion.ReadOnly =
                    txtClinicaNombre.ReadOnly = txtClinicaTelefono.ReadOnly = txtNIT.ReadOnly = txtCorreo.ReadOnly = true;

                cmdGuardar.Visible = cmdCancelar.Visible = false;
            }

            ps.CerrarConexion();
        }
Example #22
0
        public frmAgregarSolicitud(long ID, bool visor = false)
        {
            InitializeComponent();

            this._EDITANDO      = true;
            this.lblTitulo.Text = this.Text = "Editando Solicitud";

            this._ID_SOLICITUD = ID;

            var ps = new CTRL.Persistencia();

            ps.AbrirConexion();

            var reg = ps.SelPorLlave <SOLICITUD>(ID.ToString());

            if (reg != null)
            {
                this.nudIVA.Value   = reg.PORCENTAJE_IVA * 100;
                this.nudReten.Value = reg.PORCENTAJE_RETENCION * 100;

                txtPacienteID.Text   = reg.ID_PACIENTE.ToString();
                txtDoctorID.Text     = reg.ID_DOCTOR.ToString();
                txtDoctorNombre.Text = reg.DOCTORE.NOMBRES;
                txtNombre.Text       = reg.NOMBRES;
                txtNRC.Text          = reg.NRC;
                txtNIT.Text          = reg.NIT;
                txtGiro.Text         = reg.GIRO;
                txtFactura.Text      = reg.NO_FACTURA.ToString();

                dtpFecha.Value     = reg.FECHA_EMISION;
                dtpRequerido.Value = reg.FECHA_ENTREGA.Value;

                ckCFinal.Checked    = !reg.CREDITO_FISCAL;
                ckCFiscal.Checked   = reg.CREDITO_FISCAL;
                ckRetencion.Checked = reg.RETENCION;

                //AGREGANDO DETALLE
                this._AGREGANDO_FILAS = true;

                foreach (var item in reg.SOLICITUD_DETALLEs)
                {
                    int f = dgMovs.Rows.Add();

                    dgMovs.Rows[f].SetValues(new object[] { item.ID_ANALISIS, item.ANALISI.NOMBRE, item.PRECIO, item.OBSERVACIONES,
                                                            item.EXENTO });
                }
                this._AGREGANDO_FILAS = false;

                if (visor)
                {
                    this.cmdPaciente.Enabled = cmdDoctor.Enabled = ckRetencion.Enabled = ckCFiscal.Enabled = ckCFinal.Enabled =
                        dtpFecha.Enabled     = dtpRequerido.Enabled = cmdEliminarMov.Enabled = nudIVA.Enabled = nudReten.Enabled = false;

                    txtNombre.ReadOnly = txtNRC.ReadOnly = txtNIT.ReadOnly = txtFactura.ReadOnly = txtGiro.ReadOnly = true;
                }

                ActualizarTotales();
            }
            else
            {
                MessageBox.Show("El registro no fue encontrado.", "ContaClic", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
        }
Example #23
0
        private void dgMovs_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            //SI SE CHECKEO QUE ES EXENTO Y LA FACTURA ESTÁ EN CONSUMIDOR FINAL SE DEBE QUITAR EL IVA
            if (e.ColumnIndex == 4 && !_AGREGANDO_FILAS && e.RowIndex >= 0)
            {
                if (ckCFinal.Checked && (bool)dgMovs[4, e.RowIndex].Value)
                {
                    dgMovs[2, e.RowIndex].Value = decimal.Round((decimal)dgMovs[2, e.RowIndex].Value / (1 + this.ptjIVA), 2);
                }
                else if (ckCFinal.Checked && !(bool)dgMovs[4, e.RowIndex].Value)
                {
                    dgMovs[2, e.RowIndex].Value = decimal.Round((decimal)dgMovs[2, e.RowIndex].Value * (1 + this.ptjIVA), 2);
                }

                var fila = dgMovs.Rows[e.RowIndex];

                if (fila.Tag != null)
                {
                    var  lsPrecios   = (List <decimal>)fila.Tag;
                    bool fila_Exenta = (bool)fila.Cells[4].FormattedValue;


                    if (fila_Exenta)
                    {
                        //CONSUMIDOR FINAL, LISTA DE PRECIOS TIENE IVA, SE DEBE QUITAR
                        if (ckCFinal.Checked)
                        {
                            lsPrecios[0] = decimal.Round((lsPrecios[0] / (1 + this.ptjIVA)), 4);
                            lsPrecios[1] = decimal.Round((lsPrecios[1] / (1 + this.ptjIVA)), 4);
                            lsPrecios[2] = decimal.Round((lsPrecios[2] / (1 + this.ptjIVA)), 4);
                        }
                    }
                    else
                    {
                        //CONSUMIDOR FINAL, LISTA DE PRECIOS TIENE IVA, SE DEBE PONER
                        if (ckCFinal.Checked)
                        {
                            lsPrecios[0] = decimal.Round((lsPrecios[0] * (1 + this.ptjIVA)), 4);
                            lsPrecios[1] = decimal.Round((lsPrecios[1] * (1 + this.ptjIVA)), 4);
                            lsPrecios[2] = decimal.Round((lsPrecios[2] * (1 + this.ptjIVA)), 4);
                        }
                    }
                    fila.Tag = lsPrecios;
                }
            }
            ActualizarTotales();

            if (e.ColumnIndex == 0 && e.RowIndex >= 0 && dgMovs[0, e.RowIndex].EditedFormattedValue.ToString() != string.Empty)
            {
                var ps = new CTRL.Persistencia();
                ps.AbrirConexion();
                var db = ps.DB;

                try
                {
                    List <decimal> precios = new List <decimal>();

                    var analisis = db.ANALISIs.Where(p => p.ID_ANALISIS ==
                                                     long.Parse(dgMovs[0, e.RowIndex].Value.ToString())).SingleOrDefault();

                    if (analisis != null)
                    {
                        precios.Add(decimal.Round(analisis.PRECIO1 * ((ckCFinal.Checked) ? (1 + this.ptjIVA) : 1), 2));
                        precios.Add(decimal.Round(analisis.PRECIO2 * ((ckCFinal.Checked) ? (1 + this.ptjIVA) : 1), 2));
                        precios.Add(decimal.Round(analisis.PRECIO3 * ((ckCFinal.Checked) ? (1 + this.ptjIVA) : 1), 2));

                        dgMovs.Rows[e.RowIndex].Tag = precios;

                        dgMovs.Rows[e.RowIndex].Cells[2].Value = precios[_PRECIO_SEL - 1];
                    }
                }
                catch (Exception)
                {
                    ps.CerrarConexion();
                }
            }
            else if (e.RowIndex >= 0 && e.ColumnIndex == 0)
            {
                dgMovs.Rows[e.RowIndex].Tag = null;
            }
        }
Example #24
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            ActualizarTotales();

            int no_factura = 0;

            int no_validas = (from DataGridViewRow c in dgMovs.Rows
                              where (c.Cells[0].EditedFormattedValue.ToString() == "" ||
                                     c.Cells[1].EditedFormattedValue.ToString() == "") &&
                              c.IsNewRow == false
                              select c).Count();

            if (no_validas > 0 || dgMovs.Rows.Count <= 1)
            {
                MessageBox.Show("Por favor, verifique las filas agregadas.", "SysLab",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (!int.TryParse(txtFactura.Text, out no_factura))
            {
                MessageBox.Show("Por favor, verifique el número de factura.", "SysLab",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtPacienteID.Text == "- Ninguno -")
            {
                MessageBox.Show("Por favor, seleccione un paciente.", "SysLab",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtDoctorID.Text == "- Ninguno -")
            {
                MessageBox.Show("Por favor, seleccione un doctor.", "SysLab",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            { //GENERANDO DETALLE
                List <SOLICITUD_DETALLE> Detalle = new List <SOLICITUD_DETALLE>();
                foreach (DataGridViewRow item in dgMovs.Rows)
                {
                    if (!item.IsNewRow)
                    {
                        SOLICITUD_DETALLE reg = new SOLICITUD_DETALLE();

                        reg.ID_ANALISIS   = long.Parse(item.Cells[0].Value.ToString());
                        reg.PRECIO        = decimal.Parse(item.Cells[2].FormattedValue.ToString());
                        reg.OBSERVACIONES = item.Cells[3].FormattedValue.ToString();
                        reg.EXENTO        = (bool)item.Cells[4].FormattedValue;

                        Detalle.Add(reg);
                    }
                }

                if (!this._EDITANDO)
                {//AGREGANDO
                    var ps = new CTRL.Persistencia();
                    ps.IniciarTransaccion();

                    if (CTRL.Examenes.Solicitudes.AgregarSolicitud(ps.DB, long.Parse(txtPacienteID.Text), long.Parse(txtDoctorID.Text),
                                                                   dtpFecha.Value, dtpRequerido.Value, int.Parse(txtFactura.Text), txtNombre.Text.Trim(), txtGiro.Text.Trim(),
                                                                   txtNIT.Text.Trim(), txtNRC.Text.Trim(), ckRetencion.Checked, ckCFiscal.Checked, this.ptjIVA, this.ptjReten,
                                                                   this.gravado, this.iva, this.subtotal, this.exento, this.retencion, this.total, Detalle)
                        )
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("La solicitud fue agregada satisfactoriamente.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);

                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("El registro no pudo ser agregado satisfactoriamente, "
                                        + "por favor verifique que la información sea correcta.", "SysLab",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {//EDITANDO
                    var ps = new CTRL.Persistencia();
                    ps.IniciarTransaccion();

                    if (CTRL.Examenes.Solicitudes.EditarSolicitud(ps.DB, this._ID_SOLICITUD, long.Parse(txtPacienteID.Text),
                                                                  long.Parse(txtDoctorID.Text), dtpFecha.Value, dtpRequerido.Value, int.Parse(txtFactura.Text),
                                                                  txtNombre.Text.Trim(), txtGiro.Text.Trim(), txtNIT.Text.Trim(), txtNRC.Text.Trim(), ckRetencion.Checked,
                                                                  ckCFiscal.Checked, this.ptjIVA, this.ptjReten, this.gravado, this.iva, this.subtotal, this.exento,
                                                                  this.retencion, this.total, Detalle)
                        )
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("El registro no pudo ser procesado satisfactoriamente, "
                                        + "por favor verifique que la información sea correcta.", "SysLab",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Example #25
0
        private void cmdGuardar_Click(object sender, EventArgs e)
        {
            this.Validate(true);

            if (txtNombre.Text.Trim() == string.Empty)
            {
                MessageBox.Show("El nombre no es válido.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (cmbFam.SelectedIndex == -1)
            {
                MessageBox.Show("Por favor, seleccione una familia existente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                List <ANALISIS_DATO> Datos = new List <ANALISIS_DATO>();

                foreach (DataGridViewRow item in dgCampos.Rows)
                {
                    if (item.IsNewRow || item.Index < 0)
                    {
                        continue;
                    }

                    Datos.Add(
                        new ANALISIS_DATO
                    {
                        CAMPO   = item.Cells[0].EditedFormattedValue.ToString(),
                        TIPO    = Array.IndexOf(TipoDato, item.Cells[1].EditedFormattedValue.ToString()),
                        UMEDIDA = item.Cells[2].EditedFormattedValue.ToString(),
                        REF     = item.Cells[3].EditedFormattedValue.ToString(),
                        RMAX    = decimal.Parse(item.Cells[4].EditedFormattedValue.ToString()),
                        RMIN    = decimal.Parse(item.Cells[5].EditedFormattedValue.ToString())
                    });
                }


                var ps = new CTRL.Persistencia();
                ps.IniciarTransaccion();

                if (!this._EDITANDO)
                {
                    if (CTRL.Administracion.CatalogoAnalisis.AgregarAnalisis(ps.DB, (long)cmbFam.SelectedValue, txtNombre.Text.Trim(), txtDesc.Text.Trim(), nudP1.Value, nudP2.Value, nudP3.Value, Datos))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("Ha ocurrido un error, la operación fue cancelada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (CTRL.Administracion.CatalogoAnalisis.EditarAnalisis(ps.DB, this._ID_EDITAR, (long)cmbFam.SelectedValue, txtNombre.Text.Trim(), txtDesc.Text.Trim(), nudP1.Value, nudP2.Value, nudP3.Value, Datos))
                    {
                        ps.FinalizarTransaccion();
                        MessageBox.Show("El registro fue procesado satisfactoriamente.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        ps.RevertirTransaccion();
                        MessageBox.Show("Ha ocurrido un error, la operación fue cancelada.", "SysLab", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }