Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5abcbc8903 | |||
| 83ae429c65 | |||
| 4d3946d4b0 | |||
| 1fee120043 | |||
| 797e7206b3 | |||
| 05398f54af | |||
| 475c700b13 | |||
| c3d26a42f5 | |||
| 9412e23b07 | |||
| a17578398b | |||
| a42c4e1115 | |||
| c9b7db72ae | |||
| 1cdef78244 | |||
| 212738ce83 | |||
| 1179abbcd1 | |||
| 8ef0349929 | |||
| 8302e5a8ba | |||
| c818e5d31a | |||
| 8d3da0afbb | |||
| 4945afb839 | |||
| 3d73415764 | |||
| d47f7dbddb |
+1
-2
@@ -11,8 +11,7 @@ out/
|
|||||||
.idea/jarRepositories.xml
|
.idea/jarRepositories.xml
|
||||||
.idea/compiler.xml
|
.idea/compiler.xml
|
||||||
.idea/libraries/
|
.idea/libraries/
|
||||||
.idea/dataSources.xml
|
.idea/dataSources
|
||||||
.idea/db-forest-config.xml
|
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
|||||||
+5
@@ -12,5 +12,10 @@
|
|||||||
<option name="processLiterals" value="true" />
|
<option name="processLiterals" value="true" />
|
||||||
<option name="processComments" value="true" />
|
<option name="processComments" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnusedAssignment" enabled="false" level="WARNING" enabled_by_default="false">
|
||||||
|
<option name="REPORT_PREFIX_EXPRESSIONS" value="false" />
|
||||||
|
<option name="REPORT_POSTFIX_EXPRESSIONS" value="true" />
|
||||||
|
<option name="REPORT_REDUNDANT_INITIALIZER" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="fi.lpam.Main" type="Application" factoryName="Application" nameIsGenerated="true">
|
<configuration default="false" name="Main" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||||
<option name="MAIN_CLASS_NAME" value="fi.lpam.Main" />
|
<option name="MAIN_CLASS_NAME" value="fi.lpam.ruokamanageri.Main" />
|
||||||
<module name="Ruokamanageri" />
|
<module name="Ruokamanageri" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="DEV" />
|
<option name="PROGRAM_PARAMETERS" value="DEV" />
|
||||||
<extension name="coverage">
|
<extension name="coverage">
|
||||||
<pattern>
|
<pattern>
|
||||||
<option name="PATTERN" value="fi.lpam.*" />
|
<option name="PATTERN" value="fi.lpam.ruokamanageri.*" />
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
</pattern>
|
</pattern>
|
||||||
</extension>
|
</extension>
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
# 2.0.0
|
||||||
|
- Asiakkaalle lisätty tietoihin laskutusosoite ja yhteyshenkilön yhteystiedot
|
||||||
|
- Tiedot nousevat kuljetusraportille laskutusta varten
|
||||||
|
- Lisätty ohjelmaan linkki muutoslokiin
|
||||||
|
|
||||||
|
# 1.1.1
|
||||||
|
- Integroitu versionumerointi projektiin
|
||||||
|
|
||||||
# 1.1.0
|
# 1.1.0
|
||||||
- Kuljetuslistaa luodessa kuljetusrivin nollaaminen/palauttaminen oletusmääriin.
|
- Kuljetuslistaa luodessa kuljetusrivin nollaaminen/palauttaminen oletusmääriin.
|
||||||
- Kuljetuslistojen ja raporttien tulostamismekanismin läpikäynti
|
- Kuljetuslistojen ja raporttien tulostamismekanismin läpikäynti
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Pienen kotiateriapalvelun käyttöön rakennettu ohjelma sisältäen seuraavat o
|
|||||||
- Vaatimukset
|
- Vaatimukset
|
||||||
- Windows
|
- Windows
|
||||||
- Java 25+
|
- Java 25+
|
||||||
- Usean tietokoneen käyttöön OneDrive -tili
|
- Usean tietokoneen käyttöön OneDrive -tili (samanaikaisuus ei tuettu)
|
||||||
- Lataa haluamasi julkaisuversio lähdekoodista
|
- Lataa haluamasi julkaisuversio lähdekoodista
|
||||||
- Maven `package` komennolla projektista luodaan .jar tiedosto
|
- Maven `package` komennolla projektista luodaan .jar tiedosto
|
||||||
- .jar tiedosto sisältää kaikki riippuvuudet
|
- .jar tiedosto sisältää kaikki riippuvuudet
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<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 https://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>fi.lpam</groupId>
|
<groupId>fi.lpam.ruokamanageri</groupId>
|
||||||
<artifactId>Ruokamanageri</artifactId>
|
<artifactId>Ruokamanageri</artifactId>
|
||||||
<version>1.0</version>
|
<version>2.0.0</version>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>25</maven.compiler.source>
|
<maven.compiler.source>25</maven.compiler.source>
|
||||||
@@ -66,6 +66,13 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -85,7 +92,7 @@
|
|||||||
<!-- Usage: mvn clean javafx:run -->
|
<!-- Usage: mvn clean javafx:run -->
|
||||||
<id>default-cli</id>
|
<id>default-cli</id>
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>fi.lpam.Main</mainClass>
|
<mainClass>fi.lpam.ruokamanageri.Main</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
@@ -107,7 +114,7 @@
|
|||||||
<transformers>
|
<transformers>
|
||||||
<transformer implementation=
|
<transformer implementation=
|
||||||
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||||
<mainClass>fi.lpam.Main</mainClass>
|
<mainClass>fi.lpam.ruokamanageri.Main</mainClass>
|
||||||
</transformer>
|
</transformer>
|
||||||
</transformers>
|
</transformers>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package fi.lpam;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static boolean dev;
|
|
||||||
|
|
||||||
static void main(String[] args) {
|
|
||||||
//noinspection RedundantIfStatement
|
|
||||||
if (args.length > 0) {
|
|
||||||
dev = true;
|
|
||||||
} else {
|
|
||||||
dev = false;
|
|
||||||
}
|
|
||||||
App.main();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
package fi.lpam.dataluokat;
|
|
||||||
|
|
||||||
import fi.lpam.gui.virheDialogit.SiirtoVirhe;
|
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@SuppressWarnings("ClassCanBeRecord")
|
|
||||||
public class RaporttiRivi {
|
|
||||||
private final String nimi;
|
|
||||||
private final LocalDate alkuPvm, loppuPvm;
|
|
||||||
private final int salaatit, pääruoat, jälkiruoat;
|
|
||||||
private final String lisätiedot;
|
|
||||||
|
|
||||||
public RaporttiRivi(String nimi, LocalDate alkuPvm, LocalDate loppuPvm, int salaatit, int pääruoat, int jälkiruoat, String lisätiedot) {
|
|
||||||
this.nimi = nimi;
|
|
||||||
this.alkuPvm = alkuPvm;
|
|
||||||
this.loppuPvm = loppuPvm;
|
|
||||||
this.salaatit = salaatit;
|
|
||||||
this.pääruoat = pääruoat;
|
|
||||||
this.jälkiruoat = jälkiruoat;
|
|
||||||
this.lisätiedot = lisätiedot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<RaporttiRivi> haeRaportti(LocalDate alkuPvm, LocalDate loppuPvm, boolean tarkka) {
|
|
||||||
ArrayList<RaporttiRivi> raportti = new ArrayList<>();
|
|
||||||
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
|
||||||
ResultSet rs;
|
|
||||||
if (tarkka) {
|
|
||||||
//Jokainen kuljetus saa oman rivin
|
|
||||||
PreparedStatement stmt = tietokanta.prepareStatement("select nimi, kuljetusPäivämäärä, salaatit, pääruoat, jälkiruoat, lisätieto from kuljetukset where kuljetusPäivämäärä between ? and ? order by nimi");
|
|
||||||
stmt.setDate(1, Date.valueOf(alkuPvm));
|
|
||||||
stmt.setDate(2, Date.valueOf(loppuPvm));
|
|
||||||
rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
RaporttiRivi uusi = new RaporttiRivi(
|
|
||||||
rs.getString(1),
|
|
||||||
rs.getDate(2).toLocalDate(),
|
|
||||||
rs.getDate(2).toLocalDate(),
|
|
||||||
rs.getInt(3),
|
|
||||||
rs.getInt(4),
|
|
||||||
rs.getInt(5),
|
|
||||||
rs.getString(6)
|
|
||||||
);
|
|
||||||
raportti.add(uusi);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//Kuljetukset summataan yhteen riviin per vastaanottaja
|
|
||||||
PreparedStatement stmt = tietokanta.prepareStatement("select nimi, kuljetusPäivämäärä, sum(salaatit), sum(pääruoat), sum(jälkiruoat), group_concat(lisätieto, '\n') from kuljetukset where kuljetusPäivämäärä between ? and ? group by nimi order by nimi;");
|
|
||||||
stmt.setDate(1, Date.valueOf(alkuPvm));
|
|
||||||
stmt.setDate(2, Date.valueOf(loppuPvm));
|
|
||||||
rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
RaporttiRivi uusi = new RaporttiRivi(
|
|
||||||
rs.getString(1),
|
|
||||||
alkuPvm,
|
|
||||||
loppuPvm,
|
|
||||||
rs.getInt(3),
|
|
||||||
rs.getInt(4),
|
|
||||||
rs.getInt(5),
|
|
||||||
rs.getString(6)
|
|
||||||
);
|
|
||||||
raportti.add(uusi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
SiirtoVirhe virhe = new SiirtoVirhe(e);
|
|
||||||
virhe.showAndWait();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return raportti;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.nimi + ":\nSal: " + this.salaatit + ", Pr: " + this.pääruoat + ", Jr: " + this.jälkiruoat + "\nLisätiedot:\n" + this.lisätiedot.strip();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNimi() {
|
|
||||||
return nimi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getAlkuPvm() {
|
|
||||||
return alkuPvm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getLoppuPvm() {
|
|
||||||
return loppuPvm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSalaatit() {
|
|
||||||
return salaatit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPääruoat() {
|
|
||||||
return pääruoat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getJälkiruoat() {
|
|
||||||
return jälkiruoat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLisätiedot() {
|
|
||||||
return lisätiedot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
package fi.lpam.dataluokat;
|
|
||||||
|
|
||||||
import fi.lpam.gui.virheDialogit.SiirtoVirhe;
|
|
||||||
import fi.lpam.gui.virheDialogit.YhteysVirhe;
|
|
||||||
|
|
||||||
import fi.lpam.Main;
|
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class Tietokanta {
|
|
||||||
private static String osoite;
|
|
||||||
private static String dbPath = SystemUtils.getUserHome().getAbsolutePath() + "\\OneDrive\\Kuljetusruokasovellus\\tietokanta.db";
|
|
||||||
|
|
||||||
public Tietokanta(boolean dev) throws IOException {
|
|
||||||
if (dev) dbPath = "testikanta.db";
|
|
||||||
File file = new File(dbPath);
|
|
||||||
try {
|
|
||||||
//noinspection ResultOfMethodCallIgnored
|
|
||||||
file.getParentFile().mkdirs();
|
|
||||||
}
|
|
||||||
catch (Exception _) {}
|
|
||||||
//noinspection ResultOfMethodCallIgnored
|
|
||||||
file.createNewFile();
|
|
||||||
|
|
||||||
osoite = "jdbc:sqlite:" + file.getAbsolutePath();
|
|
||||||
|
|
||||||
|
|
||||||
try (Connection conn = haeYhteys()) {
|
|
||||||
InputStream is = Objects.requireNonNull(Main.class.getResourceAsStream("tietokanta.sql"));
|
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
|
||||||
String sql = br.readAllAsString();
|
|
||||||
|
|
||||||
for (String query : sql.split(";")) {
|
|
||||||
conn.createStatement().execute(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
SiirtoVirhe virhe = new SiirtoVirhe(e);
|
|
||||||
virhe.showAndWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Connection haeYhteys() {
|
|
||||||
|
|
||||||
Connection connection = null;
|
|
||||||
try {
|
|
||||||
connection = DriverManager.getConnection(osoite);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Alert virhe = new YhteysVirhe(e);
|
|
||||||
virhe.showAndWait();
|
|
||||||
}
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package fi.lpam;
|
package fi.lpam.ruokamanageri;
|
||||||
import fi.lpam.dataluokat.Tietokanta;
|
import fi.lpam.ruokamanageri.dataluokat.Tietokanta;
|
||||||
import fi.lpam.gui.Asiakashallinta;
|
import fi.lpam.ruokamanageri.gui.Asiakashallinta;
|
||||||
import fi.lpam.gui.Kierroshallinta;
|
import fi.lpam.ruokamanageri.gui.Kierroshallinta;
|
||||||
import fi.lpam.gui.KuljetusRaportit;
|
import fi.lpam.ruokamanageri.gui.KuljetusRaportit;
|
||||||
import fi.lpam.gui.KuljetusListat;
|
import fi.lpam.ruokamanageri.gui.KuljetusListat;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.geometry.Side;
|
import javafx.geometry.Side;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
@@ -12,7 +12,6 @@ import javafx.scene.control.TabPane;
|
|||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@SuppressWarnings("InstantiationOfUtilityClass")
|
@SuppressWarnings("InstantiationOfUtilityClass")
|
||||||
@@ -22,8 +21,9 @@ public class App extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws IOException {
|
public void start(Stage primaryStage) {
|
||||||
new Tietokanta(Main.dev);
|
new Tietokanta(Main.dev);
|
||||||
|
|
||||||
TabPane root = new TabPane();
|
TabPane root = new TabPane();
|
||||||
root.setSide(Side.LEFT);
|
root.setSide(Side.LEFT);
|
||||||
root.setTabMinWidth(50);
|
root.setTabMinWidth(50);
|
||||||
@@ -37,7 +37,7 @@ public class App extends Application {
|
|||||||
kuljetetut = new Tab("Kuljetetut");
|
kuljetetut = new Tab("Kuljetetut");
|
||||||
root.getTabs().addAll(asiakasHallinta, kierrostenHallinta, kuljetusListat, kuljetetut);
|
root.getTabs().addAll(asiakasHallinta, kierrostenHallinta, kuljetusListat, kuljetetut);
|
||||||
|
|
||||||
root.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
root.getSelectionModel().selectedItemProperty().addListener((_, _, newValue) -> {
|
||||||
switch (newValue.getText()) {
|
switch (newValue.getText()) {
|
||||||
case "Asiakashallinta": newValue.setContent(new Asiakashallinta()); break;
|
case "Asiakashallinta": newValue.setContent(new Asiakashallinta()); break;
|
||||||
case "Kierrostenhallinta": newValue.setContent(new Kierroshallinta()); break;
|
case "Kierrostenhallinta": newValue.setContent(new Kierroshallinta()); break;
|
||||||
@@ -53,9 +53,15 @@ public class App extends Application {
|
|||||||
|
|
||||||
Scene scene = new Scene(root);
|
Scene scene = new Scene(root);
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
primaryStage.setTitle("Ruokamanageri");
|
|
||||||
|
StringBuilder title = new StringBuilder();
|
||||||
|
title.append("Ruokamanageri");
|
||||||
|
title.append(" v").append(Main.properties.getProperty("version"));
|
||||||
|
if (Main.dev) title.append(" KEHITYS");
|
||||||
|
primaryStage.setTitle(title.toString());
|
||||||
|
|
||||||
primaryStage.setMaximized(true);
|
primaryStage.setMaximized(true);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
primaryStage.getIcons().add(new Image(Objects.requireNonNull(Main.class.getResourceAsStream("kuljetusruokalaatikko.jpg"))));
|
primaryStage.getIcons().add(new Image(Objects.requireNonNull(Main.class.getClassLoader().getResourceAsStream("kuljetusruokalaatikko.jpg"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package fi.lpam.ruokamanageri;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static boolean dev;
|
||||||
|
public static Properties properties;
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
//noinspection RedundantIfStatement
|
||||||
|
if (args.length > 0) {
|
||||||
|
dev = true;
|
||||||
|
} else {
|
||||||
|
dev = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
properties = new Properties();
|
||||||
|
properties.load(Main.class.getClassLoader().getResourceAsStream("app.properties"));
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
App.main();
|
||||||
|
}
|
||||||
|
}
|
||||||
+121
-78
@@ -1,10 +1,9 @@
|
|||||||
package fi.lpam.dataluokat;
|
package fi.lpam.ruokamanageri.dataluokat;
|
||||||
|
|
||||||
import fi.lpam.gui.virheDialogit.SiirtoVirhe;
|
import fi.lpam.ruokamanageri.gui.virheDialogit.SiirtoVirhe;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@SuppressWarnings("DuplicatedCode")
|
@SuppressWarnings("DuplicatedCode")
|
||||||
public class Asiakas implements TietokantaOlio {
|
public class Asiakas implements TietokantaOlio {
|
||||||
private int id = -1;
|
private int id = -1;
|
||||||
@@ -15,6 +14,7 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
private String erityisruokavalio;
|
private String erityisruokavalio;
|
||||||
private String avainTieto;
|
private String avainTieto;
|
||||||
private String lisätiedot;
|
private String lisätiedot;
|
||||||
|
private String laskutusOsoite, yhteyshenkilönNimi, yhteyshenkilönPuhelinnumero, yhteyshenkilönSähköposti;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tyhjä konstruktori uusien luomista varten
|
* Tyhjä konstruktori uusien luomista varten
|
||||||
@@ -46,8 +46,29 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
* @param erityisruokavalio ...
|
* @param erityisruokavalio ...
|
||||||
* @param avainTieto ...
|
* @param avainTieto ...
|
||||||
* @param lisätiedot mahdolliset lisätilaukset/tiedot
|
* @param lisätiedot mahdolliset lisätilaukset/tiedot
|
||||||
|
* @param laskutusOsoite ...
|
||||||
|
* @param yhteyshenkilönNimi ...
|
||||||
|
* @param yhteyshenkilönPuhelinnumero ...
|
||||||
|
* @param yhteyshenkilönSähköposti ...
|
||||||
*/
|
*/
|
||||||
private Asiakas(int id, String nimi, String osoite, int maanantaiKpl, int tiistaiKpl, int keskiviikkoKpl, int torstaiKpl, int perjantaiKpl, int salaatit, int pääruoat, int jälkiruoat, String erityisruokavalio, String avainTieto, String lisätiedot) {
|
private Asiakas(int id,
|
||||||
|
String nimi,
|
||||||
|
String osoite,
|
||||||
|
int maanantaiKpl,
|
||||||
|
int tiistaiKpl,
|
||||||
|
int keskiviikkoKpl,
|
||||||
|
int torstaiKpl,
|
||||||
|
int perjantaiKpl,
|
||||||
|
int salaatit,
|
||||||
|
int pääruoat,
|
||||||
|
int jälkiruoat,
|
||||||
|
String erityisruokavalio,
|
||||||
|
String avainTieto,
|
||||||
|
String lisätiedot,
|
||||||
|
String laskutusOsoite,
|
||||||
|
String yhteyshenkilönNimi,
|
||||||
|
String yhteyshenkilönPuhelinnumero,
|
||||||
|
String yhteyshenkilönSähköposti) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.nimi = nimi;
|
this.nimi = nimi;
|
||||||
this.osoite = osoite;
|
this.osoite = osoite;
|
||||||
@@ -62,37 +83,10 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
this.erityisruokavalio = erityisruokavalio;
|
this.erityisruokavalio = erityisruokavalio;
|
||||||
this.avainTieto = avainTieto;
|
this.avainTieto = avainTieto;
|
||||||
this.lisätiedot = lisätiedot;
|
this.lisätiedot = lisätiedot;
|
||||||
}
|
this.laskutusOsoite = laskutusOsoite;
|
||||||
|
this.yhteyshenkilönNimi = yhteyshenkilönNimi;
|
||||||
/**
|
this.yhteyshenkilönPuhelinnumero = yhteyshenkilönPuhelinnumero;
|
||||||
* @param nimi asiakkaan nimi
|
this.yhteyshenkilönSähköposti = yhteyshenkilönSähköposti;
|
||||||
* @param osoite osoite
|
|
||||||
* @param maanantaiKpl kuljetettava määrä
|
|
||||||
* @param tiistaiKpl kuljetettava määrä
|
|
||||||
* @param keskiviikkoKpl kuljetettava määrä
|
|
||||||
* @param torstaiKpl kuljetettava määrä
|
|
||||||
* @param perjantaiKpl kuljetettava määrä
|
|
||||||
* @param salaatit kuljetettava määrä
|
|
||||||
* @param pääruoat kuljetettava määrä
|
|
||||||
* @param jälkiruoat kuljetettava määrä
|
|
||||||
* @param erityisruokavalio ...
|
|
||||||
* @param avainTieto ...
|
|
||||||
* @param lisätiedot mahdolliset lisätilaukset/tiedot
|
|
||||||
*/
|
|
||||||
public Asiakas(String nimi, String osoite, int maanantaiKpl, int tiistaiKpl, int keskiviikkoKpl, int torstaiKpl, int perjantaiKpl, int salaatit, int pääruoat, int jälkiruoat, String erityisruokavalio, String avainTieto, String lisätiedot) {
|
|
||||||
this.nimi = nimi;
|
|
||||||
this.osoite = osoite;
|
|
||||||
this.maanantaiKpl = maanantaiKpl;
|
|
||||||
this.tiistaiKpl = tiistaiKpl;
|
|
||||||
this.keskiviikkoKpl = keskiviikkoKpl;
|
|
||||||
this.torstaiKpl = torstaiKpl;
|
|
||||||
this.perjantaiKpl = perjantaiKpl;
|
|
||||||
this.salaatit = salaatit;
|
|
||||||
this.pääruoat = pääruoat;
|
|
||||||
this.jälkiruoat = jälkiruoat;
|
|
||||||
this.erityisruokavalio = erityisruokavalio;
|
|
||||||
this.avainTieto = avainTieto;
|
|
||||||
this.lisätiedot = lisätiedot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,21 +139,26 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
int i = 1;
|
||||||
Asiakas uusi = new Asiakas(
|
Asiakas uusi = new Asiakas(
|
||||||
rs.getInt("id"),
|
rs.getInt(i++),
|
||||||
rs.getString("nimi"),
|
rs.getString(i++),
|
||||||
rs.getString("osoite"),
|
rs.getString(i++),
|
||||||
rs.getInt("maanantaiKpl"),
|
rs.getInt(i++),
|
||||||
rs.getInt("tiistaiKpl"),
|
rs.getInt(i++),
|
||||||
rs.getInt("keskiviikkoKpl"),
|
rs.getInt(i++),
|
||||||
rs.getInt("torstaiKpl"),
|
rs.getInt(i++),
|
||||||
rs.getInt("perjantaiKpl"),
|
rs.getInt(i++),
|
||||||
rs.getInt("salaatit"),
|
rs.getInt(i++),
|
||||||
rs.getInt("pääruoat"),
|
rs.getInt(i++),
|
||||||
rs.getInt("jälkiruoat"),
|
rs.getInt(i++),
|
||||||
rs.getString("erityisruokavalio"),
|
rs.getString(i++),
|
||||||
rs.getString("avainTieto"),
|
rs.getString(i++),
|
||||||
rs.getString("lisätiedot")
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++)
|
||||||
);
|
);
|
||||||
asiakkaat.add(uusi);
|
asiakkaat.add(uusi);
|
||||||
}
|
}
|
||||||
@@ -178,20 +177,26 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
@Override
|
@Override
|
||||||
public boolean tallennaUusi() {
|
public boolean tallennaUusi() {
|
||||||
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
||||||
PreparedStatement stmt = tietokanta.prepareStatement("INSERT INTO asiakkaat (nimi, osoite, maanantaiKpl, tiistaiKpl, keskiviikkoKpl, torstaiKpl, perjantaiKpl, salaatit, pääruoat, jälkiruoat, erityisruokavalio, avainTieto, lisätiedot) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
PreparedStatement stmt = tietokanta.prepareStatement("INSERT INTO asiakkaat (nimi, osoite, maanantaiKpl, tiistaiKpl, keskiviikkoKpl, torstaiKpl, perjantaiKpl, salaatit, pääruoat, jälkiruoat, erityisruokavalio, avainTieto, lisätiedot, laskutusosoite, yhteyshenkilönNimi, yhteyshenkilönPuhelinnumero, yhteyshenkilönSähköposti) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
||||||
stmt.setString(1, nimi);
|
int i = 1;
|
||||||
stmt.setString(2, osoite);
|
stmt.setString(i++, nimi);
|
||||||
stmt.setInt(3, maanantaiKpl);
|
stmt.setString(i++, osoite);
|
||||||
stmt.setInt(4, tiistaiKpl);
|
stmt.setInt(i++, maanantaiKpl);
|
||||||
stmt.setInt(5, keskiviikkoKpl);
|
stmt.setInt(i++, tiistaiKpl);
|
||||||
stmt.setInt(6, torstaiKpl);
|
stmt.setInt(i++, keskiviikkoKpl);
|
||||||
stmt.setInt(7, perjantaiKpl);
|
stmt.setInt(i++, torstaiKpl);
|
||||||
stmt.setInt(8, salaatit);
|
stmt.setInt(i++, perjantaiKpl);
|
||||||
stmt.setInt(9, pääruoat);
|
stmt.setInt(i++, salaatit);
|
||||||
stmt.setInt(10, jälkiruoat);
|
stmt.setInt(i++, pääruoat);
|
||||||
stmt.setString(11, erityisruokavalio);
|
stmt.setInt(i++, jälkiruoat);
|
||||||
stmt.setString(12, avainTieto);
|
stmt.setString(i++, erityisruokavalio);
|
||||||
stmt.setString(13, lisätiedot);
|
stmt.setString(i++, avainTieto);
|
||||||
|
stmt.setString(i++, lisätiedot);
|
||||||
|
stmt.setString(i++, laskutusOsoite);
|
||||||
|
stmt.setString(i++, yhteyshenkilönNimi);
|
||||||
|
stmt.setString(i++, yhteyshenkilönPuhelinnumero);
|
||||||
|
stmt.setString(i++, yhteyshenkilönSähköposti);
|
||||||
|
|
||||||
int muokatutRivit = stmt.executeUpdate();
|
int muokatutRivit = stmt.executeUpdate();
|
||||||
|
|
||||||
if (muokatutRivit == 0) {
|
if (muokatutRivit == 0) {
|
||||||
@@ -219,21 +224,27 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
@Override
|
@Override
|
||||||
public boolean päivitäTietokantaan() {
|
public boolean päivitäTietokantaan() {
|
||||||
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
||||||
PreparedStatement stmt = tietokanta.prepareStatement("UPDATE asiakkaat set nimi = ?, osoite = ?, maanantaiKpl = ?, tiistaiKpl = ?, keskiviikkoKpl = ?, torstaiKpl = ?, perjantaiKpl = ?, salaatit = ?, pääruoat = ?, jälkiruoat = ?, erityisruokavalio = ?, avainTieto = ?, lisätiedot = ? WHERE id = ?");
|
PreparedStatement stmt = tietokanta.prepareStatement("UPDATE asiakkaat set nimi = ?, osoite = ?, maanantaiKpl = ?, tiistaiKpl = ?, keskiviikkoKpl = ?, torstaiKpl = ?, perjantaiKpl = ?, salaatit = ?, pääruoat = ?, jälkiruoat = ?, erityisruokavalio = ?, avainTieto = ?, lisätiedot = ?, laskutusosoite = ?, yhteyshenkilönNimi = ?, yhteyshenkilönPuhelinnumero = ?, yhteyshenkilönSähköposti = ? WHERE id = ?");
|
||||||
stmt.setString(1, nimi);
|
int i = 1;
|
||||||
stmt.setString(2, osoite);
|
stmt.setString(i++, nimi);
|
||||||
stmt.setInt(3, maanantaiKpl);
|
stmt.setString(i++, osoite);
|
||||||
stmt.setInt(4, tiistaiKpl);
|
stmt.setInt(i++, maanantaiKpl);
|
||||||
stmt.setInt(5, keskiviikkoKpl);
|
stmt.setInt(i++, tiistaiKpl);
|
||||||
stmt.setInt(6, torstaiKpl);
|
stmt.setInt(i++, keskiviikkoKpl);
|
||||||
stmt.setInt(7, perjantaiKpl);
|
stmt.setInt(i++, torstaiKpl);
|
||||||
stmt.setInt(8, salaatit);
|
stmt.setInt(i++, perjantaiKpl);
|
||||||
stmt.setInt(9, pääruoat);
|
stmt.setInt(i++, salaatit);
|
||||||
stmt.setInt(10, jälkiruoat);
|
stmt.setInt(i++, pääruoat);
|
||||||
stmt.setString(11, erityisruokavalio);
|
stmt.setInt(i++, jälkiruoat);
|
||||||
stmt.setString(12, avainTieto);
|
stmt.setString(i++, erityisruokavalio);
|
||||||
stmt.setString(13, lisätiedot);
|
stmt.setString(i++, avainTieto);
|
||||||
stmt.setInt(14, id);
|
stmt.setString(i++, lisätiedot);
|
||||||
|
stmt.setString(i++, laskutusOsoite);
|
||||||
|
stmt.setString(i++, yhteyshenkilönNimi);
|
||||||
|
stmt.setString(i++, yhteyshenkilönPuhelinnumero);
|
||||||
|
stmt.setString(i++, yhteyshenkilönSähköposti);
|
||||||
|
|
||||||
|
stmt.setInt(i++, id);
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
return true;
|
return true;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -388,4 +399,36 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
public void setLisätiedot(String lisätiedot) {
|
public void setLisätiedot(String lisätiedot) {
|
||||||
this.lisätiedot = lisätiedot;
|
this.lisätiedot = lisätiedot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLaskutusOsoite() {
|
||||||
|
return laskutusOsoite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLaskutusOsoite(String laskutusOsoite) {
|
||||||
|
this.laskutusOsoite = laskutusOsoite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYhteyshenkilönNimi() {
|
||||||
|
return yhteyshenkilönNimi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYhteyshenkilönNimi(String yhteyshenkilönNimi) {
|
||||||
|
this.yhteyshenkilönNimi = yhteyshenkilönNimi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYhteyshenkilönPuhelinnumero() {
|
||||||
|
return yhteyshenkilönPuhelinnumero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYhteyshenkilönPuhelinnumero(String yhteyshenkilönPuhelinnumero) {
|
||||||
|
this.yhteyshenkilönPuhelinnumero = yhteyshenkilönPuhelinnumero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYhteyshenkilönSähköposti() {
|
||||||
|
return yhteyshenkilönSähköposti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYhteyshenkilönSähköposti(String yhteyshenkilönSähköposti) {
|
||||||
|
this.yhteyshenkilönSähköposti = yhteyshenkilönSähköposti;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package fi.lpam.dataluokat;
|
package fi.lpam.ruokamanageri.dataluokat;
|
||||||
|
|
||||||
import fi.lpam.gui.virheDialogit.SiirtoVirhe;
|
import fi.lpam.ruokamanageri.gui.virheDialogit.SiirtoVirhe;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package fi.lpam.dataluokat;
|
package fi.lpam.ruokamanageri.dataluokat;
|
||||||
|
|
||||||
import fi.lpam.gui.virheDialogit.SiirtoVirhe;
|
import fi.lpam.ruokamanageri.gui.virheDialogit.SiirtoVirhe;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package fi.lpam.ruokamanageri.dataluokat;
|
||||||
|
|
||||||
|
import fi.lpam.ruokamanageri.gui.virheDialogit.SiirtoVirhe;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@SuppressWarnings({"ClassCanBeRecord", "DuplicatedCode"})
|
||||||
|
public class RaporttiRivi {
|
||||||
|
private final String nimi;
|
||||||
|
private final LocalDate pvm;
|
||||||
|
private final int salaatit, pääruoat, jälkiruoat;
|
||||||
|
private final String lisätiedot;
|
||||||
|
private final String yhteyshenkilönNimi, laskutusOsoite, yhteyshenkilönPuhelinnumero, yhteyshenkilönSähköposti;
|
||||||
|
|
||||||
|
public RaporttiRivi(String nimi,
|
||||||
|
LocalDate pvm,
|
||||||
|
int salaatit,
|
||||||
|
int pääruoat,
|
||||||
|
int jälkiruoat,
|
||||||
|
String lisätiedot,
|
||||||
|
String yhteyshenkilönNimi,
|
||||||
|
String laskutusOsoite,
|
||||||
|
String yhteyshenkilönPuhelinnumero,
|
||||||
|
String yhteyshenkilönSähköposti) {
|
||||||
|
this.nimi = nimi;
|
||||||
|
this.pvm = pvm;
|
||||||
|
this.salaatit = salaatit;
|
||||||
|
this.pääruoat = pääruoat;
|
||||||
|
this.jälkiruoat = jälkiruoat;
|
||||||
|
this.lisätiedot = lisätiedot;
|
||||||
|
this.yhteyshenkilönNimi = yhteyshenkilönNimi;
|
||||||
|
this.laskutusOsoite = laskutusOsoite;
|
||||||
|
this.yhteyshenkilönPuhelinnumero = yhteyshenkilönPuhelinnumero;
|
||||||
|
this.yhteyshenkilönSähköposti = yhteyshenkilönSähköposti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<RaporttiRivi> haeRaportti(LocalDate alkuPvm, LocalDate loppuPvm, boolean tarkka) {
|
||||||
|
ArrayList<RaporttiRivi> raportti = new ArrayList<>();
|
||||||
|
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
||||||
|
ResultSet rs;
|
||||||
|
if (tarkka) {
|
||||||
|
//Jokainen kuljetus saa oman rivin
|
||||||
|
PreparedStatement stmt = tietokanta.prepareStatement("""
|
||||||
|
select kuljetukset.asiakasID,
|
||||||
|
kuljetukset.nimi,
|
||||||
|
kuljetukset.kuljetusPäivämäärä,
|
||||||
|
kuljetukset.salaatit,
|
||||||
|
kuljetukset.pääruoat,
|
||||||
|
kuljetukset.jälkiruoat,
|
||||||
|
kuljetukset.lisätieto,
|
||||||
|
asiakkaat.yhteyshenkilönNimi,
|
||||||
|
asiakkaat.laskutusosoite,
|
||||||
|
asiakkaat.yhteyshenkilönPuhelinnumero,
|
||||||
|
asiakkaat.yhteyshenkilönSähköposti
|
||||||
|
from kuljetukset
|
||||||
|
left join asiakkaat on kuljetukset.asiakasID=asiakkaat.id
|
||||||
|
where kuljetusPäivämäärä between ? and ?
|
||||||
|
order by kuljetukset.nimi
|
||||||
|
""");
|
||||||
|
stmt.setDate(1, Date.valueOf(alkuPvm));
|
||||||
|
stmt.setDate(2, Date.valueOf(loppuPvm));
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
int i = 2;
|
||||||
|
RaporttiRivi uusi = new RaporttiRivi(
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getDate(i++).toLocalDate(),
|
||||||
|
rs.getInt(i++),
|
||||||
|
rs.getInt(i++),
|
||||||
|
rs.getInt(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++)
|
||||||
|
);
|
||||||
|
raportti.add(uusi);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//Kuljetukset summataan yhteen riviin per vastaanottaja
|
||||||
|
PreparedStatement stmt = tietokanta.prepareStatement("""
|
||||||
|
select kuljetukset.asiakasID,
|
||||||
|
kuljetukset.nimi,
|
||||||
|
kuljetukset.kuljetusPäivämäärä,
|
||||||
|
sum(kuljetukset.salaatit),
|
||||||
|
sum(kuljetukset.pääruoat),
|
||||||
|
sum(kuljetukset.jälkiruoat),
|
||||||
|
group_concat(kuljetukset.lisätieto, ?),
|
||||||
|
asiakkaat.yhteyshenkilönNimi,
|
||||||
|
asiakkaat.laskutusosoite,
|
||||||
|
asiakkaat.yhteyshenkilönPuhelinnumero,
|
||||||
|
asiakkaat.yhteyshenkilönSähköposti
|
||||||
|
from kuljetukset
|
||||||
|
left join asiakkaat on kuljetukset.asiakasID=asiakkaat.id
|
||||||
|
where kuljetusPäivämäärä between ? and ?
|
||||||
|
group by kuljetukset.nimi
|
||||||
|
order by kuljetukset.nimi
|
||||||
|
""");
|
||||||
|
stmt.setString(1, "\n");
|
||||||
|
stmt.setDate(2, Date.valueOf(alkuPvm));
|
||||||
|
stmt.setDate(3, Date.valueOf(loppuPvm));
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
int i = 2;
|
||||||
|
RaporttiRivi uusi = new RaporttiRivi(
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getDate(i++).toLocalDate(),
|
||||||
|
rs.getInt(i++),
|
||||||
|
rs.getInt(i++),
|
||||||
|
rs.getInt(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++),
|
||||||
|
rs.getString(i++)
|
||||||
|
);
|
||||||
|
raportti.add(uusi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
SiirtoVirhe virhe = new SiirtoVirhe(e);
|
||||||
|
virhe.showAndWait();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return raportti;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
|
||||||
|
String laskutustiedot = "\n" + yhteyshenkilönNimi +
|
||||||
|
"\n" + laskutusOsoite +
|
||||||
|
"\n" + yhteyshenkilönPuhelinnumero +
|
||||||
|
"\n" + yhteyshenkilönSähköposti;
|
||||||
|
|
||||||
|
return nimi +
|
||||||
|
"\nSal: " + salaatit + ", Pr: " + pääruoat + ", Jr: " + jälkiruoat +
|
||||||
|
"\nLisätiedot:\n" +
|
||||||
|
getLisätiedot() +
|
||||||
|
laskutustiedot.replace("\nnull", "").strip();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNimi() {
|
||||||
|
return nimi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getPvm() {
|
||||||
|
return pvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSalaatit() {
|
||||||
|
return salaatit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPääruoat() {
|
||||||
|
return pääruoat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getJälkiruoat() {
|
||||||
|
return jälkiruoat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLisätiedot() {
|
||||||
|
if (lisätiedot == null) return null;
|
||||||
|
return lisätiedot.strip().trim().stripLeading().stripTrailing();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYhteyshenkilönNimi() {
|
||||||
|
return yhteyshenkilönNimi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLaskutusOsoite() {
|
||||||
|
return laskutusOsoite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYhteyshenkilönPuhelinnumero() {
|
||||||
|
return yhteyshenkilönPuhelinnumero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYhteyshenkilönSähköposti() {
|
||||||
|
return yhteyshenkilönSähköposti;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package fi.lpam.ruokamanageri.dataluokat;
|
||||||
|
|
||||||
|
import fi.lpam.ruokamanageri.gui.virheDialogit.SiirtoVirhe;
|
||||||
|
|
||||||
|
import fi.lpam.ruokamanageri.Main;
|
||||||
|
import org.apache.commons.lang3.SystemUtils;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class Tietokanta {
|
||||||
|
private static String osoite;
|
||||||
|
private static String dbPath = SystemUtils.getUserHome().getAbsolutePath() + "\\OneDrive\\Kuljetusruokasovellus\\tietokanta.db";
|
||||||
|
|
||||||
|
public Tietokanta(boolean dev) {
|
||||||
|
if (dev) dbPath = "testikanta.db";
|
||||||
|
File file = new File(dbPath);
|
||||||
|
try {
|
||||||
|
boolean _ = file.getParentFile().mkdirs();
|
||||||
|
boolean _ = file.createNewFile();
|
||||||
|
}
|
||||||
|
catch (Exception _) {}
|
||||||
|
|
||||||
|
osoite = "jdbc:sqlite:" + file.getAbsolutePath();
|
||||||
|
|
||||||
|
|
||||||
|
try (Connection conn = haeYhteys()) {
|
||||||
|
InputStream is = Objects.requireNonNull(Main.class.getClassLoader().getResourceAsStream("tietokanta.sql"));
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||||
|
String sql = br.readAllAsString();
|
||||||
|
|
||||||
|
for (String query : sql.split(";")) {
|
||||||
|
conn.createStatement().execute(query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException | IOException e) {
|
||||||
|
handleException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Lisää laskutustiedot asiakastauluun
|
||||||
|
String[] sarakkeet = {"laskutusosoite", "yhteyshenkilönNimi", "yhteyshenkilönPuhelinnumero", "yhteyshenkilönSähköposti"};
|
||||||
|
for (String sarake : sarakkeet) {
|
||||||
|
try (Connection conn = haeYhteys()) {
|
||||||
|
PreparedStatement stmt = conn.prepareStatement("alter table asiakkaat add column " + sarake + " varchar(255)");
|
||||||
|
stmt.execute();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
if (!e.getMessage().contains("duplicate column name")) {
|
||||||
|
handleException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Connection haeYhteys() {
|
||||||
|
Connection connection = null;
|
||||||
|
try {
|
||||||
|
connection = DriverManager.getConnection(osoite);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
handleException(e);
|
||||||
|
}
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleException(Exception e) {
|
||||||
|
SiirtoVirhe virhe = new SiirtoVirhe(e);
|
||||||
|
virhe.showAndWait();
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fi.lpam.dataluokat;
|
package fi.lpam.ruokamanageri.dataluokat;
|
||||||
|
|
||||||
public interface TietokantaOlio {
|
public interface TietokantaOlio {
|
||||||
|
|
||||||
+88
-32
@@ -1,15 +1,19 @@
|
|||||||
package fi.lpam.gui;
|
package fi.lpam.ruokamanageri.gui;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
|
|
||||||
import fi.lpam.gui.elementit.IntegerSpinner;
|
import fi.lpam.ruokamanageri.gui.elementit.IntegerSpinner;
|
||||||
import fi.lpam.gui.elementit.TabPohja;
|
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
||||||
import fi.lpam.Main;
|
import fi.lpam.ruokamanageri.Main;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.geometry.Side;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -17,7 +21,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class AsiakasIkkuna extends Stage {
|
public class AsiakasIkkuna extends Stage {
|
||||||
final Asiakas käsiteltäväAsiakas;
|
final Asiakas käsiteltäväAsiakas;
|
||||||
final TextField tfNimi, tfOsoite, tfRuokarajoitteet, tfAvainTieto, tfLisätiedot;
|
final TextField tfNimi, tfOsoite, tfRuokarajoitteet, tfAvainTieto, tfLisätiedot, tfYhteyshenkilönNimi, tfLaskutusOsoite, tfYhteyshenkilönPuhelinnumero, tfYhteyshenkilönSähköposti;
|
||||||
final IntegerSpinner tfMaanantai, tfTiistai, tfKeskiviikko, tfTorstai, tfPerjantai, tfSalaatit, tfPääruoat, tfJälkiruoat;
|
final IntegerSpinner tfMaanantai, tfTiistai, tfKeskiviikko, tfTorstai, tfPerjantai, tfSalaatit, tfPääruoat, tfJälkiruoat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,93 +32,138 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
this.käsiteltäväAsiakas = käsiteltäväAsiakas;
|
this.käsiteltäväAsiakas = käsiteltäväAsiakas;
|
||||||
this.setTitle("Asiakasikkuna");
|
this.setTitle("Asiakasikkuna");
|
||||||
|
|
||||||
GridPane root = new GridPane();
|
TabPane tabPane = new TabPane();
|
||||||
root.setPadding(new Insets(15));
|
tabPane.setSide(Side.LEFT);
|
||||||
root.setHgap(10);
|
int korkeus = 150;
|
||||||
root.setVgap(10);
|
tabPane.setTabMinWidth(korkeus);
|
||||||
root.setOnKeyPressed(e -> {
|
tabPane.setTabMinWidth(korkeus);
|
||||||
|
tabPane.setTabMinHeight(35);
|
||||||
|
tabPane.setTabMaxHeight(35);
|
||||||
|
tabPane.setOnKeyPressed(e -> {
|
||||||
switch (e.getCode()) {
|
switch (e.getCode()) {
|
||||||
case ENTER: tallenna(); break;
|
case ENTER: tallenna(); break;
|
||||||
case ESCAPE: close(); break;
|
case ESCAPE: close(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
root.addRow(root.getRowCount(), new Label("Vahvistetut kentät pakollisia"));
|
Tab tabAsiakasTiedot, tabLaskutusTiedot;
|
||||||
|
tabAsiakasTiedot = new Tab("Asiakastiedot");
|
||||||
|
tabLaskutusTiedot = new Tab("Laskutustiedot");
|
||||||
|
tabPane.getTabs().addAll(tabAsiakasTiedot, tabLaskutusTiedot);
|
||||||
|
for (Tab tab : tabPane.getTabs()) {
|
||||||
|
tab.setClosable(false);
|
||||||
|
tab.setStyle("-fx-font-size: 18px; -fx-font-weight: bold; -fx-font-family: Open Sans");
|
||||||
|
}
|
||||||
|
|
||||||
|
GridPane asiakasTiedot = new GridPane();
|
||||||
|
asiakasTiedot.setPadding(new Insets(15));
|
||||||
|
asiakasTiedot.setHgap(10);
|
||||||
|
asiakasTiedot.setVgap(10);
|
||||||
|
tabAsiakasTiedot.setContent(asiakasTiedot);
|
||||||
|
|
||||||
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), new Label("Vahvistetut kentät pakollisia"));
|
||||||
|
|
||||||
Label nimi = new Label("Asiakkaan etu- ja sukunimi");
|
Label nimi = new Label("Asiakkaan etu- ja sukunimi");
|
||||||
nimi.setStyle("-fx-font-weight: bold;");
|
nimi.setStyle("-fx-font-weight: bold;");
|
||||||
tfNimi = new TextField();
|
tfNimi = new TextField();
|
||||||
tfNimi.setPromptText("Pakollinen tieto");
|
tfNimi.setPromptText("Pakollinen tieto");
|
||||||
root.addRow(root.getRowCount(), nimi, tfNimi);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), nimi, tfNimi);
|
||||||
|
|
||||||
Label osoite = new Label("Osoite");
|
Label osoite = new Label("Osoite");
|
||||||
osoite.setStyle("-fx-font-weight: bold;");
|
osoite.setStyle("-fx-font-weight: bold;");
|
||||||
tfOsoite = new TextField();
|
tfOsoite = new TextField();
|
||||||
tfOsoite.setPromptText("Pakollinen tieto");
|
tfOsoite.setPromptText("Pakollinen tieto");
|
||||||
root.addRow(root.getRowCount(), osoite, tfOsoite);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), osoite, tfOsoite);
|
||||||
|
|
||||||
root.addRow(root.getRowCount(), new Label("Määrät per kuljetus"));
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), new Label("Määrät per kuljetus"));
|
||||||
|
|
||||||
Label salaatit = new Label("Salaatit");
|
Label salaatit = new Label("Salaatit");
|
||||||
tfSalaatit = new IntegerSpinner();
|
tfSalaatit = new IntegerSpinner();
|
||||||
root.addRow(root.getRowCount(), salaatit, tfSalaatit);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), salaatit, tfSalaatit);
|
||||||
|
|
||||||
Label pääruoat = new Label("Pääruoat");
|
Label pääruoat = new Label("Pääruoat");
|
||||||
tfPääruoat = new IntegerSpinner();
|
tfPääruoat = new IntegerSpinner();
|
||||||
root.addRow(root.getRowCount(), pääruoat, tfPääruoat);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), pääruoat, tfPääruoat);
|
||||||
|
|
||||||
Label jälkiruoat = new Label("Jälkiruoat");
|
Label jälkiruoat = new Label("Jälkiruoat");
|
||||||
tfJälkiruoat = new IntegerSpinner();
|
tfJälkiruoat = new IntegerSpinner();
|
||||||
root.addRow(root.getRowCount(), jälkiruoat, tfJälkiruoat);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), jälkiruoat, tfJälkiruoat);
|
||||||
|
|
||||||
root.addRow(root.getRowCount(), new Label("Kuljetukset per päivä"));
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), new Label("Kuljetukset per päivä"));
|
||||||
|
|
||||||
Label maanantai = new Label("Maanantai");
|
Label maanantai = new Label("Maanantai");
|
||||||
tfMaanantai = new IntegerSpinner();
|
tfMaanantai = new IntegerSpinner();
|
||||||
root.addRow(root.getRowCount(), maanantai, tfMaanantai);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), maanantai, tfMaanantai);
|
||||||
|
|
||||||
Label tiistai = new Label("Tiistai");
|
Label tiistai = new Label("Tiistai");
|
||||||
tfTiistai = new IntegerSpinner();
|
tfTiistai = new IntegerSpinner();
|
||||||
root.addRow(root.getRowCount(), tiistai, tfTiistai);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), tiistai, tfTiistai);
|
||||||
|
|
||||||
Label keskiviikko = new Label("Keskiviikko");
|
Label keskiviikko = new Label("Keskiviikko");
|
||||||
tfKeskiviikko = new IntegerSpinner();
|
tfKeskiviikko = new IntegerSpinner();
|
||||||
root.addRow(root.getRowCount(), keskiviikko, tfKeskiviikko);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), keskiviikko, tfKeskiviikko);
|
||||||
|
|
||||||
Label torstai = new Label("Torstai");
|
Label torstai = new Label("Torstai");
|
||||||
tfTorstai = new IntegerSpinner();
|
tfTorstai = new IntegerSpinner();
|
||||||
root.addRow(root.getRowCount(), torstai, tfTorstai);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), torstai, tfTorstai);
|
||||||
|
|
||||||
Label perjantai = new Label("Perjantai");
|
Label perjantai = new Label("Perjantai");
|
||||||
tfPerjantai = new IntegerSpinner();
|
tfPerjantai = new IntegerSpinner();
|
||||||
root.addRow(root.getRowCount(), perjantai, tfPerjantai);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), perjantai, tfPerjantai);
|
||||||
|
|
||||||
Label ruokarajoitteet = new Label("Ruokarajoitteet");
|
Label ruokarajoitteet = new Label("Ruokarajoitteet");
|
||||||
tfRuokarajoitteet = new TextField();
|
tfRuokarajoitteet = new TextField();
|
||||||
root.addRow(root.getRowCount(), ruokarajoitteet, tfRuokarajoitteet);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), ruokarajoitteet, tfRuokarajoitteet);
|
||||||
|
|
||||||
Label avainTieto = new Label("Avaintieto");
|
Label avainTieto = new Label("Avaintieto");
|
||||||
tfAvainTieto = new TextField();
|
tfAvainTieto = new TextField();
|
||||||
root.addRow(root.getRowCount(), avainTieto, tfAvainTieto);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), avainTieto, tfAvainTieto);
|
||||||
|
|
||||||
Label lisätiedot = new Label("Kuljetuksen lisätiedot");
|
Label lisätiedot = new Label("Kuljetuksen lisätiedot");
|
||||||
tfLisätiedot = new TextField();
|
tfLisätiedot = new TextField();
|
||||||
tfLisätiedot.setPromptText("Näkyy raporteilla");
|
tfLisätiedot.setPromptText("Näkyy raporteilla");
|
||||||
root.addRow(root.getRowCount(), lisätiedot, tfLisätiedot);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), lisätiedot, tfLisätiedot);
|
||||||
|
|
||||||
|
|
||||||
|
GridPane laskutusTiedot = new GridPane();
|
||||||
|
laskutusTiedot.setPadding(new Insets(15));
|
||||||
|
laskutusTiedot.setHgap(10);
|
||||||
|
laskutusTiedot.setVgap(10);
|
||||||
|
tabLaskutusTiedot.setContent(laskutusTiedot);
|
||||||
|
|
||||||
|
Label yhteyshenkilönNimi = new Label("Yhteyshenkilön etu- ja sukunimi");
|
||||||
|
tfYhteyshenkilönNimi = new TextField();
|
||||||
|
laskutusTiedot.addRow(laskutusTiedot.getRowCount(), yhteyshenkilönNimi, tfYhteyshenkilönNimi);
|
||||||
|
|
||||||
|
Label laskutusOsoite = new Label("Laskutusosoite");
|
||||||
|
tfLaskutusOsoite = new TextField();
|
||||||
|
laskutusTiedot.addRow(laskutusTiedot.getRowCount(), laskutusOsoite, tfLaskutusOsoite);
|
||||||
|
|
||||||
|
Label yhteyshenkilönPuhelinnumero = new Label("Puhelinnumero");
|
||||||
|
tfYhteyshenkilönPuhelinnumero = new TextField();
|
||||||
|
laskutusTiedot.addRow(laskutusTiedot.getRowCount(), yhteyshenkilönPuhelinnumero, tfYhteyshenkilönPuhelinnumero);
|
||||||
|
|
||||||
|
Label yhteyshenkilönSähköposti = new Label("Sähköposti");
|
||||||
|
tfYhteyshenkilönSähköposti = new TextField();
|
||||||
|
laskutusTiedot.addRow(laskutusTiedot.getRowCount(), yhteyshenkilönSähköposti, tfYhteyshenkilönSähköposti);
|
||||||
|
|
||||||
|
HBox napit = new HBox();
|
||||||
Button peruuta = new Button("Peruuta");
|
Button peruuta = new Button("Peruuta");
|
||||||
peruuta.setFont(TabPohja.buttonFont);
|
peruuta.setFont(TabPohja.buttonFont);
|
||||||
peruuta.setMinWidth(160);
|
|
||||||
peruuta.setOnAction(_ -> this.close());
|
peruuta.setOnAction(_ -> this.close());
|
||||||
Button tallenna = new Button("Tallenna");
|
Button tallenna = new Button("Tallenna");
|
||||||
tallenna.setFont(TabPohja.buttonFont);
|
tallenna.setFont(TabPohja.buttonFont);
|
||||||
tallenna.setMinWidth(160);
|
|
||||||
tallenna.setOnAction(_ -> tallenna());
|
tallenna.setOnAction(_ -> tallenna());
|
||||||
root.addRow(root.getRowCount(), peruuta, tallenna);
|
napit.getChildren().addAll(peruuta, tallenna);
|
||||||
|
napit.setAlignment(Pos.CENTER_RIGHT);
|
||||||
|
napit.setSpacing(10);
|
||||||
|
napit.setPadding(TabPohja.oletusInsets);
|
||||||
|
|
||||||
|
|
||||||
|
VBox root = new VBox();
|
||||||
|
root.getChildren().addAll(tabPane, napit);
|
||||||
this.setScene(new Scene(root));
|
this.setScene(new Scene(root));
|
||||||
this.getIcons().add(new Image(Objects.requireNonNull(Main.class.getResourceAsStream("kuljetusruokalaatikko.jpg"))));
|
this.getIcons().add(new Image(Objects.requireNonNull(Main.class.getClassLoader().getResourceAsStream("kuljetusruokalaatikko.jpg"))));
|
||||||
this.setAlwaysOnTop(true);
|
this.setAlwaysOnTop(true);
|
||||||
this.setResizable(false);
|
this.setResizable(false);
|
||||||
|
|
||||||
@@ -142,6 +191,10 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
tfRuokarajoitteet.setText(käsiteltäväAsiakas.getErityisruokavalio());
|
tfRuokarajoitteet.setText(käsiteltäväAsiakas.getErityisruokavalio());
|
||||||
tfAvainTieto.setText(käsiteltäväAsiakas.getAvainTieto());
|
tfAvainTieto.setText(käsiteltäväAsiakas.getAvainTieto());
|
||||||
tfLisätiedot.setText(käsiteltäväAsiakas.getLisätiedot());
|
tfLisätiedot.setText(käsiteltäväAsiakas.getLisätiedot());
|
||||||
|
tfYhteyshenkilönNimi.setText(käsiteltäväAsiakas.getYhteyshenkilönNimi());
|
||||||
|
tfLaskutusOsoite.setText(käsiteltäväAsiakas.getLaskutusOsoite());
|
||||||
|
tfYhteyshenkilönPuhelinnumero.setText(käsiteltäväAsiakas.getYhteyshenkilönPuhelinnumero());
|
||||||
|
tfYhteyshenkilönSähköposti.setText(käsiteltäväAsiakas.getYhteyshenkilönSähköposti());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tallenna() {
|
private void tallenna() {
|
||||||
@@ -171,6 +224,10 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
käsiteltäväAsiakas.setErityisruokavalio(tfRuokarajoitteet.getText());
|
käsiteltäväAsiakas.setErityisruokavalio(tfRuokarajoitteet.getText());
|
||||||
käsiteltäväAsiakas.setAvainTieto(tfAvainTieto.getText());
|
käsiteltäväAsiakas.setAvainTieto(tfAvainTieto.getText());
|
||||||
käsiteltäväAsiakas.setLisätiedot(tfLisätiedot.getText());
|
käsiteltäväAsiakas.setLisätiedot(tfLisätiedot.getText());
|
||||||
|
käsiteltäväAsiakas.setYhteyshenkilönNimi(tfYhteyshenkilönNimi.getText());
|
||||||
|
käsiteltäväAsiakas.setLaskutusOsoite(tfLaskutusOsoite.getText());
|
||||||
|
käsiteltäväAsiakas.setYhteyshenkilönPuhelinnumero(tfYhteyshenkilönPuhelinnumero.getText());
|
||||||
|
käsiteltäväAsiakas.setYhteyshenkilönSähköposti(tfYhteyshenkilönSähköposti.getText());
|
||||||
|
|
||||||
boolean läpi = false;
|
boolean läpi = false;
|
||||||
int maxYritykset = 3;
|
int maxYritykset = 3;
|
||||||
@@ -188,7 +245,6 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (läpi) {
|
if (läpi) {
|
||||||
int viikonKuljetukset = käsiteltäväAsiakas.getMaanantaiKpl() + käsiteltäväAsiakas.getTiistaiKpl() + käsiteltäväAsiakas.getKeskiviikkoKpl() + käsiteltäväAsiakas.getTorstaiKpl() + käsiteltäväAsiakas.getPerjantaiKpl();
|
int viikonKuljetukset = käsiteltäväAsiakas.getMaanantaiKpl() + käsiteltäväAsiakas.getTiistaiKpl() + käsiteltäväAsiakas.getKeskiviikkoKpl() + käsiteltäväAsiakas.getTorstaiKpl() + käsiteltäväAsiakas.getPerjantaiKpl();
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||||
+41
-8
@@ -1,15 +1,24 @@
|
|||||||
package fi.lpam.gui;
|
package fi.lpam.ruokamanageri.gui;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.Main;
|
||||||
import fi.lpam.gui.elementit.MaaraTableColumn;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
import fi.lpam.gui.elementit.TabPohja;
|
import fi.lpam.ruokamanageri.gui.elementit.MaaraTableColumn;
|
||||||
|
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -33,19 +42,30 @@ public class Asiakashallinta extends TabPohja {
|
|||||||
yläpalkinNapit.setSpacing(5);
|
yläpalkinNapit.setSpacing(5);
|
||||||
yläpalkki.setRight(yläpalkinNapit);
|
yläpalkki.setRight(yläpalkinNapit);
|
||||||
|
|
||||||
|
Button avaaVersioloki = new Button("Avaa muutosloki");
|
||||||
|
avaaVersioloki.setFont(buttonFont);
|
||||||
|
avaaVersioloki.setOnAction(_ -> {
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(new URI("https://git.lpam.fi/laurimaaninka/Ruokamanageri/src/branch/master/CHANGELOG.md"));
|
||||||
|
} catch (IOException | URISyntaxException e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
yläpalkinNapit.getChildren().add(avaaVersioloki);
|
||||||
|
|
||||||
Button poistaValittu = new Button("Poista");
|
Button poistaValittu = new Button("Poista");
|
||||||
poistaValittu.setOnAction(_ -> poistaValittu());
|
poistaValittu.setOnAction(_ -> poistaValittu());
|
||||||
poistaValittu.setFont(TabPohja.buttonFont);
|
poistaValittu.setFont(buttonFont);
|
||||||
yläpalkinNapit.getChildren().add(poistaValittu);
|
yläpalkinNapit.getChildren().add(poistaValittu);
|
||||||
|
|
||||||
Button muokkaaAsiakasta = new Button("Muokkaa");
|
Button muokkaaAsiakasta = new Button("Muokkaa");
|
||||||
muokkaaAsiakasta.setOnAction(_ -> muokkaaValittua());
|
muokkaaAsiakasta.setOnAction(_ -> muokkaaValittua());
|
||||||
muokkaaAsiakasta.setFont(TabPohja.buttonFont);
|
muokkaaAsiakasta.setFont(buttonFont);
|
||||||
yläpalkinNapit.getChildren().add(muokkaaAsiakasta);
|
yläpalkinNapit.getChildren().add(muokkaaAsiakasta);
|
||||||
|
|
||||||
Button uusiAsiakas = new Button("Uusi asiakas");
|
Button uusiAsiakas = new Button("Uusi asiakas");
|
||||||
uusiAsiakas.setOnAction(_ -> uusiAsiakas());
|
uusiAsiakas.setOnAction(_ -> uusiAsiakas());
|
||||||
uusiAsiakas.setFont(TabPohja.buttonFont);
|
uusiAsiakas.setFont(buttonFont);
|
||||||
yläpalkinNapit.getChildren().add(uusiAsiakas);
|
yläpalkinNapit.getChildren().add(uusiAsiakas);
|
||||||
|
|
||||||
tvAsiakkaat.setEditable(false);
|
tvAsiakkaat.setEditable(false);
|
||||||
@@ -103,8 +123,21 @@ public class Asiakashallinta extends TabPohja {
|
|||||||
TableColumn<Asiakas, String> tcLisätiedot = new TableColumn<>("Lisätieto kuljetukselle");
|
TableColumn<Asiakas, String> tcLisätiedot = new TableColumn<>("Lisätieto kuljetukselle");
|
||||||
tcLisätiedot.setMinWidth(250);
|
tcLisätiedot.setMinWidth(250);
|
||||||
tcLisätiedot.setCellValueFactory(new PropertyValueFactory<>("lisätiedot"));
|
tcLisätiedot.setCellValueFactory(new PropertyValueFactory<>("lisätiedot"));
|
||||||
|
TableColumn<Asiakas, String> tcYhteyshenkilönNimi = new TableColumn<>("Yhteyshenkilö");
|
||||||
|
tcYhteyshenkilönNimi.setMinWidth(250);
|
||||||
|
tcYhteyshenkilönNimi.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönNimi"));
|
||||||
|
TableColumn<Asiakas, String> tcLaskutusOsoite = new TableColumn<>("Laskutusosoite");
|
||||||
|
tcLaskutusOsoite.setMinWidth(250);
|
||||||
|
tcLaskutusOsoite.setCellValueFactory(new PropertyValueFactory<>("laskutusOsoite"));
|
||||||
|
TableColumn<Asiakas, String> tcYhteyshenkilönPuhelinnumero = new TableColumn<>("Yhteyshenkilön puhelinnumero");
|
||||||
|
tcYhteyshenkilönPuhelinnumero.setMinWidth(250);
|
||||||
|
tcYhteyshenkilönPuhelinnumero.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönPuhelinnumero"));
|
||||||
|
TableColumn<Asiakas, String> tcYhteyshenkilönSähköposti = new TableColumn<>("Yhteyshenkilön sähköposti");
|
||||||
|
tcYhteyshenkilönSähköposti.setMinWidth(250);
|
||||||
|
tcYhteyshenkilönSähköposti.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönSähköposti"));
|
||||||
|
|
||||||
|
tvAsiakkaat.getColumns().addAll(tcNimi, tcOsoite, tcKuljetuspäivät, tcKuljetusmäärät, tcErityisruokavalio, tcAvainTieto, tcLisätiedot, tcYhteyshenkilönNimi, tcLaskutusOsoite, tcYhteyshenkilönPuhelinnumero, tcYhteyshenkilönSähköposti);
|
||||||
|
|
||||||
tvAsiakkaat.getColumns().addAll(tcNimi, tcOsoite, tcKuljetuspäivät, tcKuljetusmäärät, tcErityisruokavalio, tcAvainTieto, tcLisätiedot);
|
|
||||||
for (TableColumn<Asiakas, ?> column : tvAsiakkaat.getColumns()) {
|
for (TableColumn<Asiakas, ?> column : tvAsiakkaat.getColumns()) {
|
||||||
column.setEditable(false);
|
column.setEditable(false);
|
||||||
column.setReorderable(false);
|
column.setReorderable(false);
|
||||||
+5
-5
@@ -1,11 +1,11 @@
|
|||||||
package fi.lpam.gui;
|
package fi.lpam.ruokamanageri.gui;
|
||||||
|
|
||||||
import com.dlsc.gemsfx.MultiColumnListView;
|
import com.dlsc.gemsfx.MultiColumnListView;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
import fi.lpam.dataluokat.Kierros;
|
import fi.lpam.ruokamanageri.dataluokat.Kierros;
|
||||||
import fi.lpam.gui.elementit.AsiakasListCell;
|
import fi.lpam.ruokamanageri.gui.elementit.AsiakasListCell;
|
||||||
import fi.lpam.gui.elementit.TabPohja;
|
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
+8
-8
@@ -1,12 +1,12 @@
|
|||||||
package fi.lpam.gui;
|
package fi.lpam.ruokamanageri.gui;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
import fi.lpam.dataluokat.Kierros;
|
import fi.lpam.ruokamanageri.dataluokat.Kierros;
|
||||||
import fi.lpam.dataluokat.Kuljetus;
|
import fi.lpam.ruokamanageri.dataluokat.Kuljetus;
|
||||||
import fi.lpam.gui.elementit.KuljetaTableCell;
|
import fi.lpam.ruokamanageri.gui.elementit.KuljetaTableCell;
|
||||||
import fi.lpam.tulostajat.KuljetusListaTulostaja;
|
import fi.lpam.ruokamanageri.tulostajat.KuljetusListaTulostaja;
|
||||||
import fi.lpam.gui.elementit.MaaraTableColumn;
|
import fi.lpam.ruokamanageri.gui.elementit.MaaraTableColumn;
|
||||||
import fi.lpam.gui.elementit.TabPohja;
|
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
+30
-10
@@ -1,9 +1,9 @@
|
|||||||
package fi.lpam.gui;
|
package fi.lpam.ruokamanageri.gui;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.RaporttiRivi;
|
import fi.lpam.ruokamanageri.dataluokat.RaporttiRivi;
|
||||||
import fi.lpam.tulostajat.KuljetusRaporttiTulostaja;
|
import fi.lpam.ruokamanageri.tulostajat.KuljetusRaporttiTulostaja;
|
||||||
import fi.lpam.gui.elementit.PaivamaaraTableCell;
|
import fi.lpam.ruokamanageri.gui.elementit.PaivamaaraTableCell;
|
||||||
import fi.lpam.gui.elementit.TabPohja;
|
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
@@ -59,18 +59,21 @@ public class KuljetusRaportit extends TabPohja {
|
|||||||
Button tulostaRaportti = new Button("Tulosta raportti");
|
Button tulostaRaportti = new Button("Tulosta raportti");
|
||||||
tulostaRaportti.setFont(buttonFont);
|
tulostaRaportti.setFont(buttonFont);
|
||||||
tulostaRaportti.setOnAction(_ ->tulostaRaportti());
|
tulostaRaportti.setOnAction(_ ->tulostaRaportti());
|
||||||
yläpalkinNapit.getChildren().addAll(tarkka, new Label("Hae kuljetukset välillä:"), alkuPvm, new Label("-"), loppuPvm, haeKuljetukset, tulostaRaportti);
|
yläpalkinNapit.getChildren().addAll(tarkka,
|
||||||
|
new Label("Hae kuljetukset välillä:"),
|
||||||
|
alkuPvm, new Label("-"), loppuPvm,
|
||||||
|
haeKuljetukset, tulostaRaportti);
|
||||||
|
|
||||||
root.setCenter(tableView);
|
root.setCenter(tableView);
|
||||||
|
|
||||||
TableColumn<RaporttiRivi, String> tcNimi = new TableColumn<>("Nimi");
|
TableColumn<RaporttiRivi, String> tcNimi = new TableColumn<>("Nimi");
|
||||||
tcNimi.setMinWidth(150);
|
tcNimi.setMinWidth(200);
|
||||||
tcNimi.setCellValueFactory(new PropertyValueFactory<>("nimi"));
|
tcNimi.setCellValueFactory(new PropertyValueFactory<>("nimi"));
|
||||||
|
|
||||||
TableColumn<RaporttiRivi, LocalDate> tcPvm = new TableColumn<>("Päivämäärä");
|
TableColumn<RaporttiRivi, LocalDate> tcPvm = new TableColumn<>("Päivämäärä");
|
||||||
tcPvm.setMinWidth(150);
|
tcPvm.setMinWidth(150);
|
||||||
tcPvm.setCellFactory(_ ->new PaivamaaraTableCell());
|
tcPvm.setCellFactory(_ ->new PaivamaaraTableCell());
|
||||||
tcPvm.setCellValueFactory(new PropertyValueFactory<>("loppuPvm"));
|
tcPvm.setCellValueFactory(new PropertyValueFactory<>("pvm"));
|
||||||
|
|
||||||
TableColumn<RaporttiRivi, Integer> tcSalaatit = new TableColumn<>("Salaatit");
|
TableColumn<RaporttiRivi, Integer> tcSalaatit = new TableColumn<>("Salaatit");
|
||||||
tcSalaatit.setMinWidth(100);
|
tcSalaatit.setMinWidth(100);
|
||||||
@@ -85,10 +88,27 @@ public class KuljetusRaportit extends TabPohja {
|
|||||||
tcJälkiruoat.setCellValueFactory(new PropertyValueFactory<>("jälkiruoat"));
|
tcJälkiruoat.setCellValueFactory(new PropertyValueFactory<>("jälkiruoat"));
|
||||||
|
|
||||||
TableColumn<RaporttiRivi, String> tcLisätiedot = new TableColumn<>("Lisätiedot");
|
TableColumn<RaporttiRivi, String> tcLisätiedot = new TableColumn<>("Lisätiedot");
|
||||||
tcLisätiedot.setMinWidth(500);
|
tcLisätiedot.setMinWidth(300);
|
||||||
tcLisätiedot.setCellValueFactory(new PropertyValueFactory<>("lisätiedot"));
|
tcLisätiedot.setCellValueFactory(new PropertyValueFactory<>("lisätiedot"));
|
||||||
|
|
||||||
tableView.getColumns().addAll(tcNimi, tcPvm, tcSalaatit, tcPääruoat, tcJälkiruoat, tcLisätiedot);
|
TableColumn<RaporttiRivi, String> tcYhteyshenkilönNimi = new TableColumn<>("Yhteyshenkilön nimi");
|
||||||
|
tcYhteyshenkilönNimi.setMinWidth(200);
|
||||||
|
tcYhteyshenkilönNimi.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönNimi"));
|
||||||
|
|
||||||
|
TableColumn<RaporttiRivi, String> tcLaskutusOsoite = new TableColumn<>("Laskutusosoite");
|
||||||
|
tcLaskutusOsoite.setMinWidth(200);
|
||||||
|
tcLaskutusOsoite.setCellValueFactory(new PropertyValueFactory<>("laskutusOsoite"));
|
||||||
|
|
||||||
|
TableColumn<RaporttiRivi, String> tcYhteyshenkilönPuhelinnumero = new TableColumn<>("Puhelinnumero");
|
||||||
|
tcYhteyshenkilönPuhelinnumero.setMinWidth(200);
|
||||||
|
tcYhteyshenkilönPuhelinnumero.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönPuhelinnumero"));
|
||||||
|
|
||||||
|
TableColumn<RaporttiRivi, String> tcYhteyshenkilönSähköposti = new TableColumn<>("Sähköposti");
|
||||||
|
tcYhteyshenkilönSähköposti.setMinWidth(200);
|
||||||
|
tcYhteyshenkilönSähköposti.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönSähköposti"));
|
||||||
|
|
||||||
|
tableView.getColumns().addAll(tcNimi, tcPvm, tcSalaatit, tcPääruoat, tcJälkiruoat, tcLisätiedot,
|
||||||
|
tcYhteyshenkilönNimi, tcLaskutusOsoite, tcYhteyshenkilönPuhelinnumero, tcYhteyshenkilönSähköposti);
|
||||||
tableView.setPlaceholder(new Label("Hae raportti"));
|
tableView.setPlaceholder(new Label("Hae raportti"));
|
||||||
for (TableColumn<RaporttiRivi, ?> sarake : tableView.getColumns()) {
|
for (TableColumn<RaporttiRivi, ?> sarake : tableView.getColumns()) {
|
||||||
sarake.setSortable(false);
|
sarake.setSortable(false);
|
||||||
+2
-3
@@ -1,10 +1,9 @@
|
|||||||
package fi.lpam.gui.elementit;
|
package fi.lpam.ruokamanageri.gui.elementit;
|
||||||
|
|
||||||
import com.dlsc.gemsfx.MultiColumnListView;
|
import com.dlsc.gemsfx.MultiColumnListView;
|
||||||
import fi.lpam.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.ContentDisplay;
|
import javafx.scene.control.ContentDisplay;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fi.lpam.gui.elementit;
|
package fi.lpam.ruokamanageri.gui.elementit;
|
||||||
|
|
||||||
import javafx.scene.control.Spinner;
|
import javafx.scene.control.Spinner;
|
||||||
import javafx.scene.control.SpinnerValueFactory;
|
import javafx.scene.control.SpinnerValueFactory;
|
||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
package fi.lpam.gui.elementit;
|
package fi.lpam.ruokamanageri.gui.elementit;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
import fi.lpam.dataluokat.Kuljetus;
|
import fi.lpam.ruokamanageri.dataluokat.Kuljetus;
|
||||||
import fi.lpam.gui.KuljetusListat;
|
import fi.lpam.ruokamanageri.gui.KuljetusListat;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.ContentDisplay;
|
import javafx.scene.control.ContentDisplay;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fi.lpam.gui.elementit;
|
package fi.lpam.ruokamanageri.gui.elementit;
|
||||||
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
|
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package fi.lpam.gui.elementit;
|
package fi.lpam.ruokamanageri.gui.elementit;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.RaporttiRivi;
|
import fi.lpam.ruokamanageri.dataluokat.RaporttiRivi;
|
||||||
import javafx.scene.control.TableCell;
|
import javafx.scene.control.TableCell;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
+1
-2
@@ -1,4 +1,4 @@
|
|||||||
package fi.lpam.gui.elementit;
|
package fi.lpam.ruokamanageri.gui.elementit;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
@@ -12,7 +12,6 @@ import javafx.scene.text.FontWeight;
|
|||||||
public class TabPohja extends StackPane {
|
public class TabPohja extends StackPane {
|
||||||
public static final Insets oletusInsets = new Insets(5);
|
public static final Insets oletusInsets = new Insets(5);
|
||||||
public static final String oletusStyle = "-fx-background-color: lightgray;";
|
public static final String oletusStyle = "-fx-background-color: lightgray;";
|
||||||
public static final Font otsikkoFont = Font.font("Open Sans", FontWeight.BOLD, 18);
|
|
||||||
public static final Font buttonFont = Font.font("Open Sans", FontWeight.BOLD, 16);
|
public static final Font buttonFont = Font.font("Open Sans", FontWeight.BOLD, 16);
|
||||||
public static final Font tekstiFont = Font.font("Open Sans", FontWeight.NORMAL, 16);
|
public static final Font tekstiFont = Font.font("Open Sans", FontWeight.NORMAL, 16);
|
||||||
public static final Border oletusBorder = new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, new CornerRadii(5), BorderWidths.DEFAULT));
|
public static final Border oletusBorder = new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, new CornerRadii(5), BorderWidths.DEFAULT));
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fi.lpam.gui.virheDialogit;
|
package fi.lpam.ruokamanageri.gui.virheDialogit;
|
||||||
|
|
||||||
public class SiirtoVirhe extends TietokantaVirhe{
|
public class SiirtoVirhe extends TietokantaVirhe{
|
||||||
public SiirtoVirhe(Exception e){
|
public SiirtoVirhe(Exception e){
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
package fi.lpam.gui.virheDialogit;
|
package fi.lpam.ruokamanageri.gui.virheDialogit;
|
||||||
|
|
||||||
import fi.lpam.Main;
|
import fi.lpam.ruokamanageri.Main;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
@@ -12,7 +12,7 @@ abstract class TietokantaVirhe extends Alert {
|
|||||||
public TietokantaVirhe() {
|
public TietokantaVirhe() {
|
||||||
super(AlertType.ERROR);
|
super(AlertType.ERROR);
|
||||||
this.setTitle("Tietokanta");
|
this.setTitle("Tietokanta");
|
||||||
ImageView sql = new ImageView(new Image(Objects.requireNonNull(Main.class.getResourceAsStream("tietokanta.png"))));
|
ImageView sql = new ImageView(new Image(Objects.requireNonNull(Main.class.getClassLoader().getResourceAsStream("tietokanta.png"))));
|
||||||
sql.setPreserveRatio(true);
|
sql.setPreserveRatio(true);
|
||||||
sql.setFitHeight(100);
|
sql.setFitHeight(100);
|
||||||
this.setGraphic(sql);
|
this.setGraphic(sql);
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fi.lpam.gui.virheDialogit;
|
package fi.lpam.ruokamanageri.gui.virheDialogit;
|
||||||
|
|
||||||
public class YhteysVirhe extends TietokantaVirhe{
|
public class YhteysVirhe extends TietokantaVirhe{
|
||||||
public YhteysVirhe(Exception error){
|
public YhteysVirhe(Exception error){
|
||||||
+4
-3
@@ -1,6 +1,6 @@
|
|||||||
package fi.lpam.tulostajat;
|
package fi.lpam.ruokamanageri.tulostajat;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.Kuljetus;
|
import fi.lpam.ruokamanageri.dataluokat.Kuljetus;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -45,8 +45,9 @@ public class KuljetusListaTulostaja extends Tulostaja{
|
|||||||
siirräOsoitinta(NIMEN_LEVEYS);
|
siirräOsoitinta(NIMEN_LEVEYS);
|
||||||
sisältö.showText(kuljetus.getLisätieto());
|
sisältö.showText(kuljetus.getLisätieto());
|
||||||
uusiRivi(RIVI_KORKEUS*0.1F);
|
uusiRivi(RIVI_KORKEUS*0.1F);
|
||||||
sisältö.showText("___________________________________________________________________");
|
sisältö.showText("___________________________________________________________________"); //67 alaviivaa (noin sivun leveys)
|
||||||
}
|
}
|
||||||
|
|
||||||
tulosta();
|
tulosta();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
+4
-11
@@ -1,24 +1,17 @@
|
|||||||
package fi.lpam.tulostajat;
|
package fi.lpam.ruokamanageri.tulostajat;
|
||||||
|
|
||||||
import fi.lpam.dataluokat.RaporttiRivi;
|
import fi.lpam.ruokamanageri.dataluokat.RaporttiRivi;
|
||||||
|
|
||||||
import java.awt.print.PrinterJob;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import fi.lpam.gui.virheDialogit.SiirtoVirhe;
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
||||||
import org.apache.pdfbox.pdmodel.PDPage;
|
|
||||||
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
|
||||||
import org.apache.pdfbox.pdmodel.common.PDRectangle;
|
|
||||||
import org.apache.pdfbox.printing.PDFPageable;
|
|
||||||
|
|
||||||
@SuppressWarnings("DuplicatedCode")
|
@SuppressWarnings("DuplicatedCode")
|
||||||
public class KuljetusRaporttiTulostaja extends Tulostaja {
|
public class KuljetusRaporttiTulostaja extends Tulostaja {
|
||||||
public void luoRaportti(ArrayList<RaporttiRivi> raporttiRivit, LocalDate alkuPvm, LocalDate loppuPvm) {
|
public void luoRaportti(ArrayList<RaporttiRivi> raporttiRivit, LocalDate alkuPvm, LocalDate loppuPvm) {
|
||||||
try {
|
try {
|
||||||
sisältö.showText("Raportti aikaväliltä " + alkuPvm + " - " + loppuPvm);
|
sisältö.showText("Raportti aikaväliltä " + alkuPvm.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")) + " - " + loppuPvm.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")));
|
||||||
uusiRivi();
|
uusiRivi();
|
||||||
uusiRivi();
|
uusiRivi();
|
||||||
|
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package fi.lpam.tulostajat;
|
package fi.lpam.ruokamanageri.tulostajat;
|
||||||
|
|
||||||
import fi.lpam.gui.virheDialogit.SiirtoVirhe;
|
import fi.lpam.ruokamanageri.gui.virheDialogit.SiirtoVirhe;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.pdmodel.PDPage;
|
import org.apache.pdfbox.pdmodel.PDPage;
|
||||||
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
||||||
@@ -9,6 +9,6 @@ module fi.lpam.ruokamanageri {
|
|||||||
requires org.apache.pdfbox;
|
requires org.apache.pdfbox;
|
||||||
requires org.apache.commons.lang3;
|
requires org.apache.commons.lang3;
|
||||||
|
|
||||||
opens fi.lpam.dataluokat to javafx.base;
|
opens fi.lpam.ruokamanageri.dataluokat to javafx.base;
|
||||||
exports fi.lpam;
|
exports fi.lpam.ruokamanageri;
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
@@ -1,2 +1,2 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
Main-Class: fi.lpam.Main
|
Main-Class: fi.lpam.ruokamanageri.Main
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
version=${project.version}
|
||||||
|
Before Width: | Height: | Size: 267 KiB After Width: | Height: | Size: 267 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
Reference in New Issue
Block a user