Skip to content

Commit

Permalink
Merge pull request #6 from fdagner/Skonto
Browse files Browse the repository at this point in the history
Skonto
  • Loading branch information
fdagner authored Jan 24, 2024
2 parents 4602a68 + 7d0ee25 commit 1d99f16
Show file tree
Hide file tree
Showing 7 changed files with 462 additions and 21 deletions.
1 change: 1 addition & 0 deletions belege.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ <h4>Vorlage</h4>
<select id="svgDropdown">
<option value="template1">Klassisch</option>
<option value="template2">Modern</option>
<option value="template3">Mutig</option>
</select>
</div><div><br>
<button onclick="applySVGholen()">Daten übernehmen</button><br><br>
Expand Down
33 changes: 27 additions & 6 deletions js/belege.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ function reloadDropdownOptions() {
yamlData.forEach(company => {
const optionCustomer = document.createElement('option');
optionCustomer.value = company.unternehmen.name;
optionCustomer.text = company.unternehmen.name;
optionCustomer.text = company.unternehmen.name+ ' ' +company.unternehmen.rechtsform;;
dropdownCustomer.appendChild(optionCustomer);

const optionSupplier = document.createElement('option');
optionSupplier.value = company.unternehmen.name;
optionSupplier.text = company.unternehmen.name;
optionSupplier.text = company.unternehmen.name+ ' ' +company.unternehmen.rechtsform;;
dropdownSupplier.appendChild(optionSupplier);
});
}
Expand Down Expand Up @@ -111,12 +111,12 @@ fetch('js/unternehmen.yml')
yamlData.forEach(company => {
const optionCustomer = document.createElement('option');
optionCustomer.value = company.unternehmen.name;
optionCustomer.text = company.unternehmen.name;
optionCustomer.text = company.unternehmen.name+ ' ' +company.unternehmen.rechtsform;
dropdownCustomer.appendChild(optionCustomer);

const optionSupplier = document.createElement('option');
optionSupplier.value = company.unternehmen.name;
optionSupplier.text = company.unternehmen.name;
optionSupplier.text = company.unternehmen.name+ ' ' + company.unternehmen.rechtsform;
dropdownSupplier.appendChild(optionSupplier);
});

Expand Down Expand Up @@ -167,7 +167,15 @@ function loadSupplierData() {
let handelsregister = null;

const erlaubteRechtsformen = ["e. K.", "e. Kfr.", "OHG", "KG", "GmbH & Co. KG", "GmbH & Co. OHG"];
handelsregister = erlaubteRechtsformen.includes(selectedSupplier.unternehmen.rechtsform) ? "HRA" : "HRB";
handelsregister;

if (erlaubteRechtsformen.includes(selectedSupplier.unternehmen.rechtsform)) {
handelsregister = "HRA";
} else if (selectedSupplier.unternehmen.rechtsform === "") {
handelsregister = "";
} else {
handelsregister = "HRB";
}

document.getElementById('amtsgerichtLieferer').textContent = 'Amtsgericht ' + selectedSupplier.unternehmen.adresse.ort + ' ' + handelsregister;
document.getElementById('ustidLieferer').textContent = 'UST-IdNr.: ' + selectedSupplier.unternehmen.ust_id;
Expand Down Expand Up @@ -399,8 +407,21 @@ function applyOrderData() {

document.getElementById('zahlungsziel').textContent = zahlungszielInput;
document.getElementById('skonto').textContent = skontoInput;
document.getElementById('skontofrist').textContent = skontofristInput;

// Überprüfen, ob skontoInput 0 oder leer ist
if (skontoInput === "" || parseFloat(skontoInput) === 0) {
// Falls 0 oder leer, das Element mit der ID "skontotext" entfernen
const skontotextElement = document.getElementById('skontotext');
if (skontotextElement) {
skontotextElement.remove();
}
} else {
// Falls nicht 0 oder leer, den Text des Elements mit der ID "skonto" setzen
document.getElementById('skonto').textContent = skontoInput;
document.getElementById('skontofrist').textContent = skontofristInput;

}

// Berechne und setze den Gesamtbetrag der Rechnung
// Berechne die Zwischensumme
const zwischensumme = gesamtpreis1 + gesamtpreis2;
Expand Down
24 changes: 23 additions & 1 deletion js/unternehmen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,26 @@
steuernummer: "181/015/1151"
iban: "DE89370400000532000077"
bic: "COBADEFFXXX"
inhaber: "Thorsten Fiedler"
inhaber: "Thorsten Fiedler"

- unternehmen:
id: "17"
name: "Petra Meininger"
motto: "Rechtsanwältin"
bank: "Sparbank"
rechtsform: ""
logo: ""
adresse:
strasse: "Platz der Einheit 85"
plz: "90431"
ort: "Nürnberg"
land: "Deutschland"
kontakt:
telefon: "0911 2654-1"
email: "[email protected]"
internet: "meiningerp.de"
ust_id: "DE443455666"
steuernummer: "181/044/1331"
iban: "DE89370400000876000077"
bic: "COBADFGHXXX"
inhaber: "Petra Meininger"
12 changes: 5 additions & 7 deletions templates/template1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions templates/template2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 100 additions & 0 deletions templates/template3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1d99f16

Please sign in to comment.