54 Commits

Author SHA1 Message Date
Hendrik Schutter c4297a4be2 fixed spelling mistakes 3 years ago
Hendrik Schutter fd52d3df6d added yt link for Kurzanleitung 3 years ago
Hendrik Schutter c320ef615d added yt link and fixed some spelling errors 3 years ago
Hendrik Schutter 2a20ea7bdb spelling errors fixed 3 years ago
Hendrik Schutter a56ad43852 Merge branch 'master' of https://git.mosad.xyz/localhorst/jFxKasse 3 years ago
Hendrik Schutter 188214dfbe bug fix 3 years ago
Hendrik Schutter cdbe2cccc0 „README.md“ ändern 3 years ago
Hendrik Schutter 5152846478 added screenshots 3 years ago
Hendrik Schutter f5c5d546c5 added kiy input 3 years ago
Hendrik Schutter 5c9d54dabf ui fixes and bill layout improvements 3 years ago
Hendrik Schutter 96d5968fef code cleanup and ui fixes 3 years ago
Hendrik Schutter 88b39820ca bill splitted 3 years ago
Hendrik Schutter 25bedae873 scroll bar is now on right side 3 years ago
Hendrik Schutter 1ec02d74a3 fixed issue with jobtime 3 years ago
Hendrik Schutter 783d9f9bc0 fixed issue #1 3 years ago
Hendrik Schutter a7b2753aa3 code cleanup and cross platform 3 years ago
Hendrik Schutter dd9ff0d410 reprint job 3 years ago
Hendrik Schutter 4e902415d7 xml saving and loading is complete 3 years ago
Hendrik Schutter 87f9b8786c xml is now in XMLController 3 years ago
Hendrik Schutter 37cfe02c5b added basic printer support 3 years ago
Hendrik Schutter 76020e371b added new pom.xml 3 years ago
Hendrik Schutter b9b6748ac7 „bin/src/main/java/com/jFxKasse/application/JavaFX11Main.class“ löschen 3 years ago
Hendrik Schutter 078b3dfdea „bin/src/main/java/com/jFxKasse/application/Main.class“ löschen 3 years ago
Hendrik Schutter 0db448019c „bin/src/main/java/com/jFxKasse/controller/DBController.class“ löschen 3 years ago
Hendrik Schutter fbd128e5b9 „bin/src/main/java/com/jFxKasse/controller/MainWindowController.class“ löschen 3 years ago
Hendrik Schutter 290a5d8e5c „bin/src/main/java/com/jFxKasse/datatypes/Job.class“ löschen 3 years ago
Hendrik Schutter dfe1008786 „bin/src/main/java/com/jFxKasse/datatypes/tableDataCurrentOrder.class“ löschen 3 years ago
Hendrik Schutter e691d4e1dc „bin/src/main/java/com/jFxKasse/datatypes/tableDataJob.class“ löschen 3 years ago
Hendrik Schutter 8ff4d88202 „bin/src/main/java/com/jFxKasse/datatypes/tableDataPositionen.class“ löschen 3 years ago
Hendrik Schutter 86c0ad144a „bin/src/main/resources/css/application.css“ löschen 3 years ago
Hendrik Schutter 38d42db6cd „bin/src/main/resources/fxml/MainWindow.fxml“ löschen 3 years ago
Hendrik Schutter c85f239651 „bin/.gitignore“ löschen 3 years ago
Hendrik Schutter 4291038d4e „bin/.project“ löschen 3 years ago
Hendrik Schutter ccaf68d60f „bin/LICENSE“ löschen 3 years ago
Hendrik Schutter ac85cb82ff „bin/README.md“ löschen 3 years ago
Hendrik Schutter ea7f84c2c1 „build.fxbuild“ löschen 3 years ago
Hendrik Schutter 9d506475cb „pom.xml“ löschen 3 years ago
Hendrik Schutter aca967e88d „bin/build.fxbuild“ löschen 3 years ago
Hendrik Schutter ebda172415 „bin/pom.xml“ löschen 3 years ago
Hendrik Schutter 279f358392 avgJobValue is now correct 3 years ago
Hendrik Schutter 244243f07a final maven setup 3 years ago
Hendrik Schutter 50b623dd39 seil0 edit 3 years ago
Hendrik Schutter 3f4edc85f0 added dir com 3 years ago
Hendrik Schutter 121a86a6b5 directory structure 3 years ago
Hendrik Schutter 0185053b8d added shade 3 years ago
Hendrik Schutter 06495ebd5b „bin/application/application.css“ löschen 3 years ago
Hendrik Schutter fc03ba40e3 „bin/application/MainWindowController.class“ löschen 3 years ago
Hendrik Schutter 640a9e4de4 „bin/application/MainWindowController$1.class“ löschen 3 years ago
Hendrik Schutter 0cad411304 „bin/application/MainWindow.fxml“ löschen 3 years ago
Hendrik Schutter 514f1b0605 „bin/application/Main.class“ löschen 3 years ago
Hendrik Schutter 0944f210dd „bin/application/DBController.class“ löschen 3 years ago
Hendrik Schutter ef23a0d631 „bin/application/DBController$1.class“ löschen 3 years ago
Hendrik Schutter ae3e02278d converted to Maven 3 years ago
Hendrik Schutter 259988195f fixed number input 3 years ago
  1. 36
      README.md
  2. BIN
      bin/application/DBController$1.class
  3. BIN
      bin/application/DBController.class
  4. BIN
      bin/application/Main.class
  5. 374
      bin/application/MainWindow.fxml
  6. BIN
      bin/application/MainWindowController$1.class
  7. BIN
      bin/application/MainWindowController.class
  8. BIN
      bin/application/tableData.class
  9. BIN
      bin/resources/icons/addEntry.png
  10. 8
      build.fxbuild
  11. 101
      pom.xml
  12. BIN
      screenshots/jobs
  13. BIN
      screenshots/newjob
  14. BIN
      screenshots/positions
  15. BIN
      screenshots/settings
  16. 93
      src/application/Main.java
  17. 1
      src/application/application.css
  18. 12
      src/main/java/com/jFxKasse/application/JavaFX11Main.java
  19. 129
      src/main/java/com/jFxKasse/application/Main.java
  20. 98
      src/main/java/com/jFxKasse/application/PrintJob.java
  21. 24
      src/main/java/com/jFxKasse/application/TimeDate.java
  22. 115
      src/main/java/com/jFxKasse/controller/DBController.java
  23. 227
      src/main/java/com/jFxKasse/controller/KeyController.java
  24. 569
      src/main/java/com/jFxKasse/controller/MainWindowController.java
  25. 140
      src/main/java/com/jFxKasse/controller/PrinterController.java
  26. 219
      src/main/java/com/jFxKasse/controller/XMLController.java
  27. 32
      src/main/java/com/jFxKasse/datatypes/Category.java
  28. 36
      src/main/java/com/jFxKasse/datatypes/Job.java
  29. 180
      src/main/java/com/jFxKasse/datatypes/PrintData.java
  30. 93
      src/main/java/com/jFxKasse/datatypes/PrintDataSimple.java
  31. 169
      src/main/java/com/jFxKasse/datatypes/PrintDataSplitted.java
  32. 3
      src/main/java/com/jFxKasse/datatypes/tableDataCurrentOrder.java
  33. 2
      src/main/java/com/jFxKasse/datatypes/tableDataJob.java
  34. 2
      src/main/java/com/jFxKasse/datatypes/tableDataPositionen.java
  35. 0
      src/main/resources/css/application.css
  36. 180
      src/main/resources/fxml/MainWindow.fxml

