using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Stimulsoft.Report; using System.Data; using System.Data.Sql; using System.Data.SqlClient; using Stimulsoft.Report.Dictionary; using Stimulsoft.Report.Export; using Stimulsoft.Base.Services; using ns_MoneyFlow.DAL; using System.Web.Configuration; using System.Web.Security; using System.IO; using Stimulsoft.Report.Components; using Stimulsoft.Base.Drawing; using Stimulsoft.Report.Web; using System.Drawing; public partial class Default2 : System.Web.UI.Page { private StiReport report = new StiReport(); protected void Page_Load(object sender, EventArgs e) { StiReport report = CreateReport1(); report.Render(); StiWebViewer1.Report = report; } private StiReport CreateReport1() { StiReport report = new StiReport(); StiPage BSReport = report.Pages[0]; BSReport.PaperSize = System.Drawing.Printing.PaperKind.Ledger; // Add the main databand StiDataBand dbMain = new StiDataBand(); dbMain.Height = 0.4; dbMain.Name = "stidbMain"; BSReport.Components.Add(dbMain); double subrepsize = BSReport.Width / 2; StiPage LiabRep = new StiPage(); report.Pages.Add(LiabRep); StiSubReport SubRep1 = new StiSubReport(new RectangleD(0, 0, subrepsize, 0.4)); SubRep1.Name = "subLiabRep"; SubRep1.Page = LiabRep; dbMain.Components.Add(SubRep1); cs_GeneralLedger.cs_GLReports objBalanceSheetRep = new cs_GeneralLedger.cs_GLReports(); objBalanceSheetRep.Login = (string)Session["UserID"]; objBalanceSheetRep.LoginPassword = (string)Session["Password"]; cs_ConnectionString ConStr = new cs_ConnectionString(); DataSet dsBSReport = objBalanceSheetRep.m_BalanceSheetReport(11, "26/5/2013", "GL", true, "abc"); dsBSReport.Tables[0].TableName = "dtBSRepTitleDetails"; DataTable dtRepDet = dsBSReport.Tables[0]; dsBSReport.Tables[1].TableName = "dtBSUsersPCList"; DataTable dtUserPC = dsBSReport.Tables[1]; dsBSReport.Tables[2].TableName = "dtBSLiabs"; DataTable dtRepLiab = dsBSReport.Tables[2]; dsBSReport.Tables[3].TableName = "dtBSAssets"; DataTable dtRepAsst = dsBSReport.Tables[3]; report.RegData(dsBSReport); report.Dictionary.Synchronize(); //Create TitleBand StiHeaderBand TitleBand = new StiHeaderBand(); TitleBand.Height = 0.85; TitleBand.Name = "TitleBand"; LiabRep.Components.Add(TitleBand); //Create HeaderBand StiHeaderBand headerBand = new StiHeaderBand(); headerBand.Height = 0.5; headerBand.Name = "HeaderBand"; LiabRep.Components.Add(headerBand); //Create Databand StiDataBand dataBand = new StiDataBand(); dataBand.DataSourceName = "dtBSLiabs"; dataBand.Height = 0.5; dataBand.Name = "DataBand"; LiabRep.Components.Add(dataBand); double pos = 0; double columnWidth = LiabRep.Width / ((dtUserPC.Rows.Count + 1) * 2); double x = columnWidth * 2; StiText hTextL = new StiText(new RectangleD(pos, 0, x, 0.7)); hTextL.Text.Value = "Liabilities"; hTextL.HorAlignment = StiTextHorAlignment.Center; hTextL.VertAlignment = StiVertAlignment.Center; hTextL.Name = "HeaderTextL"; hTextL.Border.Side = StiBorderSides.All; headerBand.Components.Add(hTextL); pos = pos + x; int nameIndex = 1; foreach (DataRow drUserPC in dtUserPC.Rows) { StiText hText = new StiText(new RectangleD(pos, 0, x, 0.4)); //hText = new StiText(new RectangleD(pos, 0, x, 0.7)); hText.Text.Value = drUserPC["ProfitCenter"].ToString() + System.Environment.NewLine + "Amt in Rs."; hText.HorAlignment = StiTextHorAlignment.Center; hText.VertAlignment = StiVertAlignment.Center; hText.Name = "HeaderText" + nameIndex.ToString(); hText.Border.Side = StiBorderSides.All; headerBand.Components.Add(hText); StiText hText1 = new StiText(new RectangleD(pos, 0.4, columnWidth, 0.3)); hText1.Text.Value = "Dr"; hText1.HorAlignment = StiTextHorAlignment.Center; hText1.VertAlignment = StiVertAlignment.Center; hText1.Name = "HeaderText1" + nameIndex.ToString(); hText1.Border.Side = StiBorderSides.All; headerBand.Components.Add(hText1); StiText hText2 = new StiText(new RectangleD(pos + columnWidth, 0.4, columnWidth, 0.3)); hText2.Text.Value = "Cr"; hText2.HorAlignment = StiTextHorAlignment.Center; hText2.VertAlignment = StiVertAlignment.Center; hText2.Name = "HeaderText2" + nameIndex.ToString(); hText2.Border.Side = StiBorderSides.All; headerBand.Components.Add(hText2); nameIndex++; pos = pos + x; } return report; } }