query( 'SELECT b.id, b.title, b.selling_price, b.printing_costs, b.isbn_print, COALESCE(SUM(ba.margin_percent), 0) AS author_margin_percent FROM books b LEFT JOIN book_authors ba ON ba.book_id = b.id WHERE b.isbn_print IS NOT NULL AND b.isbn_print <> "" GROUP BY b.id ORDER BY b.title' )->fetchAll(); $selectedId = filter_var($_GET['book_id'] ?? null, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]) ?: null; $useAuthorMargin = ($_GET['use_author_margin'] ?? '') === '1'; $discountInput = $_GET['discount_percent'] ?? (string) DEFAULT_AUTHOR_DISCOUNT_PERCENT; $discountPercent = filter_var($discountInput, FILTER_VALIDATE_FLOAT); $discountError = $discountPercent === false || $discountPercent < 0 || $discountPercent > 100; if ($discountError) { $discountPercent = DEFAULT_AUTHOR_DISCOUNT_PERCENT; } $discountRate = (float) $discountPercent / 100; $retainedRate = 1 - $discountRate; $selectedBook = null; foreach ($books as $book) { if ((int) $book['id'] === $selectedId) { $selectedBook = $book; break; } } $calculation = null; if ($selectedBook !== null) { if ($useAuthorMargin) { $discountPercent = (float) $selectedBook['author_margin_percent']; $discountError = false; } $discountRate = (float) $discountPercent / 100; $retainedRate = 1 - $discountRate; $grossPrice = (float) $selectedBook['selling_price']; $printingCosts = (float) $selectedBook['printing_costs']; $netPrice = $grossPrice / (1 + AUTHOR_PRICE_VAT_RATE); $revenueBeforeAuthorDiscount = $netPrice - $printingCosts; $authorDiscount = $revenueBeforeAuthorDiscount * $discountRate; $retainedRevenue = $revenueBeforeAuthorDiscount * $retainedRate; $authorPriceNet = $printingCosts + $retainedRevenue; $authorPriceVat = $authorPriceNet * AUTHOR_PRICE_VAT_RATE; $authorPriceGross = $authorPriceNet + $authorPriceVat; $saving = $grossPrice - $authorPriceGross; $calculation = [ 'gross_price' => $grossPrice, 'net_price' => $netPrice, 'printing_costs' => $printingCosts, 'revenue_before_author_discount' => $revenueBeforeAuthorDiscount, 'author_discount' => $authorDiscount, 'discount_percent' => (float) $discountPercent, 'retained_percent' => $retainedRate * 100, 'use_author_margin' => $useAuthorMargin, 'author_margin_percent' => (float) $selectedBook['author_margin_percent'], 'retained_revenue' => $retainedRevenue, 'author_price_net' => $authorPriceNet, 'author_price_vat' => $authorPriceVat, 'author_price_gross' => $authorPriceGross, 'saving' => $saving, ]; } $token = csrf(); ?> Autorenpreis-Rechner

Autorenpreis-Rechner

Buch auswählen

required>

Der Rabatt muss zwischen 0 und 100 Prozent liegen. Es wurde 85 Prozent verwendet.

Hinterlegte Autorenmarge für dieses Buch: %

Autorenpreis:

Berechnung pro Exemplar. Die Zwischenwerte werden ungerundet berechnet und erst für die Anzeige auf Cent gerundet.

Regulärer Brutto-Preis
Regulärer Netto-Preis (Brutto ÷ 1,07)
Abzüglich Druckkosten
Erlös vor Autorenrabatt
Autorenrabatt %
Verbleibender Erlösanteil %
Autorenpreis netto (Druckkosten + verbleibender Anteil)
Mehrwertsteuer 7 % auf Autorenpreis
Autorenpreis brutto
Ersparnis pro Exemplar

Das ausgewählte Buch ist nicht als Printbuch vorhanden.