Example #1
0
        private void afterBusca()
        {
            string st_reg = string.Empty;
            string virg   = string.Empty;

            if (CB_Abertas.Checked)
            {
                st_reg += virg + "'A'";
                virg    = ",";
            }
            if (CB_Liquidadas.Checked)
            {
                st_reg += virg + "'P'";
                virg    = ",";
            }
            if (cbCancelado.Checked)
            {
                st_reg += virg + "'C'";
                virg    = ",";
            }
            if (cbDescontado.Checked)
            {
                st_reg += virg + "'D'";
                virg    = ",";
            }
            blListaTitulo lista = TCN_Titulo.Buscar(CD_Empresa.Text,
                                                    decimal.Zero,
                                                    decimal.Zero,
                                                    decimal.Zero,
                                                    cd_contager.Text,
                                                    cd_banco.Text,
                                                    string.Empty,
                                                    cd_clifor_sacado.Text,
                                                    NR_Docto.Text,
                                                    VL_Inicial.Value,
                                                    VL_Final.Value,
                                                    rgData.NM_Valor,
                                                    DT_Inicial.Text,
                                                    DT_Final.Text,
                                                    CB_Vencidas.Checked ? "V" : string.Empty,
                                                    CB_AVencer.Checked ? "AV" : string.Empty,
                                                    st_reg,
                                                    string.Empty,
                                                    string.Empty,
                                                    nosso_numero.Text,
                                                    string.Empty,
                                                    string.Empty,
                                                    string.Empty,
                                                    st_protestado.Checked,
                                                    0,
                                                    null);

            //Totalizar titulo abertos
            if (lista.Count > 0)
            {
                tot_doc_aberto.Value = lista.Where(p => p.St_registro.Trim().ToUpper().Equals("A") || p.St_registro.Trim().ToUpper().Equals("D")).Sum(v => v.Vl_atual);
                //Totalizar titulo compensado
                tot_doc_compensado.Value = lista.Where(p => p.St_registro.Trim().ToUpper().Equals("P")).Sum(v => v.Vl_nominal);
                //Totalizar despesas cobranca
                tot_despcob.Value   = lista.Sum(v => v.Vl_despesa_cobranca);
                tot_documento.Value = tot_doc_aberto.Value + tot_doc_compensado.Value;
            }
            dsBloqueto.DataSource = lista;
            dsBloqueto_PositionChanged(this, new EventArgs());
        }