private void btnExcluir_Click(object sender, EventArgs e)
        {
            string deletar = "delete from usuarios where usu_codigo = " + txtCodigo.Text;

            SqlConnection con = new SqlConnection();

            con.ConnectionString = utils.ConexaoDb();
            SqlCommand cmd = new SqlCommand(deletar, con);

            cmd.CommandType = CommandType.Text;
            con.Open();
            try
            {
                int i = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    u.messageboxSucesso();
                }
            }
            catch (Exception ex)
            {
                u.messageboxErro(ex.ToString());
            }
            finally
            {
                con.Close();
            }
            Ulimpa();
        }
示例#2
0
        private void buttonExclui_Click(object sender, EventArgs e)
        {
            DialogResult escolha = MessageBox.Show("Você deseja realmente excluir o registro selecionado?", "Mensagem do Sitema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (escolha == DialogResult.Cancel)
            {
                buttonExclui.Enabled = false;
                btnCancela.Enabled   = true;
                buttonNovo.Enabled   = true;
                buttonSair.Enabled   = true;
                buttonSalva.Enabled  = false;
                txtCodCidade.Enabled = false;
                txtCidade.Enabled    = false;
                comboBoxUf.Enabled   = false;
                txtIbge.Enabled      = false;
                limpartxt.limparTextBoxes(this);
                comboBoxUf.Text = "PR";
            }
            else
            {
                string sql = "delete from cidades where cid_codigo = " + txtCodCidade.Text;

                SqlConnection con = new SqlConnection();
                con.ConnectionString = utils.ConexaoDb();
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.Text;
                con.Open();
                try
                {
                    int i = cmd.ExecuteNonQuery();
                    if
                    (i > 0)
                    {
                        u.messageboxSucesso();
                    }
                }
                catch (Exception ex)
                {
                    u.messageboxErro(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
            cIDADESDataGridView.Refresh();
            buttonExclui.Enabled = false;
            btnCancela.Enabled   = true;
            buttonNovo.Enabled   = true;
            buttonSair.Enabled   = true;
            buttonSalva.Enabled  = false;
            txtCodCidade.Enabled = false;
            txtIbge.Enabled      = false;
            txtCidade.Enabled    = false;
            comboBoxUf.Enabled   = false;
            limpartxt.limparTextBoxes(this);
            comboBoxUf.Text = "PR";
        }
示例#3
0
        private void btnExluir_Click(object sender, EventArgs e)
        {
            DialogResult escolha = MessageBox.Show("Deseja realmente excluir esse registro ?", "Mensagem do Sistema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (escolha == DialogResult.Cancel)
            {
                u.limparTextBoxes(this);
                u.limparMTextBoxes(this);
                txtCliente.Enabled     = false;
                txtFuncionario.Enabled = false;
                txtObs.Enabled         = false;
                mskData.Enabled        = false;
                mskHora.Enabled        = false;
                cbSituação.Text        = "Ocupado";
                btnCancela.Enabled     = false;
                btnExluir.Enabled      = false;
                btnSalvar.Enabled      = false;
                btnLocalizar.Enabled   = true;
            }
            else
            {
                string excluir = "delete from agenda where age_codigo = " + txtControle.Text;

                SqlConnection con = new SqlConnection();
                con.ConnectionString = utils.ConexaoDb();
                SqlCommand cmd = new SqlCommand(excluir, con);
                cmd.CommandType = CommandType.Text;
                con.Open();
                try
                {
                    int i = cmd.ExecuteNonQuery();
                    if
                    (i > 0)
                    {
                        u.messageboxSucesso();
                    }
                }
                catch (Exception ex)
                {
                    u.messageboxErro(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
        }
示例#4
0
        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult escolha = MessageBox.Show("Você deseja realmente excluir esse item?", "Excluir", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (escolha == DialogResult.Cancel)
            {
                textBoxNomeProcedimento.Enabled = false;
                btnNovo.Enabled     = true;
                btnCancelar.Enabled = false;
                u.limparTextBoxes(this);
                textBoxNomeProcedimento.Focus();
            }
            else
            {
                string        excrui = "delete from procedimentos where cod_procedimento = " + txtCodProcedimento.Text;
                SqlConnection con    = new SqlConnection();
                con.ConnectionString = utils.ConexaoDb();
                SqlCommand cmd = new SqlCommand(excrui, con);
                cmd.CommandType = CommandType.Text;
                con.Open();
                try
                {
                    int i = cmd.ExecuteNonQuery();
                    if (i > 0)
                    {
                        u.messageboxSucesso();
                    }
                }
                catch (Exception ex)
                {
                    u.messageboxErro(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
            txtCodProcedimento.Enabled      = false;
            textBoxNomeProcedimento.Enabled = false;
            btnCancelar.Enabled             = false;
            btnExcluir.Enabled = false;
            btnSalvar.Enabled  = false;
            btnNovo.Enabled    = true;
            u.limparTextBoxes(this);
            textBoxNomeProcedimento.Enabled = false;
        }
示例#5
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            DialogResult escolha = MessageBox.Show("Voce deseja realmente excluir esse registro ?", "Mensagem do Sistema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (escolha == DialogResult.Cancel)
            {
                //blabla bla
            }
            else
            {
                string        delete        = "delete from pedido where ped_codigo = " + txtControle.Text;
                string        deleteItem    = "delete from ITEMPEDIDO where ped_codigo = " + txtControle.Text;
                string        deleteEstoque = "delete from estoque where ven_codigo = " + txtControle.Text;
                SqlConnection con           = new SqlConnection();
                con.ConnectionString = utils.ConexaoDb();
                SqlCommand cmd = new SqlCommand(delete, con);
                cmd.CommandType = CommandType.Text;
                SqlCommand cmd1 = new SqlCommand(deleteItem, con);
                cmd1.CommandType = CommandType.Text;
                SqlCommand cmd2 = new SqlCommand(deleteEstoque, con);
                cmd2.CommandType = CommandType.Text;
                con.Open();
                try
                {
                    int i = cmd.ExecuteNonQuery();
                    int j = cmd1.ExecuteNonQuery();
                    int k = cmd2.ExecuteNonQuery();
                    if ((i > 0) || (j > 0) || (k > 0))
                    {
                        u.messageboxSucesso();
                    }
                }
                catch (Exception ex)
                {
                    u.messageboxErro(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
        }
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            DialogResult escolha = MessageBox.Show("Deseja realmente excluir esse registro? ", "Mensagem do sistema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (escolha == DialogResult.Cancel)
            {
            }
            else
            {
                string        excrui = "delete from funcionarios where cod_funcionario =  " + textBoxCodFuncionario.Text;
                SqlConnection con    = new SqlConnection();
                con.ConnectionString = utils.ConexaoDb();
                SqlCommand cmd = new SqlCommand(excrui, con);
                cmd.CommandType = CommandType.Text;
                con.Open();
                try
                {
                    int i = cmd.ExecuteNonQuery();
                    if
                    (i > 0)
                    {
                        u.messageboxSucesso();
                    }
                }
                catch (Exception ex)
                {
                    u.messageboxErro(ex.ToString());
                }
                finally
                {
                    funcionariosDataGridView.Refresh();
                    con.Close();
                }
                Unovo();
            }
        }
示例#7
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            decimal totalIpi    = 0;
            decimal totalICms   = 0;
            decimal totalpis    = 0;
            decimal totalCofins = 0;

            string  dataEmissao            = mskDtVenda.Text.Trim();
            int     numeroNota             = Convert.ToInt32(txtNunNota.Text.Trim());
            string  modeloNota             = "55";
            string  serie                  = txtSerie.Text;
            string  finalidadeNota         = comboBox1.SelectedIndex.ToString();
            int     cadastro               = Convert.ToInt32(txtcodFornecedor.Text.Trim());
            string  cfop                   = txtCodCfod.Text.Trim();
            string  nfeReferenciada        = txtNFEreferenciada.Text.Trim();
            decimal subtotal               = Convert.ToDecimal(txtsomaTudo.Text.Trim());
            decimal desconto               = Convert.ToDecimal(txtSomaDesconto.Text.Trim());
            decimal totaldaNotacomdesconto = Convert.ToDecimal(txtCdesconto.Text.Trim());
            string  obsNota                = txtObs.Text.Trim();
            string  transportador;

            if (txtCodTransp.Text == string.Empty)
            {
                transportador = "0";
            }
            else
            {
                transportador = txtCodTransp.Text.Trim();
            }
            string vencimento = txtVenc.Text;

            string updateNota = "update nota set not_dtemissao = @not_dtemissao, not_numero = @not_numero, not_modelo = @not_modelo, not_serie = not_serie, not_finalidade = @not_finalidade,"
                                + "cadastro = @cadastro, cfo_codigo = @cfo_codigo, not_referenciada = @not_referenciada, not_subtotal = @not_subtotal, not_desconto = @not_desconto, not_nfetotal = @not_nfetotal,"
                                + "not_obs = @not_obs, cod_forncedor = @cad_fornecedor, not_vencimento = @not_vencimento, not_cancelada = @not_cancelada, not_inutilizada = @not_inutilizada, not_peso = @not_peso,"
                                + "not_volume = @not_volume, not_marca = @not_marca, not_icmsbase = @not_icmsbase, not_icmsvalor = @not_icmsvalor, not_icmspercentual = @not_icmspercentual,"
                                + "not_icmsstvalor = @not_icmsstvalor   where not_codigo = " + txtControle.Text;

            SqlConnection con = new SqlConnection();

            con.ConnectionString = utils.ConexaoDb();
            SqlCommand cmd = new SqlCommand(updateNota, con);

            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add("@not_dtemissao", SqlDbType.NVarChar).Value     = dataEmissao;
            cmd.Parameters.Add("@not_numero", SqlDbType.Int).Value             = numeroNota;
            cmd.Parameters.Add("@not_modelo", SqlDbType.NVarChar).Value        = modeloNota;
            cmd.Parameters.Add("@not_serie", SqlDbType.NVarChar).Value         = serie;
            cmd.Parameters.Add("@not_finalidade", SqlDbType.NVarChar).Value    = finalidadeNota;
            cmd.Parameters.Add("@cadastro", SqlDbType.Int).Value               = cadastro;
            cmd.Parameters.Add("@cfo_codigo", SqlDbType.Int).Value             = cfop;
            cmd.Parameters.Add("@not_referenciada", SqlDbType.NVarChar).Value  = nfeReferenciada;
            cmd.Parameters.Add("@not_subtotal", SqlDbType.Decimal).Value       = subtotal;
            cmd.Parameters.Add("@not_desconto", SqlDbType.Decimal).Value       = desconto;
            cmd.Parameters.Add("@not_nfetotal", SqlDbType.Decimal).Value       = totaldaNotacomdesconto;
            cmd.Parameters.Add("@not_obs", SqlDbType.NVarChar).Value           = obsNota;
            cmd.Parameters.Add("@cad_fornecedor", SqlDbType.Int).Value         = transportador;
            cmd.Parameters.Add("@not_vencimento", SqlDbType.NVarChar).Value    = vencimento;
            cmd.Parameters.Add("@not_cancelada", SqlDbType.Int).Value          = 0;
            cmd.Parameters.Add("@not_inutilizada", SqlDbType.Int).Value        = 0;
            cmd.Parameters.Add("@not_peso", SqlDbType.NVarChar).Value          = 1;
            cmd.Parameters.Add("@not_volume", SqlDbType.NVarChar).Value        = 1;
            cmd.Parameters.Add("@not_marca", SqlDbType.NVarChar).Value         = "marca";
            cmd.Parameters.Add("@not_icmsbase", SqlDbType.Decimal).Value       = 0;
            cmd.Parameters.Add("@not_icmsvalor", SqlDbType.Decimal).Value      = 0;
            cmd.Parameters.Add("@not_icmspercentual", SqlDbType.Decimal).Value = 0;
            cmd.Parameters.Add("@not_icmsstvalor", SqlDbType.Decimal).Value    = 0;
            con.Open();
            try
            {
                int i = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    u.messageboxSucesso();
                }
                var nfeContexto = new NFeContexto(false, NFeEletronica.Versao.NFeVersao.VERSAO_3_1_0, new GerenciadorDeCertificado());
                var nota        = new Nota(nfeContexto);
                nota.ide.cUF    = "41";
                nota.ide.natOp  = txtDescCfop.Text;
                nota.ide.indPag = "0";
                nota.ide.mod    = "55";
                nota.ide.serie  = txtSerie.Text;

                //string ultimoReg = "Select not_codigo From nota where not_codigo = (Select MAX(not_numero) From nota)";

                //SqlConnection con1 = new SqlConnection();
                //con.ConnectionString = utils.ConexaoDb();
                //SqlCommand cmd2 = new SqlCommand(ultimoReg, con1);

                //con.Open();
                //SqlDataReader dR = cmd2.ExecuteReader();

                //if (dR.Read())
                //{
                //    txtNunNota.Text = 1 + dR[0].ToString();
                //}
                //con.Close();
                DataContext db           = new DataContext();
                var         pessoa       = db.Clientes.Find(Convert.ToInt32(txtcodFornecedor.Text.Trim()));
                var         CidadeEstado = db.Cidades.Find(pessoa.CidadeCodigo);

                nota.ide.nNF      = txtNunNota.Text;
                nota.ide.dEmi     = mskDtVenda.Text;
                nota.ide.tpNF     = "1"; //normal contingencia
                nota.ide.cMunFG   = CidadeEstado.Ibge;
                nota.ide.tpImp    = "1";
                nota.ide.tpEmis   = "1";
                nota.ide.cDV      = "0";
                nota.ide.idDest   = "1";
                nota.ide.indFinal = "0";
                nota.ide.indPres  = "0";
                nota.ide.tpAmb    = "2";
                nota.ide.finNFe   = finalidadeNota;
                nota.ide.procEmi  = "3";// soft utilizado
                //
                DataContext.fil_codigo = Convert.ToInt32(textBox3.Text.Trim());
                var filial = db.Filiais.Find(DataContext.fil_codigo);
                nota.emit.CNPJ    = filial.CpfCnpj;
                nota.emit.xNome   = filial.Razao;
                nota.emit.xLgr    = filial.Endereco;
                nota.emit.nro     = filial.Numero;
                nota.emit.xBairro = filial.Bairro;

                var cidade = db.Cidades.Find(filial.CidadeCodigo);
                nota.emit.cMun  = cidade.Ibge;
                nota.emit.xMun  = cidade.Descricao;
                nota.emit.UF    = cidade.UF;
                nota.emit.CEP   = filial.Cep;
                nota.emit.cPais = "1058";
                nota.emit.xPais = "Brasil";
                nota.emit.fone  = filial.Telefone;
                nota.emit.IE    = filial.IE;
                nota.emit.CRT   = "1";

                //financeiro
                var dup = new NFeEletronica.NotaFiscal.DUP();
                dup.nDup  = "123";
                dup.dVenc = "2014-03-21";
                dup.vDup  = "23.33";
                nota.cobr.dup.Add(dup);

                //transportadora
                nota.transp.modFrete = "1";
                nota.transp.xNome    = "O Mesmo";
                nota.transp.IE       = "637322284114";
                nota.transp.xEnder   = "Rua ficticia, 123";
                nota.transp.xMun     = "São Lucas";
                nota.transp.UF       = "RO";
                //produstos
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    foreach (DataGridViewColumn column in dataGridView1.Columns)
                    {
                        var notaProduto = new DET();
                        notaProduto.cProd = row.Cells["Column1"].Value.ToString();
                        DataView dv             = new DataView(DataContext.CarregaProdutos());
                        Produto  produto        = new Produto();
                        var      produtoIncluir = db.Produtos.Find(Convert.ToInt32(notaProduto.cProd));

                        notaProduto.cEAN     = produtoIncluir.EAN;
                        notaProduto.xProd    = produtoIncluir.Descricao;
                        notaProduto.NCM      = produtoIncluir.NCM;
                        notaProduto.CFOP     = Convert.ToString(produtoIncluir.CFOP);
                        notaProduto.uCom     = produtoIncluir.UnidadeMedida;
                        notaProduto.qCom     = row.Cells["Column2"].Value.ToString();
                        notaProduto.vUnCom   = row.Cells["Column3"].Value.ToString();
                        notaProduto.vProd    = row.Cells["Column4"].Value.ToString();
                        notaProduto.cEANTrib = produtoIncluir.EAN;
                        notaProduto.uTrib    = produtoIncluir.UnidadeMedida;
                        notaProduto.qTrib    = notaProduto.qCom;
                        notaProduto.vUnTrib  = notaProduto.vUnCom;
                        notaProduto.indTot   = "1";

                        switch (produtoIncluir.CstICMS)
                        {
                        case "00":
                            notaProduto.icms = ICMS.ICMS00;
                            break;

                        case "10":
                            notaProduto.icms = ICMS.ICMS10;
                            break;

                        case "20":
                            notaProduto.icms = ICMS.ICMS20;
                            break;

                        case "30":
                            notaProduto.icms = ICMS.ICMS30;
                            break;

                        case "40":
                            notaProduto.icms = ICMS.ICMS40_50;
                            break;

                        case "41":
                            notaProduto.icms = ICMS.ICMS40_50;
                            break;

                        case "50":
                            notaProduto.icms = ICMS.ICMS40_50;
                            break;

                        case "51":
                            notaProduto.icms = ICMS.ICMS51;
                            break;

                        case "60":
                            notaProduto.icms = ICMS.ICMS60;
                            break;

                        case "70":
                            notaProduto.icms = ICMS.ICMS70;
                            break;

                        case "90":
                            notaProduto.icms = ICMS.ICMS90;
                            break;

                        case "101":
                            notaProduto.icms = ICMS.ICMS101;
                            break;

                        case "102":
                            notaProduto.icms = ICMS.ICMS102_400;
                            break;

                        case "103":
                            notaProduto.icms = ICMS.ICMS102_400;
                            break;

                        case "201":
                            notaProduto.icms = ICMS.ICMS201;
                            break;

                        case "202":
                            notaProduto.icms = ICMS.ICMS202;
                            break;

                        case "500":
                            notaProduto.icms = ICMS.ICMS500;
                            break;

                        case "900":
                            notaProduto.icms = ICMS.ICMS900;
                            break;

                        default:
                            notaProduto.icms = ICMS.ICMS00;
                            break;
                        }
                        notaProduto.icms_orig = Convert.ToString(produtoIncluir.OrigemDoProduto);
                        if (nota.emit.CRT == "1")
                        {
                            notaProduto.icms_CSOSN = produtoIncluir.CstICMS;
                        }
                        else
                        {
                            notaProduto.icms_CST = produtoIncluir.CstICMS;
                        }

                        notaProduto.ipi      = IPI.IPI00_49_50_99;
                        notaProduto.ipi_CST  = "99";
                        notaProduto.ipi_vIPI = "0";

                        notaProduto.pis      = PIS.PIS01_02;
                        notaProduto.pis_CST  = "01";
                        notaProduto.pis_vBC  = "0";
                        notaProduto.pis_pPIS = "0";
                        notaProduto.pis_vPIS = "0";

                        notaProduto.cofins         = COFINS.CST01_02;
                        notaProduto.cofins_CST     = "01";
                        notaProduto.cofins_vBC     = "0";
                        notaProduto.cofins_pCOFINS = "0";
                        notaProduto.cofins_vCOFINS = "0";

                        nota.AddDet(notaProduto);
                    }
                }
                //fim de um produto
                if (nota.emit.CRT == "1")
                {
                    nota.total.vBC = "0.00";
                }
                else
                {
                    nota.total.vBC = Convert.ToString(totaldaNotacomdesconto);
                }

                nota.total.vICMS      = "0.00";
                nota.total.vICMSDeson = "0.00";
                nota.total.vBCST      = "0.00";
                nota.total.vST        = "0.00";
                nota.total.vProd      = "1.00";
                nota.total.vFrete     = "0.00";
                nota.total.vSeg       = "0.00";
                nota.total.vDesc      = "0.00";
                nota.total.vII        = "0.00";
                nota.total.vIPI       = "0.00";
                nota.total.vPIS       = "0.00";
                nota.total.vCOFINS    = "0.00";
                nota.total.vOutro     = "0.00";
                nota.total.vNF        = "1.00";
                nota.total.vTotTrib   = "0.00";

                nota.SalvarNota(@"C:\temp\teste-nota.xml");
            }
            catch (Exception ex)
            {
                u.messageboxErro(ex.ToString());
            }
            finally
            {
                con.Close();
            }
            Unovo();
        }
示例#8
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            DialogResult escolha = MessageBox.Show("Deseja realmente excluir esse registro", "Mensagem do Sistema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (escolha == DialogResult.Cancel)
            {
                u.limparTextBoxes(this);
                u.limparMTextBoxes(this);
                btnCancela.Enabled     = false;
                btnBForn.Enabled       = false;
                btnExcluir.Enabled     = false;
                btnNovo.Enabled        = true;
                btnPesquisar.Enabled   = true;
                btnSair.Enabled        = true;
                btnSalvar.Enabled      = false;
                txtCCadastro.Enabled   = false;
                txtControle.Enabled    = false;
                txtNcadastro.Enabled   = false;
                txtObs.Enabled         = false;
                txtValor.Enabled       = false;
                txtVlPago.Enabled      = false;
                mskDtVenc.Enabled      = false;
                maskedTextBox1.Enabled = false;
                cdSituacao.Enabled     = false;
                this.MaximizeBox       = false;
            }
            else
            {
                string        excluir = "delete from cpagar where pag_codigo = " + txtControle.Text;
                SqlConnection con     = new SqlConnection();
                con.ConnectionString = utils.ConexaoDb();
                SqlCommand cmd = new SqlCommand(excluir, con);
                cmd.CommandType = CommandType.Text;
                con.Open();
                try
                {
                    int i = cmd.ExecuteNonQuery();
                    if
                    (i > 0)
                    {
                        u.messageboxSucesso();
                    }
                }
                catch (Exception ex)
                {
                    u.messageboxErro(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
            u.limparTextBoxes(this);
            u.limparMTextBoxes(this);
            btnCancela.Enabled     = false;
            btnExcluir.Enabled     = false;
            btnNovo.Enabled        = true;
            btnBForn.Enabled       = false;
            btnPesquisar.Enabled   = true;
            btnSair.Enabled        = true;
            btnSalvar.Enabled      = false;
            txtCCadastro.Enabled   = false;
            txtControle.Enabled    = false;
            txtNcadastro.Enabled   = false;
            txtObs.Enabled         = false;
            txtValor.Enabled       = false;
            txtVlPago.Enabled      = false;
            mskDtVenc.Enabled      = false;
            maskedTextBox1.Enabled = false;
            cdSituacao.Enabled     = false;
            this.MaximizeBox       = false;
        }
示例#9
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (textBoxRazao.Text == string.Empty)
            {
                textBoxRazao.BackColor = Color.Gold;
                u.messageboxCamposObrigatorio();
            }
            else
            {
                if (txtcid.Text == string.Empty)
                {
                    textBoxCidade.Text = "0";
                }
                string vRazao   = textBoxRazao.Text;
                string fantasia = textBoxFantasia.Text;
                string endereco = textBoxBairro.Text;
                string bairro   = textBoxBairro.Text;
                int    cidade   = Convert.ToInt32(textBoxCidade.Text);
                string telefone = maskedTextBoxTelefone.Text;
                string celular  = maskedTextBoxCelular.Text;
                string cep      = maskedTextBoxCep.Text;
                string obs      = textBoxObs.Text;
                string cnpj     = maskedTextBoxCnpj.Text;
                string numero   = textBoxNumero.Text;
                string email    = textBoxEmail.Text;
                if (novo)
                {
                    string        sql = "insert into fornecedores(razão, fantasia, endereco, bairro,cidade, telefone, celular, cep, obs, cnpj, numero, email) values(@razão, @fantasia, @endereco, @bairro, @cidade, @telefone, @celular, @cep, @obs, @cnpj, @numero, @email )";
                    SqlConnection con = new SqlConnection();
                    con.ConnectionString = utils.ConexaoDb();
                    SqlCommand cmd = new SqlCommand(sql, con);
                    cmd.CommandType = CommandType.Text;
                    cmd.Parameters.Add("@razão", SqlDbType.VarChar).Value    = vRazao;
                    cmd.Parameters.Add("@fantasia", SqlDbType.VarChar).Value = fantasia;
                    cmd.Parameters.Add("@endereco", SqlDbType.VarChar).Value = endereco;
                    cmd.Parameters.Add("@bairro", SqlDbType.VarChar).Value   = bairro;
                    cmd.Parameters.Add("@cidade", SqlDbType.Int).Value       = cidade;
                    cmd.Parameters.Add("@telefone", SqlDbType.VarChar).Value = telefone;
                    cmd.Parameters.Add("@celular", SqlDbType.VarChar).Value  = celular;
                    cmd.Parameters.Add("@cep", SqlDbType.VarChar).Value      = cep;
                    cmd.Parameters.Add("@obs", SqlDbType.VarChar).Value      = obs;
                    cmd.Parameters.Add("@cnpj", SqlDbType.VarChar).Value     = cnpj;
                    cmd.Parameters.Add("@numero", SqlDbType.VarChar).Value   = numero;
                    cmd.Parameters.Add("@email", SqlDbType.VarChar).Value    = email;
                    con.Open();
                    fornecedoresDataGridView.Refresh();
                    try
                    {
                        int i = cmd.ExecuteNonQuery();
                        if (i > 0)
                        {
                            u.messageboxSucesso();
                        }
                    }
                    catch (Exception ex)
                    {
                        u.messageboxErro(ex.ToString());
                    }
                    finally
                    {
                        fornecedoresDataGridView.Refresh();
                        con.Close();
                    }
                }
                else
                {
                    string sql = "update fornecedores set razão = @razão, fantasia = @fantasia, endereco = @endereco, bairro = @bairro, cidade = @cidade, telefone = @telefone, celular = @celular, cep = @cep, obs = @obs, cnpj = @cnpj,  numero = @numero, email = @email where cod_fornecedor = " + textBoxCodFornecedor.Text;

                    SqlConnection con = new SqlConnection();
                    con.ConnectionString = utils.ConexaoDb();
                    SqlCommand cmd = new SqlCommand(sql, con);
                    cmd.CommandType = CommandType.Text;
                    cmd.Parameters.Add("@razão", SqlDbType.VarChar).Value    = vRazao;
                    cmd.Parameters.Add("@fantasia", SqlDbType.VarChar).Value = fantasia;
                    cmd.Parameters.Add("@endereco", SqlDbType.VarChar).Value = endereco;
                    cmd.Parameters.Add("@bairro", SqlDbType.VarChar).Value   = bairro;
                    cmd.Parameters.Add("@cidade", SqlDbType.Int).Value       = cidade;
                    cmd.Parameters.Add("@telefone", SqlDbType.VarChar).Value = telefone;
                    cmd.Parameters.Add("@celular", SqlDbType.VarChar).Value  = celular;
                    cmd.Parameters.Add("@cep", SqlDbType.VarChar).Value      = cep;
                    cmd.Parameters.Add("@obs", SqlDbType.VarChar).Value      = obs;
                    cmd.Parameters.Add("@cnpj", SqlDbType.VarChar).Value     = cnpj;
                    cmd.Parameters.Add("@numero", SqlDbType.VarChar).Value   = numero;
                    cmd.Parameters.Add("@email", SqlDbType.VarChar).Value    = email;
                    con.Open();
                    fornecedoresDataGridView.Refresh();
                    try
                    {
                        int i = cmd.ExecuteNonQuery();
                        if (i > 0)
                        {
                            u.messageboxSucesso();
                        }
                    }
                    catch (Exception ex)
                    {
                        u.messageboxErro(ex.ToString());
                    }
                    finally
                    {
                        fornecedoresDataGridView.Refresh();
                        con.Close();
                    }
                }
                u.limparMTextBoxes(this);
                u.limparTextBoxes(this);
                btnNovo.Enabled = true;
                textBoxCodFornecedor.Enabled  = false;
                textBoxBairro.Enabled         = false;
                textBoxCidade.Enabled         = false;
                textBoxEmail.Enabled          = false;
                textBoxEndereco.Enabled       = false;
                textBoxFantasia.Enabled       = false;
                textBoxNumero.Enabled         = false;
                textBoxRazao.Enabled          = false;
                maskedTextBoxCelular.Enabled  = false;
                maskedTextBoxCep.Enabled      = false;
                maskedTextBoxCnpj.Enabled     = false;
                maskedTextBoxTelefone.Enabled = false;
                buttoncancel.Enabled          = false;
                btnExcluir.Enabled            = false;
                txtNcidade.Enabled            = false;
                btnSalvar.Enabled             = false;
                txtcid.BackColor       = SystemColors.Window;
                textBoxRazao.BackColor = SystemColors.Window;
            }
        }
示例#10
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (
                textBox1CustoPro.Text == string.Empty ||
                textBoxDescricao.Text == string.Empty ||
                textBoxMarge.Text == string.Empty ||
                textBoxVlVenda.Text == string.Empty ||
                txtCfornecedor.Text == string.Empty)
            {
                txtCfornecedor.BackColor   = Color.Gold;
                textBox1CustoPro.BackColor = Color.Gold;
                textBoxDescricao.BackColor = Color.Gold;
                textBoxMarge.BackColor     = Color.Gold;
                textBoxVlVenda.BackColor   = Color.Gold;
                u.messageboxCamposObrigatorio();
            }
            else
            {
                produtos.CFOP = Convert.ToInt32(comboCfop.Text);
                produtos.CEST = txtCest.Text;
                produtos.NCM  = txtNcm.Text;
                string origem = comboOrigem.SelectedIndex.ToString();
                produtos.OrigemDoProduto = Convert.ToInt32(comboOrigem.SelectedIndex.ToString());
                int situacao = Convert.ToInt32(comboSituacao.SelectedIndex.ToString());
                produtos.Situacao   = Convert.ToInt32(comboSituacao.SelectedIndex.ToString());
                produtos.AliqInter  = Convert.ToDecimal(comboAliqINter.SelectedIndex.ToString());
                produtos.AliqIcms   = Convert.ToDecimal(txtAliqIcms.Text);
                produtos.AliqIpi    = Convert.ToDecimal(txtAliqIpi.Text);
                produtos.AliqPis    = Convert.ToDecimal(txtAliqPis.Text);
                produtos.AliqCofins = Convert.ToDecimal(txtAliqCofins.Text);
                produtos.CstICMS    = comboCstIcms.Text;
                produtos.CstIPI     = comboCstIpi.Text;
                produtos.CstPIS     = comboCstPis.Text;
                produtos.CstCOFINS  = comboCstCofins.Text;

                produtos.ValorVenda        = Convert.ToDecimal(textBoxVlVenda.Text);
                produtos.Custo             = Convert.ToDecimal(textBox1CustoPro.Text);
                produtos.Margem            = Convert.ToDecimal(textBoxMarge.Text);
                produtos.Estoque           = Convert.ToDecimal(textBoxEstoque.Text);
                produtos.Descricao         = textBoxDescricao.Text;
                produtos.EAN               = textBoxBarras.Text;
                produtos.UnidadeMedida     = textBoxUnMedida.Text;
                produtos.DescricaoReduzida = textBoxDesRed.Text;
                produtos.FornecedorID      = Convert.ToInt32(txtCfornecedor.Text.Trim());


                if (novo)
                {
                    string        sql = "insert into produtos(des_produto,ean, cod_fornecedor, est_produto,un_medida,desc_reduzida,vl_produto,custo,margem,cfo_codigo,cest,ncm,origem,situacao,aliqinter,aliqicms,aliqipi,aliqpis,aliqcofins,csticms,cstipi,cstpis,cstcofins) Values(@des_produto,@ean, @cod_fornecedor, @est_produto,@un_medida,@desc_reduzida,@vl_produto,@custo,@margem,@cfo_codigo,@cest,@ncm,@origem,@situacao,@aliqinter,@aliqicms,@aliqipi,@aliqpis,@aliqcofins,@csticms,@cstipi,@cstpis,@cstcofins)";
                    SqlConnection con = new SqlConnection();
                    con.ConnectionString = utils.ConexaoDb();
                    SqlCommand cmd = new SqlCommand(sql, con);
                    cmd.Parameters.Add("@cfo_codigo", SqlDbType.Int).Value        = produtos.CFOP;
                    cmd.Parameters.Add("@cest", SqlDbType.NVarChar).Value         = produtos.CEST;
                    cmd.Parameters.Add("@ncm", SqlDbType.NVarChar).Value          = produtos.NCM;
                    cmd.Parameters.Add("@origem", SqlDbType.Int).Value            = produtos.OrigemDoProduto;
                    cmd.Parameters.Add("@situacao", SqlDbType.Int).Value          = produtos.Situacao;
                    cmd.Parameters.Add("@aliqinter", SqlDbType.NVarChar).Value    = produtos.AliqInter;
                    cmd.Parameters.Add("@aliqicms", SqlDbType.Decimal).Value      = produtos.AliqIcms;
                    cmd.Parameters.Add("@aliqipi", SqlDbType.Decimal).Value       = produtos.AliqIpi;
                    cmd.Parameters.Add("@aliqpis", SqlDbType.Decimal).Value       = produtos.AliqPis;
                    cmd.Parameters.Add("@aliqcofins", SqlDbType.Decimal).Value    = produtos.AliqCofins;
                    cmd.Parameters.Add("@csticms", SqlDbType.NVarChar).Value      = produtos.CstICMS;
                    cmd.Parameters.Add("@cstipi", SqlDbType.NVarChar).Value       = produtos.CstIPI;
                    cmd.Parameters.Add("@cstpis", SqlDbType.NVarChar).Value       = produtos.CstPIS;
                    cmd.Parameters.Add("@cstcofins", SqlDbType.NVarChar).Value    = produtos.CstCOFINS;
                    cmd.Parameters.Add("@ean", SqlDbType.VarChar).Value           = produtos.EAN;
                    cmd.Parameters.Add("@cod_fornecedor", SqlDbType.Int).Value    = produtos.FornecedorID;
                    cmd.Parameters.Add("@un_medida", SqlDbType.VarChar).Value     = produtos.UnidadeMedida;
                    cmd.Parameters.Add("@desc_reduzida", SqlDbType.VarChar).Value = produtos.UnidadeMedida;
                    cmd.Parameters.Add("@des_produto", SqlDbType.VarChar).Value   = produtos.DescricaoReduzida;
                    cmd.Parameters.Add("@est_produto", SqlDbType.Decimal).Value   = produtos.Estoque;
                    cmd.Parameters.Add("@vl_produto", SqlDbType.Decimal).Value    = produtos.ValorVenda;
                    cmd.Parameters.Add("@custo", SqlDbType.Decimal).Value         = produtos.Custo;
                    cmd.Parameters.Add("@margem", SqlDbType.Decimal).Value        = produtos.Margem;
                    cmd.CommandType = CommandType.Text;
                    con.Open();
                    produtosDataGridView.Refresh();
                    try
                    {
                        int i = cmd.ExecuteNonQuery();
                        if (i > 0)
                        {
                            u.messageboxSucesso();
                        }
                    }
                    catch (Exception ex)
                    {
                        u.messageboxErro(ex.ToString());
                    }
                    finally
                    {
                        con.Close();
                    }
                }
                else
                {
                    produtos.ID = Convert.ToInt32(textBoxCodPoduto.Text);
                    string sql = "update produtos set des_produto = @des_produto, cod_fornecedor = @cod_fornecedor, ean = @ean, est_produto = @est_produto, un_medida = @un_medida, vl_produto = @vl_produto, custo = @custo, margem = @margem, cfo_codigo = @cfo_codigo,cest = @cest,ncm = @ncm,origem = @origem,situacao = @situacao,aliqinter = @aliqinter,aliqicms = @aliqicms,aliqipi = @aliqipi,aliqpis = @aliqpis,aliqcofins = @aliqcofins,csticms = @csticms,cstipi = @cstipi,cstpis = @cstpis,cstcofins = @cstcofins where cod_produto = " + produtos.ID;


                    SqlConnection con = new SqlConnection();
                    con.ConnectionString = utils.ConexaoDb();
                    SqlCommand cmd = new SqlCommand(sql, con);
                    cmd.Parameters.Add("@cfo_codigo", SqlDbType.Int).Value        = produtos.CFOP;
                    cmd.Parameters.Add("@cest", SqlDbType.NVarChar).Value         = produtos.CEST;
                    cmd.Parameters.Add("@ncm", SqlDbType.NVarChar).Value          = produtos.NCM;
                    cmd.Parameters.Add("@origem", SqlDbType.Int).Value            = produtos.OrigemDoProduto;
                    cmd.Parameters.Add("@situacao", SqlDbType.Int).Value          = produtos.Situacao;
                    cmd.Parameters.Add("@aliqinter", SqlDbType.NVarChar).Value    = produtos.AliqInter;
                    cmd.Parameters.Add("@aliqicms", SqlDbType.NVarChar).Value     = produtos.AliqIcms;
                    cmd.Parameters.Add("@aliqipi", SqlDbType.NVarChar).Value      = produtos.AliqIpi;
                    cmd.Parameters.Add("@aliqpis", SqlDbType.NVarChar).Value      = produtos.AliqPis;
                    cmd.Parameters.Add("@aliqcofins", SqlDbType.NVarChar).Value   = produtos.AliqCofins;
                    cmd.Parameters.Add("@csticms", SqlDbType.NVarChar).Value      = produtos.AliqIcms;
                    cmd.Parameters.Add("@cstipi", SqlDbType.NVarChar).Value       = produtos.AliqIpi;
                    cmd.Parameters.Add("@cstpis", SqlDbType.NVarChar).Value       = produtos.AliqIcms;
                    cmd.Parameters.Add("@cstcofins", SqlDbType.NVarChar).Value    = produtos.CstCOFINS;
                    cmd.Parameters.Add("@ean", SqlDbType.VarChar).Value           = produtos.EAN;
                    cmd.Parameters.Add("@cod_fornecedor", SqlDbType.Int).Value    = produtos.FornecedorID;
                    cmd.Parameters.Add("@un_medida", SqlDbType.VarChar).Value     = produtos.UnidadeMedida;
                    cmd.Parameters.Add("@desc_reduzida", SqlDbType.VarChar).Value = produtos.DescricaoReduzida;
                    cmd.Parameters.Add("@des_produto", SqlDbType.VarChar).Value   = produtos.Descricao;
                    cmd.Parameters.Add("@est_produto", SqlDbType.Decimal).Value   = produtos.Estoque;
                    cmd.Parameters.Add("@vl_produto", SqlDbType.Decimal).Value    = produtos.ValorVenda;
                    cmd.Parameters.Add("@custo", SqlDbType.Decimal).Value         = produtos.Custo;
                    cmd.Parameters.Add("@margem", SqlDbType.Decimal).Value        = produtos.Margem;
                    cmd.CommandType = CommandType.Text;
                    con.Open();

                    try
                    {
                        int i = cmd.ExecuteNonQuery();
                        if (i > 0)
                        {
                            u.messageboxSucesso();
                        }
                    }
                    catch (Exception ex)
                    {
                        u.messageboxErro(ex.ToString());
                    }
                    finally
                    {
                        con.Close();
                    }
                }
                Unovo();
                txtCfornecedor.BackColor   = SystemColors.Window;
                textBox1CustoPro.BackColor = SystemColors.Window;
                textBoxDescricao.BackColor = SystemColors.Window;
                textBoxMarge.BackColor     = SystemColors.Window;
                textBoxVlVenda.BackColor   = SystemColors.Window;
            }
        }
示例#11
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            cliente.ID = Convert.ToInt32(textBoxCodCliente.Text);

            DialogResult escolha = MessageBox.Show("Deseja realmente excluir esse registro ?", "Mensagem do Sitema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (escolha == DialogResult.Cancel)
            {
                u.limparTextBoxes(this);
                u.limparMTextBoxes(this);
                u.DisableTxt(this);
                u.DisableMasked(this);
                btnPcidade.Enabled = false;
                btnExcluir.Enabled = false;
                btnSalvar.Enabled  = false;
                buttonCancelaCadcliente.Enabled = false;
                btnNovo.Enabled = true;
                btnNovo.Enabled = true;
                btnNovo.Focus();
            }
            else
            {
                string sql = "DELETE FROM CLIENTES WHERE cod_cliente =" + cliente.ID;

                SqlConnection con = new SqlConnection();
                con.ConnectionString = utils.ConexaoDb();
                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.Text;
                con.Open();
                clientesDataGridView.Refresh();

                try
                {
                    int i = cmd.ExecuteNonQuery();
                    if (i > 0)
                    {
                        u.messageboxSucesso();
                    }
                }
                catch (Exception ex)
                {
                    u.messageboxErro(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
            }
            u.limparMTextBoxes(this);
            u.limparTextBoxes(this);
            btnNovo.Enabled                      = true;
            textBoxCodCliente.Enabled            = false;
            btnPcidade.Enabled                   = false;
            txtCodCid.Enabled                    = false;
            textBoxNumero.Enabled                = false;
            textBoxBairroCliente.Enabled         = false;
            textBoxCidadeCliente.Enabled         = false;
            textBoxEmailCliente.Enabled          = false;
            textBoxEndereco.Enabled              = false;
            textBoxNomeCliente.Enabled           = false;
            textBoxObs.Enabled                   = false;
            maskedTextBoxCel.Enabled             = false;
            maskedTextBoxCepCliente.Enabled      = false;
            maskedTextBoxCpf.Enabled             = false;
            maskedTextBoxDatanas.Enabled         = false;
            maskedTextBoxTelefoneCliente.Enabled = false;
            btnNovo.Enabled                      = true;
            btnExcluir.Enabled                   = false;
            btnSalvar.Enabled                    = false;
            buttonCancelaCadcliente.Enabled      = false;
            btnNovo.Focus();
        }
示例#12
0
        private void buttonExclui_Click(object sender, EventArgs e)
        {
            if (DataContext.TipoConexao == 2)
            {
                Cfop cfop = new Cfop();
                cfop.ID = Convert.ToInt32(txtCodCopf.Text);

                DialogResult escolha = MessageBox.Show("Deseja realmente excluir esse registro ?", "Mensagem do Sitema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (escolha == DialogResult.Cancel)
                {
                }
                else
                {
                    string        excluir = "delete from CFOP where cfo_codigo = " + cfop.ID;
                    SqlConnection con     = new SqlConnection();
                    con.ConnectionString = utils.ConexaoDb();
                    SqlCommand cmd = new SqlCommand(excluir, con);
                    cmd.CommandType = CommandType.Text;
                    con.Open();
                    try
                    {
                        int i = cmd.ExecuteNonQuery();
                        if (i > 0)
                        {
                            u.messageboxSucesso();
                        }
                    }
                    catch (Exception ex)
                    {
                        u.messageboxErro(ex.ToString());
                        throw;
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
            else
            {
                DialogResult escolha = MessageBox.Show("Deseja realmente excluir esse registro ?", "Mensagem do Sitema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (escolha == DialogResult.Cancel)
                {
                }
                else
                {
                    try
                    {
                        var cfup = db.Cfops.Find(Convert.ToInt32(txtCodCopf.Text.Trim()));
                        db.Cfops.Remove(cfup);
                        u.messageboxSucesso();
                    }
                    catch (Exception ex)
                    {
                        u.messageboxErro(ex.ToString());
                        throw;
                    }
                }
            }
            limpa();
        }
示例#13
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (txtCdesconto.Text == string.Empty ||
                txtcodFornecedor.Text == string.Empty ||
                //txtCodProduto.Text == string.Empty ||
                //txtDesconto.Text == string.Empty ||
                txtSomaDesconto.Text == string.Empty ||
                txtsomaTudo.Text == string.Empty ||
                mskDtVenda.Text == string.Empty ||
                maskedTextBox1.Text == string.Empty)
            {
                txtCdesconto.BackColor     = Color.Gold;
                txtcodFornecedor.BackColor = Color.Gold;
                //txtCodProduto.BackColor = Color.Gold;
                //txtDesconto.BackColor = Color.Gold;
                txtSomaDesconto.BackColor = Color.Gold;
                txtsomaTudo.BackColor     = Color.Gold;
                mskDtVenda.BackColor      = Color.Gold;
                maskedTextBox1.BackColor  = Color.Gold;
                u.messageboxCamposObrigatorio();
            }
            else
            {
                if (txtSomaDesconto.Text == string.Empty)
                {
                    txtSomaDesconto.Text = "0,00";
                }
                int     codcompra     = Convert.ToInt32(txtControle.Text.Trim());
                decimal pedtotalliq   = Convert.ToDecimal(txtCdesconto.Text.Trim());
                int     codfornecedor = Convert.ToInt32(txtcodFornecedor.Text.Trim());
                desconto = Convert.ToDecimal(txtSomaDesconto.Text.Trim());
                string peddtEmissao = mskDtVenda.Text.Trim();
                string dtVenc       = maskedTextBox1.Text.Trim();
                string pedobs       = txtObs.Text;

                string atualiza   = "update compra set com_totalliq = @com_totalliq, com_obs = @com_obs, com_desconto = @com_desconto where com_codigo = " + txtControle.Text;
                string financeiro = "insert into cpagar(pag_valor, pag_dtvenc, cod_cliente, pag_situacao, com_codigo) values(@com_totalliq, @pag_dtvenc, @cod_cliente, 'PENDENTE', @com_codigo)";

                SqlConnection con = new SqlConnection();
                con.ConnectionString = utils.ConexaoDb();
                SqlCommand cmd = new SqlCommand(atualiza, con);
                cmd.Parameters.Add("@com_totalliq", SqlDbType.Decimal).Value = pedtotalliq;
                cmd.Parameters.Add("@com_obs", SqlDbType.VarChar).Value      = pedobs;
                cmd.Parameters.Add("@com_desconto", SqlDbType.Decimal).Value = desconto;

                //////////////////////////////////////////////////////conta pagar
                SqlCommand cmd1 = new SqlCommand(financeiro, con);
                cmd1.Parameters.Add("@com_totalliq", SqlDbType.Decimal).Value = pedtotalliq;
                cmd1.Parameters.Add("@cod_cliente", SqlDbType.Int).Value      = codfornecedor;
                cmd1.Parameters.Add("@pag_dtvenc", SqlDbType.NVarChar).Value  = dtVenc;
                cmd1.Parameters.Add("@com_codigo", SqlDbType.Int).Value       = codcompra;
                con.Open();
                try
                {
                    int i = cmd.ExecuteNonQuery();
                    int j = cmd1.ExecuteNonQuery();

                    if ((i > 0) || (j > 0))
                    {
                        u.messageboxSucesso();
                    }
                }
                catch (Exception ex)
                {
                    u.messageboxErro(ex.ToString());
                }
                finally
                {
                    con.Close();
                }
                u.limparTextBoxes(this);
                u.limparMTextBoxes(this);
                dataGridView1.Rows.Clear();
                dataGridView1.Refresh();
                txtControle.Enabled        = false;
                txtcodFornecedor.Enabled   = false;
                txtNomeFornecedor.Enabled  = false;
                txtNomeProduto.Enabled     = false;
                txtQuantidade.Enabled      = false;
                txtValor.Enabled           = false;
                txtVTotal.Enabled          = false;
                txtSomaDesconto.Enabled    = false;
                txtCdesconto.Enabled       = false;
                txtObs.Enabled             = false;
                maskedTextBox1.Enabled     = false;
                txtDesconto.Enabled        = false;
                btnExcluir.Enabled         = false;
                btnInsProduto.Enabled      = false;
                btnNovo.Enabled            = true;
                btnPesquisar.Enabled       = true;
                btnPCliente.Enabled        = false;
                btnPProduto.Enabled        = false;
                btnSalvar.Enabled          = false;
                mskDtVenda.Enabled         = false;
                txtsomaTudo.Enabled        = false;
                txtCdesconto.BackColor     = SystemColors.Window;
                txtcodFornecedor.BackColor = SystemColors.Window;
                txtCodProduto.BackColor    = SystemColors.Window;
                txtDesconto.BackColor      = SystemColors.Window;
                txtSomaDesconto.BackColor  = SystemColors.Window;
                txtsomaTudo.BackColor      = SystemColors.Window;
                mskDtVenda.BackColor       = SystemColors.Window;
                maskedTextBox1.BackColor   = SystemColors.Window;
            }
        }