clean up repo

This commit is contained in:
Patryk Hegenberg 2023-10-30 12:17:20 +01:00
parent 100f7e474a
commit 8b19d803dd
8 changed files with 0 additions and 13742 deletions

View file

@ -1,25 +0,0 @@
module.exports = {
packagerConfig: {},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
certificateFile: './cert.pfx',
certificatePassword: process.env.CERTIFICATE_PASSWORD,
},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
};

View file

@ -1,142 +0,0 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="./style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self';" />
<title>Tagesabrechnung</title>
</head>
<body>
<main>
<div id="main" class="screen">
<div class="container">
<h1>Willkommen in der Tagesabrechnung</h1>
<p>Was möchtest du tun?</p>
<div class="menu">
<button id="show-button" type="button">Zeige Einträge</button>
<button id="in-button" type="button">Neuer Eintrag</button>
</div>
</div>
</div>
<div id="Eingabe" class="screen modal">
<h1>Eingabe Tagesdaten</h1>
<div style="margin-top: 20px;">
<button id="back-button" type="button">Zurück</button>
<button id="save-button" type="button">Speichern</button>
</div>
<p>Hier kannst du deine Daten für den heutigen Tag eingeben.</p>
<div class="Eingaben">
<div>
<form class="BarGeld">
<div class="formEntry">
<label>Gesamtes Münzgeld:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="gesamtMuenzen" placeholder="" value="0.00">
</div>
<div class="formEntry">
<label>5€ Scheine:</label>
<input type="number" id="5Euro" value=0>
</div>
<div class="formEntry">
<label>10€ Scheine:</label>
<input type="number" id="10Euro" value=0>
</div>
<div class="formEntry">
<label>20€ Scheine:</label>
<input type="number" id="20Euro" value=0>
</div>
<div class="formEntry">
<label>50€ Scheine:</label>
<input type="number" id="50Euro" value=0>
</div>
<div class="formEntry">
<label>100€ Scheine:</label>
<input type="number" id="100Euro" value=0>
</div>
<div class="formEntry">
<label>200€ Scheine:</label>
<input type="number" id="200Euro" value=0>
</div>
<div class="formEntry">
<label>Gesamtes Papiergeld:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="gesamtPapier" placeholder="" value="0.00">
</div>
<div class="formEntry">
<label>Gesamtes Bargeld:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="gesamtBar" placeholder="" value="0.00">
</div>
<div class="formEntry">
<label>Gesamtes Bargeld mit EC:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="gesamtBarEC" placeholder="" value="0.00">
</div>
</form>
</div>
<div>
<form class="EingabeSummen">
<div class="formEntry">
<label>Summe Rollengeld:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="Rollengeld" placeholder="" value="0.00">
</div>
<div class="formEntry">
<label>Summe Kartenzahlung:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="Kartenzahlung" placeholder="" value="0.00">
</div>
<div class="formEntry">
<label>zBon Kassenbericht:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="zBon-Bericht" placeholder="" value="0.00">
</div>
<div class="formEntry">
<label>Sonderausgabe aus Kasse:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="Sonderausgabe" placeholder="" value="0.00">
</div>
<div class="formEntry">
<label>Sondereingabe in Kasse:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="Sondereingabe" placeholder="" value="0.00">
</div>
<div class="formEntry">
<label>Storno - zu viel:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="Storno-viel" placeholder="zu viel auf zBon"
value="0.00">
</div>
<div class="formEntry">
<label>Storno - zu wenig:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="Storno-wenig" placeholder="zu wenig auf zBon"
value="0.00">
</div>
</form>
</div>
</div>
<form class="Ausgabe">
<div class="formOut">
<label>Papiergeld zurück in die Kasse</label>
<input type="text" pattern="\d+(\.\d{2})?" id="zurueckKasse" value="0.00">
</div>
<div class="formOut">
<label>Einzahlung auf Konto:</label>
<input type="text" pattern="\d+(\.\d{2})?" id="aufKonto" value="0.00">
</div>
<div class="formOut">
<label>Tagesbilanz vgl- Einnahme zu zBon</label>
<input type="text" pattern="\d+(\.\d{2})?" id="tagesbilanz" value="0.00">
</div>
</form>
</div>
<div id="Ausgaben" class="screen modal Ausgaben">
<h1>Ausgabe</h1>
<button id="back2-button" type="button">Zurück</button>
<button id="print-button" type="button">Einträge drucken</button>
<div id="anzeige">
<table id="table" class="Ausgaben">
</table>
</div>
</div>
</main>
<script src="./renderer.js"></script>
</body>
</html>

