05-23-2010, 05:57 PM
|
#8 (permalink)
|
|
The Acquainted
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
|
here it is....
Seems to work well, may not be "up to standard" but it's a work in progress !!!
Probably a bit mixed up as have thrown it together but the functionality is all am bothered about right now, can pretty it up once am happy with everything...
Now am playing with GD to overlay text and dimensions on the image http://sparks.homelinux.net/astromezz/med_stringer.png
Once I have done that I want to be able to make a link so it can be downloaded as a pdf, have had a quick look at fpdf, and went back to GD... Lots to do for a bit of fun..
PHP Code:
<html>
<head><title>Astromezz Stringer Calculator</title>
<STYLE TYPE="text/css">
<!--
TD{font-family: Arial; font-size: 12pt;}
H1{font-family: Arial; font-size: 16pt;}
body{font-family: Arial; font-size: 12pt;}
spec1{font-family: Arial; font-size: 14pt;}
--->
</STYLE>
</head>
<body>
<?php
$d_height = $_POST["d_height"];
$d_angle = $_POST["d_angle"];
$j_ref = $_POST["j_ref"];
$j_name = $_POST["j_name"];
$j_qty = $_POST["j_qty"];
# echo "<table border=\"1\" align=\"center\" size=\"100%\">";
echo "<table style=\"width: 100%; height: 199px; text-align: left; margin-left: auto; margin-right: auto;\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">";
echo "<tr><td style=\"white-space: nowrap; width: 25%; text-align: center;\" ><big><big><u>Job No. : " . $j_ref . "</big></big></u></td><td style=\"white-space: nowrap; width: 50%;\"></td>";
echo "<td style=\"white-space: nowrap; width: 25%; text-align: center;\"><big><big><u>Name Ref. : " . $j_name . "</big></big></u></td></tr>";
echo " <tr align=\"center\">
<td colspan=\"3\" rowspan=\"1\" nowrap=\"nowrap\"
valign=\"undefined\"><big><big><big><u><i><b>STAIRCASE
DETAILS</big></big></big></u></i></b></td>
</tr>";
echo " <tr align=\"center\">
<td colspan=\"3\" rowspan=\"1\" nowrap=\"nowrap\"
valign=\"undefined\"><br><br><br><br><br><br><br><img src=\"med_stringer.png\"></td>
</tr>
</table>";
echo "<br><br><br><br>";
echo "<table style=\"text-align: left; width: 33%;\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">";
function calc_steps($y,$z,$x,$w)
{
# $y = Min step Height
# $z = Max Step Height
# $x = Deck (floor) height
# $w = Stringer (stair) length
#
#
$aa = 1; #### Increment steps 1 ...
while ( ($x / $aa) > $y )
{
$aa++;
}
echo "<tr><td>Rises in flight :</td><td>" . ($aa - 1) . "</td>";
echo "<tr><td>Tread Rise Height :</td><td>" . round(($x / ($aa - 1)),2) . "</td>";
echo "<tr><td>Going Along Flat : </td><td>" . round(($w / ($aa - 1)),1) . "</td>";
if ( ($x / ($aa - 1)) > $z )
{
echo "<br><b>Rise Height greater than max allowed !!! </b><i>(". $z . "mm)</i>";
echo "<br> Using one extra step (". $aa .") would give a Rise height of : ";
echo round($x / ($aa),2) . "mm";
echo "<br> But that is below the Minimum Rise height of " . $y . "mm";
}
}
switch ($d_angle){
case "35";
$str_len = $d_height * 1.743;
$floor_len = $d_height * 1.428;
echo "<tr><td style=\"white-space: nowrap; width: 50%;\">Deck Height : </td><td style=\"white-space: nowrap; width: 50%;\">" . $d_height . "</td>";
echo "<tr><td>Stringer Length : </td><td>" . round($str_len,1) . "</td>";
echo "<tr><td>Floor Length : </td><td>" . round($floor_len,1) . "</td>";
echo "<tr><td>Stair Angle : </td><td>" . $d_angle ?>°<?php echo "</td>";
calc_steps(175,181.59,$d_height,$str_len);
break;
case "36";
$str_len = $d_height * 1.701;
$floor_len = $d_height * 1.376;
echo "<tr><td style=\"white-space: nowrap; width: 50%;\">Deck Height : </td><td style=\"white-space: nowrap; width: 50%;\">" . $d_height . "</td>";
echo "<tr><td>Stringer Length : </td><td>" . round($str_len,1) . "</td>";
echo "<tr><td>Floor Length : </td><td>" . round($floor_len,1) . "</td>";
echo "<tr><td>Stair Angle : </td><td>" . $d_angle ?>°<?php echo "</td>";
calc_steps(181.6,188.39,$d_height,$str_len);
break;
case "37";
$str_len = $d_height * 1.6617;
$floor_len = $d_height * 1.327;
echo "<tr><td style=\"white-space: nowrap; width: 50%;\">Deck Height : </td><td style=\"white-space: nowrap; width: 50%;\">" . $d_height . "</td>";
echo "<tr><td>Stringer Length : </td><td>" . round($str_len,1) . "</td>";
echo "<tr><td>Floor Length : </td><td>" . round($floor_len,1) . "</td>";
echo "<tr><td>Stair Angle : </td><td>" . $d_angle ?>°<?php echo "</td>";
calc_steps(188.4,190,$d_height,$str_len);
break;
} ## end case
?>
</table>
<big><big><big><u><i><b>Qty of Stringer Pairs Required : <?php echo $j_qty; ?></big></big></big></u></i></b>
</body>
</html>
__________________
Thanks... Simon
Sex, Drugs & Linux Rules
|
|
|