ported Additions to VIP

This commit is contained in:
Alec Höfler 2022-05-05 08:10:12 +02:00
parent e289f45945
commit 4b449dc277
No known key found for this signature in database
GPG key ID: BE83D6C1099F2835
2 changed files with 20 additions and 47 deletions

View file

@ -60,33 +60,21 @@ $seats = json_decode(json_encode(unserialize($row2["places"], ['allowed_classes'
//Convert object to HTML List
$seat_html = "";
$is_vip = false;
$vip_price = 0;
foreach ($seats as $seat) {
if($seat["place_name"]!="VIP"){
$seat_html .= $seat["place_name"] . " (" . $seat["place_price"] . "€), "; // results in e.g. 'Reihe 1, Platz 2 (5€)'
}else{
$is_vip=true;
$vip_price=$seat["place_price"];
}
}
//Generate Coupon Badge
$rabatt = ($row2["coupon_id"]!=0) ? $row2["zbc_code"] . ' (-' . $row2["zbc_discount"].'€)' : "-";
$zusatz = "";
//converting [1,2,3] to (1,2,3) => sql syntax
$ids = str_replace("[","(",$row2["additional_ids"]);
$ids = str_replace("]",")",$ids);
//Get all used additional services
$statement_additional = $pdo->prepare("SELECT * from zf_bap_additional WHERE additional_id IN ".$ids);
//Execute Statement and fetch Data
$statement_additional->execute();
$row_additional = $statement_additional->fetchAll();
foreach ($row_additional as $item){
$zusatz .= $item["name"]." (".$item["price_eur"]."€)";
if(count($row_additional)>1){
$zusatz .= "<br/>";
}
}
//Build HTML Site, which will be converted into a PDF
$data = '<!doctype html>
<html lang="de-AT">
@ -126,7 +114,7 @@ $data = '<!doctype html>
</tr>
<tr>
<td class="td_desc">Zusätze</td>
<td>' . $zusatz . '</td>
<td>' . ($is_vip ? "VIP (".$vip_price."€)" : "-") . '</td>
</tr>
<tr>
<td class="td_desc">Name</td>

View file

@ -49,31 +49,16 @@ $seats = json_decode(json_encode(unserialize($row2["places"])), true);
//Convert object to HTML List
$seat_html = "";
$is_vip = false;
$vip_price = 0;
foreach ($seats as $seat) {
if($seat["place_name"]!="VIP"){
$seat_html .= $seat["place_name"] . " (" . $seat["place_price"] . "€), "; // results in e.g. 'Reihe 1, Platz 2 (5€)'
}
//Generate Coupon Badge
$rabatt = ($row2["coupon_id"]!=0) ? $row2["zbc_code"] . ' (-' . $row2["zbc_discount"].'€)' : "-";
$zusatz = "";
//converting [1,2,3] to (1,2,3) => sql syntax
$ids = str_replace("[","(",$row2["additional_ids"]);
$ids = str_replace("]",")",$ids);
//Get all used additional services
$statement_additional = $pdo->prepare("SELECT * from zf_bap_additional WHERE additional_id IN ".$ids);
//Execute Statement and fetch Data
$statement_additional->execute();
$row_additional = $statement_additional->fetchAll();
foreach ($row_additional as $item){
$zusatz .= $item["name"]." (".$item["price_eur"]."€)";
if(count($row_additional)>1){
$zusatz .= "<br/>";
}else{
$is_vip=true;
$vip_price=$seat["place_price"];
}
}
@ -112,7 +97,7 @@ echo '<html>
</tr>
<tr>
<td class="td_desc">Zusätze</td>
<td>' . $zusatz . '</td>
<td>' . ($is_vip ? "VIP (".$vip_price."€)" : "-") . '</td>
</tr>
<tr>
<td class="td_desc">Bestelldatum</td>