Пример #1
0
        //METODO REGISTRA OS MOVIMENTOS DO ESTOQUE (ENTRADA/SAIDA)
        public bool insertRelatorioEstoque(EstoqueRelatorio estoque)
        {
            try
            {
                SqlConnection conexao = new SqlConnection(caminho);
                conexao.Open();

                String sql = "insert into Estoque_Relatorio(codProduto, descricao, quantidade, valorUnitario, valorTotal, movimentacao) " +
                             " values (@codProduto, @descricao, @quantidade, @valorUnitario, @valorTotal, @movimentacao) ";

                SqlCommand comando = new SqlCommand(sql, conexao);
                comando.Parameters.AddWithValue("codProduto", estoque.CodProduto);
                comando.Parameters.AddWithValue("descricao", estoque.Descricao);
                comando.Parameters.AddWithValue("quantidade", estoque.Quantidade);
                comando.Parameters.AddWithValue("valorUnitario", estoque.ValorUnitario);
                comando.Parameters.AddWithValue("valorTotal", estoque.ValorTotal);
                comando.Parameters.AddWithValue("movimentacao", estoque.Movimentacao);

                comando.ExecuteNonQuery();

            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }
Пример #2
0
        //METODO GERA RELATORIO DE SAIDAS DO ESTOQUE
        private void gerarRelatorioEstoque()
        {
            EstoqueRelatorio estoque = new EstoqueRelatorio();
            estoque.CodProduto = textBoxCodProduto.Text;
            estoque.Descricao = textBoxDescricao.Text;

            //REGISTRA VALOR NEGATIVO SIMULANDO SAIDA
            estoque.Quantidade = "-" + textBoxQtd.Text;
            estoque.ValorUnitario = "-" + textBoxValorUnit.Text;
            estoque.ValorTotal = "-" + textBoxValorTotal.Text;

            estoque.Movimentacao = "SAIDA";

            pool.insertRelatorioEstoque(estoque);
        }
Пример #3
0
        //METODO CARREGA MOVIMENTACAO DE ESTOQUE
        public ArrayList getMovimentacao(String filtro)
        {
            ArrayList lista = new ArrayList();

            SqlConnection conexao = new SqlConnection(caminho);
            conexao.Open();

            String sql = "SELECT * FROM Estoque_Relatorio ";

            if(!filtro.Equals("")){
                sql += "WHERE movimentacao LIKE '%" + filtro + "%'";
            }

            SqlCommand comando = new SqlCommand(sql, conexao);
            SqlDataReader dr = comando.ExecuteReader();

            while (dr.Read())
            {
                EstoqueRelatorio produtoEstoque = new EstoqueRelatorio();

                produtoEstoque.CodProduto = dr[0].ToString();
                produtoEstoque.Descricao = dr[1].ToString();
                produtoEstoque.Quantidade = dr[2].ToString();
                produtoEstoque.ValorUnitario = dr[3].ToString();
                produtoEstoque.ValorTotal = dr[4].ToString();
                produtoEstoque.Movimentacao = dr[5].ToString();

                lista.Add(produtoEstoque);

            }

            return lista;
        }
Пример #4
0
        //METODO GERA RELATORIO DE ENTRADAS DO ESTOQUE
        private void gerarRelatorioEstoque()
        {
            EstoqueRelatorio estoque = new EstoqueRelatorio();
            estoque.CodProduto = textBoxCodProduto.Text;
            estoque.Descricao = textBoxDescProduto.Text;
            estoque.Quantidade = textBoxQtd.Text;
            estoque.ValorUnitario = textBoxValorUnit.Text;
            estoque.ValorTotal = textBoxValorTotal.Text;
            estoque.Movimentacao = "ENTRADA";

            pool.insertRelatorioEstoque(estoque);
        }