handleiding_nieuw:sub_spacematrix
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
handleiding_nieuw:sub_spacematrix [2025/04/15 14:58] – support | handleiding_nieuw:sub_spacematrix [2025/04/15 15:51] (current) – support | ||
---|---|---|---|
Line 8: | Line 8: | ||
} | } | ||
.inputrow label { | .inputrow label { | ||
- | width: | + | width: |
} | } | ||
.inputrow input { | .inputrow input { | ||
Line 16: | Line 16: | ||
margin-left: | margin-left: | ||
font-size: 0.9em; | font-size: 0.9em; | ||
+ | min-width: 200px; | ||
+ | text-align: right; | ||
} | } | ||
table.rekenblok { | table.rekenblok { | ||
border-collapse: | border-collapse: | ||
- | margin-top: | + | margin-top: |
- | | + | |
} | } | ||
table.rekenblok td, table.rekenblok th { | table.rekenblok td, table.rekenblok th { | ||
- | padding: 6px 10px; | + | padding: |
border: 1px solid #ccc; | border: 1px solid #ccc; | ||
text-align: right; | text-align: right; | ||
Line 35: | Line 37: | ||
} | } | ||
.kaartcontainer { | .kaartcontainer { | ||
- | position: | + | position: |
- | | + | |
- | | + | |
+ | width: 320px; | ||
} | } | ||
.kaartcontainer img { | .kaartcontainer img { | ||
Line 49: | Line 52: | ||
background: red; | background: red; | ||
border-radius: | border-radius: | ||
- | top: 60%; | ||
- | left: 45%; | ||
transform: translate(-50%, | transform: translate(-50%, | ||
border: 2px solid white; | border: 2px solid white; | ||
} | } | ||
</ | </ | ||
+ | |||
+ | <div style=" | ||
+ | <div class=" | ||
+ | <img src=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | </ | ||
< | < | ||
Line 75: | Line 83: | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
- | <input id=" | + | <input id=" |
<div class=" | <div class=" | ||
</ | </ | ||
- | <button onclick="bereken()">Bereken</ | + | <div style="margin-top: 30px;"> |
<table class=" | <table class=" | ||
< | < | ||
<tr> | <tr> | ||
< | < | ||
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | <th>Totale | + | <th>Tot. BVO</ |
</tr> | </tr> | ||
</ | </ | ||
Line 96: | Line 103: | ||
< | < | ||
<td id=" | <td id=" | ||
- | < | + | < |
<td id=" | <td id=" | ||
<td id=" | <td id=" | ||
Line 102: | Line 109: | ||
</ | </ | ||
</ | </ | ||
+ | </ | ||
< | < | ||
<div id=" | <div id=" | ||
- | |||
- | < | ||
- | <div class=" | ||
- | <img src="/ | ||
- | <div class=" | ||
- | </ | ||
< | < | ||
Line 125: | Line 127: | ||
row.innerHTML = ` | row.innerHTML = ` | ||
<td style=" | <td style=" | ||
- | < | + | < |
- | < | + | < |
<td id=" | <td id=" | ||
<td id=" | <td id=" | ||
Line 135: | Line 137: | ||
function formatGetal(n) { | function formatGetal(n) { | ||
return n.toLocaleString(" | return n.toLocaleString(" | ||
+ | } | ||
+ | |||
+ | function updateStipje(fsi, | ||
+ | const stip = document.getElementById(" | ||
+ | const x = Math.min(100, | ||
+ | const y = Math.max(0, Math.min(100, | ||
+ | stip.style.left = `${x}%`; | ||
+ | stip.style.top = `${y}%`; | ||
} | } | ||
Line 140: | Line 150: | ||
const opp = parseFloat(document.getElementById(" | const opp = parseFloat(document.getElementById(" | ||
const fsi = parseFloat(document.getElementById(" | const fsi = parseFloat(document.getElementById(" | ||
+ | const gsi = parseFloat(document.getElementById(" | ||
const voorzieningPerc = parseFloat(document.getElementById(" | const voorzieningPerc = parseFloat(document.getElementById(" | ||
- | const laadvermogen = opp * fsi; | + | const laadvermogen = Math.round(opp * fsi); |
- | const bvoVoorzieningen = laadvermogen * voorzieningPerc; | + | const bvoVoorzieningen = Math.round(laadvermogen * voorzieningPerc); |
const bvoWonen = laadvermogen - bvoVoorzieningen; | const bvoWonen = laadvermogen - bvoVoorzieningen; | ||
- | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
- | document.getElementById(" | + | document.getElementById(" |
- | document.getElementById(" | + | document.getElementById(" |
+ | |||
+ | updateStipje(fsi, | ||
+ | bereken(); | ||
} | } | ||
Line 156: | Line 169: | ||
const fsi = parseFloat(document.getElementById(" | const fsi = parseFloat(document.getElementById(" | ||
const voorzieningPerc = parseFloat(document.getElementById(" | const voorzieningPerc = parseFloat(document.getElementById(" | ||
- | |||
const laadvermogen = opp * fsi; | const laadvermogen = opp * fsi; | ||
const woonBVO = laadvermogen * (1 - voorzieningPerc); | const woonBVO = laadvermogen * (1 - voorzieningPerc); | ||
Line 165: | Line 177: | ||
for (let i = 0; i < types.length; | for (let i = 0; i < types.length; | ||
- | const perc = parseFloat(document.getElementById(`perc_${i}`).value); | + | const perc = parseFloat(document.getElementById(`perc_${i}`).value) |
- | const bvo = parseFloat(document.getElementById(`bvo_${i}`).value); | + | const bvo = parseFloat(document.getElementById(`bvo_${i}`).value) |
gewogenBVO += (perc / 100) * bvo; | gewogenBVO += (perc / 100) * bvo; | ||
totalPerc += perc; | totalPerc += perc; | ||
Line 172: | Line 184: | ||
} | } | ||
- | if (totalPerc | + | if (totalPerc === 0 || gewogenBVO |
- | document.getElementById(" | + | |
- | | + | |
- | } | + | |
- | const totaalWoningen | + | const totaalWoningenExact |
let sumWon = 0; | let sumWon = 0; | ||
let sumBVO = 0; | let sumBVO = 0; | ||
+ | let wonPerType = []; | ||
- | | + | |
- | const aant = Math.round((perc / 100) * totaalWoningen); | + | for (let i = 0; i < details.length; |
- | const bvoTot = aant * bvo; | + | const { perc } = details[i]; |
+ | let aant = (perc / 100) * totaalWoningenExact; | ||
+ | let afgerond | ||
+ | wonPerType.push(afgerond); | ||
+ | restant -= afgerond; | ||
+ | } | ||
+ | |||
+ | const decimaalSort = details.map((d, | ||
+ | i, rest: ((d.perc / 100) * totaalWoningenExact) % 1 | ||
+ | })).sort((a, | ||
+ | |||
+ | for (let j = 0; j < restant; j++) { | ||
+ | wonPerType[decimaalSort[j].i]++; | ||
+ | } | ||
+ | |||
+ | for (let i = 0; i < details.length; | ||
+ | const aant = wonPerType[i]; | ||
+ | const bvoTot = aant * details[i].bvo; | ||
document.getElementById(`aantal_${i}`).innerText = formatGetal(aant); | document.getElementById(`aantal_${i}`).innerText = formatGetal(aant); | ||
document.getElementById(`totbvo_${i}`).innerText = formatGetal(bvoTot); | document.getElementById(`totbvo_${i}`).innerText = formatGetal(bvoTot); | ||
sumWon += aant; | sumWon += aant; | ||
sumBVO += bvoTot; | sumBVO += bvoTot; | ||
- | }); | + | } |
- | document.getElementById(" | + | document.getElementById(" |
+ | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
Line 196: | Line 224: | ||
document.getElementById(" | document.getElementById(" | ||
< | < | ||
- | < | + | < |
`; | `; | ||
} | } | ||
Line 202: | Line 230: | ||
updateLaadvermogen(); | updateLaadvermogen(); | ||
</ | </ | ||
- | |||
</ | </ | ||
+ |
handleiding_nieuw/sub_spacematrix.1744729083.txt.gz · Last modified: 2025/04/15 14:58 by support