Ejemplo n.º 1
0
        public void ConsultarParaGridEntrada()
        {
            string SQL    = "SELECT * FROM caixa_entrada WHERE idcaixa = '" + idCaixa + "' ORDER BY identrada DESC";
            string tabela = "caixa_entrada";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
        }
Ejemplo n.º 2
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Caixa caixa = new Caixa();

            if (entrada)
            {
                caixa.IdCaixa   = Convert.ToInt32(txtIdCaixa.Text);
                caixa.IdEntrada = iditem;
                caixa.Data      = DateTime.Now;
                caixa.Valor     = Convert.ToDecimal(txtValor.Text);
                caixa.Obs       = "LANCAMENTO MANUAL";
                if (txtObs.Text.Length > 0)
                {
                    caixa.Obs += ", " + txtObs.Text;
                }
                caixa.Usuario = usuario;
                caixa.InserirEntrada();
                caixa.ConsultaCaixaAberto();
            }
            else
            {
                caixa.IdCaixa = Convert.ToInt32(txtIdCaixa.Text);
                caixa.IdSaida = iditem;
                caixa.Data    = DateTime.Now;
                caixa.Valor   = Convert.ToDecimal(txtValor.Text);
                caixa.Obs     = "LANCAMENTO MANUAL";
                if (txtObs.Text.Length > 0)
                {
                    caixa.Obs += ", " + txtObs.Text;
                }
                caixa.Usuario = usuario;
                caixa.InserirSaida();
                caixa.ConsultaCaixaAberto();
            }
            //Carrega Grid de Entradas
            //-------------------------------------------------------------------------
            string SQL            = "SELECT * FROM caixa_entrada WHERE idcaixa = '" + txtIdCaixa.Text + "' ORDER BY identrada DESC";
            string tabela_entrada = "caixa_entrada";

            ds_entrada = new DataSet();
            ds_entrada = bd.ConsultarParaGrid(SQL, tabela_entrada);
            frmCaixa.dataGridView1.DataSource = ds_entrada.Tables[tabela_entrada];

            //Carrega Grid de Entradas
            //-------------------------------------------------------------------------
            string SQL2         = "SELECT * FROM caixa_saida WHERE idcaixa = '" + txtIdCaixa.Text + "' ORDER BY idsaida DESC";
            string tabela_saida = "caixa_saida";

            ds_saida = new DataSet();
            ds_saida = bd.ConsultarParaGrid(SQL2, tabela_saida);
            frmCaixa.dataGridView2.DataSource = ds_saida.Tables[tabela_saida];

            frmCaixa.CalcularTotalEntradas();
            frmCaixa.CalcularTotalSaidas();
            frmCaixa.lblSaldoCaixa.Text = caixa.Saldo.ToString("0.00");
            this.Close();
        }
Ejemplo n.º 3
0
        public void ConsultarParaGrid()
        {
            string SQL    = "SELECT i.iditem, i.idproduto, p.descricao, i.qtde, i.preco, (i.preco*i.qtde)subtotal, i.desconto, i.total, i.estado FROM venda_item AS i INNER JOIN produtos AS p ON i.idproduto = p.id WHERE i.idvenda = '" + idVenda + "' ORDER BY i.iditem ASC";
            string tabela = "venda_item";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            //dataGridView1.DataSource = ds.Tables["venda_item"];
        }
Ejemplo n.º 4
0
        //Metodos Eventos
        //---------------------------------------------------------------------
        private void FormGridVenda_Load(object sender, EventArgs e)
        {
            string SQL    = "SELECT * FROM venda WHERE estado = 'FINALIZADA' ORDER BY idvenda DESC";
            string tabela = "venda";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables["venda"];
            txtNumeroVenda.Select();
        }
Ejemplo n.º 5
0
        private void FormGridProdutos_Load(object sender, EventArgs e)
        {
            //string SQL = "SELECT id, ean, descricao, estado, descricaoresumida, marca, embalagem, unidade, venda, margemlucro, estoqueminimo, estoque, idfornecedor, custo, estado_estoque FROM produtos WHERE estado = 'EM LINHA' ORDER BY descricao";
            string SQL2   = "SELECT id, descricao, estado, descricaoresumida, marca, embalagem, unidade, venda, margemlucro, estoqueminimo, estoque, idfornecedor, custo, estado_estoque FROM produtos WHERE estado = 'EM LINHA' ORDER BY descricao";
            string tabela = "produtos";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL2, tabela);
            dataGridView1.DataSource = ds.Tables["produtos"];
            cbxEstadoEstoque.Text    = "TODOS";
            cbxSituacao.Text         = "EM LINHA";
        }
Ejemplo n.º 6
0
        private void FormGridFuncao_Load(object sender, EventArgs e)
        {
            string SQL    = "SELECT * FROM finalizadoras ORDER BY id";
            string tabela = "finalizadoras";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables["finalizadoras"];
        }
Ejemplo n.º 7
0
        //Métodos_Eventos
        private void FormGridFornecedores_Load(object sender, EventArgs e)
        {
            string SQL    = "SELECT * FROM fornecedor ORDER BY razaosocial";
            string tabela = "fornecedor";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables["fornecedor"];
        }
Ejemplo n.º 8
0
        private void FormGridUsuarios_Load(object sender, EventArgs e)
        {
            string SQL    = "SELECT * FROM usuarios ORDER BY id";
            string tabela = "usuarios";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables["usuarios"];
        }
