292 lines
9.6 KiB
PHP
292 lines
9.6 KiB
PHP
<table>
|
|
<tr>
|
|
<td>
|
|
<b>Veranstaltung</b>
|
|
</td>
|
|
<td>
|
|
{{$seat->event()->first()->title}}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<b>Termin</b>
|
|
</td>
|
|
<td>{{date('d.m.Y', strtotime($seat->date))}}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<b>Effektiver Erlös (gesamt)</b>
|
|
</td>
|
|
<td>
|
|
€ {{ number_format($totalPrice/100, 2) }}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<b>Effektiver Erlös (Überweisung)</b>
|
|
</td>
|
|
<td>
|
|
€ {{ number_format($transactionPrice/100, 2) }}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<b>Effektiver Erlös (Bar)</b>
|
|
</td>
|
|
<td>
|
|
€ {{ number_format($barPrice/100, 2) }}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<b>Effektiver Erlös (Gutschein)</b>
|
|
</td>
|
|
<td>
|
|
€ {{ number_format($voucherPrice/100, 2) }}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<b>Effektiver Erlös (Bankomat)</b>
|
|
</td>
|
|
<td>
|
|
€ {{ number_format($atmPrice/100, 2) }}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<b>Effektiver Erlös (Kulturkarte)</b>
|
|
</td>
|
|
<td>
|
|
€ {{ number_format($cultureCardPrice/100, 2) }}
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<b>Portokosten (alle Zahlarten)</b>
|
|
</td>
|
|
<td>
|
|
€ {{ number_format($portoCosts, 2) }}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
use App\SingleSeatsUser;
|
|
use App\Concession;
|
|
function getAmountByCategory($ssus, $category){
|
|
$count = 0;
|
|
foreach($ssus as $ssu){
|
|
if($ssu != null && $ssu->singleSeat()->first()->category == $category)
|
|
$count++;
|
|
}
|
|
return $count;
|
|
}
|
|
|
|
function getDeductByCategory($ssus){
|
|
$amount = 0;
|
|
foreach($ssus as $ssu){
|
|
if($ssu != null){
|
|
$cat = $ssu->singleSeat()->first()->category;
|
|
$event = $ssu->singleSeat()->first()->seat()->first()->event()->first();
|
|
$priceSingleTicket = 0;
|
|
if($cat === 'a' || $cat === 's'){
|
|
$priceSingleTicket = $event->price_cat_a;
|
|
}else if($cat === 'b'){
|
|
$priceSingleTicket = $event->price_cat_b;
|
|
}else{
|
|
$priceSingleTicket = $event->price_cat_c;
|
|
}
|
|
|
|
$concessionId = $ssu->event_concessions_id;
|
|
$concession = Concession::find($concessionId);
|
|
$amount += $priceSingleTicket*$concession->perc;
|
|
}
|
|
}
|
|
return $amount;
|
|
}
|
|
|
|
function getSsuByConcessionWithoutCulturcard($seat, $concessionId){
|
|
$ret = array();
|
|
foreach($seat->singleSeats()->where('booked','1')->get() as $singleSeat){
|
|
$ssu = SingleSeatsUser::where([
|
|
['single_seat_id', $singleSeat->id],
|
|
['event_concessions_id', $concessionId]
|
|
])->first();
|
|
if($ssu != null && $ssu->paymentmethod()->first()->name !== "Kulturkarte")
|
|
array_push($ret, $ssu);
|
|
}
|
|
return $ret;
|
|
}
|
|
|
|
function getSsuCulturcard($seat){
|
|
$ret = array();
|
|
foreach($seat->singleSeats()->where('booked','1')->get() as $singleSeat){
|
|
$ssu = SingleSeatsUser::where([
|
|
['single_seat_id', $singleSeat->id]
|
|
])->first();
|
|
if($ssu != null && $ssu->paymentmethod()->first()->name === "Kulturkarte")
|
|
array_push($ret, $ssu);
|
|
}
|
|
return $ret;
|
|
}
|
|
|
|
function getTotalAmount($ssus){
|
|
$count = 0;
|
|
foreach($ssus as $ssu){
|
|
if($ssu != null)
|
|
$count++;
|
|
}
|
|
return $count;
|
|
}
|
|
|
|
function calcPriceCulturecard($seat){
|
|
$priceCatA = getAmountByCategory(getSSuCulturcard($seat), 'a')*$seat->event()->first()->price_cat_a;
|
|
$priceCatB = getAmountByCategory(getSSuCulturcard($seat), 'b')*$seat->event()->first()->price_cat_b;
|
|
$priceCatC = getAmountByCategory(getSSuCulturcard($seat), 'c')*$seat->event()->first()->price_cat_c;
|
|
$priceCatS = getAmountByCategory(getSSuCulturcard($seat), 's')*$seat->event()->first()->price_cat_a;
|
|
return $priceCatA+$priceCatB+$priceCatC+$priceCatS;
|
|
}
|
|
?>
|
|
<table border="1">
|
|
<tr>
|
|
<th>Ermäßigung</th>
|
|
<th>Kat. A</th>
|
|
<th>Kat. B</th>
|
|
<th>Kat. C</th>
|
|
<th>Keine Kategorie</th>
|
|
<th>Gesamt</th>
|
|
<th>Erlösmind.</th>
|
|
</tr>
|
|
@foreach(\App\Concession::all() as $concession)
|
|
@if(getTotalAmount(getSsuByConcessionWithoutCulturcard($seat, $concession->id)) > 0)
|
|
<tr>
|
|
<td>{{$concession->name}}</td>
|
|
<td>{{getAmountByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id), 'a')}}</td>
|
|
<td>{{getAmountByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id), 'b')}}</td>
|
|
<td>{{getAmountByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id), 'c')}}</td>
|
|
<td>{{getAmountByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id), 's')}}</td>
|
|
<td>{{getTotalAmount(getSsuByConcessionWithoutCulturcard($seat, $concession->id))}}</td>
|
|
<td>€ {{ number_format(getDeductByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id))/100, 2) }}</td>
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
<?php
|
|
$totalA = 0;
|
|
$totalB = 0;
|
|
$totalC = 0;
|
|
$totalNoCat = 0;
|
|
$totalGes = 0;
|
|
$totalDeduct = 0;
|
|
$totalCulturecard = 0;
|
|
foreach(\App\Concession::all() as $concession){
|
|
$totalA+=getAmountByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id), 'a');
|
|
$totalB+=getAmountByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id), 'b');
|
|
$totalC+=getAmountByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id), 'c');
|
|
$totalNoCat+=getAmountByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id), 's');
|
|
$totalGes+= getTotalAmount(getSsuByConcessionWithoutCulturcard($seat, $concession->id));
|
|
$totalDeduct += getDeductByCategory(getSsuByConcessionWithoutCulturcard($seat, $concession->id));
|
|
}
|
|
?>
|
|
|
|
<tr>
|
|
<td>Kulturkarte (100%, Kauf)</td>
|
|
<td>{{getAmountByCategory(getSSuCulturcard($seat), 'a')}}</td>
|
|
<td>{{getAmountByCategory(getSSuCulturcard($seat), 'b')}}</td>
|
|
<td>{{getAmountByCategory(getSSuCulturcard($seat), 'c')}}</td>
|
|
<td>{{getAmountByCategory(getSSuCulturcard($seat), 's')}}</td>
|
|
<td>{{getTotalAmount(getSSuCulturcard($seat))}}</td>
|
|
<td>€ {{ number_format(calcPriceCulturecard($seat), 2) }}</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Gesamt</td>
|
|
<td>{{$totalA + getAmountByCategory(getSSuCulturcard($seat), 'a')}}</td>
|
|
<td>{{$totalB + getAmountByCategory(getSSuCulturcard($seat), 'b')}}</td>
|
|
<td>{{$totalC + getAmountByCategory(getSSuCulturcard($seat), 'c')}}</td>
|
|
<td>{{$totalNoCat + getAmountByCategory(getSSuCulturcard($seat), 's')}}</td>
|
|
<td>{{$totalGes + getTotalAmount(getSSuCulturcard($seat))}}</td>
|
|
<td>€ {{ number_format(($totalDeduct+calcPriceCulturecard($seat)*100)/100, 2) }}</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<a href="/admin/eventoverviewlist/{{$seat->id}}">Liste Überweisungen</a>
|
|
<a href="/admin/eventoverviewlistall/{{$seat->id}}">Alle Karten</a>
|
|
|
|
<button onclick="print()">Drucken</button>
|
|
|
|
<script>
|
|
var PRINTER_NAME = "Gestetner";
|
|
var HTTP_GET_VARS;
|
|
|
|
// var PRINTER_NAME = "Deskjet";
|
|
var PRINTER_FALLBACK_NAME = "Adobe";
|
|
function findGetParameter(parameterName) {
|
|
var result = null,
|
|
tmp = [];
|
|
location.search
|
|
.substr(1)
|
|
.split("&")
|
|
.forEach(function (item) {
|
|
tmp = item.split("=");
|
|
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
|
|
});
|
|
return result;
|
|
}
|
|
|
|
function print() {
|
|
jsPrintSetup.setPrinter(selectPrinter());
|
|
|
|
jsPrintSetup.setOption('orientation', jsPrintSetup.kPortraitOrientation);
|
|
jsPrintSetup.setOption('marginTop', 0);
|
|
jsPrintSetup.setOption('marginBottom', 0);
|
|
jsPrintSetup.setOption('marginLeft', 0);
|
|
jsPrintSetup.setOption('marginRight', 0);
|
|
|
|
jsPrintSetup.setOption('headerStrLeft', '');
|
|
jsPrintSetup.setOption('headerStrCenter', '');
|
|
jsPrintSetup.setOption('headerStrRight', '');
|
|
jsPrintSetup.setOption('footerStrLeft', '');
|
|
jsPrintSetup.setOption('footerStrCenter', '');
|
|
jsPrintSetup.setOption('footerStrRight', '');
|
|
|
|
jsPrintSetup.setOption('printBGColors', 1);
|
|
|
|
jsPrintSetup.clearSilentPrint();
|
|
jsPrintSetup.setOption('printSilent', 1);
|
|
|
|
jsPrintSetup.printWindow(window);
|
|
|
|
window.close();
|
|
}
|
|
|
|
|
|
|
|
function sleep (time) {
|
|
return new Promise((resolve) => setTimeout(resolve, time));
|
|
}
|
|
|
|
function selectPrinter() {
|
|
var printers = jsPrintSetup.getPrintersList().split(',');
|
|
//console.log(printers);
|
|
|
|
for (var i = 0; i < printers.length; ++i) {
|
|
if (printers[i].toLowerCase().indexOf(PRINTER_NAME.toLowerCase()) != -1) {
|
|
return printers[i];
|
|
}
|
|
}
|
|
|
|
for (var i = 0; i < printers.length; ++i) {
|
|
if (printers[i].toLowerCase().indexOf(PRINTER_FALLBACK_NAME.toLowerCase()) != -1) {
|
|
return printers[i];
|
|
}
|
|
}
|
|
|
|
if (printers.length > 0) {
|
|
return printers[0];
|
|
}
|
|
|
|
return '';
|
|
}
|
|
</script>
|