Hi,
I´ve some dificult to resolv one problem, the cenarius is:
- I´ve a common header report
- Detail section, and footer
On my detail I have some controls anfter I want a sub report to detailing same records and after I have more controls.
The problem is that the sub report lost the datasource, and on databinding occurs the error.
My Source:
Fisrt Report
My SubReport
Someone can help me?
Thanks
I´ve some dificult to resolv one problem, the cenarius is:
- I´ve a common header report
- Detail section, and footer
On my detail I have some controls anfter I want a sub report to detailing same records and after I have more controls.
The problem is that the sub report lost the datasource, and on databinding occurs the error.
My Source:
Fisrt Report
namespace Eorder_Reporting | |
{ | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Windows.Forms; | |
using Telerik.Reporting; | |
using Telerik.Reporting.Drawing; | |
using System.Data; | |
using Report.dal; | |
using System.Text; | |
/// <summary> | |
/// Summary description for ReportConsultaPedido. | |
/// </summary> | |
public partial class ReportConsultaPedido : Report | |
{ | |
public ReportConsultaPedido() | |
{ | |
/// <summary> | |
/// Required for telerik Reporting designer support | |
/// </summary> | |
InitializeComponent(); | |
// | |
// TODO: Add any constructor code after InitializeComponent call | |
// | |
this.DataSource = null; | |
this.subReport1.ReportSource = null; | |
} | |
string _strVarIdPedido; | |
public string IdPedidoDetalheConsulta | |
{ | |
get | |
{ | |
return (_strVarIdPedido); | |
} | |
set | |
{ | |
_strVarIdPedido = value; | |
} | |
} | |
private void ReportConsultaPedido_NeedDataSource(object sender, System.EventArgs e) | |
{ | |
dal clsDal = new dal(); | |
StringBuilder strSQL = new StringBuilder(); | |
strSQL.Append("SELECT CP_PEDIDO_V.ID_PEDIDO, CP_PEDIDO_V.ID_USUARIO, CP_PEDIDO_V.NR_ORDEM_COMPRA, CP_PEDIDO_V.DT_PEDIDO, "); | |
strSQL.Append(" CP_PEDIDO_V.DT_ENTREGA, CP_PEDIDO_V.TS_INCLUSAO, CP_PEDIDO_V.TS_CONCLUSAO, CP_PEDIDO_V.COD_VENDEDOR, "); | |
strSQL.Append(" CP_PEDIDO_V.TS_ENVIO_SAP, CP_PEDIDO_V.NR_CONTROLE_PORTAL, CP_PEDIDO_V.ID_TIPO_DOCUMENTO, CP_PEDIDO_V.ID_CONDICAO_PAGTO, "); | |
strSQL.Append(" CP_PEDIDO_V.DT_FATURAMENTO, CP_PEDIDO_V.DS_OBSERVACAO, CP_PEDIDO_V.COD_CLIENTE_VENDA, CP_PEDIDO_V.NM_CLIENTE_VENDA, "); | |
strSQL.Append(" CP_PEDIDO_V.DS_CIDADE_VENDA, CP_PEDIDO_V.UF_VENDA, CP_PEDIDO_V.COD_CLIENTE_ENTREGA, CP_PEDIDO_V.NM_CLIENTE_ENTREGA, "); | |
strSQL.Append(" CP_PEDIDO_V.DS_CIDADE_ENTREGA, CP_PEDIDO_V.UF_ENTREGA, CP_PEDIDO_V.TS_CANCELADO, CP_PEDIDO_V.NOME_VENDEDOR, "); | |
strSQL.Append(" CP_PEDIDO_V.DS_OBSERVACAO_PEDIDO, CP_TIPO_DOCUMENTO.DS_TIPO_DOCUMENTO, CP_CONDICAO_PAGTO.DS_CONDICAO_PAGTO, "); | |
strSQL.Append(" (SELECT SUM(COALESCE(cp_pedido_item.vl_item_total, 0)) "); | |
strSQL.Append(" FROM cp_pedido_item "); | |
strSQL.Append(" WHERE cp_pedido_item.id_pedido = cp_pedido_v.ID_PEDIDO) AS VL_TOTAL "); | |
strSQL.Append(" FROM CP_PEDIDO_V, CP_CONDICAO_PAGTO, CP_TIPO_DOCUMENTO "); | |
strSQL.Append(" WHERE CP_PEDIDO_V.ID_CONDICAO_PAGTO = CP_CONDICAO_PAGTO.ID_CONDICAO_PAGTO AND "); | |
strSQL.Append(" CP_PEDIDO_V.ID_TIPO_DOCUMENTO = CP_TIPO_DOCUMENTO.ID_TIPO_DOCUMENTO AND (CP_PEDIDO_V.TS_CANCELADO IS NULL) "); | |
strSQL.Append(" AND (CP_PEDIDO_V.NR_ORDEM_COMPRA in (" + _strVarIdPedido + "))"); | |
clsDal.CreateCommand(strSQL.ToString(), CommandType.Text); | |
System.Data.DataSet ds = clsDal.GetDataSet(); | |
this.DataSource = ds; | |
} | |
private void subReport1_ItemDataBinding(object sender, System.EventArgs e) | |
{ | |
Telerik.Reporting.Processing.ReportItemBase item = ((Telerik.Reporting.Processing.ReportItemBase)sender); | |
try | |
{ | |
if (null != item) | |
{ | |
ReportDetalhePedido pedidoDetalhe = new ReportDetalhePedido(); | |
pedidoDetalhe.IDPedido = "'" + item.DataObject["NR_ORDEM_COMPRA"].ToString().PadLeft(5, '0') + "'"; | |
subReport1.ReportSource = pedidoDetalhe; | |
} | |
} | |
catch { } | |
} | |
} | |
} |
My SubReport
namespace Eorder_Reporting | |
{ | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Windows.Forms; | |
using Telerik.Reporting; | |
using Telerik.Reporting.Drawing; | |
using Report.dal; | |
using System.Text; | |
using System.Data; | |
/// <summary> | |
/// Summary description for ReportDetalhePedido. | |
/// </summary> | |
public partial class ReportDetalhePedido : Report | |
{ | |
public ReportDetalhePedido() | |
{ | |
/// <summary> | |
/// Required for telerik Reporting designer support | |
/// </summary> | |
InitializeComponent(); | |
// | |
// TODO: Add any constructor code after InitializeComponent call | |
// | |
this.DataSource = null; | |
} | |
string _strVarIdPedido; | |
public string IDPedido | |
{ | |
get { return _strVarIdPedido; } | |
set { _strVarIdPedido = value; } | |
} | |
private void ReportDetalhePedido_NeedDataSource(object sender, System.EventArgs e) | |
{ | |
dal clsDal = new dal(); | |
StringBuilder strSQL = new StringBuilder(); | |
strSQL.Append("SELECT CP_PEDIDO_ITEM.ID_PEDIDO_ITEM, CP_PEDIDO_ITEM.ID_PEDIDO, CP_PEDIDO_ITEM.QTD_ITEM, CP_PEDIDO_ITEM.TS_INCLUSAO, "); | |
strSQL.Append(" CP_PEDIDO_ITEM.TS_CANCELADO, CP_PEDIDO_ITEM.COD_PRODUTO, CP_PEDIDO_ITEM.NM_PRODUTO, CP_PEDIDO_ITEM.DS_BU, "); | |
strSQL.Append(" CP_PEDIDO_ITEM.DS_UNIDADE, CP_PEDIDO_ITEM.COD_CLASSIFIC_PIG_POULTRY, CP_PEDIDO_ITEM.ID_TABELA_PC_PIG, "); | |
strSQL.Append(" CP_PEDIDO_ITEM.ID_TABELA_PC_POULTRY, CP_PEDIDO_ITEM.VL_ITEM, CP_PEDIDO_ITEM.FL_FINS_AGROPEC, "); | |
strSQL.Append(" CP_PEDIDO_ITEM.VL_ITEM_TOTAL, CP_PEDIDO_V.NR_ORDEM_COMPRA "); | |
strSQL.Append(" FROM CP_PEDIDO_V, CP_PEDIDO_ITEM "); | |
strSQL.Append(" WHERE CP_PEDIDO_V.ID_PEDIDO = CP_PEDIDO_ITEM.ID_PEDIDO AND (CP_PEDIDO_V.NR_ORDEM_COMPRA = " + _strVarIdPedido + ") "); | |
strSQL.Append(" ORDER BY CP_PEDIDO_ITEM.DS_BU, CP_PEDIDO_ITEM.NM_PRODUTO"); | |
clsDal.CreateCommand(strSQL.ToString(), CommandType.Text); | |
System.Data.DataSet ds = clsDal.GetDataSet(); | |
this.DataSource = ds; | |
} | |
} | |
} |
Someone can help me?
Thanks