Skip to content

Commit

Permalink
Merge pull request #75 from fdagner/bwr3
Browse files Browse the repository at this point in the history
inventurdifferenzen
  • Loading branch information
fdagner authored May 11, 2024
2 parents 807e3ad + 35ffd4f commit 6a9c1b9
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 7 deletions.
9 changes: 5 additions & 4 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ footer {
}

.dropdown .dropbtn {
font-size: 16px;
font-size: 16px;
border: none;
outline: none;
color: white;
Expand All @@ -329,7 +329,8 @@ footer {
margin: 0;
}

.navbar a:hover, .dropdown:hover .dropbtn {
.navbar a:hover,
.dropdown:hover .dropbtn {
background-color: #fc8042;
}

Expand All @@ -338,7 +339,7 @@ footer {
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}

Expand All @@ -358,4 +359,4 @@ footer {

.dropdown:hover .dropdown-content {
display: block;
}
}
101 changes: 101 additions & 0 deletions inventurdifferenzen.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<!DOCTYPE html>
<html lang="de">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Buchführung</title>
<link rel="stylesheet" href="css/style.css">
<script src="js/html2canvas.min.js"></script>
<script src="js/kontenplan.js"></script>
<script src="js/js-yaml.min.js"></script>
<script src="js/clipboard.min.js"></script>
<script src="js/menu.js"></script>
</head>
<main>
<div w3-include-html="navigation.html"></div>
<h2>Inventurdifferenzen</h2>
<form id="inventurdifferenzenForm" class="box">
<p>Für die Werkstoffarten können zufällige Ist- und Soll-Bestände generiert werden.</p>
<button type="button" onclick="updateTable()"><svg xmlns="http://www.w3.org/2000/svg" fill="#ff4800" 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="M105.1 202.6c7.7-21.8 20.2-42.3 37.8-59.8c62.5-62.5 163.8-62.5 226.3 0L386.3 160H352c-17.7 0-32 14.3-32 32s14.3 32 32 32H463.5c0 0 0 0 0 0h.4c17.7 0 32-14.3 32-32V80c0-17.7-14.3-32-32-32s-32 14.3-32 32v35.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0C73.2 122 55.6 150.7 44.8 181.4c-5.9 16.7 2.9 34.9 19.5 40.8s34.9-2.9 40.8-19.5zM39 289.3c-5 1.5-9.8 4.2-13.7 8.2c-4 4-6.7 8.8-8.1 14c-.3 1.2-.6 2.5-.8 3.8c-.3 1.7-.4 3.4-.4 5.1V432c0 17.7 14.3 32 32 32s32-14.3 32-32V396.9l17.6 17.5 0 0c87.5 87.4 229.3 87.4 316.7 0c24.4-24.4 42.1-53.1 52.9-83.7c5.9-16.7-2.9-34.9-19.5-40.8s-34.9 2.9-40.8 19.5c-7.7 21.8-20.2 42.3-37.8 59.8c-62.5 62.5-163.8 62.5-226.3 0l-.1-.1L125.6 352H160c17.7 0 32-14.3 32-32s-14.3-32-32-32H48.4c-1.6 0-3.2 .1-4.8 .3s-3.1 .5-4.6 1z" />
</svg> Neue Tabelle erstellen</button>
</form>

<div id="inventurdifferenzenButtonContainer" style="margin:0 auto;">
<div style="width:700px" contenteditable="true">
<div id="inventurdifferenzenContainer" style="margin: 0 auto;padding:10px">
<h3>Aufgabe</h3>
<p><b>Für die verschiedenen Werkstoffarten liegen dir aus der Inventur die Ist-Bestände und aus der
Buchführung die Soll-Bestände vor. Ermittle jeweils die Höhe der Inventurabweichung.</b></p>
<table class="inventurdifferenz"
style="border: 1px solid #ccc;font-family:courier;font-size: 16px;min-width:650px;border-collapse:collapse;">
<thead>
<tr style="text-align: center;background-color:#ededed;font-weight: bold;">
<th>Werkstoffe</th>
<th>Ist-Bestand</th>
<th>Soll-Bestand</th>
<th>Inventurdifferenz</th>
</tr>
</thead>
<tbody id="table-body">
</tbody>
</table>

<h3>Lösung</h3>
<table class="inventurdifferenz"
style="border: 1px solid #ccc;font-family:courier;font-size: 16px;min-width:650px;border-collapse:collapse;">
<thead>
<tr style="text-align: center;background-color:#ededed;font-weight: bold;">
<th>Werkstoffe</th>
<th>Ist-Bestand</th>
<th>Soll-Bestand</th>
<th>Inventurdifferenz</th>
</tr>
</thead>
<tbody id="table-body-l">
</tbody>
</table>
</div>
</div>
<div class="exportButtons">
<button class="icon" type="button" onclick="inventurdifferenzenHerunterladenAlsPNG()"><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" id="officeButtonVorkontierung"
data-clipboard-target="#inventurdifferenzenContainer"><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="M48 448V64c0-8.8 7.2-16 16-16H224v80c0 17.7 14.3 32 32 32h80V448c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16zM64 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 0H64zm55 241.1c-3.8-12.7-17.2-19.9-29.9-16.1s-19.9 17.2-16.1 29.9l48 160c3 10.2 12.4 17.1 23 17.1s19.9-7 23-17.1l25-83.4 25 83.4c3 10.2 12.4 17.1 23 17.1s19.9-7 23-17.1l48-160c3.8-12.7-3.4-26.1-16.1-29.9s-26.1 3.4-29.9 16.1l-25 83.4-25-83.4c-3-10.2-12.4-17.1-23-17.1s-19.9 7-23 17.1l-25 83.4-25-83.4z" />
</svg></button>
<button class="icon" type="button" onclick="inventurdifferenzenHerunterladen()"><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="inventurdifferenzenKopiereInZwischenablage()"><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>
</div>

</main>
<script src="js/inventurdifferenzen.js"></script>
<div w3-include-html="footer.html"></div>
<script>
includeHTML();
</script>
</body>

</html>
2 changes: 0 additions & 2 deletions js/buchungssatz.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ function buchungssatzHerunterladenAlsPNG() {
a.click();
document.body.removeChild(a);
});
scale: 2;
onrendered: myRenderFunction;
}

