Public Class C1차소요량OD

    Dim T As String = "1차소요량"

    Public Mon As String
    Private ErrMsg As String = "1차에너지소요량 계산되지 않았습니다"
    Private MIdx As Integer

    '//M00 일떄의 합계식이 추가되지않았따
    '//해당부분은 주로 합계식에서 사용된다.

    Public Sub Calc_Summary()

        If MIdx <> 0 Then
            MsgBox("Calc 계산식은 0번만 가능합니다")
            Return
        End If

        Dim i1, i2, i3, i4, i5, i6 As Decimal

        i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0 : i5 = 0
        For i As Integer = 1 To 12
            i1 += Result1o.일차E소요량(i).난방등유
            i2 += Result1o.일차E소요량(i).난방LNG
            i3 += Result1o.일차E소요량(i).난방LPG
            i4 += Result1o.일차E소요량(i).난방지역
            i5 += Result1o.일차E소요량(i).난방전력
        Next
        Me.난방등유 = i1
        Me.난방LNG = i2
        Me.난방LPG = i3
        Me.난방지역 = i4
        Me.난방전력 = i5

        i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0 : i5 = 0 : i6 = 0
        For i As Integer = 1 To 12
            i1 += Result1o.일차E소요량(i).냉방등유
            i2 += Result1o.일차E소요량(i).냉방LNG
            i3 += Result1o.일차E소요량(i).냉방LPG
            i4 += Result1o.일차E소요량(i).냉방지역난방열
            i5 += Result1o.일차E소요량(i).냉방지역냉방열
            i6 += Result1o.일차E소요량(i).냉방전력
        Next
        Me.냉방등유 = i1
        Me.냉방LNG = i2
        Me.냉방LPG = i3
        Me.냉방지역난방열 = i4
        Me.냉방지역냉방열 = i5
        Me.냉방전력 = i6

        i1 = 0 : i2 = 0 : i3 = 0 : i4 = 0 : i5 = 0
        For i As Integer = 1 To 12
            i1 += Result1o.일차E소요량(i).급탕등유
            i2 += Result1o.일차E소요량(i).급탕LNG
            i3 += Result1o.일차E소요량(i).급탕LPG
            i4 += Result1o.일차E소요량(i).급탕지역
            i5 += Result1o.일차E소요량(i).급탕전력
        Next
        Me.급탕등유 = i1
        Me.급탕LNG = i2
        Me.급탕LPG = i3
        Me.급탕지역 = i4
        Me.급탕전력 = i5

    End Sub
    Public Sub New(Optional ByVal pmIdx As Integer = 0)
        MIdx = pmIdx
        Mon = "M" & Format(pmIdx, "00")
    End Sub
    ReadOnly Property 소요량() As Decimal
        Get
            If MIdx = 0 Then
                Dim R As Decimal = 0
                For i As Integer = 1 To 12
                    R += Result1o.일차E소요량(i).소요량
                Next
                Return R
            Else
                Return Me.난방소요량 + Me.냉방소요량 + Me.급탕소요량 + Me.조명소요량 + Me.환기소요량 - (Result1o.생산E(MIdx).태양광전력생산량 * Result1o.E변환계수.전력) - (Result1o.생산E(MIdx).열병합전력생산량 * Result1o.E변환계수.전력)
            End If
        End Get
    End Property
    ReadOnly Property 단위면적() As Decimal
        Get
            If MIdx <> 0 Then
                Return 0
            Else
                Return Me.난방면적 + Me.냉방면적 + Me.급탕면적 + Me.조명면적 + Me.환기면적
            End If

        End Get
    End Property

