Question about ReportViewer C #

0

Good night, I would like to know if you have a text in the report, for example I'm making a receipt and I put a textbox and I would like to put it all on the same line, for example I got the name, nameRazao_cli, CPF holder, cpf_cli , the importance of (value in full).

Ccl_name and cpf_cli are coming from the database.

It would look like this in the report: I received from the accountant, Maria Aparecida, CPF holder, 111,111,111-11, the amount of (twenty reais).

Thank you

    
asked by anonymous 02.11.2016 / 02:14

1 answer

1

You need to add an expression / formula. Concatenating the fields is simple. It would look something like this:

= "Recebi da(o), " & Fields!nomeRazao_cli.Value & ", portador do CPF," & Fields!cpf_cli.Value & ", a importância de " & Fields!vlExtenso.Value

Now the value in full is something more complicated, I suggest you get a function, and run this function in the database data:

select nomeRazao_cli, cpf_cli, fn_numeroExtenso(valor_recebido) as vlExtenso ...

The function code for the number in full is often very large and I have nothing here at the moment, but I will leave links for you to base.

I would also like to do this function in C #, in case I do not know how you are getting the data, whether you are playing a DataTable or IEnumerable<T> as a data source for the report, but regardless of that you could use this function, it would look something like this:

List<Recibo> recibos = repositorio.GetRecibos();
foreach(var recibo in recibos)
   recibo.vlExtenso = Funcoes.ValorPorExtenso(recibo.valor);
reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dados", recibos));

Extended function links in SQL or C #

link

link

link

Report Viewer formulas reference:

link

    
02.11.2016 / 03:18