Export um Ticketverkäufe anhand von Künstler Deals abzurechnen.
Sind Ausgaben abzurechnen, müssen diese im Event in den Benutzerfeldern beginnend mit Buyout angegeben werden (z.B. Buyout:Catering, Buyout:Hotel).
Vorschau

Preprozessor
return {
...ctx,
events: ctx.events.map(e => {
const totalSum = Math.round(deps.lodash.sumBy(e.ticketing, (t) => Math.round(t.grossPrice * t.soldTickets)))
const expenses = e.eventInformations.filter(ei => ei.name.includes("Buyout"))
return {
...e,
ticketing: e.ticketing?.map(t => ({
...t,
netPrice: Math.round(t.grossPrice/1.07),
netSum: Math.round((t.grossPrice * t.soldTickets)/1.07),
grossSum: Math.round(t.grossPrice) * t.soldTickets,
})),
deal: e.artists?.[0].deals?.map(d => {
const guarantee = d.guarantee > 0 ? d.guarantee * 100 : null
const breakEvenSales = d.breakEvenSales > 0 ? d.breakEvenSales * 100 : 0
return {
...d,
breakEvenSales: breakEvenSales,
hasGuarantee: guarantee,
hasShare:
d.artistPercentage > 0 && breakEvenSales < totalSum && totalSum > guarantee ?
{
toShare: totalSum - breakEvenSales,
percentage: d.artistPercentage * 100,
share: ((totalSum - breakEvenSales) * d.artistPercentage)
} : null
}
})?.[0],
totalSum: totalSum,
expenses: expenses,
expensesSum: deps.lodash.sumBy(expenses, "value")
}})
}
Template
<style>
h1 {
font-family: Ubuntu;
text-decoration: none;
}
body, h2, h3, h4, p, th, td { font-family: Ubuntu; }
table {
table-layout: fixed;
width: 650px;
border-spacing: 0px;
border-collapse: separate;
}
td, th {
text-align: left;
border-bottom: 1px solid black;
padding: 5px 10px;
vertical-align: top;
}
.alert {
background-color: yellow;
font-size: 1.5em;
}
</style>
{{#if events.length}}
{{#each events}}
# Abrechnung
Event: {{this.displayNames.title}} | {{ formatDate this.start "P" }}
Location: {{this.displayNames.locationsWithCityAndRooms}}
{{#if this.ticketing}}
## Verkäufe
<table>
<thead>
<tr>
<th>VVK-Stelle</th>
<th>Kategory</th>
<th>Ticketpreis netto</th>
<th>MWSt.</th>
<th>Ticketpreis brutto</th>
<th>Anzahl</th>
<th>Gesamt netto</th>
<th>Gesamt brutto</th>
</tr>
</thead>
<tbody>
{{#each this.ticketing}}
<tr>
<td>{{ this.ticketOffice }}</td>
<td>{{ this.category }}</td>
<td>{{ formatEuro this.netPrice }}</td>
<td>{{ this.vat }} %</td>
<td>{{ formatEuro this.grossPrice }}</td>
<td>{{ this.soldTickets }}</td>
<td>{{ formatEuro this.netSum }}</td>
<td>{{ formatEuro this.grossSum }}</td>
</tr>
{{/each}}
<tr>
<th>Summe</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>{{ sumBy this.ticketing "soldTickets" }}</th>
<th>{{ formatEuro ./this.totalNetSum }}</th>
<th>{{ formatEuro (sumBy this.ticketing "grossSum" ) }}</th>
</tr>
</tbody>
</table>
{{else}}
<div class="alert">
<h3>Keine Ticketdaten gefunden</h3>
</div>
{{/if}}
{{#if this.deal}}
## Deal
### {{this.deal.name}}
{{#if this.deal.guarantee }}
Garantie: {{this.deal.guarantee}} €
{{/if}}
{{#if this.deal.artistPercentage }}
Künstleranteil: {{multiply this.deal.artistPercentage 100}} %
{{/if}}
{{#if this.deal.breakEvenSales }}
Breakeven: {{ formatEuro this.deal.breakEvenSales }}
{{/if}}
<table>
<thead>
<tr>
<th>Name</th>
<th>Bemerkung</th>
<th>Gage</th>
</tr>
</thead>
<tbody>
{{#if this.deal.hasGuarantee}}
<tr>
<td>Garantie</td>
<td></td>
<td>{{ formatEuro this.deal.hasGuarantee }}</td>
</tr>
{{/if}}
{{#if this.deal.hasShare}}
<tr>
<td>Teilung</td>
<td>{{this.deal.hasShare.percentage}} % von {{formatEuro this.deal.hasShare.toShare}}</td>
<td>{{ formatEuro this.deal.hasShare.share }}</td>
</tr>
{{/if}}
</tbody>
<tfoot>
<tr>
<th>Gesamt netto</th>
<th></th>
<th>{{ formatEuro (add this.deal.hasGuarantee this.deal.hasShare.share) }}</th>
</tr>
</tfoot>
</table>
{{else}}
<div class="alert">
<h3>Kein Deal hinterlegt</h3>
<p>Füge dem Event einen Künstler inkl. Deal hinzu.</p>
</div>
{{/if}}
{{#if this.expenses.length}}
## Ausgaben
<table class="abrechnung">
<thead>
<tr>
<th style="width: 70%;">Name</th>
<th style="width: 30%;">Betrag</th>
</tr>
</thead>
<tbody>
{{#each this.expenses}}
<tr>
<td>{{this.name}}</td>
<td>{{ formatEuro this.value }}</td>
</tr>
{{/each}}
</tbody>
<tfoot>
<tr>
<th>Gesamt</th>
<th>{{ formatEuro expensesSum }}</th>
</tr>
</tfoot>
</table>
{{/if}}
## Auszahlung
<table class="abrechnung">
<thead>
<tr>
<th style="width: 70%;">Name</th>
<th style="width: 30%;">Betrag</th>
</tr>
</thead>
<tbody>
<tr>
<td>Deal</td>
<td>{{ formatEuro (add this.deal.hasGuarantee this.deal.hasShare.share) }}</td>
</tr>
{{#if expensesSum}}
<tr>
<td>Ausgaben</td>
<td>{{ formatEuro expensesSum }}</td>
</tr>
{{/if}}
</tbody>
<tfoot>
<tr>
<th>Gesamt</th>
<th>{{ formatEuro (subtract (add this.deal.hasGuarantee this.deal.hasShare.share) expensesSum) }}</th>
</tr>
</tfoot>
</table>
{{/each}}
{{else}}
Keine Daten vorhanden
{{/if}}