Skip to content

Commit

Permalink
quittung
Browse files Browse the repository at this point in the history
  • Loading branch information
fdagner committed Feb 10, 2024
1 parent 348e518 commit be8b45c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
22 changes: 21 additions & 1 deletion belege.html
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,27 @@ <h3>Allgemeine Daten</h3>
</div>

<div id="quittungContainer"
style="border:1px solid #00000039;line-height:0.75;padding:0px;margin:0px;min-width:700px;">
style="border:1px solid #00000039;line-height:0.75;padding:0px;margin:0px;min-width:700px;"></div>
<div class="exportButtons">
<button class="icon" type="button" onclick="quittungHerunterladenAlsPNG()"><svg
xmlns="http://www.w3.org/2000/svg" height="16" width="16"
viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
<path
d="M448 80c8.8 0 16 7.2 16 16V415.8l-5-6.5-136-176c-4.5-5.9-11.6-9.3-19-9.3s-14.4 3.4-19 9.3L202 340.7l-30.5-42.7C167 291.7 159.8 288 152 288s-15 3.7-19.5 10.1l-80 112L48 416.3l0-.3V96c0-8.8 7.2-16 16-16H448zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm80 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z" />
</svg></button>
<button class="icon" type="button" onclick="quittungHerunterladen()"><svg
xmlns="http://www.w3.org/2000/svg" height="16" width="12"
viewBox="0 0 384 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
<path
d="M64 464c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16H224v80c0 17.7 14.3 32 32 32h80V448c0 8.8-7.2 16-16 16H64zM64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V154.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0H64zm97 289c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L79 303c-9.4 9.4-9.4 24.6 0 33.9l48 48c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-31-31 31-31zM257 255c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l31 31-31 31c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l48-48c9.4-9.4 9.4-24.6 0-33.9l-48-48z" />
</svg></button>
<button class="icon" type="button" onclick="quittungKopiereInZwischenablage()"><svg
xmlns="http://www.w3.org/2000/svg" height="16" width="20"
viewBox="0 0 640 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
<path
d="M392.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm80.6 120.1c-12.5 12.5-12.5 32.8 0 45.3L562.7 256l-89.4 89.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l112-112c12.5-12.5 12.5-32.8 0-45.3l-112-112c-12.5-12.5-32.8-12.5-45.3 0zm-306.7 0c-12.5-12.5-32.8-12.5-45.3 0l-112 112c-12.5 12.5-12.5 32.8 0 45.3l112 112c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256l89.4-89.4c12.5-12.5 12.5-32.8 0-45.3z" />
</svg></button>
</div>
</section>


Expand Down
33 changes: 33 additions & 0 deletions js/belege.js
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,39 @@ function kontoauszugHerunterladenAlsPNG() {
});
}


function quittungHerunterladen() {
const rechnungHTML = document.getElementById('quittungContainer').innerHTML.replace(/&nbsp;/g, ' ');;
const blob = new Blob([rechnungHTML], { type: 'svg' });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'quittung.svg';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}

function quittungKopiereInZwischenablage() {
const rechnungHTML = document.getElementById('quittungContainer').innerHTML.replace(/&nbsp;/g, ' ');;
navigator.clipboard.writeText(rechnungHTML)
.then(() => alert('Code wurde in die Zwischenablage kopiert'))
.catch(err => console.error('Fehler beim Kopieren in die Zwischenablage:', err));
}

function quittungHerunterladenAlsPNG() {
const quittungContainer = document.getElementById('quittungContainer');

html2canvas(quittungContainer).then(canvas => {
const dataURL = canvas.toDataURL('image/png');
const a = document.createElement('a');
a.href = dataURL;
a.download = 'quittung.png';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
});
}

function emailHerunterladen() {
const emailHTML = document.getElementById('emailContainer').innerHTML.replace(/&nbsp;/g, ' ');;
const blob = new Blob([emailHTML], { type: 'html' });
Expand Down

0 comments on commit be8b45c

Please sign in to comment.