Export | KSK Meldung

Export um Veranstaltungen bei der KSK zu melden.

Voraussetzung

  • Benutzerfeld „KSK“ (Checkbox) angehakt
  • Ticketeinnahmen
  • Künstler-Deal

Vorschau

Preprozessor

return {
    ...ctx,
    events: ctx.events
        .filter(e => e.eventInformations
            .find(ei => ei.name === "KSK" && ei.value))
        .map(e => {
        const totalNetSum = Math.round(deps.lodash.sumBy(e.ticketing, (t) => Math.round(t.grossPrice * t.soldTickets)/1.07))
        let gageTotal = 0
        let kskTotal = 0
        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
                const hasShare = 
                    d.artistPercentage > 0 &&  breakEvenSales < totalNetSum && totalNetSum > guarantee ? 
                    {
                        toShare: totalNetSum - breakEvenSales,
                        percentage: d.artistPercentage ? d.artistPercentage * 100 : 0,
                        share: ((totalNetSum - breakEvenSales) * d.artistPercentage)
                    } : null
                const gage = (hasShare === null || guarantee > hasShare?.share) ? guarantee : (hasShare?.share ?? 0)
                const ksk = gage / 100 * 5
                gageTotal = gageTotal + gage
                kskTotal = kskTotal + ksk
                return {
                    ...d,
                    breakEvenSales: breakEvenSales,
                    hasGuarantee: guarantee,
                    hasShare: hasShare,
                    gage: gage,
                    ksk: ksk
                }
            })?.[0],
            totalNetSum: totalNetSum,
            gageTotal: gageTotal,
            kskTotal: kskTotal
        }
    })
}

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>

<h1>KSK Abrechnung</h1>

{{#if events.length}}
<table>
    <thead>
        <tr>
            <th>Datum</th>
            <th>Künstler</th>
            <th>Ort</th>
            <th>Einnahmen</th>
            <th>Gage</th>
            <th>KSK (5 %)</th>
        </tr>
    </thead>
    <tbody>
        {{#each events}}<tr>
            <td>{{ formatDate this.start "P" }}</td>
            <td>{{this.displayNames.artists}}</td>
            <td>{{this.displayNames.rooms}}</td>
            <td>{{ formatEuro ./this.totalNetSum }}</td>
            <td>{{ formatEuro this.deal.gage }}</td>
            <td>{{ formatEuro this.deal.ksk }}</td>
        </tr>{{/each}}
    </tbody>
    <tfoot>
        <tr>
            <th>Summe</th>
            <th></th>
            <th></th>
            <th>{{ formatEuro (sumBy events "totalNetSum") }}</th>
            <th>{{ formatEuro (sumBy events "gageTotal") }}</th>
            <th>{{ formatEuro (sumBy events "kskTotal") }}</th>
        </tr>
    </tfoot>
</table>
{{else}}
Keine Daten vorhanden
{{/if}}