' SummaryPage2_AccountSecuritisationRepaymentsProcess_ItemSummary
Option Explicit On
Option Strict On

' #################################################################
' Securitisation Repayment summary

' Version: 2.00 (26/08/2013)

' Usage: Securitisation Repayments wizard
' #################################################################

' Objects
Private mAccountSecuritisationRepaymentsProcess As finAccountSecuritisationRepaymentsProcess
Private mAccountSecuritisationRepaymentsProcessItem As finAccountSecuritisationRepaymentsProcessItem

Public Function Main(source As Object,
                     eventId As String,
                     eventArgs As ISKeyValueList,
                     ByRef handled As Boolean,
                     ByRef returnValues As ISKeyValueList,
                     ByRef text As String) As Boolean

  Dim Index As Integer

  ' Assume Success
  Main = True

  ' Initialise
  mAccountSecuritisationRepaymentsProcess = DirectCast(source, finAccountSecuritisationRepaymentsProcess)
  Index = eventArgs.GetInteger("Index")
  If Index >= 0 AndAlso Index < mAccountSecuritisationRepaymentsProcess.Count Then
    mAccountSecuritisationRepaymentsProcessItem = mAccountSecuritisationRepaymentsProcess(Index)
  End If

  Select Case eventId
    Case ""
      ' Main event, i.e., return main page content
      Main = CreatePage(text)
  End Select

End Function

Private Function CreatePage(ByRef html As String) As Boolean

  Dim Ok As Boolean
  Dim sb As finHtmlSummaryPage2StringBuilder

  ' Assume Success
  Ok = True

  ' Initialise
  sb = finBL.CreateHtmlSummaryPage2StringBuilder()

  ' Initialise HTML
  With sb
    .Initialise(ScriptInfo)
    .HtmlHeaderBegin("", isefinSummaryPageStyle.Blocks)
    .HtmlHeaderEnd()
  End With

  ' Begin Section
  sb.SectionColumnsBegin()

  ' Begin Column 1
  sb.ColumnBegin("100%")

  ' Summary
  sb.BlockBegin("Summary", "", isefinSummaryPageBlockHeadingStyle.Main, False)
  sb.SummaryTablesAppend(finBL.SummaryPageStandardBlocks.AccountSecuritisationRepaymentsProcessItem_Summary(ScriptInfo, mAccountSecuritisationRepaymentsProcessItem, False))
  sb.BlockEnd()

  ' End Column 1
  sb.ColumnEnd()

  ' End Section
  sb.SectionColumnsEnd()

  ' Finalise HTML
  sb.HtmlFinalise()

  ' Resolve Templates
  html = sb.ToString(True)

  Return Ok

End Function