37 Commits

Author SHA1 Message Date
laurimaaninka 2337d11df4 Versio 2.0.2
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-21 13:41:22 +03:00
laurimaaninka cbd7f055d8 Korjattu kierroksen asiakkaiden hakemisessa virhe
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-21 13:39:03 +03:00
laurimaaninka 2cb404f227 Versio 2.0.1
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-20 14:18:24 +03:00
laurimaaninka 15a8361ee5 Vaihdettu versioloki avautumaan paikallisena tiedostona
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-20 14:15:58 +03:00
laurimaaninka aa8295f3cc Update CHANGELOG.md 2026-04-14 13:06:26 +03:00
laurimaaninka 7201f63e5d Update CHANGELOG.md 2026-04-14 13:05:54 +03:00
laurimaaninka fcd9ac03fa Update LICENSE 2026-04-14 12:56:00 +03:00
laurimaaninka 9f1ec8ee8e Update README.md 2026-04-13 12:18:18 +03:00
laurimaaninka 128ea6e069 Update README.md 2026-04-13 02:33:20 +03:00
laurimaaninka a38c4a595f Update README.md 2026-04-13 02:32:07 +03:00
laurimaaninka b8cd37aeaa Update LICENSE 2026-04-13 01:21:32 +03:00
laurimaaninka 88f561009b Update README.md 2026-04-13 01:21:05 +03:00
laurimaaninka 2fa6d11180 LISENCE
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-13 01:09:54 +03:00
laurimaaninka ca4fc0cec2 Merge remote-tracking branch 'origin/master' 2026-04-13 00:47:20 +03:00
laurimaaninka 0b97d92ee1 Käyttämättömän koodin siivous
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-13 00:47:15 +03:00
laurimaaninka 4a8cac8f69 Käyttämättömän koodin siivous
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-13 00:46:52 +03:00
laurimaaninka 26ee29a725 ?
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-13 00:46:19 +03:00
laurimaaninka 72d04bf826 Add LICENSE 2026-04-13 00:35:46 +03:00
laurimaaninka 5abcbc8903 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	CHANGELOG.md
2026-04-13 00:11:22 +03:00
laurimaaninka 83ae429c65 Versio 2.0.0
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-13 00:10:37 +03:00
laurimaaninka 4d3946d4b0 Versio 2.0.0
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 23:53:23 +03:00
laurimaaninka 1fee120043 Asiakas luokka muokattu, asiakashallinta muokattu, asiakasikkunaan lisätty laskutustiedot välilehti
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 22:31:21 +03:00
laurimaaninka 797e7206b3 Laskutustieto lisätty tietokantaan
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 20:49:01 +03:00
laurimaaninka 05398f54af Merge remote-tracking branch 'origin/Asiakkaan-laskutusosoite' into Asiakkaan-laskutusosoite
# Conflicts:
#	CHANGELOG.md
#	src/main/java/fi/lpam/ruokamanageri/dataluokat/Tietokanta.java
2026-04-12 20:46:27 +03:00
laurimaaninka 475c700b13 Haara luotu
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 20:44:26 +03:00
laurimaaninka c3d26a42f5 Lisätty laskutustieto tietokantaan
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 20:42:50 +03:00
laurimaaninka 9412e23b07 Haara luotu
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 20:40:36 +03:00
laurimaaninka a17578398b Projektin moduulirakenteen formatointi
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 20:34:34 +03:00
laurimaaninka a42c4e1115 Update CHANGELOG.md 2026-04-12 20:30:59 +03:00
laurimaaninka c9b7db72ae Merge remote-tracking branch 'origin/master'
# Conflicts:
#	.idea/runConfigurations/Main.xml
2026-04-12 20:29:11 +03:00
laurimaaninka 1cdef78244 Projektin moduulirakenteen formatointi
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 20:28:20 +03:00
laurimaaninka 212738ce83 Projektin moduulirakenteen formatointi
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 20:25:49 +03:00
laurimaaninka 1179abbcd1 Merge remote-tracking branch 'origin/master' 2026-04-12 18:25:20 +03:00
laurimaaninka 8ef0349929 Versio 1.1.1
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 18:25:08 +03:00
laurimaaninka 8302e5a8ba Update CHANGELOG.md 2026-04-12 18:22:14 +03:00
laurimaaninka 4945afb839 Lisätty laskutustieto tietokantaan
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 17:19:11 +03:00
laurimaaninka 3d73415764 Haara luotu
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-04-12 16:44:02 +03:00
40 changed files with 844 additions and 472 deletions
+1 -2
View File
@@ -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
View File
@@ -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>
@@ -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>
+15 -1
View File
@@ -1,8 +1,22 @@
# 2.0.2
- Korjattu virhe kierroksen asiakkaiden hakemisessa, joka aiheutti vääriä järjestyksiä kierroksella
# 2.0.1
- Vaihdettu versioloki avautumaan paikallisena tiedostona
# 2.0.0
### Palaaminen aiempaan versioon ei tuettu
- 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
- Kierroshallinnassa asiakasta raahattaessa placeholderin fiksaus - Kierroshallinnassa asiakasta raahattaessa placeholderin fiksaus
- Lisätty versionumero ohjelmaan
# 1.0.0 # 1.0.0
Ohjelman kieli vaihdettu Pythonista Javaan, sekä tietokanta pickle-tiedostosta SQLite tietokantaan Ohjelman kieli vaihdettu Pythonista Javaan, sekä tietokanta pickle-tiedostosta SQLite tietokantaan
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2026 Lauri Maaninka
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+3 -1
View File
@@ -1,4 +1,6 @@
## [Versiohistoria](CHANGELOG.md) # [LICENSE](LICENSE)
# [Versiohistoria](CHANGELOG.md)
# Kuvaus # Kuvaus
Pienen kotiateriapalvelun käyttöön rakennettu ohjelma sisältäen seuraavat ominaisuudet Pienen kotiateriapalvelun käyttöön rakennettu ohjelma sisältäen seuraavat ominaisuudet
+5 -4
View File
@@ -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.1.1</version> <version>2.0.2</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>
@@ -72,6 +72,7 @@
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@@ -91,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>
@@ -113,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,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,8 +0,0 @@
package fi.lpam.gui.virheDialogit;
public class YhteysVirhe extends TietokantaVirhe{
public YhteysVirhe(Exception error){
this.setHeaderText("Virhe yhdistäessä tietokantaan");
this.setContentText(error.getMessage());
}
}
@@ -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,10 +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);
@@ -39,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;
@@ -64,6 +62,6 @@ public class App extends Application {
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"))));
} }
} }
@@ -1,8 +1,6 @@
package fi.lpam; package fi.lpam.ruokamanageri;
import javax.print.DocFlavor;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
public class Main { public class Main {
@@ -17,12 +15,12 @@ public class Main {
dev = false; dev = false;
} }
InputStream stream = Main.class.getClassLoader().getResourceAsStream("app.properties");
properties = new Properties();
try { try {
properties.load(stream); properties = new Properties();
properties.load(Main.class.getClassLoader().getResourceAsStream("app.properties"));
} }
catch (IOException e) { catch (IOException e) {
//noinspection CallToPrintStackTrace
e.printStackTrace(); e.printStackTrace();
} }
@@ -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;
} }
/** /**
@@ -112,7 +106,7 @@ public class Asiakas implements TietokantaOlio {
} }
/** /**
* Hakee tietokannasta asiakasidn perusteella asiakkaat * Hakee tietokannasta asiakasidn perusteella asiakkaat ja palauttaa ne annetussa järjestyksessä
* @param IDt haettavat asiakkkaat * @param IDt haettavat asiakkkaat
* @return Haetut asiakkaat tai null * @return Haetut asiakkaat tai null
*/ */
@@ -126,7 +120,17 @@ public class Asiakas implements TietokantaOlio {
String sql = "select * from asiakkaat where id in (" + sbIDt + ") order by instr('" + sbIDt + "', id)"; String sql = "select * from asiakkaat where id in (" + sbIDt + ") order by instr('" + sbIDt + "', id)";
Statement stmt = tietokanta.createStatement(); Statement stmt = tietokanta.createStatement();
ResultSet rs = stmt.executeQuery(sql); ResultSet rs = stmt.executeQuery(sql);
return parsiResultSet(rs); ArrayList<Asiakas> asiakkaat = parsiResultSet(rs);
ArrayList<Asiakas> järjestetyt = new ArrayList<Asiakas>();
for (int id : IDt) {
for (Asiakas asiakas : asiakkaat) {
if (asiakas.getId() == id) {
järjestetyt.add(asiakas);
}
}
}
return järjestetyt;
} }
catch (SQLException e) { catch (SQLException e) {
SiirtoVirhe alert = new SiirtoVirhe(e); SiirtoVirhe alert = new SiirtoVirhe(e);
@@ -145,21 +149,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 +187,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 +234,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 +409,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;
}
} }
@@ -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;
@@ -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;
@@ -68,36 +68,6 @@ public class Kuljetus implements TietokantaOlio {
this.ruokarajoite = ruokarajoite; this.ruokarajoite = ruokarajoite;
} }
public static ArrayList<Kuljetus> haeKaikki() {
try (Connection tietokanta = Tietokanta.haeYhteys()) {
Statement stmt = tietokanta.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM kuljetukset;");
return parsiResultSet(rs);
} catch (SQLException e) {
SiirtoVirhe virhe = new SiirtoVirhe(e);
virhe.showAndWait();
return null;
}
}
/**
* Hakee yhden päivän kuljetukset riippumatta kierroksesta
* @param päivä haettava päivä
* @return päivän kuljetukset
*/
public static ArrayList<Kuljetus> haePäivänKuljetukset(LocalDate päivä) {
try (Connection tietokanta = Tietokanta.haeYhteys()) {
PreparedStatement stmt = tietokanta.prepareStatement("SELECT * FROM kuljetukset WHERE kuljetusPäivämäärä = ?;");
stmt.setDate(1, Date.valueOf(päivä));
ResultSet rs = stmt.executeQuery();
return parsiResultSet(rs);
} catch (SQLException e) {
SiirtoVirhe virhe = new SiirtoVirhe(e);
virhe.showAndWait();
return null;
}
}
/** /**
* Hakee tietyn kierroksen kuljetukset * Hakee tietyn kierroksen kuljetukset
* @param päivä kierroksen päivä * @param päivä kierroksen päivä
@@ -117,41 +87,6 @@ public class Kuljetus implements TietokantaOlio {
return null; return null;
} }
} }
/**
* Hakee kuljetukset aikajakson perusteella
*
* @param alku jakson alku (sisältyen)
* @param loppu jakson loppu (sisältyen)
* @return Jakson kuljetukset
*/
public static ArrayList<Kuljetus> haeAikaJakso(LocalDate alku, LocalDate loppu) {
try (Connection tietokanta = Tietokanta.haeYhteys()) {
PreparedStatement stmt = tietokanta.prepareStatement("SELECT * FROM kuljetukset WHERE kuljetusPäivämäärä BETWEEN ? AND ?");
stmt.setDate(1, Date.valueOf(alku));
stmt.setDate(2, Date.valueOf(loppu));
ResultSet rs = stmt.executeQuery();
return parsiResultSet(rs);
} catch (SQLException e) {
SiirtoVirhe virhe = new SiirtoVirhe(e);
virhe.showAndWait();
return null;
}
}
public static ArrayList<Kuljetus> haeAikaJaksollaJaKierroksella(LocalDate alku, LocalDate loppu, int kuljetusKierros) {
try (Connection tietokanta = Tietokanta.haeYhteys()) {
PreparedStatement stmt = tietokanta.prepareStatement("SELECT * FROM kuljetukset WHERE kuljetusKierros = ? and kuljetusPäivämäärä BETWEEN ? AND ?");
stmt.setInt(1, kuljetusKierros);
stmt.setDate(2, Date.valueOf(alku));
stmt.setDate(3, Date.valueOf(loppu));
ResultSet rs = stmt.executeQuery();
return parsiResultSet(rs);
} catch (SQLException e) {
SiirtoVirhe virhe = new SiirtoVirhe(e);
virhe.showAndWait();
return null;
}
}
@Override @Override
public boolean tallennaUusi() { public boolean tallennaUusi() {
@@ -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,4 +1,4 @@
package fi.lpam.dataluokat; package fi.lpam.ruokamanageri.dataluokat;
public interface TietokantaOlio { public interface TietokantaOlio {
@@ -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);
@@ -1,15 +1,20 @@
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.MaaraTableColumn; import fi.lpam.ruokamanageri.gui.elementit.MaaraTableColumn;
import fi.lpam.gui.elementit.TabPohja; 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.File;
import java.io.IOException;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
@@ -33,19 +38,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 File("CHANGELOG.md").toURI());
} catch (IOException 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 +119,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);
@@ -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;
@@ -104,6 +104,7 @@ public class Kierroshallinta extends TabPohja {
int index = 0; int index = 0;
for (int i = 0; i < kierrokset.size();) { for (int i = 0; i < kierrokset.size();) {
Kierros k = kierrokset.get(i); Kierros k = kierrokset.get(i);
k.setAsiakkaat(FXCollections.observableArrayList(new ArrayList<>()));
k.setAsiakkaat(mclv.getColumns().get(index).getItems()); k.setAsiakkaat(mclv.getColumns().get(index).getItems());
index++; index++;
@@ -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;
@@ -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);
@@ -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,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;
@@ -11,14 +11,4 @@ public class IntegerSpinner extends Spinner<Integer> {
super(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 50)); super(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 50));
this.setEditable(true); this.setEditable(true);
} }
/**
*
* @param min _
* @param max _
*/
public IntegerSpinner(int min, int max) {
super(new SpinnerValueFactory.IntegerSpinnerValueFactory(min, max));
this.setEditable(true);
}
} }
@@ -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,4 +1,4 @@
package fi.lpam.gui.elementit; package fi.lpam.ruokamanageri.gui.elementit;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
@@ -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,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,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){
@@ -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,12 +1,11 @@
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;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@SuppressWarnings("DuplicatedCode")
public class KuljetusListaTulostaja extends Tulostaja{ public class KuljetusListaTulostaja extends Tulostaja{
final float NIMEN_LEVEYS = 200; final float NIMEN_LEVEYS = 200;
final float OSOITTEEN_LEVEYS = 200; final float OSOITTEEN_LEVEYS = 200;
@@ -45,8 +44,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) {
@@ -1,24 +1,16 @@
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")
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();
@@ -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;
@@ -15,18 +15,18 @@ import java.awt.print.PrinterJob;
import java.io.IOException; import java.io.IOException;
public abstract class Tulostaja { public abstract class Tulostaja {
PDRectangle SIVUKOKO = PDRectangle.A4; final PDRectangle SIVUKOKO = PDRectangle.A4;
final PDFont FONTTI = new PDType1Font(Standard14Fonts.FontName.HELVETICA); final PDFont FONTTI = new PDType1Font(Standard14Fonts.FontName.HELVETICA);
final float FONTTI_KOKO = 13; final float FONTTI_KOKO = 13;
final float MARGINAALI = 50; final float MARGINAALI = 50;
final float RIVI_KORKEUS = FONTTI_KOKO * 1.2F; final float RIVI_KORKEUS = FONTTI_KOKO * 1.2F;
PDDocument dokumentti; final PDDocument dokumentti;
PDPage nykyinenSivu = null; PDPage nykyinenSivu = null;
PDPageContentStream sisältö = null; PDPageContentStream sisältö = null;
float sivunLeveys; final float sivunLeveys;
float startX; final float startX;
float startY; final float startY;
float yOffset; float yOffset;
float xOffset; float xOffset;
@@ -78,7 +78,7 @@ public abstract class Tulostaja {
uusiRivi(RIVI_KORKEUS); uusiRivi(RIVI_KORKEUS);
} }
/**Siirtää osoitinta sivulla. + oikealle, - vasemmalle*/ /**Siirtää osoitinta sivulla. + oikealle, - vasemmalle*/
void siirräOsoitinta(float tX) { void siirräOsoitinta(@SuppressWarnings("SameParameterValue") float tX) {
try { try {
sisältö.newLineAtOffset(tX, 0); sisältö.newLineAtOffset(tX, 0);
xOffset += tX; xOffset += tX;
+2 -2
View File
@@ -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 -1
View File
@@ -1,2 +1,2 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
Main-Class: fi.lpam.Main Main-Class: fi.lpam.ruokamanageri.Main

Before

Width:  |  Height:  |  Size: 267 KiB

After

Width:  |  Height:  |  Size: 267 KiB

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB