Exemple #1
0
        protected void ddlPesqTipoBoleto_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoletoBLL bll = new BoletoBLL();

            CarregaDropDowList(ddlPesqSubTipoBoleto, bll.GetBoletoSubTipos(Util.String2Short(ddlPesqTipoBoleto.SelectedValue)).ToList <object>(), "DCR_BOLETO_SUBTIPO", "COD_BOLETO_SUBTIPO");
            ddlPesqSubTipoBoleto.Items[0].Text = "<TODOS>";
        }
Exemple #2
0
        private void atuGrid()
        {
            Int16 situacao = 0;

            if (rbtAberto.Checked)
            {
                situacao = 1;
            }
            else if (rbtPago.Checked)
            {
                situacao = 2;
            }
            else
            {
                situacao = 0;
            }

            DataTable dt = Common.converteListDataTable <Boleto>(BoletoBLL.listBySituacao(txtCliente.Text,
                                                                                          DateTime.Parse(txtDataIN.Text), DateTime.Parse(txtDataFN.Text), situacao,
                                                                                          txtNumDoc.Text, txtNossoNum.Text));

            dataGridView1.AutoGenerateColumns = false;
            BindingSource bs = new BindingSource();

            bs.DataSource            = dt;
            dataGridView1.DataSource = bs;
        }
Exemple #3
0
 public RelBoleto_res(DateTime tdatain, DateTime tdatafn, Boolean trecebido)
 {
     InitializeComponent();
     datain   = tdatain;
     datafn   = tdatafn;
     recebido = trecebido;
     tipo     = getTipo();
     lb       = BoletoBLL.listBoletos(datain, datafn, recebido);
 }
Exemple #4
0
        protected void btnGerar_Click(object sender, EventArgs e)
        {
            if (!ValidarCampos())
            {
                return;
            }

            CarregaDadosPartic();

            BoletoBLL bll  = new BoletoBLL();
            var       user = (ConectaAD)Session["objUser"];
            Resultado res  = bll.GerarNovoBoleto(Util.String2Short(ddlTipoBoleto.SelectedValue) ?? 0,
                                                 Util.String2Short(ddlSubTipoBoleto.SelectedValue),
                                                 Util.String2Short(txtCodEmpresa.Text) ?? 0,
                                                 Util.String2Int32(txtMatricula.Text) ?? 0,
                                                 Util.String2Short(txtDigito.Text),
                                                 Util.String2Int32(hidNUM_IDNTF_RPTANT.Value),
                                                 Util.String2Int64(txtCpf.Text) ?? 0,
                                                 Util.String2Int32(txtLote.Text) ?? 0,
                                                 txtNome.Text.ToUpper(),
                                                 Util.String2Date(txtDtVencimento.Text) ?? DateTime.Now,
                                                 Util.String2Decimal(txtValor.Text) ?? 0,
                                                 txtInstrucoes.Text,
                                                 lblEnd1.Text,
                                                 lblEnd2.Text,
                                                 " ",
                                                 " ",
                                                 " ",
                                                 (user != null) ? user.login : "******"
                                                 );

            if (res.Ok)
            {
                int PK_BOLETO = Util.String2Int32(res.CodigoCriado.ToString()) ?? 0;
                if (InicializaRelatorio(PK_BOLETO))
                {
                    VisualizarBoleto(PK_BOLETO);
                }
                MostraMensagem(lblMensagem, "Boleto gerado com sucesso!", "n_ok");
                grdBoleto.DataBind();
                pnlGrid.Visible       = true;
                pnlNovoBoleto.Visible = false;
            }
            else
            {
                //MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção! Ocorreu um erro na geração do boleto.\\nMotivo:\\n" + res.Mensagem);
                MostraMensagem(lblMensagemNovo, "Atenção! Ocorreu um erro na geração do boleto.\\nMotivo:\\n" + res.Mensagem, "n_erro");
            }
        }
Exemple #5
0
        private void CarregarDropDown()
        {
            BoletoBLL bll = new BoletoBLL();

            CarregaDropDowList(ddlPesqTipoBoleto, bll.GetBoletoTipos().ToList <object>(), "NOM_BOLETO", "COD_BOLETO_TIPO");
            ddlPesqTipoBoleto.Items[0].Text = "<TODOS>";

            CloneDropDownList(ddlPesqTipoBoleto, ddlTipoBoleto);
            ddlTipoBoleto.Items[0].Text  = "";
            ddlTipoBoleto.Items[0].Value = null;
            ddlTipoBoleto.SelectedValue  = null;

            CarregaDropDowList(ddlPesqSubTipoBoleto, bll.GetBoletoSubTipos().ToList <object>(), "DCR_BOLETO_SUBTIPO", "COD_BOLETO_SUBTIPO");
            ddlPesqSubTipoBoleto.Items[0].Text = "<TODOS>";

            CloneDropDownList(ddlPesqSubTipoBoleto, ddlSubTipoBoleto);
            ddlSubTipoBoleto.Items[0].Text  = "";
            ddlSubTipoBoleto.Items[0].Value = null;
            ddlSubTipoBoleto.SelectedValue  = null;
        }
