Пример #1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            DialogResult respuesta;
            double       total = 0;
            Button       btn   = null;

            LOK = false;
            try
            {
                if (Calcular())
                {
                    //VALIDAMOS CONDICION A CREDITO
                    if ((montoDeduda > 0) && (!PermiteCredito))
                    {
                        objUtil.MostrarMensajeAdvertencia("El Credito No esta Permitido");
                    }
                    else if ((montoDeduda > 0) && (PermiteCredito))
                    {
                        respuesta = objUtil.MostrarMensajePregunta("SE REGISTRARA UNA CUENTA POR COBRAR DE: " + montoDeduda.ToString("N2") + "\r" +
                                                                   "ESTA SEGURO DE REGISTRAR LOS DATOS?"
                                                                   );
                        if (respuesta == System.Windows.Forms.DialogResult.Yes)
                        {
                            LOK = true;
                        }
                    }
                    else
                    {
                        total = (enEfectivo - aDevolver) + enCheques + enTarjetas;
                        if (total <= 0)
                        {
                            objUtil.MostrarMensajeAdvertencia("El Desglose de Pagoo Debe Ser Mayor a Cero");
                        }
                        else if ((total - monto) > 1)
                        {
                            objUtil.MostrarMensajeAdvertencia("El Desglose de Pagoo No Puede ser Mayor al Monto a Pagar");
                        }
                        else
                        {
                            LOK = true;
                        }
                    }

                    if (LOK)
                    {
                        btn = (Button)sender;
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
        }
Пример #2
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            double       valor = 0;
            DialogResult resp;

            try
            {
                cedulaRNC      = txtCedulaRNC.Text.Trim();
                nombreCompleto = (txtNombres.Text.Trim() + " " + txtApellidos.Text.Trim()).Trim();
                telefonos      = (txtTelefono1.Text.Trim() + "  " + txtTelefono2.Text.Trim()).Trim();

                direccion = txtDireccion.Text.Trim();
                nombres   = txtNombres.Text.Trim();
                apellidos = txtApellidos.Text.Trim();
                telefono1 = txtTelefono1.Text.Trim();
                telefono2 = txtTelefono2.Text.Trim();

                double.TryParse(telefono1.Replace("-", ""), out valor);

                //Validamos se haya indicado los campos necesarios
                if (nombreCompleto.Length < 10)
                {
                    utils.MostrarMensajeAdvertencia("Debe indicar un nombre valido, Minimo 10 Caracteres");
                    txtNombres.Focus();
                    return;
                }
                else if (direccion.Length < 10)
                {
                    utils.MostrarMensajeAdvertencia("Debe indicar una direccion valida, Minimo 10 Caracteres");
                    txtDireccion.Focus();
                    return;
                }
                else if (valor <= 0 || telefono1.Replace("-", "").Length < 10)
                {
                    utils.MostrarMensajeAdvertencia("Debe indicar un numero de telefono valido");
                    txtTelefono1.Focus();
                    return;
                }
                else
                {
                    resp = utils.MostrarMensajePregunta("Esta seguro que los datos suministrado estan corecto?");
                    if (resp == DialogResult.Yes)
                    {
                        filaDesglose["Oficina_Id"] = oficinaId;
                        filaDesglose["Entidad_Id"] = entidadId;
                        filaDesglose["CedulaRNC"]  = txtCedulaRNC.Text.Trim();
                        filaDesglose["Nombres"]    = txtNombres.Text.Trim();
                        filaDesglose["Apellidos"]  = txtApellidos.Text.Trim();
                        filaDesglose["Direccion"]  = txtDireccion.Text.Trim();
                        filaDesglose["Telefono1"]  = txtTelefono1.Text.Trim();
                        filaDesglose["Telefono2"]  = txtTelefono2.Text.Trim();



                        cedulaRNC      = txtCedulaRNC.Text.Trim();
                        nombreCompleto = (txtNombres.Text.Trim() + " " + txtApellidos.Text.Trim()).Trim();
                        telefonos      = (txtTelefono1.Text.Trim() + "  " + txtTelefono2.Text.Trim()).Trim();

                        filaDesglose["Nombre_Completo"] = nombreCompleto;
                        filaDesglose["Telefonos"]       = telefonos;

                        direccion = txtDireccion.Text.Trim();
                        nombres   = txtNombres.Text.Trim();
                        apellidos = txtApellidos.Text.Trim();
                        telefono1 = txtTelefono1.Text.Trim();
                        telefono2 = txtTelefono2.Text.Trim();

                        db.UpdateFromRow(TABLE_NAME, filaDesglose, CAMPO_ID);
                        lOK = true;
                        Close();
                    }
                }
            }
            catch (Exception ex)
            {
                utils.MostrarMensajeError(ex.Message);
            }
        }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            DialogResult respuesta;
            double       total = 0;
            Button       btn   = null;

            try
            {
                LOK = true;
                if (Calcular())
                {
                    //VALIDAMOS CONDICION A CREDITO
                    if ((montoDeduda > 0) && (!esCredito) && diasCredito <= 0)
                    {
                        utils.MostrarMensajeAdvertencia("El Credito No esta Permitido");
                        LOK = false;
                    }
                    else if ((montoDeduda > 0) && (esCredito))
                    {
                        LOK       = false;
                        respuesta = utils.MostrarMensajePregunta("SE REGISTRARA UNA CUENTA POR COBRAR DE: " + montoDeduda.ToString("N2") + "\r" +
                                                                 "ESTA SEGURO DE REGISTRAR LOS DATOS?"
                                                                 );
                        if (respuesta == System.Windows.Forms.DialogResult.Yes)
                        {
                            LOK = true;
                        }
                    }

                    if (LOK)
                    {
                        total = (enEfectivo - aDevolver) + enCheques + enTarjetas;
                        if (total <= 0 && !esCredito)
                        {
                            utils.MostrarMensajeAdvertencia("El Desglose de Pago Debe Ser Mayor a Cero");
                        }
                        else if ((total - monto) > 1)
                        {
                            utils.MostrarMensajeAdvertencia("El Desglose de Pago No Puede ser Mayor al Monto a Pagar");
                        }
                        else
                        {
                            Cursor = Cursors.WaitCursor;

                            filaDesglose["Oficina_Id"] = oficinaId;
                            filaDesglose["Entidad_Id"] = entidadId;
                            filaDesglose["CedulaRNC"]  = txtCedulaRNC.Text.Trim();
                            filaDesglose["Nombres"]    = txtNombres.Text.Trim();
                            filaDesglose["Apellidos"]  = txtApellidos.Text.Trim();
                            filaDesglose["Direccion"]  = txtDireccion.Text.Trim();
                            filaDesglose["Telefono1"]  = txtTelefono1.Text.Trim();
                            filaDesglose["Telefono2"]  = txtTelefono2.Text.Trim();

                            filaDesglose["Monto"]           = monto;
                            filaDesglose["EnEfectivo"]      = enEfectivo;
                            filaDesglose["EnCheques"]       = enCheques;
                            filaDesglose["EnTarjetas"]      = enTarjetas;
                            filaDesglose["Monto_AlContado"] = monto - montoDeduda;
                            filaDesglose["Monto_ACredito"]  = montoDeduda;

                            cedulaRNC      = txtCedulaRNC.Text.Trim();
                            nombreCompleto = (txtNombres.Text.Trim() + " " + txtApellidos.Text.Trim()).Trim();
                            telefonos      = (txtTelefono1.Text.Trim() + "  " + txtTelefono2.Text.Trim()).Trim();

                            filaDesglose["Nombre_Completo"] = nombreCompleto;
                            filaDesglose["Telefonos"]       = telefonos;

                            direccion = txtDireccion.Text.Trim();
                            nombres   = txtNombres.Text.Trim();
                            apellidos = txtApellidos.Text.Trim();
                            telefono1 = txtTelefono1.Text.Trim();
                            telefono2 = txtTelefono2.Text.Trim();


                            db.UpdateFromRow(TABLE_NAME, filaDesglose, CAMPO_ID);
                            LOK = true;
                        }
                    }

                    Cursor = Cursors.Default;
                    if (LOK)
                    {
                        btn = (Button)sender;

                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                utils.MostrarMensajeError(ex.Message);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Пример #4
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            int    motivoId;
            string comentario;
            List <DataDB_ELR_NET.Parametro> parametros = new List <DataDB_ELR_NET.Parametro>();
            string temporalId = "";
            ELRFormMensajeErrores objMsgERRORES = new ELRFormMensajeErrores();

            int          resultado = 0;
            DialogResult resp;

            try
            {
                lOK = false;

                //VALIDAMOS HAYA INDICADO NOMBRE_SP_ANULA
                if (SP_ANULA.Trim() == "")
                {
                    objUtil.MostrarMensajeError("NO SE INDICO SP_ANULA");
                }
                //VALIDAMOS SE HAYA INDICADO NOMBRE DE USUARIO
                else if (NOMBRE_USUARIO.Trim() == "")
                {
                    objUtil.MostrarMensajeError("NO SE INDICO NOMBRE DE USUARIO");
                }
                //Validamos ValorUnico sea Mayor a Cero
                else if (valorUnico <= 0)
                {
                    objUtil.MostrarMensajeError("EL VALOR DEL CAMPO UNICO DEBE SER MAYOR A CERO");
                }
                //Validamos Haya Indicado Motivo Id
                else if (cboMotivo.Text == "")
                {
                    objUtil.MostrarMensajeError("DEBE ELEGIR UN MOTIVO");
                }
                //VALIDAMOS HAYA INDICADO COMENTARIO
                else if (txtComentario.Text.Trim().Length < 15)
                {
                    objUtil.MostrarMensajeError("EL COMENTARIO DEBE TENER UN MINIMO DE 15 CARACTERES");
                }
                else
                {
                    resp = objUtil.MostrarMensajePregunta(this.Text + "\r\r" + "ESTA SEGURO QUE DESEA REALIZAR ESTA ACCION?");

                    if (resp == System.Windows.Forms.DialogResult.Yes)
                    {
                        //PASAMOS PARAMETROS PARA EL SP
                        motivoId   = int.Parse(cboMotivo.SelectedValue.ToString());
                        comentario = txtComentario.Text.Trim();
                        temporalId = objUtil.GetTemporalID();

                        parametros.Add(new DataDB_ELR_NET.Parametro("valorUnico", valorUnico));
                        parametros.Add(new DataDB_ELR_NET.Parametro("motivoId", motivoId));
                        parametros.Add(new DataDB_ELR_NET.Parametro("comentario", comentario));
                        parametros.Add(new DataDB_ELR_NET.Parametro("autor", NOMBRE_USUARIO));
                        parametros.Add(new DataDB_ELR_NET.Parametro("IdentificadorTemp", temporalId));

                        //INICIAMOS UNA TRANSACCION DE BASE DE DATOS
                        db.iniciarTransaccion();

                        //EJECUTAMOS EL STORE PROCEDURE PARA ANULAR
                        resultado = db.EjecutarSP(SP_ANULA, parametros);
                        if (resultado < 0)
                        {
                            //MOSTRAMOS ERRORES DEL SISTEMA
                            objMsgERRORES.TemporalId = temporalId;
                            objMsgERRORES.objDB      = db;

                            objMsgERRORES.ShowDialog();
                        }
                        else
                        {
                            db.confirmarTransaccion();

                            objUtil.MostrarMensajeInformacion(this.Text + " !!EJECUTADO DE FORMA SATISFACTORIA!!");
                            lOK = true;

                            Close();
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }