示例#1
0
        private void Carregar_DGV()
        {
            try
            {
                if (tb_igual.Text != string.Empty || cb_criterio.SelectedIndex == 3 || cb_criterio.SelectedIndex == 4 ||
                    cb_criterio.SelectedIndex == 5)
                {
                    switch (cb_criterio.SelectedIndex)
                    {
                    case 0:
                        cheques_pagar_todos = new Cheques_PagarCollection(int.Parse(tb_igual.Text), Cheques_PagarLoadType.LoadById);
                        break;

                    case 1:
                        cheques_pagar_todos = new Cheques_PagarCollection(int.Parse(tb_igual.Text), Cheques_PagarLoadType.LoadByCarne);
                        break;

                    case 2:
                        cheques_pagar_todos = new Cheques_PagarCollection(tb_igual.Text);
                        break;

                    case 3:
                        cheques_pagar_todos = new Cheques_PagarCollection(DateTime.Parse(tb_inicio.Text), DateTime.Parse(tb_final.Text), Cheques_PagarLoadType.LoadByEmissao);
                        break;

                    case 4:
                        cheques_pagar_todos = new Cheques_PagarCollection(DateTime.Parse(tb_inicio.Text), DateTime.Parse(tb_final.Text), Cheques_PagarLoadType.LoadByVencimento);
                        break;

                    case 5:
                        cheques_pagar_todos = new Cheques_PagarCollection(DateTime.Parse(tb_inicio.Text), DateTime.Parse(tb_final.Text), Cheques_PagarLoadType.LoadByEfetivacao);
                        break;

                    default:
                        cheques_pagar_todos = new Cheques_PagarCollection(false);
                        break;
                    }
                }
                else
                {
                    cheques_pagar_todos = new Cheques_PagarCollection(true);
                }
            }
            catch (Exception)
            {
                cheques_pagar_todos = new Cheques_PagarCollection(false);
            }

            dvg_cheque.DataSource = cheques_pagar_todos;

            //Pintar();
        }
示例#2
0
        private void dgv_parcelas_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete && int.Parse(lbl_linha.Text) >= 0)
            {
                if (parcela_todos[int.Parse(lbl_linha.Text)].PCA_VALOR_PAGO > 0)
                {
                    MessageBox.Show("Impossível excluir parcela já paga! É necessário estorná-la antes.", "3Pratos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (parcela_todos[int.Parse(lbl_linha.Text)].PCA_ITEM_NOVA_PARC > 0)
                {
                    MessageBox.Show("Impossível excluir parcela parcial! É necessário excluir a parcela " + parcela_todos[int.Parse(lbl_linha.Text)].PCA_ITEM_NOVA_PARC.ToString() + " antes.", "3Pratos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (MessageBox.Show("Deseja realmente excluir esta parcela?", "3Pratos", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Parcelas_PagarCollection parcela_todos_temp      = new Parcelas_PagarCollection();
                    Cheques_PagarCollection  cheque_pagar_todos_temp = new Cheques_PagarCollection();
                    int PCA_ITEM = 1;

                    foreach (Cheques_Pagar cheque_pagar in cheque_pagar_todos)
                    {
                        cheque_pagar_todos_temp.Add(cheque_pagar);
                    }
                    cheque_pagar_todos.Clear();

                    foreach (Parcelas_Pagar parcela in parcela_todos)
                    {
                        if (parcela.PCA_ITEM != (int.Parse(lbl_linha.Text) + 1))
                        {
                            parcela.PCA_ITEM = PCA_ITEM++;
                            if (parcela.PCA_ITEM_NOVA_PARC == (int.Parse(lbl_linha.Text) + 1))
                            {
                                parcela.PCA_ITEM_NOVA_PARC = 0;
                            }
                            parcela_todos_temp.Add(parcela);

                            if (parcela.PCA_TIPO == 3)
                            {
                                foreach (Cheques_Pagar cheque_pagar in cheque_pagar_todos_temp)
                                {
                                    if (parcela.PCA_ITEM == cheque_pagar.CHP_ITEM)
                                    {
                                        cheque_pagar_todos.Add(cheque_pagar);
                                    }
                                }
                            }
                        }
                    }
                    Carregar_Grid(parcela_todos_temp);
                }
            }
        }
示例#3
0
        public void Limpar()
        {
            tb_codigo.Text = string.Empty;
            cb_fornecedor.SelectedIndex = 0;
            cb_lancamento.SelectedIndex = 0;
            tb_compra.Text      = "";
            tb_total_geral.Text = "0,00";
            tb_total_pago.Text  = "0,00";

            Carregar_Grid(new Parcelas_PagarCollection());
            cheque_pagar_todos = new Cheques_PagarCollection();

            tb_codigo.Enabled   = true;
            btn_excluir.Enabled = false;
            btn_cheque.Enabled  = false;
        }
示例#4
0
        public Frm_Gerar_Cheques(Cheques_PagarCollection cheque_pagar_todos_temp, int CHP_ITEM_TEMP)
        {
            InitializeComponent();

            this.Text = Titulo_Tela("Gerar Cheques");
            Limpar();

            cheque_pagar_todos = new Cheques_PagarCollection();
            CHP_ITEM           = CHP_ITEM_TEMP;
            foreach (Cheques_Pagar cheque_pagar in cheque_pagar_todos_temp)
            {
                cheque_pagar_todos.Add(cheque_pagar);
            }

            Carregar_Cadastro();

            tb_conta.Select();
        }
示例#5
0
        private void Carregar_Cadastro(int CAP_CODIGO)
        {
            Contas_Pagar contas_pagar = new Contas_Pagar(CAP_CODIGO);

            if (contas_pagar.CAP_CODIGO > 0)
            {
                tb_codigo.Text = contas_pagar.CAP_CODIGO.ToString();
                try
                {
                    cb_fornecedor.SelectedValue = contas_pagar.CAP_FORNECEDOR;
                }
                catch (Exception)
                {
                    cb_fornecedor.SelectedIndex = 0;
                }
                tb_compra.Text = contas_pagar.CAP_COMPRA_FORMATADO;
                try
                {
                    cb_lancamento.SelectedValue = contas_pagar.CAP_LANCAMENTO;
                }
                catch (Exception)
                {
                    cb_lancamento.SelectedIndex = 0;
                }
                Carregar_Grid(new Parcelas_PagarCollection(CAP_CODIGO));
                cheque_pagar_todos = new Cheques_PagarCollection(CAP_CODIGO, Cheques_PagarLoadType.LoadByCarne);

                tb_codigo.Enabled   = false;
                btn_excluir.Enabled = true;
                btn_cheque.Enabled  = false;
            }
            else
            {
                MessageBox.Show("Registro não encontrado!", "3Pratos", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tb_codigo.Text = string.Empty;
            }
        }