52
main.js
View file

@ -1,52 +0,0 @@
const { app, BrowserWindow, ipcMain } = require('electron');
require('electron-reloader')(module);
if (require('electron-squirrel-startup')) app.quit();
const path = require('path');
const sqlite3 = require('sqlite3');
const db = new sqlite3.Database('./abrechnung.db');
const createWindow = () => {
const win = new BrowserWindow({
width: 1000,
height: 900,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, 'preload.js')
}
});
ipcMain.handle('db-query', async (event, sqlQuery) => {
return new Promise(res => {
db.all(sqlQuery, (err, rows) => {
if (err) throw err;
res(rows);
});
});
});
win.webContents.openDevTools();
win.loadFile('index.html');
}
app.whenReady().then(() => {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
})
ipcMain.handle('databasePath', async (event, dbPath) => {
return await sqlite3.setdbPath(dbPath)
});
ipcMain.handle('executeQuery', async (event, query, fetch, value) => {
return await sqlite3.executeQuery(query, fetch, value);
});
db.serialize(() => {
db.run("CREATE TABLE IF NOT EXISTS abrechnungen (id INTEGER PRIMARY KEY, datum TEXT, einzahlung REAL, tagesbilanz REAL, bargeld REAL)");
});

13154
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,29 +0,0 @@
{
"name": "tagesabrechnung",
"version": "1.0.0",
"description": "Dies ist eine Software zum Berechnen des Tagesumsatzes",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
"author": "Patryk Hegenberg",
"license": "MIT",
"devDependencies": {
"@electron-forge/cli": "^6.0.5",
"@electron-forge/maker-deb": "^6.0.5",
"@electron-forge/maker-rpm": "^6.0.5",
"@electron-forge/maker-squirrel": "^6.0.5",
"@electron-forge/maker-zip": "^6.0.5",
"electron": "^22.2.0",
"electron-builder": "^23.6.0",
"electron-reloader": "^1.2.3"
},
"dependencies": {
"@electron/rebuild": "^3.2.10",
"electron-squirrel-startup": "^1.0.0",
"sqlite3": "^5.1.4"
}
}

View file

@ -1,12 +0,0 @@
const { contextBridge, ipcRenderer } = require("electron");
const rows = ipcRenderer.invoke('db-query', 'SELECT * FROM abrechnungen');
contextBridge.exposeInMainWorld('api', {
invoke: (channel, data) => {
let validChannels = ['db-query'];
if (validChannels.includes(channel)) {
return ipcRenderer.invoke(channel, data);
}
}
})

View file

