Advertisement
uniblab

acctdropdown_SelectedIndexChanged

Sep 20th, 2019
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 40.87 KB | None | 0 0
  1. protected void acctdropdown_SelectedIndexChanged() {
  2.     if ( acctdropdown.SelectedValue != "" ) {
  3.         string authenticatednetid = HttpContext.Current.User.Identity.Name;
  4.         CurrentPerson = JS_Person.LoadUsingNetid( authenticatednetid );
  5.         HtmlGenericControl apptitle = (HtmlGenericControl)Page.FindControl( "apptitle" );
  6.         //if (apptitle == null)
  7.         //Page.FindControl("main-menu").Visible = false;
  8.         Panel appcontent = (Panel)Page.FindControl( "appcontent" );
  9.         appcontent.Style.Value = "margin:0";
  10.         var accounthaspreviousnote = Budget_Web_Form_Final_vw.getdc.Budget_Web_Form_Final_vws.Where( b => b.Account == acctdropdown.SelectedValue & b.User == loggedinuser.Netid & b.Prev_Yr_Note != "" ).OrderBy( b => b.SO ).ThenBy( b => b.Sub_Account ).ThenBy( b => b.Object_Code ).ToList();
  11.         HtmlGenericControl headerscriptcontrol = new HtmlGenericControl( "div" );
  12.         //fixedCols: 7,
  13.         if ( accounthaspreviousnote.Count() != 0 )
  14.             headerscriptcontrol.InnerHtml = @"<script type=""text/javascript"">$('table.freezeheader').fxdHdrCol({
  15. width:     '100%',
  16. height:    600,
  17. colModal: [
  18. { width: 120, align: 'center' },
  19. { width: 150, align: 'center' },
  20. { width: 75, align: 'center' },
  21. { width: 70, align: 'center' },
  22. { width: 245, align: 'center' },
  23. { width: 245, align: 'center' },
  24. { width: 90, align: 'center' },
  25. { width: 90, align: 'center' },
  26. { width: 90, align: 'center' },
  27. { width: 90, align: 'center' },
  28. { width: 200, align: 'center' },
  29. { width: 200, align: 'center' },
  30. { width: 90, align: 'center' },
  31. { width: 90, align: 'center' },
  32. { width: 50, align: 'center' }
  33. ]
  34. })
  35.                        </script>";
  36.         else
  37.             //fixedCols: 7,
  38.             headerscriptcontrol.InnerHtml = @"<script type=""text/javascript"">$('table.freezeheader').fxdHdrCol({
  39. width:     '100%',
  40. height:    600,
  41. colModal: [
  42. { width: 120, align: 'center' },
  43. { width: 150, align: 'center' },
  44. { width: 75, align: 'center' },
  45. { width: 70, align: 'center' },
  46. { width: 245, align: 'center' },
  47. { width: 245, align: 'center' },
  48. { width: 90, align: 'center' },
  49. { width: 90, align: 'center' },
  50. { width: 90, align: 'center' },
  51. { width: 90, align: 'center' },
  52. { width: 200, align: 'center' },
  53. { width: 90, align: 'center' },
  54. { width: 90, align: 'center' },
  55. { width: 50, align: 'center' }
  56. ]
  57. })
  58.                        </script>";
  59.  
  60.         headerscript.Controls.Add( headerscriptcontrol );
  61.         var accountdata = Budget_Web_Form_Final_vw.getdc.Budget_Web_Form_Final_vws.Where( b => b.Account == acctdropdown.SelectedValue & b.User == loggedinuser.Netid ).OrderBy( b => b.SO ).ThenBy( b => b.Sub_Account ).ThenBy( b => b.Object_Code ).ToList();
  62.         if ( accountdata.Count != 0 ) {
  63.             // put account date in header above main table
  64.             TableRow headerrow = new TableRow();
  65.             TableCell headercell = new TableCell();
  66.             headercell.HorizontalAlign = HorizontalAlign.Right;
  67.             headercell.Text = "Org:";
  68.             headerrow.Cells.Add( headercell );
  69.             headercell = new TableCell();
  70.             headercell = new TableCell();
  71.             headercell.Text = accountdata[ 0 ].Org;
  72.             headerrow.Cells.Add( headercell );
  73.             BudgetHeaderTable.Rows.Add( headerrow );
  74.  
  75.             headercell = new TableCell();
  76.             headerrow = new TableRow();
  77.             headercell = new TableCell();
  78.             headercell.HorizontalAlign = HorizontalAlign.Right;
  79.             headercell.Text = "Org Desc:";
  80.             headerrow.Cells.Add( headercell );
  81.             headercell = new TableCell();
  82.             headercell.Text = accountdata[ 0 ].Org_Desc;
  83.             headerrow.Cells.Add( headercell );
  84.             BudgetHeaderTable.Rows.Add( headerrow );
  85.  
  86.             headerrow = new TableRow();
  87.             headercell = new TableCell();
  88.             headercell.HorizontalAlign = HorizontalAlign.Right;
  89.             headercell.Text = "Account:";
  90.             headerrow.Cells.Add( headercell );
  91.             headercell = new TableCell();
  92.             headercell.Text = accountdata[ 0 ].Account;
  93.             headerrow.Cells.Add( headercell );
  94.             BudgetHeaderTable.Rows.Add( headerrow );
  95.  
  96.             headerrow = new TableRow();
  97.             headercell = new TableCell();
  98.             headercell.HorizontalAlign = HorizontalAlign.Right;
  99.             headercell.Text = "Account Name:";
  100.             headerrow.Cells.Add( headercell );
  101.             headercell = new TableCell();
  102.             headercell.Text = accountdata[ 0 ].Account_Name;
  103.             headerrow.Cells.Add( headercell );
  104.             BudgetHeaderTable.Rows.Add( headerrow );
  105.             TableRow objrow = new TableRow();
  106.             objrow.TableSection = TableRowSection.TableHeader;
  107.             objrow.CssClass = "budgettableheader";
  108.  
  109.             TableHeaderCell objdataheadercell = new TableHeaderCell();
  110.             objdataheadercell.Text = "Category Name";
  111.             objrow.Cells.Add( objdataheadercell );
  112.  
  113.             objdataheadercell = new TableHeaderCell();
  114.             objdataheadercell.Text = "C.O.";
  115.             objrow.Cells.Add( objdataheadercell );
  116.  
  117.             objdataheadercell = new TableHeaderCell();
  118.             objdataheadercell.Text = "Sub Account";
  119.  
  120.             objrow.Cells.Add( objdataheadercell );
  121.  
  122.             objdataheadercell = new TableHeaderCell();
  123.             objdataheadercell.Text = "Object Code";
  124.  
  125.             objrow.Cells.Add( objdataheadercell );
  126.  
  127.             objdataheadercell = new TableHeaderCell();
  128.             objdataheadercell.Text = "Object Name";
  129.  
  130.             objrow.Cells.Add( objdataheadercell );
  131.  
  132.             objdataheadercell = new TableHeaderCell();
  133.             objdataheadercell.Text = "Sub Object";
  134.  
  135.             objrow.Cells.Add( objdataheadercell );
  136.  
  137.             //objdataheadercell = new TableHeaderCell();
  138.             //objdataheadercell.Text = "FY16 Current Forecast";
  139.  
  140.             objrow.Cells.Add( objdataheadercell );
  141.  
  142.             objdataheadercell = new TableHeaderCell();
  143.             objdataheadercell.Text = System.String.Format( "{0} Actuals", SearchPage.PreviousYear );
  144.  
  145.             objrow.Cells.Add( objdataheadercell );
  146.  
  147.             objdataheadercell = new TableHeaderCell();
  148.             objdataheadercell.Text = System.String.Format( "{0} YTD", SearchPage.CurrentYear );
  149.  
  150.             objrow.Cells.Add( objdataheadercell );
  151.  
  152.             objdataheadercell = new TableHeaderCell();
  153.             objdataheadercell.Text = System.String.Format( "{0} Full Year Budget", SearchPage.CurrentYear );
  154.  
  155.             objrow.Cells.Add( objdataheadercell );
  156.  
  157.             objdataheadercell = new TableHeaderCell();
  158.             objdataheadercell.Text = System.String.Format( "{0} Full Year Forecast", SearchPage.CurrentYear );
  159.  
  160.             objrow.Cells.Add( objdataheadercell );
  161.  
  162.             objdataheadercell = new TableHeaderCell();
  163.             objdataheadercell.Text = System.String.Format( "{0} Forecast Note", SearchPage.CurrentYear );
  164.  
  165.             objrow.Cells.Add( objdataheadercell );
  166.  
  167.             if ( accounthaspreviousnote.Count() != 0 ) {
  168.                 objdataheadercell = new TableHeaderCell();
  169.                 objdataheadercell.Text = System.String.Format( "{0} Budget Note", SearchPage.CurrentYear );
  170.                 objrow.Cells.Add( objdataheadercell );
  171.             }
  172.  
  173.             objdataheadercell = new TableHeaderCell();
  174.             objdataheadercell.Text = System.String.Format( "{0} Forecast - {1} Budget", SearchPage.CurrentYear, SearchPage.CurrentYear );
  175.             objrow.Cells.Add( objdataheadercell );
  176.  
  177.             objdataheadercell = new TableHeaderCell();
  178.             objdataheadercell.Text = System.String.Format( "{0} Forecast - {1} Actuals", SearchPage.CurrentYear, SearchPage.PreviousYear );
  179.             objrow.Cells.Add(objdataheadercell);
  180.  
  181.             objdataheadercell = new TableHeaderCell();
  182.             objdataheadercell.Text = "";
  183.  
  184.             objrow.Cells.Add( objdataheadercell );
  185.  
  186.             BudgetTable.Rows.Add( objrow );
  187.  
  188.             string lastcat = "";
  189.             string lastcatfullname = "";
  190.             string lastCO = "";
  191.             decimal? BQ1 = 0;
  192.             decimal? BQ2 = 0;
  193.             decimal? BQ3 = 0;
  194.             decimal? BQ4 = 0;
  195.             decimal? ObjectCurrentForecast = 0;
  196.             decimal? ObjectBudgetVariance = 0;
  197.             decimal? ObjectForecastMinusActual = 0;
  198.             decimal? BQ1_all = 0;
  199.             decimal? BQ2_all = 0;
  200.             decimal? BQ3_all = 0;
  201.             decimal? BQ4_all = 0;
  202.             decimal? ObjectBudgetVariance_all = 0;
  203.             decimal? ObjectForecastMinusActual_all = 0;
  204.             decimal? ObjectCurrentForecast_all = 0;
  205.             //UpdatePanel BQ1totalupdatepanel = new UpdatePanel();
  206.             //UpdatePanel BQ2totalupdatepanel = new UpdatePanel();
  207.             //UpdatePanel BQ3totalupdatepanel = new UpdatePanel();
  208.             UpdatePanel BQ4totalupdatepanel = new UpdatePanel();
  209.             UpdatePanel FYBudgettotalupdatepanel = new UpdatePanel();
  210.             UpdatePanel BudgetVariancetotalupdatepanel = new UpdatePanel();
  211.             UpdatePanel ForecastMinusActualtotalupdatepanel = new UpdatePanel();
  212.             TableCell objdatacell = new TableCell();
  213.             foreach ( var accline in accountdata ) {
  214.                 string CategoryNameNoSpace = accline.Category_Name.Replace( " ", "" );
  215.                 objrow = new TableRow();
  216.                 objrow.TableSection = TableRowSection.TableBody;
  217.                 objrow.Height = 70;
  218.                 objrow.ID = "ObjectRow_" + accline.RecID;
  219.                 objdatacell = new TableCell();
  220.                 //AsyncPostBackTrigger BQ1trigger = new AsyncPostBackTrigger();
  221.                 //BQ1trigger.ControlID = "BQ1_" + accline.RecID + "_" + CategoryNameNoSpace;
  222.                 //BQ1trigger.EventName = "TextChanged";
  223.                 //BQ1totalupdatepanel.Triggers.Add(BQ1trigger);
  224.                 //AsyncPostBackTrigger BQ2trigger = new AsyncPostBackTrigger();
  225.                 //BQ2trigger.ControlID = "BQ2_" + accline.RecID + "_" + CategoryNameNoSpace;
  226.                 //BQ2trigger.EventName = "TextChanged";
  227.                 //BQ2totalupdatepanel.Triggers.Add(BQ2trigger);
  228.                 //AsyncPostBackTrigger BQ3trigger = new AsyncPostBackTrigger();
  229.                 //BQ3trigger.ControlID = "BQ3_" + accline.RecID + "_" + CategoryNameNoSpace;
  230.                 //BQ3trigger.EventName = "TextChanged";
  231.                 //BQ3totalupdatepanel.Triggers.Add(BQ3trigger);
  232.                 AsyncPostBackTrigger BQ4trigger = new AsyncPostBackTrigger();
  233.                 BQ4trigger.ControlID = "BQ4_" + accline.RecID + "_" + CategoryNameNoSpace;
  234.                 BQ4trigger.EventName = "TextChanged";
  235.                 BQ4totalupdatepanel.Triggers.Add( BQ4trigger );
  236.                 if ( CategoryNameNoSpace != lastcat ) {
  237.                     if ( lastcat != "" ) {
  238.                         //BQ1totalupdatepanel.ID = lastcat + "_BQ1";
  239.                         //BQ1totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  240.                         //BQ2totalupdatepanel.ID = lastcat + "_BQ2";
  241.                         //BQ2totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  242.                         //BQ3totalupdatepanel.ID = lastcat + "_BQ3";
  243.                         //BQ3totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  244.                         BQ4totalupdatepanel.ID = lastcat + "_BQ4";
  245.                         BQ4totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  246.                         FYBudgettotalupdatepanel.ID = lastcat + "_FYBudget";
  247.                         FYBudgettotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  248.                         BudgetVariancetotalupdatepanel.ID = lastcat + "_BudgetVariance";
  249.                         BudgetVariancetotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  250.                         ForecastMinusActualtotalupdatepanel.ID = lastcat + "_ForecastMinusActual";
  251.                         ForecastMinusActualtotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  252.                         TableRow totalrow = new TableRow();
  253.                         totalrow.TableSection = TableRowSection.TableBody;
  254.                         totalrow.ID = "Category_total_TR_" + lastcat;
  255.                         totalrow.CssClass = "budgetcategorytotal";
  256.  
  257.                         TableCell totalcell = new TableCell();
  258.                         totalcell.Text = lastcatfullname + " Total";
  259.                         totalcell.CssClass = "categorytotalcelllabel";
  260.                         totalrow.Cells.Add( totalcell );
  261.  
  262.                         totalcell = new TableCell();
  263.                         totalrow.Cells.Add( totalcell );
  264.                         totalcell = new TableCell();
  265.                         totalrow.Cells.Add( totalcell );
  266.                         totalcell = new TableCell();
  267.                         totalrow.Cells.Add( totalcell );
  268.                         totalcell = new TableCell();
  269.                         totalrow.Cells.Add( totalcell );
  270.                         totalcell = new TableCell();
  271.                         totalrow.Cells.Add( totalcell );
  272.  
  273.                         //totalcell = new TableCell();
  274.                         //totalcell.ID = "Category_total_" + lastcat + "_CurrentForecast";
  275.                         //HtmlGenericControl dummmydiv = new HtmlGenericControl("div");
  276.                         //totalcontent.InnerHtml = string.Format("{0:C0}", ObjectCurrentForecast);
  277.                         //dummmydiv.Controls.Add(totalcontent);
  278.                         //totalcell.Controls.Add(dummmydiv);
  279.                         //totalrow.Cells.Add(totalcell);
  280.  
  281.                         totalcell = new TableCell();
  282.                         totalcell.ID = "Category_total_" + lastcat + "_BQ1";
  283.                         //totalcell.Text = BQ1.ToString();
  284.                         HtmlGenericControl totalcontent = new HtmlGenericControl( "div" );
  285.                         totalcontent = new HtmlGenericControl( "div" );
  286.                         totalcontent.ID = "Category_total_" + lastcat + "_BQ1_content";
  287.                         totalcontent.InnerHtml = string.Format( "{0:C0}", BQ1 );
  288.                         //BQ1totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  289.                         totalcell.Controls.Add( totalcontent );
  290.                         totalrow.Cells.Add( totalcell );
  291.                         //BQ1totalupdatepanel = new UpdatePanel();
  292.                         //BQ1totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  293.  
  294.                         totalcell = new TableCell();
  295.                         totalcell.ID = "Category_total_" + lastcat + "_BQ2";
  296.                         //totalcell.Text = BQ2.ToString();
  297.                         totalcontent = new HtmlGenericControl( "div" );
  298.                         totalcontent.ID = "Category_total_" + lastcat + "_BQ2_content";
  299.                         totalcontent.InnerHtml = string.Format( "{0:C0}", BQ2 );
  300.                         //BQ2totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  301.                         totalcell.Controls.Add( totalcontent );
  302.                         totalrow.Cells.Add( totalcell );
  303.                         //BQ2totalupdatepanel = new UpdatePanel();
  304.                         //BQ2totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  305.  
  306.                         totalcell = new TableCell();
  307.                         totalcell.ID = "Category_total_" + lastcat + "_BQ3";
  308.                         //totalcell.Text = BQ3.ToString();
  309.                         totalcontent = new HtmlGenericControl( "div" );
  310.                         totalcontent.ID = "Category_total_" + lastcat + "_BQ3_content";
  311.                         totalcontent.InnerHtml = string.Format( "{0:C0}", BQ3 );
  312.                         //BQ3totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  313.                         totalcell.Controls.Add( totalcontent );
  314.                         totalrow.Cells.Add( totalcell );
  315.                         // BQ3totalupdatepanel = new UpdatePanel();
  316.                         //BQ3totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  317.  
  318.                         totalcell = new TableCell();
  319.                         totalcell.ID = "Category_total_" + lastcat + "_BQ4";
  320.                         //totalcell.Text = BQ4.ToString();
  321.                         totalcontent = new HtmlGenericControl( "div" );
  322.                         totalcontent.ID = "Category_total_" + lastcat + "_BQ4_content";
  323.                         totalcontent.InnerHtml = string.Format( "{0:C0}", BQ4 );
  324.                         BQ4totalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  325.                         totalcell.Controls.Add( BQ4totalupdatepanel );
  326.                         totalrow.Cells.Add( totalcell );
  327.                         BQ4totalupdatepanel = new UpdatePanel();
  328.                         BQ4totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  329.  
  330.                         totalcell = new TableCell();
  331.                         totalrow.Cells.Add( totalcell );
  332.  
  333.                         if ( accounthaspreviousnote.Count() != 0 ) {
  334.                             totalcell = new TableCell();
  335.                             totalrow.Cells.Add( totalcell );
  336.                         }
  337.  
  338.                         totalcell = new TableCell();
  339.                         totalcell.ID = "Category_total_" + lastcat + "_BudgetVariance";
  340.                         totalcontent = new HtmlGenericControl( "div" );
  341.                         totalcontent.ID = "Category_total_" + lastcat + "_BudgetVariance_content";
  342.                         totalcontent.InnerHtml = string.Format( "{0:C0}", ObjectBudgetVariance );
  343.                         BudgetVariancetotalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  344.                         totalcell.Controls.Add( BudgetVariancetotalupdatepanel );
  345.                         totalrow.Cells.Add( totalcell );
  346.                         BudgetVariancetotalupdatepanel = new UpdatePanel();
  347.                         BudgetVariancetotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  348.  
  349.                         totalcell = new TableCell();
  350.                         totalcell.ID = "Category_total_" + lastcat + "_ForecastMinusActual";
  351.                         totalcontent = new HtmlGenericControl( "div" );
  352.                         totalcontent.ID = "Category_total_" + lastcat + "_ForecastMinusActual_content";
  353.                         totalcontent.InnerHtml = string.Format( "{0:C0}", ObjectForecastMinusActual );
  354.                         ForecastMinusActualtotalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  355.                         totalcell.Controls.Add( ForecastMinusActualtotalupdatepanel );
  356.                         totalrow.Cells.Add( totalcell );
  357.                         ForecastMinusActualtotalupdatepanel = new UpdatePanel();
  358.                         ForecastMinusActualtotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  359.  
  360.                         totalcell = new TableCell();
  361.                         totalrow.Cells.Add( totalcell );
  362.  
  363.                         BudgetTable.Rows.Add( totalrow );
  364.                         BQ1 = 0;
  365.                         BQ2 = 0;
  366.                         BQ3 = 0;
  367.                         BQ4 = 0;
  368.                         ObjectBudgetVariance = 0;
  369.                         ObjectForecastMinusActual = 0;
  370.                         ObjectCurrentForecast = 0;
  371.                     }
  372.                     objdatacell.Text = accline.Category_Name;
  373.                     lastcat = CategoryNameNoSpace;
  374.                     lastcatfullname = accline.Category_Name;
  375.                 } else {
  376.                     objdatacell.Text = "";
  377.                 }
  378.                 objrow.Cells.Add( objdatacell );
  379.                 objdatacell = new TableCell();
  380.                 if ( lastCO != accline.Consolidation_Object )
  381.                     objdatacell.Text = accline.Consolidation_Object;
  382.                 else
  383.                     objdatacell.Text = "";
  384.                 objrow.Cells.Add( objdatacell );
  385.  
  386.                 objdatacell = new TableCell();
  387.                 objdatacell.ID = "subacct_" + accline.RecID;
  388.                 UpdatePanel textboxupdatepanel = new UpdatePanel();
  389.                 textboxupdatepanel.ID = accline.RecID + "_subacct";
  390.                 textboxupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  391.                 DropDownList subacctInput = new DropDownList();
  392.  
  393.                 string qry = @"SELECT DISTINCT ACCT_NBR, SUB_ACCT_NBR, SUB_ACCT_NAME
  394.                                    FROM  KFS_COA
  395.                                    WHERE (ACCT_CLOSED_FLG = 'N') AND (ACCT_NBR = '" + accline.Account + "')" +
  396.                                     " AND (len([SUB_ACCT_CLOSED_FLG]) = 0 or [SUB_ACCT_CLOSED_FLG] = 'N')" +
  397.                                 " ORDER BY ACCT_NBR, SUB_ACCT_NBR";
  398.                 var KfsConnectionString = ConfigurationManager.ConnectionStrings[ "Kfs" ].ConnectionString;
  399.                 using ( var sqlConnection = new SqlConnection( KfsConnectionString ) ) {
  400.                     sqlConnection.Open();
  401.                     using ( var sqlCommand = new SqlCommand( qry, sqlConnection ) ) {
  402.                         using ( var dr = sqlCommand.ExecuteReader() ) {
  403.                             if ( dr.HasRows ) {
  404.                                 ListItem subacctdropdownitem = new ListItem();
  405.                                 //subacctdropdownitem.Text = "";
  406.                                 //subacctdropdownitem.Value = "";
  407.                                 //subacctInput.Items.Add(subacctdropdownitem);
  408.                                 while ( dr.Read() ) {
  409.                                     subacctdropdownitem = new ListItem();
  410.                                     subacctdropdownitem.Text = StringTools.NonNullValue( dr[ "SUB_ACCT_NBR" ].ToString () );
  411.                                     subacctdropdownitem.Value = StringTools.NonNullValue( dr[ "SUB_ACCT_NBR" ].ToString() );
  412.                                     subacctInput.Items.Add( subacctdropdownitem );
  413.                                 }
  414.                             }
  415.                         }
  416.                     }
  417.                 }
  418.  
  419.                 if ( subacctInput.Items.FindByValue( accline.Sub_Account ) == null )
  420.                     subacctInput.Items.Add( accline.Sub_Account );
  421.                 subacctInput.SelectedValue = accline.Sub_Account;
  422.                 if ( StringTools.NonNullValue( accline.ReadOnly ) == "Y" ) {
  423.                     //if (!CurrentPerson.IsInRole("Department - Financial Services"))
  424.                     subacctInput.Enabled = false;
  425.                 }
  426.                 subacctInput.ID = "subacct_" + accline.RecID + "_" + CategoryNameNoSpace;
  427.                 subacctInput.Attributes.Add( "onfocus", "setinitalval(this)" );
  428.                 subacctInput.Attributes.Add( "onchange", "highlightifchanged(this)" );
  429.                 //subacctInput.Attributes.Add("onkeyup", "highlightifchanged(this)");
  430.                 //subacctInput.Attributes.Add("onmouseup", "highlightifchanged(this)");
  431.                 subacctInput.AutoPostBack = true;
  432.                 subacctInput.SelectedIndexChanged += DDL_TextChanged;
  433.                 ScriptManager.GetCurrent( Page ).RegisterAsyncPostBackControl( subacctInput );
  434.                 textboxupdatepanel.ContentTemplateContainer.Controls.Add( subacctInput );
  435.                 objdatacell.Controls.Add( textboxupdatepanel );
  436.                 objrow.Cells.Add( objdatacell );
  437.  
  438.                 objdatacell = new TableCell();
  439.                 objdatacell.Text = accline.Object_Code;
  440.                 objdatacell.ID = "objectcode_" + accline.RecID;
  441.                 objrow.Cells.Add( objdatacell );
  442.  
  443.                 objdatacell = new TableCell();
  444.                 objdatacell.Text = accline.Object_Name;
  445.                 objrow.Cells.Add( objdatacell );
  446.  
  447.                 objdatacell = new TableCell();
  448.                 objdatacell.ID = "subobject_" + accline.RecID;
  449.                 textboxupdatepanel = new UpdatePanel();
  450.                 textboxupdatepanel.ID = accline.RecID + "_subobject";
  451.                 textboxupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  452.                 DropDownList subobjectInput = new DropDownList();
  453.  
  454.                 qry = @"SELECT DISTINCT OBJ_CD, SUB_OBJ_CD, SUB_OBJ_CD_SHORT_NAME
  455.                            FROM BudgetFom_Object_tbl
  456.                            WHERE (OBJ_CD = '" + accline.Object_Code + "')" +
  457.                                 " ORDER BY OBJ_CD, SUB_OBJ_CD";
  458.  
  459.                 using ( var sqlConnection = new SqlConnection( KfsConnectionString ) ) {
  460.                     sqlConnection.Open();
  461.                     using ( var sqlCommand = new SqlCommand( qry, sqlConnection ) ) {
  462.                         using ( var dr = sqlCommand.ExecuteReader() ) {
  463.                             if ( dr.HasRows ) {
  464.                                 ListItem subobjectdropdownitem = new ListItem();
  465.                                 //subacctdropdownitem.Text = "";
  466.                                 //subacctdropdownitem.Value = "";
  467.                                 //subacctInput.Items.Add(subacctdropdownitem);
  468.                                 while ( dr.Read() ) {
  469.                                     subobjectdropdownitem = new ListItem();
  470.                                     subobjectdropdownitem.Text = StringTools.NonNullValue( (string)dr[ "SUB_OBJ_CD" ].ToString() ) + "-" + StringTools.NonNullValue( (string)dr[ "SUB_OBJ_CD_SHORT_NAME" ].ToString() );
  471.                                     subobjectdropdownitem.Value = StringTools.NonNullValue( (string)dr[ "SUB_OBJ_CD" ].ToString() );
  472.                                     subobjectInput.Items.Add( subobjectdropdownitem );
  473.                                 }
  474.                             }
  475.                         }
  476.                     }
  477.                 }
  478.  
  479.                 if ( subobjectInput.Items.FindByValue( accline.Sub_Object ) == null )
  480.                     subobjectInput.Items.Add( accline.Sub_Object );
  481.                 subobjectInput.SelectedValue = accline.Sub_Object;
  482.                 if ( StringTools.NonNullValue( accline.ReadOnly ) == "Y" ) {
  483.                     //if (!CurrentPerson.IsInRole("Department - Financial Services"))
  484.                     subobjectInput.Enabled = false;
  485.                 }
  486.                 subobjectInput.ID = "subobject_" + accline.RecID + "_" + CategoryNameNoSpace;
  487.                 subobjectInput.Attributes.Add( "onfocus", "setinitalval(this)" );
  488.                 subobjectInput.Attributes.Add( "onkeyup", "highlightifchanged(this)" );
  489.                 subobjectInput.Attributes.Add( "onmouseup", "highlightifchanged(this)" );
  490.                 subobjectInput.AutoPostBack = true;
  491.                 subobjectInput.SelectedIndexChanged += DDL_TextChanged;
  492.                 ScriptManager.GetCurrent( Page ).RegisterAsyncPostBackControl( subobjectInput );
  493.                 textboxupdatepanel.ContentTemplateContainer.Controls.Add( subobjectInput );
  494.                 objdatacell.Controls.Add( textboxupdatepanel );
  495.                 objrow.Cells.Add( objdatacell );
  496.  
  497.                 //objdatacell = new TableCell();
  498.                 //HtmlGenericControl forecastcontent = new HtmlGenericControl("div");
  499.                 //HtmlGenericControl forecastdummmydiv = new HtmlGenericControl("div");
  500.  
  501.                 //objdatacell.ID = "ObjectCurrentForecastCell_" + accline.RecID;
  502.                 //forecastcontent.InnerHtml = string.Format("{0:F0}", accline.Current_Budget);
  503.                 //forecastdummmydiv.Controls.Add(forecastcontent);
  504.                 //objdatacell.Controls.Add(forecastdummmydiv);
  505.                 //if (accline.Current_Budget != null)
  506.                 //{
  507.                 //    ObjectCurrentForecast = ObjectCurrentForecast + accline.Current_Budget;
  508.                 //    if (CategoryNameNoSpace == "Expense")
  509.                 //        ObjectCurrentForecast_all = ObjectCurrentForecast_all - accline.Current_Budget;
  510.                 //    else
  511.                 //        ObjectCurrentForecast_all = ObjectCurrentForecast_all + accline.Current_Budget;
  512.                 //}
  513.                 //objrow.Cells.Add(objdatacell);
  514.  
  515.                 objdatacell = new TableCell();
  516.                 HtmlGenericControl actualscontent = new HtmlGenericControl( "div" );
  517.                 HtmlGenericControl actualsdummmydiv = new HtmlGenericControl( "div" );
  518.  
  519.                 actualscontent.InnerHtml = string.Format( "{0:F0}", accline.PY_Actual );
  520.                 actualsdummmydiv.Controls.Add( actualscontent );
  521.                 objdatacell.Controls.Add( actualsdummmydiv );
  522.                 objdatacell.ID = "BQ1_" + accline.RecID;
  523.                 if ( accline.PY_Actual != null ) {
  524.                     BQ1 = BQ1 + accline.PY_Actual;
  525.                     if ( CategoryNameNoSpace == "Expense" )
  526.                         BQ1_all = BQ1_all - accline.PY_Actual;
  527.                     else
  528.                         BQ1_all = BQ1_all + accline.PY_Actual;
  529.                 }
  530.                 objrow.Cells.Add( objdatacell );
  531.  
  532.                 objdatacell = new TableCell();
  533.  
  534.                 HtmlGenericControl budgetcontent = new HtmlGenericControl( "div" );
  535.                 HtmlGenericControl budgetdummmydiv = new HtmlGenericControl( "div" );
  536.  
  537.                 budgetcontent.InnerHtml = string.Format( "{0:F0}", accline.Actual );
  538.                 budgetdummmydiv.Controls.Add( budgetcontent );
  539.                 objdatacell.Controls.Add( budgetdummmydiv );
  540.                 objdatacell.ID = "BQ2_" + accline.RecID;
  541.                 if ( accline.Actual != null ) {
  542.                     BQ2 = BQ2 + accline.Actual;
  543.                     if ( CategoryNameNoSpace == "Expense" )
  544.                         BQ2_all = BQ2_all - accline.Actual;
  545.                     else
  546.                         BQ2_all = BQ2_all + accline.Actual;
  547.                 }
  548.                 objrow.Cells.Add( objdatacell );
  549.  
  550.                 objdatacell = new TableCell();
  551.  
  552.                 HtmlGenericControl ytdcontent = new HtmlGenericControl( "div" );
  553.                 HtmlGenericControl ytddummmydiv = new HtmlGenericControl( "div" );
  554.  
  555.                 ytdcontent.InnerHtml = string.Format( "{0:F0}", accline.Current_Budget );
  556.                 ytddummmydiv.Controls.Add( ytdcontent );
  557.                 objdatacell.Controls.Add( ytddummmydiv );
  558.                 objdatacell.ID = "BQ3_" + accline.RecID;
  559.                 if ( accline.Current_Budget != null ) {
  560.                     BQ3 = BQ3 + accline.Current_Budget;
  561.                     if ( CategoryNameNoSpace == "Expense" )
  562.                         BQ3_all = BQ3_all - accline.Current_Budget;
  563.                     else
  564.                         BQ3_all = BQ3_all + accline.Current_Budget;
  565.                 }
  566.                 objrow.Cells.Add( objdatacell );
  567.  
  568.                 objdatacell = new TableCell();
  569.  
  570.                 objdatacell.ID = "BQ4_" + accline.RecID;
  571.                 textboxupdatepanel = new UpdatePanel();
  572.                 textboxupdatepanel.ID = accline.RecID + "_BQ4";
  573.                 textboxupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  574.                 TextBox BQ4Input = new TextBox();
  575.                 BQ4Input.Columns = 8;
  576.                 BQ4Input.Text = string.Format( "{0:F0}", accline.Forecast );
  577.                 BQ4Input.ID = "BQ4_" + accline.RecID + "_" + CategoryNameNoSpace;
  578.                 BQ4Input.Attributes.Add( "onfocus", "setinitalval(this)" );
  579.                 BQ4Input.Attributes.Add( "onkeyup", "highlightifchanged(this)" );
  580.                 BQ4Input.Attributes.Add( "onchange", "if(!checkfordecimal(this)){return false;}" );
  581.                 BQ4Input.Attributes.Add( "onblur", "if(!checkfordecimalmsg(this,event)){return false;}" );
  582.                 BQ4Input.AutoPostBack = true;
  583.                 if ( StringTools.NonNullValue( accline.ReadOnly ) == "Y" ) {
  584.                     //if (!CurrentPerson.IsInRole("Department - Financial Services"))
  585.                     BQ4Input.Enabled = false;
  586.                 }
  587.                 BQ4Input.TextChanged += TextBox2_TextChanged;
  588.                 ScriptManager.GetCurrent( Page ).RegisterAsyncPostBackControl( BQ4Input );
  589.                 textboxupdatepanel.ContentTemplateContainer.Controls.Add( BQ4Input );
  590.                 objdatacell.Controls.Add( textboxupdatepanel );
  591.                 if ( accline.Budget != null ) {
  592.                     BQ4 = BQ4 + accline.Budget;
  593.                     if ( CategoryNameNoSpace == "Expense" )
  594.                         BQ4_all = BQ4_all - accline.Budget;
  595.                     else
  596.                         BQ4_all = BQ4_all + accline.Budget;
  597.                 }
  598.                 objrow.Cells.Add( objdatacell );
  599.  
  600.                 objdatacell = new TableCell();
  601.                 objdatacell.ID = "note_" + accline.RecID;
  602.                 textboxupdatepanel = new UpdatePanel();
  603.                 textboxupdatepanel.ID = accline.RecID + "_note";
  604.                 textboxupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  605.                 TextBox noteInput = new TextBox();
  606.                 noteInput.TextMode = TextBoxMode.MultiLine;
  607.                 noteInput.Rows = 2;
  608.                 noteInput.Text = accline.Note;
  609.                 noteInput.ID = "note_" + accline.RecID + "_" + CategoryNameNoSpace;
  610.                 noteInput.Attributes.Add( "onfocus", "setinitalval(this)" );
  611.                 noteInput.Attributes.Add( "onkeyup", "highlightifchanged(this)" );
  612.                 noteInput.AutoPostBack = true;
  613.                 noteInput.TextChanged += TextBox2_TextChanged;
  614.                 ScriptManager.GetCurrent( Page ).RegisterAsyncPostBackControl( noteInput );
  615.                 textboxupdatepanel.ContentTemplateContainer.Controls.Add( noteInput );
  616.                 objdatacell.Controls.Add( textboxupdatepanel );
  617.                 objrow.Cells.Add( objdatacell );
  618.  
  619.                 if ( accounthaspreviousnote.Count() != 0 ) {
  620.                     objdatacell = new TableCell();
  621.                     HtmlGenericControl prev_yr_div = new HtmlGenericControl( "div" );
  622.                     prev_yr_div.InnerHtml = accline.Prev_Yr_Note;
  623.                     prev_yr_div.Style.Add( "max-width", "200px" );
  624.                     objdatacell.Controls.Add( prev_yr_div );
  625.                     objrow.Cells.Add( objdatacell );
  626.                 }
  627.  
  628.                 objdatacell = new TableCell();
  629.  
  630.                 objdatacell.ID = "ObjectBudgetVarianceCell_" + accline.RecID;
  631.                 textboxupdatepanel = new UpdatePanel();
  632.                 textboxupdatepanel.ID = accline.RecID + "_BudgetVariance";
  633.                 textboxupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  634.                 HtmlGenericControl BudgetVariance = new HtmlGenericControl( "div" );
  635.                 BudgetVariance.InnerHtml = string.Format( "{0:F0}", accline.Forecast - accline.Current_Budget );
  636.                 BudgetVariance.ID = "BudgetVariance_" + accline.RecID + "_" + CategoryNameNoSpace;
  637.                 textboxupdatepanel.ContentTemplateContainer.Controls.Add( BudgetVariance );
  638.                 objdatacell.Controls.Add( textboxupdatepanel );
  639.                 //if (accline.CB_Budget_Variance != null)
  640.                 //{
  641.                 ObjectBudgetVariance = ObjectBudgetVariance + accline.Budget - accline.Current_Budget;
  642.                 ObjectBudgetVariance_all = ObjectBudgetVariance_all + accline.Budget - accline.Current_Budget;
  643.                 //}
  644.                 objrow.Cells.Add( objdatacell );
  645.  
  646.                 objdatacell = new TableCell();
  647.  
  648.                 objdatacell.ID = "ObjectForecastMinusActualCell_" + accline.RecID;
  649.                 textboxupdatepanel = new UpdatePanel();
  650.                 textboxupdatepanel.ID = accline.RecID + "_ForecastMinusActual";
  651.                 textboxupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  652.                 HtmlGenericControl ForecastMinusActual = new HtmlGenericControl( "div" );
  653.                 ForecastMinusActual.InnerHtml = string.Format( "{0:F0}", accline.Forecast - accline.PY_Actual );
  654.                 ForecastMinusActual.ID = "ForecastMinusActual_" + accline.RecID + "_" + CategoryNameNoSpace;
  655.                 textboxupdatepanel.ContentTemplateContainer.Controls.Add( ForecastMinusActual );
  656.                 objdatacell.Controls.Add( textboxupdatepanel );
  657.                 //if (accline.CB_Budget_Variance != null)
  658.                 //{
  659.                 ObjectForecastMinusActual = ObjectForecastMinusActual + accline.Forecast - accline.PY_Actual;
  660.                 ObjectForecastMinusActual_all = ObjectForecastMinusActual_all + accline.Budget - accline.PY_Actual;
  661.                 //}
  662.                 objrow.Cells.Add( objdatacell );
  663.  
  664.                 objdatacell = new TableCell();
  665.  
  666.                 LinkButton btnDeleteObjcode = new LinkButton();
  667.                 btnDeleteObjcode.Command += btnDeleteObjcode_Click;
  668.                 btnDeleteObjcode.CommandArgument = accline.RecID.ToString();
  669.                 btnDeleteObjcode.Text = "Delete";
  670.                 btnDeleteObjcode.OnClientClick = "if(!ConfirmDelete('" + accline.Object_Code + "','" + accline.Object_Name + "',event)){return false;}";
  671.                 objdatacell.Controls.Add( btnDeleteObjcode );
  672.                 objrow.Cells.Add( objdatacell );
  673.  
  674.                 BudgetTable.Rows.Add( objrow );
  675.             }
  676.             if ( lastcat != "" )   // total for the last category name and account totals
  677.             {
  678.                 // total for the last category name
  679.                 TableRow totalrow = new TableRow();
  680.                 totalrow.TableSection = TableRowSection.TableBody;
  681.                 totalrow.ID = "Category_total_TR_" + lastcat;
  682.                 totalrow.CssClass = "budgetcategorytotal";
  683.                 TableCell totalcell = new TableCell();
  684.                 totalcell.Text = lastcatfullname + " Total";
  685.                 totalcell.CssClass = "categorytotalcelllabel";
  686.                 totalrow.Cells.Add( totalcell );
  687.  
  688.                 totalcell = new TableCell();
  689.                 totalrow.Cells.Add( totalcell );
  690.                 totalcell = new TableCell();
  691.                 totalrow.Cells.Add( totalcell );
  692.                 totalcell = new TableCell();
  693.                 totalrow.Cells.Add( totalcell );
  694.                 totalcell = new TableCell();
  695.                 totalrow.Cells.Add( totalcell );
  696.                 totalcell = new TableCell();
  697.                 totalrow.Cells.Add( totalcell );
  698.  
  699.                 //totalcell = new TableCell();
  700.                 //totalcell.ID = "Category_total_" + lastcat + "_CurrentForecast";
  701.                 //HtmlGenericControl dummmydiv = new HtmlGenericControl("div");
  702.                 //totalcontent.InnerHtml = string.Format("{0:C0}", ObjectCurrentForecast);
  703.                 //dummmydiv.Controls.Add(totalcontent);
  704.                 //totalcell.Controls.Add(dummmydiv);
  705.                 //totalrow.Cells.Add(totalcell);
  706.  
  707.                 //BQ1totalupdatepanel.ID = lastcat + "_BQ1";
  708.                 //BQ1totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  709.                 HtmlGenericControl totalcontent = new HtmlGenericControl( "div" );
  710.                 totalcell = new TableCell();
  711.                 totalcell.ID = "Category_total_" + lastcat + "_BQ1";
  712.                 //totalcell.Text = BQ1.ToString();
  713.                 totalcontent = new HtmlGenericControl( "div" );
  714.                 totalcontent.ID = "Category_total_" + lastcat + "_BQ1_content";
  715.                 totalcontent.InnerHtml = string.Format( "{0:C0}", BQ1 );
  716.                 //BQ1totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  717.                 totalcell.Controls.Add( totalcontent );
  718.                 totalrow.Cells.Add( totalcell );
  719.  
  720.                 //BQ2totalupdatepanel.ID = lastcat + "_BQ2";
  721.                 //BQ2totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  722.                 totalcell = new TableCell();
  723.                 totalcell.ID = "Category_total_" + lastcat + "_BQ2";
  724.                 //totalcell.Text = BQ2.ToString();
  725.                 totalcontent = new HtmlGenericControl( "div" );
  726.                 totalcontent.ID = "Category_total_" + lastcat + "_BQ2_content";
  727.                 totalcontent.InnerHtml = string.Format( "{0:C0}", BQ2 );
  728.                 //BQ2totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  729.                 totalcell.Controls.Add( totalcontent );
  730.                 totalrow.Cells.Add( totalcell );
  731.  
  732.                 //BQ3totalupdatepanel.ID = lastcat + "_BQ3";
  733.                 //BQ3totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  734.                 totalcell = new TableCell();
  735.                 totalcell.ID = "Category_total_" + lastcat + "_BQ3";
  736.                 //totalcell.Text = BQ3.ToString();
  737.                 totalcontent = new HtmlGenericControl( "div" );
  738.                 totalcontent.ID = "Category_total_" + lastcat + "_BQ3_content";
  739.                 totalcontent.InnerHtml = string.Format( "{0:C0}", BQ3 );
  740.                 //BQ3totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  741.                 totalcell.Controls.Add( totalcontent );
  742.                 totalrow.Cells.Add( totalcell );
  743.  
  744.                 BQ4totalupdatepanel.ID = lastcat + "_BQ4";
  745.                 BQ4totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  746.                 totalcell = new TableCell();
  747.                 totalcell.ID = "Category_total_" + lastcat + "_BQ4";
  748.                 //totalcell.Text = BQ4.ToString();
  749.                 totalcontent = new HtmlGenericControl( "div" );
  750.                 totalcontent.ID = "Category_total_" + lastcat + "_BQ4_content";
  751.                 totalcontent.InnerHtml = string.Format( "{0:C0}", BQ4 );
  752.                 BQ4totalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  753.                 totalcell.Controls.Add( BQ4totalupdatepanel );
  754.                 totalrow.Cells.Add( totalcell );
  755.  
  756.                 totalcell = new TableCell();
  757.                 totalrow.Cells.Add( totalcell );
  758.  
  759.                 if ( accounthaspreviousnote.Count() != 0 ) {
  760.                     totalcell = new TableCell();
  761.                     totalrow.Cells.Add( totalcell );
  762.                 }
  763.  
  764.                 BudgetVariancetotalupdatepanel.ID = lastcat + "_BudgetVariance";
  765.                 BudgetVariancetotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  766.                 totalcell = new TableCell();
  767.                 totalcell.ID = "Category_total_" + lastcat + "_BudgetVariance";
  768.                 totalcontent = new HtmlGenericControl( "div" );
  769.                 totalcontent.ID = "Category_total_" + lastcat + "_BudgetVariance_content";
  770.                 totalcontent.InnerHtml = string.Format( "{0:C0}", ObjectBudgetVariance );
  771.                 BudgetVariancetotalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  772.                 totalcell.Controls.Add( BudgetVariancetotalupdatepanel );
  773.                 totalrow.Cells.Add( totalcell );
  774.  
  775.                 ForecastMinusActualtotalupdatepanel.ID = lastcat + "_ForecastMinusActual";
  776.                 ForecastMinusActualtotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  777.                 totalcell = new TableCell();
  778.                 totalcell.ID = "Category_total_" + lastcat + "_ForecastMinusActual";
  779.                 totalcontent = new HtmlGenericControl( "div" );
  780.                 totalcontent.ID = "Category_total_" + lastcat + "_ForecastMinusActual_content";
  781.                 totalcontent.InnerHtml = string.Format( "{0:C0}", ObjectForecastMinusActual );
  782.                 ForecastMinusActualtotalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  783.                 totalcell.Controls.Add( ForecastMinusActualtotalupdatepanel );
  784.                 totalrow.Cells.Add( totalcell );
  785.  
  786.                 totalcell = new TableCell();
  787.                 totalrow.Cells.Add( totalcell );
  788.  
  789.                 BudgetTable.Rows.Add( totalrow );
  790.  
  791.                 // total for the account totals
  792.                 totalrow = new TableRow();
  793.                 totalrow.TableSection = TableRowSection.TableBody;
  794.                 totalrow.ID = "Account_total_TR";
  795.                 totalrow.CssClass = "budgetaccounttotal";
  796.                 totalcell = new TableCell();
  797.                 totalcell.Text = "Operating Margin";
  798.                 totalrow.Cells.Add( totalcell );
  799.  
  800.                 totalcell = new TableCell();
  801.                 totalrow.Cells.Add( totalcell );
  802.                 totalcell = new TableCell();
  803.                 totalrow.Cells.Add( totalcell );
  804.                 totalcell = new TableCell();
  805.                 totalrow.Cells.Add( totalcell );
  806.                 totalcell = new TableCell();
  807.                 totalrow.Cells.Add( totalcell );
  808.                 totalcell = new TableCell();
  809.                 totalrow.Cells.Add( totalcell );
  810.  
  811.                 //totalcell = new TableCell();
  812.                 //totalcell.ID = "Account_total_CurrentForecast";
  813.                 //dummmydiv = new HtmlGenericControl("div");
  814.                 //totalcontent.InnerHtml = string.Format("{0:C0}", ObjectCurrentForecast_all);
  815.                 //dummmydiv.Controls.Add(totalcontent);
  816.                 //totalcell.Controls.Add(dummmydiv);
  817.                 //totalrow.Cells.Add(totalcell);
  818.  
  819.                 //BQ1totalupdatepanel = new UpdatePanel();
  820.                 //BQ1totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  821.                 //BQ1totalupdatepanel.ID = "Account_BQ1";
  822.                 totalcontent = new HtmlGenericControl( "div" );
  823.                 totalcell = new TableCell();
  824.                 totalcell.ID = "Account_total_BQ1";
  825.                 totalcontent = new HtmlGenericControl( "div" );
  826.                 totalcontent.ID = "Account_total_BQ1_content";
  827.                 totalcontent.InnerHtml = string.Format( "{0:C0}", BQ1_all );
  828.                 //BQ1totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  829.                 totalcell.Controls.Add( totalcontent );
  830.                 totalrow.Cells.Add( totalcell );
  831.  
  832.                 //BQ2totalupdatepanel = new UpdatePanel();
  833.                 //BQ2totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  834.                 //BQ2totalupdatepanel.ID = "Account_BQ2";
  835.                 totalcell = new TableCell();
  836.                 totalcell.ID = "Account_total_BQ2";
  837.                 totalcontent = new HtmlGenericControl( "div" );
  838.                 totalcontent.ID = "Account_total_BQ2_content";
  839.                 totalcontent.InnerHtml = string.Format( "{0:C0}", BQ2_all );
  840.                 //BQ2totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  841.                 totalcell.Controls.Add( totalcontent );
  842.                 totalrow.Cells.Add( totalcell );
  843.  
  844.                 //BQ3totalupdatepanel = new UpdatePanel();
  845.                 //BQ3totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  846.                 //BQ3totalupdatepanel.ID = "Account_BQ3";
  847.                 totalcell = new TableCell();
  848.                 totalcell.ID = "Account_total_BQ3";
  849.                 totalcontent = new HtmlGenericControl( "div" );
  850.                 totalcontent.ID = "Account_total_BQ3_content";
  851.                 totalcontent.InnerHtml = string.Format( "{0:C0}", BQ3_all );
  852.                 //BQ3totalupdatepanel.ContentTemplateContainer.Controls.Add(totalcontent);
  853.                 totalcell.Controls.Add( totalcontent );
  854.                 totalrow.Cells.Add( totalcell );
  855.  
  856.                 BQ4totalupdatepanel = new UpdatePanel();
  857.                 BQ4totalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  858.                 BQ4totalupdatepanel.ID = "Account_BQ4";
  859.                 totalcell = new TableCell();
  860.                 totalcell.ID = "Account_total_BQ4";
  861.                 totalcontent = new HtmlGenericControl( "div" );
  862.                 totalcontent.ID = "Account_total_BQ4_content";
  863.                 totalcontent.InnerHtml = string.Format( "{0:C0}", BQ4_all );
  864.                 BQ4totalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  865.                 totalcell.Controls.Add( BQ4totalupdatepanel );
  866.                 totalrow.Cells.Add( totalcell );
  867.  
  868.                 totalcell = new TableCell();
  869.                 totalrow.Cells.Add( totalcell );
  870.  
  871.                 if ( accounthaspreviousnote.Count() != 0 ) {
  872.                     totalcell = new TableCell();
  873.                     totalrow.Cells.Add( totalcell );
  874.                 }
  875.  
  876.                 BudgetVariancetotalupdatepanel = new UpdatePanel();
  877.                 BudgetVariancetotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  878.                 BudgetVariancetotalupdatepanel.ID = "Account_BudgetVariance";
  879.                 totalcell = new TableCell();
  880.                 totalcell.ID = "Account_total_BudgetVariance";
  881.                 totalcontent = new HtmlGenericControl( "div" );
  882.                 totalcontent.ID = "Account_total_BudgetVariance_content";
  883.                 totalcontent.InnerHtml = string.Format( "{0:C0}", ObjectBudgetVariance_all );
  884.                 BudgetVariancetotalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  885.                 totalcell.Controls.Add( BudgetVariancetotalupdatepanel );
  886.                 totalrow.Cells.Add( totalcell );
  887.  
  888.                 //ForecastMinusActualtotalupdatepanel = new UpdatePanel();
  889.                 //ForecastMinusActualtotalupdatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
  890.                 //ForecastMinusActualtotalupdatepanel.ID = "Account_ForecastMinusActual";
  891.                 //totalcell = new TableCell();
  892.                 //totalcell.ID = "Account_total_ForecastMinusActual";
  893.                 //totalcontent = new HtmlGenericControl( "div" );
  894.                 //totalcontent.ID = "Account_total_ForecastMinusActual_content";
  895.                 //totalcontent.InnerHtml = string.Format( "{0:C0}", ObjectForecastMinusActual_all );
  896.                 //ForecastMinusActualtotalupdatepanel.ContentTemplateContainer.Controls.Add( totalcontent );
  897.                 //totalcell.Controls.Add( ForecastMinusActualtotalupdatepanel );
  898.                 //totalrow.Cells.Add( totalcell );
  899.  
  900.                 totalcell = new TableCell();
  901.                 totalrow.Cells.Add( totalcell );
  902.  
  903.                 BudgetTable.Rows.Add( totalrow );
  904.  
  905.             }
  906.         } else  //requested account not found; someone probably manually edited queryparam acct
  907.             {
  908.             accountheadercontainer.Visible = false;
  909.             addobjectcodecontainer.Visible = false;
  910.             btnFinish.Visible = false;
  911.             BudgetTable.Visible = false;
  912.             lblDebug.Text = "That's not a valid account for you.";
  913.         }
  914.     } else  //requested account not found; someone probably manually edited queryparam acct
  915.         {
  916.         accountheadercontainer.Visible = false;
  917.         addobjectcodecontainer.Visible = false;
  918.         btnFinish.Visible = false;
  919.         BudgetTable.Visible = false;
  920.         lblDebug.Text = "That's not a valid account for you.";
  921.     }
  922.  
  923.     //lblDebug.Text += acctdropdown.SelectedValue + "sent";
  924. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement