Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@JavanXD
Created August 9, 2020 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JavanXD/8d921b7c1071d8b722922e2626c0cb86 to your computer and use it in GitHub Desktop.
Save JavanXD/8d921b7c1071d8b722922e2626c0cb86 to your computer and use it in GitHub Desktop.
Create a summary of your outgoings for lottery tickets on lotto-bw.de (DE)
sum = 0.0;
anzahlGewinne = 0;
anzahlSpielscheine = 0;
sumEurojackpot = 0.0;
sumLotto = 0.0;
sumGewinne = 0.0;
kostenEurojackpotScheine = 0.0;
anzahlEurojackpotScheine = 0;
kostenLOTTOScheine = 0.0;
anzahlLOTTOScheine = 0;
$('#journal_container .journal_container').children('.row').each( (index, element) => {
if (index === 0) {
return true; /* skip first row */
}
if ($(element).text().indexOf("Aufladen") !== -1) {
console.log(index, "Kundenkonto Aufladung (Lastschrifteinzug)");
return true;
}
if ($(element).text().indexOf("automatisch") !== -1) {
console.log(index, "Kundenkonto automatisch entladen (Lottogewinn)");
anzahlGewinne++;
return true;
}
moneyElement = $(element).children('.journal_row:last-child').children('.journal_cell:last-child').first();
money = parseFloat(moneyElement.text().replace(',', '.'));
console.log(index, money);
sum = sum+money;
if ($(element).text().indexOf("Spielschein bezahlt") !== -1) {
anzahlSpielscheine++;
if ($(element).text().indexOf("LOTTO 6aus49") !== -1) {
anzahlLOTTOScheine++;
kostenLOTTOScheine = kostenLOTTOScheine+money;
}
if ($(element).text().indexOf("Eurojackpot") !== -1) {
anzahlEurojackpotScheine++;
kostenEurojackpotScheine = kostenEurojackpotScheine+money;
}
}
if ($(element).text().indexOf("Gewinn Eurojackpot") !== -1) {
sumEurojackpot = sumEurojackpot+money;
sumGewinne = sumGewinne+money;
}
if ($(element).text().indexOf("Gewinn LOTTO 6aus49") !== -1) {
sumLotto = sumLotto+money;
sumGewinne = sumGewinne+money;
}
});
console.log('================ Auswertung ===================')
console.info("Anzahl gekaufter Spielscheine", anzahlSpielscheine);
console.info(" davon LOTTO 6aus49", anzahlLOTTOScheine);
console.info(" davon Eurojackpot", anzahlEurojackpotScheine);
console.info("Anzahl aller Gewinne", anzahlGewinne);
console.info("Summe Einnahmen/Ausgaben (€)", sum);
console.info("Summe Gewinne (€)", sumGewinne);
console.info(" davon LOTTO 6aus49 (€)", sumLotto);
console.info(" davon Eurojackpot (€)", sumEurojackpot);
console.info("Effektiver Preis pro LOTTO 6aus49 Schein (€)", parseFloat((kostenLOTTOScheine+sumLotto)/anzahlLOTTOScheine).toFixed(2));
console.info("Effektiver Preis pro Eurojackpot Schein (€)", parseFloat((kostenEurojackpotScheine+sumEurojackpot)/anzahlEurojackpotScheine).toFixed(2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment