wcf.regNote.message
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
$i = 0;
$dateiname = "../../../buchungen/$buchungen".".txt";
if(file_exists($dateiname)){ //prüfe ob Datei vorhanden
$datei = fopen($dateiname, "r+"); //öffne Datei zum lesen
if($datei){
echo "<table width='100%' border='0'>";
echo "<tr><td class='abfrage' width='2%'>Nr.</td><td class='abfrage' width='12%'>Res-Nummer</td><td class='abfrage' width='5%'>Herkunft</td><td class='abfrage' width='10%'>Gastname</td><td class='abfrage' width='6%'>Anreise</td><td class='abfrage' width='6%'>Abreise</td><td class='abfrage' width='2%'>Nächte</td>";
echo "<td class='abfrage' width='6%'>Preis Kat1</td><td class='abfrage' width='8%'>Gesamt Kat1</td><td class='abfrage' width='6%'>Preis Kat2</td><td class='abfrage' width='8%'>Gesamt Kat2</td><td class='abfrage' width='8%'>12% Komm</td><td class='abfrage' width='8%'>Status Kat1</td>";
echo "<td colspan='2'class='abfrage' width='8%'>Status Kat2</td></tr>";
echo "<tr><td colspan='15' class='abfrage'> </td></tr>";
$nr = 0;
$gesamtkommi = 0;
$gesamtkat1 = 0;
$gesamtkat2 = 0;
while(!feof($datei)){ //mache bis Datei zu Ende
$zeile = fgets($datei, 255); //lese zeilenweise aus
$liste[] = explode(",",$zeile); //zerlege Zeile in einzelne Werte
$nr++;
echo "<td class='abfrage' width='2%'>".$nr."</td><td class='abfrage'width='12%'>".$liste[$i][0]."</td><td class='abfrage' width='5%' align='center'>".$liste[$i][1]."</td><td class='abfrage' width='17%'>".$liste[$i][2]." ".$liste[$i][3]." ".$liste[$i][4]."</td>";
echo "<td class='abfrage' width='6%'>"." ".$liste[$i][5]."</td><td class='abfrage' width='6%'>".$liste[$i][6]."</td><td class='abfrage' align='center' width='2%'>".$liste[$i][7]."</td>";
if($liste[$i][9] == "wurde nicht gewählt" || ($liste[$i][8] == " ")){//Wenn Kat 1 nicht gewählt
echo "<td class='abfrage' align='right' width='5%'> </td><td class='abfrage' align='right' width='8%'> </td>";
}
else{
echo "<td class='abfrage' align='right' width='5%'>".$liste[$i][8]." ?"."</td><td class='abfrage' align='right' width='8%'>".$liste[$i][9]." ?"."</td>";
}
if($liste[$i][11] == "wurde nicht gewählt" || ($liste[$i][10] == " ")){// Wenn Kat 2 nicht gewählt
$kom1 = $liste[$i][12];
$kom = sprintf("%01.2f", $kom1)." ?";
echo "<td class='abfrage' width='5%'> </td><td class='abfrage' width='8%'> </td><td class='abfrage' align='right' width='6%'>".$kom."</td><td class='abfrage' width='6%'> ".$liste[$i][13]." ".$liste[$i][14]."</td>";
echo "<td class='abfrage' width='6%'> ".$liste[$i][15]." ".$liste[$i][16]."</td><td class='abfrage' width=''> </td></tr>";
}
else{
$kom1 = $liste[$i][12];
$kom = sprintf("%01.2f", $kom1)." ?";
echo "<td class='abfrage' align='right' width='5%'>".$liste[$i][10]." ?"."</td><td class='abfrage' align='right' width='8%'>".$liste[$i][11]." ?"."</td><td class='abfrage' align='right' width='6%'>".$kom."</td><td class='abfrage' width='6%'> ".$liste[$i][13]." ".$liste[$i][14]."</td>";
echo "<td class='abfrage' width='6%'> ".$liste[$i][15]." ".$liste[$i][16]."</td><td class='abfrage' width=''> </td></tr>";
}
$test = $liste[$i][11];
$gesamtkommi1 += $liste[$i][12];
$gesamtkommi = sprintf("%01.2f", $gesamtkommi1);
$gesamtkat11 += $liste[$i][9];
$gesamtkat1 = sprintf("%01.2f",$gesamtkat11);
$gesamtkat21 += $liste[$i][11];
$gesamtkat2 = sprintf("%01.2f", $gesamtkat21);
$i++;
}
|
|
|
PHP Source code |
1 2 3 4 |
$file = File("../../../buchungen/$buchungen.txt"); //Dadurch erhälst du ein Array mit Einträgen per Zeile aus der Datei
for ($i = 0; $i < count($file) - 1; $i++)
echo "Zeile ".$i + 1.": ".$file[$i]."<br />";
|

... Ich hab mir deinen Code auch nicht wirklich angeschaut, bloss wie du die Zeilen ausliest.
|
|
PHP Source code |
1 2 3 4 5 6 |
<?php
while(!feof($datei))
{ //mache bis Datei zu Ende
$zeile = fgets($datei, 255); //lese zeilenweise aus
$liste[] = explode(",",$zeile); //zerlege Zeile in einzelne Werte
?>
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 |
<?php
while(!feof($datei))
{
$zeile = fgets($datei, 255); //lese zeilenweise aus
$liste[$i] = explode(",",$zeile); //zerlege Zeile in einzelne Werte
$i++;
}
$i = 0;
while ($i < (sizeof($liste) - 1))
{
?>
|