'Business Report Engine
'Version .03
'How to document the code: http://tutorial.programming4.us/windows_7/Visual-Basic-2010---Documenting-the-Source-Code---Implementing-XML-Comments.aspx
'See General Business Reporting Application Profile: http://www.xbrlsite.com/2014/Library/GeneralBusinessReportingProfile-2013-11-30.pdf
'See NOLAP Application Profile: http://www.xbrlsite.com/2014/Library/NOLAP-2014-07-01.pdf
''' Representation of the entire business report
Public Class BusinessReport
Public Facts As Collection
Public Components As Collection
Public ParentheticalExplainations As Collection
Public BusinessRules As Collection
Public ReportElements As Collection
Private m_Facts As Collection
''' Loads a business report into working memory from the XML model format.
''' This loads the representation format XML
Public Sub Load()
End Sub
''' Loads a business report into working memory from the XBRL format.
''' This loads the XBRL format, if the XML model format is not available
Public Sub LoadXBRL()
End Sub
''' Saves a business report into XML model format for storage in local file system.
''' This saves what is currently in memory to the local file system.
Public Sub Save()
End Sub
''' Saves a business report into XML model format for storage to a web service which supports this format.
''' This saves what is currently in memory to a web service API which supports this workflow.
Public Sub SaveToWebService()
End Sub
''' Exports what is in memory to a serialization which complies with the XBRL technical syntax.
''' This saves what is currently in memory to a web service API which supports this workflow.
Public Sub ExportXBRL()
End Sub
''' Generates information which is then used to render the business report.
''' This rendering information can be sent of a GUI control which specializes in rendering this format.
Public Sub Render()
End Sub
''' Adds a fact to the business report
''' Not sure if you want to allow a fact to be added to a business report; perhaps facts should ONLY be allowed to be added to a component
Public Sub AddFact()
End Sub
''' Deletes fact from the business report
Public Sub DeleteFact()
End Sub
''' Adds a component to business report
Public Sub AddComponent()
End Sub
''' Deletes a component from the business report
Public Sub DeleteComponent()
End Sub
''' Adds a parenthetical explaination to the business report
Public Sub AddParentheticalExplaination()
End Sub
''' Deletes a parenthetical explaination from the business report
Public Sub DeleteParentheticalExplaination()
End Sub
'Not sure if this is appropriate, most business rules are related to a component
'However, some business rules are not related to a component
''' Adds a business rule to the business report
Public Sub AddBusinessRule()
End Sub
''' Deletes a business rule from the business report
Public Sub DeleteBusinessRule()
End Sub
''' Adds a report element to the business report
''' Not sure I really want to do this; report elements always fit into a component (or should). But maybe this would be good to add a report element which will eventually be added to a component.
Public Sub AddReportElement()
End Sub
''' Deletes a report element from the business report
Public Sub DeleteReportElement()
End Sub
''' Validates the entire business report
Public Sub Validate()
End Sub
End Class
''' Class for a component of a business report
Public Class Component
Public Network As String
Public Table As String
Public FactTable As Collection
Public ModelStructure As Collection
''' Validates the individual component
Public Sub Validate()
End Sub
''' Generates information which is then used to render the component.
''' This rendering information can be sent of a GUI control which specializes in rendering this format.
Public Sub Render()
End Sub
End Class
''' Class for a fact which is contained within a component which is part of a business report
Public Class Fact
Public Characteristics As Collection
''' A value, or fact value, could be NUMERIC or NONNUMERIC
Public Value As VariantType
Public Rounding As String
Public Units As String
Public ParantheticalExplainations As Collection
''' Adds a characteristic to the collection of characteristics of a fact
Public Sub AddCharacteristic()
End Sub
''' Deletes a characteristic from the collection of characteristics of a fact
Public Sub DeleteCharacteristic()
End Sub
''' Adds a parenthetical explaination to the collection of parenthetical explainations of a fact
Public Sub AddParantheticalExplaination()
End Sub
''' Deletes a parenthetical explaination from the collection of parenthetical explainations of a fact
Public Sub DeleteParantheticalExplaination()
End Sub
''' Updates or changes the value of a fact to a newly provided value
Public Sub UpdateValue()
End Sub
''' Updates or changes the rounding of a fact to a newly provided value
''' Rounding is the same thing as 'decimals' in XBRL
Public Sub UpdateRouding()
End Sub
''' Updates or changes the units of a fact to a newly provided value
Public Sub UpdateUnits()
End Sub
''' Validates the syntax and semantics of a fact
Public Sub Validate()
'Validates the fact
End Sub
End Class
''' Class for a parenthetical explaination which is part of a fact contained within a business report
''' The syntax of a parenthetical explaination is an XBRL footnote
Public Class ParentheticalExplaination
Public Identifier As String
Public Category As String
Public Value As String
''' Validates a parenthetical explaination
Public Sub Validate()
End Sub
End Class
''' Class for a characteristic which which is a part of a fact
''' Other terms for characteristic are ASPECT or DIMENSION. However, the ENTITY and PERIOD parts of a context are also characteristics. ENTITY and PERIOD are defined as ASPECTS per the XBRL Abstract Model 2.0
Public Class Characteristic
Public Name As String
Public Member As String
End Class
''' Class for a busiess rule
''' Business rules can be part of a COMPONENT or they can be part of a BUSINESS REPORT. For example Assets=LiabilitiesAndEquity is NOT part of COMPONENT rather it is associated with the BUSINESS REPORT
Public Class BusinessRule
Public Identifier As String
Public Category As String
Public Rule As String
''' Validates the business rule
Public Sub Validate()
End Sub
End Class
''' Allowed values for a ConceptArrangementPattern
''' NOTE that business users MAY need to add additional concept arrangement patterns. For more information see http://www.xbrlsite.com/DigitalFinancialReporting/Metapatterns/2013-05-15/
Enum ConceptArrangementPattern
RollUp
RollForward
Adjustment
Variance
Hierarchy
ComplexComputation
End Enum
''' Allowed values for a MemberArrangementPattern
''' NOTE that business users MAY need to add additional member arrangement patterns. NOTE that this needs a lot of work. For more information see http://www.xbrlsite.com/DigitalFinancialReporting/MemberArrangementPatterns/2013-05-15/ and see http://financialreportontology.wikispaces.com/Relationship.
Enum MemberArrangementPattern
WholePart
CollectionMember
ObjectStuff
End Enum
''' Unclear about this. Could be redundant.
Enum BusinessRuleCategory
RollUp
RollForward
MemberAggregation
Adjustment
Variance
End Enum
''' Class for a ReportElement which is part of the model or representation structure of a business report
''' Note that a business user never directly works with the notion of a report element. Business users work with Networks, Tables, Axis, Member, LineItems, Abstract or Concept. Every report element fits into one of those seven categories
Public Class ReportElement
''' Uniquely identifies the report element
''' Every report element requires an identifier. The identifier is automatically managed by the application and is read only.
Private Identifier As String
''' Name the report element
''' Every report element requires an name. NOTE that the name of a Network is equivalent to the URI of the Network
Public Name As String
''' Standard label of a report element
''' Every report element requires a label. The standard label is also part of the label collection. The Network definition is equivalent to the label.
Public StandardLabel As String
''' Documentation or definition of a report element
''' Every report element requires documentation. The documentation is also part of the label collection.
Public Documentation As String
''' Report element class or object type or category.
''' Every report element is either a: Network, Table, Axis, Member, LineItems, Abstract, Concept.
Public ReportElementClass As String
''' Adds a label to a report element
Public Sub AddLabel()
End Sub
''' Deletes a label from a report element
Public Sub DeleteLabel()
End Sub
''' Validates a report element.
Public Sub Validate()
'Validates the report element
End Sub
End Class
''' Allowed values for ReportElementClass
''' This might not be totally correct, but I think it is. LineItems is really a characteristic. All Axis are characteristics. Entity and Period, which are NOT in the model are also characteristics.
Enum ReportElementClasses
''' A network is a set of report elements.
''' A network is the resolved base set of extended links within an XBRL terms. A Network has a NAME and a LABEL which are equivalent to the Network URI and Definition respectively.
Network
''' A TABLE is the same thing as an XBRL Dimensions Hypercube. Other terms used to describe this are matrix, cube, array.
''' A Table has only a NAME and LABEL. The type attrubite is always set to "string", the periodType is always set to "duration", and abstract is always TRUE.
Table 'Hypercube
''' An AXIS is the same thing as an XBRL Dimensions Dimension. Other terms used to describe this are aspect and characteristic.
''' A AXIS has only a NAME and LABEL. The type attrubite is always set to "nonnum:domainItemType", the periodType is always set to "duration", and abstract is always TRUE.
Axis 'Dimension, Aspect, Characteristic
''' An MEMBER is the same thing as an XBRL Dimensions member.
''' A MEMBER has only a NAME and LABEL. The type attrubite is always set to "string", the periodType is always set to "duration", and abstract is always TRUE.
Member
''' A LineItems is the same thing as an XBRL Dimensions Primary Item.
''' A LINEITEMS has only a NAME and LABEL. The type attrubite is always set to "string", the periodType is always set to "duration", and abstract is always TRUE.
LineItems 'Primary items
''' An CONCEPT is the same thing as an XBRL Dimensions Primary Item which has an abstract attribute value equal to FALSE.
''' A CONCEPT has a NAME, LABEL, DataType, PeriodType, and an optional BALANCE property. The type attrubite is always set to "string", the periodType is always set to "duration", and abstract is always TRUE.
Concept
''' An ABSTRACT is the same thing as an XBRL Dimensions Primary Item which has an abstract attribute value equal to TRUE.
''' A LINEITEMS has only a NAME and LABEL. The type attrubite is always set to "string", the periodType is always set to "duration", and abstract is always TRUE.
Abstract
End Enum
''' Equivalent to XBRL Network
Public Class Network
Inherits ReportElement
End Class
''' Equivalent to XBRL Dimensions hypercube
''' NOTE that in this model, EVERY report element exists with a Table. That Table may be explicily defined or implied.
Public Class Table 'This is a HYPERCUBE
Inherits ReportElement
End Class
''' Equivalent to XBRL Dimensions dimension
Public Class Axis
Inherits ReportElement
End Class
''' Equivalent to XBRL Dimensions member
''' NOTE that many times the root member is erroneously referred to as a DOMAIN. This is incorrect. A root member is a member. A domain is the set all members of an Axis.
Public Class Member
Inherits ReportElement
End Class
''' Equivalent to XBRL Dimensions set of primary items
Public Class LineItems
Inherits ReportElement
End Class
''' Equivalent to XBRL Dimensions primary item
Public Class Concept
Inherits ReportElement
Public DataType As String
Public BalanceType As String
Public PeriodType As String
End Class
''' Equivalent to XBRL Network
Public Class Abstract
Inherits ReportElement
End Class
''' Equivalent to XBRL Network
Public Class Label
Public Name As String
Public LabelRole As String
Public Value As String
End Class
''' The RepresentationStructure provides the relations between the report elements which make up the structure of a component of a business report
''' The representation structure, or also called model structure, is NOT the same thing as XBRL presentation relations. A representation structure is a composite of the XBRL presentation, XBRL calculation, XBRL definition relations into ONE set of relations which can then be used to autogenerate the XBRL presentation, calculation, and definition relations.
Public Class RepresentationStructure
Public FromReportElement As String
Public ToReportElement As String
Public RelationType As String
Public Order As Integer
Public NegateValue As String
Public ReportElements As Collection
''' Validates the representation structure.
Public Sub Validate()
End Sub
End Class
''' The PresentationStructure is optional and provides the XBRL presentation relations should a business user choose to manage those relations manually, rather than allow the application to manage the relations
''' The PresentationStructure is totally optional. It is only used when a business user chooses to have more control over how XBRL presentation relations are articulated.
Public Class PresentationStructure
Public FromReportElement As String
Public ToReportElement As String
Public RelationType As String
Public PreferredLabel As String
Public Order As Integer
Public reportReportElementselements As Collection
''' Validates the presentation structure
Public Sub Validate()
'Validates the presentation structure
End Sub
End Class