Export | Abrechnung

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 totalNetSum = Math.round(deps.lodash.sumBy(e.ticketing, (t) => Math.round(t.grossPrice * t.soldTickets)/(1 + (t.vat/100))))
        const expenses = e.eventInformations.filter(ei => ei.name.includes("Buyout"))
        return {
        ...e,
        ticketing: e.ticketing?.map(t => ({
            ...t,
            netPrice: Math.round(t.grossPrice/(1 + (t.vat/100))),
            netSum: Math.round((t.grossPrice * t.soldTickets)/(1 + (t.vat/100))),
            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 < totalNetSum && totalNetSum > guarantee ? 
                    {
                        toShare: totalNetSum - breakEvenSales,
                        percentage: d.artistPercentage * 100,
                        share: ((totalNetSum - breakEvenSales) * d.artistPercentage)
                    } : null
            }
        })?.[0],
        totalSum: totalSum,
        totalNetSum,
        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;
    }

    .sales th:nth-child(1),
    .sales th:nth-child(2),
    .sales th:nth-child(3),
    .sales th:nth-child(4),
    .sales th:nth-child(5),
    .sales th:nth-child(6) {
        width: 12%;
    }

    .sales th:nth-child(7),
    .sales th:nth-child(8) {
        width: 14%;
    }

    .deal th:nth-child(1) {
        width: 24%;
    }

    .deal th:nth-child(2) {
        width: 62%;
    }

    .deal th:nth-child(3) {
        width: 14%;
    }

    .expenses th:nth-child(1),
    .result th:nth-child(1) {
        width: 86%;
    }

    .expenses th:nth-child(2),
    .result th:nth-child(2) {
        width: 14%;
    }


    .alignRight {
        text-align: right;
    }

    .noWrap {
        white-space: nowrap;
    }

    .alert {
        background-color: yellow;
        font-size: 1.5em;
    }

    .small {
        font-size: 0.6em;
    }
</style>

{{#if events.length}}
{{#each events}}

<h1>Abrechnung</h1>
<p>Event: {{this.displayNames.title}} | {{ formatDate this.start "P" }}<br />
    Location: {{this.displayNames.locationsWithCityAndRooms}}</p>

{{#if this.ticketing}}
<h2>Verkäufe</h2>
<table class="sales">
    <thead>
        <tr>
            <th>VVK-Stelle</th>
            <th>Kat.</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 class="alignRight noWrap">{{ formatEuro this.netPrice }}</td>
            <td>{{ this.vat }} %</td>
            <td class="alignRight noWrap">{{ formatEuro this.grossPrice }}</td>
            <td>{{ this.soldTickets }}</td>
            <td class="alignRight noWrap">{{ formatEuro this.netSum }}</td>
            <td class="alignRight noWrap">{{ 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 class="alignRight noWrap">{{ formatEuro ./this.totalNetSum }}</th>
            <th class="alignRight noWrap">{{ formatEuro (sumBy this.ticketing "grossSum" ) }}</th>
        </tr>
    </tbody>
</table>
{{else}}
<div class="alert">
    <h3>Keine Ticketdaten gefunden</h3>
</div>
{{/if}}

{{#if this.deal}}
<h2>Deal</h2>
<h3>{{this.deal.name}}</h3>

{{#if this.deal.guarantee }}
<div>Garantie: {{this.deal.guarantee}} €</div>
{{/if}}
{{#if this.deal.artistPercentage }}
<div>Künstleranteil: {{multiply this.deal.artistPercentage 100}} %</div>
{{/if}}
{{#if this.deal.breakEvenSales }}
<div>Breakeven: {{ formatEuro this.deal.breakEvenSales }}</div>
{{/if}}

<table class="deal">
    <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 class="alignRight noWrap">{{ 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 class="alignRight noWrap">{{ formatEuro this.deal.hasShare.share }}</td>
        </tr>
        {{/if}}
    </tbody>
    <tfoot>
        <tr>
            <th>Gesamt netto</th>
            <th></th>
            <th class="alignRight noWrap">{{ 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}}
<h2>Ausgaben</h2>

<table class="expenses">
    <thead>
        <tr>
            <th>Name</th>
            <th>Betrag</th>
        </tr>
    </thead>
    <tbody>
        {{#each this.expenses}}
        <tr>
            <td>{{this.name}}</td>
            <td class="alignRight noWrap">{{ formatEuro this.value }}</td>
        </tr>
        {{/each}}
    </tbody>
    <tfoot>
        <tr>
            <th>Gesamt</th>
            <th class="alignRight noWrap">{{ formatEuro expensesSum }}</th>
        </tr>
    </tfoot>
</table>
{{/if}}

<h2>Auszahlung</h2>

<table class="result">
    <thead>
        <tr>
            <th>Name</th>
            <th>Betrag</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Deal</td>
            <td class="alignRight noWrap">{{ formatEuro (add this.deal.hasGuarantee this.deal.hasShare.share) }}</td>
        </tr>
        {{#if expensesSum}}
        <tr>
            <td>Ausgaben</td>
            <td class="alignRight noWrap">{{ formatEuro expensesSum }}</td>
        </tr>
        {{/if}}
    </tbody>
    <tfoot>
        <tr>
            <th>Gesamt</th>
            <th class="alignRight noWrap">{{ formatEuro (subtract (add this.deal.hasGuarantee this.deal.hasShare.share)
                expensesSum) }}</th>
        </tr>
    </tfoot>
</table>

{{/each}}
{{else}}
<div>Keine Daten vorhanden</div>
{{/if}}