Exemple #6
0
        private int status = 0; // usado para nao ficar aparecendo a showbox de confirmacao quando o usuario selecionar varias linhas
        private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            if (!e.Row.IsNewRow)
            {
                if (status == 0)
                {
                    DialogResult response = MessageBox.Show("ATENÇÃO ESSA OPERAÇÃO NÃO PODERÁ SER DESFEITA.\nVocê tem certeza que deseja deletar as boletas selecionadas?", "Deletar Boletas?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (response == System.Windows.Forms.DialogResult.No)
                    {
                        e.Cancel = true;
                        status   = 2; // coloco status 2 caso o usuario selecione não então quando ele for varrer as outras linhas para excluir ele sabe que o usuario responde nao
                    }
                    else
                    {
                        if (status != 2)
                        {
                            Int32 numdoc = Int32.Parse(e.Row.Cells[5].Value.ToString());
                            BoletoBLL.del(numdoc);
                        }
                    }
                }
                else
                {
                    if (status != 2)
                    {
                        Int32 numdoc = Int32.Parse(e.Row.Cells[5].Value.ToString());
                        BoletoBLL.del(numdoc);
                    }
                }

                int qtselecionada = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected);
                if (qtselecionada == 1)
                {
                    status = 0;
                }
                else
                {
                    status = 1;
                }
            }
        }
Exemple #7
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                if (dataGridView1.Columns[e.ColumnIndex] is DataGridViewButtonColumn)
                {
                    Int32  id = Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString());
                    Boleto o  = BoletoBLL.get(id);
                    if (o.Recebido)
                    {
                        MessageBox.Show("Essa boleta já está quitada.");
                    }
                    else
                    {
                        o.Recebido     = true;
                        o.DataRecebido = DateTime.Now.Date;
                        BoletoBLL.save(ref o);

                        atuGrid();
                    }
                }
            }
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string COD_EMPRS        = Request.QueryString["nEmpr"];
            string NUM_RGTRO_EMPRG  = Request.QueryString["nReg"];
            string NUM_DIVR_EMPRG   = Request.QueryString["nDigReg"];
            string NUM_IDNTF_RPTANT = Request.QueryString["nrepr"];
            //string NUM_DEPEND = Request.QueryString["ndep"];

            string NOM_EMPR = Request.QueryString["cPart"];

            string End1            = Request.QueryString["cEnd1"];
            string End2            = Request.QueryString["cEnd2"];
            string COD_TIPO_BOLETO = Request.QueryString["nIdBol"];

            string PARTICIPANTEEMAIL = Request.QueryString["ParticipanteEmail"];

            ScriptManager.RegisterStartupScript(UpdatePanel,
                                                UpdatePanel.GetType(),
                                                "script",
                                                "_client_side_script()",
                                                true);

            Page.Form.DefaultButton = btnPesquisar.UniqueID;
            lblMensagem.Visible     = false;
            lblMensagemNovo.Visible = false;

            if (!IsPostBack)
            {
                grdBoleto.Sort("DT_PROCESSAMENTO", SortDirection.Ascending);

                CarregarDropDown();

                if (!String.IsNullOrEmpty(COD_EMPRS) && !String.IsNullOrEmpty(NUM_RGTRO_EMPRG))
                {
                    ParticipanteBLL bll_p = new ParticipanteBLL();
                    PARTICIPANTE    part  = bll_p.GetParticipanteBy(Util.String2Short(COD_EMPRS) ?? 0, Util.String2Int32(NUM_RGTRO_EMPRG) ?? 0, Util.String2Int32(NUM_IDNTF_RPTANT) ?? 0, true);

                    txtPesqCodEmpresa.Text          = COD_EMPRS;
                    txtPesqMatricula.Text           = NUM_RGTRO_EMPRG;
                    txtPesqNome.Text                = NOM_EMPR;
                    hidPesqNUM_IDNTF_RPTANT.Value   = NUM_IDNTF_RPTANT;
                    ddlPesqTipoBoleto.SelectedValue = COD_TIPO_BOLETO;
                    if (part != null)
                    {
                        txtPesqDigito.Text = part.NUM_DIGVR_EMPRG.ToString();
                        txtPesqCpf.Text    = part.NUM_CPF_EMPRG.ToString();
                        txtEMail.Text      = part.COD_EMAIL_EMPRG;
                        lblPesqEnd1.Text   = part.DCR_ENDER_EMPRG + ", " + part.NUM_ENDER_EMPRG;
                        lblPesqEnd2.Text   = part.COD_CEP_EMPRG + "  " + part.NOM_BAIRRO_EMPRG + "  " + part.NOM_CIDRS_EMPRG + "-" + part.COD_UNDFD_EMPRG;
                    }

                    if (!String.IsNullOrEmpty(PARTICIPANTEEMAIL) && PARTICIPANTEEMAIL != "undefined")
                    {
                        txtEMail.Text = PARTICIPANTEEMAIL;
                    }

                    if (!String.IsNullOrEmpty(NUM_DIVR_EMPRG) && End2 != "undefined")
                    {
                        txtPesqDigito.Text = NUM_DIVR_EMPRG;
                    }

                    if (!String.IsNullOrEmpty(End1) && End1 != "undefined")
                    {
                        lblPesqEnd1.Text = End1;
                    }

                    if (!String.IsNullOrEmpty(End2) && End2 != "undefined")
                    {
                        lblPesqEnd2.Text = End2;
                    }

                    BoletoBLL           bll         = new BoletoBLL();
                    AAT_TBL_BOLETO_TIPO BOLETO_TIPO = bll.GetBoletoTipo(Util.String2Short(COD_TIPO_BOLETO) ?? 0);

                    if (BOLETO_TIPO != null)
                    {
                        txtInstrucoes.Text = BOLETO_TIPO.DCR_OBSERVACAO;
                    }

                    //ReportCrystal.Visible = false;
                    //txtCodEmpresa.Text = COD_EMPRS;
                    //txtMatricula.Text = NUM_RGTRO_EMPRG;
                    //txtDigito.Text = NUM_DIVR_EMPRG;
                    //txtCpf.Text = part.NUM_CPF_EMPRG.ToString();
                    //txtNome.Text = NOM_EMPR;
                    //ddlTipoBoleto.SelectedValue = COD_TIPO_BOLETO;
                    //lblEnd1.Text = End1;
                    //lblEnd2.Text = End2;


                    //if (ValidarCampos())
                    //{
                    //txtEMail.Enabled = true;
                    //btnEmail.Enabled = true;
                    //}
                }
            }
        }
