Esempio n. 1
0
        private void devuelveProveedor()
        {
            if (txtNroDocumento.Text.ToString() == "")
            {
                txtProveedor.Text = "";
                txtContacto.Focus();

                return;
            }
            if (txtNroDocumento.Text.ToString().Length != 11)
            {
                MessageBoxAdv.Show("El ruc debe de tener 11 digitos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);

                return;
            }
            else
            {
                clsConsultaSunat clsConsulta = new clsConsultaSunat();
                InfoSunat = clsConsulta.GetDataSunat(txtNroDocumento.Text.ToString());
                if (InfoSunat.Count > 0)
                {
                    txtProveedor.Text = InfoSunat[1].ToString();
                    if (InfoSunat[4].ToString().Contains("BAJA"))
                    {
                        lblEstado.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblEstado.ForeColor = Color.Black;
                    }
                    lblEstado.Text    = InfoSunat[4].ToString();
                    lblDireccion.Text = InfoSunat[6].ToString();
                }
                else
                {
                    InfoSunat = clsConsulta.GetDataSunat(txtNroDocumento.Text.ToString());
                    if (InfoSunat.Count > 0)
                    {
                        txtProveedor.Text = InfoSunat[1].ToString();
                        if (InfoSunat[4].ToString().Contains("BAJA"))
                        {
                            lblEstado.ForeColor = Color.Red;
                        }
                        else
                        {
                            lblEstado.ForeColor = Color.Black;
                        }
                        lblEstado.Text    = InfoSunat[4].ToString();
                        lblDireccion.Text = InfoSunat[6].ToString();
                    }
                    else
                    {
                        InfoSunat = clsConsulta.GetDataSunat(txtNroDocumento.Text.ToString());
                        if (InfoSunat.Count > 0)
                        {
                            txtProveedor.Text = InfoSunat[1].ToString();
                            if (InfoSunat[4].ToString().Contains("BAJA"))
                            {
                                lblEstado.ForeColor = Color.Red;
                            }
                            else
                            {
                                lblEstado.ForeColor = Color.Black;
                            }
                            lblEstado.Text    = InfoSunat[4].ToString();
                            lblDireccion.Text = InfoSunat[6].ToString();
                        }
                    }
                }
            }
            if (txtProveedor.Text == "")
            {
                MessageBoxAdv.Show("Revise el Nª de RUC", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtNroDocumento.Focus();

                return;
            }
            txtContacto.Focus();

            return;
        }
Esempio n. 2
0
        private void txtNroDocumento_KeyPress(object sender, KeyPressEventArgs e)
        {
            ArrayList InfoSunat = new ArrayList();

            lblDireccion.Text = "";
            lblEstado.Text    = "";
            if ((Convert.ToInt32(e.KeyChar) == 9) || (Convert.ToInt32(e.KeyChar) == 13))
            {
                if (txtNroDocumento.Text.ToString() == "")
                {
                    txtProveedor.Text = "";
                    txtDenominacion.Focus();
                    return;
                }
                if (txtNroDocumento.Text.ToString().Length != 11)
                {
                    MessageBoxAdv.Show("El ruc debe de tener 11 digitos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    clsConsultaSunat clsConsulta = new clsConsultaSunat();
                    InfoSunat = clsConsulta.GetDataSunat(txtNroDocumento.Text.ToString());
                    if (InfoSunat.Count > 0)
                    {
                        txtProveedor.Text = InfoSunat[1].ToString();
                        if (InfoSunat[4].ToString().Contains("BAJA"))
                        {
                            lblEstado.ForeColor = Color.Red;
                        }
                        else
                        {
                            lblEstado.ForeColor = Color.Black;
                        }
                        lblEstado.Text    = InfoSunat[4].ToString();
                        lblDireccion.Text = InfoSunat[6].ToString();
                    }
                    else
                    {
                        InfoSunat = clsConsulta.GetDataSunat(txtNroDocumento.Text.ToString());
                        if (InfoSunat.Count > 0)
                        {
                            txtProveedor.Text = InfoSunat[1].ToString();
                            if (InfoSunat[4].ToString().Contains("BAJA"))
                            {
                                lblEstado.ForeColor = Color.Red;
                            }
                            else
                            {
                                lblEstado.ForeColor = Color.Black;
                            }
                            lblEstado.Text    = InfoSunat[4].ToString();
                            lblDireccion.Text = InfoSunat[6].ToString();
                        }
                        else
                        {
                            InfoSunat = clsConsulta.GetDataSunat(txtNroDocumento.Text.ToString());
                            if (InfoSunat.Count > 0)
                            {
                                txtProveedor.Text = InfoSunat[1].ToString();
                                if (InfoSunat[4].ToString().Contains("BAJA"))
                                {
                                    lblEstado.ForeColor = Color.Red;
                                }
                                else
                                {
                                    lblEstado.ForeColor = Color.Black;
                                }
                                lblEstado.Text    = InfoSunat[4].ToString();
                                lblDireccion.Text = InfoSunat[6].ToString();
                            }
                        }
                    }
                }
                if (txtProveedor.Text == "")
                {
                    MessageBoxAdv.Show("Revise el Nª de RUC", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtNroDocumento.Focus();
                    return;
                }
                txtDenominacion.Focus();
                return;
            }
        }
Esempio n. 3
0
        private void txtRuc_KeyPress(object sender, KeyPressEventArgs e)
        {
            lblEstado.Text = "";
            ArrayList InfoSunat = new ArrayList();

            if ((Convert.ToInt32(e.KeyChar) == 9) || (Convert.ToInt32(e.KeyChar) == 13))
            {
                if (txtRuc.Text.ToString().Length != 11)
                {
                    MessageBoxAdv.Show("El ruc debe de tener 11 digitos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    clsConsultaSunat clsConsulta = new clsConsultaSunat();
                    InfoSunat = clsConsulta.GetDataSunat(txtRuc.Text.ToString());
                    if (InfoSunat.Count > 0)
                    {
                        txtRazonSocial.Text = InfoSunat[1].ToString();
                        if (InfoSunat[3].ToString() != "")
                        {
                            dptFechaCreacion.Value = Convert.ToDateTime(InfoSunat[3].ToString());
                        }
                        txtDireccion.Text = InfoSunat[6].ToString();
                        if (InfoSunat[4].ToString().Contains("BAJA"))
                        {
                            lblEstado.ForeColor = Color.Red;
                        }
                        else
                        {
                            lblEstado.ForeColor = Color.Black;
                        }
                        lblEstado.Text = InfoSunat[4].ToString();
                    }
                    else
                    {
                        InfoSunat = clsConsulta.GetDataSunat(txtRuc.Text.ToString());
                        dptFechaCreacion.Value = Convert.ToDateTime(InfoSunat[3].ToString());
                        txtDireccion.Text      = InfoSunat[6].ToString();
                        if (InfoSunat.Count > 0)
                        {
                            txtRazonSocial.Text = InfoSunat[1].ToString();
                            if (InfoSunat[4].ToString().Contains("BAJA"))
                            {
                                lblEstado.ForeColor = Color.Red;
                            }
                            else
                            {
                                lblEstado.ForeColor = Color.Black;
                            }
                            lblEstado.Text = InfoSunat[4].ToString();
                        }
                        else
                        {
                            InfoSunat = clsConsulta.GetDataSunat(txtRuc.Text.ToString());
                            dptFechaCreacion.Value = Convert.ToDateTime(InfoSunat[3].ToString());
                            txtDireccion.Text      = InfoSunat[6].ToString();
                            if (InfoSunat.Count > 0)
                            {
                                txtRazonSocial.Text = InfoSunat[1].ToString();
                                if (InfoSunat[4].ToString().Contains("BAJA"))
                                {
                                    lblEstado.ForeColor = Color.Red;
                                }
                                else
                                {
                                    lblEstado.ForeColor = Color.Black;
                                }
                                lblEstado.Text = InfoSunat[4].ToString();
                            }
                        }
                    }
                }
                if (txtRazonSocial.Text == "")
                {
                    MessageBoxAdv.Show("Revise el Nª de RUC", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtRuc.Focus();
                    return;
                }
                txtNRP.Focus();
                return;
            }
        }