Ejemplo n.º 9
0
        //Metodos
        //--------------------------------------------------------------------
        private void FormFechamentoCaixa_Load(object sender, EventArgs e)
        {
            string SQL    = "SELECT * FROM caixa WHERE estado = 'ABERTO' ORDER BY idcaixa ";
            string tabela = "caixa";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables[tabela];
        }
Ejemplo n.º 10
0
        private void FormGridFuncionarios_Load(object sender, EventArgs e)
        {
            string SQL   = "SELECT * FROM funcionario ORDER BY id";
            string table = "funcionario";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, table);
            dataGridView1.DataSource = ds.Tables[table];
        }
Ejemplo n.º 11
0
        //Metodos Gerais
        //-------------------------------------------------------------------------
        public void AtualizaGrid()
        {
            string SQL    = "SELECT * FROM cod_barras WHERE idproduto = '" + idProduto + "' ORDER BY ean13";
            string tabela = "cod_barras";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables["cod_barras"];
        }
Ejemplo n.º 12
0
        //Metodos Eventos
        //---------------------------------------------------------------------
        private void FormGridCaixas_Load(object sender, EventArgs e)
        {
            string SQL    = "SELECT * FROM caixa WHERE estado = 'FECHADO' ORDER BY idcaixa DESC";
            string tabela = "caixa";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables[tabela];
            txtIDCaixa.Select();
        }
Ejemplo n.º 13
0
        private void FormCaixa_Load(object sender, EventArgs e)
        {
            //Carrega Grid de Entradas
            //-------------------------------------------------------------------------
            string SQL            = "SELECT * FROM caixa_entrada WHERE idcaixa = '" + txtIdCaixa.Text + "' ORDER BY identrada DESC";
            string tabela_entrada = "caixa_entrada";

            ds_entrada = new DataSet();
            ds_entrada = bd.ConsultarParaGrid(SQL, tabela_entrada);
            dataGridView1.DataSource = ds_entrada.Tables[tabela_entrada];

            //Carrega Grid de Entradas
            //-------------------------------------------------------------------------
            string SQL2         = "SELECT * FROM caixa_saida WHERE idcaixa = '" + txtIdCaixa.Text + "' ORDER BY idsaida DESC";
            string tabela_saida = "caixa_saida";

            ds_saida = new DataSet();
            ds_saida = bd.ConsultarParaGrid(SQL2, tabela_saida);
            dataGridView2.DataSource = ds_saida.Tables[tabela_saida];

            this.CalcularTotalEntradas();
            this.CalcularTotalSaidas();
        }
Ejemplo n.º 14
0
        private void FormPagtosCliente_Load(object sender, EventArgs e)
        {
            //mesAtual = DateTime.Now.Month;
            string SQL    = "SELECT p.idpagamento, p.data_pagto, p.valor_pagto, f.descricao, p.idvenda, p.idparcela, p.obs, p.usuario, p.idcliente FROM cliente_pagamento p, finalizadoras f WHERE p.idcliente = '" + codigoCliente + "' AND p.idfinalizadora = f.id ORDER BY p.data_pagto DESC";
            string tabela = "cliente_pagamento";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables[tabela];
            if (dataGridView1.RowCount > 0)
            {
                this.AtualizarTotal();
            }
            else
            {
            }
        }
Ejemplo n.º 15
0
        //Metodos Eventos
        //--------------------------------------------------------------------
        private void FormDebitosCliente_Load(object sender, EventArgs e)
        {
            string SQL    = "SELECT idvenda, idparcela, dtvencimento, valor, juros, (valor + juros)total, obs, estado, idcliente FROM cliente_debito WHERE idcliente = '" + idcliente + "' AND estado = 'ABERTA' ORDER BY dtvencimento";
            string tabela = "cliente_debito";

            ds = new DataSet();
            ds = bd.ConsultarParaGrid(SQL, tabela);
            dataGridView1.DataSource = ds.Tables[tabela];
            if (dataGridView1.RowCount > 0)
            {
                btnEfetuarPagamento.Enabled = true;
                btnInserirJuros.Enabled     = true;
                this.AtualizarTotal();
            }
            else
            {
                btnEfetuarPagamento.Enabled = false;
                btnInserirJuros.Enabled     = false;
            }
        }
Ejemplo n.º 16
0
        private void FormGridClientes_Load(object sender, EventArgs e)
        {
            //Grid - Pessoa Fisica
            //----------------------------------------------------------------
            string SQL    = "SELECT * FROM clientespf WHERE c_status = 'ATIVO'";
            string tabela = "pessoafisica";

            dsPf = new DataSet();
            dsPf = bd.ConsultarParaGrid(SQL, tabela);
            dataGridViewPF.DataSource = dsPf.Tables["pessoafisica"];

            //Grid - Pessoa Juridica
            //-----------------------------------------------------------------
            string SQL2    = "SELECT * FROM clientespj WHERE c_status = 'ATIVO'";
            string tabela2 = "pessoajuridica";

            dsPj = new DataSet();
            dsPj = bd.ConsultarParaGrid(SQL2, tabela2);
            dataGridViewPJ.DataSource = dsPj.Tables["pessoajuridica"];

            cbxSituacao.Text = "ATIVO";
        }