Browse Source

Completed jobs TreeTable and Stats

master testing
Hendrik Schutter 3 years ago
parent
commit
8650177d86
  1. 172
      src/application/DBController.java
  2. 1
      src/application/Main.java
  3. 37
      src/application/MainWindow.fxml
  4. 260
      src/application/MainWindowController.java
  5. 82
      src/application/tableDataJob.java
  6. BIN
      src/resources/icons/addEntry.png

172
src/application/DBController.java

@ -401,20 +401,180 @@ class DBController
// e.printStackTrace();
}
System.out.println("XXXXXXXXXXX 0 XXXXXXXXXXX");
return 0;
}
public void fillJobs_Jobs(int pID, String pTime, String pPositionen_quantity, String pPositionen_name,
String pPositionen_value, String pPositionen_cat, String pState,
String pJobvalue)
public String getTime_Job(int pID)
{ // Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT jobid, time FROM jobs WHERE jobid = " + pID + ";");
return rs.getString("time");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "404";
}
}
public String getQuantity_Job(int pID)
{ // Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT jobid, positionen_quantity FROM jobs WHERE jobid = "
+ pID + ";");
return rs.getString("positionen_quantity");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "404";
}
}
public String getName_Job(int pID)
{ // Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT jobid, positionen_name FROM jobs WHERE jobid = " + pID
+ ";");
return rs.getString("positionen_name");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "404";
}
}
public String getValue_Job(int pID)
{ // Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT jobid, positionen_value FROM jobs WHERE jobid = " + pID
+ ";");
return rs.getString("positionen_value");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "404";
}
}
public String getCategory_Job(int pID)
{ // Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT jobid, positionen_cat FROM jobs WHERE jobid = " + pID
+ ";");
return rs.getString("positionen_cat");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "404";
}
}
public String getState_Job(int pID)
{ // Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT jobid, state FROM jobs WHERE jobid = " + pID + ";");
return rs.getString("state");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "404";
}
}
public String getJobValue_Job(int pID)
{ // Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT jobid, jobvalue FROM jobs WHERE jobid = " + pID + ";");
return rs.getString("jobvalue");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
return "404";
}
}
public String getAllJobValue_Job()
{ // Gibt den Nutzernamen zurück
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT state, jobvalue, SUM(jobvalue) AS ALLVALUE FROM jobs WHERE state = "
+ '"' + "verbucht" + '"' + ";");
return rs.getString("ALLVALUE");
} 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
+ "'WHERE jobid =" + pID + ";");
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
}
public ArrayList<tableDataJob> loadTableJobs_Job()
{ // Gibt den Nutzernamen zurück
ArrayList<tableDataJob> tmp = new ArrayList<tableDataJob>();
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT jobid, time, positionen_quantity, positionen_name, positionen_value, positionen_cat, state, jobvalue FROM jobs;");
while (rs.next()) {
try {
// return rs.getString("jobvalue");
String tablePosition = rs.getString("positionen_name");
tableDataJob data = new tableDataJob(rs.getInt("jobid"),
rs.getString("time"), tablePosition, rs.getString("state"),
rs.getString("jobvalue"));
tmp.add(data);
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
}
} catch (SQLException e) {
System.err.println("Couldn't handle DB-Query");
e.printStackTrace();
}
return tmp;
}
public void fillJobs_Jobs(int pID, String pTime, String pPositionen_quantity,
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("INSERT INTO jobs VALUES (?, ?, ?, ?, ?, ?, ?, ?);");
PreparedStatement ps = connection.prepareStatement(
"INSERT INTO jobs VALUES (?, ?, ?, ?, ?, ?, ?, ?);");
ps.setInt(1, pID); // primary
ps.setString(2, pTime);
ps.setString(3, pPositionen_quantity);

1
src/application/Main.java

@ -77,6 +77,7 @@ public class Main extends Application
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();

37
src/application/MainWindow.fxml

@ -113,12 +113,15 @@
<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">
<placeholder>
<Label text="" />
</placeholder>
<columns>
<TreeTableColumn fx:id="columnColor" editable="false" maxWidth="428.0" minWidth="119.333251953125" prefWidth="119.333251953125" resizable="false" sortable="false" text="Farbe" />
<TreeTableColumn fx:id="columnCat" editable="false" maxWidth="800.0" minWidth="94.0" prefWidth="300.0" resizable="false" sortable="false" text="Kategorie" />
<TreeTableColumn fx:id="columnPrize" editable="false" maxWidth="693.3333129882812" minWidth="44.33331298828125" prefWidth="140.33331298828125" resizable="false" sortable="false" text="Preis" />
<TreeTableColumn fx:id="columnPositionsEdit" editable="false" maxWidth="1581.6666870117188" minWidth="38.0" prefWidth="596.333251953125" resizable="false" sortable="false" text="Positionen" />
<TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="1218.0" minWidth="59.0" prefWidth="144.666748046875" resizable="false" sortable="false" text="Nummer" />
<TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="1218.0" minWidth="59.0" prefWidth="181.6666259765625" resizable="false" sortable="false" text="Nummer" />
</columns>
<columnResizePolicy>
<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
@ -138,7 +141,7 @@
<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:">
<Label fx:id="labelNewPosition" 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>
@ -158,13 +161,13 @@
<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:">
<Label fx:id="labelNewColor" 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="346.0" layoutY="90.0" prefHeight="25.0" prefWidth="96.0" />
<Label fx:id="lableSelectCat" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="204.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Kategorie:">
<Label fx:id="labelSelectCat" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="204.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Kategorie:">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
@ -186,15 +189,15 @@
<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">
<placeholder>
<placeholder>
<Label text="" />
</placeholder>
<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" />
<TreeTableColumn fx:id="columnJobValue" editable="false" prefWidth="111.0" resizable="false" text="Betrag" />
<TreeTableColumn fx:id="columnState" editable="false" prefWidth="101.0" resizable="false" text="Zustand" />
<TreeTableColumn fx:id="columnPositions" editable="false" prefWidth="861.0" resizable="false" sortable="false" text="Positionen" />
<TreeTableColumn fx:id="columnTime" editable="false" prefWidth="159.0" resizable="false" text="Zeit" />
<TreeTableColumn fx:id="columnJobNumber" editable="false" maxWidth="3000.0" prefWidth="110.666748046875" 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">
@ -202,21 +205,21 @@
<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">
<TitledPane fx:id="titlePaneStats" alignment="CENTER" collapsible="false" contentDisplay="CENTER" layoutX="957.0" layoutY="561.0" prefHeight="118.0" prefWidth="400.0" text="Statistik - 30.03.2018 15:15 Uhr">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="59.0" prefWidth="483.0">
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="92.0" prefWidth="414.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">
<Label fx:id="labelJobCount" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="41.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€">
<Label fx:id="labelAvgJob" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="41.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€">
<Label fx:id="labelAllValue" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="41.0" layoutY="60.0" prefHeight="34.0" prefWidth="340.0" text="Gesamt: 1088,48€">
<font>
<Font name="Cantarell Regular" size="18.0" />
</font>
@ -398,7 +401,7 @@
</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">
<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" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Cantarell Bold" size="48.0" />
</font>
@ -408,7 +411,7 @@
<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">
<Label fx:id="labelAllPrize" alignment="CENTER" contentDisplay="CENTER" layoutX="10.0" layoutY="511.0" prefHeight="15.0" prefWidth="386.0" text="0,00 €" textAlignment="CENTER">
<font>
<Font name="Cantarell Regular" size="70.0" />
</font>

260
src/application/MainWindowController.java

@ -24,7 +24,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import org.omg.CORBA.PUBLIC_MEMBER;
import com.jfoenix.controls.JFXTextField;
@ -39,6 +39,7 @@ import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.util.Pair;
public class MainWindowController
{
@ -51,9 +52,9 @@ public class MainWindowController
@FXML
private AnchorPane paneDB;
@FXML
private Tab tapPosEdit;
@FXML
private Tab tapPosEdit;
@FXML
private TreeTableView<tableDataCurrentOrder> tableCurrentOrder;
@ -84,7 +85,7 @@ public class MainWindowController
private TreeTableColumn<tableDataJob, String> columnTime;
@FXML
private TreeTableColumn<tableDataJob, String> columnJobNumber;
private TreeTableColumn<tableDataJob, Integer> columnJobNumber;
@FXML
private TreeTableColumn<tableDataJob, Integer> idSpalte02 = new TreeTableColumn<>(
@ -265,25 +266,25 @@ public class MainWindowController
private Label labelTime;
@FXML
private Label lableJobCount;
private Label labelJobCount;
@FXML
private Label labelAvgJob;
@FXML
private Label lableAllValue;
private Label labelAllValue;
@FXML
private Label lableSelectCat;
private Label labelSelectCat;
@FXML
private Label lableNewPosition;
private Label labelNewPosition;
@FXML
private Label labelNewValue;
@FXML
private Label lableNewColor;
private Label labelNewColor;
@FXML
private Label labelDBStatus;
@ -331,15 +332,17 @@ public class MainWindowController
private Job currentJob = null;
String currentOrderPosName;
private String currentOrderPosName;
private int selectedJobId;
@FXML
TreeItem<tableDataCurrentOrder> rootCurrentJob = new TreeItem<>(
new tableDataCurrentOrder("0", 0));
@FXML
TreeItem<tableDataCurrentOrder> rootJobs = new TreeItem<>(
new tableDataCurrentOrder("0", 0));
TreeItem<tableDataJob> rootJobs = new TreeItem<>(
new tableDataJob(0, "0", "0", "0", "0"));
@FXML
TreeItem<tableDataPositionen> rootPositionen = new TreeItem<>(
@ -355,7 +358,7 @@ public class MainWindowController
Dialog<Pair<String, String>> dialog = new Dialog<>();
dialog.setTitle("Über jFxKasse");
dialog.setHeaderText(
"Informationen und Lizenzen - Version 0.9.4 - Techdemo");
"Informationen und Lizenzen - Version 0.1 - Without Printer");
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
@ -366,7 +369,7 @@ public class MainWindowController
grid.add(new Label(
"Einfaches Kassensystem für kleine bis mittel große Veranstaltungen mit Bon-Drucker\n"
+ "\nUnter Lizenz GPL-3.0 abrufbar auf https://github.com/Windoofs/jFxKasse\n"
+ "\nUnter Lizenz GPL-3.0 abrufbar auf https://git.mosad.xyz/localhorst/jFxKasse\n"
+ "\nDatenbank: sqlite.org - Public Domain"
+ " \nUI Design01: eclipse.org/efxclipse/install.html - Eclipse Public License 1.0"
+ " \nUI Design02: http://www.jfoenix.com/ - Apache License 2.0"
@ -391,6 +394,13 @@ public class MainWindowController
@FXML
public void btnCreateNewDatabaseAction(ActionEvent event) throws Exception
{
if(!(tftNewDBName.getText().equals(""))) {
setDatabaseName(tftNewDBName.getText());
dbc.dbname = getDatabaseName();
dbc.connectDatabase(); // establish DB connection
@ -410,9 +420,9 @@ public class MainWindowController
initUI(); // Starting the UI elements
getSelectedCat();
createNewJob();
btnLock.setDisable(false);
btnLock.setDisable(false);
}
}
@FXML
@ -444,7 +454,27 @@ public class MainWindowController
@FXML
public void btnCalcStatsAction(ActionEvent event)
{
System.out.println("Button!");
System.out.println(dbc.getAllJobValue_Job());
if(dbc.getAllJobValue_Job() != null) {
float allValue = Float.valueOf(dbc.getAllJobValue_Job());
float avgJobValue = ((float) allValue / dbc.getLatestJobNumber_Job());
setJobStatLabel(dbc.getLatestJobNumber_Job(), avgJobValue, allValue);
}else {
setJobStatLabel(dbc.getLatestJobNumber_Job(), 0, 0);
}
titlePaneStats.setVisible(true);
}
@FXML
@ -456,7 +486,8 @@ public class MainWindowController
@FXML
public void btnCancelJobAction(ActionEvent event)
{
dbc.setStatus_Jobs(selectedJobId + 1, "storniert");
fillTableJobs();
}
@FXML
@ -520,7 +551,7 @@ public class MainWindowController
@FXML
public void btnPrintBillAction(ActionEvent event)
{
//currentJob.printJobOnConsole();
// currentJob.printJobOnConsole();
btnPrintBill.setDisable(true);
tapPosEdit.setDisable(false);
@ -539,6 +570,8 @@ public class MainWindowController
currentJob.createPosCatDBString(), "verbucht",
String.valueOf(currentJob.getJobValue()));
fillTableJobs();
currentJob = null;
createNewJob();
@ -704,10 +737,28 @@ public class MainWindowController
rootPositionen.getChildren().size());
for (int i = 0; i < dbc.ladeTabellePositionen().size(); i++) {
float fValue = Float.valueOf(dbc.ladeTabellePositionen().get(i).getValue());
String strValue = String.format("%.02f", fValue);
strValue.replace('.', ',');
tableDataPositionen helpTableData = new tableDataPositionen(
dbc.ladeTabellePositionen().get(i).getID(),
dbc.ladeTabellePositionen().get(i).getName(),
dbc.ladeTabellePositionen().get(i).getValue() + " €",
(strValue + "€")
,
dbc.getCategoryNameFromPositionen(i + 1),
getColorNames(dbc.ladeTabellePositionen().get(i).getColor()));
rootPositionen.getChildren()
@ -723,13 +774,13 @@ public class MainWindowController
}
tftNewDBName.setText(getDatabaseName());
tftKat05.setDisable(true);
titlePaneStats.setVisible(false);
btnPrintBill.setDisable(true);
btnDeleteSelectedPosition.setDisable(true);
isPrintBtnDisabled = true;
initPositionen();
initCurrentOrderTreeTableView();
initJobTreeTableView();
}
@ -793,6 +844,13 @@ public class MainWindowController
entryTreeTable.setRoot(rootPositionen);
entryTreeTable.setShowRoot(false);
entryTreeTable.setEditable(false);
columnPosnumber.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
columnPositionsEdit.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
columnPrize.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
columnCat.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
columnColor.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
ObservableList<String> color = FXCollections.observableArrayList("Rot",
"Orange", "Braun", "Weiß", "Gelb", "Gr\u00fcn", "Blau", "Indigo");
@ -834,7 +892,7 @@ public class MainWindowController
.getSelectedIndex(); // get selected item
idPositionen = columnPosnumber.getCellData(selected);
try {
try {
tftNewPosition
.setText(dbc.getName_Positionen(idPositionen));
@ -852,11 +910,7 @@ public class MainWindowController
}
});
columnPosnumber.setStyle("-fx-alignment: CENTER;");
columnPositionsEdit.setStyle("-fx-alignment: CENTER;");
columnPrize.setStyle("-fx-alignment: CENTER;");
columnCat.setStyle("-fx-alignment: CENTER;");
columnColor.setStyle("-fx-alignment: CENTER;");
tftNewValue.textProperty().addListener(new ChangeListener<String>() {
@Override
@ -1044,12 +1098,11 @@ public class MainWindowController
btnCalcStats.setDisable(pState);
btnClearEntry.setDisable(pState);
if ((!isPrintBtnDisabled) && (!pState)) {
// print was not disabled and will be enabled again
btnPrintBill.setDisable(pState);
btnDeleteSelectedPosition.setDisable(pState);
}
if (pState) {
@ -1072,13 +1125,16 @@ public class MainWindowController
catChoise.setDisable(pState);
tableCurrentOrder.setDisable(pState);
// jobsTreeTable.setDisable(pState);
jobsTreeTable.setDisable(pState);
entryTreeTable.setDisable(pState);
labelAllPrize.setVisible(!pState);
labelJobCounter.setVisible(!pState);
titlePaneStats.setVisible(!pState);
if(pState) {
titlePaneStats.setVisible(!pState);
}
titledPaneEntry.setDisable(pState);
titlePaneCat.setDisable(pState);
@ -1113,6 +1169,7 @@ public class MainWindowController
}
}
public Button getButtonByID(int pID)
{
@ -1171,6 +1228,7 @@ public class MainWindowController
return gridButton01;
}
}
private void handelGridButtons(int pID)
{
@ -1194,6 +1252,7 @@ public class MainWindowController
setJobPrizeLabel(currentJob.getJobValue());
}
private void initCurrentOrderTreeTableView()
{
@ -1231,6 +1290,93 @@ public class MainWindowController
});
}
private void initJobTreeTableView()
{
columnJobNumber
.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
columnTime.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
columnPositions
.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
columnState.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
columnJobValue
.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;");
jobsTreeTable.setRoot(rootJobs);
jobsTreeTable.setShowRoot(false);
jobsTreeTable.setEditable(false);
columnJobNumber.setCellValueFactory(cellData -> cellData.getValue()
.getValue().numberProperty().asObject());
columnTime.setCellValueFactory(
cellData -> cellData.getValue().getValue().timeProperty());
columnPositions.setCellValueFactory(
cellData -> cellData.getValue().getValue().positionProperty());
columnState.setCellValueFactory(
cellData -> cellData.getValue().getValue().statusProperty());
columnJobValue.setCellValueFactory(
cellData -> cellData.getValue().getValue().valueProperty());
jobsTreeTable.getSelectionModel().selectedItemProperty()
.addListener(new ChangeListener<Object>() {
@Override
public void changed(ObservableValue<?> observable, Object oldVal,
Object newVal)
{
selectedJobId = jobsTreeTable.getSelectionModel()
.getSelectedIndex(); // get selected item
if(dbc.getState_Job(selectedJobId+1).equals("storniert")) {
btnCancelJob.setDisable(true);
}else {
btnCancelJob.setDisable(false);
}
}
});
}
@FXML
public void fillTableJobs()
{ // loads the table in the TreeTableView
rootJobs.getChildren().remove(0, rootJobs.getChildren().size());
for (int i = 0; i < dbc.loadTableJobs_Job().size(); i++) {
float fValue = Float
.valueOf(dbc.loadTableJobs_Job().get(i).getValue());
String strValue = String.format("%.02f", fValue);
strValue.replace('.', ',');
strValue = (strValue + "€");
String strJobDescription = createJobDescription(
dbc.loadTableJobs_Job().get(i).getPosition(),
dbc.getQuantity_Job(dbc.loadTableJobs_Job().get(i).getNumber()));
tableDataJob tmp = new tableDataJob(
dbc.loadTableJobs_Job().get(i).getNumber(),
dbc.loadTableJobs_Job().get(i).getTime(), strJobDescription,
dbc.loadTableJobs_Job().get(i).getStatus(), strValue);
rootJobs.getChildren().add(new TreeItem<tableDataJob>(tmp));
}
}
public void createNewJob()
{
@ -1239,28 +1385,66 @@ public class MainWindowController
labelJobCounter.setText("Auftragsnummer: "
+ String.valueOf(dbc.getLatestJobNumber_Job() + 1));
}
private void setJobPrizeLabel(float pPrize)
private static String createJobDescription(String pNames, String pQuantities)
{
String line = pQuantities;
int size = line.length() - line.replace(";", "").length() + 1;
String[] namesArray = new String[size];
String[] quantitiesArray = new String[size];
// String str = String.valueOf(pPrize);
namesArray = pNames.split(";");
quantitiesArray = pQuantities.split(";");
String tmp = quantitiesArray[0] + "x " + namesArray[0];
for (int i = 1; i < namesArray.length; i++) {
tmp = tmp + ", " + quantitiesArray[i] + "x " + namesArray[i];
}
return tmp;
}
private void setJobPrizeLabel(float pPrize)
{
String str = String.format("%.02f", pPrize);
str.replace('.', ',');
labelAllPrize.setText(str + "€");
}
private void setJobStatLabel(int pCounter, float pAvgValue, float pAllValue)
{
labelJobCount.setText("Anzahl Aufträge: " + pCounter);
String str = String.format("%.02f", pAvgValue);
str.replace('.', ',');
labelAvgJob.setText("Durchschnittlicher Auftragswert: " + str + "€");
str = String.format("%.02f", pAllValue);
str.replace('.', ',');
labelAllValue.setText("Gesamt: " + str + "€");
titlePaneStats.setText("Statistik - " + getSystemTime() + " " + getSystemDate());
}
public void updateTimeLabel()
{
labelTime.setText("Uhrzeit: " + getSystemTime());
}
public void blockUnlock() {
public void blockUnlock()
{
btnLock.setDisable(true);
}

82
src/application/tableDataJob.java

@ -6,27 +6,62 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class tableDataJob
{
{
private final StringProperty position = new SimpleStringProperty();
private final IntegerProperty number = new SimpleIntegerProperty();
private final IntegerProperty quantity = new SimpleIntegerProperty();
private final StringProperty time = new SimpleStringProperty();
public tableDataJob(final String pPosition, final Integer pQuantity)
private final StringProperty positionen = new SimpleStringProperty();
private final StringProperty status = new SimpleStringProperty();
private final StringProperty value = new SimpleStringProperty();
public tableDataJob(final Integer pNumber, final String pTime,
final String pPositionen, final String pStatus, final String pValue)
{
this.number.set(pNumber);
this.time.set(pTime);
this.positionen.set(pPositionen);
this.status.set(pStatus);
this.value.set(pValue);
}
public IntegerProperty numberProperty()
{
this.position.set(pPosition);
this.quantity.set(pQuantity);
return number;
}
public StringProperty timeProperty()
{
return time;
}
public StringProperty positionProperty()
{
return position;
return positionen;
}
public StringProperty statusProperty()
{
return status;
}
public IntegerProperty quantityProperty()
public StringProperty valueProperty()
{
return quantity;
return value;
}
public Integer getNumber()
{
return numberProperty().get();
}
public String getTime()
{
return timeProperty().get();
}
public String getPosition()
@ -34,9 +69,24 @@ public class tableDataJob
return positionProperty().get();
}
public Integer getQuantity()
public String getStatus()
{
return statusProperty().get();
}
public String getValue()
{
return valueProperty().get();
}
public final void setNumber(int pNumber)
{
return quantityProperty().get();
numberProperty().set(pNumber);
}
public final void setTime(String pTime)
{
timeProperty().set(pTime);
}
public final void setPosition(String pPosition)
@ -44,8 +94,14 @@ public class tableDataJob
positionProperty().set(pPosition);
}
public final void setQuantity(int pQuantity)
public final void setStatus(String pStatus)
{
quantityProperty().set(pQuantity);
statusProperty().set(pStatus);
}
public final void setValue(String pValue)
{
valueProperty().set(pValue);
}
}

BIN
src/resources/icons/addEntry.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

Loading…
Cancel
Save