﻿Imports RGBC_Forecast.SystemFunctions
Imports RGBC_Forecast.ProjectFunctions
Imports System.Threading
Imports System.Globalization

Partial Public Class Home
  Inherits System.Web.UI.Page

  Private Shared Report As BrandReport

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then

      'Math.Round(CDbl("15,098.24"), 0, MidpointRounding.AwayFromZero) & " : " & Math.Round(15098.2355, 0, MidpointRounding.AwayFromZero)

      Dim strReport As String = "Forecast Report by Focus Brands"
      Dim dr As DataRow

      Dim arg As New Collection

      dr = db.getRow("SELECT * FROM mstPeriod WHERE strPeriod = '" & Date.Today.ToString("yyyyMM") & "'")
      If Not dr Is Nothing Then
        arg.Add(dr!intFiscalYear, "FinYear")
        arg.Add(0, "BrandID")
        arg.Add(0, "PrincipalID")
        arg.Add(False, "blnDecimal")

        'dr = db.getRow("SELECT COUNT(*) as intBrands FROM mstBrand WHERE refBrandManagerID = " & Session.Item("USER")!UserID)
        'If dr!intBrands > 0 Then
        '  arg.Add(Session.Item("USER")!UserID, "BrandManagerID")
        '  arg.Add(-1, "DailyReportGroupingID") ' GDaily: -1 = All
        'Else
        arg.Add(0, "BrandManagerID")
        arg.Add(3, "DailyReportGroupingID") ' GDaily: 3 = Focus Brands
        'End If

        'new rpt object
        lblReportName.Text = strReport
        'Report = New BrandReport(strReport, arg)

        'Report.getForecastReport(phReport)
      End If

    End If
  End Sub

  Private Sub Page_PreRenderComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRenderComplete

    Dim imgLoading As WebControls.Image

    imgLoading = Page.Master.FindControl("imgLoading")

    imgLoading.CssClass = "invisible"
  End Sub
End Class