add: Rechnung View

This commit is contained in:
Johannes Kantz 2023-01-31 06:01:53 +01:00
parent 2b5839f0ea
commit c981fbca19
5 changed files with 137 additions and 12 deletions

View File

@ -0,0 +1,67 @@
package com.bib.essensbestellungsverwaltung;
import javafx.fxml.FXML;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Spinner;
import javafx.scene.input.MouseEvent;
import javafx.scene.text.Text;
import java.util.Calendar;
public class InvoiceController {
@FXML
Text responseText;
@FXML
ChoiceBox monatChoiceBox;
@FXML
Spinner jahrSpinner;
@FXML
public void initialize() {
monatChoiceBox.setValue(intToMonth(Calendar.getInstance().get(Calendar.MONTH) + 1));
jahrSpinner.getValueFactory().setValue(Calendar.getInstance().get(Calendar.YEAR));
}
@FXML
void onRechnungErstellenClick(MouseEvent mouseEvent) {
responseText.setText(monatChoiceBox.getValue().toString() + jahrSpinner.getValue());
// hier rechnung erstellen
}
private int monthToInt(String month) {
return switch (month) {
case "Januar" -> 1;
case "Februar" -> 2;
case "März" -> 3;
case "April" -> 4;
case "Mai" -> 5;
case "Juni" -> 6;
case "Juli" -> 7;
case "August" -> 8;
case "September" -> 9;
case "Oktober" -> 10;
case "November" -> 11;
case "Dezember" -> 12;
default -> -1;
};
}
private String intToMonth(int month) {
return switch (month) {
case 1 -> "Januar";
case 2 -> "Februar";
case 3 -> "März";
case 4 -> "April";
case 5 -> "Mai";
case 6 -> "Juni";
case 7 -> "Juli";
case 8 -> "August";
case 9 -> "September";
case 10 -> "Oktober";
case 11 -> "November";
case 12 -> "Dezember";
default -> "";
};
}
}

View File

@ -3,11 +3,13 @@ package com.bib.essensbestellungsverwaltung;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.ContextMenuEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Background;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.Arrays;
@ -57,7 +59,9 @@ public class ParentMenuController {
}
@FXML
public void onAusloggenClick(MouseEvent mouseEvent) {
public void onAusloggenClick(MouseEvent mouseEvent) throws IOException {
Parent p = FXMLLoader.load(StartViewApplication.class.getResource("workerMenu.fxml"));
StartViewApplication.primary.getScene().setRoot(p);
}
private void changePage(String page) {

View File

@ -17,8 +17,8 @@ public class StartViewApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 950,480);
//stage = primary;
Scene scene = new Scene(fxmlLoader.load(), 1200,900);
primary = stage;
stage.setTitle("Essen Bestellung im Kindergarten");
stage.setScene(scene);
stage.show();

View File

@ -3,10 +3,12 @@ package com.bib.essensbestellungsverwaltung;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.ContextMenuEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.io.IOException;
@ -69,7 +71,9 @@ public class WorkerMenuController {
}
@FXML
public void onAusloggenClick(MouseEvent mouseEvent) {
public void onAusloggenClick(MouseEvent mouseEvent) throws IOException {
Parent p = FXMLLoader.load(StartViewApplication.class.getResource("parentMenu.fxml"));
StartViewApplication.primary.getScene().setRoot(p);
}
private void changePage(String page) {

View File

@ -1,14 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.collections.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="com.bib.essensbestellungsverwaltung.AdminController"
prefHeight="400.0" prefWidth="600.0">
</AnchorPane>
<HBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="860.0" prefWidth="850.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bib.essensbestellungsverwaltung.InvoiceController">
<children>
<VBox alignment="CENTER" prefHeight="860.0" prefWidth="500.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Abrechnung erstellen">
<font>
<Font name="System Bold" size="25.0" />
</font></Text>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="122.0" spacing="20.0">
<children>
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0">
<children>
<Label text="Jahr" />
<Spinner fx:id="jahrSpinner">
<valueFactory>
<SpinnerValueFactory.IntegerSpinnerValueFactory initialValue="2023" max="2100" min="2020" />
</valueFactory>
</Spinner>
</children>
</VBox>
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0">
<children>
<Label text="Monat" />
<ChoiceBox fx:id="monatChoiceBox" value="Januar">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Januar" />
<String fx:value="Februar" />
<String fx:value="März" />
<String fx:value="April" />
<String fx:value="Mai" />
<String fx:value="Juni" />
<String fx:value="Juli" />
<String fx:value="August" />
<String fx:value="September" />
<String fx:value="Oktober" />
<String fx:value="November" />
<String fx:value="Dezember" />
</FXCollections>
</items>
</ChoiceBox>
</children>
</VBox>
</children>
</HBox>
<Button mnemonicParsing="false" onMouseClicked="#onRechnungErstellenClick" text="Rechnung erstellen" />
<Text fx:id="responseText" strokeType="OUTSIDE" strokeWidth="0.0">
<VBox.margin>
<Insets top="100.0" />
</VBox.margin>
</Text>
</children>
</VBox>
</children>
</HBox>