Exemple #9
0
        private void btnLocalizar_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "";
            intQtde = 0;

            OpenFileDialog openFile = new OpenFileDialog();

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                txtFileRetorno.Text = openFile.FileName;
                int          nLoopCtr     = 1;
                int          intNossoNum  = 0;
                Boolean      blnBolNaoLoc = false;
                StreamReader sr           = new StreamReader(txtFileRetorno.Text);

                String[] fields = new String[3];

                while (true)
                {
                    string line = sr.ReadLine();
                    if (line == null)
                    {
                        break;
                    }

                    toolStripStatusLabel1.Text = "Processando linhas " + nLoopCtr.ToString();
                    Application.DoEvents();
                    nLoopCtr++;

                    fields = processLine(line);
                    if (fields[0] != null)
                    {
                        BolProcessada bp = new BolProcessada();
                        bp.NossoNum = fields[0];

                        intNossoNum += 1;
                        Boleto b = BoletoBLL.get(Int32.Parse(fields[0]));
                        if (b.ID > 0)
                        {
                            b.DataRecebido  = DateTime.Parse(fields[1]);
                            b.ValorRecebido = Decimal.Parse(fields[2]);
                            b.Recebido      = true;

                            BoletoBLL.save(ref b);

                            bp.Cliente   = b.Cliente.Nome;
                            bp.Valor     = b.Valor;
                            bp.ValorPago = b.ValorRecebido;
                        }
                        else
                        {
                            bp.Cliente   = "*** NOSSO NUMERO NÃO LOCALIZADO NO BANCO DE DADOS ***";
                            blnBolNaoLoc = true;
                        }

                        listBol.Add(bp);
                        toolStripStatusLabel1.Text = "Processando Nosso Num.: " + fields[0];
                    }
                }

                if (intQtde != intNossoNum)
                {
                    MessageBox.Show("Atenção: arq. retorno " + intQtde.ToString() +
                                    "/nNosso Num encontrados " + intNossoNum.ToString());
                }

                if (blnBolNaoLoc)
                {
                    MessageBox.Show("Existem boletas que não foram localizadas no banco de dados");
                }

                dataGridView1.DataSource = listBol;

                toolStripStatusLabel1.Text = "Processo finalizado. Total boletas " + intQtde;
            }
        }