@ -1,139 +0,0 @@
let abrechnungen = window.api.invoke('db-query', "SELECT * FROM abrechnungen").then(function(res) {
return res;
})
.catch(function(err) {
console.error(err);
});
const eintragen = () => {
window.api.invoke('db-query', "INSERT INTO abrechnungen (datum, Einzahlung, Tagesbilanz, Bargeld) VALUES (date(), "
+ parseFloat(document.getElementById("aufKonto").value) + ","
+ parseFloat(document.getElementById("tagesbilanz").value) + ","
+ parseFloat(document.getElementById("zurueckKasse").value) + ");").then(function(res) {
console.log(res);
})
.catch(function(err) {
console.error(err);
});
}
document.getElementById("save-button").addEventListener('click', () => {
eintragen()
});
document.getElementById("show-button").addEventListener('click', () => {
document.getElementById("main").style.display = "none"
document.getElementById("Ausgaben").style.display = "block"
anzeige();
});
document.getElementById("in-button").addEventListener('click', () => {
document.getElementById("Eingabe").style.display = "block"
document.getElementById("main").style.display = "none"
});
document.getElementById("back-button").addEventListener('click', () => {
document.getElementById("Eingabe").style.display = "none"
document.getElementById("main").style.display = "block"
});
document.getElementById("back2-button").addEventListener('click', () => {
document.getElementById("Ausgaben").style.display = "none"
document.getElementById("main").style.display = "block"
});
const updateGesamtBargeld = () => {
const muenzen = parseFloat(document.getElementById("gesamtMuenzen").value);
const papier = parseFloat(document.getElementById("gesamtPapier").value);
const rollengeld = parseFloat(document.getElementById("Rollengeld").value);
document.getElementById("gesamtBar").value = (muenzen + papier + rollengeld).toFixed(2);
getGesamtMitEC();
zurueckKasse();
Einzahlung();
Tagesbilanz();
}
const getPapierGeld = () => {
const euro5 = document.getElementById("5Euro").value * 5;
const euro10 = document.getElementById("10Euro").value * 10;
const euro20 = document.getElementById("20Euro").value * 20;
const euro50 = document.getElementById("50Euro").value * 50;
const euro100 = document.getElementById("100Euro").value * 100;
const euro200 = document.getElementById("200Euro").value * 200;
document.getElementById("gesamtPapier").value = euro5 + euro10 + euro20 + euro50 + euro100 + euro200;
updateGesamtBargeld();
}
const getGesamtMitEC = () => {
const ec = parseFloat(document.getElementById("Kartenzahlung").value);
const gesamtBar = parseFloat(document.getElementById("gesamtBar").value);
document.getElementById("gesamtBarEC").value = (ec + gesamtBar).toFixed(2);
}
const Tagesbilanz = async () => {
const gesamtMitEc = parseFloat(document.getElementById("gesamtBarEC").value);
const zBonBericht = parseFloat(document.getElementById("zBon-Bericht").value);
const sonderOut = parseFloat(document.getElementById("Sonderausgabe").value);
const sonderIn = parseFloat(document.getElementById("Sondereingabe").value);
const stornoWenig = parseFloat(document.getElementById("Storno-wenig").value);
const stornoViel = parseFloat(document.getElementById("Storno-viel").value);
const last = await lastEntry();
const result = gesamtMitEc + last - zBonBericht + sonderOut - sonderIn - stornoWenig + stornoViel;
document.getElementById("tagesbilanz").value = result.toFixed(2);
}
const zurueckKasse = () => {
const muenzgeld = parseFloat(document.getElementById("gesamtMuenzen").value);
const rollengeld = parseFloat(document.getElementById("Rollengeld").value);
const gesamt = 300 - muenzgeld - rollengeld;
document.getElementById("zurueckKasse").value = (Math.floor(gesamt / 5) * 5).toFixed(2);
}
const Einzahlung = () => {
const gesamtBar = parseFloat(document.getElementById("gesamtBar").value);
const zurueckKasse = parseFloat(document.getElementById("zurueckKasse").value);
let returnValue = gesamtBar - zurueckKasse;
(returnValue < 0 ? returnValue = 0.00 : returnValue.toFixed(2));
document.getElementById("aufKonto").value = (Math.floor(returnValue/5)*5).toFixed(2);
}
const createListeners = () => {
document.getElementById("5Euro").addEventListener("change", getPapierGeld);
document.getElementById("10Euro").addEventListener("change", getPapierGeld);
document.getElementById("20Euro").addEventListener("change", getPapierGeld);
document.getElementById("50Euro").addEventListener("change", getPapierGeld);
document.getElementById("100Euro").addEventListener("change", getPapierGeld);
document.getElementById("200Euro").addEventListener("change", getPapierGeld);
document.getElementById("gesamtMuenzen").addEventListener("change", updateGesamtBargeld);
document.getElementById("gesamtPapier").addEventListener("change", updateGesamtBargeld);
document.getElementById("Rollengeld").addEventListener("change", updateGesamtBargeld);
document.getElementById("Kartenzahlung").addEventListener("change", getGesamtMitEC);
document.getElementById("Kartenzahlung").addEventListener("change", Tagesbilanz);
document.getElementById("zBon-Bericht").addEventListener("change", Tagesbilanz);
document.getElementById("Sonderausgabe").addEventListener("change", Tagesbilanz);
document.getElementById("Sondereingabe").addEventListener("change", Tagesbilanz);
document.getElementById("Storno-wenig").addEventListener("change", Tagesbilanz);
document.getElementById("Storno-viel").addEventListener("change", Tagesbilanz);
}
const anzeige = () => {
console.log(abrechnungen);
let table = "<tr><th>Datum</th><th>Einzahlung</th><th>Tagesbilanz</th><th>Bargeld</th></tr>";
abrechnungen.then(function(data) {
for (let i = 0; i < data.length; i++) {
table += "<tr><td>" + data[i].datum + "</td><td>"
+ data[i].einzahlung + "</td><td>" + data[i].tagesbilanz
+ "</td><td>" + data[i].bargeld + "</td></tr>";
}
document.getElementById("table").innerHTML = table;
});
}
const lastEntry = async () => {
const lastAbrechnung = await window.api.invoke('db-query', "SELECT * FROM abrechnungen ORDER BY datum DESC Limit 1").then(function(res) {
return res[0].tagesbilanz;
});
return parseFloat(lastAbrechnung);
}
createListeners();

