I need to print data from a DataGridViewer, which gets the products launched for sale. What is the best way to print this information in Report? I tried to use the Table component, but I can not pass the information to it, since it needs to be bound to a DataSet.
Here is the form constructor where the report is located:
public frmTesteImpressaoVenda(String nomeEmpresa, String enderecoEmpresa, String cnpjEmpresa, String telefoneEmpresa,
String nomeCliente, String cpjCliente, DateTime DataVenda, String Pagamento) {
InitializeComponent();
reportVenda.LocalReport.ReportEmbeddedResource = "GUI.ImpressaoVenda.rdlc";
ReportParameter[] parms = new ReportParameter[8];
parms[0] = new ReportParameter("NomeEmpresa", nomeEmpresa);
parms[1] = new ReportParameter("EnderecoEmpresa", enderecoEmpresa);
parms[2] = new ReportParameter("CnpjEmpresa", cnpjEmpresa);
parms[3] = new ReportParameter("Telefone", telefoneEmpresa);
parms[4] = new ReportParameter("Cliente", nomeCliente);
parms[5] = new ReportParameter("Cpf", cpjCliente);
parms[6] = new ReportParameter("DataVenda", DataVenda.ToString());
parms[7] = new ReportParameter("Pagamento", Pagamento);
reportVenda.LocalReport.SetParameters(parms);
reportVenda.LocalReport.Refresh();
reportVenda.RefreshReport();
}
The code below is the sales form where you pass the parameters to fill the report.
private void btImprimirTeste_Click(object sender, EventArgs e) {
frmTesteImpressaoVenda impVenda = new frmTesteImpressaoVenda(
CadastroEmpresa.nome_empresa,
CadastroEmpresa.endereco + ", " + CadastroEmpresa.numendereco + " - " + CadastroEmpresa.bairro + " - " + CadastroEmpresa.cidade,
CadastroEmpresa.cnpj,
CadastroEmpresa.telefone,
txtNomeCliente.Text,
lbCpf.Text,
DateTime.Now,
cbTipoPagto.Text
);
impVenda.Show();
}