#Region "난방"
    ReadOnly Property 난방소요량() As Decimal
        Get

            If MIdx = 0 Then
                Dim R As Decimal = Me.난방등유 * Result1o.E변환계수.등유 + Me.난방LNG * Result1o.E변환계수.LNG + _
                Me.난방LPG * Result1o.E변환계수.LPG + Me.난방지역 * Result1o.E변환계수.지역난방 + _
                Me.난방전력 * Result1o.E변환계수.전력

                Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.난방전력 * Result1o.E변환계수.전력
            Else
                Return Me.난방등유 * Result1o.E변환계수.등유 + Me.난방LNG * Result1o.E변환계수.LNG + _
                Me.난방LPG * Result1o.E변환계수.LPG + Me.난방지역 * Result1o.E변환계수.지역난방 + _
                Me.난방전력 * Result1o.E변환계수.전력
            End If
        End Get
    End Property

    ReadOnly Property 난방소요량2() As Decimal   '//140112(?)
        Get

            ' Dim 건물용도 As Integer = CInt(DSET1.tbl_myoun.Select("존분류 <> '0'")(0)("존분류").ToString())
            If MIdx = 0 Then

                If Pub.Program = EProgram.친환경평가 Then
                    '//친환경
                    Dim R As Decimal = Me.난방등유 * Result1o.E변환계수.지역난방 + Me.난방LNG * Result1o.E변환계수.지역난방 + _
                    Me.난방LPG * Result1o.E변환계수.지역난방 + Me.난방지역 * Result1o.E변환계수.지역난방 + _
                    Me.난방전력 * Result1o.E변환계수.전력
                    Try
                        Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                        (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.난방전력 * Result1o.E변환계수.전력
                    Catch ex As Exception

                    End Try

                Else
                    Dim R As Decimal = Me.난방등유 * Result1o.E변환계수.등유 + Me.난방LNG * Result1o.E변환계수.LNG + _
                    Me.난방LPG * Result1o.E변환계수.LPG + Me.난방지역 * Result1o.E변환계수.지역난방 + _
                    Me.난방전력 * Result1o.E변환계수.전력
                    Try
                        Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                        (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.난방전력 * Result1o.E변환계수.전력
                    Catch ex As Exception

                    End Try
                End If


            Else


                If Pub.Program = EProgram.친환경평가 Then
                    Return Me.난방등유 * Result1o.E변환계수.지역난방 + Me.난방LNG * Result1o.E변환계수.지역난방 + _
                    Me.난방LPG * Result1o.E변환계수.지역난방 + Me.난방지역 * Result1o.E변환계수.지역난방 + _
                    Me.난방전력 * Result1o.E변환계수.전력
                Else
                    Return Me.난방등유 * Result1o.E변환계수.등유 + Me.난방LNG * Result1o.E변환계수.LNG + _
                    Me.난방LPG * Result1o.E변환계수.LPG + Me.난방지역 * Result1o.E변환계수.지역난방 + _
                    Me.난방전력 * Result1o.E변환계수.전력
                End If



            End If
        End Get
    End Property

    Property 난방등유() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("난방등유"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("난방등유") = value
            End If
        End Set
    End Property
    Property 난방LNG() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("난방LNG"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("난방LNG") = value
            End If
        End Set
    End Property
    Property 난방LPG() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("난방LPG"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("난방LPG") = value
            End If
        End Set
    End Property
    'Property 난방펠렛() As Decimal
    '    Get
    '        Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
    '        If DR.GetUpperBound(0) = -1 Then
    '            MsgBox(ErrMsg)
    '            Return 0
    '        Else
    '            Return TOSG(T,DR(0)("난방펠렛"))
    '        End If
    '    End Get
    '    Set(ByVal value As Decimal)
    '        Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
    '        If DR.GetUpperBound(0) = -1 Then
    '            MsgBox(ErrMsg)
    '        Else
    '            DR(0)("난방펠렛") = value
    '        End If
    '    End Set
    'End Property
    Property 난방지역() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("난방지역"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("난방지역") = value
            End If
        End Set
    End Property
    Property 난방전력() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("난방전력"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("난방전력") = value
            End If
        End Set
    End Property
    ReadOnly Property 난방면적() As Decimal
        Get
            If Result1o.사용면적.H = 0 Then
                Return 0
            Else
                Return Me.난방소요량 / Result1o.사용면적.H
            End If
        End Get
    End Property

    ReadOnly Property 난방면적2() As Decimal
        Get
            If Result1o.사용면적.H = 0 Then
                Return 0
            Else
                Return Me.난방소요량2 / Result1o.사용면적.H
            End If
        End Get
    End Property
#End Region

#Region "냉방"
    ReadOnly Property 냉방소요량() As Decimal
        Get
            If MIdx = 0 Then
                Dim R As Decimal = Me.냉방등유 * Result1o.E변환계수.등유 + Me.냉방LNG * Result1o.E변환계수.LNG + _
                Me.냉방LPG * Result1o.E변환계수.LPG + Me.냉방지역난방열 * Result1o.E변환계수.지역난방 + _
                Me.냉방지역냉방열 * Result1o.E변환계수.지역냉방 + Me.냉방전력 * Result1o.E변환계수.전력

                Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.냉방전력 * Result1o.E변환계수.전력
            Else
                Return Me.냉방등유 * Result1o.E변환계수.등유 + Me.냉방LNG * Result1o.E변환계수.LNG + _
                Me.냉방LPG * Result1o.E변환계수.LPG + Me.냉방지역난방열 * Result1o.E변환계수.지역난방 + _
                Me.냉방지역냉방열 * Result1o.E변환계수.지역냉방 + Me.냉방전력 * Result1o.E변환계수.전력
            End If
        End Get
    End Property
    Property 냉방등유() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("냉방등유"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("냉방등유") = value
            End If
        End Set
    End Property
    Property 냉방LNG() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("냉방LNG"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("냉방LNG") = value
            End If
        End Set
    End Property
    Property 냉방펠렛() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("냉방펠렛"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("냉방펠렛") = value
            End If
        End Set
    End Property
    Property 냉방LPG() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("냉방LPG"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("냉방LPG") = value
            End If
        End Set
    End Property
    Property 냉방지역난방열() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("냉방지역"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("냉방지역") = value
            End If
        End Set
    End Property
    Property 냉방지역냉방열() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("냉방지역2"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("냉방지역2") = value
            End If
        End Set
    End Property
    Property 냉방전력() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("냉방전력"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("냉방전력") = value
            End If
        End Set
    End Property
    ReadOnly Property 냉방면적() As Decimal
        Get
            If Result1o.사용면적.C = 0 Then
                Return 0
            Else
                Return Me.냉방소요량 / Result1o.사용면적.C
            End If
        End Get
    End Property
#End Region

#Region "급탕"
    ReadOnly Property 급탕소요량() As Decimal
        Get
            If MIdx = 0 Then
                Dim R As Decimal = Me.급탕등유 * Result1o.E변환계수.등유 + Me.급탕LNG * Result1o.E변환계수.LNG + _
                Me.급탕LPG * Result1o.E변환계수.LPG + Me.급탕지역 * Result1o.E변환계수.지역난방 + _
                Me.급탕전력 * Result1o.E변환계수.전력

                Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.급탕전력 * Result1o.E변환계수.전력
            Else
                Return Me.급탕등유 * Result1o.E변환계수.등유 + Me.급탕LNG * Result1o.E변환계수.LNG + _
                Me.급탕LPG * Result1o.E변환계수.LPG + Me.급탕지역 * Result1o.E변환계수.지역난방 + _
                Me.급탕전력 * Result1o.E변환계수.전력
            End If
        End Get
    End Property

    ReadOnly Property 급탕소요량2() As Decimal
        Get
            ' Dim 건물용도 As Integer = CInt(DSET1.tbl_myoun.Select("존분류 <> '0'")(0)("존분류").ToString())


            If MIdx = 0 Then
                If Pub.Program = EProgram.친환경평가 Then
                    Dim R As Decimal = Me.급탕등유 * Result1o.E변환계수.지역난방 + Me.급탕LNG * Result1o.E변환계수.지역난방 + _
                      Me.급탕LPG * Result1o.E변환계수.지역난방 + Me.급탕지역 * Result1o.E변환계수.지역난방 + _
                      Me.급탕전력 * Result1o.E변환계수.전력
                    Try
                        Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                        (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.급탕전력 * Result1o.E변환계수.전력
                    Catch ex As Exception

                    End Try
                Else
                    Dim R As Decimal = Me.급탕등유 * Result1o.E변환계수.등유 + Me.급탕LNG * Result1o.E변환계수.LNG + _
                    Me.급탕LPG * Result1o.E변환계수.LPG + Me.급탕지역 * Result1o.E변환계수.지역난방 + _
                    Me.급탕전력 * Result1o.E변환계수.전력
                    Try
                        Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                        (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.급탕전력 * Result1o.E변환계수.전력
                    Catch ex As Exception

                    End Try
                End If

            Else

                If Pub.Program = EProgram.친환경평가 Then
                    Return Me.급탕등유 * Result1o.E변환계수.지역난방 + Me.급탕LNG * Result1o.E변환계수.지역난방 + _
                    Me.급탕LPG * Result1o.E변환계수.지역난방 + Me.급탕지역 * Result1o.E변환계수.지역난방 + _
                    Me.급탕전력 * Result1o.E변환계수.전력
                Else
                    Return Me.급탕등유 * Result1o.E변환계수.등유 + Me.급탕LNG * Result1o.E변환계수.LNG + _
                    Me.급탕LPG * Result1o.E변환계수.LPG + Me.급탕지역 * Result1o.E변환계수.지역난방 + _
                    Me.급탕전력 * Result1o.E변환계수.전력
                End If

            End If
        End Get
    End Property


    Property 급탕등유() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("급탕등유"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("급탕등유") = value
            End If
        End Set
    End Property
    Property 급탕LNG() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("급탕LNG"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("급탕LNG") = value
            End If
        End Set
    End Property
    Property 급탕펠렛() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("급탕펠렛"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("급탕펠렛") = value
            End If
        End Set
    End Property
    Property 급탕LPG() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("급탕LPG"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("급탕LPG") = value
            End If
        End Set
    End Property
    Property 급탕지역() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("급탕지역"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("급탕지역") = value
            End If
        End Set
    End Property
    Property 급탕전력() As Decimal
        Get
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
                Return 0
            Else
                Return TOSG(T, DR(0)("급탕전력"))
            End If
        End Get
        Set(ByVal value As Decimal)
            Dim DR() As DSR.에너지소요량1Row = CType(DSETR1.에너지소요량1.Select("mon='" & Mon & "'"), DSR.에너지소요량1Row())
            If DR.GetUpperBound(0) = -1 Then
                MsgBox(ErrMsg)
            Else
                DR(0)("급탕전력") = value
            End If
        End Set
    End Property
    ReadOnly Property 급탕면적() As Decimal
        Get
            If Result1o.사용면적.W = 0 Then
                Return 0
            Else
                Return Me.급탕소요량 / Result1o.사용면적.W
            End If
        End Get
    End Property
    ReadOnly Property 급탕면적2() As Decimal
        Get
            If Result1o.사용면적.W = 0 Then
                Return 0
            Else
                Return Me.급탕소요량2 / Result1o.사용면적.W
            End If
        End Get
    End Property
#End Region

#Region "조명부분(읽기전용)"
    ReadOnly Property 조명소요량() As Decimal
        Get
            If MIdx = 0 Then
                Dim R As Decimal = 조명전력 * Result1o.E변환계수.전력

                Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.조명전력 * Result1o.E변환계수.전력
            Else
                Return 조명전력 * Result1o.E변환계수.전력
            End If
        End Get
    End Property
    ReadOnly Property 조명전력() As Decimal
        Get
            If MIdx = 0 Then   '//합계필드라면 12월의 합계를 반환한다.
                Dim i1 As Decimal = 0
                For i As Integer = 1 To 12
                    i1 += Result1o.일차E소요량(i).조명전력
                Next
                Return i1
            Else
                Return Result1o.E소요량(Me.MIdx).조명S
            End If
        End Get
    End Property
    ReadOnly Property 조명면적() As Decimal
        Get
            If Result1o.사용면적.L = 0 Then
                Return 0
            Else
                Return Me.조명소요량 / Result1o.사용면적.L
            End If
        End Get
    End Property

#End Region

#Region "환기부분(읽기전용)"
    ReadOnly Property 환기소요량() As Decimal
        Get
            If MIdx = 0 Then
                Dim R As Decimal = 환기전력 * Result1o.E변환계수.전력

                Return R - (Result1o.생산E(0).태양광전력생산량 + Result1o.생산E(0).열병합전력생산량) / _
                (Me.난방전력 + Me.냉방전력 + Me.급탕전력 + Me.조명전력 + Me.환기전력) * Me.환기전력 * Result1o.E변환계수.전력
            Else
                Return 환기전력 * Result1o.E변환계수.전력
            End If
        End Get
    End Property
    ReadOnly Property 환기전력() As Decimal
        Get
            If MIdx = 0 Then   '//합계필드라면 12월의 합계를 반환한다.
                Dim i1 As Decimal = 0
                For i As Integer = 1 To 12
                    i1 += Result1o.일차E소요량(i).환기전력
                Next
                Return i1
            Else
                Return Result1o.E소요량(Me.MIdx).환기S
            End If
        End Get
    End Property
    ReadOnly Property 환기면적() As Decimal
        Get
            If Result1o.사용면적.V = 0 Then
                Return 0
            Else
                Return Me.환기소요량 / Result1o.사용면적.V
            End If
        End Get
    End Property
#End Region


End Class