let clipboardBuchungssatz = new ClipboardJS('#officeButtonBuchungssatz');
Expand Down
110 changes: 110 additions & 0 deletions js/inventurdifferenzen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@


// Formatieren der Währung mit Euro-Symbol, Tausenderpunkt und Dezimalkomma
function formatCurrency(amount) {
return new Intl.NumberFormat("de-DE", {
style: "currency",
currency: "EUR",
}).format(amount);
}

function generateRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}

function generateRandomPercentage(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}

function updateTable() {
let werkstoffe = ["Rohstoffe", "Fremdbauteile", "Hilfsstoffe", "Betriebsstoffe"];
let tableBody = document.getElementById("table-body");
let tableBodyl = document.getElementById("table-body-l");
let tableContent = "";
let tableContentl = "";
let averageValue = 0;

// Calculate average value for werkstoffe other than "Rohstoffe"
for (let i = 1; i < werkstoffe.length; i++) {
averageValue += generateRandomNumber(5000, 100000);
}
averageValue /= (werkstoffe.length - 1);

for (let i = 0; i < werkstoffe.length; i++) {
let werkstoff = werkstoffe[i];
let inventoryValue = 0;

if (werkstoff === "Rohstoffe") {
inventoryValue = averageValue * 2;
} else {
inventoryValue = generateRandomNumber(5000, 100000);
}

let deviationPercentage = generateRandomPercentage(-2, 10);
let accountingValue = Math.round(inventoryValue * (1 + deviationPercentage / 100));
let inventoryDifference = -1 * (inventoryValue - accountingValue);

tableContent += "<tr>";
tableContent += "<td style='text-align: left;border: 1px solid #ccc;padding: 15px;'>" + werkstoff + "</td>";
tableContent += "<td style='text-align: right;border: 1px solid #ccc;padding: 15px;'>" + formatCurrency(inventoryValue) + "</td>";
tableContent += "<td style='text-align: right;border: 1px solid #ccc;padding: 15px;'>" + formatCurrency(accountingValue) + "</td>";
tableContent += "<td style='text-align: right;border: 1px solid #ccc;padding: 15px;'></td>";
tableContent += "</tr>";

tableContentl += "<tr>";
tableContentl += "<td style='text-align: left;border: 1px solid #ccc;padding: 15px;'>" + werkstoff + "</td>";
tableContentl += "<td style='text-align: right;border: 1px solid #ccc;padding: 15px;'>" + formatCurrency(inventoryValue) + "</td>";
tableContentl += "<td style='text-align: right;border: 1px solid #ccc;padding: 15px;'>" + formatCurrency(accountingValue) + "</td>";
tableContentl += "<td style='text-align: right;border: 1px solid #ccc;padding: 15px;'>" + formatCurrency(inventoryDifference) + "</td>";
tableContentl += "</tr>";
}

tableBody.innerHTML = tableContent;
tableBodyl.innerHTML = tableContentl;
}

updateTable();

function inventurdifferenzenHerunterladen() {
const inventurdifferenzenHTML = document.getElementById('inventurdifferenzenContainer').innerHTML;
const blob = new Blob([inventurdifferenzenHTML], { type: 'text/html' });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'inventurdifferenzen.html';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}

function inventurdifferenzenKopiereInZwischenablage() {
const inventurdifferenzenHTML = document.getElementById('inventurdifferenzenContainer').innerHTML;
navigator.clipboard.writeText(inventurdifferenzenHTML)
.then(() => alert('Code wurde in die Zwischenablage kopiert'))
.catch(err => console.error('Fehler beim Kopieren in die Zwischenablage:', err));
}

function inventurdifferenzenHerunterladenAlsPNG() {
const inventurdifferenzenContainer = document.getElementById('inventurdifferenzenContainer');

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

let clipboardVorkontierung = new ClipboardJS('#officeButtonVorkontierung');

clipboardVorkontierung.on('success', function (e) {
console.log("Die Tabelle wurde in die Zwischenablage kopiert.");
alert("Die Tabelle wurde in die Zwischenablage kopiert.");
});

clipboardVorkontierung.on('error', function (e) {
console.error("Fehler beim Kopieren der Tabelle: ", e.action);
alert("Fehler beim Kopieren der Tabelle.");
});
1 change: 1 addition & 0 deletions navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<div class="dropdown-content">
<a href="inventar.html">Inventar</a>
<a href="bilanz7.html">Bilanz 7</a>
<a href="inventurdifferenzen.html">Inventurdifferenzen</a>
<a href="promptsammlung7.html">Promptsammlung 7</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion vorkontierung.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2>Vorkontierung</h2>
<div style="padding-left:6px;border: 1px solid #ddd;padding: 4px;">
<video style="width:100%;margin: 0 auto;" controls>
<source src="media/video/vorkontierung.mp4" type="video/mp4">
Your bser does not support the video tag.
Your browser does not support the video tag.
</video>
</div>
</details><br>
Expand Down

0 comments on commit 6a9c1b9

Please sign in to comment.