Exemple #10
0
        private void btnGerar_Click(object sender, EventArgs e)
        {
            if (validForm())
            {
                List <Entity.Boleto> lb = new List <Entity.Boleto>();

                Int16    qtde = Int16.Parse(txtQtde.Text);
                DateTime venc = DateTime.Parse(txtVencimento.Text);
                lblVencimentos.Text = "";

                for (int i = 0; i < qtde; i++)
                {
                    Entity.Boleto o = new Entity.Boleto();
                    o.Cliente    = ClienteBLL.get(Int32.Parse(txtCliente.Text));
                    o.Valor      = Decimal.Parse(txtValor_Contrato.Text);
                    o.Obs1       = txtObs1.Text;
                    o.Obs2       = txtObs2.Text;
                    o.Obs3       = txtObs3.Text;
                    o.Vencimento = venc;

                    BoletoBLL.save(ref o);
                    lb.Add(o);

                    lblVencimentos.Text += venc.ToShortDateString() + Environment.NewLine;
                    venc = venc.AddMonths(1);
                }

                lbb = new List <BoletoNet.BoletoBancario>();

                foreach (Entity.Boleto boleto in lb)
                {
                    Configuracao   config = ConfiguracaoBLL.get();
                    Entity.Boleto  b      = boleto;
                    BoletoBancario bb     = new BoletoBancario();
                    bb.CodigoBanco       = 104;
                    bb.OcultarInstrucoes = true;

                    Cedente c = new Cedente(config.CNPJ, config.RazaoSocial, config.Agencia, config.Conta_Format, config.ContaDigito);
                    c.Codigo = config.Cedente;
                    String           base_nossnum = (24000000000000000 + b.ID).ToString();
                    BoletoNet.Boleto bol          = new BoletoNet.Boleto(b.Vencimento, b.Valor, "SR", base_nossnum, c);
                    bol.NumeroDocumento        = b.ID.ToString();
                    bol.Sacado                 = new Sacado(b.Cliente.CNPJ, b.Cliente.Nome + " (" + b.Cliente.Fantasia + ") ");
                    bol.Sacado.Endereco.End    = b.Cliente.Endereco;
                    bol.Sacado.Endereco.Numero = b.Cliente.Numero;
                    bol.Sacado.Endereco.Bairro = b.Cliente.Bairro;
                    bol.Sacado.Endereco.Cidade = b.Cliente.Cidade;
                    bol.Sacado.Endereco.UF     = b.Cliente.UF;
                    bol.Sacado.Endereco.CEP    = b.Cliente.CEP;

                    bol.DataDocumento = DateTime.Today.Date;
                    bol.ValorBoleto   = b.Valor;
                    Instrucao lot = new Instrucao(104);
                    lot.Descricao = config.Descricao;
                    bol.Instrucoes.Add(lot);

                    if (!String.IsNullOrEmpty(txtValor_Bruto.Text))
                    {
                        Instrucao obs = new Instrucao(104);
                        obs.Descricao = "Cobrar valor normal contrato após o vencimento R$ " + Decimal.Parse(txtValor_Bruto.Text).ToString("n");
                        bol.Instrucoes.Add(obs);
                    }

                    if (b.Obs1.Length > 0)
                    {
                        Instrucao obs1 = new Instrucao(104);
                        obs1.Descricao = b.Obs1;
                        bol.Instrucoes.Add(obs1);
                    }
                    if (b.Obs2.Length > 0)
                    {
                        Instrucao obs2 = new Instrucao(104);
                        obs2.Descricao = b.Obs2;
                        bol.Instrucoes.Add(obs2);
                    }
                    if (b.Obs3.Length > 0)
                    {
                        Instrucao obs3 = new Instrucao(104);
                        obs3.Descricao = b.Obs3;
                        bol.Instrucoes.Add(obs3);
                    }

                    bb.Boleto = bol;
                    bb.Boleto.Valida();

                    //salvando o nosso numero depois de gerado
                    b.NossoNum = bb.Boleto.NossoNumero;
                    BoletoBLL.save(ref b);

                    lbb.Add(bb);
                }

                GeraLayout();
                _impressaoBoleto.webBrowser1.Navigate(_arquivo);
                _impressaoBoleto.ShowDialog();


                toolStripStatusLabel1.Text = "Boletos gerados";
            }
        }