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); }
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(); }
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"]; }
//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(); }
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"; }
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"]; }
//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"]; }
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"]; }
//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]; }
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]; }
//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"]; }
//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(); }
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(); }
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 { } }
//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; } }
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"; }