test page

<html><!DOCTYPE html>
<head>

<style>
	* { font-family: verdana; font-size: 10pt; COLOR: gray; }
	table { border: 1px solid black;border-collapse: collapse; padding: 150px; padding-left: 50px; width: 800px }
	tr:nth-child(even) {background-col: #ffffff; }
 td {text-align: left; COLOR: gray; }
 td.tdr {text-align: right; }
	td.tdc {text-align: center; }
 td.tdtot {text-align: right; background-color:#dddddd;}
 th { height: 50px; text-align: center; COLOR: gray;}

.button {
         background-color: #1c87c9;
         border: none;
         color: white;
         padding: 20px 34px;
         text-align: center;
         text-decoration: none;
         display: inline-block;
         font-size: 20px;
         margin: 4px 2px;
         cursor: pointer;
         }
.errmes {text-align: left; COLOR: red;}
.goodmes {text-align: left; COLOR: green;}

	
}
</style>
</head>
<body>

<?php

//single vars
//var init
$regels = 0;
$aktie = "";
$times = 0;
$korting = 0.0;

$regels=(int)$_GET["regels"];
$aktie= $_GET["aktie"];
$times= (int)$_GET["times"];
$korting=(float)$_GET["korting"];

echo "<center>";
echo "<img src=\"passier-logo.png\" alt=passier>";
echo "<img src=\"passierlogo.png\" alt=passier>";
echo "<br><br><br><br>";

//adres tabel
echo "<table>";
echo "<tr>";
echo "<td>". "Passier Bathrooms & Wellness" ."<br><br></td>";
echo "<td>". "Klant naam" ."<br><br></td>";
echo "</tr>";

echo "<tr>";
echo "<td>". "DENNEWEG 070". "</td>";
echo "<td>". "klant Straat". "</td>";
echo "</tr>";

echo "<tr>";
echo "<td>". "CJ 2514 Den Haag". "</td>";
echo "<td>". "Klant postcode stad". "</td>";

echo "</tr>";
echo "<tr>";
echo "<td>", "Netherlands". "</td>";
echo "<td>", "Klantland". "</td>";
echo "</tr>";
echo " </table>";

echo "<br><br><br>";


if ($aktie!="klaar")
{
  echo "<table>";
  echo "<tr>";
  echo "<td><b>- Na het invoeren van een nieuwe regel altijd \"calculeer en nieuwe regel\" drukken</td>";
  echo "</tr>";
  
  echo "<tr>";
  echo "<td><b>- Als je alle regels hebt ingevuld (ook korting!) op \"klaar\" drukken</td>";
  echo "</tr>";
		echo "<tr>";
  echo "<td><b>- Als er iets niet klopt kun je met \"pagina terug\" in je browser het veranderen</td>";
  echo "</tr>";
  echo "<tr>";
  echo "<td><b>- In het Safari menu klik op \"Bestand\" en kies \"Export als PDF\"</td>";
  echo "</tr>";
  echo "</table>";
  echo "<br><br><br><br>";
}


//als we klaar zijn moet de volgende tabel in midden staan
//echo "</center>";







$totex = 0.0;

//2 display in table
$aant2D = "";
$art2D = "";
$img2D = "";
$col2D = "";
$price2D = 0.0;
$am2D = 0.0;
$totex2D = 0.0;

//strings
$art0="";$art1="";$art2="";$art3="";$art4="";$art5="";$art6="";$art7="";$art8="";$art9="";
$img0="";$img1="";$img2="";$img3="";$img4="";$img5="";$img6="";$img7="";$img8="";$img9="";
$col0="";$col1="";$col2="";$col3="";$col4="";$col5="";$col6="";$col7="";$col8="";$col9="";



//numbers
$aant0=0;$aant1=0;$aant2=0;$aant3=0;$aant4=0;$aant5=0;$aant6=0;$aant7=0;$aant8=0;$aant9=0;

$price0 = 0.0;
$price1 = 0.0;
$price2 = 0.0;
$price3 = 0.0;
$price4 = 0.0;
$price5 = 0.0;
$price6 = 0.0;
$price7 = 0.0;
$price8 = 0.0;
$price9 = 0.0;

$am0 = 0.0;
$am1 = 0.0;
$am2 = 0.0;
$am3 = 0.0;
$am4 = 0.0;
$am5 = 0.0;
$am6 = 0.0;
$am7 = 0.0;
$am8 = 0.0;
$am9 = 0.0;





?>

<?php
//$aant0=0;
// if aant is not numeric the (int) will make it 0
$aant0=(int)$_GET["aant0"];
$aant1=(int)$_GET["aant1"];
$aant2=(int)$_GET["aant2"];
$aant3=(int)$_GET["aant3"];
$aant4=(int)$_GET["aant4"];
$aant5=(int)$_GET["aant5"];
$aant6=(int)$_GET["aant6"];
$aant7=(int)$_GET["aant7"];
$aant8=(int)$_GET["aant8"];
$aant9=(int)$_GET["aant9"];

$art0=$_GET["art0"];
$art1=$_GET["art1"];
$art2=$_GET["art2"];
$art3=$_GET["art3"];
$art4=$_GET["art4"];
$art5=$_GET["art5"];
$art6=$_GET["art6"];
$art7=$_GET["art7"];
$art8=$_GET["art8"];
$art9=$_GET["art9"];

$img0=$_GET["img0"];
$img1=$_GET["img1"];
$img2=$_GET["img2"];
$img3=$_GET["img3"];
$img4=$_GET["img4"];
$img5=$_GET["img5"];
$img6=$_GET["img6"];
$img7=$_GET["img7"];
$img8=$_GET["img8"];
$img9=$_GET["img9"];

$col0=$_GET["col0"];
$col1=$_GET["col1"];
$col2=$_GET["col2"];
$col3=$_GET["col3"];
$col4=$_GET["col4"];
$col5=$_GET["col5"];
$col6=$_GET["col6"];
$col7=$_GET["col7"];
$col8=$_GET["col8"];
$col9=$_GET["col9"];

$price0=(float)$_GET["price0"];
$price1=(float)$_GET["price1"];
$price2=(float)$_GET["price2"];
$price3=(float)$_GET["price3"];
$price4=(float)$_GET["price4"];
$price5=(float)$_GET["price5"];
$price6=(float)$_GET["price6"];
$price7=(float)$_GET["price7"];
$price8=(float)$_GET["price8"];
$price9=(float)$_GET["price9"];

$am0=(float)$_GET["am0"];
$am1=(float)$_GET["am1"];
$am2=(float)$_GET["am2"];
$am3=(float)$_GET["am3"];
$am4=(float)$_GET["am4"];
$am5=(float)$_GET["am5"];
$am6=(float)$_GET["am6"];
$am7=(float)$_GET["am7"];
$am8=(float)$_GET["am8"];
$am9=(float)$_GET["am9"];


//
//output debug vars
//
$debug=0;
if ($aktie =="klaar")$debug=0;
if($debug==1)
{
	
//show em
echo "regels=[$regels]<br>";
echo "aktie=[$aktie]<BR>";
echo "times=[$times]<br>";
echo "korting=[$korting]<br>";
if (!isset($times)) echo "<div class=errmes> times is NOT set</div><br>";
if($times==0) echo "<div class=errmes>times=0</div><br>";
if(empty($korting)) echo "<div class=\"errmes\">korting is empty</div><br>";

echo "aant0=",$aant0;echo "<br>";
echo "aant1=",$aant1;echo "<br>";
echo "aant2=",$aant2;echo "<br>";
echo "aant3=",$aant3;echo "<br>";
echo "aant4=",$aant4;echo "<br>";
echo "aant5=",$aant5;echo "<br>";
echo "aant6=",$aant6;echo "<br>";
echo "aant7=",$aant7;echo "<br>";
echo "aant8=",$aant8;echo "<br>";
echo "aant9=",$aant9;echo "<br>";

echo "art0=",$art0;echo "<br>";
echo "art1=",$art1;echo "<br>";
echo "art2=",$art2;echo "<br>";
echo "art3=",$art3;echo "<br>";
echo "art4=",$art4;echo "<br>";
echo "art5=",$art5;echo "<br>";
echo "art6=",$art6;echo "<br>";
echo "art7=",$art7;echo "<br>";
echo "art8=",$art8;echo "<br>";
echo "art9=",$art9;echo "<br>";

echo "img0=",$img0;echo "<br>";
echo "img1=",$img1;echo "<br>";
echo "img2=",$img2;echo "<br>";
echo "img3=",$img3;echo "<br>";
echo "img4=",$img4;echo "<br>";
echo "img5=",$img5;echo "<br>";
echo "img6=",$img6;echo "<br>";
echo "img7=",$img7;echo "<br>";
echo "img8=",$img8;echo "<br>";
echo "img9=",$img9;echo "<br>";

echo "col0=",$col0;echo "<br>";
echo "col1=",$col1;echo "<br>";
echo "col2=",$col2;echo "<br>";
echo "col3=",$col3;echo "<br>";
echo "col4=",$col4;echo "<br>";
echo "col5=",$col5;echo "<br>";
echo "col6=",$col6;echo "<br>";
echo "col7=",$col7;echo "<br>";
echo "col8=",$col8;echo "<br>";
echo "col9=",$col9;echo "<br>";

echo "price0=",$price0;echo "<br>";
echo "price1=",$price1;echo "<br>";
echo "price2=",$price2;echo "<br>";
echo "price3=",$price3;echo "<br>";
echo "price4=",$price4;echo "<br>";
echo "price5=",$price5;echo "<br>";
echo "price6=",$price6;echo "<br>";
echo "price7=",$price7;echo "<br>";
echo "price8=",$price8;echo "<br>";
echo "price9=",$price9;echo "<br>";

echo "am0=",$am0;echo "<br>";
echo "am1=",$am1;echo "<br>";
echo "am2=",$am2;echo "<br>";
echo "am3=",$am3;echo "<br>";
echo "am4=",$am4;echo "<br>";
echo "am5=",$am5;echo "<br>";
echo "am6=",$am6;echo "<br>";
echo "am7=",$am7;echo "<br>";
echo "am8=",$am8;echo "<br>";
echo "am9=",$am9;echo "<br>";


//show some aantal stuff
if (!isset($aant0)) echo "<div class=\"errmes\"> aant0 is niet set</div>";
if (!is_numeric($aant0)) echo "<div class=\"errmes\"> aant0 is niet numeriek</div>";

}//if debug

?>

<?php
//$regels=1;
//if ($regels==0)
if ($aktie!="klaar"){
	$regels++;
	if($debug==1) echo "<div class=\"goodmes\">added a line</div>";
}else{
	if ($debug==1)echo "<div class=\"errmes\">Did NOT add a line</div>";
}




echo "<form action=\"off1.php\" method=\"get\">";

echo "<table border=\"1\">";
echo "<tbody>";

echo "<th>#</th>";
echo "<th>Aantal</th>";
echo "<th>Artikel</th>";
echo "<th>Foto</th>";
echo "<th>Kleur</th>";
echo "<th>Prijs/Stuk</th>";
//echo "<th>Korting</th>";
//echo "<th>NettoBedrag</th>";
echo "<th>Bedrag</th>";





for($x=0;$x<$regels;$x++)
{


switch ($x) {
    case 0:
         $art2D = $art0;
								 $aant2D = $aant0;
         $img2D = $img0;
								 $col2D = $col0;
								 $price2D = $price0;
         $am0 = (float)$aant0 * (float)($price0);
								 $am2D = $am0;
        break;
    case 1:
         $art2D = $art1;
 								$aant2D = $aant1;
									$img2D = $img1;
 								$col2D = $col1;
								 $price2D = $price1;
									$am1 = (float)$aant1 * (float)($price1);
								$am2D = $am1;
       break;
    case 2:
         $art2D = $art2;
 						 	$aant2D = $aant2;
         $img2D = $img2;
  							$col2D = $col2;
 								$price2D = $price2;
         $am2 = (float)$aant2 * (float)($price2);
								 $am2D = $am2;									
       break;
    case 3:
         $art2D = $art3;
 								$aant2D = $aant3;
         $img2D = $img3;
									$col2D = $col3;
 								$price2D = $price3;
		       $am3 = (float)$aant3 * (float)($price3);
	 							$am2D = $am3;
        break;
    case 4:
         $art2D = $art4;
								 $aant2D = $aant4;
         $img2D = $img4;
								 $price2D = $price4;
		       $am4 = (float)$aant4 * (float)($price4);
	 							$am2D = $am4;
        break;
    case 5:
         $art2D = $art5;
 								$aant2D = $aant5;
         $img2D = $img5;
								 $price2D = $price5;
		       $am5 = (float)$aant5 * (float)($price5);
								 $am2D = $am5;									
         break;
    case 6:
         $art2D = $art6;
 							 $aant2D = $aant6;
         $img2D = $img6;
								 $price2D = $price6;
		       $am6 = (float)$aant6 * (float)($price6);
 								$am2D = $am6;									
        break;
    case 7:
         $art2D = $art7;
 							 $aant2D = $aant7;
         $img2D = $img7;
								 $price2D = $price7;
									$am7 = (float)$aant7 * (float)($price7);
								 $am2D = $am7;									
          break;
    case 8:
 							 $aant2D = $aant8;
         $art2D = $art8;
         $img2D = $img8;
								 $price2D = $price8;
		       $am8 = (float)$aant8 * (float)($price8);		
								 $am2D = $am8;									
        break;
    case 9:
 							 $aant2D = $aant9;
         $art2D = $art9;
         $img2D = $img9;
								 $price2D = $price9;
		       $am9 = (float)$aant9 * (float)($price9);															 
									$am2D = $am9;									
        break;
    default:
    $art2D = "huh";

}
//calc totaal ex BTW
$totex += $am2D;
//aantal always at least 1
if ($aant2D==0) $aant2D=1;

//if artikel empty show some stuff
if ($art2D=="")
{
	;
	if ($debug==1) echo "times=".$times."regel=".$x." art2D is empty string ";
}
$show=1.0;
if ($x>=5) $show = 0;
if ($debug==1) echo "show=[".$show."]<br>";

//new artikelregel ddus niet totaal en BTW die komen erna
//if ($art2D!="" && $times!= 0)
//{
if( $show==1)
{
echo "<tr>";

// regel nr
$tel = 0;
$tel = $x + 1;
//$tel = $x;
echo " <td>" . $tel ."</td>";

//column aantal
if ($aktie!="klaar"){
 echo "<td>";
 echo "<input type=\"text\" name=\"aant$x\" value=\"$aant2D\">";
 echo "</td>";
}else{
 echo "<td>";
 echo "$aant2D";
 echo "</td>";	
}

//column artikel


if ($aktie!="klaar")
{
 echo "<td>";
	echo "<input type=\"text\" name=\"art$x\" value=\"$art2D\">";
 echo "</td>";
}
else
{
	echo "<td>";
	echo $art2D;
 echo "</td>";
}


//column plaatje
if (empty($img2D)){
   //echo "<td>Selecteer een foto: <BR><input type=\"file\" name=\"img$x\"></td>";
			echo "<td><input type=\"file\" name=\"img$x\"></td>";
 }
 else{
   //echo "<td>geselecteerde foto: $img2D";
			echo "<td class=\"tdc\">";
			echo "<img src=\"$img2D\" alt=\"passier\" style=\"width:50px;height:50px;\">";
   echo "<input type=\"hidden\" name=\"img$x\" value=\"$img2D\">";
   echo "</td>";
 }
	
	//column kleur
if (empty($col2D)){
   //echo "<td>Selecteer een kleur: <BR><input type=\"file\" name=\"col$x\"></td>";
			echo "<td><input type=\"file\" name=\"col$x\"></td>";
 }
 else{
   //echo "<td>geselecteerde kleur: $col2D";
			echo "<td class=\"tdc\">";
			echo "<img src=\"$col2D\" alt=\"passier\" style=\"width:50px;height:50px;border:1px;\">";
   echo "<input type=\"hidden\" name=\"col$x\" value=\"$col2D\">";
   echo "</td>";
 }
	//column price
if ($aktie!="klaar"){
 echo "<td>";
 //echo "<input type=\"text\" style=\"font-size:18pt;height:420px;width:200px;\">";
 echo "<input type=\"text\" name=\"price$x\" value=\"$price2D\">";
 echo "</td>";	
}else{
 echo "<td class=\"tdr\">";
 echo "€";
 echo number_format(floatval($price2D), 2)."\n";
 echo "</td>";	
}

//column amount
//echo " <td class=\"tdr\">" . floatval($am2D) ."</td>";
echo "<td class=\"tdr\">";
echo "€";
echo number_format(floatval($am2D), 2)."\n";
echo "</td>";

 echo " </tr>";
}//if show einde artikel rgel	
}//for loop





//totaal ex BTWregel
echo " <tr>";
echo " <td class=\"tdtot\">Totaal</td>";
echo " <td class=\"tdtot\" colspan=5></td>";
echo " <td class=\"tdtot\">";
echo "€";
echo number_format(floatval($totex), 2)."\n";
echo "</td>";
echo " </tr>";

//Korting regel
echo " <tr>";
echo " <td class=\"tdtot\">Korting</td>";
echo " <td class=\"tdtot\" colspan=5></td>";
if ($aktie!="klaar"){
 $titi = number_format(floatval($korting), 2)."\n";
 //echo "<td><input text-align: right; type=\"text\" name=\"korting\" value=\"$korting\"></td>";
	echo "<td><input text-align: right; type=\"text\" name=\"korting\" value=\"$titi\"></td>";
}
else
{
echo "<td class=\"tdtot\">";
 echo "€";
 echo number_format(floatval($korting), 2)."\n";
	echo "</td>";
 //korting is not input pass it as a hidden
 //echo "<input type=\"hidden\" name=\"korting\" value=\"$korting\">";  
}






echo " </tr>";




//BTW
echo " <tr>";
echo "<td class=\"tdtot\">BTW(21%)</td>";
echo "<td class=\"tdtot\" colspan=5></td>";
echo "<td class=\"tdtot\">";
$titi=0.0;
$titi= floatval(0.21 * (floatval($totex) - floatval($korting)));
echo "€";
echo number_format($titi, 2)."\n";
echo "</td>";
echo "</tr>";
//te voldoen
echo " <tr>";
echo "<td class=\"tdtot\">Te voldoen</td>";
echo "<td class=\"tdtot\" colspan=5></td>";
echo "<td class=\"tdtot\">";
$titi=0.0;
$titi= floatval(1.21 * (floatval($totex) - floatval($korting)));
//echo "$titi";
echo "€";
echo number_format($titi, 2)."\n";
echo "</td>";
echo "</tr>";










echo "</table>";

if ($aktie!="klaar"){
 echo "<input type=\"submit\" value=\"Calculeer+nieuwe regel\">";
 echo "<input type=\"hidden\" name=\"aktie\" value=\"$aktie\">";  
 $times++;
 echo "<input type=\"hidden\" name=\"times\" value=\"$times\">";
 echo "<input type=\"hidden\" name=\"regels\" value=\"$regels\">";  
}



$art4 = "POLO MARMO STACKABLE VALET TRAYS LONG RECTANGULAR MINI PRINTED CALFSKIN GOLF: TOBACCO MARBLES: TRAVERTINO STITCHING: TOBACCO cm 26 x 9.5 | h. cm 1.6 H.S. CODE: 68020000";
//als we klaar zijn de buttn niet laten zien
if ($aktie!="klaar")
{
 echo "<a class=button href=\"off1.php?aktie=klaar";
 echo "&regels=$regels";
 echo "&korting=$korting";
 echo "&times=$times";
 echo "&aant0=$aant0&aant1=$aant1&aant2=$aant2&aant3=$aant3&aant4=$aant4&aant5=$aant5&aant6=$aant6&aant7=$aant7&aant8=$aant8&aant9=$aant9";
 echo "&art0=$art0&art1=$art1&art2=$art2&art3=$art3&art4=$art4&art5=$art5&art6=$art6&art7=$art7&art8=$art8&art9=$art9";
 echo "&img0=$img0&img1=$img1&img2=$img2&img3=$img3&img4=$img4&img5=$img5&img6=$img6&img7=$img7&img8=$img8&img9=$img9";
 echo "&col0=$col0&col1=$col1&col2=$col2&col3=$col3&col4=$col4&col5=$col5&col6=$col6&col7=$col7&col8=$col8&col9=$col9";
 echo "&price0=$price0&price1=$price1&price2=$price2&price3=$price3&price4=$price4&price5=$price5&price6=$price6&price7=$price7&price8=$price8&price9=$price9";
 echo "&am0=$am0&am1=$am1&am2=$am2&am3=$am3&am4=$am4&am5=$am5&am6=$am6&am7=$am7&am8=$am8&am9=$am9";
 echo "\">Klaar</a>";
}
//echo "<input type=\"submit\" value=\"verwijder regel\">";
//$aktie="remove";
//echo "<input type=\"hidden\" name=\"aktie\" value=\"$aktie\">";  
//echo "hoeveel regels: <input type=\"text\" name=\"regels\"><br>";
//echo"art2D=[",$art2D,"]<BR>";
//echo "<input type=\"text\" style=\"font-size:18pt;height:420px;width:200px;\">";
//laatste columns
//echo "<td>";
//echo "<input type=\"text\" style=\"font-size:18pt;height:420px;width:200px;\">";
//echo "<input type=\"text\" name=\"am$x\" value=\"$am2D\">";
//echo "</td>";
//echo " <td>" . $temp5 ."</td>";
//echo "aantal*price=".(float)$aant0 * (float)($price0)."<BR>";

echo "</form>";

?>
</body>
</html>