Public Class Report_검토서2

    Dim 신재생에너지 As Decimal = 0
    Dim 난방에너지 As Decimal = 0
    Dim 냉방에너지 As Decimal = 0
    Dim 급탕에너지 As Decimal = 0
    Dim 조명에너지 As Decimal = 0
    Dim 환기에너지 As Decimal = 0
    Dim 합계 As Decimal = 0


    Private Sub Frm_v20091231_Result_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        '  Me.DSR.TReqUse.Merge(DSETR1.TReqUse)
        Me.DSR.ExtReport.Merge(DSETR1.ExtReport)


        Dim addmulti As Double = 1.0
        Dim Multi(5) As Double
        Dim Total1(5) As Double
        Dim Total2 As Double    '//total


        If Program = EProgram.총량평가 Then

            For Each Dr0 As DS.tbl_typeRow In DSET1.tbl_type.Rows
                'Dim multi As Double = 1.0
                Select Case Dr0.시설용도

                    Case "0013" '구내식당-0013
                        Multi(0) = 1.571
                        Multi(1) = 1.571
                        Multi(2) = 0.024
                        Multi(3) = 1.286
                        Multi(4) = 1.571
                    Case "0014" '전산실-0014
                        Multi(0) = 0.503
                        Multi(1) = 0.196
                        Multi(2) = 0.685
                        Multi(3) = 0.514
                        Multi(4) = 0.314
                    Case "0017" '병실-0017
                        Multi(0) = 0.314
                        Multi(1) = 0.314
                        Multi(2) = 0.251
                        Multi(3) = 0.514
                        Multi(4) = 0.314
                    Case "0016" '객실-0016
                        Multi(0) = 0.685
                        Multi(1) = 0.685
                        Multi(2) = 0.251
                        Multi(3) = 1.541
                        Multi(4) = 0.685
                    Case "0015" '초중고
                        Multi(0) = 1.964
                        Multi(1) = 1.964
                        Multi(2) = 1.25
                        Multi(3) = 1.875
                        Multi(4) = 1.964
                    Case "0018" '강의실
                        Multi(0) = 2.037
                        Multi(1) = 2.037
                        Multi(2) = 1.667
                        Multi(3) = 2.5
                        Multi(4) = 2.037
                    Case "0019" '체육시설
                        Multi(0) = 0.611
                        Multi(1) = 0.611
                        Multi(2) = 0.114
                        Multi(3) = 0.5
                        Multi(4) = 0.611
                    Case Else
                        Multi(0) = 1.0
                        Multi(1) = 1.0
                        Multi(2) = 1.0
                        Multi(3) = 1.0
                        Multi(4) = 1.0

                End Select

                Total1(0) += Dr0.면적 / Multi(0)
                Total1(1) += Dr0.면적 / Multi(1)
                Total1(2) += Dr0.면적 / Multi(2)
                Total1(3) += Dr0.면적 / Multi(3)
                Total1(4) += Dr0.면적 / Multi(4)

                Total2 += Dr0.면적

            Next


            For i As Integer = 0 To 4
                If Total2 = 0 Then
                    Multi(i) = 1
                Else
                    Multi(i) = Total2 / Total1(i) '//251002 수정
                End If
            Next


        Else
            Multi(0) = 1.0
            Multi(1) = 1.0
            Multi(2) = 1.0
            Multi(3) = 1.0
            Multi(4) = 1.0
        End If

        Dim a1 As Double = Result1o.일차E소요량(0).난방면적 * Multi(0)
        Dim a2 As Double = Result1o.일차E소요량(0).냉방면적 * Multi(1)
        Dim a3 As Double = Result1o.일차E소요량(0).급탕면적 * Multi(2)
        Dim a4 As Double = Result1o.일차E소요량(0).조명면적 * Multi(3)
        Dim a5 As Double = Result1o.일차E소요량(0).환기면적 * Multi(4)


        DSR.ExtReport.Rows(0)("c077") = a1.ToString("N1")
        DSR.ExtReport.Rows(0)("c078") = a2.ToString("N1")
        DSR.ExtReport.Rows(0)("c079") = a3.ToString("N1")
        DSR.ExtReport.Rows(0)("c080") = a4.ToString("N1")
        DSR.ExtReport.Rows(0)("c081") = a5.ToString("N1")
        DSR.ExtReport.Rows(0)("c082") = (a1 + a2 + a3 + a4 + a5).ToString("N1")
        DSR.ExtReport.AcceptChanges()

        Dim drDesc As DS.tbl_DescRow = DSET1.tbl_Desc.Rows(0)
        Dim params As New List(Of Microsoft.Reporting.WinForms.ReportParameter)
        params.Add(New Microsoft.Reporting.WinForms.ReportParameter("param1", drDesc.민간구분))
        Me.ReportViewer1.LocalReport.SetParameters(params.ToArray)


        Me.ReportViewer1.LocalReport.SetParameters(params)
        Me.ReportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth
        Me.ReportViewer1.ZoomPercent = 100
        Me.ReportViewer1.RefreshReport()
    End Sub

End Class