I kan da godt får hele koden, men jeg kan desværre ikke give jer et link, da det kører på et internt system, og der ikke er adgang hertil ude fra.
<?php
include('../static/afsnit9.php');
include('../static/afsnit3.php');
//$typer = Array("CRB", "IPE", "Robot");
$typer = $PRODUKTIONSMETODE;
$kostpristabel = Array();
$kostpristabel[1][spaendvidde] = "0-11,3";
$kostpristabel[2][spaendvidde] = "11,3-13,3";
$kostpristabel[3][spaendvidde] = "13,3-15,3";
$kostpristabel[4][spaendvidde] = "15,3-17,3";
$kostpristabel[5][spaendvidde] = "17,3-19,3";
$kostpristabel[6][spaendvidde] = "19,3-21,3";
$kostpristabel[7][spaendvidde] = "21,3-23,3";
$kostpristabel[8][spaendvidde] = "23,3-";
$kostpristabel[1][vaegt] = "0-560";
$kostpristabel[2][vaegt] = "560-720";
$kostpristabel[3][vaegt] = "720-860";
$kostpristabel[4][vaegt] = "860-1035";
$kostpristabel[5][vaegt] = "1035-1160";
$kostpristabel[6][vaegt] = "1160-1350";
$kostpristabel[7][vaegt] = "1350-1530";
$kostpristabel[8][vaegt] = "1530-";
?>
<h2>Kalkulation</h2>
<form action="kalkulation_process.php" method="post" name="ds" id="ds" style="display:inline;">
<div>
<div>
<b>Procent-satser for hovedrammer (Felt 343)</b><br>
<table border="0">
<tr>
<th colspan="2" align="center">Symmetrisk</th>
<th colspan="2" align="center">Asymmetrisk</th>
<th colspan="2" align="center">Pulttag</th>
<th rowspan="2" align="center">Gitter</th>
</tr>
<tr>
<?php for($i=0; $i<count($PROCENTSATSER); $i++) {?>
<th align="center" width="40px"> < <?php echo $PROCENTSATSER[$i][1];?></th>
<th align="center" width="40px"> > <?php echo $PROCENTSATSER[$i][2];?></th>
<? }?>
</tr>
<tr>
<?php for($i=1; $i<=count($PROCENTSATSER); $i++) {?>
<td>
<input class="small" style="width:30px;" type="text" name="procentsats[<?php echo $i;?>][1]" value="<?php echo str_replace(',', '.', $PROCENTSATS[$i][1]); ?>">%
</td>
<td>
<input class="small" style="width:30px;" type="text" name="procentsats[<?php echo $i;?>][2]" value="<?php echo $PROCENTSATS[$i][2]; ?>">%
</td>
<? }?>
<td><input class="small" style="width:20px;" type="text" name="procentsats[<?PHP echo count($PROCENTSATSER)+1;?>][1]" value="<?php echo $PROCENTSATS[count($PROCENTSATSER)+1][1]; ?>">%</td>
</tr>
</table>
</div>
<div>
<b>Procent-satser for ekstra rammer (Felt 355, 367 og 390)</b><br>
<table border="0">
<tr>
<th colspan="2" align="center">Felt 355</th>
<th colspan="2" align="center">Felt 367</th>
<th colspan="2" align="center">Felt 390</th>
</tr>
<tr>
<?php for($i=0; $i<count($PROCENTSATSER2); $i++) {?>
<th align="center" width="40px"> < <?php echo $PROCENTSATSER2[$i][1];?></th>
<th align="center" width="40px"> > <?php echo $PROCENTSATSER2[$i][2];?></th>
<? }?>
</tr>
<tr>
<?php for($i=0; $i<count($PROCENTSATSER2); $i++) {?>
<td>
<input class="small" style="width:30px;" type="text" name="procentsats2[<?php echo $i;?>][1]" value="<?php echo $PROCENTSATS2[$i][1]; ?>">%
</td>
<td>
<input class="small" style="width:30px;" type="text" name="procentsats2[<?php echo $i;?>][2]" value="<?php echo $PROCENTSATS2[$i][2]; ?>">%
</td>
<? }?>
</tr>
</table>
</div>
<br>
<div>
<b>F<sub>yd</sub> (Felt 240)</b><br>
<table border="0">
<tr>
<th align="center">Lav</th>
<th align="center">Normal</th>
<th align="center">Høj</th>
</tr>
<tr>
<td align="center"><input class="small" type="text" name="" value=""></td>
<td align="center"><input class="small" type="text" name="" value=""></td>
<td align="center"><input class="small" type="text" name="" value=""></td>
</tr>
</table>
</div>
<br>
<div class="left">
<b>Kostpris</b><br>
<table><tr><td>
Kørsel:</td><td><input class="small" type="text" name="kostpris_koersel" value="<?php echo $KOSTPRIS_KOERSEL; ?>">
</td></tr><tr><td>
Ekstern fragt:</td><td><input class="small" type="text" name="kostpris_ekstern_fragt" value="<?php echo $KOSTPRIS_EKSTERN_FRAGT; ?>"><br>
</td></tr><tr><td>
Montage stål:</td><td><input class="small" type="text" name="kostpris_montage_staal" value="<?php echo $KOSTPRIS_MONTAGE_STAAL; ?>"><br>
</td></tr><tr><td>
Ekstern kran:</td><td><input class="small" type="text" name="kostpris_ekstern_kran" value="<?php echo $KOSTPRIS_EKSTERN_KRAN; ?>"><br>
</td></tr><tr><td>
Montage sigma:</td><td><input class="small" type="text" name="kostpris_montage_sigma" value="<?php echo $KOSTPRIS_MONTAGE_SIGMA; ?>"><br>
</td></tr></table>
</div>
<div class="left">
<b>Rør</b><br>
<table>
<tr><th>Type</th><th>Kg/m</th></tr>
<?php
$maxkey = 0;
while (list($key,$val) = each($PIPE)) {
if ($key > $maxkey) $maxkey = $key;
echo "<tr>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"pipe[$key]\" value=\"$val\"></td>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"pipe2[$key]\" value=\"$PIPE2[$key]\"></td>\n";
echo "</tr>\n";
}
?>
<tr>
<td><input class="small" type="text" name="pipe[<?php echo ++$maxkey; ?>]" value=""></td>
<td><input class="small" type="text" name="pipe2[<?php echo $maxkey; ?>]" value=""></td>
</tr>
</table>
<b>Faktor: </b><input class="small" type="text" name="kipningsfaktor" value="<?php echo $KIPNINGSFAKTOR; ?>">
</div>
<div class="left">
<b>Valuta</b><br>
<table>
<tr><th>Valuta</th><th>Kurs</th></tr>
<?php
$maxkey = 0;
while (list($key,$val) = each($VALUTA)) {
if ($key > $maxkey) $maxkey = $key;
echo "<tr>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"valuta[$key]\" value=\"$val\"></td>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"valuta2[$key]\" value=\"$VALUTA2[$key]\"></td>\n";
echo "</tr>\n";
}
?>
<tr>
<td><input class="small" type="text" name="valuta[<?php echo ++$maxkey; ?>]" value=""></td>
<td><input class="small" type="text" name="valuta2[<?php echo $maxkey; ?>]" value="<?php echo $VALUTA2[$key]; ?>"></td>
</tr>
</table>
</div>
<div class="left">
<b>Portoverliggere</b><br>
<table>
<tr><th>Type</th><th>Kg/m</th><th>kr./kg</th></tr>
<?php
$maxkey = 0;
while (list($key,$val) = each($DIM)) {
if ($key > $maxkey) $maxkey = $key;
echo "<tr>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"dim[$key][type]\" value=\"".$val['type']."\"></td>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"dim[$key][kgm]\" value=\"".$val['kgm']."\"></td>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"dim[$key][krkg]\" value=\"".$val['krkg']."\"></td>\n";
echo "</tr>\n";
}
?>
<tr>
<td><input class="small" type="text" name="dim[<?php echo ++$maxkey; ?>][type]" value=""></td>
<td><input class="small" type="text" name="dim[<?php echo $maxkey; ?>][kgm]" value=""></td>
<td><input class="small" type="text" name="dim[<?php echo $maxkey; ?>][krkg]" value=""></td>
</tr>
</table>
</div>
<div class="left">
<b>Sokkeljern</b><br>
<table>
<tr><th>Type</th><th>Kg/stk.</th><th>Kostpris/stk.</th></tr>
<?php
$maxkey = 0;
while (list($key,$val) = each($DIM2)) {
if ($key > $maxkey) $maxkey = $key;
echo "<tr>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"dim2[$key][type]\" value=\"".$val['type']."\"></td>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"dim2[$key][kgstk]\" value=\"".$val['kgstk']."\"></td>\n";
echo "<td><input class=\"small\" type=\"text\" name=\"dim2[$key][krstk]\" value=\"".$val['krstk']."\"></td>\n";
echo "</tr>\n";
}
?>
<tr>
<td><input class="small" type="text" name="dim2[<?php echo ++$maxkey; ?>][type]" value=""></td>
<td><input class="small" type="text" name="dim2[<?php echo $maxkey; ?>][kgm]" value=""></td>
<td><input class="small" type="text" name="dim2[<?php echo $maxkey; ?>][krstk]" value=""></td>
</tr>
</table>
</div>
<div>
<b>Skydedøre</b><br>
<table>
<tr><th>
Kostpris:</th></tr><tr><td><input class="small" type="text" name="kostpris_skydedoere" value="<?php echo $KOSTPRIS_SKYDEDOERE; ?>">
</td></tr></table>
</div>
<div>
<input type="submit" name="gem" value="gem" size="10" class="submit">
</div>
</div>
<div style="clear:left;">
<b>Kostpristabel hovedrammer og gavlrammer (Felt 343)</b><br>
<table>
<tr><th rowspan="2">Spændvidde</th><th rowspan="2">Vægt</th>
<?php
for ($i = 1; $i <= count($KORROSIONKLASSE); $i++) {
echo "<th colspan=\"".count($typer)."\">$KORROSIONKLASSE[$i]</th>";
}
?>
</tr>
<tr>
<?php
for ($i = 0; $i < count($KORROSIONKLASSE); $i++) {
reset($typer);
while(list(,$val) = each($typer)) {
echo "<th>$val</th>\n";
}
}
?>
</tr>
<?php
for ($j = 1; $j <= count($kostpristabel); $j++) {
$mld = 1;
echo "<tr>\n";
echo "<td>".$kostpristabel[$j]['spaendvidde']."</td>\n";
echo "<td>".$kostpristabel[$j]['vaegt']."</td>\n";
$antaltyper = count($typer);
for ($i=1; $i<=($antaltyper*count($KORROSIONKLASSE)); $i++) {
$modulus = $i % $antaltyper;
if ($modulus==0){
$modulus=$antaltyper;
}
if($i>$antaltyper) {
$standard = number_format($TILLAEGOVERFLADE[$mld] + $KOSTPRIS1[$j][$modulus], 2, '.', '');
echo "<td><input class=\"small\" type=\"text\" name=\"kost1[$j][$i]\" value=\"".$standard."\"></td>\n";
if($modulus==$antaltyper){
$mld++;
}
} else {
echo "<td><input class=\"small\" type=\"text\" name=\"kost1[$j][$i]\" value=\"".$KOSTPRIS1[$j][$i]."\" onChange=\"beregn();\"></td>\n";
if($modulus==$antaltyper){
$mld++;
}
}
}
echo "</tr>\n";
}
?>
</table>
</div>
<div>
<b>Kostpristabel IPE-søjler (Felt 395)</b><br>
<table>
<tr><th rowspan="2">Spændvidde</th><th rowspan="2">Vægt</th>
<?php
for ($i = 1; $i <= count($KORROSIONKLASSE); $i++) {
echo "<th colspan=\"".count($typer)."\">$KORROSIONKLASSE[$i]</th>";
}
?>
</tr>
<tr>
<?php
reset($typer);
for ($i = 0; $i < count($KORROSIONKLASSE); $i++) {
reset($typer);
while(list(,$val) = each($typer)) {
echo "<th>$val</th>\n";
}
}
?>
</tr>
<?php
for ($j = 1; $j <= count($kostpristabel); $j++) {
$mld = 1;
echo "<tr>\n";
echo "<td>".$kostpristabel[$j]['spaendvidde']."</td>\n";
echo "<td>".$kostpristabel[$j]['vaegt']."</td>\n";
$antaltyper = count($typer);
for ($i=1; $i<=($antaltyper*count($KORROSIONKLASSE)); $i++) {
$modulus = $i % $antaltyper;
if ($modulus==0){
$modulus=$antaltyper;
}
if($i>$antaltyper) {
$standard = number_format($TILLAEGOVERFLADE[$mld] + $KOSTPRIS2[$j][$modulus], 2, '.', '');
echo "<td><input class=\"small\" type=\"text\" name=\"kost2[$j][$i]\" value=\"".$standard."\"></td>\n";
if($modulus==$antaltyper){
$mld++;
}
} else {
echo "<td><input class=\"small\" type=\"text\" name=\"kost2[$j][$i]\" value=\"".$KOSTPRIS2[$j][$i]."\"></td>\n";
if($modulus==$antaltyper){
$mld++;
}
}
}
echo "</tr>\n";
}
?>
</table>
</div>
<div>
<b>Kostpristabel U-Søjler</b><br>
<table>
<tr>
<?php
for ($i = 1; $i <= count($KORROSIONKLASSE); $i++) {
echo "<th colspan=\"".count($typer)."\">$KORROSIONKLASSE[$i]</th>";
}
?>
</tr>
<tr>
<?php
for ($i = 0; $i < count($KORROSIONKLASSE); $i++) {
reset($typer);
while(list(,$val) = each($typer)) {
echo "<th>$val</th>\n";
}
}
?>
</tr>
<tr>
<?php
$mld = 1;
$antaltyper = count($typer);
$j = 1;
for ($i=1; $i<=($antaltyper*count($KORROSIONKLASSE)); $i++) {
$modulus = $i % $antaltyper;
if ($modulus==0){
$modulus=$antaltyper;
}
if($i>$antaltyper) {
$standard = number_format($TILLAEGOVERFLADE[$mld] + $KOSTPRIS4[$j][$modulus], 2, '.', '');
echo "<td><input class=\"small\" type=\"text\" name=\"kost4[$j][$i]\" value=\"".$standard."\"></td>\n";
if($modulus==$antaltyper){
$mld++;
}
} else {
echo "<td><input class=\"small\" type=\"text\" name=\"kost4[$j][$i]\" value=\"".$KOSTPRIS4[$j][$i]."\"></td>\n";
if($modulus==$antaltyper){
$mld++;
}
}
}
?>
</tr>
</table>
</div>
<div class="left" style="width:300px;">
<b>Tillægspris HEA-søjler incl. skrottillæg</b><br>
<table>
<tr>
<?php
reset($typer);
foreach ($typer as $val) {
echo "<th>$val</th>\n";
}
?>
</tr>
<tr>
<?php
for ($i=1; $i <= count($typer); $i++) {
echo "<td><input class=\"small\" type=\"text\" name=\"tillaegHEA[$i]\" value=\"".$TILLAEGHEA[$i]."\"></td>\n";
}
?>
</tr>
</table>
</div>
<div class="left" style="width:300px;">
<b>Tillægspris HEB-søjler incl. skrottillæg</b><br>
<table>
<tr>
<?php
reset($typer);
foreach ($typer as $val) {
echo "<th>$val</th>\n";
}
?>
</tr>
<?php
for ($i=1; $i <= count($typer); $i++) {
echo "<td><input class=\"small\" type=\"text\" name=\"tillaegHEB[$i]\" value=\"".$TILLAEGHEB[$i]."\"></td>\n";
}
?>
</table>
</div>
<div>
<b>Faktor: </b><input type="text" name="faktor" class="small" value="<?php echo $FAKTOR; ?>">
</div>
<div style="clear:left;">
<b>Kostpristabel Vindkryds</b><br>
<table>
<tr>
<?php
for ($i = 1; $i <= count($KORROSIONKLASSE); $i++) {
echo "<th colspan=\"".count($typer)."\">$KORROSIONKLASSE[$i]</th>";
}
?>
</tr>
<tr>
<?php
for ($i = 0; $i < count($KORROSIONKLASSE); $i++) {
reset($typer);
while(list(,$val) = each($typer)) {
echo "<th>$val</th>\n";
}
}
?>
</tr>
<tr>
<?php
$mld = 1;
$antaltyper = count($typer);
$j = 1;
for ($i=1; $i<=($antaltyper*count($KORROSIONKLASSE)); $i++) {
$modulus = $i % $antaltyper;
if ($modulus==0){
$modulus=$antaltyper;
}
if($i>$antaltyper) {
$standard = number_format($TILLAEGOVERFLADE[$mld] + $KOSTPRIS3[$j][$modulus], 2, '.', '');
echo "<td><input class=\"small\" type=\"text\" name=\"kost3[$j][$i]\" value=\"".$standard."\"></td>\n";
if($modulus==$antaltyper){
$mld++;
}
} else {
echo "<td><input class=\"small\" type=\"text\" name=\"kost3[$j][$i]\" value=\"".$KOSTPRIS3[$j][$i]."\"></td>\n";
if($modulus==$antaltyper){
$mld++;
}
}
}
?>
</tr>
</table>
<b>IPE</b><br>
<table>
<tr><td>Wy (10x3)</td><td>Profil</td><td>Kg/m</td></tr>
<?php
$maxkey = 0;
while (list($key,$val) = each($IPE)) {
if ($key > $maxkey) $maxkey = $key;
?>
<tr>
<td><input type="text" name="ipe[<?php echo $key; ?>][wy]" value="<?php echo $val[wy]; ?>"></td>
<td><input type="text" name="ipe[<?php echo $key; ?>][profil]" value="<?php echo $val[profil]; ?>"></td>
<td><input type="text" name="ipe[<?php echo $key; ?>][kg]" value="<?php echo $val[kg]; ?>"></td>
</tr>
<?php } ?>
<td><input type="text" name="ipe[<?php echo ++$maxkey; ?>][wy]" value=""></td>
<td><input type="text" name="ipe[<?php echo $maxkey; ?>][profil]" value=""></td>
<td><input type="text" name="ipe[<?php echo $maxkey; ?>][kg]" value=""></td>
</table>
<br>
<b>HEA</b><br>
<table>
<tr><td>Wy (10x3)</td><td>Profil</td><td>Kg/m</td></tr>
<?php
$maxkey = 0;
while (list($key,$val) = each($HEA)) {
if ($key > $maxkey) $maxkey = $key;
?>
<tr>
<td><input type="text" name="hea[<?php echo $key; ?>][wy]" value="<?php echo $val[wy]; ?>"></td>
<td><input type="text" name="hea[<?php echo $key; ?>][profil]" value="<?php echo $val[profil]; ?>"></td>
<td><input type="text" name="hea[<?php echo $key; ?>][kg]" value="<?php echo $val[kg]; ?>"></td>
</tr>
<?php } ?>
<td><input type="text" name="hea[<?php echo ++$maxkey; ?>][wy]" value=""></td>
<td><input type="text" name="hea[<?php echo $maxkey; ?>][profil]" value=""></td>
<td><input type="text" name="hea[<?php echo $maxkey; ?>][kg]" value=""></td>
</table>
<br>
<b>HEB</b><br>
<table>
<tr><td>Wy (10x3)</td><td>Profil</td><td>Kg/m</td></tr>
<?php
$maxkey = 0;
while (list($key,$val) = each($HEB)) {
if ($key > $maxkey) $maxkey = $key;
?>
<tr>
<td><input type="text" name="heb[<?php echo $key; ?>][wy]" value="<?php echo $val[wy]; ?>"></td>
<td><input type="text" name="heb[<?php echo $key; ?>][profil]" value="<?php echo $val[profil]; ?>"></td>
<td><input type="text" name="heb[<?php echo $key; ?>][kg]" value="<?php echo $val[kg]; ?>"></td>
</tr>
<?php } ?>
<td><input type="text" name="heb[<?php echo ++$maxkey; ?>][wy]" value=""></td>
<td><input type="text" name="heb[<?php echo $maxkey; ?>][profil]" value=""></td>
<td><input type="text" name="heb[<?php echo $maxkey; ?>][kg]" value=""></td>
</table>
<br>
<b>U</b><br>
<table>
<tr><td>Wy (10x3)</td><td>Profil</td><td>Kg/m</td></tr>
<?php
$maxkey = 0;
while (list($key,$val) = each($U)) {
if ($key > $maxkey) $maxkey = $key;
?>
<tr>
<td><input type="text" name="u[<?php echo $key; ?>][wy]" value="<?php echo $val[wy]; ?>"></td>
<td><input type="text" name="u[<?php echo $key; ?>][profil]" value="<?php echo $val[profil]; ?>"></td>
<td><input type="text" name="u[<?php echo $key; ?>][kg]" value="<?php echo $val[kg]; ?>"></td>
</tr>
<?php } ?>
<td><input type="text" name="u[<?php echo ++$maxkey; ?>][wy]" value=""></td>
<td><input type="text" name="u[<?php echo $maxkey; ?>][profil]" value=""></td>
<td><input type="text" name="u[<?php echo $maxkey; ?>][kg]" value=""></td>
</table>
<p>
<b>Forudsætninger og forbehold</b><br>
<textarea cols="40" rows="5" name="standardforbehold">
<?php echo $STANDARDFORBEHOLD; ?>
</textarea>
</p>
</div>
</form>
og koden fra kalkulation_process, som sørger for at gemme data.
<?php
include('../static/afsnit3.php');
$res = '<?php
# DO NOT EDIT THIS FILE MANUALLY !!!
$KOSTPRIS_KOERSEL = '.str_replace(',','.',$_POST['kostpris_koersel']).';
$KOSTPRIS_EKSTERN_FRAGT = '.str_replace(',','.',$_POST['kostpris_ekstern_fragt']).';
$KOSTPRIS_MONTAGE_STAAL = '.str_replace(',','.',$_POST['kostpris_montage_staal']).';
$KOSTPRIS_EKSTERN_KRAN = '.str_replace(',','.',$_POST['kostpris_ekstern_kran']).';
$KOSTPRIS_MONTAGE_SIGMA = '.str_replace(',','.',$_POST['kostpris_montage_sigma']).';
$KOSTPRIS_SKYDEDOERE = '.str_replace(',','.',$_POST['kostpris_skydedoere']).';
$PIPE = array(
';
while (list($key,$val) = each($_POST['pipe'])) {
if ($val) $res .= ' "'.$key.'" => "'.$val.'",'."\n";
}
$res .= '
);
$PIPE2 = array(
';
while (list($key,$val) = each($_POST['pipe2'])) {
if ($val) $res .= ' "'.$key.'" => "'.$val.'",'."\n";
}
$res .= '
);
$KIPNINGSFAKTOR = '.str_replace(',','.',$_POST['kipningsfaktor']).';
$VALUTA = array(
';
while (list($key,$val) = each($_POST['valuta'])) {
if ($val) $res .= ' "'.$key.'" => "'.$val.'",'."\n";
}
$res .= '
);
$VALUTA2 = array(
';
while (list($key,$val) = each($_POST['valuta2'])) {
if ($val) $res .= ' "'.$key.'" => "'.str_replace(',','.',$val).'",'."\n";
}
$res .= '
);
$PROCENTSATS = array();'."\n";
while (list($key,$val) = each($_POST['procentsats'])) {
$res .= ' $PROCENTSATS['.$key."][1] = '".$val[1]."';\n";
$res .= ' $PROCENTSATS['.$key."][2] = '".$val[2]."';\n";
}
$res .= '
$PROCENTSATS2 = array();'."\n";
while (list($key,$val) = each($_POST['procentsats2'])) {
$res .= ' $PROCENTSATS2['.$key."][1] = '".$val[1]."';\n";
$res .= ' $PROCENTSATS2['.$key."][2] = '".$val[2]."';\n";
}
$res .= '
$DIM = array();'."\n";
while (list($key,$val) = each($_POST['dim'])) {
if ($val[type] != '') {
$res .= ' $DIM['.$key."][type] = '".$val[type]."';\n";
$res .= ' $DIM['.$key."][kgm] = '".$val[kgm]."';\n";
$res .= ' $DIM['.$key."][krkg] = '".$val[krkg]."';\n";
}
}
$res .= ' $DIM2 = array();'."\n";
while (list($key,$val) = each($_POST['dim2'])) {
if ($val[type] != '') {
$res .= ' $DIM2['.$key."][type] = '".$val[type]."';\n";
$res .= ' $DIM2['.$key."][kgstk] = '".$val[kgstk]."';\n";
$res .= ' $DIM2['.$key."][krstk] = '".$val[krstk]."';\n";
}
}
$res .= ' $FAKTOR = '."'".$_POST['faktor']."';\n";
$res .= '$STANDARDFORBEHOLD = ' . "'" . $_POST['standardforbehold'] . "';\n\n";
$res .= '
$KOSTPRIS1 = array();'."\n";
for ($i=1; $i<=8; $i++) {
$res .= '$KOSTPRIS1['.$i.'] ='." array('0";
for($j=1; $j<=(count($PRODUKTIONSMETODE)*count($KORROSIONKLASSE)); $j++) {
$res .= "','";
if ($_POST['kost1'][$i][$j] == '') $res .= '0';
else $res .= str_replace(",", ".", $_POST['kost1'][$i][$j]);
}
$res .= "');\n\n";
}
$res .= '$KOSTPRIS2 = array();'."\n";
for ($i=1; $i<=8; $i++) {
$res .= '$KOSTPRIS2['.$i.'] ='." array('0";
for($j=1; $j<=(count($PRODUKTIONSMETODE)*count($KORROSIONKLASSE)); $j++) {
$res .= "','";
if ($_POST['kost2'][$i][$j] == '') $res .= '0';
else $res .= str_replace(",", ".", $_POST['kost2'][$i][$j]);
}
$res .= "');\n\n";
}
$i = 1;
$res .= '$KOSTPRIS3 = array();'."\n";
$res .= '$KOSTPRIS3['.$i.'] ='." array('0";
for($j=1; $j<=(count($PRODUKTIONSMETODE)*count($KORROSIONKLASSE)); $j++) {
$res .= "','";
if ($_POST['kost3'][$i][$j] == '') $res .= '0';
else $res .= str_replace(",", ".", $_POST['kost3'][$i][$j]);
}
$res .= "');\n\n";
$i = 1;
$res .= '$KOSTPRIS4 = array();'."\n";
$res .= '$KOSTPRIS4['.$i.'] ='." array('0";
for($j=1; $j<=(count($PRODUKTIONSMETODE)*count($KORROSIONKLASSE)); $j++) {
$res .= "','";
if ($_POST['kost4'][$i][$j] == '') $res .= '0';
else $res .= str_replace(",", ".", $_POST['kost4'][$i][$j]);
}
$res .= "');\n\n";
$res .= '$TILLAEGHEA'." = array('0','" . implode("','", $_POST['tillaegHEA']) . "');\n\n";
$res .= '$TILLAEGHEB'." = array('0','" . implode("','", $_POST['tillaegHEB']) . "');\n\n";
$res .= '$IPE = array();'."\n";
while (list($key,$val) = each($_POST['ipe'])) {
if ($val[profil] != "") {
$res .= ' $IPE['.$key."][wy] = '".$val[wy]."';\n";
$res .= ' $IPE['.$key."][profil] = '".$val[profil]."';\n";
$res .= ' $IPE['.$key."][kg] = '".$val[kg]."';\n";
}
}
$res .= "\n";
$res .= '$HEA = array();'."\n";
while (list($key,$val) = each($_POST['hea'])) {
if ($val[profil] != "") {
$res .= ' $HEA['.$key."][wy] = '".$val[wy]."';\n";
$res .= ' $HEA['.$key."][profil] = '".$val[profil]."';\n";
$res .= ' $HEA['.$key."][kg] = '".$val[kg]."';\n";
}
}
$res .= "\n";
$res .= '$HEB = array();'."\n";
while (list($key,$val) = each($_POST['heb'])) {
if ($val[profil] != "") {
$res .= ' $HEB['.$key."][wy] = '".$val[wy]."';\n";
$res .= ' $HEB['.$key."][profil] = '".$val[profil]."';\n";
$res .= ' $HEB['.$key."][kg] = '".$val[kg]."';\n";
}
}
$res .= "\n";
$res .= '$U = array();'."\n";
while (list($key,$val) = each($_POST['u'])) {
if ($val[profil] != "") {
$res .= ' $U['.$key."][wy] = '".$val[wy]."';\n";
$res .= ' $U['.$key."][profil] = '".$val[profil]."';\n";
$res .= ' $U['.$key."][kg] = '".$val[kg]."';\n";
}
}
$res .= "\n";
$res .= '?>';
# Update the file
$fp = fopen('../static/afsnit9.php', "w");
fputs($fp, $res);
fclose($fp);
header("Location: index.php?page=kalkulation");
?>