Public Class Frm_v20091231_Report_auth

#Region "data Base 변경여부및 적용방법"

     '''변경된내용을적용한다.
    Public Overrides Function AcceptChanged() As Boolean

        Return True
    End Function

    '''변경된내용이있다면 취소한다.
    Public Overrides Function RejectChanged() As Boolean

        Return True
    End Function

    '''데이터에변형이있었는가?
    Public Overrides Function HasChanged() As Boolean
        Return False
    End Function


#End Region



    Private Sub Frm_v20091231_Result_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.DSR.TReqUse.Merge(DSETR.TReqUse)
        MakeInfoTable()
        MakeGraphTable()


        Me.ReportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth
        Me.ReportViewer1.ZoomPercent = 100
        Me.ReportViewer1.RefreshReport()

    End Sub
    Private Sub MakeInfoTable()

        '//일반정보확인
        Dim Dr As DSR.Graph_InfoRow = Me.DSR.Graph_Info.NewGraph_InfoRow
        Dr.name = CType(DSET.tbl_Desc.Rows(0), DS.tbl_DescRow).buildname
        Dr.year = CType(DSET.tbl_Desc.Rows(0), DS.tbl_DescRow).reqdate.Substring(0, 4)
        Dr.juso = CType(DSET.tbl_Desc.Rows(0), DS.tbl_DescRow).buildaddr
        Dr.chung = CType(DSET.tbl_Desc.Rows(0), DS.tbl_DescRow).builds1 & "/" & CType(DSET.tbl_Desc.Rows(0), DS.tbl_DescRow).builds2
        Dr.myoun = CType(DSET.tbl_Desc.Rows(0), DS.tbl_DescRow).buildm23
        Dr.ydo = ""   '//용도는 딱히 필드가없다.

        Dr.i1 = "[인증번호]"
        Dr.i2 = "[인증기관]"
        Dr.i3 = "[운영기관]"

        Dr.co2 = 80  '//co2배출량값

        Me.DSR.Graph_Info.AddGraph_InfoRow(Dr)
        Me.DSR.Graph_Info.AcceptChanges()

        '//용도별 Co2 배출량 데이터 생성
        Dim Dr2 As DSR.Graph_Info_dataRow = Me.DSR.Graph_Info_data.NewGraph_Info_dataRow
        Dr2.난방소요 = Result.E소요량(0).난방면적
        Dr2.급탕소요 = Result.E소요량(0).급탕면적
        Dr2.냉방소요 = Result.E소요량(0).냉방면적
        Dr2.조명소요 = Result.E소요량(0).조명면적
        Dr2.환기소요 = Result.E소요량(0).환기면적

        Dr2.난방소요1 = Result.일차E소요량(0).난방면적
        Dr2.급탕소요1 = Result.일차E소요량(0).급탕면적
        Dr2.냉방소요1 = Result.일차E소요량(0).냉방면적
        Dr2.조명소요1 = Result.일차E소요량(0).조명면적
        Dr2.환기소요1 = Result.일차E소요량(0).환기면적

        Dr2.난방co2 = Result.Co2발생량(0).난방면적
        Dr2.급탕co2 = Result.Co2발생량(0).급탕면적
        Dr2.냉방co2 = Result.Co2발생량(0).냉방면적
        Dr2.조명co2 = Result.Co2발생량(0).조명면적
        Dr2.환기co2 = Result.Co2발생량(0).환기면적

        Me.DSR.Graph_Info_data.AddGraph_Info_dataRow(Dr2)
        Me.DSR.Graph_Info_data.AcceptChanges()

    End Sub
    Private Sub MakeGraphTable()
        'If DSR.TReqUse.Rows.Count < 1 Then Return

        'Dim Dr As DSR.Graph_ReqRow
        'For Gubun As Short = 0 To 1
        '    For mon As Short = 1 To 12
        '        If Gubun = 0 Then   '//6번
        '            Dr = Me.DSR.Graph_Req.NewGraph_ReqRow
        '            Dr.Gubun = "난방에너지요구량"
        '            Dr.Mon = Format(mon, "0") & "월"
        '            Dr.Req = Ru(6, "M" & Format(mon, "00"))
        '            Me.DSR.Graph_Req.Rows.Add(Dr)
        '        Else    '//11번
        '            Dr = Me.DSR.Graph_Req.NewGraph_ReqRow
        '            Dr.Gubun = "냉방에너지요구량"
        '            Dr.Mon = Format(mon, "0") & "월"
        '            Dr.Req = Ru(11, "M" & Format(mon, "00"))
        '            Me.DSR.Graph_Req.Rows.Add(Dr)
        '        End If
        '    Next
        'Next

        ''//연간에너지요구량및소요량
        ''//Graph_requse gubun,type,
        ''           1차에너지소요량	에너지소요량	에너지요구량	
        ''신재생에너지                   (-57)
        ''난방에너지	106	91.87445415	56.14013248	
        ''냉방에너지	155.3678094	119.8832527	40.83005443	
        ''급탕에너지	42.6421498	14.21404993	14.6	
        ''조명에너지	144.2220948	48.07403159	73.08380082	
        ''환기에너지	61.68818331	20.56272777		

        'Dim 신재생에너지 as decimal
        'Dim 난방에너지 as decimal
        'Dim 냉방에너지 as decimal
        'Dim 급탕에너지 as decimal
        'Dim 조명에너지 as decimal
        'Dim 환기에너지 as decimal

        'Dim Drow As DSR.TReqUseRow = CType(DSETR.TReqUse.Rows(56 - 1), DSR.TReqUseRow)
        'Dim L56 as decimal = Drow.M01 + Drow.M02 + Drow.M03 + Drow.M04 + Drow.M05 + Drow.M06 + Drow.M07 + Drow.M08 + Drow.M09 + Drow.M10 + Drow.M11 + Drow.M12
        'Drow = CType(DSETR.TReqUse.Rows(57 - 1), DSR.TReqUseRow)
        'Dim L57 as decimal = Drow.M01 + Drow.M02 + Drow.M03 + Drow.M04 + Drow.M05 + Drow.M06 + Drow.M07 + Drow.M08 + Drow.M09 + Drow.M10 + Drow.M11 + Drow.M12


        'Dim Dr2 As DSR.Graph_ReqUseRow
        'For Gubun As Short = 0 To 2
        '    Select Case Gubun
        '        Case 0  '//1차에너지소요량

        '            신재생에너지 = 0
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "1차에너지소요량"
        '            Dr2.type = "신재생에너지"
        '            Dr2.Req = 신재생에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '(SUM(계산결과!H72:H74)*1.1+계산결과!H75*0.88+계산결과!H76*3)/계산결과!H15
        '            난방에너지 = CSng(((Ru(41) + Ru(42) + Ru(43)) * 1.1 + Ru(44) * 0.88 + Ru(45) * 3) / Ru(7))
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "1차에너지소요량"
        '            Dr2.type = "난방에너지"
        '            Dr2.Req = 난방에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '(SUM(계산결과!H78:H80)*1.1+계산결과!H81*0.88+계산결과!H82*3)/계산결과!H20
        '            냉방에너지 = CSng(((Ru(46) + Ru(47) + Ru(48)) * 1.1 + Ru(49) * 0.88 + Ru(50) * 3) / Ru(12))
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "1차에너지소요량"
        '            Dr2.type = "냉방에너지"
        '            Dr2.Req = 냉방에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '(SUM(계산결과!H84:H86)*1.1+계산결과!H87*0.88+계산결과!H88*3)/계산결과!H26
        '            급탕에너지 = CSng(((Ru(51) + Ru(52) + Ru(53)) * 1.1 + Ru(54) * 0.88 + Ru(55) * 3) / Ru(18))
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "1차에너지소요량"
        '            Dr2.type = "급탕에너지"
        '            Dr2.Req = 급탕에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            'IF(SUM(D33:D35)=0,0,계산결과!H90*3/계산결과!H23)
        '            조명에너지 = CSng(IIf(난방에너지 + 냉방에너지 + 급탕에너지 = 0, 0, Ru(56) * 3 / Ru(15)))
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "1차에너지소요량"
        '            Dr2.type = "조명에너지"
        '            Dr2.Req = 조명에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H92*3/계산결과!H27
        '            환기에너지 = Ru(57) * 3 / Ru(19)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "1차에너지소요량"
        '            Dr2.type = "환기에너지"
        '            Dr2.Req = 환기에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)
        '        Case 1  '//에너지소요량

        '            '=-(ru(62)+ru(63))-(IF(계산결과!H15<>0,(계산결과!H39+계산결과!H41-계산결과!G38)/계산결과!H15,0)+IF(계산결과!H20<>0,(계산결과!H45+계산결과!H47-계산결과!G44)/계산결과!H20,0)+IF(계산결과!H23<>0,(SUM(계산결과!I90:T90)-계산결과!G50)/계산결과!H23,0)+IF(계산결과!H26<>0,(계산결과!H54+계산결과!H55-계산결과!G53)/계산결과!H26,0)+IF(계산결과!H27<>0,(SUM(계산결과!I92:T92)-계산결과!G58)/계산결과!H27,0))

        '            Dim PreData as decimal = 0
        '            Dim Ru7, Ru23, Ru25, Ru22G as decimal
        '            Ru7 = Ru(7)
        '            Ru23 = Ru(23)
        '            Ru25 = Ru(25)
        '            Ru22G = Ru(22, "COLG")
        '            PreData += CSng(IIf(Ru(7) <> 0, (Ru(23) + Ru(25) - Ru(22, "COLG")) / Ru(7), 0))
        '            PreData += CSng(IIf(Ru(12) <> 0, (Ru(28) + Ru(29) - Ru(27, "COLG")) / Ru(12), 0))
        '            PreData += CSng(IIf(Ru(15) <> 0, (L56 - Ru(31, "COLG")) / Ru(15), 0))
        '            PreData += CSng(IIf(Ru(18) <> 0, (Ru(34) + Ru(35) - Ru(33, "COLG")) / Ru(18), 0))
        '            PreData += CSng(IIf(Ru(19) <> 0, (L57 - Ru(37, "COLG")) / Ru(19), 0))
        '            'PreData = -1 * PreData

        '            신재생에너지 = -(Ru(62) + Ru(63)) - PreData
        '            'MsgBox(신재생에너지)

        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지소요량"
        '            Dr2.type = "신재생에너지"
        '            Dr2.Req = 신재생에너지

        '            'MsgBox(Dr2.Req)
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H42
        '            난방에너지 = Ru(26)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지소요량"
        '            Dr2.type = "난방에너지"
        '            Dr2.Req = 난방에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H48()
        '            냉방에너지 = Ru(30)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지소요량"
        '            Dr2.type = "냉방에너지"
        '            Dr2.Req = 냉방에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H56
        '            급탕에너지 = Ru(36)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지소요량"
        '            Dr2.type = "급탕에너지"
        '            Dr2.Req = 급탕에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '=IF(SUM(E33:E35)=0,0,계산결과!H51) '/난방+냉방+급탕
        '            If 난방에너지 + 냉방에너지 + 급탕에너지 = 0 Then
        '                조명에너지 = 0
        '            Else
        '                조명에너지 = Ru(32)
        '            End If

        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지소요량"
        '            Dr2.type = "조명에너지"
        '            Dr2.Req = 조명에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H59
        '            환기에너지 = Ru(38)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지소요량"
        '            Dr2.type = "환기에너지"
        '            Dr2.Req = 환기에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '        Case 2  '//에너지요구량


        '            신재생에너지 = 0
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지요구량"
        '            Dr2.type = "신재생에너지"
        '            Dr2.Req = 신재생에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H14
        '            난방에너지 = Ru(6)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지요구량"
        '            Dr2.type = "난방에너지"
        '            Dr2.Req = 난방에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H19
        '            냉방에너지 = Ru(11)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지요구량"
        '            Dr2.type = "냉방에너지"
        '            Dr2.Req = 냉방에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H25
        '            급탕에너지 = Ru(17)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지요구량"
        '            Dr2.type = "급탕에너지"
        '            Dr2.Req = 급탕에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            '계산결과!H22
        '            조명에너지 = Ru(14)
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지요구량"
        '            Dr2.type = "조명에너지"
        '            Dr2.Req = 조명에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)

        '            환기에너지 = 0
        '            Dr2 = Me.DSR.Graph_ReqUse.NewGraph_ReqUseRow
        '            Dr2.Gubun = "에너지요구량"
        '            Dr2.type = "환기에너지"
        '            Dr2.Req = 환기에너지
        '            Me.DSR.Graph_ReqUse.Rows.Add(Dr2)
        '    End Select
        'Next

    End Sub


End Class