Name anzeigen anstatt ID bei Angeboterstellung
parent
42453b825f
commit
df97979002
|
@ -6,9 +6,9 @@ import java.util.List;
|
||||||
|
|
||||||
public class FakturamaGUI {
|
public class FakturamaGUI {
|
||||||
private JFrame frame;
|
private JFrame frame;
|
||||||
|
private JTextArea textArea;
|
||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
private CardLayout cardLayout;
|
private CardLayout cardLayout;
|
||||||
private JTextArea textArea;
|
|
||||||
|
|
||||||
public FakturamaGUI() {
|
public FakturamaGUI() {
|
||||||
initialize();
|
initialize();
|
||||||
|
@ -18,17 +18,11 @@ public class FakturamaGUI {
|
||||||
frame = new JFrame("Fakturama");
|
frame = new JFrame("Fakturama");
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
frame.setSize(800, 600);
|
frame.setSize(800, 600);
|
||||||
|
frame.setLayout(new BorderLayout());
|
||||||
|
|
||||||
cardLayout = new CardLayout();
|
cardLayout = new CardLayout();
|
||||||
mainPanel = new JPanel(cardLayout);
|
mainPanel = new JPanel(cardLayout);
|
||||||
|
frame.add(mainPanel, BorderLayout.CENTER);
|
||||||
// Startseite
|
|
||||||
JPanel homePanel = new JPanel(new BorderLayout());
|
|
||||||
textArea = new JTextArea();
|
|
||||||
textArea.setEditable(false);
|
|
||||||
JScrollPane scrollPane = new JScrollPane(textArea);
|
|
||||||
homePanel.add(scrollPane, BorderLayout.CENTER);
|
|
||||||
mainPanel.add(homePanel, "Home");
|
|
||||||
|
|
||||||
// Menüleiste
|
// Menüleiste
|
||||||
JMenuBar menuBar = new JMenuBar();
|
JMenuBar menuBar = new JMenuBar();
|
||||||
|
@ -66,7 +60,6 @@ public class FakturamaGUI {
|
||||||
saveDataItem.addActionListener(e -> {
|
saveDataItem.addActionListener(e -> {
|
||||||
Main.saveData();
|
Main.saveData();
|
||||||
updateTextArea();
|
updateTextArea();
|
||||||
cardLayout.show(mainPanel, "Home");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
JMenuItem loadDataItem = new JMenuItem("Daten laden");
|
JMenuItem loadDataItem = new JMenuItem("Daten laden");
|
||||||
|
@ -74,20 +67,28 @@ public class FakturamaGUI {
|
||||||
loadDataItem.addActionListener(e -> {
|
loadDataItem.addActionListener(e -> {
|
||||||
Main.loadData();
|
Main.loadData();
|
||||||
updateTextArea();
|
updateTextArea();
|
||||||
cardLayout.show(mainPanel, "Home");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
JMenuItem exitItem = new JMenuItem("Beenden");
|
JMenuItem exitItem = new JMenuItem("Beenden");
|
||||||
menu.add(exitItem);
|
menu.add(exitItem);
|
||||||
exitItem.addActionListener(e -> System.exit(0));
|
exitItem.addActionListener(e -> System.exit(0));
|
||||||
|
|
||||||
frame.add(mainPanel);
|
textArea = new JTextArea();
|
||||||
|
textArea.setEditable(false);
|
||||||
|
JScrollPane scrollPane = new JScrollPane(textArea);
|
||||||
|
|
||||||
|
JPanel homePanel = new JPanel(new BorderLayout());
|
||||||
|
homePanel.add(scrollPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
mainPanel.add(homePanel, "Home");
|
||||||
|
cardLayout.show(mainPanel, "Home");
|
||||||
|
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
updateTextArea();
|
updateTextArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAddCustomerPanel() {
|
private void showAddCustomerPanel() {
|
||||||
JPanel panel = new JPanel(new GridLayout(7, 2));
|
JPanel panel = new JPanel(new GridLayout(6, 2));
|
||||||
JLabel nameLabel = new JLabel("Name:");
|
JLabel nameLabel = new JLabel("Name:");
|
||||||
JTextField nameField = new JTextField();
|
JTextField nameField = new JTextField();
|
||||||
JLabel addressLabel = new JLabel("Adresse:");
|
JLabel addressLabel = new JLabel("Adresse:");
|
||||||
|
@ -141,7 +142,7 @@ public class FakturamaGUI {
|
||||||
JLabel netPriceLabel = new JLabel("Nettopreis:");
|
JLabel netPriceLabel = new JLabel("Nettopreis:");
|
||||||
JTextField netPriceField = new JTextField();
|
JTextField netPriceField = new JTextField();
|
||||||
JLabel vatRateLabel = new JLabel("Mehrwertsteuersatz:");
|
JLabel vatRateLabel = new JLabel("Mehrwertsteuersatz:");
|
||||||
JComboBox<Double> vatRateBox = new JComboBox<>(new Double[]{7.0, 19.0});
|
JComboBox<String> vatRateBox = new JComboBox<>(new String[]{"19%", "7%"});
|
||||||
|
|
||||||
JButton addButton = new JButton("Hinzufügen");
|
JButton addButton = new JButton("Hinzufügen");
|
||||||
addButton.setBackground(new Color(144, 238, 144)); // Hellgrün
|
addButton.setBackground(new Color(144, 238, 144)); // Hellgrün
|
||||||
|
@ -149,7 +150,7 @@ public class FakturamaGUI {
|
||||||
String unit = unitField.getText();
|
String unit = unitField.getText();
|
||||||
String description = descriptionField.getText();
|
String description = descriptionField.getText();
|
||||||
double netPrice = Double.parseDouble(netPriceField.getText());
|
double netPrice = Double.parseDouble(netPriceField.getText());
|
||||||
double vatRate = (Double) vatRateBox.getSelectedItem();
|
double vatRate = vatRateBox.getSelectedIndex() == 0 ? 19.0 : 7.0;
|
||||||
Main.articles.add(new Main.Article(unit, description, netPrice, vatRate));
|
Main.articles.add(new Main.Article(unit, description, netPrice, vatRate));
|
||||||
updateTextArea();
|
updateTextArea();
|
||||||
cardLayout.show(mainPanel, "Home");
|
cardLayout.show(mainPanel, "Home");
|
||||||
|
@ -176,7 +177,7 @@ public class FakturamaGUI {
|
||||||
private void showCreateOfferPanel() {
|
private void showCreateOfferPanel() {
|
||||||
JPanel panel = new JPanel(new BorderLayout());
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
|
|
||||||
JPanel formPanel = new JPanel(new GridLayout(4, 2));
|
JPanel formPanel = new JPanel(new GridLayout(2, 2));
|
||||||
JLabel customerLabel = new JLabel("Kunde:");
|
JLabel customerLabel = new JLabel("Kunde:");
|
||||||
JComboBox<String> customerBox = new JComboBox<>();
|
JComboBox<String> customerBox = new JComboBox<>();
|
||||||
for (Main.Customer customer : Main.customers) {
|
for (Main.Customer customer : Main.customers) {
|
||||||
|
@ -229,9 +230,8 @@ public class FakturamaGUI {
|
||||||
cardLayout.show(mainPanel, "CreateOffer");
|
cardLayout.show(mainPanel, "CreateOffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void showCreateOrderConfirmationPanel() {
|
private void showCreateOrderConfirmationPanel() {
|
||||||
JPanel panel = new JPanel(new GridLayout(6, 2));
|
JPanel panel = new JPanel(new GridLayout(4, 2));
|
||||||
JLabel offerLabel = new JLabel("Angebot:");
|
JLabel offerLabel = new JLabel("Angebot:");
|
||||||
JComboBox<String> offerBox = new JComboBox<>();
|
JComboBox<String> offerBox = new JComboBox<>();
|
||||||
for (Main.Offer offer : Main.offers) {
|
for (Main.Offer offer : Main.offers) {
|
||||||
|
@ -260,8 +260,6 @@ public class FakturamaGUI {
|
||||||
panel.add(offerBox);
|
panel.add(offerBox);
|
||||||
panel.add(dateLabel);
|
panel.add(dateLabel);
|
||||||
panel.add(dateField);
|
panel.add(dateField);
|
||||||
panel.add(new JLabel());
|
|
||||||
panel.add(new JLabel());
|
|
||||||
panel.add(backButton);
|
panel.add(backButton);
|
||||||
panel.add(addButton);
|
panel.add(addButton);
|
||||||
|
|
||||||
|
@ -270,7 +268,7 @@ public class FakturamaGUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showCreateDeliveryNotePanel() {
|
private void showCreateDeliveryNotePanel() {
|
||||||
JPanel panel = new JPanel(new GridLayout(6, 2));
|
JPanel panel = new JPanel(new GridLayout(4, 2));
|
||||||
JLabel orderConfirmationLabel = new JLabel("Auftragsbestätigung:");
|
JLabel orderConfirmationLabel = new JLabel("Auftragsbestätigung:");
|
||||||
JComboBox<String> orderConfirmationBox = new JComboBox<>();
|
JComboBox<String> orderConfirmationBox = new JComboBox<>();
|
||||||
for (Main.OrderConfirmation orderConfirmation : Main.orderConfirmations) {
|
for (Main.OrderConfirmation orderConfirmation : Main.orderConfirmations) {
|
||||||
|
@ -300,8 +298,6 @@ public class FakturamaGUI {
|
||||||
panel.add(orderConfirmationBox);
|
panel.add(orderConfirmationBox);
|
||||||
panel.add(dateLabel);
|
panel.add(dateLabel);
|
||||||
panel.add(dateField);
|
panel.add(dateField);
|
||||||
panel.add(new JLabel());
|
|
||||||
panel.add(new JLabel());
|
|
||||||
panel.add(backButton);
|
panel.add(backButton);
|
||||||
panel.add(addButton);
|
panel.add(addButton);
|
||||||
|
|
||||||
|
@ -310,7 +306,7 @@ public class FakturamaGUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showCreateInvoicePanel() {
|
private void showCreateInvoicePanel() {
|
||||||
JPanel panel = new JPanel(new GridLayout(6, 2));
|
JPanel panel = new JPanel(new GridLayout(4, 2));
|
||||||
JLabel deliveryNoteLabel = new JLabel("Lieferschein:");
|
JLabel deliveryNoteLabel = new JLabel("Lieferschein:");
|
||||||
JComboBox<String> deliveryNoteBox = new JComboBox<>();
|
JComboBox<String> deliveryNoteBox = new JComboBox<>();
|
||||||
for (Main.DeliveryNote deliveryNote : Main.deliveryNotes) {
|
for (Main.DeliveryNote deliveryNote : Main.deliveryNotes) {
|
||||||
|
@ -341,8 +337,6 @@ public class FakturamaGUI {
|
||||||
panel.add(deliveryNoteBox);
|
panel.add(deliveryNoteBox);
|
||||||
panel.add(dateLabel);
|
panel.add(dateLabel);
|
||||||
panel.add(dateField);
|
panel.add(dateField);
|
||||||
panel.add(new JLabel());
|
|
||||||
panel.add(new JLabel());
|
|
||||||
panel.add(backButton);
|
panel.add(backButton);
|
||||||
panel.add(addButton);
|
panel.add(addButton);
|
||||||
|
|
||||||
|
@ -358,7 +352,7 @@ public class FakturamaGUI {
|
||||||
}
|
}
|
||||||
sb.append("\nArtikel:\n");
|
sb.append("\nArtikel:\n");
|
||||||
for (Main.Article article : Main.articles) {
|
for (Main.Article article : Main.articles) {
|
||||||
sb.append(article.id).append(": ").append(article.description).append(" - ").append(article.unit).append(" - ").append(article.netPrice).append(" € - ").append(article.vatRate).append(" %").append("\n");
|
sb.append(article.description).append(" - ").append(article.unit).append(" - ").append(article.netPrice).append(" € - ").append(article.vatRate).append(" %").append("\n");
|
||||||
}
|
}
|
||||||
sb.append("\nAngebote:\n");
|
sb.append("\nAngebote:\n");
|
||||||
for (Main.Offer offer : Main.offers) {
|
for (Main.Offer offer : Main.offers) {
|
||||||
|
|
Loading…
Reference in New Issue