Compare commits
98 Commits
2.0.0
..
69243d9cb2
| Author | SHA1 | Date | |
|---|---|---|---|
| 69243d9cb2 | |||
| 1d4056bc99 | |||
| c676ae8400 | |||
| deb2f49fb6 | |||
| ded6accd29 | |||
| f9e868918c | |||
| f76d4413d4 | |||
| 65b4a7ef9b | |||
| d2e8962f31 | |||
| cc9d9992ce | |||
| 73ad0ff2fa | |||
| d98e6f64d0 | |||
| 53eae9ee3f | |||
| 0618f5cf00 | |||
| b48f9ab7a8 | |||
| f82161d5d3 | |||
| 91d2a35799 | |||
| 997833611c | |||
| b8403211c5 | |||
| 942eab2c04 | |||
| 3846f5c51e | |||
| f65674b9c4 | |||
| 71c65b48d7 | |||
| c755a7b4bd | |||
| b39be9e0e8 | |||
| 89cf179076 | |||
| 1dae32584e | |||
| 4703254619 | |||
| 37f20cf737 | |||
| 5f28c031cf | |||
| 6efec623b1 | |||
| 449876490a | |||
| 2b1c0c03a9 | |||
| bf0dcaae40 | |||
| c3a5ec7a52 | |||
| 1a5dcc78ee | |||
| 1bf2c93cec | |||
| f03cb9bade | |||
| d6913f515a | |||
| 88983b2e43 | |||
| 1d06dfcfc4 | |||
| 6601a588c2 | |||
| fac9334688 | |||
| b129c55260 | |||
| ed963f00e1 | |||
| cd194527e8 | |||
| 0732db2365 | |||
| 1ddb66694f | |||
| bc8aa2fa6a | |||
| 5fd66ec45a | |||
| e83bdee4d0 | |||
| 6455fa453c | |||
| 8cf1d03e5c | |||
| ea49b5cb38 | |||
| f8994ba15b | |||
| 0ab62e26e1 | |||
| 9b6c545138 | |||
| 8d1a0ccf3d | |||
| bf7a102bb2 | |||
| bba6eb3caa | |||
| 36db7d0d93 | |||
| 65bf7d1078 | |||
| 87ba3ebc11 | |||
| ba9369b61a | |||
| d8361d66ee | |||
| 0d7292a302 | |||
| e7f802dad5 | |||
| 2efdf0e79d | |||
| 457d44fa3c | |||
| c69d0c01e6 | |||
| ee438bac8a | |||
| 8c7c14666c | |||
| b7ea2d0065 | |||
| 429bb9df06 | |||
| be744094eb | |||
| f05dfb6b64 | |||
| 51ec3609f3 | |||
| 3a6fa1877d | |||
| 3fbd316fdc | |||
| 38612bdfca | |||
| 1c540420bc | |||
| 6efec93998 | |||
| f8462624c7 | |||
| 72db34007a | |||
| b3e85581e2 | |||
| 2d587b4f15 | |||
| 332b774d66 | |||
| 02a247aae6 | |||
| 3f19b4c5cf | |||
| b9939c671f | |||
| c407b4cb59 | |||
| 1fc82d1b0d | |||
| 884748df85 | |||
| 499db8f4a0 | |||
| 7387c069f5 | |||
| f5d3db26f1 | |||
| 4fa86e24e3 | |||
| 7eddb935dc |
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<profile version="1.0">
|
<profile version="1.0">
|
||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
<inspection_tool class="ExtractMethodRecommender" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="ExtractMethodRecommender" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="minLength" value="735" />
|
<option name="minLength" value="951" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="GrazieInspection" enabled="false" level="GRAMMAR_ERROR" enabled_by_default="false" />
|
<inspection_tool class="GrazieInspection" enabled="false" level="GRAMMAR_ERROR" enabled_by_default="false" />
|
||||||
<inspection_tool class="LanguageDetectionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="LanguageDetectionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
|||||||
+18
-1
@@ -1,4 +1,21 @@
|
|||||||
|
# 3.0.1
|
||||||
|
- Kierroshallinnan muokkaus tukemaan paremmin useampaa kierrosta
|
||||||
|
- Kosmeettisia viilauksia muuallekin
|
||||||
|
|
||||||
|
# 3.0.0
|
||||||
|
- Lisätty lauantai ja sunnuntai mahdollisiksi kuljetuspäiviksi
|
||||||
|
- Mahdollisuus kuljettaa (ja muokata listaa) yli 10 ateriaa per asiakas
|
||||||
|
- Versioloki näkyy taas
|
||||||
|
- Pieniä viilauksia asiakashallinnan näkymään
|
||||||
|
|
||||||
|
# 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
|
# 2.0.0
|
||||||
|
### Palaaminen aiempaan versioon ei tuettu
|
||||||
- Asiakkaalle lisätty tietoihin laskutusosoite ja yhteyshenkilön yhteystiedot
|
- Asiakkaalle lisätty tietoihin laskutusosoite ja yhteyshenkilön yhteystiedot
|
||||||
- Tiedot nousevat kuljetusraportille laskutusta varten
|
- Tiedot nousevat kuljetusraportille laskutusta varten
|
||||||
- Lisätty ohjelmaan linkki muutoslokiin
|
- Lisätty ohjelmaan linkki muutoslokiin
|
||||||
@@ -12,4 +29,4 @@
|
|||||||
- Kierroshallinnassa asiakasta raahattaessa placeholderin fiksaus
|
- Kierroshallinnassa asiakasta raahattaessa placeholderin fiksaus
|
||||||
|
|
||||||
# 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
|
||||||
@@ -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.
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -7,19 +9,18 @@ Pienen kotiateriapalvelun käyttöön rakennettu ohjelma sisältäen seuraavat o
|
|||||||
- Kuljetuslistojen luominen
|
- Kuljetuslistojen luominen
|
||||||
- Kuljetettujen määrien raportointi
|
- Kuljetettujen määrien raportointi
|
||||||
|
|
||||||
## Toteutus
|
# Toteutus
|
||||||
- SQLite tietokanta
|
- SQLite tietokanta
|
||||||
- JavaFX GUI
|
- JavaFX GUI
|
||||||
- Java 25
|
- Java 25
|
||||||
- Maven
|
- Maven
|
||||||
|
|
||||||
## Käyttöönotto
|
# Käyttöönotto
|
||||||
- Vaatimukset
|
- Vaatimukset
|
||||||
- Windows
|
- Windows
|
||||||
- Java 25+
|
- Java 25+
|
||||||
- Usean tietokoneen käyttöön OneDrive -tili (samanaikaisuus ei tuettu)
|
- Usean tietokoneen käyttöön OneDrive -tili (samanaikaisuus ei tuettu)
|
||||||
- Lataa haluamasi julkaisuversio lähdekoodista
|
- Lataa haluamasi ohjelmaversio julkaisuista
|
||||||
- Maven `package` komennolla projektista luodaan .jar tiedosto
|
- Aja .jar tiedosto
|
||||||
- .jar tiedosto sisältää kaikki riippuvuudet
|
- Tietokanta sijaitsee osoitteessa `~/OneDrive/Kuljetusruokasovellus/tietokanta.db`
|
||||||
- Tietokantatiedosto asuu osoitteessa `$KOTIKANSIO/OneDrive/Kuljetusruokasovellus/tietokanta.db`
|
|
||||||
- Ohjelma luo tietokannan, mikäli sitä ei löydy.
|
- Ohjelma luo tietokannan, mikäli sitä ei löydy.
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>fi.lpam.ruokamanageri</groupId>
|
<groupId>fi.lpam.ruokamanageri</groupId>
|
||||||
<artifactId>Ruokamanageri</artifactId>
|
<artifactId>Ruokamanageri</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>3.0.1</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>
|
||||||
@@ -43,24 +43,24 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.dlsc.gemsfx</groupId>
|
<groupId>com.dlsc.gemsfx</groupId>
|
||||||
<artifactId>gemsfx</artifactId>
|
<artifactId>gemsfx</artifactId>
|
||||||
<version>3.10.1</version>
|
<version>4.0.5</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.pdfbox</groupId>
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
<artifactId>pdfbox</artifactId>
|
<artifactId>pdfbox</artifactId>
|
||||||
<version>3.0.6</version>
|
<version>3.0.7</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-logging</groupId>
|
<groupId>commons-logging</groupId>
|
||||||
<artifactId>commons-logging</artifactId>
|
<artifactId>commons-logging</artifactId>
|
||||||
<version>1.3.5</version>
|
<version>1.3.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.51.2.0</version>
|
<version>3.53.1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class Main {
|
|||||||
properties.load(Main.class.getClassLoader().getResourceAsStream("app.properties"));
|
properties.load(Main.class.getClassLoader().getResourceAsStream("app.properties"));
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
//noinspection CallToPrintStackTrace
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,17 @@ package fi.lpam.ruokamanageri.dataluokat;
|
|||||||
import fi.lpam.ruokamanageri.gui.virheDialogit.SiirtoVirhe;
|
import fi.lpam.ruokamanageri.gui.virheDialogit.SiirtoVirhe;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
import java.time.DayOfWeek;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
@SuppressWarnings("DuplicatedCode")
|
@SuppressWarnings("DuplicatedCode")
|
||||||
public class Asiakas implements TietokantaOlio {
|
public class Asiakas implements TietokantaOlio {
|
||||||
private int id = -1;
|
private int id = -1;
|
||||||
private String nimi;
|
private String nimi;
|
||||||
private String osoite;
|
private String osoite;
|
||||||
private int maanantaiKpl, tiistaiKpl, keskiviikkoKpl, torstaiKpl, perjantaiKpl;
|
private int maanantaiKpl, tiistaiKpl, keskiviikkoKpl, torstaiKpl, perjantaiKpl, lauantaiKpl, sunnuntaiKpl;
|
||||||
private int salaatit, pääruoat, jälkiruoat;
|
private int salaatit, pääruoat, jälkiruoat;
|
||||||
private String erityisruokavalio;
|
private String erityisruokavalio;
|
||||||
private String avainTieto;
|
private String avainTieto;
|
||||||
@@ -40,6 +44,8 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
* @param keskiviikkoKpl kuljetettava määrä
|
* @param keskiviikkoKpl kuljetettava määrä
|
||||||
* @param torstaiKpl kuljetettava määrä
|
* @param torstaiKpl kuljetettava määrä
|
||||||
* @param perjantaiKpl kuljetettava määrä
|
* @param perjantaiKpl kuljetettava määrä
|
||||||
|
* @param lauantaiKpl kuljetettava määrä
|
||||||
|
* @param sunnuntaiKpl kuljetettava määrä
|
||||||
* @param salaatit kuljetettava määrä
|
* @param salaatit kuljetettava määrä
|
||||||
* @param pääruoat kuljetettava määrä
|
* @param pääruoat kuljetettava määrä
|
||||||
* @param jälkiruoat kuljetettava määrä
|
* @param jälkiruoat kuljetettava määrä
|
||||||
@@ -59,6 +65,8 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
int keskiviikkoKpl,
|
int keskiviikkoKpl,
|
||||||
int torstaiKpl,
|
int torstaiKpl,
|
||||||
int perjantaiKpl,
|
int perjantaiKpl,
|
||||||
|
int lauantaiKpl,
|
||||||
|
int sunnuntaiKpl,
|
||||||
int salaatit,
|
int salaatit,
|
||||||
int pääruoat,
|
int pääruoat,
|
||||||
int jälkiruoat,
|
int jälkiruoat,
|
||||||
@@ -77,6 +85,8 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
this.keskiviikkoKpl = keskiviikkoKpl;
|
this.keskiviikkoKpl = keskiviikkoKpl;
|
||||||
this.torstaiKpl = torstaiKpl;
|
this.torstaiKpl = torstaiKpl;
|
||||||
this.perjantaiKpl = perjantaiKpl;
|
this.perjantaiKpl = perjantaiKpl;
|
||||||
|
this.lauantaiKpl = lauantaiKpl;
|
||||||
|
this.sunnuntaiKpl = sunnuntaiKpl;
|
||||||
this.salaatit = salaatit;
|
this.salaatit = salaatit;
|
||||||
this.pääruoat = pääruoat;
|
this.pääruoat = pääruoat;
|
||||||
this.jälkiruoat = jälkiruoat;
|
this.jälkiruoat = jälkiruoat;
|
||||||
@@ -106,7 +116,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
|
||||||
*/
|
*/
|
||||||
@@ -117,10 +127,17 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
sbIDt.append(", ").append(IDt[i]);
|
sbIDt.append(", ").append(IDt[i]);
|
||||||
}
|
}
|
||||||
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
try (Connection tietokanta = Tietokanta.haeYhteys()) {
|
||||||
String sql = "select * from asiakkaat where id in (" + sbIDt + ") order by instr('" + sbIDt + "', id)";
|
String sql = "select * from asiakkaat where id in (" + sbIDt + ")";
|
||||||
Statement stmt = tietokanta.createStatement();
|
Statement stmt = tietokanta.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
ResultSet rs = stmt.executeQuery(sql);
|
||||||
return parsiResultSet(rs);
|
|
||||||
|
HashMap<Integer, Asiakas> asiakkaat = new HashMap<>(IDt.length);
|
||||||
|
parsiResultSet(rs).forEach(asiakas -> asiakkaat.put(asiakas.getId(), asiakas));
|
||||||
|
ArrayList<Asiakas> järjestetyt = new ArrayList<>(asiakkaat.size());
|
||||||
|
for (int id : IDt) {
|
||||||
|
järjestetyt.add(asiakkaat.get(id));
|
||||||
|
}
|
||||||
|
return järjestetyt;
|
||||||
}
|
}
|
||||||
catch (SQLException e) {
|
catch (SQLException e) {
|
||||||
SiirtoVirhe alert = new SiirtoVirhe(e);
|
SiirtoVirhe alert = new SiirtoVirhe(e);
|
||||||
@@ -139,26 +156,27 @@ 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(i++),
|
rs.getInt("id"),
|
||||||
rs.getString(i++),
|
rs.getString("nimi"),
|
||||||
rs.getString(i++),
|
rs.getString("osoite"),
|
||||||
rs.getInt(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("lauantaiKpl"),
|
||||||
rs.getInt(i++),
|
rs.getInt("sunnuntaiKpl"),
|
||||||
rs.getInt(i++),
|
rs.getInt("salaatit"),
|
||||||
rs.getString(i++),
|
rs.getInt("pääruoat"),
|
||||||
rs.getString(i++),
|
rs.getInt("jälkiruoat"),
|
||||||
rs.getString(i++),
|
rs.getString("erityisruokavalio"),
|
||||||
rs.getString(i++),
|
rs.getString("avainTieto"),
|
||||||
rs.getString(i++),
|
rs.getString("lisätiedot"),
|
||||||
rs.getString(i++),
|
rs.getString("laskutusOsoite"),
|
||||||
rs.getString(i++)
|
rs.getString("yhteyshenkilönNimi"),
|
||||||
|
rs.getString("yhteyshenkilönPuhelinnumero"),
|
||||||
|
rs.getString("yhteyshenkilönSähköposti")
|
||||||
);
|
);
|
||||||
asiakkaat.add(uusi);
|
asiakkaat.add(uusi);
|
||||||
}
|
}
|
||||||
@@ -177,7 +195,7 @@ 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, laskutusosoite, yhteyshenkilönNimi, yhteyshenkilönPuhelinnumero, yhteyshenkilönSähköposti) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
PreparedStatement stmt = tietokanta.prepareStatement("INSERT INTO asiakkaat (nimi, osoite, maanantaiKpl, tiistaiKpl, keskiviikkoKpl, torstaiKpl, perjantaiKpl, lauantaiKpl, sunnuntaiKpl, salaatit, pääruoat, jälkiruoat, erityisruokavalio, avainTieto, lisätiedot, laskutusosoite, yhteyshenkilönNimi, yhteyshenkilönPuhelinnumero, yhteyshenkilönSähköposti) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
||||||
int i = 1;
|
int i = 1;
|
||||||
stmt.setString(i++, nimi);
|
stmt.setString(i++, nimi);
|
||||||
stmt.setString(i++, osoite);
|
stmt.setString(i++, osoite);
|
||||||
@@ -186,6 +204,8 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
stmt.setInt(i++, keskiviikkoKpl);
|
stmt.setInt(i++, keskiviikkoKpl);
|
||||||
stmt.setInt(i++, torstaiKpl);
|
stmt.setInt(i++, torstaiKpl);
|
||||||
stmt.setInt(i++, perjantaiKpl);
|
stmt.setInt(i++, perjantaiKpl);
|
||||||
|
stmt.setInt(i++, lauantaiKpl);
|
||||||
|
stmt.setInt(i++, sunnuntaiKpl);
|
||||||
stmt.setInt(i++, salaatit);
|
stmt.setInt(i++, salaatit);
|
||||||
stmt.setInt(i++, pääruoat);
|
stmt.setInt(i++, pääruoat);
|
||||||
stmt.setInt(i++, jälkiruoat);
|
stmt.setInt(i++, jälkiruoat);
|
||||||
@@ -224,7 +244,7 @@ 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 = ?, laskutusosoite = ?, yhteyshenkilönNimi = ?, yhteyshenkilönPuhelinnumero = ?, yhteyshenkilönSähköposti = ? WHERE id = ?");
|
PreparedStatement stmt = tietokanta.prepareStatement("UPDATE asiakkaat set nimi = ?, osoite = ?, maanantaiKpl = ?, tiistaiKpl = ?, keskiviikkoKpl = ?, torstaiKpl = ?, perjantaiKpl = ?, lauantaiKpl = ?, sunnuntaiKpl = ?, salaatit = ?, pääruoat = ?, jälkiruoat = ?, erityisruokavalio = ?, avainTieto = ?, lisätiedot = ?, laskutusosoite = ?, yhteyshenkilönNimi = ?, yhteyshenkilönPuhelinnumero = ?, yhteyshenkilönSähköposti = ? WHERE id = ?");
|
||||||
int i = 1;
|
int i = 1;
|
||||||
stmt.setString(i++, nimi);
|
stmt.setString(i++, nimi);
|
||||||
stmt.setString(i++, osoite);
|
stmt.setString(i++, osoite);
|
||||||
@@ -233,6 +253,8 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
stmt.setInt(i++, keskiviikkoKpl);
|
stmt.setInt(i++, keskiviikkoKpl);
|
||||||
stmt.setInt(i++, torstaiKpl);
|
stmt.setInt(i++, torstaiKpl);
|
||||||
stmt.setInt(i++, perjantaiKpl);
|
stmt.setInt(i++, perjantaiKpl);
|
||||||
|
stmt.setInt(i++, lauantaiKpl);
|
||||||
|
stmt.setInt(i++, sunnuntaiKpl);
|
||||||
stmt.setInt(i++, salaatit);
|
stmt.setInt(i++, salaatit);
|
||||||
stmt.setInt(i++, pääruoat);
|
stmt.setInt(i++, pääruoat);
|
||||||
stmt.setInt(i++, jälkiruoat);
|
stmt.setInt(i++, jälkiruoat);
|
||||||
@@ -288,6 +310,33 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
return this.getNimi();
|
return this.getNimi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPäivänSalaatit(LocalDate päivä) {
|
||||||
|
int kerroin = getKuljetusKerroin(päivä);
|
||||||
|
return kerroin * getSalaatit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPäivänPääruoat(LocalDate päivä) {
|
||||||
|
int kerroin = getKuljetusKerroin(päivä);
|
||||||
|
return kerroin * getPääruoat();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPäivänJälkiruoat(LocalDate päivä) {
|
||||||
|
int kerroin = getKuljetusKerroin(päivä);
|
||||||
|
return kerroin * getJälkiruoat();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getKuljetusKerroin(LocalDate päivä) {
|
||||||
|
return switch (päivä.getDayOfWeek()) {
|
||||||
|
case DayOfWeek.MONDAY -> getMaanantaiKpl();
|
||||||
|
case DayOfWeek.TUESDAY -> getTiistaiKpl();
|
||||||
|
case DayOfWeek.WEDNESDAY -> getKeskiviikkoKpl();
|
||||||
|
case DayOfWeek.THURSDAY -> getTorstaiKpl();
|
||||||
|
case DayOfWeek.FRIDAY -> getPerjantaiKpl();
|
||||||
|
case DayOfWeek.SATURDAY -> getLauantaiKpl();
|
||||||
|
case DayOfWeek.SUNDAY -> getSunnuntaiKpl();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -352,6 +401,22 @@ public class Asiakas implements TietokantaOlio {
|
|||||||
this.perjantaiKpl = perjantaiKpl;
|
this.perjantaiKpl = perjantaiKpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLauantaiKpl() {
|
||||||
|
return lauantaiKpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLauantaiKpl(int lauantaiKpl) {
|
||||||
|
this.lauantaiKpl = lauantaiKpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSunnuntaiKpl() {
|
||||||
|
return sunnuntaiKpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSunnuntaiKpl(int sunnuntaiKpl) {
|
||||||
|
this.sunnuntaiKpl = sunnuntaiKpl;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSalaatit() {
|
public int getSalaatit() {
|
||||||
return salaatit;
|
return salaatit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,17 +36,9 @@ public class Kuljetus implements TietokantaOlio {
|
|||||||
this.nimi = asiakas.getNimi();
|
this.nimi = asiakas.getNimi();
|
||||||
this.kuljetusPäivämäärä = pvm;
|
this.kuljetusPäivämäärä = pvm;
|
||||||
this.kuljetusKierros = kuljetusKierros;
|
this.kuljetusKierros = kuljetusKierros;
|
||||||
int kuljetusKerroin = switch (kuljetusPäivämäärä.getDayOfWeek()) {
|
this.salaatit = asiakas.getPäivänSalaatit(pvm);
|
||||||
case MONDAY -> asiakas.getMaanantaiKpl();
|
this.pääruoat = asiakas.getPäivänPääruoat(pvm);
|
||||||
case TUESDAY -> asiakas.getTiistaiKpl();
|
this.jälkiruoat = asiakas.getPäivänJälkiruoat(pvm);
|
||||||
case WEDNESDAY -> asiakas.getKeskiviikkoKpl();
|
|
||||||
case THURSDAY -> asiakas.getTorstaiKpl();
|
|
||||||
case FRIDAY -> asiakas.getPerjantaiKpl();
|
|
||||||
default -> 0;
|
|
||||||
};
|
|
||||||
this.salaatit = kuljetusKerroin * asiakas.getSalaatit();
|
|
||||||
this.pääruoat = kuljetusKerroin * asiakas.getPääruoat();
|
|
||||||
this.jälkiruoat = kuljetusKerroin * asiakas.getJälkiruoat();
|
|
||||||
this.osoite = asiakas.getOsoite();
|
this.osoite = asiakas.getOsoite();
|
||||||
this.avainTieto = asiakas.getAvainTieto();
|
this.avainTieto = asiakas.getAvainTieto();
|
||||||
this.lisätieto = asiakas.getLisätiedot();
|
this.lisätieto = asiakas.getLisätiedot();
|
||||||
@@ -68,36 +60,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 +79,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() {
|
||||||
@@ -291,23 +218,16 @@ public class Kuljetus implements TietokantaOlio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void palautaMäärät(Asiakas asiakas) {
|
public void palautaMäärät(Asiakas asiakas) {
|
||||||
int kuljetusKerroin = switch (kuljetusPäivämäärä.getDayOfWeek()) {
|
setSalaatit(asiakas.getPäivänSalaatit(kuljetusPäivämäärä));
|
||||||
case MONDAY -> asiakas.getMaanantaiKpl();
|
setPääruoat(asiakas.getPäivänPääruoat(kuljetusPäivämäärä));
|
||||||
case TUESDAY -> asiakas.getTiistaiKpl();
|
setJälkiruoat(asiakas.getPäivänJälkiruoat(kuljetusPäivämäärä));
|
||||||
case WEDNESDAY -> asiakas.getKeskiviikkoKpl();
|
|
||||||
case THURSDAY -> asiakas.getTorstaiKpl();
|
|
||||||
case FRIDAY -> asiakas.getPerjantaiKpl();
|
|
||||||
default -> 0;
|
|
||||||
};
|
|
||||||
setSalaatit(asiakas.getSalaatit() * kuljetusKerroin);
|
|
||||||
setPääruoat(asiakas.getPääruoat() * kuljetusKerroin);
|
|
||||||
setJälkiruoat(asiakas.getJälkiruoat() * kuljetusKerroin);
|
|
||||||
setLisätieto(asiakas.getLisätiedot());
|
setLisätieto(asiakas.getLisätiedot());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean kuljetetaan() {
|
public boolean kuljetetaan() {
|
||||||
return salaatit > 0 || pääruoat > 0 || jälkiruoat > 0 || !lisätieto.isBlank();
|
return salaatit > 0 || pääruoat > 0 || jälkiruoat > 0 || !lisätieto.isBlank();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ public class Tietokanta {
|
|||||||
handleException(e);
|
handleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Lisää laskutustiedot asiakastauluun
|
//Lisää kuljetuspäivät asiakassarakkeeseen (v2.0.2->3.x.x)
|
||||||
String[] sarakkeet = {"laskutusosoite", "yhteyshenkilönNimi", "yhteyshenkilönPuhelinnumero", "yhteyshenkilönSähköposti"};
|
String[] sarakkeet = {"lauantaiKpl", "sunnuntaiKpl"};
|
||||||
for (String sarake : sarakkeet) {
|
for (String sarake : sarakkeet) {
|
||||||
try (Connection conn = haeYhteys()) {
|
try (Connection conn = haeYhteys()) {
|
||||||
PreparedStatement stmt = conn.prepareStatement("alter table asiakkaat add column " + sarake + " varchar(255)");
|
PreparedStatement stmt = conn.prepareStatement("alter table asiakkaat add column " + sarake + " int not null default 0");
|
||||||
stmt.execute();
|
stmt.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
if (!e.getMessage().contains("duplicate column name")) {
|
if (!e.getMessage().contains("duplicate column name")) {
|
||||||
|
|||||||
@@ -22,7 +22,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, tfYhteyshenkilönNimi, tfLaskutusOsoite, tfYhteyshenkilönPuhelinnumero, tfYhteyshenkilönSähköposti;
|
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, tfLauantai, tfSunnuntai, tfSalaatit, tfPääruoat, tfJälkiruoat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Luo ikkunan jossa muokataan saatua asiakasta
|
* Luo ikkunan jossa muokataan saatua asiakasta
|
||||||
@@ -30,7 +30,12 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
*/
|
*/
|
||||||
public AsiakasIkkuna(Asiakas käsiteltäväAsiakas) {
|
public AsiakasIkkuna(Asiakas käsiteltäväAsiakas) {
|
||||||
this.käsiteltäväAsiakas = käsiteltäväAsiakas;
|
this.käsiteltäväAsiakas = käsiteltäväAsiakas;
|
||||||
this.setTitle("Asiakasikkuna");
|
if (käsiteltäväAsiakas.getNimi() != null) {
|
||||||
|
this.setTitle(käsiteltäväAsiakas.getNimi());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.setTitle("Uusi asiakas");
|
||||||
|
}
|
||||||
|
|
||||||
TabPane tabPane = new TabPane();
|
TabPane tabPane = new TabPane();
|
||||||
tabPane.setSide(Side.LEFT);
|
tabPane.setSide(Side.LEFT);
|
||||||
@@ -46,22 +51,82 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
default: break;
|
default: break;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
Tab tabAsiakasTiedot, tabLaskutusTiedot;
|
Tab tabKuljetusTiedot, tabAsiakastiedot;
|
||||||
tabAsiakasTiedot = new Tab("Asiakastiedot");
|
tabKuljetusTiedot = new Tab("Kuljetustiedot");
|
||||||
tabLaskutusTiedot = new Tab("Laskutustiedot");
|
tabAsiakastiedot = new Tab("Asiakastiedot");
|
||||||
tabPane.getTabs().addAll(tabAsiakasTiedot, tabLaskutusTiedot);
|
tabPane.getTabs().addAll(tabKuljetusTiedot, tabAsiakastiedot);
|
||||||
for (Tab tab : tabPane.getTabs()) {
|
for (Tab tab : tabPane.getTabs()) {
|
||||||
tab.setClosable(false);
|
tab.setClosable(false);
|
||||||
tab.setStyle("-fx-font-size: 18px; -fx-font-weight: bold; -fx-font-family: Open Sans");
|
tab.setStyle("-fx-font-size: 18px; -fx-font-weight: bold; -fx-font-family: Open Sans");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GridPane kuljetusTiedot = new GridPane();
|
||||||
|
kuljetusTiedot.setPadding(new Insets(15));
|
||||||
|
kuljetusTiedot.setHgap(10);
|
||||||
|
kuljetusTiedot.setVgap(10);
|
||||||
|
tabKuljetusTiedot.setContent(kuljetusTiedot);
|
||||||
|
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), new Label("Määrät per kuljetus"));
|
||||||
|
|
||||||
|
Label salaatit = new Label("Salaatit");
|
||||||
|
tfSalaatit = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), salaatit, tfSalaatit);
|
||||||
|
|
||||||
|
Label pääruoat = new Label("Pääruoat");
|
||||||
|
tfPääruoat = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), pääruoat, tfPääruoat);
|
||||||
|
|
||||||
|
Label jälkiruoat = new Label("Jälkiruoat");
|
||||||
|
tfJälkiruoat = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), jälkiruoat, tfJälkiruoat);
|
||||||
|
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), new Label("Kuljetukset per päivä"));
|
||||||
|
|
||||||
|
Label maanantai = new Label("Maanantai");
|
||||||
|
tfMaanantai = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), maanantai, tfMaanantai);
|
||||||
|
|
||||||
|
Label tiistai = new Label("Tiistai");
|
||||||
|
tfTiistai = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), tiistai, tfTiistai);
|
||||||
|
|
||||||
|
Label keskiviikko = new Label("Keskiviikko");
|
||||||
|
tfKeskiviikko = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), keskiviikko, tfKeskiviikko);
|
||||||
|
|
||||||
|
Label torstai = new Label("Torstai");
|
||||||
|
tfTorstai = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), torstai, tfTorstai);
|
||||||
|
|
||||||
|
Label perjantai = new Label("Perjantai");
|
||||||
|
tfPerjantai = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), perjantai, tfPerjantai);
|
||||||
|
|
||||||
|
tfLauantai = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), new Label("Lauantai"), tfLauantai);
|
||||||
|
|
||||||
|
tfSunnuntai = new IntegerSpinner();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), new Label("Sunnuntai"), tfSunnuntai);
|
||||||
|
|
||||||
|
Label ruokarajoitteet = new Label("Ruokarajoitteet");
|
||||||
|
tfRuokarajoitteet = new TextField();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), ruokarajoitteet, tfRuokarajoitteet);
|
||||||
|
|
||||||
|
Label avainTieto = new Label("Avaintieto");
|
||||||
|
tfAvainTieto = new TextField();
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), avainTieto, tfAvainTieto);
|
||||||
|
|
||||||
|
Label lisätiedot = new Label("Kuljetuksen lisätiedot");
|
||||||
|
tfLisätiedot = new TextField();
|
||||||
|
tfLisätiedot.setPromptText("Näkyy raporteilla");
|
||||||
|
kuljetusTiedot.addRow(kuljetusTiedot.getRowCount(), lisätiedot, tfLisätiedot);
|
||||||
|
|
||||||
|
|
||||||
GridPane asiakasTiedot = new GridPane();
|
GridPane asiakasTiedot = new GridPane();
|
||||||
asiakasTiedot.setPadding(new Insets(15));
|
asiakasTiedot.setPadding(new Insets(15));
|
||||||
asiakasTiedot.setHgap(10);
|
asiakasTiedot.setHgap(10);
|
||||||
asiakasTiedot.setVgap(10);
|
asiakasTiedot.setVgap(10);
|
||||||
tabAsiakasTiedot.setContent(asiakasTiedot);
|
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;");
|
||||||
@@ -75,77 +140,21 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
tfOsoite.setPromptText("Pakollinen tieto");
|
tfOsoite.setPromptText("Pakollinen tieto");
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), osoite, tfOsoite);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), osoite, tfOsoite);
|
||||||
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), new Label("Määrät per kuljetus"));
|
|
||||||
|
|
||||||
Label salaatit = new Label("Salaatit");
|
|
||||||
tfSalaatit = new IntegerSpinner();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), salaatit, tfSalaatit);
|
|
||||||
|
|
||||||
Label pääruoat = new Label("Pääruoat");
|
|
||||||
tfPääruoat = new IntegerSpinner();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), pääruoat, tfPääruoat);
|
|
||||||
|
|
||||||
Label jälkiruoat = new Label("Jälkiruoat");
|
|
||||||
tfJälkiruoat = new IntegerSpinner();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), jälkiruoat, tfJälkiruoat);
|
|
||||||
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), new Label("Kuljetukset per päivä"));
|
|
||||||
|
|
||||||
Label maanantai = new Label("Maanantai");
|
|
||||||
tfMaanantai = new IntegerSpinner();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), maanantai, tfMaanantai);
|
|
||||||
|
|
||||||
Label tiistai = new Label("Tiistai");
|
|
||||||
tfTiistai = new IntegerSpinner();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), tiistai, tfTiistai);
|
|
||||||
|
|
||||||
Label keskiviikko = new Label("Keskiviikko");
|
|
||||||
tfKeskiviikko = new IntegerSpinner();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), keskiviikko, tfKeskiviikko);
|
|
||||||
|
|
||||||
Label torstai = new Label("Torstai");
|
|
||||||
tfTorstai = new IntegerSpinner();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), torstai, tfTorstai);
|
|
||||||
|
|
||||||
Label perjantai = new Label("Perjantai");
|
|
||||||
tfPerjantai = new IntegerSpinner();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), perjantai, tfPerjantai);
|
|
||||||
|
|
||||||
Label ruokarajoitteet = new Label("Ruokarajoitteet");
|
|
||||||
tfRuokarajoitteet = new TextField();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), ruokarajoitteet, tfRuokarajoitteet);
|
|
||||||
|
|
||||||
Label avainTieto = new Label("Avaintieto");
|
|
||||||
tfAvainTieto = new TextField();
|
|
||||||
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), avainTieto, tfAvainTieto);
|
|
||||||
|
|
||||||
Label lisätiedot = new Label("Kuljetuksen lisätiedot");
|
|
||||||
tfLisätiedot = new TextField();
|
|
||||||
tfLisätiedot.setPromptText("Näkyy raporteilla");
|
|
||||||
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");
|
Label yhteyshenkilönNimi = new Label("Yhteyshenkilön etu- ja sukunimi");
|
||||||
tfYhteyshenkilönNimi = new TextField();
|
tfYhteyshenkilönNimi = new TextField();
|
||||||
laskutusTiedot.addRow(laskutusTiedot.getRowCount(), yhteyshenkilönNimi, tfYhteyshenkilönNimi);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), yhteyshenkilönNimi, tfYhteyshenkilönNimi);
|
||||||
|
|
||||||
Label laskutusOsoite = new Label("Laskutusosoite");
|
Label laskutusOsoite = new Label("Laskutusosoite");
|
||||||
tfLaskutusOsoite = new TextField();
|
tfLaskutusOsoite = new TextField();
|
||||||
laskutusTiedot.addRow(laskutusTiedot.getRowCount(), laskutusOsoite, tfLaskutusOsoite);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), laskutusOsoite, tfLaskutusOsoite);
|
||||||
|
|
||||||
Label yhteyshenkilönPuhelinnumero = new Label("Puhelinnumero");
|
Label yhteyshenkilönPuhelinnumero = new Label("Puhelinnumero");
|
||||||
tfYhteyshenkilönPuhelinnumero = new TextField();
|
tfYhteyshenkilönPuhelinnumero = new TextField();
|
||||||
laskutusTiedot.addRow(laskutusTiedot.getRowCount(), yhteyshenkilönPuhelinnumero, tfYhteyshenkilönPuhelinnumero);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), yhteyshenkilönPuhelinnumero, tfYhteyshenkilönPuhelinnumero);
|
||||||
|
|
||||||
Label yhteyshenkilönSähköposti = new Label("Sähköposti");
|
Label yhteyshenkilönSähköposti = new Label("Sähköposti");
|
||||||
tfYhteyshenkilönSähköposti = new TextField();
|
tfYhteyshenkilönSähköposti = new TextField();
|
||||||
laskutusTiedot.addRow(laskutusTiedot.getRowCount(), yhteyshenkilönSähköposti, tfYhteyshenkilönSähköposti);
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), yhteyshenkilönSähköposti, tfYhteyshenkilönSähköposti);
|
||||||
|
|
||||||
HBox napit = new HBox();
|
HBox napit = new HBox();
|
||||||
Button peruuta = new Button("Peruuta");
|
Button peruuta = new Button("Peruuta");
|
||||||
@@ -185,6 +194,8 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
tfKeskiviikko.getValueFactory().setValue(käsiteltäväAsiakas.getKeskiviikkoKpl());
|
tfKeskiviikko.getValueFactory().setValue(käsiteltäväAsiakas.getKeskiviikkoKpl());
|
||||||
tfTorstai.getValueFactory().setValue(käsiteltäväAsiakas.getTorstaiKpl());
|
tfTorstai.getValueFactory().setValue(käsiteltäväAsiakas.getTorstaiKpl());
|
||||||
tfPerjantai.getValueFactory().setValue(käsiteltäväAsiakas.getPerjantaiKpl());
|
tfPerjantai.getValueFactory().setValue(käsiteltäväAsiakas.getPerjantaiKpl());
|
||||||
|
tfLauantai.getValueFactory().setValue(käsiteltäväAsiakas.getLauantaiKpl());
|
||||||
|
tfSunnuntai.getValueFactory().setValue(käsiteltäväAsiakas.getSunnuntaiKpl());
|
||||||
tfSalaatit.getValueFactory().setValue(käsiteltäväAsiakas.getSalaatit());
|
tfSalaatit.getValueFactory().setValue(käsiteltäväAsiakas.getSalaatit());
|
||||||
tfPääruoat.getValueFactory().setValue(käsiteltäväAsiakas.getPääruoat());
|
tfPääruoat.getValueFactory().setValue(käsiteltäväAsiakas.getPääruoat());
|
||||||
tfJälkiruoat.getValueFactory().setValue(käsiteltäväAsiakas.getJälkiruoat());
|
tfJälkiruoat.getValueFactory().setValue(käsiteltäväAsiakas.getJälkiruoat());
|
||||||
@@ -218,6 +229,8 @@ public class AsiakasIkkuna extends Stage {
|
|||||||
käsiteltäväAsiakas.setKeskiviikkoKpl(tfKeskiviikko.getValue());
|
käsiteltäväAsiakas.setKeskiviikkoKpl(tfKeskiviikko.getValue());
|
||||||
käsiteltäväAsiakas.setTorstaiKpl(tfTorstai.getValue());
|
käsiteltäväAsiakas.setTorstaiKpl(tfTorstai.getValue());
|
||||||
käsiteltäväAsiakas.setPerjantaiKpl(tfPerjantai.getValue());
|
käsiteltäväAsiakas.setPerjantaiKpl(tfPerjantai.getValue());
|
||||||
|
käsiteltäväAsiakas.setLauantaiKpl(tfLauantai.getValue());
|
||||||
|
käsiteltäväAsiakas.setSunnuntaiKpl(tfSunnuntai.getValue());
|
||||||
käsiteltäväAsiakas.setSalaatit(tfSalaatit.getValue());
|
käsiteltäväAsiakas.setSalaatit(tfSalaatit.getValue());
|
||||||
käsiteltäväAsiakas.setPääruoat(tfPääruoat.getValue());
|
käsiteltäväAsiakas.setPääruoat(tfPääruoat.getValue());
|
||||||
käsiteltäväAsiakas.setJälkiruoat(tfJälkiruoat.getValue());
|
käsiteltäväAsiakas.setJälkiruoat(tfJälkiruoat.getValue());
|
||||||
@@ -246,7 +259,14 @@ 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() +
|
||||||
|
käsiteltäväAsiakas.getLauantaiKpl() +
|
||||||
|
käsiteltäväAsiakas.getSunnuntaiKpl();
|
||||||
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||||
alert.setTitle("Onnistuimme!");
|
alert.setTitle("Onnistuimme!");
|
||||||
alert.setHeaderText("Asiakkaan tallentaminen onnistui!");
|
alert.setHeaderText("Asiakkaan tallentaminen onnistui!");
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package fi.lpam.ruokamanageri.gui;
|
package fi.lpam.ruokamanageri.gui;
|
||||||
|
|
||||||
import fi.lpam.ruokamanageri.Main;
|
|
||||||
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
import fi.lpam.ruokamanageri.gui.elementit.MaaraTableColumn;
|
import fi.lpam.ruokamanageri.gui.elementit.MaaraTableColumn;
|
||||||
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
||||||
@@ -14,11 +13,10 @@ import javafx.scene.input.MouseEvent;
|
|||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -42,7 +40,7 @@ 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");
|
Button avaaVersioloki = new Button("VERSIOLOKI");
|
||||||
avaaVersioloki.setFont(buttonFont);
|
avaaVersioloki.setFont(buttonFont);
|
||||||
avaaVersioloki.setOnAction(_ -> {
|
avaaVersioloki.setOnAction(_ -> {
|
||||||
try {
|
try {
|
||||||
@@ -85,63 +83,68 @@ public class Asiakashallinta extends TabPohja {
|
|||||||
});
|
});
|
||||||
root.setCenter(tvAsiakkaat);
|
root.setCenter(tvAsiakkaat);
|
||||||
|
|
||||||
|
TableColumn<Asiakas, String> tcId = new TableColumn<>("Id");
|
||||||
|
tcId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||||
TableColumn<Asiakas, String> tcNimi = new TableColumn<>("Nimi");
|
TableColumn<Asiakas, String> tcNimi = new TableColumn<>("Nimi");
|
||||||
tcNimi.setMinWidth(180);
|
|
||||||
tcNimi.setCellValueFactory(new PropertyValueFactory<>("nimi"));
|
tcNimi.setCellValueFactory(new PropertyValueFactory<>("nimi"));
|
||||||
TableColumn<Asiakas, String> tcOsoite = new TableColumn<>("Osoite");
|
TableColumn<Asiakas, String> tcOsoite = new TableColumn<>("Osoite");
|
||||||
tcOsoite.setMinWidth(250);
|
|
||||||
tcOsoite.setCellValueFactory(new PropertyValueFactory<>("osoite"));
|
tcOsoite.setCellValueFactory(new PropertyValueFactory<>("osoite"));
|
||||||
|
|
||||||
|
int minWidth = 40;
|
||||||
TableColumn<Asiakas, MaaraTableColumn<Asiakas, Integer>> tcKuljetuspäivät = new TableColumn<>("Kuljetukset per päivä");
|
TableColumn<Asiakas, MaaraTableColumn<Asiakas, Integer>> tcKuljetuspäivät = new TableColumn<>("Kuljetukset per päivä");
|
||||||
MaaraTableColumn<Asiakas, Integer> tcMaanantaiKpl = new MaaraTableColumn<>("MA", 20);
|
MaaraTableColumn<Asiakas, Integer> tcMaanantaiKpl = new MaaraTableColumn<>("MA", minWidth);
|
||||||
tcMaanantaiKpl.setCellValueFactory(new PropertyValueFactory<>("maanantaiKpl"));
|
tcMaanantaiKpl.setCellValueFactory(new PropertyValueFactory<>("maanantaiKpl"));
|
||||||
MaaraTableColumn<Asiakas, Integer> tcTiistaiKpl = new MaaraTableColumn<>("TI", 20);
|
MaaraTableColumn<Asiakas, Integer> tcTiistaiKpl = new MaaraTableColumn<>("TI", minWidth);
|
||||||
tcTiistaiKpl.setCellValueFactory(new PropertyValueFactory<>("tiistaiKpl"));
|
tcTiistaiKpl.setCellValueFactory(new PropertyValueFactory<>("tiistaiKpl"));
|
||||||
MaaraTableColumn<Asiakas, Integer> tcKeskiviikkoKpl = new MaaraTableColumn<>("KE", 20);
|
MaaraTableColumn<Asiakas, Integer> tcKeskiviikkoKpl = new MaaraTableColumn<>("KE", minWidth);
|
||||||
tcKeskiviikkoKpl.setCellValueFactory(new PropertyValueFactory<>("keskiviikkoKpl"));
|
tcKeskiviikkoKpl.setCellValueFactory(new PropertyValueFactory<>("keskiviikkoKpl"));
|
||||||
MaaraTableColumn<Asiakas, Integer> tcTorstaiKpl = new MaaraTableColumn<>("TO", 20);
|
MaaraTableColumn<Asiakas, Integer> tcTorstaiKpl = new MaaraTableColumn<>("TO", minWidth);
|
||||||
tcTorstaiKpl.setCellValueFactory(new PropertyValueFactory<>("torstaiKpl"));
|
tcTorstaiKpl.setCellValueFactory(new PropertyValueFactory<>("torstaiKpl"));
|
||||||
MaaraTableColumn<Asiakas, Integer> tcPerjantaiKpl = new MaaraTableColumn<>("PE", 20);
|
MaaraTableColumn<Asiakas, Integer> tcPerjantaiKpl = new MaaraTableColumn<>("PE", minWidth);
|
||||||
tcPerjantaiKpl.setCellValueFactory(new PropertyValueFactory<>("perjantaiKpl"));
|
tcPerjantaiKpl.setCellValueFactory(new PropertyValueFactory<>("perjantaiKpl"));
|
||||||
tcKuljetuspäivät.getColumns().addAll(tcMaanantaiKpl, tcTiistaiKpl, tcKeskiviikkoKpl, tcTorstaiKpl, tcPerjantaiKpl);
|
MaaraTableColumn<Asiakas, Integer> tcLauantaiKpl = new MaaraTableColumn<>("LA", minWidth);
|
||||||
|
tcLauantaiKpl.setCellValueFactory(new PropertyValueFactory<>("lauantaiKpl"));
|
||||||
|
MaaraTableColumn<Asiakas, Integer> tcSunnuntaiKpl = new MaaraTableColumn<>("SU", minWidth);
|
||||||
|
tcSunnuntaiKpl.setCellValueFactory(new PropertyValueFactory<>("sunnuntaiKpl"));
|
||||||
|
tcKuljetuspäivät.getColumns().addAll(tcMaanantaiKpl, tcTiistaiKpl, tcKeskiviikkoKpl, tcTorstaiKpl, tcPerjantaiKpl, tcLauantaiKpl, tcSunnuntaiKpl);
|
||||||
|
|
||||||
TableColumn<Asiakas, MaaraTableColumn<Asiakas, Integer>> tcKuljetusmäärät = new TableColumn<>("Määrät per kuljetus");
|
TableColumn<Asiakas, MaaraTableColumn<Asiakas, Integer>> tcKuljetusmäärät = new TableColumn<>("Määrät per kuljetus");
|
||||||
MaaraTableColumn<Asiakas, Integer> tcSalaatit = new MaaraTableColumn<>("Salaatit", 90);
|
MaaraTableColumn<Asiakas, Integer> tcSalaatit = new MaaraTableColumn<>("Salaatit", minWidth, 150);
|
||||||
tcSalaatit.setCellValueFactory(new PropertyValueFactory<>("salaatit"));
|
tcSalaatit.setCellValueFactory(new PropertyValueFactory<>("salaatit"));
|
||||||
MaaraTableColumn<Asiakas, Integer> tcPääruoat = new MaaraTableColumn<>("Pääruoat", 90);
|
MaaraTableColumn<Asiakas, Integer> tcPääruoat = new MaaraTableColumn<>("Pääruoat", minWidth, 150);
|
||||||
tcPääruoat.setCellValueFactory(new PropertyValueFactory<>("pääruoat"));
|
tcPääruoat.setCellValueFactory(new PropertyValueFactory<>("pääruoat"));
|
||||||
MaaraTableColumn<Asiakas, Integer> tcJälkiruoat = new MaaraTableColumn<>("Jälkiruoat", 90);
|
MaaraTableColumn<Asiakas, Integer> tcJälkiruoat = new MaaraTableColumn<>("Jälkiruoat", minWidth, 150);
|
||||||
tcJälkiruoat.setCellValueFactory(new PropertyValueFactory<>("jälkiruoat"));
|
tcJälkiruoat.setCellValueFactory(new PropertyValueFactory<>("jälkiruoat"));
|
||||||
tcKuljetusmäärät.getColumns().addAll(tcSalaatit, tcPääruoat, tcJälkiruoat);
|
tcKuljetusmäärät.getColumns().addAll(tcSalaatit, tcPääruoat, tcJälkiruoat);
|
||||||
|
|
||||||
TableColumn<Asiakas, String> tcErityisruokavalio = new TableColumn<>("Ruokarajoitteet");
|
TableColumn<Asiakas, String> tcErityisruokavalio = new TableColumn<>("Ruokarajoitteet");
|
||||||
tcErityisruokavalio.setMinWidth(150);
|
// tcErityisruokavalio.setMinWidth(150);
|
||||||
tcErityisruokavalio.setCellValueFactory(new PropertyValueFactory<>("erityisruokavalio"));
|
tcErityisruokavalio.setCellValueFactory(new PropertyValueFactory<>("erityisruokavalio"));
|
||||||
TableColumn<Asiakas, String> tcAvainTieto = new TableColumn<>("Avaintieto");
|
TableColumn<Asiakas, String> tcAvainTieto = new TableColumn<>("Avaintieto");
|
||||||
tcAvainTieto.setMinWidth(150);
|
// tcAvainTieto.setMinWidth(150);
|
||||||
tcAvainTieto.setCellValueFactory(new PropertyValueFactory<>("avainTieto"));
|
tcAvainTieto.setCellValueFactory(new PropertyValueFactory<>("avainTieto"));
|
||||||
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ö");
|
TableColumn<Asiakas, String> tcYhteyshenkilönNimi = new TableColumn<>("Yhteyshenkilö");
|
||||||
tcYhteyshenkilönNimi.setMinWidth(250);
|
// tcYhteyshenkilönNimi.setMinWidth(250);
|
||||||
tcYhteyshenkilönNimi.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönNimi"));
|
tcYhteyshenkilönNimi.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönNimi"));
|
||||||
TableColumn<Asiakas, String> tcLaskutusOsoite = new TableColumn<>("Laskutusosoite");
|
TableColumn<Asiakas, String> tcLaskutusOsoite = new TableColumn<>("Laskutusosoite");
|
||||||
tcLaskutusOsoite.setMinWidth(250);
|
// tcLaskutusOsoite.setMinWidth(250);
|
||||||
tcLaskutusOsoite.setCellValueFactory(new PropertyValueFactory<>("laskutusOsoite"));
|
tcLaskutusOsoite.setCellValueFactory(new PropertyValueFactory<>("laskutusOsoite"));
|
||||||
TableColumn<Asiakas, String> tcYhteyshenkilönPuhelinnumero = new TableColumn<>("Yhteyshenkilön puhelinnumero");
|
TableColumn<Asiakas, String> tcYhteyshenkilönPuhelinnumero = new TableColumn<>("Yhteyshenkilön puhelinnumero");
|
||||||
tcYhteyshenkilönPuhelinnumero.setMinWidth(250);
|
// tcYhteyshenkilönPuhelinnumero.setMinWidth(250);
|
||||||
tcYhteyshenkilönPuhelinnumero.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönPuhelinnumero"));
|
tcYhteyshenkilönPuhelinnumero.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönPuhelinnumero"));
|
||||||
TableColumn<Asiakas, String> tcYhteyshenkilönSähköposti = new TableColumn<>("Yhteyshenkilön sähköposti");
|
TableColumn<Asiakas, String> tcYhteyshenkilönSähköposti = new TableColumn<>("Yhteyshenkilön sähköposti");
|
||||||
tcYhteyshenkilönSähköposti.setMinWidth(250);
|
// tcYhteyshenkilönSähköposti.setMinWidth(250);
|
||||||
tcYhteyshenkilönSähköposti.setCellValueFactory(new PropertyValueFactory<>("yhteyshenkilönSähköposti"));
|
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(tcId, tcNimi, tcOsoite, tcKuljetuspäivät, tcKuljetusmäärät, tcErityisruokavalio, tcAvainTieto, tcLisätiedot, tcYhteyshenkilönNimi, tcLaskutusOsoite, tcYhteyshenkilönPuhelinnumero, tcYhteyshenkilönSähköposti);
|
||||||
|
|
||||||
for (TableColumn<Asiakas, ?> column : tvAsiakkaat.getColumns()) {
|
for (TableColumn<Asiakas, ?> column : tvAsiakkaat.getColumns()) {
|
||||||
column.setEditable(false);
|
column.setEditable(false);
|
||||||
column.setReorderable(false);
|
column.setReorderable(false);
|
||||||
column.setResizable(false);
|
column.setResizable(true);
|
||||||
column.setStyle("-fx-alignment: CENTER; -fx-font-size: 16px;");
|
column.setStyle("-fx-alignment: CENTER; -fx-font-size: 16px;");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import javafx.collections.ObservableList;
|
|||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
|
|
||||||
@@ -47,7 +48,10 @@ public class Kierroshallinta extends TabPohja {
|
|||||||
yläpalkki.setRight(yläpalkinNapit);
|
yläpalkki.setRight(yläpalkinNapit);
|
||||||
|
|
||||||
Button lisääKierros = new Button("Lisää uusi kierros");
|
Button lisääKierros = new Button("Lisää uusi kierros");
|
||||||
lisääKierros.setOnAction(_ -> lisaaKierros());
|
lisääKierros.setOnAction(_ -> {
|
||||||
|
int uudenKierroksenNumero = mclv.getColumns().size();
|
||||||
|
lisaaKierros(new Kierros(uudenKierroksenNumero, FXCollections.observableArrayList(new ArrayList<>())));
|
||||||
|
});
|
||||||
lisääKierros.setFont(TabPohja.buttonFont);
|
lisääKierros.setFont(TabPohja.buttonFont);
|
||||||
yläpalkinNapit.getChildren().add(lisääKierros);
|
yläpalkinNapit.getChildren().add(lisääKierros);
|
||||||
|
|
||||||
@@ -67,14 +71,11 @@ public class Kierroshallinta extends TabPohja {
|
|||||||
HashSet<Integer> kierroksellaOlevatAsiakasIDt = new HashSet<>();
|
HashSet<Integer> kierroksellaOlevatAsiakasIDt = new HashSet<>();
|
||||||
|
|
||||||
if (!kierrokset.isEmpty()) {
|
if (!kierrokset.isEmpty()) {
|
||||||
for (Kierros k : kierrokset) {
|
for (Kierros kierros : kierrokset) {
|
||||||
MultiColumnListView.ListViewColumn<Asiakas> sarake = new MultiColumnListView.ListViewColumn<>();
|
lisaaKierros(kierros);
|
||||||
sarake.setHeader(new Label("Kierros " + k.getKierrosNumero()));
|
for (Asiakas asiakas : kierros.getAsiakkaat()) {
|
||||||
sarake.setItems(k.getAsiakkaat());
|
|
||||||
for (Asiakas asiakas : k.getAsiakkaat()) {
|
|
||||||
kierroksellaOlevatAsiakasIDt.add(asiakas.getId());
|
kierroksellaOlevatAsiakasIDt.add(asiakas.getId());
|
||||||
}
|
}
|
||||||
mclv.getColumns().add(sarake);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,14 +90,12 @@ public class Kierroshallinta extends TabPohja {
|
|||||||
mclv.getColumns().add(colEiKierroksella);
|
mclv.getColumns().add(colEiKierroksella);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lisaaKierros() {
|
private void lisaaKierros(Kierros kierros) {
|
||||||
int uudenKierroksenNumero = mclv.getColumns().size();
|
if (kierros.getId() == -1) kierrokset.add(kierros);
|
||||||
Kierros lisättäväKierros = new Kierros(uudenKierroksenNumero, FXCollections.observableArrayList(new ArrayList<>()));
|
|
||||||
kierrokset.add(lisättäväKierros);
|
|
||||||
MultiColumnListView.ListViewColumn<Asiakas> uusiSarake = new MultiColumnListView.ListViewColumn<>();
|
MultiColumnListView.ListViewColumn<Asiakas> uusiSarake = new MultiColumnListView.ListViewColumn<>();
|
||||||
uusiSarake.setHeader(new Label("Kierros " + uudenKierroksenNumero));
|
uusiSarake.setHeader(new Label("Kierros " + kierros.getKierrosNumero()));
|
||||||
uusiSarake.setItems(lisättäväKierros.getAsiakkaat());
|
uusiSarake.setItems(kierros.getAsiakkaat());
|
||||||
mclv.getColumns().add(uudenKierroksenNumero-1, uusiSarake);
|
mclv.getColumns().add(kierros.getKierrosNumero()-1, uusiSarake);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tallennaKierrokset() {
|
private void tallennaKierrokset() {
|
||||||
@@ -104,6 +103,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++;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ package fi.lpam.ruokamanageri.gui;
|
|||||||
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
import fi.lpam.ruokamanageri.dataluokat.Kierros;
|
import fi.lpam.ruokamanageri.dataluokat.Kierros;
|
||||||
import fi.lpam.ruokamanageri.dataluokat.Kuljetus;
|
import fi.lpam.ruokamanageri.dataluokat.Kuljetus;
|
||||||
import fi.lpam.ruokamanageri.gui.elementit.KuljetaTableCell;
|
import fi.lpam.ruokamanageri.gui.tableCell.IntegerFieldTableCellFactory;
|
||||||
|
import fi.lpam.ruokamanageri.gui.tableCell.KuljetaTableCell;
|
||||||
import fi.lpam.ruokamanageri.tulostajat.KuljetusListaTulostaja;
|
import fi.lpam.ruokamanageri.tulostajat.KuljetusListaTulostaja;
|
||||||
import fi.lpam.ruokamanageri.gui.elementit.MaaraTableColumn;
|
import fi.lpam.ruokamanageri.gui.elementit.MaaraTableColumn;
|
||||||
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
import fi.lpam.ruokamanageri.gui.elementit.TabPohja;
|
||||||
@@ -13,7 +14,6 @@ import javafx.collections.FXCollections;
|
|||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.cell.ChoiceBoxTableCell;
|
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
@@ -109,17 +109,17 @@ public class KuljetusListat extends TabPohja {
|
|||||||
tcOsoite.setOnEditCommit((TableColumn.CellEditEvent<Kuljetus, String> event) -> {event.getTableView().getItems().get(event.getTablePosition().getRow()).setOsoite(event.getNewValue()); tallennusStatus.setText("Tallennettu: Ei");});
|
tcOsoite.setOnEditCommit((TableColumn.CellEditEvent<Kuljetus, String> event) -> {event.getTableView().getItems().get(event.getTablePosition().getRow()).setOsoite(event.getNewValue()); tallennusStatus.setText("Tallennettu: Ei");});
|
||||||
|
|
||||||
TableColumn<Kuljetus, Integer> tcSalaatit = new MaaraTableColumn<>("Salaatit", 100);
|
TableColumn<Kuljetus, Integer> tcSalaatit = new MaaraTableColumn<>("Salaatit", 100);
|
||||||
tcSalaatit.setCellFactory(ChoiceBoxTableCell.forTableColumn(määräVaihtoehdot));
|
tcSalaatit.setCellFactory(new IntegerFieldTableCellFactory<>());
|
||||||
tcSalaatit.setCellValueFactory(new PropertyValueFactory<>("salaatit"));
|
tcSalaatit.setCellValueFactory(new PropertyValueFactory<>("salaatit"));
|
||||||
tcSalaatit.setOnEditCommit((TableColumn.CellEditEvent<Kuljetus, Integer> event) -> {event.getTableView().getItems().get(event.getTablePosition().getRow()).setSalaatit(event.getNewValue()); tallennusStatus.setText("Tallennettu: Ei");});
|
tcSalaatit.setOnEditCommit((TableColumn.CellEditEvent<Kuljetus, Integer> event) -> {event.getTableView().getItems().get(event.getTablePosition().getRow()).setSalaatit(event.getNewValue()); tallennusStatus.setText("Tallennettu: Ei");});
|
||||||
|
|
||||||
TableColumn<Kuljetus, Integer> tcPääruoat = new MaaraTableColumn<>("Pääruoat", 100);
|
TableColumn<Kuljetus, Integer> tcPääruoat = new MaaraTableColumn<>("Pääruoat", 100);
|
||||||
tcPääruoat.setCellFactory(ChoiceBoxTableCell.forTableColumn(määräVaihtoehdot));
|
tcPääruoat.setCellFactory(new IntegerFieldTableCellFactory<>());
|
||||||
tcPääruoat.setCellValueFactory(new PropertyValueFactory<>("pääruoat"));
|
tcPääruoat.setCellValueFactory(new PropertyValueFactory<>("pääruoat"));
|
||||||
tcPääruoat.setOnEditCommit((TableColumn.CellEditEvent<Kuljetus, Integer> event) -> {event.getTableView().getItems().get(event.getTablePosition().getRow()).setPääruoat(event.getNewValue()); tallennusStatus.setText("Tallennettu: Ei");});
|
tcPääruoat.setOnEditCommit((TableColumn.CellEditEvent<Kuljetus, Integer> event) -> {event.getTableView().getItems().get(event.getTablePosition().getRow()).setPääruoat(event.getNewValue()); tallennusStatus.setText("Tallennettu: Ei");});
|
||||||
|
|
||||||
TableColumn<Kuljetus, Integer> tcJälkiruoat = new MaaraTableColumn<>("Jälkiruoat", 100);
|
TableColumn<Kuljetus, Integer> tcJälkiruoat = new MaaraTableColumn<>("Jälkiruoat", 100);
|
||||||
tcJälkiruoat.setCellFactory(ChoiceBoxTableCell.forTableColumn(määräVaihtoehdot));
|
tcJälkiruoat.setCellFactory(new IntegerFieldTableCellFactory<>());
|
||||||
tcJälkiruoat.setCellValueFactory(new PropertyValueFactory<>("jälkiruoat"));
|
tcJälkiruoat.setCellValueFactory(new PropertyValueFactory<>("jälkiruoat"));
|
||||||
tcJälkiruoat.setOnEditCommit((TableColumn.CellEditEvent<Kuljetus, Integer> event) -> {event.getTableView().getItems().get(event.getTablePosition().getRow()).setJälkiruoat(event.getNewValue()); tallennusStatus.setText("Tallennettu: Ei");});
|
tcJälkiruoat.setOnEditCommit((TableColumn.CellEditEvent<Kuljetus, Integer> event) -> {event.getTableView().getItems().get(event.getTablePosition().getRow()).setJälkiruoat(event.getNewValue()); tallennusStatus.setText("Tallennettu: Ei");});
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package fi.lpam.ruokamanageri.gui;
|
|||||||
|
|
||||||
import fi.lpam.ruokamanageri.dataluokat.RaporttiRivi;
|
import fi.lpam.ruokamanageri.dataluokat.RaporttiRivi;
|
||||||
import fi.lpam.ruokamanageri.tulostajat.KuljetusRaporttiTulostaja;
|
import fi.lpam.ruokamanageri.tulostajat.KuljetusRaporttiTulostaja;
|
||||||
import fi.lpam.ruokamanageri.gui.elementit.PaivamaaraTableCell;
|
import fi.lpam.ruokamanageri.gui.tableCell.PaivamaaraTableCell;
|
||||||
import fi.lpam.ruokamanageri.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;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.dlsc.gemsfx.MultiColumnListView;
|
|||||||
import fi.lpam.ruokamanageri.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;
|
||||||
@@ -14,12 +15,10 @@ import javafx.scene.layout.VBox;
|
|||||||
public class AsiakasListCell extends MultiColumnListView.ColumnListCell<Asiakas> {
|
public class AsiakasListCell extends MultiColumnListView.ColumnListCell<Asiakas> {
|
||||||
private final StackPane wrapper;
|
private final StackPane wrapper;
|
||||||
|
|
||||||
public AsiakasListCell(MultiColumnListView multiColumnListView) {
|
public AsiakasListCell(MultiColumnListView<Asiakas> multiColumnListView) {
|
||||||
//noinspection unchecked
|
|
||||||
super(multiColumnListView);
|
super(multiColumnListView);
|
||||||
this.setHeight(150);
|
this.setMinHeight(60);
|
||||||
this.setPrefHeight(50);
|
this.setMaxHeight(60);
|
||||||
|
|
||||||
|
|
||||||
VBox content = new VBox();
|
VBox content = new VBox();
|
||||||
content.visibleProperty().bind(placeholder.not().and(emptyProperty().not()));
|
content.visibleProperty().bind(placeholder.not().and(emptyProperty().not()));
|
||||||
@@ -30,9 +29,11 @@ public class AsiakasListCell extends MultiColumnListView.ColumnListCell<Asiakas>
|
|||||||
contentPlaceholder.managedProperty().bind(placeholder);
|
contentPlaceholder.managedProperty().bind(placeholder);
|
||||||
|
|
||||||
Label label = new Label();
|
Label label = new Label();
|
||||||
|
label.setFont(TabPohja.tekstiFont);
|
||||||
label.textProperty().bind(textProperty());
|
label.textProperty().bind(textProperty());
|
||||||
|
|
||||||
wrapper = new StackPane(content, contentPlaceholder, label);
|
wrapper = new StackPane(content, contentPlaceholder, label);
|
||||||
|
wrapper.setAlignment(Pos.CENTER_LEFT);
|
||||||
setGraphic(wrapper);
|
setGraphic(wrapper);
|
||||||
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
|
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
|
||||||
}
|
}
|
||||||
@@ -59,7 +60,7 @@ public class AsiakasListCell extends MultiColumnListView.ColumnListCell<Asiakas>
|
|||||||
placeholder.set(true);
|
placeholder.set(true);
|
||||||
setText("");
|
setText("");
|
||||||
} else {
|
} else {
|
||||||
setText(asiakas.getNimi() + ": " + asiakas.getOsoite());
|
setText(asiakas.getNimi() + "\n" + asiakas.getOsoite());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setText("");
|
setText("");
|
||||||
|
|||||||
@@ -4,21 +4,8 @@ import javafx.scene.control.Spinner;
|
|||||||
import javafx.scene.control.SpinnerValueFactory;
|
import javafx.scene.control.SpinnerValueFactory;
|
||||||
|
|
||||||
public class IntegerSpinner extends Spinner<Integer> {
|
public class IntegerSpinner extends Spinner<Integer> {
|
||||||
/**
|
|
||||||
* Min 0, Max 50
|
|
||||||
*/
|
|
||||||
public IntegerSpinner() {
|
public IntegerSpinner() {
|
||||||
super(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 50));
|
super(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 500));
|
||||||
this.setEditable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param min _
|
|
||||||
* @param max _
|
|
||||||
*/
|
|
||||||
public IntegerSpinner(int min, int max) {
|
|
||||||
super(new SpinnerValueFactory.IntegerSpinnerValueFactory(min, max));
|
|
||||||
this.setEditable(true);
|
this.setEditable(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,17 @@ package fi.lpam.ruokamanageri.gui.elementit;
|
|||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
|
|
||||||
public class MaaraTableColumn<Asiakas, Integer> extends TableColumn<Asiakas, Integer> {
|
public class MaaraTableColumn<Asiakas, Integer> extends TableColumn<Asiakas, Integer> {
|
||||||
public MaaraTableColumn(String columnLabel, int minWidth) {
|
public MaaraTableColumn(String columnLabel, int minWidth, int maxWidth) {
|
||||||
super(columnLabel);
|
super(columnLabel);
|
||||||
this.setResizable(false);
|
this.setResizable(true);
|
||||||
this.setReorderable(false);
|
this.setReorderable(false);
|
||||||
this.setMinWidth(minWidth);
|
this.setMinWidth(minWidth);
|
||||||
|
this.setMaxWidth(maxWidth);
|
||||||
|
this.setStyle("-fx-alignment: CENTER; -fx-font-size: 16px;");
|
||||||
|
}
|
||||||
|
|
||||||
|
public MaaraTableColumn(String columnLabel, int width) {
|
||||||
|
this(columnLabel, width, width);
|
||||||
|
this.setResizable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package fi.lpam.ruokamanageri.gui.tableCell;
|
||||||
|
|
||||||
|
import javafx.scene.control.TableCell;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
|
import javafx.scene.input.KeyEvent;
|
||||||
|
import javafx.util.Callback;
|
||||||
|
import javafx.util.converter.IntegerStringConverter;
|
||||||
|
|
||||||
|
public class IntegerFieldTableCellFactory<T> implements Callback<TableColumn<T, Integer>, TableCell<T, Integer>> {
|
||||||
|
@Override
|
||||||
|
public TableCell<T, Integer> call(TableColumn<T, Integer> param ) {
|
||||||
|
return new TextFieldTableCell<>(new IntegerStringConverter()) {
|
||||||
|
private boolean filterSet = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startEdit() {
|
||||||
|
super.startEdit();
|
||||||
|
if (!filterSet) {
|
||||||
|
getGraphic().addEventFilter(KeyEvent.KEY_TYPED, KE -> {
|
||||||
|
if (!"0123456789".contains(KE.getCharacter())) {
|
||||||
|
KE.consume();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
filterSet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fi.lpam.ruokamanageri.gui.elementit;
|
package fi.lpam.ruokamanageri.gui.tableCell;
|
||||||
|
|
||||||
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
import fi.lpam.ruokamanageri.dataluokat.Asiakas;
|
||||||
import fi.lpam.ruokamanageri.dataluokat.Kuljetus;
|
import fi.lpam.ruokamanageri.dataluokat.Kuljetus;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fi.lpam.ruokamanageri.gui.elementit;
|
package fi.lpam.ruokamanageri.gui.tableCell;
|
||||||
|
|
||||||
import fi.lpam.ruokamanageri.dataluokat.RaporttiRivi;
|
import fi.lpam.ruokamanageri.dataluokat.RaporttiRivi;
|
||||||
import javafx.scene.control.TableCell;
|
import javafx.scene.control.TableCell;
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package fi.lpam.ruokamanageri.gui.virheDialogit;
|
|
||||||
|
|
||||||
public class YhteysVirhe extends TietokantaVirhe{
|
|
||||||
public YhteysVirhe(Exception error){
|
|
||||||
this.setHeaderText("Virhe yhdistäessä tietokantaan");
|
|
||||||
this.setContentText(error.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ 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;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.time.LocalDate;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@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 {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ create table if not exists asiakkaat (
|
|||||||
jälkiruoat int not null,
|
jälkiruoat int not null,
|
||||||
erityisruokavalio varchar(255),
|
erityisruokavalio varchar(255),
|
||||||
avainTieto varchar(255),
|
avainTieto varchar(255),
|
||||||
lisätiedot text
|
lisätiedot text,
|
||||||
|
laskutusosoite varchar(255),
|
||||||
|
yhteyshenkilönNimi varchar(255),
|
||||||
|
yhteyshenkilönPuhelinnumero varchar(255),
|
||||||
|
yhteyshenkilönSähköposti varchar(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists kierrokset (
|
create table if not exists kierrokset (
|
||||||
|
|||||||
Reference in New Issue
Block a user