feat: konfigurierbarer USt-Satz im Profil, Rechnungserstellung und Vorschau
- Neues Feld vatRate im User-Profil (Default 19 %), bearbeitbar im Rechnungs-Tab neben Rechnungslegung-Checkbox und Rechnungsprefix - Canvas-Vorschau und PDF-Vorschau reagieren live auf den eingegebenen Steuersatz (JS-Setter updateProfileVatRate, dynamische Sample-Zeilen und Summary) - Neue USt-Kachel auf create_invoice mit Eingabefeld; Summary-Kachel, PDF-Preview und gespeicherte Rechnung übernehmen den Feldwert - Rechnungsvorschau für reale Aufträge auf dreispaltiges Layout (Name, Steuersatz, Nettobetrag) inkl. "zzgl. X% USt"-Zeile vereinheitlicht - Kachel-Overflow auf create_invoice durch box-sizing: border-box korrigiert
This commit is contained in:
@@ -346,11 +346,14 @@ window.initProfileInvoiceGenerator = function() {
|
||||
// Nettobetrag column header (right-aligned)
|
||||
ctx.fillText('Nettobetrag', colNetX + colNetWidth - padding, y + rowHeight / 2);
|
||||
|
||||
var vatRate = (window.profileInvoiceVatRate != null) ? window.profileInvoiceVatRate : 0.19;
|
||||
var vatPctLabel = (Math.round(vatRate * 10000) / 100).toString().replace('.', ',') + '%';
|
||||
|
||||
// Sample data rows (placeholder)
|
||||
var sampleData = [
|
||||
{ name: 'Umzugsleistung inkl. Verpackung', vat: '19%', net: '450,00 €' },
|
||||
{ name: 'Entsorgung Möbel', vat: '19%', net: '85,00 €' },
|
||||
{ name: 'Montage/De-Montage', vat: '19%', net: '120,00 €' }
|
||||
{ name: 'Umzugsleistung inkl. Verpackung', vat: vatPctLabel, net: '450,00 €' },
|
||||
{ name: 'Entsorgung Möbel', vat: vatPctLabel, net: '85,00 €' },
|
||||
{ name: 'Montage/De-Montage', vat: vatPctLabel, net: '120,00 €' }
|
||||
];
|
||||
|
||||
var currentY = y + rowHeight;
|
||||
@@ -415,9 +418,8 @@ window.initProfileInvoiceGenerator = function() {
|
||||
|
||||
// Calculate totals from sample data
|
||||
var netTotal = 655.00; // 450 + 85 + 120
|
||||
var vatRate = 0.19;
|
||||
var vatTotal = 124.45; // 655 * 0.19
|
||||
var grossTotal = 779.45; // 655 + 124.45
|
||||
var vatTotal = netTotal * vatRate;
|
||||
var grossTotal = netTotal + vatTotal;
|
||||
|
||||
// Draw summary lines
|
||||
ctx.textBaseline = 'middle';
|
||||
@@ -435,7 +437,7 @@ window.initProfileInvoiceGenerator = function() {
|
||||
// Umsatzsteuer - label left, value right
|
||||
ctx.font = fontSize + 'px Arial';
|
||||
ctx.textAlign = 'left';
|
||||
ctx.fillText('zzgl. 19% USt:', labelX, summaryY + summaryRowHeight / 2);
|
||||
ctx.fillText('zzgl. ' + vatPctLabel + ' USt:', labelX, summaryY + summaryRowHeight / 2);
|
||||
ctx.font = 'bold ' + fontSize + 'px Arial';
|
||||
ctx.textAlign = 'right';
|
||||
ctx.fillText(vatTotal.toFixed(2).replace('.', ',') + ' €', valueX, summaryY + summaryRowHeight / 2);
|
||||
@@ -1135,6 +1137,12 @@ window.initProfileInvoiceGenerator = function() {
|
||||
};
|
||||
};
|
||||
|
||||
window.updateProfileVatRate = function(rate) {
|
||||
if (rate == null || isNaN(rate)) return;
|
||||
window.profileInvoiceVatRate = rate;
|
||||
draw();
|
||||
};
|
||||
|
||||
window.updateProfileMasterdataValue = function(key, value) {
|
||||
if (!window.masterdataValues) window.masterdataValues = {};
|
||||
window.masterdataValues[key] = value;
|
||||
|
||||
Reference in New Issue
Block a user