or
Private
Sub
activityTable_NeedDataSource(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
activityTable.NeedDataSource
Dim
tbl
As
Telerik.Reporting.Processing.Table = TryCast(sender, Processing.Table)
Dim
sect
As
Processing.ReportSection = TryCast(Processing.ElementTreeHelper.FindChildByName(tbl.Report,
"ReportHeaderSection1"
,
True
).FirstOrDefault, Processing.ReportSection)
Dim
data
As
Object
= sect.DataObject
Dim
cutoffdate
As
Date
, managedbypartnerid
As
Integer
Dim
totalduetextbox
As
Processing.ProcessingElement = Processing.ElementTreeHelper.GetChildByName(sect,
"payStubAmountDueTextBox"
)
Dim
totaldueaftertextbox
As
Processing.ProcessingElement = Processing.ElementTreeHelper.GetChildByName(sect,
"payStubAmountDueAfterTextBox"
)
Dim
autopaytextbox
As
Processing.ProcessingElement = Processing.ElementTreeHelper.GetChildByName(sect,
"autopaytext"
)
If
data IsNot
Nothing
Then
cutoffdate = data.Item(
"UsageCutOffDate"
)
managedbypartnerid = data.Item(
"ManagedByPartnerId"
)
End
If
<
telerik:ReportViewer
ID
=
"ReportViewerFiche"
runat
=
"server"
BorderStyle
=
"Solid"
BorderWidth
=
"1"
Report
=
"Rapports.Fiches.FicheAA.MyReport, Rapports, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
Width
=
"100%"
Height
=
"500px"
ViewMode
=
"PrintPreview"
>
</
telerik:ReportViewer
>
public string ConnectionString { get; set; }
private void Rpt_CustomerAccountsReport_NeedDataSource(object sender, EventArgs e)
{
try
{
if (Report.ReportParameters["MarketListID"].Value == null
&& Report.ReportParameters["BranchID"].Value == null
&& Report.ReportParameters["CustomerGroupID"].Value == null
&& Report.ReportParameters["CustomerID"].Value == null)
{
ErrorMsg("Error! This report cannot be run without parameters. Please select a Branch, Marketing list or Customer group.");
}
else
{
SqlData data = new SqlData(ConnectionString);
// Shared getdataset function
dsMain = data.GetDataSet("spRpt_CustomerAccountsReport", CommandType.StoredProcedure,
"@EmployeeUserID", Report.ReportParameters["EmployeeUserID"].Value,
"@MarketListID", Report.ReportParameters["MarketListID"].Value,
"@CustomerID", Report.ReportParameters["CustomerID"].Value,
"@BranchID", Report.ReportParameters["BranchID"].Value,
"@CustomerGroupID", Report.ReportParameters["CustomerGroupID"].Value,
"@EmployeeID", Report.ReportParameters["EmployeeID"].Value);
// ** Moving the max record limit to the stored procedure so we can change / make it user configurable without a re-compile
if (dsMain.Tables[0].Rows.Count > 40000)
{
ErrorMsg("Over 40,000 results were returned. The report cannot render. Please select more specific criteria.");
}
else
{
Report.DataSource = dsMain.Tables[0];
}
} // They provided parameters
}
catch (Exception ex)
{
ErrorMsg(ex.Message);
}
}
private void GroupHeaderArea1_ItemDataBinding(object sender, EventArgs e)
{
try
{
// Get the section
Telerik.Reporting.Processing.GroupSection section = (sender as Telerik.Reporting.Processing.GroupSection);
if (section != null)
{
// Get the customer ID for this section
object id = section.DataObject["CustomerID"];
if (id != null)
{
int CustID = (int)id;
// Filter out sub-report data
DataRow[] drContacts = dsMain.Tables[1].Select("CustomerID=" + CustID.ToString());
DataRow[] drCrossSell = dsMain.Tables[2].Select("CustomerID=" + CustID.ToString());
DataRow[] drAccounts = dsMain.Tables[3].Select("CustomerID=" + CustID.ToString());
Rpt_CustomerAccountsReportAccountSummary rptAcct = new Rpt_CustomerAccountsReportAccountSummary();
Rpt_CustomerAccountsReportContacts rptContact = new Rpt_CustomerAccountsReportContacts();
Rpt_CustomerAccountsReportCrossSell rptCrossSell = new Rpt_CustomerAccountsReportCrossSell();
rptAcct.DataSource = drAccounts;
rptContact.DataSource = drContacts;
rptCrossSell.DataSource = drCrossSell;
srContacts.ReportSource = rptContact;
srCrossSell.ReportSource = rptCrossSell;
srAccountSummary.ReportSource = rptAcct;
}
}
}
catch (Exception ex)
{
ErrorMsg(ex.Message);
}
}