Imports System.IO Imports System.Xml Imports System.Xml.XPath Imports System.Xml.Xsl Imports PDFDocScout ResPage.aspx Partial Class ResPage Inherits System.Web.UI.Page Protected Function GetInstalled(ByRef x As String) As String If x.tolower = ".t." Then Return "Installeret" Return "Ikke installeret" End Function Protected Sub GetWindow(ByRef Elements As XmlNodeList, ByRef id As String, _ ByRef area0 As Double, ByRef area1 As Double, ByRef name As String, ByRef imp As Integer) Dim a0 As Double = 0.0 Dim a1 As Double = 0.0 For Each n0 In Elements Dim sfb_node As XmlElement = n0.item("sfb") If Not sfb_node Is Nothing Then Dim sfb As String = sfb_node.innertext 'If Not sfb.contains(be06.improvement) Then If sfb.contains(id) Then Dim an As XmlElement = n0.item("area") If Not an Is Nothing Then Dim na0 As String = an.innertext.replace(".", ",") If na0.length > 0.0 Then Dim part As Integer = n0.item("part").innertext Dim typ As Integer = Std.GetTyp(part) name = Std.NameWin(typ) Dim da0 As Double = na0 Dim number As XmlElement = n0.item("no") Dim no As Double = number.innertext da0 *= no If sfb.contains(be06.improvement) Then a1 += da0 imp = Std.GetImp(part) a0 += da0 area0 = a0 area1 = a1 Protected Sub GetReport(ByRef doc As StringBuilder, ByVal split As Integer) Dim xml As XmlDocument = New XmlDocument xml = CType(Session("xmldoc"), XmlDocument) Dim kroner, el_dem As Double Dim price As Double = CType(Session("eprice"), Double) Dim old_price As Double = CType(Session("saved_eprice"), Double) Dim el_price As Double = CType(Session("el_price"), Double) Dim dem As Double = Be06.GetDemand(xml, price, el_price, kroner, el_dem) Dim cons0 As Double = CType(Session.Item("cons0"), Double) Dim std_cons As Double = CType(Session("std_cons0"), Double) Dim last_kwh As Double = CType(Session("last_kwh"), Double) Dim last_kr0 As Double = CType(Session("last_kr0"), Double) Dim el0 As Double = CType(Session.Item("el0"), Double) Dim kr0 As Double = CType(Session.Item("kr0"), Double) Side 1
' Dim dem0 As String = CType(Math.Round(dem, 1), String) Dim dem0 As String = Math.Round(dem, 1).ToString("n1") Dim saving As String = CType(Math.Round(cons0 - dem, 1), String) Dim year As String = CType(Session("year"), String) Dim area As Double = CType(Session("area"), Double) Dim stor As Integer = CType(Session("stories"), Integer) Dim gr As Integer = CType(Session("ground"), Integer) Dim t0 As Integer = CType(Session("type"), Integer) Dim orient0 As Double = CType(Session("orient"), Double) Dim people As Double = CType(Session("people"), Double) Dim heat As Integer = CType(Session("heating"), Integer) Dim ht_sup As Integer = CType(Session("heat_sup"), Integer) Dim fu_sup As Integer = CType(Session("fuel_sup"), Integer) Dim cons_sup As Double = CType(Session("cons_sup"), Double) Dim unit As String = Be06.Unit(heat) Dim cons As Double = CType(Session("consump"), Double) Dim cons_kr As Double = CType(Session("consump_kr"), Double) Dim hp_ex As Integer = CType(Session("hp_ex"), Integer) Dim conv As Integer = CType(Session("converted"), Integer) ' heating system converted Dim frac As Double = 0.0 If cons0 > 0.0 Then frac = (cons0 - dem) / cons0 Dim tot_cons As Double = cons If cons < 0.0 Then tot_cons = 0.0 Dim save_kr As Double = tot_cons * price * frac Dim kr As String = Math.Round(save_kr, 0) Dim el_dem0 As Double Dim save_cons As String = Be06.GetSaving(xml, cons0, el0, kr0, cons, price, el_price, el_dem0, last_kwh, last_kr0, std_cons, False) ' 2821 kwh, 2869 kr. Seneste tiltag 0 kr pr år Dim n As Integer = save_cons.indexof(" ") Dim m0 As Integer = save_cons.indexof(", ") Dim m1 As Integer = save_cons.indexof(" kr") Dim save_cons0 As String = save_cons.substring(m0 + 2, m1 - m0-2) kr Dim fuel0 As Double = CType(save_cons0, Double) save_cons0 = fuel0.tostring("n0") Dim save_el As Double = (el0 - el_dem0) * area * el_price 'Dim save_pct0 As String = save_cons.substring(m0 + 1, m1 - m0-1) Dim save_pct0 As String = Math.Round(100.0 * (cons0 - dem) / cons0, 1) Dim fuel_cons As String = save_cons.substring(0, n) ' kwh Dim dec As Integer = Std.heat_dec(heat) If price > 0.0 Then Dim fuel As Double = fuel0 / price Select Case dec Case 1 fuel_cons = Math.Round(fuel, dec).tostring("n1") Case 3 fuel_cons = Math.Round(fuel, dec).tostring("n3") Case fuel_cons = Math.Round(fuel, dec).tostring("n0") End Select ' fuel_cons = Math.Round(fuel, dec) ' fuel_cons += " " & Be06.Unit(heat) & " pr år" Dim fuel_unit As String = Be06.Unit(heat) + " pr år" ' If split < 0 Then ' Text document to be imported in excel doc.append("dokumentation af energibesparelser for bygningen" & vbtab & "Videncenter for energibesparelser i bygninger" & vbcrlf & doc.append("forventet varmebesparelse" & vbcrlf & If price > 0.0 Then Side 2
If conv > 0 Then doc.append("besparelse i varmeforbrug" & vbtab & "Beregnes ikke pga. varmekonvertering" & vbcrlf & doc.append("besparelse i varmeforbrug" & vbtab & "" & fuel_cons & "" & vbtab & "" & fuel_unit & "" & vbcrlf & doc.append("økonomisk varmebesparelse" & vbtab & "" & save_cons0 & "" & vbtab & "kr pr år" & vbcrlf & doc.append("besparelse i varmeforbrug" & vbtab & "" & save_cons0 & "" & vbcrlf & doc.append("teoretisk beregnet energibehov, kwh/m² år" & vbcrlf & doc.append("energibehov før forbedring" & vbtab & "" & Math.Round(cons0, 1).ToString("n1") & "" & vbcrlf & doc.append("heraf el-behov før forbedring" & vbtab & "" & Math.Round(el0, 1).ToString("n1") & "" & vbcrlf & doc.append("energibehov efter forbedring" & vbtab & "" & dem0 & "" & vbcrlf & doc.append("heraf el-behov efter forbedring" & vbtab & "" & Math.Round(el_dem0, 1).ToString("n1") & "" & vbcrlf & doc.append("besparelse i energibehov" & vbtab & "" & saving & "" & vbcrlf & doc.append("samlet besparelsesprocent" & vbtab & "" & save_pct0 & "" & vbcrlf & doc.append("bygningen" & vbcrlf & doc.append("byggeår" & vbtab & "" & year & "" & vbcrlf & doc.append("etageareal" & vbtab & "" & area.tostring.replace(".", ",") & "" & vbtab & "m²" & vbcrlf & doc.append("etager" & vbtab & "" & Std.stories(stor) & "" & vbcrlf & doc.append("kælder" & vbtab & "" & Std.ground(gr) & "" & vbcrlf & doc.append("hustype" & vbtab & "" & Std.build_type(t0) & "" & vbcrlf & doc.append("orientering" & vbtab & "" & orient0 & "" & vbtab & "grader" & vbcrlf & doc.append("antal beboere" & vbtab & "" & people & "" & vbcrlf & Dim heat0 As String = Std.heating(heat) Dim n0 As Integer = heat0.indexof(", ") Dim n1 As Integer = heat0.length doc.append("opvarmning" & vbtab & "" & heat0.substring(0, n0) & "" & vbtab & "" & heat0.substring(n0 + 2, n1 - n0-2) & "" & vbcrlf & doc.append("supplerende opvarmning" & vbtab & "" & Std.NameSupHeat(ht_sup) & "" & vbcrlf & Dim sp As String = Be06.GetElement(xml, "BUILDING", "solarpanel") doc.append("solvarme" & vbtab & "" & GetInstalled(sp) & "" & vbcrlf & Dim hp0 As Integer = Be06.GetHeatPump(xml) doc.append("varmepumpe" & vbtab & "" & Std.VpType(hp_ex) & "" & vbcrlf & doc.append("oplyst eksisterende varmeforbrug" & vbcrlf & doc.append("varmeforbrug pr år" & vbtab & "" & cons.tostring("n0") & "" & vbtab & "" & unit & "" & vbcrlf & If ht_sup > 0 Then doc.append("supplerende varmeforbrug pr år" & vbtab & "" & cons_sup.tostring("n0") & "" & vbtab & "" & Std.NameSupFuel(fu_sup) & "" & vbcrlf & If heat <> 4 Then doc.append("energipris" & vbtab & "" & old_price & "" & vbtab & "kr" & vbcrlf & doc.append("el-pris" & vbtab & "" & el_price & "" & vbtab & "kr/kwh" Side 3
& vbcrlf & doc.append("varmeforbrug pr år" & vbtab & "" & cons_kr.tostring("n0") & "" & vbtab & "kr" & vbcrlf & doc.append("klimaskærm" & vbcrlf & Dim type As String = "" Dim n01 As XmlNode Dim Elements As XmlNodeList = xml.getelementsbytagname("opaque_const") For Each n01 In Elements Dim sfb As XmlElement = n01.item("sfb") If Not sfb Is Nothing Then Dim id0 As String = sfb.innertext Dim area0 As XmlElement = n01.item("area") If Not area0 Is Nothing Then Dim ae0 As String = area0.innertext.replace(".", ",") If ae0.length > 0 Then Dim wimp As Integer = 0 Dim impr As Boolean = id0.contains(be06.improvement) If impr Then Dim part As Integer = n01.item("part").innertext Dim typ As Integer = Std.GetTyp(part) wimp = Std.GetImp(part) Dim ae1 As Double = ae0 ae0 = Math.Round(ae1, 2).ToString("n1") If ae1 > 0.0 Then Dim name As String = n01.item("id").innertext If id0.contains(be06.wall) Or id0.contains(be06.wall_x) Or id0.contains(be06.wall_y) Then type = "Ydervæg" If id0.contains(be06.floor) Or id0.contains(be06.floor_x) Then type = "Gulv i stueetage" If id0.contains(be06.roof) Or id0.contains(be06.roof_x) Then type = "Loft" If id0.contains(be06.wall_45) Then type = "Skråvæg" If id0.contains(be06.wall_sk) Then type = "Skunkvæg" If id0.contains(be06.floor_sk) Then type = "Skunkgulv" If id0.contains(be06.roof_re) Then type = "Tagrem" type += ": " + name doc.append("" & type & "" & vbtab & "" & ae0 & "" & vbtab & "m²" & vbcrlf & Dim sum_a0 As Double = 0.0 Dim sum_a1 As Double = 0.0 Dim name0 As String = "" Dim impw As Integer = 0 Dim timp() As String = {"Ingen forbedring", "Forbedret til Minimum", "Forbedret til Lavenergi"} Elements = xml.getelementsbytagname("transp_constr") doc.append("vinduer" & vbcrlf & GetWindow(Elements, Be06.n_win, sum_a0, sum_a1, name0, impw) doc.append("vinduer, nord: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & Side 4
doc.append("vinduer, nord: " & name0 & ", " & timp(impw) & "" & GetWindow(Elements, Be06.n_win_x, sum_a0, sum_a1, name0, impw) doc.append("vinduer, nord: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("vinduer, nord: " & name0 & ", " & timp(impw) & "" & GetWindow(Elements, Be06.e_win, sum_a0, sum_a1, name0, impw) doc.append("vinduer, øst: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("vinduer, øst: " & name0 & ", " & timp(impw) & "" & GetWindow(Elements, Be06.e_win_x, sum_a0, sum_a1, name0, impw) doc.append("vinduer, øst: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("vinduer, øst: " & name0 & ", " & timp(impw) & "" & GetWindow(Elements, Be06.s_win, sum_a0, sum_a1, name0, impw) doc.append("vinduer, syd: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("vinduer, syd: " & name0 & ", " & timp(impw) & "" & GetWindow(Elements, Be06.s_win_x, sum_a0, sum_a1, name0, impw) doc.append("vinduer, syd: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("vinduer, syd: " & name0 & ", " & timp(impw) & "" & GetWindow(Elements, Be06.w_win, sum_a0, sum_a1, name0, impw) doc.append("vinduer, vest: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("vinduer, vest: " & name0 & ", " & timp(impw) & "" & Side 5
GetWindow(Elements, Be06.w_win_x, sum_a0, sum_a1, name0, impw) doc.append("vinduer, vest: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("vinduer, vest: " & name0 & ", " & timp(impw) & "" & GetWindow(Elements, Be06.n_win_rf, sum_a0, sum_a1, name0, impw) doc.append("ovenlysvinduer, nord: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("ovenlysvinduer, nord: " & name0 & ", " & timp(impw) & "" & vbtab & "" & Math.Round(sum_a1, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & GetWindow(Elements, Be06.v_win_rf, sum_a0, sum_a1, name0, impw) doc.append("ovenlysvinduer, øst, vest: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("ovenlysvinduer, øst, vest: " & name0 & ", " & timp(impw) & "" & vbtab & "" & Math.Round(sum_a1, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & GetWindow(Elements, Be06.s_win_rf, sum_a0, sum_a1, name0, impw) doc.append("ovenlysvinduer, syd: " & name0 & "" & vbtab & "" & Math.Round(sum_a0, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("ovenlysvinduer, syd: " & name0 & ", " & timp(impw) & "" & vbtab & "" & Math.Round(sum_a1, 2).ToString("n1") & "" & vbtab & "m²" & vbcrlf & doc.append("installationer" & vbcrlf & Elements = xml.getelementsbytagname("ventilation") For Each n01 In Elements Dim id As String = n01.item("id").innertext Dim part As Integer = n01.item("part").innertext Dim typ As Integer = part >> 2 Dim im As Integer = part - 4 * typ doc.append("ventilation" & vbtab & "" & id & ", " & timp(im) & "" & vbcrlf & Dim ht() As String = {"Kedel", "Fjernvarme", "El", "Naturgas"} If conv > 0 Then doc.append("varmeforsyning konverteret til" & vbtab & "" & ht(conv) & "" & vbcrlf & Dim ht_type As Integer = Be06.GetHeatType(xml) Elements = xml.getelementsbytagname("boiler") Dim imp As String = Be06.GetElement(xml, "HEATING_SYSTEMS", "id") Dim col As Integer = 0 If ht_type < 2 Then Side 6
If imp.contains("min") Then col = 1 If imp.contains("lav") Then col = 2 For Each n01 In Elements Dim id As String = n01.item("id").innertext If ht_type < 2 Then doc.append("" & ht(ht_type) & "" & vbtab & "" & id & ", " & timp(col) & "" & vbcrlf & doc.append("" & ht(ht_type) & "" & vbtab & "-" & vbcrlf & vbcrlf & Dim hp01 As Integer = Be06.GetHeatPump(xml) If hp0 > 0 Then doc.append("varmepumpe" & vbtab & "" & Std.VpType(hp01) & "" & vbcrlf & Dim active As Boolean = Be06.IsTrue(Be06.GetElement(xml, "BUILDING", "solarpanel")) Dim a0 As String = Be06.GetElement(xml, "SOLAR_COLLECTOR", "area").replace(".", ",") Dim as0 As Double = a0 If active And as0 > 0.0 Then Dim orient As String = Be06.GetElement(xml, "SOLAR_COLLECTOR", "orient").replace(".", ",") Dim slope As String = Be06.GetElement(xml, "SOLAR_COLLECTOR", "slope").replace(".", ",") doc.append("solvarme" & vbtab & "Areal " & a0 & " m², Orientering " & orient & ", Hældning " & slope & " grader" & vbcrlf & doc.append("<?xml version=""1.0"" encoding=""iso-8859-1""?>") doc.append("<?xml-stylesheet type=""text/xsl"" href=""be06doc.xsl""?>") doc.append("<be06doc subject=""dokumentation af energibesparelser for bygningen"" head=""videncenter for energibesparelser i bygninger"">") If split < 2 Then Dim owner As String = Be06.GetElement(xml, "DESCRIPT", "owner") Dim addr As String = Be06.GetElement(xml, "DESCRIPT", "addr1") Dim zip As String = Be06.GetElement(xml, "DESCRIPT", "addr2") If owner.length > 0 Or addr.length > 0 Or zip.length > 0 Then doc.append("<table head=""ejendommen " & _ addr & ", " & zip & ". Ejer: " & owner & """></table>") doc.append("<table head=""forventet varmebesparelse"">") If price > 0.0 Then If conv > 0 Then doc.append("<row><id>besparelse i varmeforbrug</id><value>beregnes ikke pga. varmekonvertering</value></row>") doc.append("<row><id>besparelse i varmeforbrug</id><value>" & fuel_cons & " " & fuel_unit & "</value></row>") doc.append("<row><id>økonomisk varmebesparelse</id><value>" & save_cons0 & " kr pr år</value></row>") doc.append("<row><id>besparelse i varmeforbrug</id><value>" & save_cons0 & "</value></row>") doc.append("</table>") Side 7
doc.append("<table head=""teoretisk beregnet energibehov"">") doc.append("<row><id>energibehov før forbedring</id><value>" & Math.Round(cons0, 1).ToString("n1") & " kwh/m² år</value></row>") doc.append("<row><id>heraf el-behov før forbedring</id><value>" & Math.Round(el0, 1).ToString("n1") & " kwh/m² år</value></row>") doc.append("<row><id>energibehov efter forbedring</id><value>" & dem0 & " kwh/m² år</value></row>") doc.append("<row><id>heraf el-behov efter forbedring</id><value>" & Math.Round(el_dem0, 1).ToString("n1") & " kwh/m² år</value></row>") 'doc.append("<row><id>besparelse i energibehov</id><value>" & String.Format("{0:0,0.00}", -123456789.654321) & " kwh/m² år</value></row>") doc.append("<row><id>besparelse i energibehov</id><value>" & saving & " kwh/m² år</value></row>") doc.append("<row><id>samlet besparelsesprocent</id><value>" & save_pct0 & "</value></row>") doc.append("</table>") doc.append("<table head=""bygningen"">") doc.append("<row><id>byggeår</id><value>" & year & "</value></row>") doc.append("<row><id>etageareal</id><value>" & area.tostring.replace(".", ",") & " m²</value></row>") doc.append("<row><id>etager</id><value>" & Std.stories(stor) & "</value></row>") doc.append("<row><id>kælder</id><value>" & Std.ground(gr) & "</value></row>") doc.append("<row><id>hustype</id><value>" & Std.build_type(t0) & "</value></row>") doc.append("<row><id>orientering</id><value>" & orient0 & " grader</value></row>") doc.append("<row><id>antal beboere</id><value>" & people & "</value></row>") doc.append("<row><id>opvarmning</id><value>" & Std.heating(heat) & "</value></row>") doc.append("<row><id>supplerende opvarmning</id><value>" & Std.NameSupHeat(ht_sup) & "</value></row>") Dim sp As String = Be06.GetElement(xml, "BUILDING", "solarpanel") doc.append("<row><id>solvarme</id><value>" & GetInstalled(sp) & "</value></row>") 'Dim hp As String = Be06.GetElement(xml, "BUILDING", "heatpump") Dim hp0 As Integer = Be06.GetHeatPump(xml) doc.append("<row><id>varmepumpe</id><value>" & Std.VpType(hp_ex) & "</value></row>") 'doc.append("<row><id>varmepumpe</id><value>" & GetInstalled(hp) & "</value></row>") doc.append("</table>") doc.append("<table head=""oplyst eksisterende varmeforbrug"">") doc.append("<row><id>varmeforbrug pr år</id><value>" & cons.tostring("n0") & " " & unit & "</value></row>") ' doc.append("<row><id>varmeforbrug pr år</id><value>" & cons & " " & unit & "</value></row>") If ht_sup > 0 Then doc.append("<row><id>supplerende varmeforbrug pr år</id><value>" & cons_sup.tostring("n0") & " " & Std.NameSupFuel(fu_sup) & "</value></row>") If heat <> 4 Then doc.append("<row><id>energipris</id><value>" & old_price & " kr</value></row>") doc.append("<row><id>el-pris</id><value>" & el_price & " kr/kwh</value></row>") doc.append("<row><id>varmeforbrug pr år</id><value>" & cons_kr.tostring("n0") & " kr</value></row>") Side 8
' doc.append("<row><id>varmeforbrug pr år</id><value>" & cons_kr & " kr</value></row>") doc.append("</table>") If split <> 1 Then doc.append("<table head=""klimaskærm"">") Dim type As String = "" Dim n0 As XmlNode Dim Elements As XmlNodeList = xml.getelementsbytagname("opaque_const") For Each n0 In Elements Dim sfb As XmlElement = n0.item("sfb") If Not sfb Is Nothing Then Dim id0 As String = sfb.innertext Dim area0 As XmlElement = n0.item("area") If Not area0 Is Nothing Then Dim ae0 As String = area0.innertext.replace(".", ",") If ae0.length > 0 Then Dim wimp As Integer = 0 Dim impr As Boolean = id0.contains(be06.improvement) If impr Then Dim part As Integer = n0.item("part").innertext Dim typ As Integer = Std.GetTyp(part) wimp = Std.GetImp(part) Dim ae1 As Double = ae0 ae0 = Math.Round(ae1, 2).ToString("n1") If ae1 > 0.0 Then Dim name As String = n0.item("id").innertext If id0.contains(be06.wall) Or id0.contains(be06.wall_x) Or id0.contains(be06.wall_y) Then type = "Ydervæg" If id0.contains(be06.floor) Or id0.contains(be06.floor_x) Then type = "Gulv i stueetage" If id0.contains(be06.roof) Or id0.contains(be06.roof_x) Then type = "Loft" If id0.contains(be06.wall_45) Then type = "Skråvæg" If id0.contains(be06.wall_sk) Then type = "Skunkvæg" If id0.contains(be06.floor_sk) Then type = "Skunkgulv" If id0.contains(be06.roof_re) Then type = "Tagrem" type += ": " + name doc.append("<row><id color=""" & wimp & """>" & type & "</id><value>" & ae0 & " m²</value></row>") doc.append("</table>") Dim sum_a0 As Double = 0.0 Dim sum_a1 As Double = 0.0 Dim name0 As String = "" Dim impw As Integer = 0 Dim timp() As String = {"Ingen forbedring", "Forbedret til Minimum", "Forbedret til Lavenergi"} Side 9
Elements = xml.getelementsbytagname("transp_constr") doc.append("<table head=""vinduer"">") GetWindow(Elements, Be06.n_win, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">vinduer, nord: " & name0 & "</id><value>" & Math.Round(sum_a0, doc.append("<row><id color=""" & impw & """>Vinduer, nord: " GetWindow(Elements, Be06.n_win_x, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">vinduer, nord: " & name0 & "</id><value>" & Math.Round(sum_a0, doc.append("<row><id color=""" & impw & """>Vinduer, nord: " GetWindow(Elements, Be06.e_win, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">vinduer, øst: " & name0 & "</id><value>" & Math.Round(sum_a0, doc.append("<row><id color=""" & impw & """>Vinduer, øst: " GetWindow(Elements, Be06.e_win_x, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">vinduer, øst: " & name0 & "</id><value>" & Math.Round(sum_a0, doc.append("<row><id color=""" & impw & """>Vinduer, øst: " GetWindow(Elements, Be06.s_win, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">vinduer, syd: " & name0 & "</id><value>" & Math.Round(sum_a0, doc.append("<row><id color=""" & impw & """>Vinduer, syd: " GetWindow(Elements, Be06.s_win_x, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">vinduer, syd: " & name0 & "</id><value>" & Math.Round(sum_a0, doc.append("<row><id color=""" & impw & """>Vinduer, syd: " Side 10
GetWindow(Elements, Be06.w_win, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">vinduer, vest: " & name0 & "</id><value>" & Math.Round(sum_a0, doc.append("<row><id color=""" & impw & """>Vinduer, vest: " GetWindow(Elements, Be06.w_win_x, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">vinduer, vest: " & name0 & "</id><value>" & Math.Round(sum_a0, doc.append("<row><id color=""" & impw & """>Vinduer, vest: " GetWindow(Elements, Be06.n_win_rf, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">ovenlysvinduer, nord: " & name0 & "</id><value>" & Math.Round(sum_a0, 2).ToString("n1") & " m²</value></row>") doc.append("<row><id color=""" & impw & """>Ovenlysvinduer, nord: " GetWindow(Elements, Be06.v_win_rf, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">ovenlysvinduer, øst, vest: " & name0 & "</id><value>" & Math.Round(sum_a0, 2).ToString("n1") & " m²</value></row>") doc.append("<row><id color=""" & impw & """>Ovenlysvinduer, øst, vest: " GetWindow(Elements, Be06.s_win_rf, sum_a0, sum_a1, name0, impw) doc.append("<row><id color=""0"">ovenlysvinduer, syd: " & name0 & "</id><value>" & Math.Round(sum_a0, 2).ToString("n1") & " m²</value></row>") doc.append("<row><id color=""" & impw & """>Ovenlysvinduer, syd: " doc.append("</table>") doc.append("<table head=""installationer"">") Elements = xml.getelementsbytagname("ventilation") For Each n0 In Elements Dim id As String = n0.item("id").innertext Dim part As Integer = n0.item("part").innertext Dim typ As Integer = part >> 2 Dim im As Integer = part - 4 * typ doc.append("<row><id color=""" & im & Side 11
""">Ventilation</id><value>" & id & ", " & timp(im) & "</value></row>") Dim ht() As String = {"Kedel", "Fjernvarme", "El", "Naturgas"} If conv > 0 Then doc.append("<row><id color=""2"">varmeforsyning konverteret til</id><value>" & ht(conv) & "</value></row>") Dim ht_type As Integer = Be06.GetHeatType(xml) Elements = xml.getelementsbytagname("boiler") Dim imp As String = Be06.GetElement(xml, "HEATING_SYSTEMS", "id") Dim col As Integer = 0 If ht_type < 2 Then If imp.contains("min") Then col = 1 If imp.contains("lav") Then col = 2 For Each n0 In Elements Dim id As String = n0.item("id").innertext If ht_type < 2 Then doc.append("<row><id color=""" & col & """>" & ht(ht_type) & "</id><value>" & id & ", " & timp(col) & "</value></row>") doc.append("<row><id color=""0"">" & ht(ht_type) & "</id><value>-</value></row>") Dim hp0 As Integer = Be06.GetHeatPump(xml) If hp0 > 0 Then doc.append("<row><id color=""2"">varmepumpe</id><value>" & Std.VpType(hp0) & "</value></row>") Dim active As Boolean = Be06.IsTrue(Be06.GetElement(xml, "BUILDING", "solarpanel")) Dim a0 As String = Be06.GetElement(xml, "SOLAR_COLLECTOR", "area").replace(".", ",") Dim as0 As Double = a0 If active And as0 > 0.0 Then Dim orient As String = Be06.GetElement(xml, "SOLAR_COLLECTOR", "orient").replace(".", ",") Dim slope As String = Be06.GetElement(xml, "SOLAR_COLLECTOR", "slope").replace(".", ",") doc.append("<row><id color=""2"">solvarme</id><value>areal " & a0 & " m², Orientering " & orient & ", Hældning " & slope & " grader</value></row>") doc.append("</table>") doc.append("</be06doc>") Protected Sub SavePdf_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SavePdf.Click Dim doc As New StringBuilder Dim doc2 As New StringBuilder GetReport(doc, 1) GetReport(doc2, 2) Dim text As String = doc.tostring Dim text2 As String = doc2.tostring Dim dir As String = Request.PhysicalApplicationPath Dim fn As String = dir + "App_Data\be06doc.xsl" Dim PDFDoc As New PDFDocScout.PDFDocument Side 12
PDFDoc.InitLibrary("jlh@sbi.dk", "CD56-0A59-E401-695D-403") PDFDoc.GenerateInMemoryFile = True PDFDoc.AutoOpenGeneratedPDF = False PDFDoc.HTML2PDF_UseGDIPlusToLoadImages = True PDFDoc.BeginDocument() Dim xmldoc As New XmlDocument xmldoc.loadxml(text) Dim xslt As New XslCompiledTransform xslt.load(fn) Dim writer As New StringWriter xslt.transform(xmldoc, Nothing, writer) writer.close() Dim width As Long = PDFDoc.Page.Width Dim x0 As Long = width / 20 Dim height As Long = PDFDoc.Page.Height Dim y0 As Long = height / 20 PDFDoc.Page.AddHTMLBoxEx(writer.ToString, x0, y0, width - 2 * x0, height - y0, True, dir) PDFDoc.AddPage() xmldoc.loadxml(text2) Dim writer2 As New StringWriter xslt.transform(xmldoc, Nothing, writer2) writer2.close() PDFDoc.Pages(1).AddHTMLBoxEx(writer2.ToString, x0, y0, width - 2 * x0, -1, True, dir) PDFDoc.EndDocument() Dim size As Long = PDFDoc.BinaryImageSize Dim buffer(cint(size)) As Byte Dim MemoryImage As System.Array = PDFDoc.BinaryImage Array.Copy(MemoryImage, buffer, size) Response.Clear() Response.ContentType = "application/pdf" Response.AddHeader("content-disposition", "attachment; filename=be10.pdf") Response.BinaryWrite(buffer) Response.End() Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init If Not Page.IsPostBack Then Dim doc As New StringBuilder GetReport(doc, 0) Dim text As String = doc.tostring Xml1.DocumentContent = text Xml1.TransformSource = Path.Combine(Request.PhysicalApplicationPath, "App_Data\be06doc.xsl") Protected Sub SaveText_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveText.Click Dim csm As ClientScriptManager = Page.ClientScript Dim doc As New StringBuilder GetReport(doc, -1) Dim text As String = doc.tostring 'Response.Clear() 'Response.ClearHeaders() 'Response.ContentType = "text/txt; charset=iso-8859-1" 'Response.AddHeader("content-disposition", "attachment; filename=be10res.txt") 'Dim n As Integer = text.length 'Dim xx(n) As Byte Side 13
'Dim m As Integer = 0 'For Each c As Char In text 'xx(m) = Asc(c) 'm += 1 ' 'Response. 'Response.BinaryWrite(xx) 'Response.End() ' csm.registerclientscriptblock(typeof(page), "copy", _ Dim type As System.Type = Page.GetType Dim cmd As String = _ "<script language=""javascript"" type=""text/javascript""> " + _ "window.clipboarddata.setdata(""text"", """ + text + "; " + "</script>" csm.registerclientscriptblock(type, "copy", _ "<script language=""javascript"" type=""text/javascript""> " + _ "window.clipboarddata.setdata(""text"", """ + text + "; " + "</script>") Protected Sub LinkKey_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkKey.Click Page.Response.Redirect("KeyPage.aspx") Protected Sub ImageHelp_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageHelp.Click Session.Item("PrevPage") = "ResPage.aspx" Page.Response.Redirect("HelpPage.aspx") Protected Sub ImageAbout_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageAbout.Click Session.Item("PrevPage") = "ResPage.aspx" Page.Response.Redirect("AboutPage.aspx") Protected Sub ButtonBack_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonBack.Click Page.Response.Redirect("Install2Page.aspx") 'Protected Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button.Click ' Page.Response.Redirect("WallPage.aspx") ' Protected Sub ButtonNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonNew.Click Dim xml As XmlDocument = New XmlDocument Dim doc As String = CType(Session("savexmldoc"), String) xml.loadxml(doc) Session.Item("wimp") = 0 Session.Item("xmldoc") = xml Page.Response.Redirect("WallPage.aspx") 'Protected Sub NewBuilding_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles NewBuilding.Click ' Session.Abandon() ' Page.Response.Redirect("Default.aspx") ' Protected Sub ImageMain_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageMain.Click Page.Response.Redirect("Default.aspx") Protected Sub ImageWall0_Click(ByVal sender As Object, ByVal e As Side 14
System.Web.UI.ImageClickEventArgs) Handles ImageWall0.Click Page.Response.Redirect("EnvPage.aspx") Protected Sub ImageWin0_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageWin0.Click Page.Response.Redirect("WinexPage.aspx") Protected Sub ImageInst0_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageInst0.Click Page.Response.Redirect("Inst2Page.aspx") Protected Sub ImageWall1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageWall1.Click Page.Response.Redirect("WallPage.aspx") Protected Sub ImageWin1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageWin1.Click Page.Response.Redirect("WinPage.aspx") Protected Sub ImageInst1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageInst1.Click Page.Response.Redirect("Install2Page.aspx") Protected Sub SaveModel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveModel.Click Dim xml As XmlDocument = New XmlDocument Dim conv As Integer = CType(Session("converted"), Integer) ' If conv > 0 Then ' Dim doc As String = CType(Session("prev_xmldoc"), String) ' xml.loadxml(doc) ' xml = CType(Session("xmldoc"), XmlDocument) ' Response.Clear() Response.ClearHeaders() Response.ContentType = "text/xml; charset=iso-8859-1" Response.AddHeader("content-disposition", "attachment; filename=be10web.xml") 'Response.AddHeader("content-disposition", "inline; filename=be06web.xml") Dim model As String = xml.outerxml.replace(",", ".") 'Response.Write(Xml.OuterXml.Replace(",", ".")) Dim n As Integer = model.length Dim xx(n) As Byte Dim m As Integer = 0 For Each c As Char In model xx(m) = Asc(c) m += 1 Response.BinaryWrite(xx) Response.End() End Class Side 15