36
README.md

@ -1,2 +1,38 @@
# jFxKasse
easy payment system for small to middel sized events with a sales slip printer
Simples Kassensystem für kleine bis mittlere Veranstaltungen mit Bon-Drucker
## Video Tutorials (German | Deutsch)
[YouTube Video: jFxKasse - Kassensystem - Kurzanleitung](https://www.youtube.com/watch?v=DV9DDESw40I)
[YouTube Video: jFxKasse - Kassensystem - Installieren](https://www.youtube.com/watch?v=IY1bqRjwh0Q)
## Screenshots
### Main View | Hauptansicht
![](https://git.mosad.xyz/localhorst/jFxKasse/raw/branch/master/screenshots/newjob)
### Jobs | Auftäge
![](https://git.mosad.xyz/localhorst/jFxKasse/raw/branch/master/screenshots/jobs)
### Positions | Positionen
![](https://git.mosad.xyz/localhorst/jFxKasse/raw/branch/master/screenshots/positions)
### Settings | Einstellungen
![](https://git.mosad.xyz/localhorst/jFxKasse/raw/branch/master/screenshots/settings)
## Requirements | Anforderungen
### Software
* Java JRE 11
* Display/Bildschirm > 1366px X 768px
* Windoofs, Mac, GNU/Linux (openSuse tested)
### Hardware
I used this printer: [Epson TM T20II](https://www.epson.de/products/sd/pos-printer/epson-tm-t20ii)
Other sales slip printer are possible.

BIN
bin/application/DBController$1.class

BIN
bin/application/DBController.class

BIN
bin/application/Main.class

374
bin/application/MainWindow.fxml

@ -1,374 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXTextField?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.control.TreeTableColumn?>
<?import javafx.scene.control.TreeTableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="mainAnchorpane" maxHeight="732.0" maxWidth="1366.0" minHeight="732.0" minWidth="1366.0" prefHeight="732.0" prefWidth="1366.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
<children>
<TabPane layoutX="4.0" layoutY="5.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="924.0" prefWidth="1536.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<tabs>
<Tab text="Einstellungen">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<Button fx:id="ueberbtn" layoutX="664.0" layoutY="325.0" mnemonicParsing="false" onAction="#ueberbtnAction" text="Über" />
<TitledPane alignment="CENTER" animated="false" collapsible="false" contentDisplay="CENTER" layoutX="790.0" layoutY="10.0" prefHeight="163.0" prefWidth="566.0" text="Datenbank">
<content>
<AnchorPane fx:id="paneDB" minHeight="0.0" minWidth="0.0" prefHeight="135.0" prefWidth="547.0">
<children>
<Label fx:id="labelDBName" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="329.0" layoutY="10.0" prefHeight="34.0" prefWidth="229.0" text="Datenbankname:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<JFXTextField fx:id="tftNewDBName" alignment="CENTER" layoutX="25.0" layoutY="10.0" prefHeight="25.0" prefWidth="376.0" />
<Label fx:id="labelDBStatus" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="7.0" layoutY="50.0" prefHeight="34.0" prefWidth="551.0" text="Keine Datenbank gefunden!">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<Button fx:id="btnCreateNewDatabase" layoutX="297.0" layoutY="90.0" mnemonicParsing="false" onAction="#btnCreateNewDatabaseAction" text="Neue Datenbank anlegen">
<font>
<Font name="Cantarell Regular" size="13.0" />
</font>
</Button>
<Button fx:id="btnOpenFolder" layoutX="39.0" layoutY="90.0" mnemonicParsing="false" onAction="#btnOpenFolderAction" text="Speicherort öffnen">
<font>
<Font name="Cantarell Regular" size="13.0" />
</font>
</Button>
</children>
</AnchorPane>
</content>
<font>
<Font name="Cantarell Regular" size="13.0" />
</font>
</TitledPane>
</children>
</AnchorPane>
</content>
</Tab>
<Tab text="Positionen bearbeiten">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<TreeTableView fx:id="entryTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="502.0" prefWidth="1346.0">
<columns>
<TreeTableColumn fx:id="columnColor" editable="false" maxWidth="200.0" minWidth="200.0" prefWidth="200.0" resizable="false" sortable="false" text="Farbe" />
<TreeTableColumn fx:id="columnPrize" editable="false" maxWidth="200.0" minWidth="200.0" prefWidth="200.0" resizable="false" sortable="false" text="Preis" />
<TreeTableColumn fx:id="columnPositionsEdit" editable="false" maxWidth="800.0" minWidth="800.0" prefWidth="800.0" resizable="false" sortable="false" text="Positionen" />
<TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="120.0" minWidth="120.0" prefWidth="120.0" resizable="false" sortable="false" text="Nummer" />
</columns>
<columnResizePolicy>
<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TreeTableView>
<Button fx:id="btnSaveEntry" layoutX="494.0" layoutY="631.0" mnemonicParsing="false" onAction="#btnSaveEntryAction" text="Ausgewählten Eintrag speichern">
<font>
<Font name="Cantarell Regular" size="17.0" />
</font>
</Button>
<Button fx:id="btnClearEntry" layoutX="462.0" layoutY="525.0" mnemonicParsing="false" onAction="#btnClearEntryAction" text="Ausgewählten Eintrag zurücksetzten">
<font>
<Font name="Cantarell Regular" size="17.0" />
</font>
</Button>
<TitledPane alignment="CENTER" animated="false" collapsible="false" contentDisplay="CENTER" layoutX="792.0" layoutY="525.0" prefHeight="163.0" prefWidth="565.0" text="Eintrag editieren">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<Label fx:id="lableNewPosition" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="10.0" prefHeight="34.0" prefWidth="105.0" text="Position:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<JFXTextField fx:id="tftNewPosition" alignment="CENTER" layoutX="160.0" layoutY="10.0" prefHeight="25.0" prefWidth="279.0">
<font>
<Font name="Cantarell Regular" size="13.0" />
</font></JFXTextField>
<Label fx:id="labelNewValue" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="442.0" layoutY="50.0" prefHeight="34.0" prefWidth="118.0" text="Preis in Euro:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<JFXTextField fx:id="tftNewValue" alignment="CENTER" layoutX="380.0" layoutY="50.0" prefHeight="25.0" prefWidth="58.0">
<font>
<Font name="Cantarell Regular" size="13.0" />
</font></JFXTextField>
<Label fx:id="lableNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<ChoiceBox fx:id="colorChoise" layoutX="292.0" layoutY="95.0" prefWidth="150.0" />
</children>
</AnchorPane>
</content>
<font>
<Font name="Cantarell Regular" size="13.0" />
</font>
</TitledPane>
</children></AnchorPane>
</content>
</Tab>
<Tab text="Aufträge">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0">
<children>
<TreeTableView fx:id="jobsTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="541.0" prefWidth="1346.0">
<columns>
<TreeTableColumn fx:id="columnJobValue" editable="false" prefWidth="90.6666259765625" resizable="false" text="Betrag" />
<TreeTableColumn fx:id="columnState" editable="false" prefWidth="91.0" resizable="false" text="Zustand" />
<TreeTableColumn fx:id="columnPositions" editable="false" prefWidth="981.333251953125" resizable="false" sortable="false" text="Positionen" />
<TreeTableColumn fx:id="columnTime" editable="false" prefWidth="99.666748046875" resizable="false" text="Zeit" />
<TreeTableColumn fx:id="columnJobNumber" editable="false" maxWidth="3000.0" prefWidth="83.6666259765625" resizable="false" text="Nummer" />
</columns>
</TreeTableView>
<Button fx:id="btnReprintJob" layoutX="378.0" layoutY="603.0" mnemonicParsing="false" onAction="#btnReprintJobAction" text="Ausgewählter Auftrag drucken">
<font>
<Font name="Cantarell Regular" size="17.0" />
</font>
</Button>
<TitledPane fx:id="titlePaneStats" alignment="CENTER" collapsible="false" contentDisplay="CENTER" layoutX="992.0" layoutY="561.0" prefHeight="118.0" prefWidth="365.0" text="Statistik - 30.03.2018 15:15 Uhr">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="59.0" prefWidth="483.0">
<children>
<Label fx:id="lableJobCount" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="17.0" layoutY="2.0" prefHeight="34.0" prefWidth="340.0" text="Anzahl Aufträge: 2781">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<Label fx:id="labelAvgJob" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="17.0" layoutY="30.0" prefHeight="34.0" prefWidth="340.0" text="Durchschnittlicher Auftragswert: 12,90€">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
<Label fx:id="lableAllValue" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="17.0" layoutY="60.0" prefHeight="34.0" prefWidth="340.0" text="Gesamt: 1088,48€">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
</Label>
</children>
</AnchorPane>
</content>
</TitledPane>
<Button fx:id="btnCancelJob" layoutX="44.0" layoutY="603.0" mnemonicParsing="false" onAction="#btnCancelJobAction" text="Ausgewählter Auftrag stornieren">
<font>
<Font name="Cantarell Regular" size="17.0" />
</font>
</Button>
<Button fx:id="btnCalcStats" layoutX="712.0" layoutY="603.0" mnemonicParsing="false" onAction="#btnCalcStatsAction" text="Statistiken berrechnen">
<font>
<Font name="Cantarell Regular" size="17.0" />
</font>
</Button>
</children>
</AnchorPane>
</content>
</Tab>
<Tab text="Neuer Auftrag">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0">
<children>
<TreeTableView fx:id="tableCurrentOrder" layoutX="15.0" layoutY="85.0" prefHeight="379.0" prefWidth="382.0">
<columns>
<TreeTableColumn fx:id="columnPosition" editable="false" prefWidth="304.3333740234375" resizable="false" sortable="false" text="Position" />
<TreeTableColumn fx:id="columnQuantity" editable="false" prefWidth="80.6666259765625" resizable="false" sortable="false" text="Anzahl" />
</columns>
</TreeTableView>
<GridPane gridLinesVisible="true" layoutX="430.0" layoutY="15.0" prefHeight="670.0" prefWidth="920.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<JFXButton fx:id="gridButton04" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton04Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton05" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton05Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton03" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton03Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton02" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton02Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton01" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton01Action" prefHeight="134.0" prefWidth="179.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton10" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton10Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton09" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton09Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton08" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton08Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton07" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton07Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton06" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton06Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="1">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton15" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton15Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton14" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton14Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton13" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton13Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton12" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton12Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton11" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton11Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="2">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton20" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton20Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton19" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton19Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton18" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton18Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton17" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton17Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton16" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton16Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="3">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton25" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton25Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton23" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton23Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="2" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton22" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton22Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="3" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton21" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton21Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="4" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
<JFXButton fx:id="gridButton24" buttonType="RAISED" maxWidth="235.0" minWidth="179.0" onAction="#gridButton24Action" prefHeight="169.0" prefWidth="235.0" ripplerFill="#655252" text="leer 0,00€" textAlignment="CENTER" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="4">
<font>
<Font name="Cantarell Regular" size="24.0" />
</font>
</JFXButton>
</children>
</GridPane>
<Button fx:id="btnPrintBill" contentDisplay="CENTER" defaultButton="true" graphicTextGap="1.0" layoutX="75.0" layoutY="599.0" maxHeight="88.0" minHeight="75.0" mnemonicParsing="false" onAction="#btnPrintBillAction" prefHeight="88.0" prefWidth="258.0" text="Drucken" wrapText="true">
<font>
<Font name="Cantarell Bold" size="48.0" />
</font>
</Button>
<Button fx:id="btnDeleteSelectedPosition" layoutX="43.0" layoutY="475.0" mnemonicParsing="false" onAction="#btnDeleteSelectedPositionAction" prefHeight="17.0" prefWidth="332.0" text="Ausgewählte Position löschen" textAlignment="CENTER">
<font>
<Font name="Cantarell Regular" size="20.0" />
</font>
</Button>
<Label fx:id="labelAllPrize" alignment="CENTER" contentDisplay="CENTER" layoutX="10.0" layoutY="505.0" prefHeight="15.0" prefWidth="386.0" text="0,00 €" textAlignment="CENTER">
<font>
<Font name="Open Sans" size="70.0" />
</font>
</Label>
<Label fx:id="labelJobCounter" alignment="TOP_RIGHT" contentDisplay="CENTER" layoutX="5.0" layoutY="45.0" prefHeight="34.0" prefWidth="392.0" text="Auftragsnummer: 0" textAlignment="CENTER">
<font>
<Font name="Cantarell Regular" size="26.0" />
</font>
</Label>
<Label fx:id="labelTime" alignment="TOP_RIGHT" layoutX="7.0" layoutY="11.0" maxHeight="33.0" maxWidth="392.0" minHeight="33.0" minWidth="392.0" prefHeight="33.0" prefWidth="392.0" text="Uhrzeit: 12:15">
<font>
<Font name="Cantarell Regular" size="26.0" />
</font>
</Label>
<JFXButton fx:id="btnLock" buttonType="RAISED" cancelButton="true" layoutX="1.0" layoutY="6.0" lineSpacing="2.0" onAction="#btnLockAction" prefHeight="42.0" prefWidth="180.0" ripplerFill="BLACK" text="Kasse sperren" textAlignment="CENTER" textFill="#c91c1c" textOverrun="LEADING_WORD_ELLIPSIS">
<font>
<Font name="Cantarell Regular" size="19.0" />
</font>
</JFXButton>
<Line endX="800.0" layoutX="62.0" layoutY="465.0" rotate="90.0" startX="-100.0" strokeWidth="4.0" />
</children>
</AnchorPane>
</content>
</Tab>
</tabs>
</TabPane>
</children>
</AnchorPane>

BIN
bin/application/MainWindowController$1.class

BIN
bin/application/MainWindowController.class

BIN
bin/application/tableData.class

BIN
bin/resources/icons/addEntry.png

Before

Width: 72  |  Height: 72  |  Size: 577 B

8
build.fxbuild

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="ASCII"?>
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build">
<deploy>
<application name="FxPWMaster01"/>
<info/>
</deploy>
<signjar/>
</anttasks:AntTask>

101
pom.xml

@ -0,0 +1,101 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>jFxKasse</artifactId>
<version>0.3.2</version>
<name>jFxKasse</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>9.0.8</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.23.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
<!--<release>11</release> -->
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.jFxKasse.application.Main</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<finalName>jFxKasse</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.jFxKasse.application.JavaFX11Main</mainClass>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

BIN
screenshots/jobs

After

Width: 1374  |  Height: 765  |  Size: 123 KiB

BIN
screenshots/newjob

After

Width: 1374  |  Height: 765  |  Size: 128 KiB

BIN
screenshots/positions

After

Width: 1374  |  Height: 765  |  Size: 107 KiB

BIN
screenshots/settings

After

Width: 1374  |  Height: 765  |  Size: 83 KiB

93
src/application/Main.java

@ -1,93 +0,0 @@
package application;
import java.io.File;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.util.Duration;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
public class Main extends Application
{
private MainWindowController mwc;
private DBController dbc = new DBController(this);
private Stage primaryStage;
@Override
public void start(Stage primaryStage)
{
this.primaryStage = primaryStage;
mainWindow();
}
private void mainWindow()
{
try {
FXMLLoader loader = new FXMLLoader(
getClass().getResource("MainWindow.fxml"));
AnchorPane pane = loader.load();
primaryStage.setTitle("jFxKasse"); // Title of window
mwc = loader.getController();
mwc.setMain(this, dbc);
firstStart();
Scene scene = new Scene(pane);
scene.getStylesheets()
.add(Main.class.getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show(); // shows the stage
Timeline timeline = new Timeline(
new KeyFrame(Duration.seconds(1), ev -> {
mwc.updateTimeLabel(); // update time
}));
timeline.setCycleCount(Animation.INDEFINITE);
timeline.play();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args)
{
launch(args);
}
/**
* Checks if the config.xml is preset.
* @author hendrik
*/
private void firstStart() throws Exception
{
if (mwc.loadSettings()) {
// config.xml found, app starting normal
System.out.println("XML gefunden!");
mwc.initUI(); // Starting the UI elements
mwc.setDBLabel(); // Set databese labels
dbc.dbname = mwc.getDatabaseName(); // handover database name
dbc.connectDatabase(); // estabishing DB conection
mwc.fillTablePositionen(); // fill TreeTable 'Positionen'
mwc.fillCategory();
mwc.fillTableJobs();
mwc.loadGridButtons();
mwc.getSelectedCat(); //Load DB entries in Chois Box
mwc.createNewJob();
} else {
// config.xml NOT found, first start of app
System.out.println("keine XML gefunden!");
mwc.blockUI(true); // disable UI elements that need DB
mwc.blockUnlock();
File dir = new File(System.getProperty("user.home") + "/bin/jFxKasse");
dir.mkdir(); // Create new Subfolder
}
}
}

1
src/application/application.css

@ -1 +0,0 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */

12
src/main/java/com/jFxKasse/application/JavaFX11Main.java

@ -0,0 +1,12 @@
package com.jFxKasse.application;
import com.jFxKasse.application.Main;
public class JavaFX11Main
{
public static void main(String[] args)
{
Main.main(args);
}
}

129
src/main/java/com/jFxKasse/application/Main.java

@ -0,0 +1,129 @@
package com.jFxKasse.application;
import javafx.application.Application;
import javafx.event.EventHandler;
import java.io.File;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.util.Duration;
import com.jFxKasse.controller.MainWindowController;
import com.jFxKasse.controller.PrinterController;
import com.jFxKasse.controller.XMLController;
import com.jFxKasse.controller.DBController;
import com.jFxKasse.controller.KeyController;
import javafx.scene.Scene;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
public class Main extends Application
{
// path to config.xml and the database
public static String filepath;
private static String osName = System.getProperty("os.name");
private static String userHome = System.getProperty("user.home");
private MainWindowController mwc;
private XMLController xmlc = new XMLController(filepath);
private DBController dbc = new DBController(filepath);
private PrinterController pc = new PrinterController();
private KeyController kc;
private Stage primaryStage;
@Override
public void start(Stage primaryStage)
{
this.primaryStage = primaryStage;
System.out.println("\nstarting jFxKasse\n");
mainWindow();
}
private void mainWindow()
{
try {
FXMLLoader loader = new FXMLLoader(
getClass().getResource("/fxml/MainWindow.fxml"));
AnchorPane pane = loader.load();
primaryStage.setTitle("jFxKasse"); // Title of window
mwc = loader.getController(); // set the mwc as the JavaFx
// MainWindowController
pc.searchPrinters(); // search for available printers
mwc.setMain(this, dbc, xmlc, pc); // set the created instances to the
// mwc
firstStart(); // test if this is the first run
Scene scene = new Scene(pane);
scene.getStylesheets().add(
Main.class.getResource("/css/application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show(); // shows the stage
//attach the KeyController
kc = new KeyController(scene, mwc);
Timeline timeline = new Timeline(
new KeyFrame(Duration.seconds(1), ev -> {
mwc.updateTimeLabel(); // update time label on UI
}));
timeline.setCycleCount(Animation.INDEFINITE);
timeline.play();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args)
{
if (osName.contains("Windows")) {
System.out.println("FCK Windows");
filepath = userHome + "/Documents/jFxKasse/";
} else {
filepath = userHome + "/jFxKasse/";
}
launch(args);
}
/**
* Checks if the config.xml is preset.
*/
private void firstStart() throws Exception
{
if (xmlc.loadSettings()) {
// config.xml found, app starting normal
System.out.println("XML found!");
mwc.initUI(); // Starting the UI elements
mwc.setDBLabel(); // Set database labels
dbc.setDbname(xmlc.getDatabaseName()); // handover database name
dbc.connectDatabase(); // estabishing DB conection
mwc.fillTablePositionen(); // fill TreeTable 'Positionen'
mwc.fillCategory();
mwc.fillPrinterSettings();
mwc.fillTableJobs();
mwc.loadGridButtons();
mwc.getSelectedCat(); // Load DB entries in Chois Box
mwc.createNewJob();
} else {
// config.xml NOT found, first start of app
System.out.println("no XML found!");
xmlc.initXML(); // set default values
mwc.blockUI(true); // disable UI elements that need DB
mwc.blockUnlock();
File dir = new File(filepath);
dir.mkdir(); // Create new Subfolder
}
}
}

98
src/main/java/com/jFxKasse/application/PrintJob.java

@ -0,0 +1,98 @@
package com.jFxKasse.application;
import java.util.ArrayList;
import com.jFxKasse.controller.DBController;
import com.jFxKasse.controller.PrinterController;
import com.jFxKasse.controller.XMLController;
import com.jFxKasse.datatypes.PrintDataSimple;
import com.jFxKasse.datatypes.PrintDataSplitted;
import javafx.geometry.Insets;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.util.Pair;
public class PrintJob
{
private TimeDate timedate = new TimeDate();
public void printJob(int jobID, XMLController xmlc, DBController dbc,
PrinterController pc)
{
if ((xmlc.getPrintername().equals("Drucker auswählen")
|| xmlc.getPrintername() == null)) {
// no printer selected
System.out.println("Kein Drucker eingestellt!!!");
// creates a dialog
Dialog<Pair<String, String>> dialog = new Dialog<>();
dialog.setTitle("Kein Drucker");
dialog.setHeaderText("Es ist kein Drucker einestellt.\n"
+ "In den Einstellungen einen Drucker auswählen.");
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
grid.add(new Label("Tipp:\n"
+ "Es kann ein virtueller Drucker installiert werden: \n\n"
+ "www.cups-pdf.de"), 0, 0);
dialog.getDialogPane().setContent(grid);
dialog.setResizable(true);
dialog.showAndWait();
} else {
// printer selected
pc.selectPrinter(xmlc.getPrintername());
/* Single bill or splitted */
if (xmlc.getCategorySplitted()) {
// split the bills
PrintDataSplitted pdsplitted = new PrintDataSplitted(
xmlc.getLinebreak(), xmlc.getOffsetHeader(),
xmlc.getOffsetFooter(),
timedate.getSystemTime() + " " + timedate.getSystemDate(),
xmlc.getHeader(), xmlc.getFooter());
pdsplitted.setData(Integer.toString(jobID), dbc.getTime_Job(jobID),
dbc.getQuantity_Job(jobID), dbc.getName_Job(jobID),
dbc.getValue_Job(jobID), dbc.getCategory_Job(jobID),
dbc.getJobValue_Job(jobID));
System.out.println("Printing job ...");
ArrayList<String> printString = pdsplitted.getPrintStrings();
for (int i = 0; i < printString.size(); i++) {
pc.printString(printString.get(i));
}
} else {
// one single bills
PrintDataSimple pds = new PrintDataSimple(xmlc.getLinebreak(),
xmlc.getOffsetHeader(), xmlc.getOffsetFooter(),
timedate.getSystemTime() + " " + timedate.getSystemDate(),
xmlc.getHeader(), xmlc.getFooter());
pds.setData(Integer.toString(jobID), dbc.getTime_Job(jobID),
dbc.getQuantity_Job(jobID), dbc.getName_Job(jobID),
dbc.getValue_Job(jobID), dbc.getCategory_Job(jobID),
dbc.getJobValue_Job(jobID));
System.out.println("Printing job ...");
pc.printString(pds.getPrintString());
}
}
}
}

24
src/main/java/com/jFxKasse/application/TimeDate.java

@ -0,0 +1,24 @@
package com.jFxKasse.application;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class TimeDate
{
public String getSystemTime()
{
DateFormat dateFormat = new SimpleDateFormat("HH:mm");
Date date = new Date();
String time = dateFormat.format(date);
return time;
}
public String getSystemDate()
{
DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
Date date = new Date();
String dateStr = dateFormat.format(date);
return dateStr;
}
}

115
src/application/DBController.java → src/main/java/com/jFxKasse/controller/DBController.java

@ -1,4 +1,4 @@
package application;
package com.jFxKasse.controller;
import java.sql.Connection;
import java.sql.DriverManager;
@ -7,46 +7,49 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import com.jFxKasse.datatypes.tableDataJob;
import com.jFxKasse.datatypes.tableDataPositionen;
import java.io.File;
class DBController
public class DBController
{
private Connection connection;
private String DB_PATH_Linux = System.getProperty("user.home")
+ "/bin/jFxKasse/";
private String DB_PATH;
public String dbname;
@SuppressWarnings("unused")
private Main main;
private String dbname;
public void main()
{
try {
connection = DriverManager
.getConnection("jdbc:sqlite:" + DB_PATH_Linux + dbname + ".db");
.getConnection("jdbc:sqlite:" + DB_PATH + dbname + ".db");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
DBController(Main main)
public DBController(String path)
{
this.DB_PATH = path;
}
public void setDbname(String dbname)
{
this.main = main;
this.dbname = dbname;
}
public void connectDatabase()
{ // connect to database
System.out.println("Verbinde ... DB name: " + dbname);
System.out.println("Connecting... DB name: " + dbname);
try {
if (connection != null)
return;
connection = DriverManager
.getConnection("jdbc:sqlite:" + DB_PATH_Linux + dbname + ".db");
.getConnection("jdbc:sqlite:" + DB_PATH + dbname + ".db");
if (!connection.isClosed())
System.out.println("DB Datei-Verbindung erstellt");
System.out.println("DB connection established");
} catch (SQLException e) {
throw new RuntimeException(e);
}
@ -66,8 +69,8 @@ class DBController
});
}
public boolean existiertDatenbank(String pPfad)
{ // Prüft ob die Datenbank existiert
public boolean existDB(String pPfad)
{ // does the DB exists?
File varTmpDir = new File(pPfad);
if (!varTmpDir.exists()) {
return false;
@ -78,10 +81,7 @@ class DBController
public String getCategoryNameFromPositionen(int pID)
{
// System.out.println("getCategoryName: " + pID);
int catInPos = 0;
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT posid, cat FROM positionen "
@ -92,11 +92,9 @@ class DBController
e.printStackTrace();
}
if (catInPos == 6) {
return "Standard";
}
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT catid, catname FROM category "
@ -113,7 +111,7 @@ class DBController
// table Position section //
public void createTablePositionen()
{ // create table position
System.out.println("Erstelle Tabelle Positionen");
System.out.println("Creating table Positionen");
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("DROP TABLE IF EXISTS positionen;");
@ -134,7 +132,7 @@ class DBController
public void fillPositionen_Positionen(int pID, String pName, float pValue,
int pCat, String pColor)
{ // create new data in table
System.out.println("Erstelle neuen positionen eintrag");
System.out.println("Creating new positionen entry");
try {
PreparedStatement ps = connection.prepareStatement(
"INSERT INTO positionen VALUES (?, ?, ?, ?, ?);");
@ -155,7 +153,7 @@ class DBController
}
public String getName_Positionen(int pID)
{ // Gibt das Datum zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -169,7 +167,7 @@ class DBController
}
public String getValue_Positionen(int pID)
{ // Gibt das Konto zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -184,7 +182,7 @@ class DBController
}
public int getCat_Positionen(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -199,7 +197,7 @@ class DBController
}
public String getColor_Positionen(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -214,7 +212,7 @@ class DBController
}
public void setName_Positionen(int pID, String pName)
{ // Setzt das Datum
{
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE positionen SET name = '" + pName
@ -226,7 +224,7 @@ class DBController
}
public void setValue_Positionen(int pID, String pValue)
{ // Setzt das Konto
{
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE positionen SET value = '" + pValue
@ -238,7 +236,7 @@ class DBController
}
public void setCat_Positionen(int pID, int pCat)
{ // Setzt den Nutzername
{
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE positionen SET cat = '" + pCat
@ -250,7 +248,7 @@ class DBController
}
public void setColor_Positionen(int pID, String pColor)
{ // Setzt den Nutzername
{
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE positionen SET color = '" + pColor
@ -262,14 +260,13 @@ class DBController
}
public ArrayList<tableDataPositionen> ladeTabellePositionen()
{ // Gibt ein Objekt daten mit allen Einträgen der DB zurück
{
ArrayList<tableDataPositionen> daten = new ArrayList<>();
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM positionen;");
while (rs.next()) {
try {
// Entschlüsselte Daten werden als Datenobjekt gespeichert
daten.add(new tableDataPositionen(rs.getInt("posid"),
rs.getString("name"), rs.getString("value"),
rs.getString("cat"), rs.getString("color")));
@ -286,7 +283,7 @@ class DBController
}
public void ausgebenSysoPositionen()
{ // Debugging Ausgabe der kompletten Tabelle
{
System.out.println("Print positionen");
try {
Statement stmt = connection.createStatement();
@ -327,7 +324,7 @@ class DBController
}
public void setName_Category(int pID, String pName)
{ // Setzte den Namen
{
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE category SET catname = '" + pName
@ -359,7 +356,7 @@ class DBController
}
public String getName_Category(int pID)
{ // Gibt das Datum zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -375,8 +372,8 @@ class DBController
// table Jobs section //
public void erstelleTabelleJobs()
{ // Erstelle Tabelle mit Reihen
System.out.println("Erstelle Tabelle Jobs");
{ // create table jobs
System.out.println("Creating table Jobs");
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("DROP TABLE IF EXISTS jobs;");
@ -390,7 +387,6 @@ class DBController
public int getLatestJobNumber_Job()
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -402,11 +398,10 @@ class DBController
}
return 0;
}
public String getTime_Job(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -420,7 +415,7 @@ class DBController
}
public String getQuantity_Job(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -435,7 +430,7 @@ class DBController
}
public String getName_Job(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -450,7 +445,7 @@ class DBController
}
public String getValue_Job(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -465,7 +460,7 @@ class DBController
}
public String getCategory_Job(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -480,7 +475,7 @@ class DBController
}
public String getState_Job(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -494,7 +489,7 @@ class DBController
}
public String getJobValue_Job(int pID)
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -508,7 +503,7 @@ class DBController
}
public String getAllJobValue_Job()
{ // Gibt den Nutzernamen zurück
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
@ -522,8 +517,23 @@ class DBController
}
}
public String getJobCount()
{
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT count(*) AS JOBCOUNT FROM jobs WHERE state = " + '"'
+ "verbucht" + '"' + ";");
return rs.getString("JOBCOUNT");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "0";
}
}
public void setStatus_Jobs(int pID, String pStatus)
{ // Setzt das Konto
{
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE jobs SET state = '" + pStatus
@ -535,7 +545,7 @@ class DBController
}
public ArrayList<tableDataJob> loadTableJobs_Job()
{ // Gibt den Nutzernamen zurück
{
ArrayList<tableDataJob> tmp = new ArrayList<tableDataJob>();
try {
@ -545,8 +555,6 @@ class DBController
while (rs.next()) {
try {
// return rs.getString("jobvalue");
String tablePosition = rs.getString("positionen_name");
tableDataJob data = new tableDataJob(rs.getInt("jobid"),
@ -570,7 +578,6 @@ class DBController
String pPositionen_name, String pPositionen_value,
String pPositionen_cat, String pState, String pJobvalue)
{
System.out.println("Create new Job Entry");
try {
PreparedStatement ps = connection.prepareStatement(
@ -591,7 +598,5 @@ class DBController
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
}
}

227
src/main/java/com/jFxKasse/controller/KeyController.java

@ -0,0 +1,227 @@
package com.jFxKasse.controller;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
public class KeyController
{
private MainWindowController mwc;
public KeyController(Scene scene, MainWindowController mwc)
{
this.mwc = mwc;
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent keyEvent)
{
switch (mwc.getActiveTab()) {
case 0:
handleTabNewJob(keyEvent);
break;
case 1:
handleTabJobs(keyEvent);
break;
case 2:
handleTabPosEdit(keyEvent);
break;
case 3:
handleTabSettings(keyEvent);
break;
default:
}
}
});
}
private void handleTabNewJob(KeyEvent key)
{
if ((key.getCode() == KeyCode.ENTER)
&& (!mwc.btnPrintBill.isDisabled())) {
mwc.btnPrintBillAction(null);
}
if ((key.getCode() == KeyCode.ESCAPE) && (!mwc.btnLock.isDisabled())) {
mwc.btnLockAction(null);
}
if ((key.getCode() == KeyCode.DELETE)
&& (!mwc.btnDeleteSelectedPosition.isDisabled())) {
mwc.btnDeleteSelectedPositionAction(null);
}
handelGridButtons(key);
}
private void handleTabJobs(KeyEvent key)
{
if ((key.getCode() == KeyCode.ENTER)
&& (!mwc.btnReprintJob.isDisabled())) {
mwc.btnReprintJobAction(null);
}
if ((key.getCode() == KeyCode.DELETE)
&& (!mwc.btnCancelJob.isDisabled())) {
mwc.btnCancelJobAction(null);
}
if ((key.getCode() == KeyCode.S) && (!mwc.btnCalcStats.isDisabled())) {
mwc.btnCalcStatsAction(null);
}
}
private void handleTabPosEdit(KeyEvent key)
{
if ((key.getCode() == KeyCode.ENTER)
&& (!mwc.btnSaveEntry.isDisabled())) {
mwc.btnSaveEntryAction(null);
}
if ((key.getCode() == KeyCode.DELETE)
&& (!mwc.btnClearEntry.isDisabled())) {
mwc.btnClearEntryAction(null);
}
}
private void handleTabSettings(KeyEvent key)
{
if ((key.getCode() == KeyCode.ENTER)
&& (!mwc.btnSavePrinter.isDisabled())) {
mwc.btnSavePrinterAction(null);
}
if ((key.getCode() == KeyCode.ENTER) && (!mwc.btnSaveCat.isDisabled())) {
mwc.btnSaveCatAction(null);
}
if ((key.getCode() == KeyCode.ENTER)
&& (!mwc.btnCreateNewDatabase.isDisabled())) {
try {
mwc.btnCreateNewDatabaseAction(null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
void handelGridButtons(KeyEvent key)
{
switch (key.getCode()) {
case Q:
mwc.gridButton01Action(null);
break;
case W:
mwc.gridButton02Action(null);
break;
case E:
mwc.gridButton03Action(null);
break;
case R:
mwc.gridButton04Action(null);
break;
case T:
mwc.gridButton05Action(null);
break;
case Z:
mwc.gridButton06Action(null);
break;
case U:
mwc.gridButton07Action(null);
break;
case I:
mwc.gridButton08Action(null);
break;
case O:
mwc.gridButton09Action(null);
break;