189
style.css
View file

@ -1,189 +0,0 @@
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
color: #0f0f0f;
background-color: #f6f6f6;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
.container {
margin: 0;
padding-top: 10vh;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}
.row {
display: flex;
justify-content: center;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
h1 {
text-align: center;
}
input,
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
color: #0f0f0f;
background-color: #ffffff;
transition: border-color 0.25s;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
}
button {
cursor: pointer;
}
button:hover {
border-color: #396cd8;
}
input,
button {
outline: none;
}
#greet-input {
margin-right: 5px;
}
@media (prefers-color-scheme: dark) {
:root {
color: #f6f6f6;
background-color: #2f2f2f;
}
a:hover {
color: #24c8db;
}
input,
button {
color: #ffffff;
background-color: #0f0f0f98;
}
}
.BarGeld {
flex-direction: column;
display: flex;
padding: 5px;
gap: 5px;
}
.EingabeSummen{
display: flex;
flex-direction: column;
padding: 5px;
gap: 5px;
}
button {
width: 250px;
}
.Eingaben{
display: flex;
flex-direction: row;
justify-content: space-evenly;
align-items: space-evenly;
gap: 5px;
}
.menu{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 5px;
}
.formEntry{
display: flex;
justify-content: space-between;
align-items: center;
text-align: center;
}
.Ausgabe{
display: flex;
flex-direction: row;
justify-content: center;
margin-top: 20px;
gap:5px;
}
.formOut{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#main {
display: block;
}
#Eingabe {
display: none;
text-align: center;
}
#Ausgaben {
display: none;
}
#table{
display: flex;
justify-content: space-evenly;
align-items: center;
}
.Ausgaben {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
text-align: center;
}
tr, th, td {
margin: 10px;
}
table {
width: 80%;
border-collapse: collapse;
margin: 2em auto;
}
th, td {
border: 1px solid #646cff;
padding: 0.8em 1.2em;
text-align: left;
font-size: 1em;
font-family: inherit;
}
th {
background-color: #646cff;
color: #ffffff;
}