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(); //public Stimulsoft.Report.Components.StiGroupHeaderBand grLiabPrim; //public DataSet dsBSReport; //public DataTable dtRepDet; //public DataTable dtUserPC; //public DataTable dtRepLiab; //public DataTable dtRepAsst; //public StiGroupHeaderBand ghbLiabSec; protected void Page_Load(object sender, EventArgs e) { try { StiReport report = CreateReport2(); report.Render(); StiWebViewer1.Report = report; StiWebViewer1.ViewMode = StiWebViewMode.WholeReport; //StiReportResponse.ResponseAsPdf(this.Page, report, true); //StiOptions.Web.AllowUseResponseFlush = false; } catch (SqlException ex) { ErrorExtension ErrorExtension = new ErrorExtension(); ErrorExtension.ToLogString(ex, ""); Response.Redirect("ErrorPage.aspx?Error=2&Page=" + Page.Title); } catch (Exception ex) { ErrorExtension ErrorExtension = new ErrorExtension(); ErrorExtension.ToLogString(ex, ""); Response.Redirect("ErrorPage.aspx?Error=1&Page=" + Page.Title); } } public StiReport CreateReport2() { StiReport report = new StiReport(); 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(); StiPage MainRepPage = report.Pages[0]; MainRepPage.PaperSize = System.Drawing.Printing.PaperKind.Ledger; MainRepPage.Orientation = StiPageOrientation.Landscape; MainRepPage.PrintOn = StiPrintOnType.AllPages; MainRepPage.Enabled = true; //Create Report Title Band StiReportTitleBand TitleBand = new StiReportTitleBand(); TitleBand.Height =3; TitleBand.Name = "TitleBand"; TitleBand.Enabled = true; TitleBand.Printable = true; TitleBand.CanGrow = true; TitleBand.PrintIfEmpty = true; MainRepPage.Components.Add(TitleBand); // Panel in title band StiPanel pnReportTitle = new StiPanel(new RectangleD(0, 0, MainRepPage.PageWidth, 0.5)); TitleBand.Components.Add(pnReportTitle); // Company Logo in title band StiImage imgCompLogo = new StiImage(new RectangleD(3.5, 0, 3, 1.4)); imgCompLogo.Enabled = true; imgCompLogo.Printable = true; imgCompLogo.CanShrink = true; imgCompLogo.AspectRatio = true; pnReportTitle.Components.Add(imgCompLogo); // Get the logo image from the given path DataRow dr = dtRepDet.Rows[0]; if (dr["CompLogoPath"].ToString() != "") { if (File.Exists(Server.MapPath(dr["CompLogoPath"].ToString()))) { imgCompLogo.Image = Stimulsoft.Base.Drawing.StiImageFromURL.LoadBitmap(Server.MapPath(dr["CompLogoPath"].ToString())); } } // Company Name in title band StiText txtCompName = new StiText(new RectangleD(3.5, 1.5, 3, 0.4)); txtCompName.Text.Value = dr["CompanyName"].ToString(); txtCompName.Font = new Font("Arial", 10F, System.Drawing.FontStyle.Bold); txtCompName.HorAlignment = StiTextHorAlignment.Center; txtCompName.VertAlignment = StiVertAlignment.Center; txtCompName.CanGrow = true; txtCompName.Enabled = true; txtCompName.Printable = true; pnReportTitle.Components.Add(txtCompName); // Company Address in title band StiText txtCompAddress = new StiText(new RectangleD(3.5, 1.9 , 3, 0.4)); txtCompAddress.Text.Value = dr["CompAddress"].ToString(); txtCompAddress.Font = new Font("Arial", 10F, System.Drawing.FontStyle.Bold); txtCompAddress.HorAlignment = StiTextHorAlignment.Center; txtCompAddress.VertAlignment = StiVertAlignment.Center; txtCompAddress.CanGrow = true; txtCompAddress.Enabled = true; txtCompAddress.Printable = true; pnReportTitle.Components.Add(txtCompAddress); // Report title in title band StiText txtReportTitle = new StiText(new RectangleD(3.5 ,2.3, 3 , 0.5)); txtReportTitle.Text.Value = dr["Heading"].ToString(); txtReportTitle.Font = new Font("Arial", 10F, System.Drawing.FontStyle.Bold); txtReportTitle.HorAlignment = StiTextHorAlignment.Center; txtReportTitle.VertAlignment = StiVertAlignment.Center; txtReportTitle.CanGrow = true; txtReportTitle.Enabled = true; txtReportTitle.Printable = true; pnReportTitle.Components.Add(txtReportTitle); // Add the main databand StiDataBand dbMain = new StiDataBand(new RectangleD(0, 0, MainRepPage.PageWidth, 2)); dbMain.Name = "stidbMain"; dbMain.Printable = true; dbMain.PrintOnAllPages = true; MainRepPage.Components.Add(dbMain); // Create the liability sub report page StiPage LiabRep = new StiPage(); LiabRep.PaperSize = System.Drawing.Printing.PaperKind.Custom; LiabRep.PageWidth = (dbMain.Width - MainRepPage.Margins.Left - MainRepPage.Margins.Right) / 2; LiabRep.Orientation = StiPageOrientation.Portrait; LiabRep.Margins.Top = MainRepPage.Margins.Top; LiabRep.Margins.Bottom = MainRepPage.Margins.Bottom; LiabRep.Margins.Left = 0; LiabRep.Margins.Right = 0; LiabRep.PrintOn = StiPrintOnType.AllPages; report.Pages.Add(LiabRep); // Create the Asset sub report page StiPage AssetRep = new StiPage(); AssetRep.PaperSize = System.Drawing.Printing.PaperKind.Custom; AssetRep.PageWidth = (dbMain.Width - MainRepPage.Margins.Left - MainRepPage.Margins.Right) / 2; AssetRep.Orientation = StiPageOrientation.Portrait; AssetRep.Margins.Top = MainRepPage.Margins.Top; AssetRep.Margins.Bottom = MainRepPage.Margins.Bottom; AssetRep.Margins.Left = 0; AssetRep.Margins.Right = 0; AssetRep.PrintOn = StiPrintOnType.AllPages; report.Pages.Add(AssetRep); //Vertical Lines //StiVerticalLinePrimitive stiLine1 = new StiVerticalLinePrimitive(); //stiLine1.ClientRectangle = new RectangleD(2, 2, 6, 10); //stiLine1.Color = Color.Red; //stiLine1.EndCap = new StiCap(1, StiCapStyle.Square, 10, true, Color.Red); ////stiLine1.Top = 2; ////stiLine1.Height = 10; //stiLine1.PrintOn = StiPrintOnType.AllPages; ////stiLine1.ShiftMode = StiShiftMode.IncreasingSize; //stiLine1.Printable = true; //stiLine1.Enabled = true; //MainRepPage.Components.Add(stiLine1); // Create Sub report for Liabilities StiSubReport SubRep1 = new StiSubReport(new RectangleD(0, 0, LiabRep.PageWidth , 1)); SubRep1.Name = "subLiabRep"; SubRep1.Page = LiabRep; SubRep1.SubReportPageGuid = LiabRep.Guid; dbMain.Components.Add(SubRep1); // Calculate the starting point for the Asset sub report double AssetL = (dbMain.Width - MainRepPage.Margins.Left - MainRepPage.Margins.Right) / 2; // Create Sub report for Assets StiSubReport SubRep2 = new StiSubReport(new RectangleD(AssetL, 0, AssetRep.PageWidth, 1)); SubRep2.Name = "subAssetRep"; SubRep2.Page = AssetRep; SubRep2.SubReportPageGuid = AssetRep.Guid; dbMain.Components.Add(SubRep2); // Variables for calculating the width of the text boxes in each band double columnWidth = LiabRep.PageWidth / ((dtUserPC.Rows.Count + 2) * 2); double x = columnWidth * 2; double gap = x * 2 / 6; double pos = 0; // ---------------------------------------------------- Liabilities -------------------------------------------------------- // //Create Databand for header band in Liabilities sub report StiDataBand dbinhbLiab = new StiDataBand(new RectangleD(0, 0, LiabRep.PageWidth, 0.8)); dbinhbLiab.Height = 0.8; dbinhbLiab.Name = "LiabHeaderDataBand"; dbinhbLiab.PrintOnAllPages = true; LiabRep.Components.Add(dbinhbLiab); // "Liabilities" header StiText txtLiabHdr = new StiText(new RectangleD(pos, 0, (x * 2), 0.7)); txtLiabHdr.Text.Value = "Liabilities"; txtLiabHdr.Font = new Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtLiabHdr.HorAlignment = StiTextHorAlignment.Center; txtLiabHdr.VertAlignment = StiVertAlignment.Center; txtLiabHdr.Name = "HeaderTextL"; txtLiabHdr.Border.Side = StiBorderSides.All; txtLiabHdr.ShrinkFontToFit = true; dbinhbLiab.Components.Add(txtLiabHdr); // Add Group Header band for primary accounts StiGroupHeaderBand ghbLiabPrim = new StiGroupHeaderBand();//new RectangleD(0, 1, LiabRep.PageWidth, 1)); ghbLiabPrim.Height = 0.3; ghbLiabPrim.Condition.Value = "{dtBSLiabs.PrimOrder}"; ghbLiabPrim.SortDirection = StiGroupSortDirection.Ascending; LiabRep.Components.Add(ghbLiabPrim); //Panel in primary group header band StiPanel pngrLiabPrim = new StiPanel(new RectangleD(0, 0, LiabRep.PageWidth,0.3)); ghbLiabPrim.Components.Add(pngrLiabPrim); // Databand in primary group header band StiDataBand dbgrhdrLiabPrim = new StiDataBand(); dbgrhdrLiabPrim.Height = 0.3; pngrLiabPrim.Components.Add(dbgrhdrLiabPrim); StiText txtLiabPrimAccts = new StiText(new RectangleD(0.05, 0, (x * 2), 0.3)); txtLiabPrimAccts.Text.Value = "{dtBSLiabs.PrimAcctHead}"; txtLiabPrimAccts.Border.Side = StiBorderSides.None; txtLiabPrimAccts.Type = StiSystemTextType.DataColumn; txtLiabPrimAccts.WordWrap = true; txtLiabPrimAccts.ShrinkFontToFit = true; txtLiabPrimAccts.HorAlignment = StiTextHorAlignment.Left; txtLiabPrimAccts.VertAlignment = StiVertAlignment.Center; dbgrhdrLiabPrim.Components.Add(txtLiabPrimAccts); // If the primary account head is 'Bank accounts', then display it as 'Bank account - overdraft' StiCondition cndLiabPrimAcct = new StiCondition(); cndLiabPrimAcct.Item = StiFilterItem.Expression; cndLiabPrimAcct.TextColor = Color.Black; cndLiabPrimAcct.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular); cndLiabPrimAcct.Expression = new StiExpression("dtBSLiabs.PrimAcctHead == " + @"""Bank Accounts"""); cndLiabPrimAcct.CanAssignExpression = true; cndLiabPrimAcct.AssignExpression = @"""Bank Accounts - Overdraft"""; cndLiabPrimAcct.Enabled = true; txtLiabPrimAccts.Conditions.Add(cndLiabPrimAcct); // Add group header band for secondary account heads StiGroupHeaderBand ghbLiabSec = new StiGroupHeaderBand(); ghbLiabSec.Height = 0.0; ghbLiabSec.Condition.Value = "{dtBSLiabs.AcctHead}"; ghbLiabSec.SortDirection = StiGroupSortDirection.Ascending; ghbLiabSec.CanGrow = true; ghbLiabSec.Enabled = true; ghbLiabSec.KeepGroupHeaderTogether = true; ghbLiabSec.KeepGroupTogether = true; LiabRep.Components.Add(ghbLiabSec); //Panel in secondary group header band StiPanel pngrLiabSec = new StiPanel(new RectangleD(0, 0, LiabRep.PageWidth, 0.3)); ghbLiabSec.Components.Add(pngrLiabSec); // Databand in secondary group header band StiDataBand dbgrhdrLiabSec = new StiDataBand(); dbgrhdrLiabSec.Height = 0.3; pngrLiabSec.Components.Add(dbgrhdrLiabSec); StiText txtLiabSecAccts = new StiText(new RectangleD(gap, 0, (x * 2) - gap, 0.3)); txtLiabSecAccts.Text.Value = "{dtBSLiabs.AcctHead}"; txtLiabSecAccts.HorAlignment = StiTextHorAlignment.Left; txtLiabSecAccts.VertAlignment = StiVertAlignment.Center; txtLiabSecAccts.Border.Side = StiBorderSides.None; txtLiabSecAccts.Type = StiSystemTextType.DataColumn; txtLiabSecAccts.WordWrap = true; txtLiabSecAccts.ShrinkFontToFit = true; dbgrhdrLiabSec.Components.Add(txtLiabSecAccts); // If the secondary account head is 'Bank accounts', then display it as 'Bank account - overdraft' StiCondition cndgdbLiabsec1 = new StiCondition(); cndgdbLiabsec1.Item = StiFilterItem.Expression; cndgdbLiabsec1.TextColor = Color.Black; cndgdbLiabsec1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular); cndgdbLiabsec1.Expression = new StiExpression("dtBSLiabs.AcctHead == " + @"""Bank Accounts"""); cndgdbLiabsec1.CanAssignExpression = true; cndgdbLiabsec1.AssignExpression = @"""Bank Accounts - Overdraft"""; cndgdbLiabsec1.Enabled = true; txtLiabSecAccts.Conditions.Add(cndgdbLiabsec1); // If the primary account head and secondary account heads are same, then disable the secondary group header band StiCondition cndgdbLiabsec2 = new StiCondition(); cndgdbLiabsec2.Item = StiFilterItem.Value; cndgdbLiabsec2.DataType = StiFilterDataType.Expression; cndgdbLiabsec2.Column = "dtBSLiabs.PrimAcctHead"; cndgdbLiabsec2.Condition = StiFilterCondition.EqualTo; cndgdbLiabsec2.Value1 = "dtBSLiabs.AcctHead"; cndgdbLiabsec2.Enabled = false; ghbLiabSec.Conditions.Add(cndgdbLiabsec2); //Add databand for Chart of Accounts StiDataBand dbLiabAccts = new StiDataBand();//new RectangleD(0, 3, LiabRep.PageWidth, 0.8)); ; dbLiabAccts.DataSourceName = "dtBSLiabs"; dbLiabAccts.Height = 0.3; dbLiabAccts.Sort = new System.String[] { "ASC", "CompAccName" }; LiabRep.Components.Add(dbLiabAccts); StiText txtLiabAccts = new StiText(new RectangleD(gap * 2, 0, (x * 2) - (gap * 2), 0.4)); txtLiabAccts.Text.Value = "{dtBSLiabs.CompAccName}"; txtLiabAccts.HorAlignment = StiTextHorAlignment.Left; txtLiabAccts.VertAlignment = StiVertAlignment.Center; txtLiabAccts.Border.Side = StiBorderSides.None; txtLiabAccts.Type = StiSystemTextType.DataColumn; txtLiabAccts.WordWrap = true; txtLiabAccts.ShrinkFontToFit = true; dbLiabAccts.Components.Add(txtLiabAccts); // Add footer band to display 'Difference in Opening balance' StiFooterBand fbLiab = new StiFooterBand(); fbLiab.Height = 0.4; fbLiab.Enabled = false; fbLiab.Printable = true; fbLiab.PrintIfEmpty = true; LiabRep.Components.Add(fbLiab); // Panel in footer band StiPanel pnfbLiab = new StiPanel(new RectangleD(0, 0, LiabRep.PageWidth, 0.4)); fbLiab.Components.Add(pnfbLiab); StiText txtDiffOpBalLiab = new StiText(new RectangleD(0.05, 0, x, 0.4)); txtDiffOpBalLiab.Text.Value = "Difference in Opening Balance"; txtDiffOpBalLiab.WordWrap = true; txtDiffOpBalLiab.ShrinkFontToFit = true; pnfbLiab.Components.Add(txtDiffOpBalLiab); //------------------------------------------------------ Assets --------------------------------------------------// //Create Databand for header band in Assets sub report StiDataBand dbinhbAsset = new StiDataBand(new RectangleD(0, 0, AssetRep.PageWidth, 0.8)); dbinhbAsset.Height = 0.8; dbinhbAsset.Name = "AssetHeaderDataBand"; dbinhbAsset.PrintOnAllPages = true; AssetRep.Components.Add(dbinhbAsset); // "Assets" header StiText txtAssetHdr = new StiText(new RectangleD(pos, 0, (x * 2), 0.7)); txtAssetHdr.Text.Value = "Assets"; txtAssetHdr.Font = new Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtAssetHdr.HorAlignment = StiTextHorAlignment.Center; txtAssetHdr.VertAlignment = StiVertAlignment.Center; txtAssetHdr.Name = "HeaderTextA"; txtAssetHdr.Border.Side = StiBorderSides.All; txtAssetHdr.ShrinkFontToFit = true; dbinhbAsset.Components.Add(txtAssetHdr); // Add Group Header band for primary accounts StiGroupHeaderBand ghbAssetPrim = new StiGroupHeaderBand(); ghbAssetPrim.Height = 0.3; ghbAssetPrim.Condition.Value = "{dtBSAssets.PrimOrder}"; ghbAssetPrim.SortDirection = StiGroupSortDirection.Ascending; AssetRep.Components.Add(ghbAssetPrim); //Panel in primary group header band StiPanel pngrAssetPrim = new StiPanel(new RectangleD(0, 0, AssetRep.PageWidth, 0.3)); ghbAssetPrim.Components.Add(pngrAssetPrim); // Databand in primary group header band StiDataBand dbgrhdrAssetPrim = new StiDataBand(); dbgrhdrAssetPrim.Height = 0.3; pngrAssetPrim.Components.Add(dbgrhdrAssetPrim); StiText txtAssetPrimAccts = new StiText(new RectangleD(0.05, 0, (x * 2), 0.3)); txtAssetPrimAccts.Text.Value = "{dtBSAssets.PrimAcctHead}"; txtAssetPrimAccts.HorAlignment = StiTextHorAlignment.Left; txtAssetPrimAccts.VertAlignment = StiVertAlignment.Center; txtAssetPrimAccts.Border.Side = StiBorderSides.None; txtAssetPrimAccts.Type = StiSystemTextType.DataColumn; txtAssetPrimAccts.WordWrap = true; txtAssetPrimAccts.ShrinkFontToFit = true; dbgrhdrAssetPrim.Components.Add(txtAssetPrimAccts); // Add group header band for secondary account heads StiGroupHeaderBand ghbAssetSec = new StiGroupHeaderBand(); ghbAssetSec.Height = 0.0; ghbAssetSec.Condition.Value = "{dtBSAssets.AcctHead}"; ghbAssetSec.SortDirection = StiGroupSortDirection.Ascending; ghbAssetSec.CanGrow = true; ghbAssetSec.Enabled = true; ghbAssetSec.KeepGroupHeaderTogether = true; ghbAssetSec.KeepGroupTogether = true; AssetRep.Components.Add(ghbAssetSec); //Panel in secondary group header band StiPanel pngrAssetSec = new StiPanel(new RectangleD(0, 0, AssetRep.PageWidth, 0.3)); ghbAssetSec.Components.Add(pngrAssetSec); // Databand in secondary group header band StiDataBand dbgrhdrAssetSec = new StiDataBand(); dbgrhdrAssetSec.Height = 0.3; pngrAssetSec.Components.Add(dbgrhdrAssetSec); StiText txtAssetSecAccts = new StiText(new RectangleD(gap, 0, (x * 2) - gap, 0.3)); txtAssetSecAccts.Text.Value = "{dtBSAssets.AcctHead}"; txtAssetSecAccts.HorAlignment = StiTextHorAlignment.Left; txtAssetSecAccts.VertAlignment = StiVertAlignment.Center; txtAssetSecAccts.Border.Side = StiBorderSides.None; txtAssetSecAccts.Type = StiSystemTextType.DataColumn; txtAssetSecAccts.WordWrap = true; txtAssetSecAccts.ShrinkFontToFit = true; dbgrhdrAssetSec.Components.Add(txtAssetSecAccts); // If the primary account head and secondary account heads are same, then disable the secondary group header band StiCondition cndgdbAssetsec = new StiCondition(); cndgdbAssetsec.Item = StiFilterItem.Value; cndgdbAssetsec.DataType = StiFilterDataType.Expression; cndgdbAssetsec.Column = "dtBSAssets.PrimAcctHead"; cndgdbAssetsec.Condition = StiFilterCondition.EqualTo; cndgdbAssetsec.Value1 = "dtBSAssets.AcctHead"; cndgdbAssetsec.Enabled = false; ghbAssetSec.Conditions.Add(cndgdbAssetsec); //Add databand for Chart of Accounts StiDataBand dbAssetAccts = new StiDataBand(); dbAssetAccts.DataSourceName = "dtBSAssets"; dbAssetAccts.Height = 0.3; dbAssetAccts.Sort = new System.String[] { "ASC", "CompAccName" }; AssetRep.Components.Add(dbAssetAccts); StiText txtAssetAccts = new StiText(new RectangleD(gap * 2, 0, (x * 2) - (gap * 2), 0.4)); txtAssetAccts.Text.Value = "{dtBSAssets.CompAccName}"; txtAssetAccts.HorAlignment = StiTextHorAlignment.Left; txtAssetAccts.VertAlignment = StiVertAlignment.Center; txtAssetAccts.Border.Side = StiBorderSides.None; txtAssetAccts.Type = StiSystemTextType.DataColumn; txtAssetAccts.WordWrap = true; txtAssetAccts.ShrinkFontToFit = true; dbAssetAccts.Components.Add(txtAssetAccts); // Add footer band to display 'Difference in Opening balance' StiFooterBand fbAsset = new StiFooterBand(); fbAsset.Height = 0.4; fbAsset.Enabled = false; fbAsset.Printable = true; fbAsset.PrintIfEmpty = true; AssetRep.Components.Add(fbAsset); // Panel in footer band StiPanel pnfbAsset = new StiPanel(new RectangleD(0, 0, AssetRep.PageWidth, 0.4)); fbAsset.Components.Add(pnfbAsset); StiText txtDiffOpBalAsset = new StiText(new RectangleD(0.05, 0, x, 0.4)); txtDiffOpBalAsset.Text.Value = "Difference in Opening Balance"; txtDiffOpBalAsset.WordWrap = true; txtDiffOpBalAsset.ShrinkFontToFit = true; pnfbAsset.Components.Add(txtDiffOpBalAsset); // Set the starting point for the PC headers pos = pos + (x * 2); foreach (DataRow drUserPC in dtUserPC.Rows) { // ------------------------------------- Liabilities ------------------------------------------ // // Header with PC Num and name StiText txtLiabPChdr = new StiText(new RectangleD(pos, 0, x, 0.7)); txtLiabPChdr.Text.Value = drUserPC["ProfitCenter"].ToString() + System.Environment.NewLine + "Amt in Rs."; txtLiabPChdr.Font = new Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtLiabPChdr.HorAlignment = StiTextHorAlignment.Center; txtLiabPChdr.VertAlignment = StiVertAlignment.Center; txtLiabPChdr.WordWrap = true; txtLiabPChdr.Border.Side = StiBorderSides.All; txtLiabPChdr.ShrinkFontToFit = true; dbinhbLiab.Components.Add(txtLiabPChdr); // Amount fields for Primary account head StiText txtLiabPCPrimAmt1 = new StiText(new RectangleD(pos, 0, columnWidth, 0.3)); txtLiabPCPrimAmt1.HorAlignment = StiTextHorAlignment.Right; txtLiabPCPrimAmt1.VertAlignment = StiVertAlignment.Center; txtLiabPCPrimAmt1.Border.Side = StiBorderSides.None; dbgrhdrLiabPrim.Components.Add(txtLiabPCPrimAmt1); StiText txtLiabPCPrimAmt2 = new StiText(new RectangleD(pos + columnWidth, 0, columnWidth, 0.3)); txtLiabPCPrimAmt2.HorAlignment = StiTextHorAlignment.Right; txtLiabPCPrimAmt2.VertAlignment = StiVertAlignment.Center; txtLiabPCPrimAmt2.Border.Side = StiBorderSides.None; txtLiabPCPrimAmt2.Text.Value = new StiExpression("{Totals.Sum(" + ghbLiabPrim.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")}"); txtLiabPCPrimAmt2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtLiabPCPrimAmt2.ShrinkFontToFit = true; txtLiabPCPrimAmt2.WordWrap= true; dbgrhdrLiabPrim.Components.Add(txtLiabPCPrimAmt2); // If the amount is negative, then display in brackets and in red colour StiCondition cndLiabPrimAmt = new StiCondition(); cndLiabPrimAmt.Item = StiFilterItem.Expression; cndLiabPrimAmt.TextColor = Color.Red; cndLiabPrimAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndLiabPrimAmt.Expression = new StiExpression("Totals.Sum(" + ghbLiabPrim.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") < 0"); cndLiabPrimAmt.Enabled = true; cndLiabPrimAmt.CanAssignExpression = true; cndLiabPrimAmt.AssignExpression = "\"(\" + " + "Totals.Sum(" + ghbLiabPrim.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") * -1 + \")\""; txtLiabPCPrimAmt2.Conditions.Add(cndLiabPrimAmt); // Amount field for secondary account head StiText txtLiabPCSecAmt = new StiText(new RectangleD(pos, 0, columnWidth, 0.3)); txtLiabPCSecAmt.HorAlignment = StiTextHorAlignment.Right; txtLiabPCSecAmt.VertAlignment = StiVertAlignment.Center; txtLiabPCSecAmt.Border.Side = StiBorderSides.None; txtLiabPCSecAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Underline); txtLiabPCSecAmt.Text.Value = new StiExpression("{Totals.Sum(" + ghbLiabSec.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")}"); txtLiabPCSecAmt.ShrinkFontToFit = true; txtLiabPCSecAmt.WordWrap = true; dbgrhdrLiabSec.Components.Add(txtLiabPCSecAmt); // If the amount is negative, then display in brackets and in red colour StiCondition cndLiabSecAmt = new StiCondition(); cndLiabSecAmt.Item = StiFilterItem.Expression; cndLiabSecAmt.TextColor = Color.Red; cndLiabSecAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Underline); cndLiabSecAmt.Expression = new StiExpression("Totals.Sum(" + ghbLiabSec.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") < 0"); cndLiabSecAmt.Enabled = true; cndLiabSecAmt.CanAssignExpression = true; cndLiabSecAmt.AssignExpression = "\"(\" + " + "Totals.Sum(" + ghbLiabSec.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") * -1 + \")\""; txtLiabPCSecAmt.Conditions.Add(cndLiabSecAmt); // Amount field for each chart of account StiText txtLiabAcctAmt = new StiText(new RectangleD(pos, 0, columnWidth, 0.4)); txtLiabAcctAmt.HorAlignment = StiTextHorAlignment.Right; txtLiabAcctAmt.VertAlignment = StiVertAlignment.Center; txtLiabAcctAmt.Border.Side = StiBorderSides.None; txtLiabAcctAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular); txtLiabAcctAmt.Text.Value = "{dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + "}"; txtLiabAcctAmt.Type = StiSystemTextType.DataColumn; txtLiabAcctAmt.ShrinkFontToFit = true; txtLiabAcctAmt.WordWrap = true; dbLiabAccts.Components.Add(txtLiabAcctAmt); // If the amount is negative, then display in brackets and in red colour StiCondition cndLiabAcctAmt = new StiCondition(); cndLiabAcctAmt.Item = StiFilterItem.Value; cndLiabAcctAmt.DataType = StiFilterDataType.Numeric; cndLiabAcctAmt.TextColor = Color.Red; cndLiabAcctAmt.Column = "dtBSLiabs.n" + drUserPC["PC_Num"].ToString(); cndLiabAcctAmt.Condition = StiFilterCondition.LessThan; cndLiabAcctAmt.Value1 = "0"; cndLiabAcctAmt.Enabled = true; cndLiabAcctAmt.CanAssignExpression = true; cndLiabAcctAmt.AssignExpression = "\"(\" + " + "(dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + " * -1)" + " + \")\""; txtLiabAcctAmt.Conditions.Add(cndLiabAcctAmt); // If the sum of all the PC transactions on the Assets side accounts is greater than that on the Liabilities side accounts, then enable the Liability footer band StiCondition cndfbLiab = new StiCondition(); cndfbLiab.Item = StiFilterItem.Expression; cndfbLiab.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) > (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + "))"); cndfbLiab.Enabled = true; fbLiab.Conditions.Add(cndfbLiab); // Field to display the difference in opening balance in the footer band StiText txtfbLiab = new StiText(new RectangleD(pos, 0, x, 0.4)); txtfbLiab.Enabled = false; txtfbLiab.Printable = true; txtfbLiab.ShrinkFontToFit = true; txtfbLiab.WordWrap = true; txtfbLiab.HorAlignment = StiTextHorAlignment.Right; txtfbLiab.VertAlignment = StiVertAlignment.Center; pnfbLiab.Components.Add(txtfbLiab); // The difference in opening balance amount is displayed only if there is a difference in the respective PC amounts on the assets and liabilities side, and if the asset side amount is greater // than the liability side amount // If the difference for the respective PCs is greater than zero, then display the difference StiCondition cndLiabDiffInOB1 = new StiCondition(); cndLiabDiffInOB1.Item = StiFilterItem.Expression; cndLiabDiffInOB1.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) > (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && (Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") - Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) > 0"); cndLiabDiffInOB1.TextColor = Color.Black; cndLiabDiffInOB1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular); cndLiabDiffInOB1.Enabled = true; cndLiabDiffInOB1.CanAssignExpression = true; cndLiabDiffInOB1.AssignExpression = "Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") - Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")"; txtfbLiab.Conditions.Add(cndLiabDiffInOB1); // If the difference for the respective PCs is lesser than zero, then display the difference in brackets and in red colour StiCondition cndLiabDiffInOB2 = new StiCondition(); cndLiabDiffInOB2.Item = StiFilterItem.Expression; cndLiabDiffInOB2.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) > (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && (Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") - Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) < 0"); cndLiabDiffInOB2.TextColor = Color.Red; cndLiabDiffInOB2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular); cndLiabDiffInOB2.Enabled = true; cndLiabDiffInOB2.CanAssignExpression = true; cndLiabDiffInOB2.AssignExpression = "\"(\" + " + "(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") - Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") * -1)" + " + \")\""; txtfbLiab.Conditions.Add(cndLiabDiffInOB2); //---------------------------------------------- Assets -------------------------------------------------// // Header with PC Num and name StiText txtAssetPChdr = new StiText(new RectangleD(pos, 0, x, 0.7)); txtAssetPChdr.Text.Value = drUserPC["ProfitCenter"].ToString() + System.Environment.NewLine + "Amt in Rs."; txtAssetPChdr.Font = new Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtAssetPChdr.HorAlignment = StiTextHorAlignment.Center; txtAssetPChdr.VertAlignment = StiVertAlignment.Center; txtAssetPChdr.WordWrap = true; txtAssetPChdr.Border.Side = StiBorderSides.All; txtAssetPChdr.ShrinkFontToFit = true; dbinhbAsset.Components.Add(txtAssetPChdr); // Amount fields for Primary account head StiText txtAssetPCPrimAmt1 = new StiText(new RectangleD(pos, 0, columnWidth, 0.3)); txtAssetPCPrimAmt1.HorAlignment = StiTextHorAlignment.Right; txtAssetPCPrimAmt1.VertAlignment = StiVertAlignment.Center; txtAssetPCPrimAmt1.Border.Side = StiBorderSides.None; dbgrhdrAssetPrim.Components.Add(txtAssetPCPrimAmt1); StiText txtAssetPCPrimAmt2 = new StiText(new RectangleD(pos + columnWidth, 0, columnWidth, 0.3)); txtAssetPCPrimAmt2.HorAlignment = StiTextHorAlignment.Right; txtAssetPCPrimAmt2.VertAlignment = StiVertAlignment.Center; txtAssetPCPrimAmt2.Border.Side = StiBorderSides.None; txtAssetPCPrimAmt2.Text.Value = new StiExpression("{Totals.Sum(" + ghbAssetPrim.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")}"); txtAssetPCPrimAmt2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtAssetPCPrimAmt2.ShrinkFontToFit = true; txtAssetPCPrimAmt2.WordWrap = true; dbgrhdrAssetPrim.Components.Add(txtAssetPCPrimAmt2); // If the amount is negative, then display in brackets and in red colour StiCondition cndAssetPrimAmt = new StiCondition(); cndAssetPrimAmt.Item = StiFilterItem.Expression; cndAssetPrimAmt.TextColor = Color.Red; cndAssetPrimAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndAssetPrimAmt.Expression = new StiExpression("Totals.Sum(" + ghbAssetPrim.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") < 0"); cndAssetPrimAmt.Enabled = true; cndAssetPrimAmt.CanAssignExpression = true; cndAssetPrimAmt.AssignExpression = "\"(\" + " + "Totals.Sum(" + ghbAssetPrim.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") * -1 + \")\""; txtAssetPCPrimAmt2.Conditions.Add(cndAssetPrimAmt); // Amount field for secondary account head StiText txtAssetPCSecAmt = new StiText(new RectangleD(pos, 0, columnWidth, 0.3)); txtAssetPCSecAmt.HorAlignment = StiTextHorAlignment.Right; txtAssetPCSecAmt.VertAlignment = StiVertAlignment.Center; txtAssetPCSecAmt.Border.Side = StiBorderSides.None; txtAssetPCSecAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Underline); txtAssetPCSecAmt.Text.Value = new StiExpression("{Totals.Sum(" + ghbAssetSec.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")}"); txtAssetPCSecAmt.ShrinkFontToFit = true; txtAssetPCSecAmt.WordWrap = true; dbgrhdrAssetSec.Components.Add(txtAssetPCSecAmt); // If the amount is negative, then display in brackets and in red colour StiCondition cndAssetSecAmt = new StiCondition(); cndAssetSecAmt.Item = StiFilterItem.Expression; cndAssetSecAmt.TextColor = Color.Red; cndAssetSecAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Underline); cndAssetSecAmt.Expression = new StiExpression("Totals.Sum(" + ghbAssetSec.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") < 0"); cndAssetSecAmt.Enabled = true; cndAssetSecAmt.CanAssignExpression = true; cndAssetSecAmt.AssignExpression = "\"(\" + " + "Totals.Sum(" + ghbAssetSec.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") * -1 + \")\""; txtAssetPCSecAmt.Conditions.Add(cndAssetSecAmt); // Amount field for each chart of account StiText txtAssetAcctAmt = new StiText(new RectangleD(pos, 0, columnWidth, 0.4)); txtAssetAcctAmt.HorAlignment = StiTextHorAlignment.Right; txtAssetAcctAmt.VertAlignment = StiVertAlignment.Center; txtAssetAcctAmt.Border.Side = StiBorderSides.None; txtAssetAcctAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular); txtAssetAcctAmt.Text.Value = "{dtBSAssets.n" + drUserPC["PC_Num"].ToString() + "}"; txtAssetAcctAmt.Type = StiSystemTextType.DataColumn; txtAssetAcctAmt.WordWrap = true; txtAssetAcctAmt.ShrinkFontToFit = true; dbAssetAccts.Components.Add(txtAssetAcctAmt); // If the amount is negative, then display in brackets and in red colour StiCondition cndAssetAcctAmt = new StiCondition(); cndAssetAcctAmt.Item = StiFilterItem.Value; cndAssetAcctAmt.DataType = StiFilterDataType.Numeric; cndAssetAcctAmt.TextColor = Color.Red; cndAssetAcctAmt.Column = "dtBSAssets.n" + drUserPC["PC_Num"].ToString(); cndAssetAcctAmt.Condition = StiFilterCondition.LessThan; cndAssetAcctAmt.Value1 = "0"; cndAssetAcctAmt.Enabled = true; cndAssetAcctAmt.CanAssignExpression = true; cndAssetAcctAmt.AssignExpression = "\"(\" + " + "(dtBSAssets.n" + drUserPC["PC_Num"].ToString() + " * -1)" + " + \")\""; txtAssetAcctAmt.Conditions.Add(cndAssetAcctAmt); // If the sum of all the PC transactions on the Liabilities side accounts is greater than that on the Assets side account, then enable the Asset footer band StiCondition cndfbAsset = new StiCondition(); cndfbAsset.Item = StiFilterItem.Expression; cndfbAsset.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) < (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + "))"); cndfbAsset.Enabled = true; fbAsset.Conditions.Add(cndfbAsset); // Field to display the difference in opening balance in the footer band StiText txtfbAsset = new StiText(new RectangleD(pos, 0, x, 0.4)); txtfbAsset.Enabled = false; txtfbAsset.Printable = true; txtfbAsset.ShrinkFontToFit = true; txtfbAsset.WordWrap = true; txtfbAsset.HorAlignment = StiTextHorAlignment.Right; txtfbAsset.VertAlignment = StiVertAlignment.Center; pnfbAsset.Components.Add(txtfbAsset); // The difference in opening balance amount is displayed only if there is a difference in the respective PC amounts on the assets and liabilities side, and if the liability side amount is greater // than the asset side amount // If the difference is greater than zero, then display the difference StiCondition cndAssetDiffInOB1 = new StiCondition(); cndAssetDiffInOB1.Item = StiFilterItem.Expression; cndAssetDiffInOB1.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) < (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") - Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) > 0"); cndAssetDiffInOB1.TextColor = Color.Black; cndAssetDiffInOB1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular); cndAssetDiffInOB1.Enabled = true; cndAssetDiffInOB1.CanAssignExpression = true; cndAssetDiffInOB1.AssignExpression = "Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") - Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")"; txtfbAsset.Conditions.Add(cndAssetDiffInOB1); // If the difference is lesser than zero, then display the difference in brackets and in red colour StiCondition cndAssetDiffInOB2 = new StiCondition(); cndAssetDiffInOB2.Item = StiFilterItem.Expression; cndAssetDiffInOB2.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) < (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") - Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) < 0"); cndAssetDiffInOB2.TextColor = Color.Red; cndAssetDiffInOB2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular); cndAssetDiffInOB2.Enabled = true; cndAssetDiffInOB2.CanAssignExpression = true; cndAssetDiffInOB2.AssignExpression = "\"(\" + " + "(Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") - Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") * -1)" + " + \")\""; txtfbAsset.Conditions.Add(cndAssetDiffInOB2); pos = pos + x; } // Report summary band StiReportSummaryBand rsbReportSummary = new StiReportSummaryBand(); rsbReportSummary.Height = 0.4; rsbReportSummary.CanGrow = true; rsbReportSummary.Enabled = true; rsbReportSummary.KeepReportSummaryTogether = true; rsbReportSummary.PrintIfEmpty = true; rsbReportSummary.Printable = true; MainRepPage.Components.Add(rsbReportSummary); // Panel in report summary band for Liabilities StiPanel pnrsbLiab = new StiPanel(new RectangleD(0, 0, LiabRep.PageWidth, 0.4)); rsbReportSummary.Components.Add(pnrsbLiab); // Total on Liabilities side StiText txtrsbLiabTtl = new StiText(new RectangleD(0, 0, (x * 2), 0.7)); txtrsbLiabTtl.Text.Value = "Total"; txtrsbLiabTtl.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtrsbLiabTtl.HorAlignment = StiTextHorAlignment.Center; txtrsbLiabTtl.VertAlignment = StiVertAlignment.Center; txtrsbLiabTtl.Border.Side = StiBorderSides.All; txtrsbLiabTtl.WordWrap = true; txtrsbLiabTtl.ShrinkFontToFit = true; txtrsbLiabTtl.CanGrow = true; txtrsbLiabTtl.Enabled = true; txtrsbLiabTtl.Printable = true; pnrsbLiab.Components.Add(txtrsbLiabTtl); // Panel in report summary band for Assets StiPanel pnrsbAsset = new StiPanel(new RectangleD(AssetL, 0, AssetRep.PageWidth, 0.4)); rsbReportSummary.Components.Add(pnrsbAsset); // Total on Assets side StiText txtrsbAssetTtl = new StiText(new RectangleD(0, 0, (x * 2), 0.7)); txtrsbAssetTtl.Text.Value = "Total"; txtrsbAssetTtl.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtrsbAssetTtl.HorAlignment = StiTextHorAlignment.Center; txtrsbAssetTtl.VertAlignment = StiVertAlignment.Center; txtrsbAssetTtl.Border.Side = StiBorderSides.All; txtrsbAssetTtl.WordWrap = true; txtrsbAssetTtl.ShrinkFontToFit = true; txtrsbAssetTtl.Printable = true; pnrsbAsset.Components.Add(txtrsbAssetTtl); pos = x * 2; foreach (DataRow drUserPC in dtUserPC.Rows) { // ------------------------------------- Liabilities ------------------------------------------ // // Total is the sum total of all the PC transactions for the Liabilities side accounts StiText txtLiabPCTotAmt = new StiText(new RectangleD(pos, 0, x , 0.7)); //txtLiabPCTotAmt.Text.Value = new StiExpression("{Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")}"); //txtLiabPCTotAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtLiabPCTotAmt.HorAlignment = StiTextHorAlignment.Right; txtLiabPCTotAmt.VertAlignment = StiVertAlignment.Center; txtLiabPCTotAmt.ShrinkFontToFit = true; txtLiabPCTotAmt.Border.Side = StiBorderSides.All; txtLiabPCTotAmt.WordWrap= true; pnrsbLiab.Components.Add(txtLiabPCTotAmt); // If the sum of all the PC transactions on the Liabilities side accounts is greater than that on the Assets side accounts and if the sum of all transactions on the Liabilities side accounts is greater than zero, then display the sum of all transactions on the Liabilities side accounts StiCondition cndLiabTotPCAmt1 = new StiCondition(); cndLiabTotPCAmt1.Item = StiFilterItem.Expression; cndLiabTotPCAmt1.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) < (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") >= 0"); cndLiabTotPCAmt1.TextColor = Color.Black; cndLiabTotPCAmt1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndLiabTotPCAmt1.Enabled = true; cndLiabTotPCAmt1.CanAssignExpression = true; cndLiabTotPCAmt1.AssignExpression = "Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")"; txtLiabPCTotAmt.Conditions.Add(cndLiabTotPCAmt1); // If the sum of all the PC transactions on the Liabilities side accounts is greater than that on the Assets side accounts and if the sum of all transactions on the Liabilities side accounts is less than zero, then display the sum of all transactions on the Liabilities side accounts in red colour and in brackets StiCondition cndLiabTotPCAmt2 = new StiCondition(); cndLiabTotPCAmt2.Item = StiFilterItem.Expression; cndLiabTotPCAmt2.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) < (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") < 0"); cndLiabTotPCAmt2.TextColor = Color.Red; cndLiabTotPCAmt2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndLiabTotPCAmt2.Enabled = true; cndLiabTotPCAmt2.CanAssignExpression = true; cndLiabTotPCAmt2.AssignExpression = "\"(\" + " + "(Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") * -1)" + " + \")\""; txtLiabPCTotAmt.Conditions.Add(cndLiabTotPCAmt2); // If the sum of all the PC transactions on the Assets side accounts is greater than that on the Liabilities side accounts and if the sum of all transactions on the Assets side accounts is greater than zero, then display the sum of all transactions on the Assets side accounts StiCondition cndLiabTotPCAmt3 = new StiCondition(); cndLiabTotPCAmt3.Item = StiFilterItem.Expression; cndLiabTotPCAmt3.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) > (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") >= 0"); cndLiabTotPCAmt3.TextColor = Color.Black; cndLiabTotPCAmt3.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndLiabTotPCAmt3.Enabled = true; cndLiabTotPCAmt3.CanAssignExpression = true; cndLiabTotPCAmt3.AssignExpression = "Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")"; txtLiabPCTotAmt.Conditions.Add(cndLiabTotPCAmt3); // If the sum of all the PC transactions on the Assets side accounts is greater than that on the Liabilities side accounts and if the sum of all transactions on the Assets side accounts is less than zero, then display the sum of all transactions on the Assets side accounts in red colour and in brackets StiCondition cndLiabTotPCAmt4 = new StiCondition(); cndLiabTotPCAmt4.Item = StiFilterItem.Expression; cndLiabTotPCAmt4.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) > (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") < 0"); cndLiabTotPCAmt4.TextColor = Color.Red; cndLiabTotPCAmt4.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndLiabTotPCAmt4.Enabled = true; cndLiabTotPCAmt4.CanAssignExpression = true; cndLiabTotPCAmt4.AssignExpression = "\"(\" + " + "(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") * -1)" + " + \")\""; txtLiabPCTotAmt.Conditions.Add(cndLiabTotPCAmt4); //---------------------------------------------- Assets -------------------------------------------------// // Total is the sum total of all the PC transactions for the Assets side accounts StiText txtAssetPCTotAmt = new StiText(new RectangleD(pos, 0, x , 0.7)); //txtAssetPCTotAmt.Text.Value = new StiExpression("{Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")}"); //txtAssetPCTotAmt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); txtAssetPCTotAmt.HorAlignment = StiTextHorAlignment.Right; txtAssetPCTotAmt.VertAlignment = StiVertAlignment.Center; txtAssetPCTotAmt.ShrinkFontToFit = true; txtAssetPCTotAmt.Border.Side = StiBorderSides.All; txtAssetPCTotAmt.WordWrap = true; pnrsbAsset.Components.Add(txtAssetPCTotAmt); // If the sum of all the PC transactions on the Assets side accounts is greater than that on the Liabilities side account, and if the sum of all transactions on the Assets side accounts is greater than zero, then display the sum of all transactions on the Assets side accounts StiCondition cndAssetTotPCAmt1 = new StiCondition(); cndAssetTotPCAmt1.Item = StiFilterItem.Expression; cndAssetTotPCAmt1.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) > (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") >= 0"); cndAssetTotPCAmt1.TextColor = Color.Black; cndAssetTotPCAmt1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndAssetTotPCAmt1.Enabled = true; cndAssetTotPCAmt1.CanAssignExpression = true; cndAssetTotPCAmt1.AssignExpression = "Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")"; txtAssetPCTotAmt.Conditions.Add(cndAssetTotPCAmt1); // If the sum of all the PC transactions on the Assets side accounts is greater than that on the Liabilities side account, and if the sum of all transactions on the Assets side accounts is lesser than zero, then display the sum of all transactions on the Assets side accounts in brackets and in red colour StiCondition cndAssetTotPCAmt2 = new StiCondition(); cndAssetTotPCAmt2.Item = StiFilterItem.Expression; cndAssetTotPCAmt2.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) > (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") < 0"); cndAssetTotPCAmt2.TextColor = Color.Black; cndAssetTotPCAmt2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndAssetTotPCAmt2.Enabled = true; cndAssetTotPCAmt2.CanAssignExpression = true; cndAssetTotPCAmt2.AssignExpression = "\"(\" + " + "(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ") * -1)" + " + \")\""; txtAssetPCTotAmt.Conditions.Add(cndAssetTotPCAmt2); // If the sum of all the PC transactions on the Liabilities side accounts is greater than that on the Assets side account, and if the sum of all transactions on the Liabilities side accounts is greater than zero, then display the sum of all transactions on the Liabilities side accounts StiCondition cndAssetTotPCAmt3 = new StiCondition(); cndAssetTotPCAmt3.Item = StiFilterItem.Expression; cndAssetTotPCAmt3.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) < (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") >= 0"); cndAssetTotPCAmt3.TextColor = Color.Black; cndAssetTotPCAmt3.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndAssetTotPCAmt3.Enabled = true; cndAssetTotPCAmt3.CanAssignExpression = true; cndAssetTotPCAmt3.AssignExpression = "Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")"; txtAssetPCTotAmt.Conditions.Add(cndAssetTotPCAmt3); // If the sum of all the PC transactions on the Liabilities side accounts is greater than that on the Assets side account, and if the sum of all transactions on the Liabilities side accounts is lesser than zero, then display the sum of all transactions on the Liabilities side accounts in brackets and in red colour StiCondition cndAssetTotPCAmt4 = new StiCondition(); cndAssetTotPCAmt4.Item = StiFilterItem.Expression; cndAssetTotPCAmt4.Expression = new StiExpression("(Totals.Sum(" + dbAssetAccts.Name + ", dtBSAssets.n" + drUserPC["PC_Num"].ToString() + ")) < (Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ")) && Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") < 0"); cndAssetTotPCAmt4.TextColor = Color.Black; cndAssetTotPCAmt4.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); cndAssetTotPCAmt4.Enabled = true; cndAssetTotPCAmt4.CanAssignExpression = true; cndAssetTotPCAmt4.AssignExpression = "\"(\" + " + "(Totals.Sum(" + dbLiabAccts.Name + ", dtBSLiabs.n" + drUserPC["PC_Num"].ToString() + ") * -1)" + " + \")\""; txtAssetPCTotAmt.Conditions.Add(cndAssetTotPCAmt4); pos = pos + x; } //StiVerticalLinePrimitive stiLine1 = new Stimulsoft.Report.Components.StiVerticalLinePrimitive(); ////stiLine1.ClientRectangle = new Stimulsoft.Base.Drawing.RectangleD(AssetL, 3.6, 0.1, 3.1); //stiLine1.Top = 0; //stiLine1.Left = AssetL; //stiLine1.Height = 10; //stiLine1.PrintOn = StiPrintOnType.AllPages; //stiLine1.ShiftMode = StiShiftMode.IncreasingSize; //stiLine1.GrowToHeight = true; //stiLine1.CanGrow = true; ////stiLine1.DisplayRectangle = new RectangleD(AssetL, 3.6, 0.1, 3.1); //stiLine1.Color = System.Drawing.Color.Blue; //stiLine1.Guid = null; //stiLine1.Interaction = null; //stiLine1.EndCap = new Stimulsoft.Base.Drawing.StiCap(10, Stimulsoft.Base.Drawing.StiCapStyle.None, 10, true, System.Drawing.Color.Red); //stiLine1.StartCap = new Stimulsoft.Base.Drawing.StiCap(10, Stimulsoft.Base.Drawing.StiCapStyle.None, 10, true, System.Drawing.Color.Green); ////stiLine1.Page = MainRepPage; //MainRepPage.Components.Add(stiLine1); //stiLine1.Page = MainRepPage; StiVerticalLinePrimitive VerticalLinePrimitive6 = new Stimulsoft.Report.Components.StiVerticalLinePrimitive(); VerticalLinePrimitive6 = new Stimulsoft.Report.Components.StiVerticalLinePrimitive(); VerticalLinePrimitive6.ClientRectangle = new Stimulsoft.Base.Drawing.RectangleD(0, 3.6, 0.01, 2.3); VerticalLinePrimitive6.Color = System.Drawing.Color.Black; VerticalLinePrimitive6.Guid = null; VerticalLinePrimitive6.Name = "VerticalLinePrimitive6"; VerticalLinePrimitive6.EndCap = new Stimulsoft.Base.Drawing.StiCap(10, Stimulsoft.Base.Drawing.StiCapStyle.None, 10, true, System.Drawing.Color.Black); VerticalLinePrimitive6.Interaction = null; VerticalLinePrimitive6.StartCap = new Stimulsoft.Base.Drawing.StiCap(10, Stimulsoft.Base.Drawing.StiCapStyle.None, 10, true, System.Drawing.Color.Black); MainRepPage.Components.Add(VerticalLinePrimitive6); VerticalLinePrimitive6.Page = MainRepPage; return report; } protected void Button1_Click(object sender, EventArgs e) { StiReport report = CreateReport2(); StiWebDesigner1.Design(report); } }