Example #1
0
        public void DrawDistributionTable()
        {
            HtmlTableRow  tr;
            HtmlTableCell td;
            HtmlInputText txt;

            var    ds = FSDataServices.GetFSReportConfiguration();
            int    group_cd;
            string row_name;

            foreach (DataRow drConfig in ds.Tables[0].Rows)
            {
                //skip headers and totals rows
                if ((int)drConfig["GROUP_CD"] != 0)
                {
                    group_cd = (int)drConfig["GROUP_CD"];
                    row_name = (string)drConfig["Name"];

                    tr = new HtmlTableRow();
                    tr.AddReportRow();
                    tr.Cells.AddCell(row_name, "reportCaption");

                    var dr = IncomeTable.Select(String.Format("GROUP_CD={0} and BookMonth='{1}'", group_cd, BookMonth));
                    if (dr.Length > 0)
                    {
                        td = DisplayedMoneyCell((decimal)Utility.GetNotNullValue(dr[0]["Income"], "Decimal"), "reportTotal", "right");
                    }
                    else
                    {
                        td = DisplayedMoneyCell(0, "reportTotal", "right");
                    }
                    td.Attributes.Add("alt", group_cd.ToString());
                    tr.Cells.Add(td);

                    td  = new HtmlTableCell();
                    txt = new HtmlInputText();
                    td.Controls.Add(txt);
                    txt.AddStyle("width:90px;height:15px;text-align:right");
                    if (!ReadOnly)
                    {
                        txt.AddOnMouseOut("extractNumber(this,0,false,0);");
                        txt.AddOnKeyUp("extractNumber(this,0,false,0);");
                        txt.AddKeyPressBlockNonNumbers();
                    }
                    else
                    {
                        txt.SetReadOnly();
                    }
                    dr = ProjectionTable.Select(String.Format("GROUP_CD={0} and BookMonth='{1}'", group_cd, BookMonth));
                    if (dr.Length > 0)
                    {
                        txt.Value = String.Format("{0:0}", (decimal)Utility.GetNotNullValue(dr[0]["Amount"], "Decimal"));
                    }
                    tr.Cells.Add(td);

                    tr.Cells.AddDisplayedMoneyCell(0, "reportTotal", "right");

                    ChartTable.Rows.Add(tr);
                }
            }
        }