Exemple #1
0
        private void dgv_produtos_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete && int.Parse("") >= 0)
            {
                if (tb_codigo.Text != "")
                {
                    MessageBox.Show("Impossível excluir produto ao alterar uma compra!", "Joincar", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (MessageBox.Show("Deseja realmente excluir este produto?", "Joincar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Produtos_CompraCollection produtos_compra_todos_temp = new Produtos_CompraCollection();
                    int PC_ITEM = 1;

                    foreach (Produtos_Compra produtos_compra in produtos_venda_todos)
                    {
                        if (produtos_compra.PC_ITEM != (int.Parse("0") + 1))
                        {
                            produtos_compra.PC_ITEM = PC_ITEM++;
                            produtos_compra_todos_temp.Add(produtos_compra);
                        }
                    }
                    Carregar_Grid(produtos_compra_todos_temp);
                }
            }
        }
Exemple #2
0
        public void Limpar()
        {
            tb_codigo.Text = string.Empty;
            cb_cliente.SelectedIndex = 0;
            tb_data.Text = DateTime.Now.ToString("dd/MM/yyyy");
            rb_nao_gerar.Checked = false;
            rb_avista.Checked = true;
            rb_aprazo.Checked = false;
            tb_out_desp.Text = "0,00";
            tb_acresc.Text = "0,00";
            tb_desc.Text = "0,00";
            gb_compra.Text = Titulo_Grupo("Cadastro");
            Carregar_Grid(new Produtos_CompraCollection());
            produtos_venda_todos_anterior = new Produtos_CompraCollection();

            tb_codigo.Enabled = true;
            btn_produto.Enabled = true;
            btn_gravar.Enabled = true;
            btn_cancelar.Enabled = false;
            dgv_produtos.Enabled = true;
            rb_orcamento.Enabled = rb_venda.Enabled = true;
            rb_orcamento.Checked = true;

            btn_imprimir.Enabled = false;
            // Coloca "COMPRAS" como pradrão de histórico

            bool Tem = false;
            int Posicao = 0;
        }
Exemple #3
0
        public void Limpar()
        {
            tb_codigo.Text = string.Empty;
            cb_fornecedor.SelectedIndex = 0;
            tb_data.Text         = DateTime.Now.ToString("dd/MM/yyyy");
            tb_nf.Text           = "";
            rb_nao_gerar.Checked = false;
            rb_avista.Checked    = false;
            rb_aprazo.Checked    = true;
            tb_out_desp.Text     = "0,00";
            tb_frete.Text        = "0,00";
            tb_acresc.Text       = "0,00";
            tb_desc.Text         = "0,00";
            gb_compra.Text       = Titulo_Grupo("Cadastro");
            Carregar_Grid(new Produtos_CompraCollection());
            produtos_compra_todos_anterior = new Produtos_CompraCollection();

            tb_codigo.Enabled    = true;
            btn_produto.Enabled  = true;
            btn_gravar.Enabled   = true;
            btn_cancelar.Enabled = false;
            dgv_produtos.Enabled = true;

            btn_imprimir.Enabled = false;
        }
Exemple #4
0
        public void Limpar()
        {
            tb_codigo.Text = string.Empty;
            cb_fornecedor.SelectedIndex = 0;
            cb_lancamento.SelectedIndex = 0;
            tb_data.Text         = DateTime.Now.ToString("dd/MM/yyyy");
            tb_nf.Text           = "";
            rb_nao_gerar.Checked = false;
            rb_avista.Checked    = false;
            rb_aprazo.Checked    = true;
            tb_out_desp.Text     = "0,00";
            tb_frete.Text        = "0,00";
            tb_acresc.Text       = "0,00";
            tb_desc.Text         = "0,00";
            gb_compra.Text       = Titulo_Grupo("Cadastro");
            Carregar_Grid(new Produtos_CompraCollection());
            produtos_compra_todos_anterior = new Produtos_CompraCollection();

            tb_codigo.Enabled           = true;
            btn_produto.Enabled         = true;
            btn_gravar.Enabled          = true;
            btn_cancelar.Enabled        = false;
            dgv_produtos.Enabled        = true;
            cb_lancamento.SelectedIndex = 0;

            // Coloca "COMPRAS" como pradrão de histórico

            bool Tem     = false;
            int  Posicao = 0;

            cb_lancamento.Visible = false;

            for (int i = 0; i < cb_lancamento.Items.Count; i++)
            {
                cb_lancamento.SelectedIndex = i;
                if (cb_lancamento.Text.ToUpper() == "COMPRAS")
                {
                    Tem     = true;
                    Posicao = i;
                }
            }
            if (Tem)
            {
                cb_lancamento.SelectedIndex = Posicao;
            }
            else
            {
                cb_lancamento.SelectedIndex = 0;
            }
            cb_lancamento.Visible = true;
        }
Exemple #5
0
        public void Carregar_Grid(Produtos_CompraCollection produtos_compra_todos_temp)
        {
            produtos_venda_todos = new Produtos_CompraCollection();
            float subtotal = 0;

            foreach (Produtos_Compra produtos_compra in produtos_compra_todos_temp)
            {
                subtotal += produtos_compra.PC_TOTAL;
                produtos_venda_todos.Add(produtos_compra);
            }
            dgv_produtos.DataSource = produtos_venda_todos;
            tb_subtotal.Text = subtotal.ToString("0.00");

            Calcular_Total();
            Esconder_Colunas();
        }
Exemple #6
0
        public void Carregar_Cadastro(int COM_CODIGO)
        {
            Compra compra = new Compra(COM_CODIGO,1);

            if (compra.COM_CODIGO > 0)
            {
                tb_codigo.Text = compra.COM_CODIGO.ToString();
                try
                {
                    cb_cliente.SelectedValue = compra.COM_CLIENTE_FORNECEDOR;
                }
                catch (Exception)
                {
                    cb_cliente.SelectedIndex = 0;
                }
                tb_data.Text = compra.COM_DATA.ToString("dd/MM/yyyy");
                
                if (compra.COM_TIPO_PAGTO == 0)
                {
                    rb_nao_gerar.Checked = true;
                    rb_avista.Checked = false;
                    rb_aprazo.Checked = false;
                }
                else if (compra.COM_TIPO_PAGTO == 0)
                {
                    rb_nao_gerar.Checked = false;
                    rb_avista.Checked = true;
                    rb_aprazo.Checked = false;
                }
                else
                {
                    rb_nao_gerar.Checked = false;
                    rb_avista.Checked = false;
                    rb_aprazo.Checked = true;
                }
                tb_out_desp.Text = compra.COM_OUT_DESPESAS.ToString("0.00");
                tb_acresc.Text = compra.COM_ACRESCIMO.ToString("0.00");
                tb_desc.Text = compra.COM_DESCONTO.ToString("0.00");
                int moviment = compra.COM_TIPO_MOVIMENTO;
                if (moviment == 0) rb_orcamento.Checked = true;
                if (moviment == 1)
                {
                    rb_venda.Checked = true;

                    rb_venda.Enabled = false;
                    rb_orcamento.Enabled = false;
                }
                else
                {
                    rb_venda.Enabled = true;
                    rb_orcamento.Enabled = true;
                }
                
                Carregar_Grid(new Produtos_CompraCollection(COM_CODIGO));
                Ativar_Desativar(false);

                //Guardar produtos anteriores para baixa de estoque correta
                produtos_venda_todos_anterior = new Produtos_CompraCollection(COM_CODIGO);

                tb_codigo.Enabled = false;
                if (compra.COM_CANCELADO == 1)
                {
                    gb_compra.Text = Titulo_Grupo("Cadastro") + " - CANCELADO";
                    btn_produto.Enabled = false;
                    btn_gravar.Enabled = false;
                    btn_cancelar.Enabled = false;
                    dgv_produtos.Enabled = false;
                    btn_limpar.Focus();
                }
                else
                {
                    btn_cancelar.Enabled = true;
                    dgv_produtos.Enabled = true;
                    cb_cliente.Select();
                }

                btn_imprimir.Enabled = true;
            }
            else
            {
                MessageBox.Show("Registro não encontrado!", "Joincar", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tb_codigo.Text = string.Empty;
                tb_codigo.Select();
            }
        }