Beispiel #1
0
        private void btNovo_Click(object sender, EventArgs e)
        {
            OrdemPagamentoManutencao form = new OrdemPagamentoManutencao(new OrdemPagamento(), true);

            form.ShowDialog();
            btPesquisar_Click(null, null);
        }
Beispiel #2
0
        private void btGerarOP_Click(object sender, EventArgs e)
        {
            OrdemPagamento ordemPagamento = new OrdemPagamento();
            string         msgRetorno     = string.Empty;

            msgRetorno = ValidarCombos();

            if (msgRetorno == string.Empty)
            {
                ordemPagamento.idOrdemPagamento = 0;
                ordemPagamento.idEmpresa        = 0;
                ordemPagamento.idObraEtapa      = 0;
                ordemPagamento.idSolicitante    = UsuarioLogado.idUsuario;
                ordemPagamento.nomeSolicitante  = UsuarioLogado.Nome;
                ordemPagamento.dataSolicitacao  = DateTime.Now;
                ordemPagamento.Autorizado       = string.Empty;
                ordemPagamento.Observacao       = string.Empty;
                ordemPagamento.lstItens         = new List <OrdemPagamentoItem>();
                ordemPagamento.lstItens.Add(new OrdemPagamentoItem()
                {
                    idOcorrenciaMulta    = ocorrenciaSelecionada.idOcorrencia,
                    idManutencao         = 0,
                    idFrete              = 0,
                    idObraGastoRealizado = 0,
                    idAbastecimento      = 0,
                    idUEN                = int.Parse(cbUEN.SelectedValue.ToString()),
                    idCentroCusto        = int.Parse(cbCentroCusto.SelectedValue.ToString()),
                    idDespesa            = int.Parse(cbDespesa.SelectedValue.ToString()),
                    descricaoUEN         = cbUEN.Text,
                    descricaoCentroCusto = cbCentroCusto.Text,
                    descricaoDespesa     = cbDespesa.Text,
                    Valor                = ocorrenciaSelecionada.valorMulta,
                    dataVencimento       = tbData.Value,
                    numeroParcela        = 1,
                    totalParcelas        = 1
                });

                OrdemPagamentoManutencao form = new OrdemPagamentoManutencao(ordemPagamento, false);
                form.ShowDialog();

                this.Close();
            }
            else
            {
                MessageBox.Show("Atenção: " + msgRetorno, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #3
0
        private void VisualizarLancamento()
        {
            OrdemPagamento ordemPagamentoSelecionada = new OrdemPagamento();
            int            linhaGrid = 0;
            int            idOrdemPagamentoSelecionada = 0;

            try
            {
                if (gvOrdensPagamentos.RowCount == 0)
                {
                    return;
                }

                linhaGrid = gvOrdensPagamentos.SelectedCells[0].RowIndex;
                idOrdemPagamentoSelecionada = int.Parse(gvOrdensPagamentos[0, linhaGrid].Value.ToString());

                ordemPagamentoSelecionada = bizOP.PesquisarOrdemPagamento(new OrdemPagamento()
                {
                    idOrdemPagamento = idOrdemPagamentoSelecionada
                })[0];
                ordemPagamentoSelecionada.lstItens = new List <OrdemPagamentoItem>();
                ordemPagamentoSelecionada.lstItens = bizOP.PesquisarOrdemPagamentoItem(new OrdemPagamentoItem()
                {
                    idOrdemPagamento = idOrdemPagamentoSelecionada
                });

                OrdemPagamentoManutencao form = new OrdemPagamentoManutencao(ordemPagamentoSelecionada, true);
                form.ShowDialog();

                btPesquisar_Click(null, null);
            }
            catch (SqlException)
            {
                MessageBox.Show(helper.RetornarMensagemPadraoErroAcessoBD(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show(helper.RetornarMensagemPadraoErroGenerico(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #4
0
        private void btGerarOP_Click(object sender, EventArgs e)
        {
            BIZOrdemPagamento bizOP           = new BIZOrdemPagamento();
            OrdemPagamento    ordemPagamento  = new OrdemPagamento();
            string            msgRetorno      = string.Empty;
            DateTime          dataVecimentoOP = new DateTime();
            int idOPSelecionada = 0;
            int idFornecedor    = 0;

            try
            {
                msgRetorno = this.ValidarGeracaoOP(out idFornecedor);

                if (msgRetorno == string.Empty)
                {
                    using (AbastecimentoVencimentoOP formVencimentoOP = new AbastecimentoVencimentoOP())
                    {
                        DialogResult dr = formVencimentoOP.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            dataVecimentoOP = formVencimentoOP.tbData.Value;
                            if (formVencimentoOP.chkAdicionarOP.Checked)
                            {
                                idOPSelecionada = int.Parse(formVencimentoOP.cbOPAbastecimento.SelectedValue.ToString());
                            }
                        }
                        else
                        {
                            return;
                        }
                    }

                    if (idOPSelecionada == 0)
                    {
                        ordemPagamento.idOrdemPagamento = 0;
                        ordemPagamento.idEmpresa        = 0;
                        ordemPagamento.idFavorecido     = idFornecedor;
                        ordemPagamento.idObraEtapa      = 0;
                        ordemPagamento.idSolicitante    = UsuarioLogado.idUsuario;
                        ordemPagamento.nomeSolicitante  = UsuarioLogado.Nome;
                        ordemPagamento.dataSolicitacao  = DateTime.Now;
                        ordemPagamento.Autorizado       = string.Empty;
                        ordemPagamento.Observacao       = string.Empty;
                        ordemPagamento.lstItens         = new List <OrdemPagamentoItem>();
                        ordemPagamento.lstItens.AddRange(GerarListadeItens(dataVecimentoOP));
                    }
                    else
                    {
                        ordemPagamento = bizOP.PesquisarOrdemPagamento(new OrdemPagamento()
                        {
                            idOrdemPagamento = idOPSelecionada
                        })[0];
                        ordemPagamento.lstItens = bizOP.PesquisarOrdemPagamentoItem(new OrdemPagamentoItem()
                        {
                            idOrdemPagamento = idOPSelecionada
                        });
                        ordemPagamento.lstItens.AddRange(GerarListadeItens(dataVecimentoOP));
                    }

                    OrdemPagamentoManutencao form = new OrdemPagamentoManutencao(ordemPagamento, false);
                    form.ShowDialog();

                    this.CarregarGrid(new Abastecimento());
                }
                else
                {
                    MessageBox.Show("Atenção" + msgRetorno, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (SqlException)
            {
                MessageBox.Show(helper.RetornarMensagemPadraoErroAcessoBD(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show(helper.RetornarMensagemPadraoErroGenerico(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }