private void btnGrupoImposto_Click(object sender, EventArgs e) { try { DataTable dtEmpresa = new DataTable(); dtEmpresa = empresaNegocios.PesquisarEmpresa(); FrmGerenciamentoTributario frmGerenciamentoTributario = new FrmGerenciamentoTributario(Convert.ToInt32(dtEmpresa.Rows[0]["RegimeTributario"])); frmGerenciamentoTributario.ShowInTaskbar = false; frmGerenciamentoTributario.pesquisaExterna = true; frmGerenciamentoTributario.Height = 496; frmGerenciamentoTributario.ShowDialog(); if (frmGerenciamentoTributario._TributacaoFiscalId > 0) { tributacaoFiscalId = frmGerenciamentoTributario._TributacaoFiscalId; txtDescricaoGrupoImposto.Text = frmGerenciamentoTributario._Descricao; } else { tributacaoFiscalId = 0; txtDescricaoGrupoImposto.Text = "SELECIONE O GRUPO DE IMPOSTO"; } txtValorCompra.Focus(); } catch { } }
private void RetornarRegimeTributarioEmpresa() { dtEmpresa = new DataTable(); dtEmpresa = empresaNegocios.PesquisarEmpresa(); }
private void CarregarEmpresa() { try { DataTable dtEmpresa = new DataTable(); dtEmpresa = empresaNegocios.PesquisarEmpresa(); if (dtEmpresa.Rows.Count > 0) { empresaId = Convert.ToInt32(dtEmpresa.Rows[0]["EmpresaId"].ToString()); txtRazaoSocial.Text = dtEmpresa.Rows[0]["RazaoSocial"].ToString(); txtNomeFantasia.Text = dtEmpresa.Rows[0]["NomeFantasia"].ToString(); txtTelefone.Text = dtEmpresa.Rows[0]["Telefone"].ToString(); txtCelular.Text = dtEmpresa.Rows[0]["Celular"].ToString(); txtCep.Text = dtEmpresa.Rows[0]["Cep"].ToString(); txtEndereco.Text = dtEmpresa.Rows[0]["Endereco"].ToString(); txtNumero.Text = dtEmpresa.Rows[0]["Numero"].ToString(); txtBairro.Text = dtEmpresa.Rows[0]["Bairro"].ToString(); if (dtEmpresa.Rows[0]["CidadeId"].ToString() != null) { dtCidade = cidadesNegocios.PesquisarPorCodigo(Convert.ToInt32(dtEmpresa.Rows[0]["CidadeId"])); txtCidade.Text = dtCidade.Rows[0]["Nome"].ToString(); } txtCpfCnpj.Text = dtEmpresa.Rows[0]["Cnpj"].ToString(); txtIE.Text = dtEmpresa.Rows[0]["IE"].ToString(); txtIM.Text = dtEmpresa.Rows[0]["IM"].ToString(); txtSite.Text = dtEmpresa.Rows[0]["SiteEmpresa"].ToString(); txtEmail.Text = dtEmpresa.Rows[0]["Email"].ToString(); if (dtEmpresa.Rows[0]["RegimeTributario"].ToString() == "1") { cbbRegimeTributario.Text = "1 - Simples Nacional"; } else if (dtEmpresa.Rows[0]["RegimeTributario"].ToString() == "2") { cbbRegimeTributario.Text = "2 - Simples Nacional - Excesso de sublimite de receita bruta"; } else { cbbRegimeTributario.Text = "3 - Regime Normal"; } if (dtEmpresa.Rows[0]["Csosn"].ToString() == "101") { cbbCSOSN.Text = "101 – Tributada pelo Simples Nacional com permissão de crédito"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "102") { cbbCSOSN.Text = "102 – Tributada pelo Simples Nacional sem permissão de crédito"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "103") { cbbCSOSN.Text = "103 – Isenção do ICMS no Simples Nacional para faixa de receita bruta"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "201") { cbbCSOSN.Text = "201 – Tributada pelo Simples Nacional com permissão de crédito e com cobrança do ICMS por substituição tributária"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "202") { cbbCSOSN.Text = "202 – Tributada pelo Simples Nacional sem permissão de crédito e com cobrança do ICMS por substituição tributária"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "203") { cbbCSOSN.Text = "203 – Isenção do ICMS no Simples Nacional para faixa de receita bruta e com cobrança do ICMS por substituição tributária"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "300") { cbbCSOSN.Text = "300 – Imune"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "400") { cbbCSOSN.Text = "400 – Não tributada pelo Simples Nacional"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "500") { cbbCSOSN.Text = "500 – ICMS cobrado anteriormente por substituição tributária (substituído) ou por antecipação"; } else if (dtEmpresa.Rows[0]["Csosn"].ToString() == "900") { cbbCSOSN.Text = "900 – Outros"; } #region Contador txtNomeC.Text = dtEmpresa.Rows[0]["NomeC"].ToString(); txtCpfC.Text = dtEmpresa.Rows[0]["CpfC"].ToString(); txtCRCC.Text = dtEmpresa.Rows[0]["CRCC"].ToString(); txtTelefoneC.Text = dtEmpresa.Rows[0]["TelefoneC"].ToString(); txtCelularC.Text = dtEmpresa.Rows[0]["CelularC"].ToString(); txtEmailC.Text = dtEmpresa.Rows[0]["EmailC"].ToString(); if (dtEmpresa.Rows[0]["CidadeCId"].ToString() != null) { dtCidade = cidadesNegocios.PesquisarPorCodigo(Convert.ToInt32(dtEmpresa.Rows[0]["CidadeCId"])); txtCidadeC.Text = dtCidade.Rows[0]["Nome"].ToString(); } #endregion #region Logotipo if (!string.IsNullOrEmpty(dtEmpresa.Rows[0]["Logotipo"].ToString())) { try { byte[] foto_array = (Byte[])dtEmpresa.Rows[0]["Logotipo"]; MemoryStream memoria = new MemoryStream(foto_array); pcbImagem.Image = Image.FromStream(memoria); } catch { } } #endregion #region CERFICADO DIGITAL //if (!string.IsNullOrEmpty(dtEmpresa.Rows[0]["CertificadoDigital"].ToString())) //{ // try // { // txtDadosCertificado.Text = dtEmpresa.Rows[0]["CertificadoDigital"].ToString(); // X509Store store = new X509Store("MY", StoreLocation.CurrentUser); // store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly); // X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates; // X509Certificate2Collection collection1 = null; // if (!string.IsNullOrEmpty(txtDadosCertificado.Text)) // collection1 = (X509Certificate2Collection)collection.Find(X509FindType.FindBySubjectDistinguishedName, txtDadosCertificado.Text, false); // for (int i = 0; i < collection1.Count; i++) // { // //Verificar a validade do certificado // if (DateTime.Compare(DateTime.Now, collection1[i].NotAfter) == -1) // { // certificado = collection1[i]; // break; // } // } // //Se não encontrou nenhum certificado com validade correta, vou pegar o primeiro certificado, porem vai travar na hora de tentar enviar a nota fiscal, por conta da validade. Wandrey 06/04/2011 // if (certificado == null && collection1.Count > 0) // certificado = collection1[0]; // if (certificado != null) // DemonstraDadosCertificado(); // } // catch { MessageBox.Show("Erro ao carregar o certificado digital", "Aviso do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); } //} #endregion } else { Limpar(); } } catch (Exception ex) { MessageBox.Show("ERRO:\n\nDetalhe técnico : " + ex.Message, "Aviso do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); } }