コード例 #1
0
        private void frmServico_Load(object sender, EventArgs e)
        {
            txtCodigo.Text = Cod;
            try
            {
                if (Editar)
                {
                    txtCodigo.Text = Cod;

                    string sql = String.Format(@"select * from ORDEM where IDORDEM = {0}", Cod);
                    txtCodigoFcfo.Text   = MetodosSql.GetField(sql, "IDFCFO");
                    txtDescricao.Text    = MetodosSql.GetField(sql, "DESCRICAO");
                    txtConclusao.Text    = MetodosSql.GetField(sql, "CONCLUSAO");
                    txtObservacao.Text   = MetodosSql.GetField(sql, "OBSERVACAO");
                    txtStatus.Text       = MetodosSql.GetField(sql, "STATUS");
                    txtNomeCliente.Text  = MetodosSql.GetField(String.Format(@"select * from ORDEM INNER JOIN FCFO ON FCFO.IDFCFO = ORDEM.IDFCFO WHERE IDORDEM = {0}", Cod), "NOME");
                    txtSobrenome.Text    = MetodosSql.GetField(String.Format(@"select * from ORDEM inner join FCFO ON FCFO.IDFCFO = ORDEM.IDFCFO WHERE IDORDEM = {0}", Cod), "NOMEFANTASIA");
                    txtDataInclusao.Text = MetodosSql.GetField(String.Format(@"select  DATAINCLUSAO as 'Nasc' from ORDEM where IDORDEM = {0}", Cod), "Nasc");
                    AtualizaGrid();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void Recebimento()
        {
            try
            {
                ValorPagamento();

                double ValorTotalRestante = Convert.ToDouble(txtValorTotal.Text.Replace(".", ",")) - (Convert.ToDouble(txtValorCheque.Text.Replace(".", ",")) + Convert.ToDouble(txtValorCredito.Text.Replace(".", ",")) + Convert.ToDouble(txtValorDebito.Text.Replace(".", ",")) + Convert.ToDouble(txtValorDinheiro.Text.Replace(".", ",")));
                txtValorRestante.Text = ValorTotalRestante.ToString();

                double ValorTotal = Convert.ToDouble(txtValorTotal.Text.Replace(".", ","));
                txtValorTotal.Text = ValorTotal.ToString();

                string sql = String.Format(@"insert into RECEBIMENTO(IDVENDA, IDFCFO , VALORDINHEIRO , VALORCHEQUE , VALORCARTAOCREDITO , VALORCARTAODEBITO) VALUES ({0}, {1} , {2} , {3} , {4} , {5})", Entrada, IDCLIENTE, txtValorDinheiro.Text.Replace(",", "."), txtValorCheque.Text.Replace(",", "."), txtValorCredito.Text.Replace(",", "."), txtValorDebito.Text.Replace(",", "."));
                MetodosSql.ExecQuery(sql);

                sql = String.Format(@"select PARCELAS from TIPOPAGAMENTO where IDTIPOPAGAMENTO = {0}", TipoPagamento);
                int NParcelas = int.Parse(MetodosSql.GetField(sql, "PARCELAS"));


                for (int parcela = 1; parcela <= NParcelas; parcela++)
                {
                    sql = String.Format(@"insert into PARCELA values ({0},{1},{2},{3}/{4},'A')", parcela, Entrada, IDCLIENTE, ValorTotalRestante, NParcelas);
                    MetodosSql.ExecQuery(sql);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        private void AtualizaGrid()
        {
            string sql = String.Format(@"select C.IDFCFO AS IDCLIENTE,
	                                                     C.NOME,
	                                                         C.NOMEFANTASIA AS SOBRENOME,
	                                                         C.CPF, C.CNPJ,
	                                                         cast(isnull(P.TOTAL,0) - isnull(R.PAGO,0) as numeric(20,2)) as 'DEVENDO'
													
	                                                     from FCFO C

	                                                     inner join (select IDFCFO, sum(isnull(VALOR,0)) as 'TOTAL' from PARCELA group by IDFCFO) P
	                                                     on P.IDFCFO = C.IDFCFO

	                                                     left join (select IDFCFO, sum(isnull(VALORDINHEIRO,0) + 
			                                                     isnull(VALORCHEQUE,0) + 
			                                                     isnull(VALORCARTAODEBITO,0) + 
			                                                     isnull(VALORCARTAOCREDITO,0)) as 'PAGO' from RECEBIMENTO WHERE EXTORNO != 1
			                                                     group by IDFCFO) R
	                                                     on R.IDFCFO = C.IDFCFO ORDER BY C.NOME"    );



            Clipboard.SetText(sql);
            gridControl1.DataSource = MetodosSql.GetDT(sql);
        }
コード例 #4
0
        private void InsertParcela()
        {
            if (Editar)
            {
                string sql       = String.Format(@"select PARCELAS from TIPOPAGAMENTO where IDTIPOPAGAMENTO = {0}", txtCodigoPagamento.Text);
                int    NParcelas = int.Parse(MetodosSql.GetField(sql, "PARCELAS"));

                sql = String.Format(@"select sum(ITEMMOVIMENTO.VALOR * ITEMMOVIMENTO.QUANTIDADE) - VENDA.DESCONTO as 'TOTAL' from ITEMMOVIMENTO
                                    INNER JOIN VENDA ON ITEMMOVIMENTO.IDVENDA = VENDA.IDVENDA
                                    Where VENDA.IDVENDA = {0}
                                    GROUP BY VENDA.DESCONTO", CODVENDA);
                string totalVenda = MetodosSql.GetField(sql, "TOTAL");

                sql = String.Format(@"select IDFCFO from VENDA where IDVENDA = '{0}'", CODVENDA);
                string idCliente = MetodosSql.GetField(sql, "IDFCFO");

                for (int parcela = 1; parcela <= NParcelas; parcela++)
                {
                    sql = String.Format(@"insert into PARCELA values ({0},{1},{2},{3}/{4},null)", parcela, CODVENDA, idCliente, totalVenda.Replace(".", "").Replace(",", "."), NParcelas);
                    MetodosSql.ExecQuery(sql);
                }

                Editar = true;
            }
        }
コード例 #5
0
        private void frmCadastroProdutos_Load(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(txtCodigo.Text))
                {
                    if (Editar)
                    {
                        txtCodigo.Text = Cod;

                        string sql = String.Format(@"select * from PRODUTO where IDPRODUTO = {0}", Cod);
                        txtDescricao.Text = MetodosSql.GetField(sql, "DESCRICAO");
                        //txtPrecoEntrada.Text = MetodosSql.GetField(sql, "PRECOUNENTRADA");
                        //txtPrecoEntrada.Text = MetodosSql.GetField(String.Format(@"select CAST(PRECOUNENTRADA as numeric(20,2))as 'PE' from PRODUTO where IDPRODUTO = {0}", Cod), "PE");
                        //txtMargemVenda.Text = MetodosSql.GetField(sql, "MARGEMVENDA");
                        //txtMargemVenda.Text = MetodosSql.GetField(String.Format(@"select CAST(MARGEMVENDA as numeric(20,2))as 'MA' from PRODUTO where IDPRODUTO = {0}", Cod), "MA");
                        txtObservacao.Text   = MetodosSql.GetField(sql, "OBSERVACAO");
                        txtDataInclusao.Text = MetodosSql.GetField(String.Format(@"select CONVERT(varchar, CONVERT(DATETIME, DATAINCLUSAO, 121), 103) as 'Nasc' from PRODUTO where IDPRODUTO = {0}", Cod), "Nasc");
                        //txtPrecoVenda.Text = MetodosSql.GetField(sql, "PRECOUNVENDA");
                        //txtPrecoVenda.Text = MetodosSql.GetField(String.Format(@"select CAST(PRECOUNVENDA as numeric(20,2))as 'PV' from PRODUTO where IDPRODUTO = {0}", Cod), "PV");
                        txtTipoSeguro.Text    = MetodosSql.GetField(sql, "TIPOSEGURO");
                        txtCiaSeguradora.Text = MetodosSql.GetField(sql, "CIASEGURADORA");
                        txtNumeroQuiver.Text  = MetodosSql.GetField(sql, "NUMEROQUIVER");
                    }
                }
                else
                {
                    LimpaCampos();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
        private void frmFCFO_Load(object sender, EventArgs e)
        {
            txtCodigo.Text = Cod;
            validaBtn1     = false;
            validaBtn2     = false;
            txtTipoPessoa.Select();

            try
            {
                if (Editar)
                {
                    string sql = String.Format(@"select * from FCFO where IDFCFO = {0}", Cod);

                    txtNome.Text                = MetodosSql.GetField(sql, "NOME");
                    txtTipoPessoa.Text          = MetodosSql.GetField(sql, "TIPOPESSOA");
                    txtNomeFantasia.Text        = MetodosSql.GetField(sql, "NOMEFANTASIA");
                    txtCpf.Text                 = MetodosSql.GetField(sql, "CPF");
                    txtCNPJ.Text                = MetodosSql.GetField(sql, "CNPJ");
                    txtDataNasc.Text            = MetodosSql.GetField(sql, "DTANASCIMENTO");
                    txtSexo.Text                = MetodosSql.GetField(sql, "SEXO");
                    txtTelefone.Text            = MetodosSql.GetField(sql, "TELEFONE1");
                    txtTelefone2.Text           = MetodosSql.GetField(sql, "TELEFONE2");
                    txtCelular.Text             = MetodosSql.GetField(sql, "CELULAR");
                    txtCelular2.Text            = MetodosSql.GetField(sql, "CELULAR2");
                    txtEmail.Text               = MetodosSql.GetField(sql, "EMAIL");
                    txtEmail2.Text              = MetodosSql.GetField(sql, "EMAIL2");
                    txtRua.Text                 = MetodosSql.GetField(sql, "RUA");
                    txtLogradouro.Text          = MetodosSql.GetField(sql, "LOGRADOURO");
                    txtNumero.Text              = MetodosSql.GetField(sql, "NUMERO");
                    txtBairro.Text              = MetodosSql.GetField(sql, "BAIRRO");
                    txtCidade.Text              = MetodosSql.GetField(sql, "CIDADE");
                    txtCep.Text                 = MetodosSql.GetField(sql, "CEP");
                    txtEstado.Text              = MetodosSql.GetField(sql, "ESTADO");
                    txtComplemento.Text         = MetodosSql.GetField(sql, "COMPLEMENTO");
                    txtObservacao.Text          = MetodosSql.GetField(sql, "OBSERVACAO");
                    txtRg.Text                  = MetodosSql.GetField(sql, "RG");
                    txtCnh.Text                 = MetodosSql.GetField(sql, "CNH");
                    txtEstadoCivil.Text         = MetodosSql.GetField(sql, "ESTADOCIVIL");
                    txtApolice.Text             = MetodosSql.GetField(sql, "APOLICE");
                    txtTipoResidencia.Text      = MetodosSql.GetField(sql, "TIPORESIDENCIA");
                    txtObservacaoDocumento.Text = MetodosSql.GetField(sql, "OBSDOCUMENTO");
                    sql    = String.Format("SELECT * FROM FCFOIMAGEM WHERE IDFCFO = {0}", Cod);
                    valida = MetodosSql.GetField(sql, "IMAGEM1");
                    if (valida != "")
                    {
                        pbImagemDoc1.Image = Image.FromStream(MetodosSql.GetImage(sql, "IMAGEM1"));
                    }
                    valida = MetodosSql.GetField(sql, "IMAGEM2");
                    if (valida != "")
                    {
                        pbDoc2.Image = Image.FromStream(MetodosSql.GetImage(sql, "IMAGEM2"));
                    }
                    txtDataInclusao.Text = MetodosSql.GetField(String.Format(@"select CONVERT(varchar, CONVERT(DATETIME, DATAINCLUSAO, 121), 103) as 'Nasc' from FCFO where IDFCFO = {0}", Cod), "Nasc");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
        public frmPrincipal()
        {
            InitializeComponent();
            string sql = String.Format(@"SELECT * FROM PROPRIETARIO");

            this.Text = MetodosSql.GetField(sql, "NOMEFANTASIA");
        }
コード例 #8
0
 private void frmCadastroCiaSeguradora_Load(object sender, EventArgs e)
 {
     try
     {
         if (Editar)
         {
             string sql = String.Format(@"SELECT * FROM FCFOSEGURADORA WHERE IDSEGURADORA = '{0}'", Cod);
             txtNome.Text                = MetodosSql.GetField(sql, "NOME");
             txtNomeFantasia.Text        = MetodosSql.GetField(sql, "NOMEFANTASIA");
             txtSexo.Text                = MetodosSql.GetField(sql, "SEXO");
             txtCelular.Text             = MetodosSql.GetField(sql, "CELULAR");
             txtCelular2.Text            = MetodosSql.GetField(sql, "CELULAR2");
             txtTelefone.Text            = MetodosSql.GetField(sql, "TELEFONE1");
             txtTelefone2.Text           = MetodosSql.GetField(sql, "TELEFONE2");
             txtEmail.Text               = MetodosSql.GetField(sql, "EMAIL");
             txtEmail2.Text              = MetodosSql.GetField(sql, "EMAIL2");
             txtObservacao.Text          = MetodosSql.GetField(sql, "OBSERVACAO");
             txtCpf.Text                 = MetodosSql.GetField(sql, "CPF");
             txtCNPJ.Text                = MetodosSql.GetField(sql, "CNPJ");
             txtRg.Text                  = MetodosSql.GetField(sql, "RG");
             txtObservacaoDocumento.Text = MetodosSql.GetField(sql, "OBSDOCUMENTO");
             txtTipoPessoa.Text          = MetodosSql.GetField(sql, "TIPOPESSOA");
             txtDataInclusao.Text        = MetodosSql.GetField(String.Format(@"SELECT CONVERT(VARCHAR, DATAINCLUSAO, 103) AS DATAINCLUSAO FROM FCFOSEGURADORA WHERE IDSEGURADORA = '{0}'", Cod), "DATAINCLUSAO");
             txtCodigo.Text              = MetodosSql.GetField(sql, "IDSEGURADORA");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #9
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                if (Editar)
                {
                    sql = String.Format(@"delete from ITEMMOVIMENTO where IDITEM = '{0}'", IDITEM);

                    MetodosSql.ExecQuery(sql);
                }
                else
                {
                    produtos.RemoveAt(int.Parse(IDITEM));
                }

                btnExcluir.Visible          = false;
                btnSelecionaProduto.Enabled = true;

                IDITEM = null;

                LimpaCampos();
                AtualizaGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #10
0
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            try
            {
                int quant;
                var rowHandle = gridView1.FocusedRowHandle;
                var obj       = gridView1.GetRowCellValue(rowHandle, "IDPRODUTO");


                quant = int.Parse(MetodosSql.GetField(String.Format(@"SELECT COUNT(IDPRODUTO) AS PRODUTO FROM ITEMMOVIMENTO WHERE IDPRODUTO= '{0}'", obj.ToString()), "PRODUTO"));

                if (DialogResult.Yes == MessageBox.Show("Deseja mesmo exluir?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    if (quant > 0)
                    {
                        MessageBox.Show("Existe uma venda que contém este seguro. Você não poderá excluir seguros que estão cadastrados em vendas.", "Aviso.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MetodosSql.ExecQuery(String.Format(@"delete from PRODUTO where IDPRODUTO = {0}", obj.ToString()));
                        AtualizaGrid();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #11
0
        private void Salvar()
        {
            try
            {
                if (Editar)
                {
                    AlteraEstoque();
                    Validar();
                    string SQL = String.Format(@"update ENTRADAPRODUTO
	                                             set IDPRODUTO = ('{0}'),
			                                         IDFCFO = ('{1}'),
                                                     VALORUNENTRADA = REPLACE('{2}',',','.'),  
                                                     QUANTIDADEENTRADA = REPLACE('{3}',',','.'),
                                                     CHAVENFE = ('{4}'),
                                                     DOCUMENTO = ('{5}'),
                                                     OBSERVACAO = ('{6}'),
                                                     DATAINCLUSAO = CONVERT(DATETIME, '{7}', 103)
                                                     where IDENTRADA = '{8}'

                                                     
		                                             
                                                   ", txtCodigoProduto.Text, txtCodigoFornecedor.Text,
                                               txtValorEntrada.Text.Replace(".", "").Replace(",", "."), txtQuantidadeEntrada.Text, txtChaveNfe.Text, txtDocumento.Text, txtObservacao.Text, txtDataInclusao.Text, txtCodigo.Text);

                    string sql = String.Format(@"update produto set PRECOUNENTRADA = {0} , MARGEMVENDA = {2} WHERE IDPRODUTO = {1}", txtValorEntrada.Text.Replace(".", "").Replace(",", "."), txtCodigoProduto.Text, txtMargemVenda.Text.Replace(".", "").Replace(",", "."));
                    MetodosSql.ExecQuery(sql);


                    Clipboard.SetText(SQL);


                    MetodosSql.ExecQuery(SQL);
                }
                else
                {
                    Validar();
                    string SQL = String.Format(@"insert into ENTRADAPRODUTO (IDPRODUTO , IDFCFO , VALORUNENTRADA , QUANTIDADEENTRADA , CHAVENFE , DOCUMENTO , OBSERVACAO , DATAINCLUSAO) values ('{0}' , '{1}' , REPLACE('{2}',',','.'), REPLACE('{3}',',','.'), '{4}' , '{5}' , '{6}' , CONVERT(varchar,CONVERT(DATETIME, '{7}', 103), 121) ) select SCOPE_IDENTITY()"
                                               , txtCodigoProduto.Text, txtCodigoFornecedor.Text, txtValorEntrada.Text.Replace(".", "").Replace(",", "."), txtQuantidadeEntrada.Text, txtChaveNfe.Text, txtDocumento.Text, txtObservacao.Text, txtDataInclusao.Text);

                    string sql = String.Format(@"update produto set PRECOUNENTRADA = {0} WHERE IDPRODUTO = {1}", txtValorEntrada.Text.Replace(".", "").Replace(",", "."), txtCodigoProduto.Text);
                    InsereEstoque();
                    MetodosSql.ExecQuery(sql);



                    object Ncad = MetodosSql.ExecScalar(SQL);
                    txtCodigo.Text = Ncad.ToString();


                    Editar = true;
                }

                InsereEstoque();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #12
0
        public frmPrincipal(string nome, string usuario)
        {
            InitializeComponent();
            bsUsuario.Caption = "• " + nome;
            string sql = String.Format(@"SELECT * FROM PROPRIETARIO");

            this.Text = MetodosSql.GetField(sql, "NOMEFANTASIA");
        }
コード例 #13
0
 private void frmIdPagamento_Load(object sender, EventArgs e)
 {
     txtValorRestante.Text = RESTANTE;
     txtCodigoVenda.Text   = CODIGOVENDA;
     txtCodigoParcela.Text = CODIGOPARCELA;
     sql = String.Format(@"select cast(VALOR as numeric(20,2)) as 'VALOR' from PARCELA where IDPARCELA = '{0}'", CODIGOPARCELA);
     txtValorParcela.Text = MetodosSql.GetField(sql, "VALOR");
 }
コード例 #14
0
        private void frmCadastroPorcentagens_Load(object sender, EventArgs e)
        {
            string sql = String.Format(@"SELECT * FROM PORCENTAGENS");

            txtPorcentagemNota.Text      = MetodosSql.GetField(sql, "PERCIMPOSTONOTA");
            txtPorcentagemCorretora.Text = MetodosSql.GetField(sql, "PERCSEGURALTA");
            txtCod.Text = MetodosSql.GetField(sql, "IDPORCENTAGEM");
        }
コード例 #15
0
        private void frmAlteraQuantidade_Load(object sender, EventArgs e)
        {
            txtCodigoProduto.Text = Cod;

            string sql = String.Format(@"select * from ESTOQUE where IDPRODUTO = {0}", Cod);

            txtQuantidade.Text = MetodosSql.GetField(sql, "QUANTIDADE");
            txtObservacao.Text = MetodosSql.GetField(sql, "OBSERVACAO");
        }
コード例 #16
0
        private void Cadastro()
        {
            try
            {
                if (Editar)
                {
                    string sql = String.Format(@"UPDATE FCFOSEGURADORA SET NOME = '{0}', NOMEFANTASIA = '{1}', CPF = '{2}', CNPJ = '{3}', RG = '{4}', OBSDOCUMENTO = '{5}',
                                                 TELEFONE1 = '{6}', TELEFONE2 = '{7}', CELULAR = '{8}', CELULAR2 = '{9}', EMAIL = '{10}', EMAIL2 = '{11}',
                                                 OBSERVACAO = '{12}' WHERE IDSEGURADORA = '{13}'",
                                               /*{0}*/ txtNome.Text,
                                               /*{1}*/ txtNomeFantasia.Text,
                                               /*{2}*/ txtCpf.Text,
                                               /*{3}*/ txtCNPJ.Text,
                                               /*{4}*/ txtRg.Text,
                                               /*{5}*/ txtObservacaoDocumento.Text,
                                               /*{6}*/ txtTelefone.Text,
                                               /*{7}*/ txtTelefone2.Text,
                                               /*{8}*/ txtCelular.Text,
                                               /*{9}*/ txtCelular2.Text,
                                               /*{10}*/ txtEmail.Text,
                                               /*{11}*/ txtEmail2.Text,
                                               /*{12}*/ txtObservacao.Text,
                                               /*{13}*/ Cod);



                    MetodosSql.ExecQuery(sql);
                }
                else
                {
                    string sql = String.Format(@"INSERT INTO FCFOSEGURADORA VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}',
                                                '{10}', '{11}', '{12}', getdate())",
                                               /*{0}*/ txtNome.Text,
                                               /*{1}*/ txtNomeFantasia.Text,
                                               /*{2}*/ txtCpf.Text,
                                               /*{3}*/ txtCNPJ.Text,
                                               /*{4}*/ txtRg.Text,
                                               /*{5}*/ txtObservacaoDocumento.Text,
                                               /*{6}*/ txtTelefone.Text,
                                               /*{7}*/ txtTelefone2.Text,
                                               /*{8}*/ txtCelular.Text,
                                               /*{9}*/ txtCelular2.Text,
                                               /*{10}*/ txtEmail.Text,
                                               /*{11}*/ txtEmail2.Text,
                                               /*{12}*/ txtObservacao.Text);



                    MetodosSql.ExecQuery(sql);
                    Editar = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #17
0
 private void AtualizaGrid()
 {
     grdVisaoRelCliente.DataSource = MetodosSql.GetDT(String.Format(@"select IDFCFO, NOME, NOMEFANTASIA AS 'SOBRENOME',
        CPF, CNPJ, RG, CNH,
        OBSDOCUMENTO, DTANASCIMENTO,
        TELEFONE1, CELULAR, EMAIL,
        CIDADE, ESTADO, OBSERVACAO,
        TIPOPESSOA from FCFO WHERE TIPO = 'C'"));
 }
コード例 #18
0
 public frmVisaoSelecionaCliente()
 {
     InitializeComponent();
     gridView1.OptionsBehavior.Editable = false;
     gridControl1.EmbeddedNavigator.Buttons.Append.Visible = false;
     gridControl1.EmbeddedNavigator.Buttons.Remove.Visible = false;
     gridControl1.DataSource = MetodosSql.GetDT("select IDFCFO , NOME , NOMEFANTASIA AS SOBRENOME ,OBSERVACAO  from FCFO where TIPO = 'C'");
     gridView1.BestFitColumns();
 }
コード例 #19
0
 public frmVisaoSelecionaFornecedor()
 {
     InitializeComponent();
     gridView1.OptionsBehavior.Editable = false;
     gridControl1.EmbeddedNavigator.Buttons.Append.Visible = false;
     gridControl1.EmbeddedNavigator.Buttons.Remove.Visible = false;
     gridControl1.DataSource = MetodosSql.GetDT("select IDFCFO, NOME, NOMEFANTASIA, CPFCNPJ from FCFO where TIPO = 'F'");
     gridView1.BestFitColumns();
 }
コード例 #20
0
 public frmVisaoSelecionaProdutoOrdem()
 {
     InitializeComponent();
     gridView1.OptionsBehavior.Editable = false;
     gridControl1.EmbeddedNavigator.Buttons.Append.Visible = false;
     gridControl1.EmbeddedNavigator.Buttons.Remove.Visible = false;
     gridControl1.DataSource = MetodosSql.GetDT(@"select IDPRODUTO , DESCRICAO , PRECOUNVENDA , MARGEMVENDA , PRECOUNENTRADA , DATAINCLUSAO , OBSERVACAO , UNIDADECONTROLE FROM PRODUTO");
     gridView1.BestFitColumns();
 }
コード例 #21
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                var    rowHandle = gridView1.FocusedRowHandle;
                var    obj = gridView1.GetRowCellValue(rowHandle, "IDVENDA");
                int    LINHA, IDITEM, IDPRODUTO;
                double QUANTIDADE;

                if (obj != null)
                {
                    if (DialogResult.Yes == MessageBox.Show("Deseja mesmo exluir?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                    {
                        string sql = String.Format(@"select count(IDITEM) as LINHA FROM ITEMMOVIMENTO WHERE IDVENDA = {0}", obj);
                        LINHA = int.Parse(MetodosSql.GetField(sql, "LINHA"));

                        sql    = String.Format(@"SELECT MIN(IDITEM) AS MINIDITEM FROM ITEMMOVIMENTO WHERE IDVENDA = {0}", obj);
                        IDITEM = int.Parse(MetodosSql.GetField(sql, "MINIDITEM"));

                        for (int i = 1; i <= LINHA; i++)
                        {
                            sql = String.Format(@"SELECT IDPRODUTO, QUANTIDADE FROM ITEMMOVIMENTO WHERE IDITEM = {0}", IDITEM);

                            IDPRODUTO  = int.Parse(MetodosSql.GetField(sql, "IDPRODUTO"));
                            QUANTIDADE = double.Parse(MetodosSql.GetField(sql, "QUANTIDADE"));

                            string estoque = String.Format(@"UPDATE ESTOQUE SET QUANTIDADE = QUANTIDADE + {0} WHERE IDPRODUTO = {1} ", QUANTIDADE, IDPRODUTO);
                            IDITEM++;

                            MetodosSql.ExecQuery(sql);
                            MetodosSql.ExecQuery(estoque);
                        }



                        MetodosSql.ExecQuery(String.Format(@"DELETE FROM PARCELA WHERE IDVENDA = {0}", obj));
                        MetodosSql.ExecQuery(String.Format(@"delete from VENDA where IDVENDA = {0}", obj.ToString()));
                        AtualizaGrid();
                    }
                    else
                    {
                        MessageBox.Show("Por favor, selecione um registro", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Por favor, selecione um registro", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            gridView1.BestFitColumns();
        }
コード例 #22
0
        public void AtualizaGrid()
        {
            string sql = String.Format(@"select IDPRODUTO, DESCRICAO, TIPOSEGURO, CIASEGURADORA, NUMEROQUIVER,  
                                        OBSERVACAO, DATAINCLUSAO
                                        from PRODUTO 
						                ORDER BY PRODUTO.IDPRODUTO"                        );

            gridControl1.DataSource = MetodosSql.GetDT(sql);
            MetodosSql.ExecQuery(sql);
        }
コード例 #23
0
        private void Cadastro()
        {
            try
            {
                string sql = String.Format(@"update PROPRIETARIO 
                                                set NOME = '{0}', 
                                                    NOMEFANTASIA = '{1}' , 
                                                    CPF = '{2}' , 
                                                    CNPJ = '{3}' ,
                                                    TELEFONE = '{4}',
                                                    TELEFONE2 = '{5}',
                                                    CELULAR = '{6}',
                                                    CELULAR2 = '{7}',
                                                    EMAIL = '{8}',
                                                    EMAIL2 = '{9}',
                                                    CONTATO = '{10}' , 
                                                    RUA = '{11}', 
                                                    LOGRADOURO = '{12}', 
                                                    NUMERO = '{13}' , 
                                                    BAIRRO = '{14}' , 
                                                    CIDADE = '{15}', 
                                                    CEP = '{16}' , 
                                                    ESTADO = '{17}' , 
                                                    COMPLEMENTO = '{18}' , 
                                                    DATAINCLUSAO = getdate()",
                                           /*{0}*/ txtNome.Text,
                                           /*{1}*/ txtNomeFantasia.Text,
                                           /*{2}*/ txtCpf.Text,
                                           /*{3}*/ txtCnpj.Text,
                                           /*{4}*/ txtTelefone.Text,
                                           /*{5}*/ txtTelefone2.Text,
                                           /*{6}*/ txtCelular.Text,
                                           /*{7}*/ txtCelular2.Text,
                                           /*{8}*/ txtEmail.Text,
                                           /*{9}*/ txtEmail2.Text,
                                           /*{10}*/ txtContato.Text,
                                           /*{11}*/ txtRua.Text,
                                           /*{12}*/ txtLogradouro.Text,
                                           /*{13}*/ txtNumero.Text,
                                           /*{14}*/ txtBairro.Text,
                                           /*{15}*/ txtCidade.Text,
                                           /*{16}*/ txtCep.Text,
                                           /*{17}*/ txtEstado.Text,
                                           /*{18}*/ txtComplemento.Text);


                object CodCad = MetodosSql.ExecScalar(sql);
                //txtCodigo.Text = CodCad.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #24
0
        //private void txtPrecoEntrada_Leave(object sender, EventArgs e)
        //{
        //    if (String.IsNullOrWhiteSpace(txtPrecoEntrada.Text))
        //    {
        //        txtPrecoEntrada.Text = "0,00";
        //    }
        //}

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            frmVisaoSelecionaCiaSeuradora frm = new frmVisaoSelecionaCiaSeuradora();

            frm.ShowDialog();
            if (!String.IsNullOrWhiteSpace(frm.Codigo))
            {
                codCliente            = frm.Codigo;
                txtCiaSeguradora.Text = MetodosSql.GetField(String.Format("SELECT NOMEFANTASIA FROM FCFOSEGURADORA WHERE IDSEGURADORA = {0}", codCliente), "NOMEFANTASIA");
            }
        }
コード例 #25
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var rowHandle = gridView1.FocusedRowHandle;
            var obj       = gridView1.GetRowCellValue(rowHandle, "IDVENDEDOR");

            if (DialogResult.Yes == MessageBox.Show("Tem certeza que deseja excluir este vendedor?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                string sql = String.Format(@"DELETE FROM VENDEDORES WHERE IDVENDEDOR = '{0}'", obj.ToString());
                MetodosSql.ExecQuery(sql);
                AtualizaGrid();
            }
        }
コード例 #26
0
        private void InsereEstoque()
        {
            string sql = String.Empty;

            if (String.IsNullOrWhiteSpace(txtCodigo.Text))
            {
                sql = String.Format(@"update ESTOQUE
                                             set QUANTIDADE = QUANTIDADE + {0}
                                             where IDPRODUTO = '{1}'", txtQuantidadeEntrada.Text, txtCodigoProduto.Text);
                MetodosSql.ExecQuery(sql);
            }
        }
コード例 #27
0
        private void grdVisaoUsuario_DoubleClick(object sender, EventArgs e)
        {
            var rowHandle = gridView1.FocusedRowHandle;
            var cod       = gridView1.GetRowCellValue(rowHandle, "ID");

            if (DialogResult.Yes == MessageBox.Show("Tem certeza que deseja excluir este usuário?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                string sql = String.Format(@"DELETE FROM LOGIN WHERE ID = '{0}'", cod);
                MetodosSql.ExecQuery(sql);
            }
            AtualizaGrid();
        }
コード例 #28
0
 private void frmCadastroUsuario_Load(object sender, EventArgs e)
 {
     if (Editar)
     {
         string sql = String.Format(@"SELECT * FROM LOGIN WHERE ID = '{0}'", Cod);
         txtNome.Text           = MetodosSql.GetField(sql, "NOME");
         txtUsuario.Text        = MetodosSql.GetField(sql, "USUARIO");
         txtSenha.Text          = MetodosSql.GetField(sql, "SENHA");
         txtConfirmarSenha.Text = MetodosSql.GetField(sql, "SENHA");
         txtCod.Text            = Cod;
     }
 }
コード例 #29
0
        private void frmEdiçãoParcela_Load(object sender, EventArgs e)
        {
            if (Editar)
            {
                string dinheiro, cheque, debito, credito;
                string sql = String.Format(@"SELECT cast(VALORDINHEIRO as numeric(20,2)) AS VALORDINHEIRO, CAST(VALORCHEQUE AS NUMERIC(20,2)) AS VALORCHEQUE, CAST(VALORCARTAODEBITO AS NUMERIC(20,2)) AS VALORCARTAODEBITO,
                                            CAST(VALORCARTAOCREDITO AS NUMERIC(20,2)) AS VALORCARTAOCREDITO FROM RECEBIMENTO WHERE IDPARCELA = '{0}'", CodParcela);
                dinheiro = MetodosSql.GetField(sql, "VALORDINHEIRO");
                cheque   = MetodosSql.GetField(sql, "VALORCHEQUE");
                debito   = MetodosSql.GetField(sql, "VALORCARTAODEBITO");
                credito  = MetodosSql.GetField(sql, "VALORCARTAOCREDITO");

                if (dinheiro != "0,00")
                {
                    txtValorDinheiro.Text = dinheiro;
                    txtValorCheque.Text   = "0,00";
                    txtValorDebito.Text   = "0,00";
                    txtValorCredito.Text  = "0,00";
                }
                else if (cheque != "0,00")
                {
                    txtValorDinheiro.Text = "0,00";
                    txtValorCheque.Text   = cheque;
                    txtValorDebito.Text   = "0,00";
                    txtValorCredito.Text  = "0,00";
                }
                else if (debito != "0,00")
                {
                    txtValorDinheiro.Text = "0,00";
                    txtValorCheque.Text   = "0,00";
                    txtValorDebito.Text   = debito;
                    txtValorCredito.Text  = "0,00";
                }
                else if (credito != "0,00")
                {
                    txtValorDinheiro.Text = "0,00";
                    txtValorCheque.Text   = "0,00";
                    txtValorDebito.Text   = "0,00";
                    txtValorCredito.Text  = credito;
                }
                else
                {
                    txtValorDinheiro.Text = "0,00";
                    txtValorCheque.Text   = "0,00";
                    txtValorDebito.Text   = "0,00";
                    txtValorCredito.Text  = "0,00";
                }
                txtCodigoVenda.Text   = CodVenda;
                txtCodigoParcela.Text = CodParcela;
                txtValorParcela.Text  = ValorParcela;
                txtValorRestante.Text = Restante;
            }
        }
コード例 #30
0
        private void btnExcluir_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (gridView1.SelectedRowsCount > 0)
                {
                    var rowHandle = gridView1.FocusedRowHandle;
                    var id        = gridView1.GetRowCellValue(rowHandle, "IDCLIENTE");
                    if (id == null)
                    {
                        MessageBox.Show("Selecione um registro", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        string sql = String.Format(@"select IDFCFO from VENDA WHERE IDFCFO = " + id.ToString());

                        string teste  = MetodosSql.GetField(sql, "IDFCFO");
                        string SQL    = String.Format(@"SELECT IDFCFO FROM ORDEM where IDFCFO = " + id.ToString());
                        string IdFcfo = MetodosSql.GetField(SQL, "IDFCFO");


                        if (id.ToString() == teste.ToString())
                        {
                            MessageBox.Show("Há uma Venda no Nome Deste Cliente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        else
                        {
                            if (id.ToString() == IdFcfo.ToString())
                            {
                                MessageBox.Show("Há uma Ordem de Serviço no Nome Deste Cliente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else
                            {
                                if (DialogResult.Yes == MessageBox.Show("Deseja Excluir Este Cliente?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                                {
                                    sql = String.Format(@"DELETE from FCFO WHERE IDFCFO = " + id.ToString());
                                    MetodosSql.ExecQuery(sql);
                                    AtualizaGrid();
                                }
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Selecione um registro", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }