53 Commits

Author SHA1 Message Date
pepa d2aa1cbd9a Opraveno vyhodnocení sestavy pro podpis, pokud je v agendě více sestav s podpisem. 2016-01-06 11:55:28 +01:00
pepa 52cf63414b Oprevena sestava Žádost o SC- tisk z agend Cestovní příkazy a Požadavky na SC odkazuje na stejnou sestavu.
Byla přidána možnost použít property hlavní entity jako zdroje dat pro sestavu- rozšířen constructor třídy Report o parametr property.
2015-11-27 15:11:23 +01:00
pepa f904e89946 Opraveno filtrování podle čísla požadavku v agendě Cestovní příkazy. 2015-11-27 14:22:05 +01:00
pepa 5cae516cb6 Na sestavě Vyúčtování SC bylo odstraněno pole pro podpis "S provedením pracovní cesty souhlasí".
closes #259
2015-11-27 13:57:25 +01:00
pepa 6ac6d783fb - Opravena kontrola práv při ružení schválení vyúčtování SC.
- Opraven refresh gridů při mazání záznamů.
- Zrušeno výchozí třídění v agendě Cestovní příkazy.
- Opraven pom.xml.
2015-10-19 10:24:53 +02:00
pepa 67ff54d3f1 Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-10-18 16:28:30 +02:00
pepa 275e120021 Opraveno ukládání záznamu v agendě Fakturace požadavků. Příznak Fakturováno se již ukládá správně. 2015-10-16 10:03:34 +02:00
franta d20a72b336 Kvůli přechodu na IntelliJ IDEA upravena konfigurace Maven.
Fakturace rozděleny na fakturace materiálu a služeb.

closes #249
2015-10-14 10:06:41 +02:00
pepa e24684bbd0 Přesunut podpis příkazce operace na vyúčtování služební cesty.
closes #258
2015-10-12 15:26:25 +02:00
pepa 21bf006c19 Aktualizace podepisovací komponenty. 2015-10-11 22:08:30 +02:00
pepa 970928bb4e Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-10-11 21:53:33 +02:00
pepa 369184940b Do agendy Cestovní příkazy byly přidány záložky "Má střediska", "Mé komise" a "Vše", kde se zobrazují vyúčtování služebních ke schválení. V záložkách lze vyúčtování označit jako proplacené. Do e-mailu se generuje odkaz do těchto záložek.
closes #253
closes #250
2015-10-11 21:52:50 +02:00
franta cc374a3bf1 Podepsané dokumenty se nyní zobrazují ve dvou záložkách - Aktuální
dokumenty a Archiv.
V Archivu se zobrazují dokumenty starší než rok.

closes #225
2015-10-05 13:09:20 +02:00
franta 66e0c427ac Popisek změněn na "Zajistím sám", případně ve sloupci na "Zaj. sám"
closes #247
2015-10-05 08:57:26 +02:00
franta 095089d020 U požadavků na nákup je nyní pole Popis povinné.
closes #248
2015-10-05 08:32:42 +02:00
pepa 84154ccbff Neaktivní uživatelé se nenabízí v seznamech pro výběr uživatele (spolucestující...). V agendě Uživatelé a Střediska/komise jsou barevně odlišeni.
closes #239
2015-10-02 14:58:51 +02:00
pepa 1230959854 Opraveno duplikování vyúčtování SC, když se na požadavku provede úprava a znovu se schválí.
closes #255
2015-10-02 13:27:24 +02:00
pepa 96154a6b98 Opraveno mazání záznamů z požadavků
closes #257
2015-10-02 09:41:16 +02:00
pepa 14242fa41a Vyúčtování služebních cest u spolucestujících lze nyní zrušit u každého zvlášť. Lze tak provést dodatečnou opravu vyúčtování.
closes #251
2015-10-02 09:32:09 +02:00
pepa 67a99d8d78 Na sestavách se pro viditelný dig. podpis vytváří klasické read only formulářové pole, které se podpisem nahradí za obrázek podpisu.
Změna podepisovací komponenty- na windows se spouští stejná jak na linuxu, macos...
closes #244
2015-10-01 16:00:49 +02:00
pepa 768d3ee874 Opraveno duplicitní vkládání záznamů do agendy Fakturace požadavků, v případě, že se požadavek upraví a znovu schválí.
closes #252
2015-09-08 22:22:23 +02:00
pepa cd6a6cf5a6 Přidaná sestava "Protokol o kontrole" - digitální podpis při schvalování nákupů. 2015-09-07 22:08:21 +02:00
pepa d1ccaf530d Při napojování uživatele z AD se login převede na malá písmena. Opravena chyba při mazání uživatele.
closes #237
2015-08-18 22:21:05 +02:00
pepa 10439b5001 Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-08-08 22:53:15 +02:00
pepa b33f9f2e8a Pokud se upraví požadavek, u kterého je podepsaný dokument, tak se dokument smaže a požadavek se nastaví jako nový.
closes #227
2015-08-08 22:52:10 +02:00
franta 07d0949bea Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-07-14 20:21:10 +02:00
franta 2819cc125c Implementován validátor pro Globální nastavení.
closes #236
2015-07-14 20:17:32 +02:00
pepa c0922921c5 V agendě Procesy schválení lze u jednotlivých schvalovacích rolí nastavit, jestli bude vyžadován při schválení elektronický podpis.
closes #242
2015-07-11 01:05:41 +02:00
pepa b70041bfff Změněn způsob ukládání PDF dokumentu. Data se předávájí ve ViewModelu, tak nemůže dojít k tomu, že by se schválením jiného záznamu v druhém okně prohlížeče uložilo jiné PDF.
refs #243
2015-07-10 15:29:44 +02:00
pepa b5ffa07644 Aktualizace podepisovací aplikace- opraveno náhodné zatuhnutí po startu.
refs #224
2015-07-09 08:22:32 +02:00
pepa cccd8177fa Implementace uložiště podepsaných dokumentů. Při prvním podpisu se uloží podepsané PDF a vytvoří se záznam v agendě podepsaných dokumentů.
closes #243
2015-07-08 12:55:41 +02:00
pepa 6db416dd04 Vyřešeno generování PDF pro podpis na základě entity, která se schvaluje.
closes #240
2015-07-03 13:36:23 +02:00
pepa 05faa87071 Digitální podpis se zobrazí v PDF viditelně. Server předá podepisovací aplikaci ID fieldu, kde se podpis zobrazí. ID je zadáno v reportu jaku parametr pole signature.
refs #224
2015-07-02 14:12:26 +02:00
pepa 11e3a48b28 Ve windows se spustí podepisovací aplikace, která si bere certifikáty ze systémového uložiště.
refs #224
2015-06-25 13:08:06 +02:00
pepa d7999e78ca Merge remote-tracking branch 'origin/master' 2015-06-24 12:54:57 +02:00
pepa d6cff454fd Základní implementace podepisování PDF dokumentů. Podpis implementován pouze pro sestavu schválení služební cesty (natvrdo v kódu). Spouští se univerzální podepisovací aplikace, která čte certifikát ze souboru.
closes #224
2015-06-24 12:54:31 +02:00
franta 1d30f0d0c7 Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-06-24 10:16:36 +02:00
franta 9fb1ef7601 Přidána základní funkčnost zobrazování dat agendy.
refs #225
2015-06-24 10:14:21 +02:00
pepa 312b62af7b Merge branch 'Verze_2.0' 2015-06-21 00:36:08 +02:00
pepa b0fedfa3f3 Opraveny datumy na vyúčtování služební cesty.
closes #232
2015-06-21 00:31:33 +02:00
pepa dc0607c072 Vytvořením požadavku na služební cestu se odešle e-mail spolucestujícím.
closes #235
2015-06-20 23:49:49 +02:00
pepa 162cea6001 Merge branch 'Verze_2.0' 2015-06-15 21:18:14 +02:00
pepa 4d74b0a3fe Opraven binding formuláře vyúčtování služební cesty.
closes #231
2015-06-15 21:17:17 +02:00
pepa 3b3e4b38e6 Vyúčtování služební cesty nelze odeslat ke schválení, pokud nejsou vyplněné časy odjezdu a příjezdu.
closes #230
2015-06-14 20:45:36 +02:00
pepa 1164e11107 Merge branch 'master' of https://git.bukova.info/repos/git/isspst 2015-06-13 00:07:05 +02:00
pepa c2ca2e45ec Opraveno generovani vyuctovani sluzebni cesty spolucestujicich, pokud je pozadovana zaloha- zaloha se nyni neprenese.
closes #229
Po schvaleni pozadavku na sluzebni cestu se spolucestujicimi se posle mail o schvaleni i spolucestujicim.
closes #228
2015-06-13 00:00:00 +02:00
franta c9a56887dc Připraveny podklady pro novou agendu "Podepsané dokumenty"
Vzhled agendy (grid/strom/...) zatím není znám.

closes #222
2015-06-04 14:19:54 +02:00
franta aaa89a2653 Workaround pro zápis číselné řady.
Vznikaly duplicity nad unikátním indexem.
Nyní se číslo nezapisuje a načítá se z vazby na požadavku na cesťák.

closes #221
2015-05-22 12:10:00 +02:00
franta fbc7a02161 Zpráva z pracovní cesty prodloužena na 8kB
closes #220
2015-05-20 07:51:47 +02:00
pepa e5a8e0f0d9 Po otevření dialogu pro zobrazení vyúčtování SC se přepne na první záložku, kterou může schválit aktuálně přihlášený uživatel.
closes #217
2015-05-17 21:52:46 +02:00
pepa 0f169f8be9 Na formuláři vyúčtování služební cesty se automaticky předvyplní datum v poli "Zpráva z pracovní cesty podána dne", pokud je pole prázdné.
closes #216
2015-05-17 21:06:26 +02:00
pepa b6d0546b48 Na formulář vyúčtování služební cesty bylo přidáno tlačítko "Uložit a odeslat ke schválení"
closes #218
2015-05-17 20:52:38 +02:00
pepa a6799064f7 Opraveno generování e-mailu po odeslání vyúčtování služební cesty ke schválení. Text a URL se nyní vygeneruje správně.
closes #219
2015-05-13 13:36:51 +02:00
150 changed files with 5244 additions and 677 deletions
+79
View File
@@ -0,0 +1,79 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 16464111046498525641 (0xe47c45c4252121c9)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=CZ, ST=Vysocina, O=bukova.info, CN=Josef Rokos/emailAddress=rokos@bukova.info
Validity
Not Before: Jun 24 09:59:50 2015 GMT
Not After : Jun 21 09:59:50 2025 GMT
Subject: C=CZ, ST=Vysocina, O=bukova.info, CN=Josef Rokos/emailAddress=rokos@bukova.info
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:bc:fb:64:50:5b:58:03:8c:20:1c:77:d3:50:31:
94:55:78:d6:05:bb:bc:88:9d:cb:20:b1:8c:ff:ac:
fc:97:1a:b1:9c:29:c4:ac:af:ed:3b:de:93:d5:cf:
75:3e:d0:05:41:32:bf:12:25:53:60:28:af:ff:3e:
3c:3a:4c:52:78:3f:b2:78:b9:c6:2f:fc:0e:44:eb:
65:c3:7f:38:2b:ab:88:37:8c:68:55:69:e3:3d:5e:
9b:99:25:11:55:06:ab:e8:c1:fa:54:da:5b:e7:9b:
3e:3f:39:4f:cf:b3:cb:48:cf:96:02:89:0b:7e:24:
c7:00:e9:ce:8d:ea:07:cf:21:f2:89:51:c8:cc:7a:
04:e4:68:6f:1c:a8:e0:76:18:40:62:ee:2f:bd:13:
64:b7:1e:2e:18:bb:b1:d4:17:d5:fb:1f:07:59:65:
46:f0:c4:51:dc:ac:62:ff:31:a8:72:26:a6:1a:88:
37:23:82:49:9a:02:d2:39:74:98:71:7f:a4:77:52:
3a:ed:22:2e:99:9c:81:2c:48:16:3c:82:7b:af:2c:
0d:4b:28:4d:e0:46:7d:b5:b8:ea:3f:e7:5a:5b:4f:
d8:06:b2:a3:86:2f:8b:5b:9c:bc:04:2e:64:b6:e1:
09:c9:14:6d:54:7e:86:40:7b:66:33:27:33:4a:3d:
7c:97
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
EF:9B:88:5C:07:27:79:EA:60:90:5C:7A:28:45:FB:7F:35:E6:CB:3F
X509v3 Authority Key Identifier:
keyid:EF:9B:88:5C:07:27:79:EA:60:90:5C:7A:28:45:FB:7F:35:E6:CB:3F
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha1WithRSAEncryption
08:e9:a4:32:cc:35:7c:66:5a:ea:f2:bd:e6:75:78:81:52:11:
22:27:32:c9:ec:91:6e:51:8a:f1:1e:0f:25:8a:e1:64:ba:e4:
85:1c:e4:fd:75:f0:26:3d:65:62:16:29:20:4f:5f:d2:66:36:
de:2b:bd:7b:96:71:f6:2c:d1:c5:54:69:89:dd:52:20:49:49:
b1:ac:09:b4:1e:33:59:0d:89:fd:a4:28:7a:70:96:e5:cb:58:
7e:b9:1d:02:7a:33:ee:ad:6a:ad:2c:3c:5e:7d:cc:f5:72:69:
51:fd:77:b4:0f:10:fd:9e:c2:1a:04:c5:a9:56:6e:fd:66:9f:
b6:1c:f9:d3:68:f4:4f:8c:6c:67:af:f5:e0:a5:30:67:a6:a7:
9b:6e:16:89:8a:e5:b4:20:f4:f7:74:f4:9c:ca:5d:c7:2f:e6:
30:9d:6b:2e:95:29:c1:e7:aa:d7:d6:59:dc:a9:f0:10:40:02:
66:3f:58:a2:38:8c:89:1a:0b:94:1a:e5:80:49:14:44:f4:06:
b1:11:1a:cd:ef:76:6a:bf:f8:6f:58:9d:af:a3:6b:9a:8e:bb:
6c:10:d6:d8:4e:73:58:20:0b:99:38:41:d4:22:d4:80:0b:09:
0d:25:40:3e:66:15:a0:44:4e:d6:59:5a:58:07:e5:4b:62:f1:
e9:ae:b6:7c
-----BEGIN CERTIFICATE-----
MIIDrzCCApegAwIBAgIJAOR8RcQlISHJMA0GCSqGSIb3DQEBBQUAMG4xCzAJBgNV
BAYTAkNaMREwDwYDVQQIDAhWeXNvY2luYTEUMBIGA1UECgwLYnVrb3ZhLmluZm8x
FDASBgNVBAMMC0pvc2VmIFJva29zMSAwHgYJKoZIhvcNAQkBFhFyb2tvc0BidWtv
dmEuaW5mbzAeFw0xNTA2MjQwOTU5NTBaFw0yNTA2MjEwOTU5NTBaMG4xCzAJBgNV
BAYTAkNaMREwDwYDVQQIDAhWeXNvY2luYTEUMBIGA1UECgwLYnVrb3ZhLmluZm8x
FDASBgNVBAMMC0pvc2VmIFJva29zMSAwHgYJKoZIhvcNAQkBFhFyb2tvc0BidWtv
dmEuaW5mbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALz7ZFBbWAOM
IBx301AxlFV41gW7vIidyyCxjP+s/JcasZwpxKyv7Tvek9XPdT7QBUEyvxIlU2Ao
r/8+PDpMUng/sni5xi/8DkTrZcN/OCuriDeMaFVp4z1em5klEVUGq+jB+lTaW+eb
Pj85T8+zy0jPlgKJC34kxwDpzo3qB88h8olRyMx6BORobxyo4HYYQGLuL70TZLce
Lhi7sdQX1fsfB1llRvDEUdysYv8xqHImphqINyOCSZoC0jl0mHF/pHdSOu0iLpmc
gSxIFjyCe68sDUsoTeBGfbW46j/nWltP2Aayo4Yvi1ucvAQuZLbhCckUbVR+hkB7
ZjMnM0o9fJcCAwEAAaNQME4wHQYDVR0OBBYEFO+biFwHJ3nqYJBceihF+3815ss/
MB8GA1UdIwQYMBaAFO+biFwHJ3nqYJBceihF+3815ss/MAwGA1UdEwQFMAMBAf8w
DQYJKoZIhvcNAQEFBQADggEBAAjppDLMNXxmWuryveZ1eIFSESInMsnskW5RivEe
DyWK4WS65IUc5P118CY9ZWIWKSBPX9JmNt4rvXuWcfYs0cVUaYndUiBJSbGsCbQe
M1kNif2kKHpwluXLWH65HQJ6M+6taq0sPF59zPVyaVH9d7QPEP2ewhoExalWbv1m
n7Yc+dNo9E+MbGev9eClMGemp5tuFomK5bQg9Pd09JzKXccv5jCday6VKcHnqtfW
Wdyp8BBAAmY/WKI4jIkaC5Qa5YBJFET0BrERGs3vdmq/+G9Yna+ja5qOu2wQ1thO
c1ggC5k4QdQi1IALCQ0lQD5mFaBETtZZWlgH5Uti8emutnw=
-----END CERTIFICATE-----
+18 -1
View File
@@ -24,7 +24,7 @@
<repository> <repository>
<id>fdvsolution.public</id> <id>fdvsolution.public</id>
<name>Dynamic Jasper</name> <name>Dynamic Jasper</name>
<url>http://archiva.fdvs.com.ar/repository/public1/</url> <url>http://nexus.fdvs.com.ar/content/groups/public/</url>
</repository> </repository>
</repositories> </repositories>
@@ -407,6 +407,23 @@
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.js</include>
<include>**/*.wpd</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build> </build>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
@@ -7,6 +7,7 @@ import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.RequirementType; import info.bukova.isspst.data.RequirementType;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.reporting.Report; import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.reporting.ReportMapping;
@@ -22,6 +23,7 @@ import info.bukova.isspst.services.reqsubjects.ServiceItemService;
import info.bukova.isspst.services.requirement.RequirementService; import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.requirement.TripRequirementService; import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.services.tripbill.TripBillService; import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
@@ -33,7 +35,7 @@ import java.util.Map;
public class Constants { public class Constants {
public final static long DB_VERSION = 4; public final static long DB_VERSION = 5;
public final static String DEF_ADMIN = "admin"; public final static String DEF_ADMIN = "admin";
public final static String DEF_ADMIN_PASSWD = "admin"; public final static String DEF_ADMIN_PASSWD = "admin";
@@ -85,6 +87,7 @@ public class Constants {
public final static String MOD_ORDER = "ORDER"; public final static String MOD_ORDER = "ORDER";
public final static String MOD_INVOICING = "INVOICING"; public final static String MOD_INVOICING = "INVOICING";
public final static String MOD_SEARCH = "SEARCH"; public final static String MOD_SEARCH = "SEARCH";
public final static String MOD_SIGNEDDOCS = "SIGNEDDOCS";
public final static Module MODULES[] = { public final static Module MODULES[] = {
new Module(MOD_USERS, "Uživatelé", UserService.class), new Module(MOD_USERS, "Uživatelé", UserService.class),
new Module(MOD_PERMISSIONS, "Práva", RoleService.class), new Module(MOD_PERMISSIONS, "Práva", RoleService.class),
@@ -102,6 +105,7 @@ public class Constants {
new Module(MOD_ORDER, "Objednávky", OrderService.class), new Module(MOD_ORDER, "Objednávky", OrderService.class),
new Module(MOD_INVOICING, "Fakturace požadavků", InvoicingService.class), new Module(MOD_INVOICING, "Fakturace požadavků", InvoicingService.class),
new Module(MOD_SEARCH, "Fulltextové vyhledávání", FullTextService.class, true, false), new Module(MOD_SEARCH, "Fulltextové vyhledávání", FullTextService.class, true, false),
new Module(MOD_SIGNEDDOCS, "Podepsané dokumenty", SignedDocumentService.class, true, false),
}; };
public final static String PERM_APPROVE = "PERM_APPROVE"; public final static String PERM_APPROVE = "PERM_APPROVE";
@@ -112,6 +116,7 @@ public class Constants {
public final static String PERM_EDIT_OWN = "PERM_EDIT_OWN"; public final static String PERM_EDIT_OWN = "PERM_EDIT_OWN";
public final static String PERM_DELETE_NEW = "PERM_DELETE_NEW"; public final static String PERM_DELETE_NEW = "PERM_DELETE_NEW";
public final static String PERM_SEARCH = "PERM_SEARCH"; public final static String PERM_SEARCH = "PERM_SEARCH";
public final static String PERM_PAY_BILL = "PERM_PAY_BILL";
public final static Permission SPECIAL_PERMISSIONS[] = { public final static Permission SPECIAL_PERMISSIONS[] = {
new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_REQUIREMENTS, PermissionType.GLOBAL), new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_REQUIREMENTS, PermissionType.GLOBAL),
@@ -129,18 +134,28 @@ public class Constants {
new Permission(PERM_APPROVE, "Schválení", MOD_TRIPREQUIREMENTS, PermissionType.WORKGROUP), new Permission(PERM_APPROVE, "Schválení", MOD_TRIPREQUIREMENTS, PermissionType.WORKGROUP),
new Permission(PERM_SEARCH, "Vyhledávat", MOD_SEARCH, PermissionType.GLOBAL), new Permission(PERM_SEARCH, "Vyhledávat", MOD_SEARCH, PermissionType.GLOBAL),
new Permission(PERM_READ, "Číst", MOD_SIGNEDDOCS, PermissionType.GLOBAL),
new Permission(PERM_PAY_BILL, "Vyplacení SC", MOD_TRIPBILL, PermissionType.GLOBAL)
}; };
public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava"; public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava";
public final static ReportMapping REPORTS[] = { public final static ReportMapping REPORTS[] = {
new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresní karty", "address")), new ReportMapping(MOD_ADDRESSBOOK, new Report(1, false, "Adresní karty", "address")),
new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresa", "address", false, true)), new ReportMapping(MOD_ADDRESSBOOK, new Report(2, false, "Adresa", "address", false, true)),
new ReportMapping(MOD_TRIPBILL, new Report("Žádost", "tripRequirement", false, true)), new ReportMapping(MOD_TRIPBILL, new Report(7, true, "Žádost o SC", "tripRequirementApp", false, true, "requirement")),
new ReportMapping(MOD_TRIPBILL, new Report("Vyúčtování", "tripBill", false, true, true)), new ReportMapping(MOD_TRIPBILL, new Report(4, true, "Vyúčtování", "tripBill", false, true, true)),
new ReportMapping(MOD_ORDER, new Report("Objednávka", "order", true, true)), new ReportMapping(MOD_ORDER, new Report(5, false, "Objednávka", "order", true, true)),
new ReportMapping(MOD_REQUIREMENTS, new Report("Požadavky", "requirements")) new ReportMapping(MOD_REQUIREMENTS, new Report(6, false, "Požadavky", "requirements")),
new ReportMapping(MOD_TRIPREQUIREMENTS, new Report(7, true, "Žádost o SC", "tripRequirementApp", false, true)),
new ReportMapping(MOD_REQUIREMENTS, new Report(8, true, "Protokol o kontrole", "orderRequirement", false, true))
}; };
public final static Map<Class<?>, Integer> SIGN_REPORT_MAP = Collections.unmodifiableMap(new HashMap<Class<?>, Integer>() {{
put(TripBillApproval.class, 4);
put(TripRequirement.class, 7);
}});
public final static String REQTYPE_ORDER = "ORDER"; public final static String REQTYPE_ORDER = "ORDER";
public final static String REQTYPE_BUSINESSTRIP = "BUSINESSTRIP"; public final static String REQTYPE_BUSINESSTRIP = "BUSINESSTRIP";
public final static RequirementType REQTYPES[] = { public final static RequirementType REQTYPES[] = {
@@ -155,10 +170,17 @@ public class Constants {
public final static Map<Class<?>, String> URL_MAP = Collections.unmodifiableMap(new HashMap<Class<?>, String>() {{ public final static Map<Class<?>, String> URL_MAP = Collections.unmodifiableMap(new HashMap<Class<?>, String>() {{
put(Requirement.class, "/main/orders/"); put(Requirement.class, "/main/orders/");
put(TripRequirement.class, "/main/trips/requirements/"); put(TripRequirement.class, "/main/trips/requirements/");
put(TripBillApproval.class, "/main/trips/bill/");
put(Order.class, "/main/orders/created/"); put(Order.class, "/main/orders/created/");
put(TripBill.class, "/main/trips/bill/"); put(TripBill.class, "/main/trips/bill/");
}} ); }} );
public final static int LEN_TEXT = 255; public final static int LEN_TEXT = 255;
public final static int LEN_DESCRIPTION = 8192; public final static int LEN_DESCRIPTION = 8192;
public final static int LEN_RESULT_MESSAGE = 8192;
public final static String MAIL_URL_KEYWORD = "-url-";
public final static String KEY_SIGN_DATA = "SIGN_DATA";
public final static String KEY_SIGN_GUID = "SIGN_GUID";
} }
@@ -2,6 +2,7 @@ package info.bukova.isspst;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import org.apache.commons.lang.time.DateUtils; import org.apache.commons.lang.time.DateUtils;
@@ -54,4 +55,31 @@ public class DateTimeUtils
{ {
return DateTimeUtils.getDate(DateTimeUtils.getCurrDateTime()); return DateTimeUtils.getDate(DateTimeUtils.getCurrDateTime());
} }
public static Calendar getCalendarDelta(Date value, int calendarType, int delta) {
if (value == null) {
value = DateTimeUtils.getCurrDate();
}
Calendar calendar = new GregorianCalendar();
calendar.setTime(value);
int deltaValue = calendar.get(calendarType);
calendar.set(calendarType, deltaValue + delta);
return calendar;
}
public static Calendar getCalendar(Date value) {
if (value == null) {
value = DateTimeUtils.getCurrDate();
}
Calendar calendar = new GregorianCalendar();
calendar.setTime(value);
return calendar;
}
public static Date getDateDelta(Date value, int calendarType, int delta) {
Calendar calendar = DateTimeUtils.getCalendarDelta(value, calendarType, delta);
return calendar.getTime();
}
} }
@@ -1,5 +1,12 @@
package info.bukova.isspst; package info.bukova.isspst;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.services.Service;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.ServletContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -38,6 +45,48 @@ public class ModuleUtils {
return null; return null;
} }
public static Module getModule(DataModel entity, ServletContext sc) {
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
for (Module m : Constants.MODULES) {
Service<?> service;
try {
service = (Service<?>) ctx.getBean(m.getServiceClass());
} catch (NoSuchBeanDefinitionException e) {
String[] beans = ctx.getBeanNamesForType(m.getServiceClass());
for (String s : beans) {
service = (Service<?>) ctx.getBean(s);
if (service.getEntityClasses().contains(entity.getClass())) {
return m;
}
}
continue;
} catch (ClassCastException e) { //nestandardní moduly neřeší...
continue;
}
if (service.getEntityClasses().contains(entity.getClass())) {
return m;
}
}
return null;
}
public static Service<?> getServiceInstance(Module m, ServletContext sc) {
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
try {
return (Service<?>) ctx.getBean(m.getServiceClass());
} catch (NoSuchBeanDefinitionException e) {
String[] beans = ctx.getBeanNamesForType(m.getServiceClass());
return (Service<?>) ctx.getBean(beans[0]);
}
}
public static boolean isActive(String id) { public static boolean isActive(String id) {
return getModule(id).isActive(); return getModule(id).isActive();
} }
@@ -0,0 +1,31 @@
package info.bukova.isspst;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegExUtils {
public static List<String> getMatches(String input, String regEx, int group) {
List<String> list = new ArrayList<String>();
if (!StringUtils.isNullOrEmpty(input) && !StringUtils.isNullOrEmpty(regEx)) {
Pattern pattern = Pattern.compile(regEx);
Matcher matcher = pattern.matcher(input);
int groupCount = matcher.groupCount() + 1;
if ((groupCount >= 0) && (group < groupCount)) {
while (matcher.find()) {
String item = matcher.group(group);
list.add(item);
}
}
}
return list;
}
public static List<String> getMatches(String input, String regEx) {
return RegExUtils.getMatches(input, regEx, 0);
}
}
@@ -5,6 +5,7 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -13,16 +14,18 @@ public class SessionData implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = -764426911263559758L; private static final long serialVersionUID = -764426911263559759L;
private List<Workgroup> userCentres; private List<Workgroup> userCentres;
private List<Workgroup> userWorkgroups; private List<Workgroup> userWorkgroups;
private User currentUser; private User currentUser;
private Map<Integer, List<Role>> workgroupRoles; private Map<Integer, List<Role>> workgroupRoles;
private boolean loginFailed; private boolean loginFailed;
private Map<String, Object> properties;
public SessionData() { public SessionData() {
loginFailed = false; loginFailed = false;
properties = new HashMap<String, Object>();
} }
public List<Workgroup> getUserCentres() { public List<Workgroup> getUserCentres() {
@@ -65,4 +68,11 @@ public class SessionData implements Serializable {
this.loginFailed = loginFailed; this.loginFailed = loginFailed;
} }
public void setProperty(String key, Object value) {
properties.put(key, value);
}
public Object getProperty(String key) {
return properties.get(key);
}
} }
@@ -0,0 +1,25 @@
package info.bukova.isspst;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.ServletContext;
/**
* @author Pepa Rokos
*/
public class SpringUtils {
private static WebApplicationContext webCtx(ServletContext sc) {
return WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
}
public static Object getBean(String name, ServletContext sc) {
return webCtx(sc).getBean(name);
}
public static <T> T getBean(Class<T> clazz, ServletContext sc) {
return webCtx(sc).getBean(clazz);
}
}
@@ -0,0 +1,29 @@
package info.bukova.isspst;
import info.bukova.isspst.data.TripBillApproval;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
/**
* @author Pepa Rokos
*/
public class TripBillAprovalUrlResolver implements EntityUrlResolver {
@Autowired
private HttpServletRequest request;
@Override
public String entityUrl(Object entity) {
String defUrl = request.getRequestURL().toString();
defUrl = defUrl.substring(0, defUrl.indexOf(request.getServletPath()));
if (entity instanceof TripBillApproval) {
String url = Constants.URL_MAP.get(entity.getClass());
return defUrl + url + "?select=" + String.valueOf(((TripBillApproval)entity).getId());
}
return defUrl + "/app";
}
}
@@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.SignedDocument;
public interface SignedDocumentDao extends BaseDao<SignedDocument> {
}
@@ -0,0 +1,9 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.SignedDocumentDao;
import info.bukova.isspst.data.SignedDocument;
public class SignedDocumentDaoJPA extends BaseDaoJPA<SignedDocument> implements SignedDocumentDao {
}
@@ -1,7 +1,8 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import java.math.BigDecimal; import org.hibernate.annotations.Cascade;
import java.util.List; import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
@@ -11,17 +12,17 @@ import javax.persistence.JoinColumn;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import java.math.BigDecimal;
import org.hibernate.annotations.LazyCollection; import java.util.List;
import org.hibernate.annotations.LazyCollectionOption;
@Entity @Entity
@Table(name = "INVOICING") @Table(name = "INVOICING")
public class Invoicing extends BaseData implements Cloneable public class Invoicing extends BaseData implements Cloneable
{ {
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "REQUIREMENT_ID") @JoinColumn(name = "REQUIREMENT_ID")
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
private Requirement requirement; private Requirement requirement;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@@ -14,6 +14,8 @@ public class SettingsData {
private MailMessage newReqTemplate; private MailMessage newReqTemplate;
private MailMessage authReqTemplate; private MailMessage authReqTemplate;
private MailMessage confReqTemplate; private MailMessage confReqTemplate;
private MailMessage confReqTripPassenger;
private MailMessage reqPassenger;
private Address mainAddress; private Address mainAddress;
private List<Address> shippingAddrs; private List<Address> shippingAddrs;
private String bankName; private String bankName;
@@ -28,6 +30,8 @@ public class SettingsData {
newReqTemplate = new MailMessage(); newReqTemplate = new MailMessage();
authReqTemplate = new MailMessage(); authReqTemplate = new MailMessage();
confReqTemplate = new MailMessage(); confReqTemplate = new MailMessage();
confReqTripPassenger = new MailMessage();
reqPassenger = new MailMessage();
mainAddress = new Address(); mainAddress = new Address();
shippingAddrs = new ArrayList<Address>(); shippingAddrs = new ArrayList<Address>();
vehicles = new ArrayList<Vehicle>(); vehicles = new ArrayList<Vehicle>();
@@ -150,4 +154,20 @@ public class SettingsData {
{ {
this.logoFile = logoFile; this.logoFile = logoFile;
} }
public MailMessage getConfReqTripPassenger() {
return confReqTripPassenger;
}
public void setConfReqTripPassenger(MailMessage confReqTripPassenger) {
this.confReqTripPassenger = confReqTripPassenger;
}
public MailMessage getReqPassenger() {
return reqPassenger;
}
public void setReqPassenger(MailMessage reqPassenger) {
this.reqPassenger = reqPassenger;
}
} }
@@ -0,0 +1,114 @@
package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import info.bukova.isspst.Module;
import info.bukova.isspst.StringUtils;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.IndexedEmbedded;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity
@Table(name = "SIGNED_DOCUMENTS")
public class SignedDocument extends BaseData {
@Column(name = "MODULE_NAME", length = Constants.LEN_TEXT)
private String moduleName;
@Column(name = "RECORD_ID")
private int recordId;
@Column(name = "NUMSER", length = Constants.LEN_TEXT)
private String numser;
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
private String description;
@Column(name = "SIGN_DATE")
private Date signDate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "signedDocument", orphanRemoval = true)
@LazyCollection(LazyCollectionOption.TRUE)
@IndexedEmbedded
private List<SignedDocumentItem> items;
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public int getRecordId() {
return recordId;
}
public void setRecordId(int recordId) {
this.recordId = recordId;
}
public String getNumser() {
return numser;
}
public void setNumser(String numser) {
this.numser = numser;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getSignDate() {
return signDate;
}
public void setSignDate(Date signDate) {
this.signDate = signDate;
}
public String getAgendaName() {
if (StringUtils.isNullOrEmpty(this.moduleName)) {
return "";
}
for (Module m : Constants.MODULES) {
if (this.moduleName.equals(m.getId())) {
return m.getName();
}
}
return "";
}
public List<SignedDocumentItem> getItems() {
return items;
}
public void setItems(List<SignedDocumentItem> items) {
this.items = items;
}
public void addItem(SignedDocumentItem item) {
if (items == null) {
items = new ArrayList<SignedDocumentItem>();
}
item.setSignedDocument(this);
this.items.add(item);
}
}
@@ -0,0 +1,88 @@
package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "SIGNED_DOCUMENTS_ITEMS")
public class SignedDocumentItem {
@Id
@Column(name = "ID")
@GeneratedValue
private int id;
@Column(name = "REPORT_ID")
private long reportId;
@Column(name = "REPORT_NAME", length = Constants.LEN_TEXT)
private String reportName;
@Column(name = "FILENAME", length = Constants.LEN_TEXT)
private String fileName;
@ManyToOne
@JoinColumn(name = "SIGNED_DOCUMENT_ID")
private SignedDocument signedDocument;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getReportId() {
return reportId;
}
public void setReportId(long reportId) {
this.reportId = reportId;
}
public String getReportName() {
return reportName;
}
public void setReportName(String reportName) {
this.reportName = reportName;
}
public String getActualReportName() {
for (ReportMapping rm : Constants.REPORTS) {
Report rep = rm.getReport();
if (this.reportId == rep.getReportId()) {
return rep.getName();
}
}
return reportName;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public SignedDocument getSignedDocument() {
return signedDocument;
}
public void setSignedDocument(SignedDocument signedDocument) {
this.signedDocument = signedDocument;
}
}
@@ -1,5 +1,6 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import info.bukova.isspst.storage.EntityWithAttachment; import info.bukova.isspst.storage.EntityWithAttachment;
import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption; import org.hibernate.annotations.LazyCollectionOption;
@@ -14,7 +15,6 @@ import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
@@ -36,7 +36,7 @@ public class TripBill extends BaseData implements EntityWithAttachment {
@Column(name = "SIGN_DATE") @Column(name = "SIGN_DATE")
private Date signDate; private Date signDate;
@Column(name = "RESULT_MESSAGE") @Column(name = "RESULT_MESSAGE", length = Constants.LEN_RESULT_MESSAGE)
@Field(index = Index.YES, analyze = Analyze.YES) @Field(index = Index.YES, analyze = Analyze.YES)
private String resultMessage; private String resultMessage;
@@ -60,11 +60,15 @@ public class TripBill extends BaseData implements EntityWithAttachment {
@LazyCollection(LazyCollectionOption.TRUE) @LazyCollection(LazyCollectionOption.TRUE)
@IndexedEmbedded @IndexedEmbedded
private List<FileMetainfo> attachedFiles; private List<FileMetainfo> attachedFiles;
@ManyToOne(fetch = FetchType.EAGER) @OneToOne(fetch = FetchType.EAGER, orphanRemoval = true)
@JoinColumn(name = "APPROVAL_ID") @JoinColumn(name = "APPROVAL_ID")
private TripBillApproval approval; private TripBillApproval approval;
@Column(name = "SAVED") @Column(name = "SAVED")
private Boolean saved; private Boolean saved; // Nastaveno na true, pokud uživatel udělá změnu- nepřenáší se pak částky od žadatele
@Column(name = "PAID")
private Boolean paid;
@Column(name = "PAID_DATE")
private Date paidDate;
public TripBill() { public TripBill() {
billItems = new ArrayList<TripBillItem>(); billItems = new ArrayList<TripBillItem>();
@@ -186,4 +190,20 @@ public class TripBill extends BaseData implements EntityWithAttachment {
public void setSaved(Boolean saved) { public void setSaved(Boolean saved) {
this.saved = saved; this.saved = saved;
} }
public Boolean getPaid() {
return paid;
}
public void setPaid(Boolean paid) {
this.paid = paid;
}
public Date getPaidDate() {
return paidDate;
}
public void setPaidDate(Date paidDate) {
this.paidDate = paidDate;
}
} }
@@ -1,6 +1,9 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
/** /**
@@ -11,4 +14,31 @@ import javax.persistence.Table;
@Table(name = "TRIP_BILL_APPROVAL") @Table(name = "TRIP_BILL_APPROVAL")
public class TripBillApproval extends RequirementBase { public class TripBillApproval extends RequirementBase {
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "TRIPBILL_ID")
private TripBill bill;
@Override
public String getNumser() {
if (bill == null) {
return "";
}
TripRequirement tr = bill.getRequirement();
if (tr == null) {
return "";
}
return tr.getNumser();
}
public TripBill getBill() {
return bill;
}
public void setBill(TripBill bill) {
this.bill = bill;
}
} }
@@ -1,15 +1,14 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import java.math.BigDecimal; import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import java.math.BigDecimal;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
@Entity @Entity
@Table(name = "WORKFLOW") @Table(name = "WORKFLOW")
@@ -25,6 +24,8 @@ public class Workflow extends BaseData {
private Integer wOrder; private Integer wOrder;
@Column(name = "WLIMIT", precision=15, scale=4) @Column(name = "WLIMIT", precision=15, scale=4)
private BigDecimal limit; private BigDecimal limit;
@Column(name = "SIGNATURE")
private Boolean signature;
public Boolean getCentre() { public Boolean getCentre() {
return centre; return centre;
@@ -68,4 +69,11 @@ public class Workflow extends BaseData {
this.limit = limit; this.limit = limit;
} }
public Boolean getSignature() {
return signature;
}
public void setSignature(Boolean signature) {
this.signature = signature;
}
} }
@@ -0,0 +1,64 @@
package info.bukova.isspst.filters;
import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.SignedDocument;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class SignedDocumentFilter implements Filter<SignedDocument>
{
private SignedDocument condition;
public SignedDocumentFilter(SignedDocument cond)
{
this.condition = cond;
}
private static class SignedDocumentMatcher extends TypeSafeMatcher<SignedDocument>
{
private SignedDocument condition;
public SignedDocumentMatcher(SignedDocument cond)
{
this.condition = cond;
}
@Override
public void describeTo(Description desc)
{
desc.appendText("SignedDocument matches");
}
@Override
public boolean matchesSafely(SignedDocument item)
{
boolean foundAgendaName = StringUtils.isEqualForFilter(item.getAgendaName(), condition.getAgendaName());
boolean foundNumSer = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
boolean foundSignDate = DateTimeUtils.isEqualByDateForFilter(item.getSignDate(), condition.getSignDate());
return (foundAgendaName && foundNumSer && foundDescription && foundSignDate);
}
@Factory
public static Matcher<SignedDocument> matchBuilding(SignedDocument item)
{
return new SignedDocumentMatcher(item);
}
}
@Override
public SignedDocumentMatcher matcher()
{
return new SignedDocumentMatcher(condition);
}
@Override
public String queryString()
{
return "";
}
}
@@ -0,0 +1,78 @@
package info.bukova.isspst.filters;
import info.bukova.isspst.BooleanUtils;
import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.data.User;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class TripBillApprovalFilter implements Filter<TripBillApproval>
{
private TripBillApproval condition;
public TripBillApprovalFilter(TripBillApproval cond)
{
this.condition = cond;
}
private static class TripBillApprovalMatcher extends TypeSafeMatcher<TripBillApproval>
{
private TripBillApproval condition;
public TripBillApprovalMatcher(TripBillApproval cond)
{
this.condition = cond;
}
@Override
public void describeTo(Description desc)
{
desc.appendText("requirement matches");
}
@Override
public boolean matchesSafely(TripBillApproval item)
{
if (item.getBill() == null) {
return false;
}
boolean foundNumser = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getBill().getRequirement().getReqDate(), condition.getBill().getRequirement().getReqDate());
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
boolean foundFrom = StringUtils.isEqualForFilter(item.getBill().getRequirement().getFrom(), condition.getBill().getRequirement().getFrom());
boolean foundTo = StringUtils.isEqualForFilter(item.getBill().getRequirement().getTo(), condition.getBill().getRequirement().getTo());
boolean foundWorkgroup = (condition.getWorkgroup() == null ||(item.getWorkgroup() != null && item.getWorkgroup().equals(condition.getWorkgroup())));
boolean foundCentre = (condition.getCentre() == null || (item.getCentre() != null && item.getCentre().equals(condition.getCentre())));
boolean foundOwner = User.isEqualByUserForFilter(item.getBill().getOwnedBy(), condition.getBill().getOwnedBy());
boolean foundPaid = BooleanUtils.isEqualByBooleanValue(item.getBill().getPaid(), condition.getBill().getPaid());
boolean foundPaidDate = DateTimeUtils.isEqualByDateForFilter(item.getBill().getPaidDate(), condition.getBill().getPaidDate());
return foundNumser && foundReqDate && foundDescription && foundFrom && foundTo && foundWorkgroup && foundCentre && foundOwner && foundPaid && foundPaidDate;
}
@Factory
public static Matcher<TripBillApproval> matchTripRequirement(TripBillApproval building)
{
return new TripBillApprovalMatcher(building);
}
}
@Override
public TripBillApprovalMatcher matcher()
{
return new TripBillApprovalMatcher(condition);
}
@Override
public String queryString()
{
return "";
}
}
@@ -1,5 +1,6 @@
package info.bukova.isspst.mail; package info.bukova.isspst.mail;
import info.bukova.isspst.Constants;
import info.bukova.isspst.EntityUrlResolver; import info.bukova.isspst.EntityUrlResolver;
import info.bukova.isspst.UrlResolverHolder; import info.bukova.isspst.UrlResolverHolder;
@@ -57,7 +58,7 @@ public class EntityMessageBuilder implements MessageBuilder {
for (String p : properties) { for (String p : properties) {
try { try {
if (p.equals("-url-")) { if (p.equals(Constants.MAIL_URL_KEYWORD)) {
ret = ret.replaceAll("\\[" + p + "\\]", getUrl(data)); ret = ret.replaceAll("\\[" + p + "\\]", getUrl(data));
} else { } else {
ret = ret.replaceAll("\\[" + p + "\\]", BeanUtils.getProperty(data, p)); ret = ret.replaceAll("\\[" + p + "\\]", BeanUtils.getProperty(data, p));
@@ -1,5 +1,6 @@
package info.bukova.isspst.reporting; package info.bukova.isspst.reporting;
import com.mysql.jdbc.StringUtils;
import info.bukova.isspst.data.Address; import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.AuthItem; import info.bukova.isspst.data.AuthItem;
import info.bukova.isspst.data.Order; import info.bukova.isspst.data.Order;
@@ -8,16 +9,14 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.data.UserSettingsData; import info.bukova.isspst.data.UserSettingsData;
import info.bukova.isspst.services.requirement.TripRequirementService; import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.storage.FileStorage; import info.bukova.isspst.storage.FileStorage;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import com.mysql.jdbc.StringUtils;
public class ParamFiller { public class ParamFiller {
@Autowired @Autowired
@@ -30,6 +29,8 @@ public class ParamFiller {
private TripRequirementService tripReqService; private TripRequirementService tripReqService;
@Autowired @Autowired
private GlobalSettingsService settingService; private GlobalSettingsService settingService;
@Autowired
private TripBillApprovalService tripBillApprovalService;
public void fill() { public void fill() {
if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) { if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) {
@@ -57,7 +58,13 @@ public class ParamFiller {
TripBill tb = (TripBill)definition.getDataSet().get(0); TripBill tb = (TripBill)definition.getDataSet().get(0);
tripReqService.loadAuthItems(tb.getRequirement()); tripReqService.loadAuthItems(tb.getRequirement());
AuthItem lastButOneAuth = tb.getRequirement().getAuthorization().get(0); if (tb.getApproval() != null) {
tripBillApprovalService.loadAuthItems(tb.getApproval());
}
if (tb.getApproval() != null && tb.getApproval().getAuthorization() != null && !tb.getApproval().getAuthorization().isEmpty()) {
AuthItem lastButOneAuth = tb.getApproval().getAuthorization().get(0);
definition.setParam("P_PREV_APPROVE_DATE", lastButOneAuth.getAuthDate()); definition.setParam("P_PREV_APPROVE_DATE", lastButOneAuth.getAuthDate());
User lastButOneUser = lastButOneAuth.getApprover(); User lastButOneUser = lastButOneAuth.getApprover();
@@ -67,8 +74,7 @@ public class ParamFiller {
definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile())); definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile()));
} }
AuthItem lastAuth = tb.getApproval().getAuthorization().get(tb.getApproval().getAuthorization().size() - 1);
AuthItem lastAuth = tb.getRequirement().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate()); definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate());
User u = lastAuth.getApprover(); User u = lastAuth.getApprover();
@@ -78,6 +84,7 @@ public class ParamFiller {
definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile())); definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile()));
} }
} }
}
if ((definition.getDataSet().get(0) instanceof Order) if ((definition.getDataSet().get(0) instanceof Order)
&& definition.getReport().isSingleRecord()) { && definition.getReport().isSingleRecord()) {
@@ -1,18 +1,21 @@
package info.bukova.isspst.reporting; package info.bukova.isspst.reporting;
import java.io.File; import info.bukova.isspst.SpringUtils;
import info.bukova.isspst.data.DataModel;
import javax.servlet.ServletContext; import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import org.slf4j.Logger; import info.bukova.isspst.storage.ReportFileStorage;
import org.slf4j.LoggerFactory;
import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperRunManager; import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.util.JRProperties; import net.sf.jasperreports.engine.util.JRProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletContext;
import java.io.File;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class PredefinedGenerator implements Generator { public class PredefinedGenerator implements Generator {
@@ -29,6 +32,11 @@ public class PredefinedGenerator implements Generator {
@Override @Override
public byte[] generate() { public byte[] generate() {
byte[] bytes = null; byte[] bytes = null;
SignedDocumentItem signedItem = getSignedDocument();
if (signedItem != null) {
return fromStorage(signedItem);
}
try { try {
JasperReport report = (JasperReport) JRLoader.loadObject(getReportFile()); JasperReport report = (JasperReport) JRLoader.loadObject(getReportFile());
@@ -44,6 +52,18 @@ public class PredefinedGenerator implements Generator {
return bytes; return bytes;
} }
private byte[] fromStorage(SignedDocumentItem sdItem) {
ReportFileStorage reportStorage = SpringUtils.getBean(ReportFileStorage.class, ctx);
return reportStorage.fileData(sdItem);
}
private SignedDocumentItem getSignedDocument() {
SignedDocumentService sdService = SpringUtils.getBean(SignedDocumentService.class, ctx);
SignedDocumentItem sdItem = sdService.getItem((DataModel) definition.getDataSet().get(0), definition.getReport().getReportId());
return sdItem;
}
protected File getReportFile() { protected File getReportFile() {
return new File(ctx.getRealPath("WEB-INF/reports") + "/" + definition.getReport().getJasperFile() + ".jasper"); return new File(ctx.getRealPath("WEB-INF/reports") + "/" + definition.getReport().getJasperFile() + ".jasper");
} }
@@ -4,60 +4,80 @@ package info.bukova.isspst.reporting;
public class Report { public class Report {
private ReportType type; private ReportType type;
private long reportId;
private boolean signable;
private String name; private String name;
private String jasperFile; private String jasperFile;
private boolean hasSettings; private boolean hasSettings;
private boolean singleRecord; private boolean singleRecord;
private boolean hasCondition; private boolean hasCondition;
private String property;
public Report() { public Report() {
this.reportId = 0;
this.signable = false;
hasSettings = false; hasSettings = false;
singleRecord = false; singleRecord = false;
hasCondition = false; hasCondition = false;
} }
/** /**
* @param reportId
* @param signable
* @param name * @param name
* @param jasperFile * @param jasperFile
*/ */
public Report(String name, String jasperFile) { public Report(long reportId, boolean signable, String name, String jasperFile) {
this(); this();
this.type = ReportType.DEFINED; this.type = ReportType.DEFINED;
this.reportId = reportId;
this.signable = signable;
this.name = name; this.name = name;
this.jasperFile = jasperFile; this.jasperFile = jasperFile;
} }
/** /**
* @param reportId
* @param signable
* @param name * @param name
* @param jasperFile * @param jasperFile
* @param hasSettings * @param hasSettings
*/ */
public Report(String name, String jasperFile, boolean hasSettings) { public Report(long reportId, boolean signable, String name, String jasperFile, boolean hasSettings) {
this(name, jasperFile); this(reportId, signable, name, jasperFile);
this.hasSettings = hasSettings; this.hasSettings = hasSettings;
} }
/** /**
* @param reportId
* @param signable
* @param name * @param name
* @param jasperFile * @param jasperFile
* @param hasSettings * @param hasSettings
* @param singleRecord * @param singleRecord
*/ */
public Report(String name, String jasperFile, boolean hasSettings, boolean singleRecord) { public Report(long reportId, boolean signable, String name, String jasperFile, boolean hasSettings, boolean singleRecord) {
this(name, jasperFile, hasSettings); this(reportId, signable, name, jasperFile, hasSettings);
this.singleRecord = singleRecord; this.singleRecord = singleRecord;
} }
public Report(long reportId, boolean signable, String name, String jasperFile, boolean hasSettings, boolean singleRecord, String property) {
this(reportId, signable, name, jasperFile, hasSettings, singleRecord);
this.property = property;
}
/** /**
* *
* @param reportId
* @param signable
* @param name * @param name
* @param jasperFile * @param jasperFile
* @param hasSettings * @param hasSettings
* @param singleRecord * @param singleRecord
* @param hasCondition * @param hasCondition
*/ */
public Report(String name, String jasperFile, boolean hasSettings, boolean singleRecord, boolean hasCondition) { public Report(long reportId, boolean signable, String name, String jasperFile, boolean hasSettings, boolean singleRecord, boolean hasCondition) {
this(name, jasperFile, hasSettings, singleRecord); this(reportId, signable, name, jasperFile, hasSettings, singleRecord);
this.hasCondition = hasCondition; this.hasCondition = hasCondition;
} }
@@ -108,4 +128,28 @@ public class Report {
public void setHasCondition(boolean hasCondition) { public void setHasCondition(boolean hasCondition) {
this.hasCondition = hasCondition; this.hasCondition = hasCondition;
} }
public long getReportId() {
return reportId;
}
public void setReportId(long reportId) {
this.reportId = reportId;
}
public boolean isSignable() {
return signable;
}
public void setSignable(boolean signable) {
this.signable = signable;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
} }
@@ -1,17 +1,17 @@
package info.bukova.isspst.reporting; package info.bukova.isspst.reporting;
import java.io.IOException; import info.bukova.isspst.storage.ReportFileStorage;
import java.io.OutputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
@Controller @Controller
public class ReportController { public class ReportController {
@@ -21,6 +21,8 @@ public class ReportController {
private GeneratorFactory factory; private GeneratorFactory factory;
@Autowired @Autowired
private ParamFiller paramFiller; private ParamFiller paramFiller;
@Autowired
private ReportFileStorage reportFileStorage;
private static final String ERROR_MESSAGE = "<html><body><b>Generator returned no data!</b><br/>%s</body></html>"; private static final String ERROR_MESSAGE = "<html><body><b>Generator returned no data!</b><br/>%s</body></html>";
private final static Logger logger = LoggerFactory.getLogger(ReportController.class); private final static Logger logger = LoggerFactory.getLogger(ReportController.class);
@@ -46,13 +48,20 @@ public class ReportController {
try { try {
os = response.getOutputStream(); os = response.getOutputStream();
if (reportDefinition.getReport() == null || reportDefinition.getDataSet() == null) { if ((reportDefinition.getReport() == null || reportDefinition.getDataSet() == null) && reportDefinition.getSignedDocItem() == null) {
throw new ReportException("Definition is null"); throw new ReportException("Definition is null");
} }
byte[] data;
if (reportDefinition.getSignedDocItem() == null) {
paramFiller.fill(); paramFiller.fill();
Generator gen = factory.createGenerator(reportDefinition); Generator gen = factory.createGenerator(reportDefinition);
byte[] data = gen.generate(); data = gen.generate();
} else {
data = reportFileStorage.fileData(reportDefinition.getSignedDocItem());
}
response.setContentType(contentType); response.setContentType(contentType);
response.setContentLength(data.length); response.setContentLength(data.length);
@@ -1,5 +1,6 @@
package info.bukova.isspst.reporting; package info.bukova.isspst.reporting;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import java.io.Serializable; import java.io.Serializable;
@@ -20,6 +21,7 @@ public class ReportDefinition implements Serializable {
private List<String> fieldsToPrint; private List<String> fieldsToPrint;
private String reportTitle; private String reportTitle;
private Service<Object> service; private Service<Object> service;
private SignedDocumentItem signedDocItem;
public ReportDefinition() { public ReportDefinition() {
params = new HashMap<String, Object>(); params = new HashMap<String, Object>();
@@ -92,6 +94,7 @@ public class ReportDefinition implements Serializable {
reportTitle = ""; reportTitle = "";
service = null; service = null;
params.clear(); params.clear();
signedDocItem = null;
} }
public String getReportTitle() { public String getReportTitle() {
@@ -110,4 +113,11 @@ public class ReportDefinition implements Serializable {
this.service = service; this.service = service;
} }
public SignedDocumentItem getSignedDocItem() {
return signedDocItem;
}
public void setSignedDocItem(SignedDocumentItem signedDocItem) {
this.signedDocItem = signedDocItem;
}
} }
@@ -0,0 +1,68 @@
package info.bukova.isspst.reporting;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfFormField;
import com.lowagie.text.pdf.PdfName;
import net.sf.jasperreports.engine.JRGenericPrintElement;
import net.sf.jasperreports.engine.JRPropertiesMap;
import net.sf.jasperreports.engine.export.GenericElementHandler;
import net.sf.jasperreports.engine.export.GenericElementHandlerBundle;
import net.sf.jasperreports.engine.export.GenericElementPdfHandler;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRPdfExporterContext;
import net.sf.jasperreports.extensions.ExtensionsRegistry;
import net.sf.jasperreports.extensions.ExtensionsRegistryFactory;
import net.sf.jasperreports.extensions.SingletonExtensionRegistry;
/**
* @author Pepa Rokos
*/
public class SignaturePdfHandler implements GenericElementPdfHandler, GenericElementHandlerBundle, ExtensionsRegistryFactory {
@Override
public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) {
return new SingletonExtensionRegistry<GenericElementHandlerBundle>(GenericElementHandlerBundle.class, this);
}
@Override
public void exportElement(JRPdfExporterContext exporterContext, JRGenericPrintElement element) {
//PdfFormField field = PdfFormField.createSignature(exporterContext.getPdfWriter());
PdfFormField field = PdfFormField.createTextField(exporterContext.getPdfWriter(), true, false, 255);
Object param = element.getParameterValue("index");
String index = param != null ? String.valueOf(param) : null;
if (index != null) {
field.setFieldName("signature-" + index);
} else {
field.setFieldName("signature");
}
field.put(PdfName.V, exporterContext.getPdfWriter().getPdfIndirectReference());
field.setFieldFlags(PdfFormField.FF_READ_ONLY);
field.setWidget(new Rectangle(element.getX(),
exporterContext.getExportedReport().getPageHeight() - element.getY(),
element.getX() + element.getWidth(),
exporterContext.getExportedReport().getPageHeight() - element.getY() - element.getHeight()), PdfName.HIGHLIGHT);
exporterContext.getPdfWriter().addAnnotation(field);
}
@Override
public boolean toExport(JRGenericPrintElement element) {
return true;
}
@Override
public String getNamespace() {
return "urn:sig:sig";
}
@Override
public GenericElementHandler getHandler(String elementName, String exporterKey) {
if (elementName.equals("signature") && exporterKey.equals(JRPdfExporter.PDF_EXPORTER_KEY)) {
return this;
}
return null;
}
}
@@ -5,9 +5,6 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.services.users.LdapUserImporter; import info.bukova.isspst.services.users.LdapUserImporter;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import java.util.Collection;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.ldap.core.DirContextOperations; import org.springframework.ldap.core.DirContextOperations;
@@ -15,6 +12,8 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator; import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator;
import java.util.Collection;
public class AuthPopulator implements LdapAuthoritiesPopulator { public class AuthPopulator implements LdapAuthoritiesPopulator {
private UserService userService; private UserService userService;
@@ -30,7 +29,8 @@ public class AuthPopulator implements LdapAuthoritiesPopulator {
public Collection<? extends GrantedAuthority> getGrantedAuthorities( public Collection<? extends GrantedAuthority> getGrantedAuthorities(
DirContextOperations userData, String login) { DirContextOperations userData, String login) {
User user = null; User user;
try { try {
user = (User) userService.loadUserByUsername(login); user = (User) userService.loadUserByUsername(login);
} catch (UsernameNotFoundException e) { } catch (UsernameNotFoundException e) {
@@ -14,6 +14,7 @@ import info.bukova.isspst.storage.DocumentFileStorage;
import org.hibernate.NonUniqueResultException; import org.hibernate.NonUniqueResultException;
import org.hibernate.Query; import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.GenericTypeResolver;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -22,6 +23,7 @@ import javax.validation.Validator;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -40,8 +42,20 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
private DocumentFileStorage documentFileStorage; private DocumentFileStorage documentFileStorage;
private NumberSeriesService numberSeriesService; private NumberSeriesService numberSeriesService;
private Class<T> entityClass;
public AbstractService() {
entityClass = (Class<T>) GenericTypeResolver.resolveTypeArgument(getClass(), AbstractService.class);
}
@Override
public List<Class<?>> getEntityClasses() {
List<Class<?>> classes = new ArrayList<Class<?>>();
classes.add(entityClass);
return classes;
}
public void setDocumentFileStorage(DocumentFileStorage storage) { public void setDocumentFileStorage(DocumentFileStorage storage) {
this.documentFileStorage = storage; this.documentFileStorage = storage;
} }
@@ -23,5 +23,6 @@ public interface Service<T> {
public Module getModule(); public Module getModule();
public List<Report> getReports(); public List<Report> getReports();
public boolean canPrintRecord(T entity); public boolean canPrintRecord(T entity);
public List<Class<?>> getEntityClasses();
} }
@@ -60,6 +60,9 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
} }
} }
// String source = UserCountUtils.encryptUserCount(1000);
// long users = UserCountUtils.decryptUserCount(source);
long dbVersion = this.getDbInfo().getVersion(); long dbVersion = this.getDbInfo().getVersion();
if (Constants.DB_VERSION > dbVersion) if (Constants.DB_VERSION > dbVersion)
@@ -133,6 +136,12 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
sq.executeUpdate(); sq.executeUpdate();
} }
if (dbVersion < 5) {
sql = "ALTER TABLE TRIP_BILL MODIFY RESULT_MESSAGE VARCHAR(" + String.valueOf(Constants.LEN_RESULT_MESSAGE) + ")";
sq = this.dao.getSession().createSQLQuery(sql);
sq.executeUpdate();
}
this.updateDatabaseVersion(); this.updateDatabaseVersion();
} }
} }
@@ -1,6 +1,7 @@
package info.bukova.isspst.services.invoicing; package info.bukova.isspst.services.invoicing;
import info.bukova.isspst.data.Invoicing; import info.bukova.isspst.data.Invoicing;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
@@ -20,4 +21,14 @@ public interface InvoicingService extends Service<Invoicing> {
public List<Invoicing> getPendingList(); public List<Invoicing> getPendingList();
public List<Invoicing> getArchiveList(); public List<Invoicing> getArchiveList();
public Invoicing getForRequirement(Requirement req);
public List<Invoicing> getMaterialPendingList();
public List<Invoicing> getMaterialArchiveList();
public List<Invoicing> getServicesPendingList();
public List<Invoicing> getServicesArchiveList();
} }
@@ -1,19 +1,20 @@
package info.bukova.isspst.services.invoicing; package info.bukova.isspst.services.invoicing;
import info.bukova.isspst.Constants;
import info.bukova.isspst.data.Invoicing; import info.bukova.isspst.data.Invoicing;
import info.bukova.isspst.data.InvoicingItem; import info.bukova.isspst.data.InvoicingItem;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.AbstractOwnedService; import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.LazyLoader; import info.bukova.isspst.services.LazyLoader;
import java.math.BigDecimal;
import java.util.List;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.Query; import org.hibernate.Query;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implements public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implements
InvoicingService { InvoicingService {
@@ -92,4 +93,53 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where inv.completed = true order by rq.numser"); Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where inv.completed = true order by rq.numser");
return q.list(); return q.list();
} }
@Override
@Transactional
public Invoicing getForRequirement(Requirement req) {
Query query = dao.getQuery("select invoice from Invoicing invoice join invoice.requirement rq where rq.id = :reqId");
query.setParameter("reqId", req.getId());
return (Invoicing) query.uniqueResult();
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<Invoicing> getMaterialPendingList() {
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed Is Null or inv.completed = false) and (rq.kind = :kind) order by rq.numser");
q.setParameter("kind", Constants.REQ_TYPE_MATERIAL);
return q.list();
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<Invoicing> getMaterialArchiveList() {
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed = true) and (rq.kind = :kind) order by rq.numser");
q.setParameter("kind", Constants.REQ_TYPE_MATERIAL);
return q.list();
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<Invoicing> getServicesPendingList() {
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed Is Null or inv.completed = false) and (rq.kind = :kind) order by rq.numser");
q.setParameter("kind", Constants.REQ_TYPE_SERVICES);
return q.list();
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<Invoicing> getServicesArchiveList() {
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed = true) and (rq.kind = :kind) order by rq.numser");
q.setParameter("kind", Constants.REQ_TYPE_SERVICES);
return q.list();
}
} }
@@ -2,6 +2,7 @@ package info.bukova.isspst.services.requirement;
import info.bukova.isspst.data.RequirementBase; import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import java.util.Date; import java.util.Date;
@@ -22,9 +23,11 @@ public interface RequirementBaseService<T extends RequirementBase> extends Servi
public void loadType(T data); public void loadType(T data);
public void loadWorkflow(T data); public void loadWorkflow(T data);
public void approve(T entity); public void approve(T entity);
public void approve(T entity, Date approveDate); public void approve(T entity, Date approveDate, byte[] signedPdf);
public boolean canApprove(T entity); public boolean canApprove(T entity);
public List<User> getNextApprover(T entity); public List<User> getNextApprover(T entity);
public boolean prepareSignData(T entity, Date approveDate);
public Workflow getNextWorkflow(T entity);
public List<T> getMy(); public List<T> getMy();
@@ -1,23 +1,38 @@
package info.bukova.isspst.services.requirement; package info.bukova.isspst.services.requirement;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.Module;
import info.bukova.isspst.ModuleUtils;
import info.bukova.isspst.data.AuthItem; import info.bukova.isspst.data.AuthItem;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.JobMapping; import info.bukova.isspst.data.JobMapping;
import info.bukova.isspst.data.RequirementBase; import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.SettingsData; import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workflow; import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.mail.MailMessage; import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.mail.Mailer; import info.bukova.isspst.mail.Mailer;
import info.bukova.isspst.mail.MessageBuilder; import info.bukova.isspst.mail.MessageBuilder;
import info.bukova.isspst.reporting.Generator;
import info.bukova.isspst.reporting.GeneratorFactory;
import info.bukova.isspst.reporting.ParamFiller;
import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.services.AbstractOwnedService; import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.LazyLoader; import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.Service;
import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.signapi.SignData;
import info.bukova.isspst.storage.FileStorage;
import info.bukova.isspst.storage.ReportFileStorage;
import org.hibernate.LazyInitializationException; import org.hibernate.LazyInitializationException;
import org.hibernate.Query; import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +40,11 @@ import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID;
/** /**
* @author Pepa Rokos * @author Pepa Rokos
@@ -50,6 +67,20 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
private UserService userService; private UserService userService;
@Autowired @Autowired
protected WorkgroupService workgroupService; protected WorkgroupService workgroupService;
@Autowired
private ReportDefinition reportDefinition;
@Autowired
private ParamFiller paramFiller;
@Autowired
private GeneratorFactory genFactory;
@Autowired
private ServletContext servletContext;
@Autowired
private FileStorage storage;
@Autowired
private SignedDocumentService signedDocumentService;
@Autowired
private ReportFileStorage signedDocStorage;
@Override @Override
@Transactional @Transactional
@@ -100,7 +131,8 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
} }
protected void postAdd(T entity) { protected void postAdd(T entity) {
if (canApprove(entity)) { Workflow wf = getNextWorkflow(entity);
if (canApprove(entity) && (wf.getSignature() == null || !wf.getSignature())) {
approve(entity); approve(entity);
} else { } else {
this.sendToApprovers(entity); this.sendToApprovers(entity);
@@ -119,6 +151,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
workflow.setLimit(w.getLimit()); workflow.setLimit(w.getLimit());
workflow.setOrder(w.getOrder()); workflow.setOrder(w.getOrder());
workflow.setRole(w.getRole()); workflow.setRole(w.getRole());
workflow.setSignature(w.getSignature());
entity.getWorkflow().add(workflow); entity.getWorkflow().add(workflow);
} }
} }
@@ -214,7 +247,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
} }
} }
protected void approve(T entity, User user, Date approveDate) { protected void approve(T entity, User user, Date approveDate, byte[] signedPdf) {
T e = (T) dao.getById(entity.getId()); T e = (T) dao.getById(entity.getId());
if (e.getReqDate().getTime() > approveDate.getTime()) { if (e.getReqDate().getTime() > approveDate.getTime()) {
@@ -246,6 +279,12 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
super.update(e); super.update(e);
if (signedPdf != null) {
saveSignedDoc(e, signedPdf);
} else if (wf.getSignature() != null && wf.getSignature() && !signatureNotRequired(wf)) {
throw new ApproveException("ErrApproveMustBeSigned");
}
if (!autoApprove(e, approveDate)) { if (!autoApprove(e, approveDate)) {
this.sendToApprovers(e); this.sendToApprovers(e);
@@ -272,8 +311,17 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
postApprove(e); postApprove(e);
} }
/**
* Check pro automatické schválení, kdy není třeba podepisovat- nadlimitní nákupy se neautorizují...
* @param wf Další krok schválení
* @return true pokud není potřeba podepisovat. Zde vrací vždy false, v případě potřeby nutno překrýt.
*/
protected boolean signatureNotRequired(Workflow wf) {
return false;
}
protected void approve(T entity, User user) { protected void approve(T entity, User user) {
approve(entity, user, new Date()); approve(entity, user, new Date(), null);
} }
@Override @Override
@@ -286,8 +334,8 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
@Override @Override
@Transactional @Transactional
@PreAuthorize("this.canApprove(#entity)") @PreAuthorize("this.canApprove(#entity)")
public void approve(T entity, Date approveDate) { public void approve(T entity, Date approveDate, byte[] signedPdf) {
approve(entity, getLoggedInUser(), approveDate); approve(entity, getLoggedInUser(), approveDate, signedPdf);
} }
/** /**
@@ -310,6 +358,30 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
} }
protected void saveSignedDoc(T entity, byte[] signedPdf) {
DataModel reportEntity = entityForSignReport(entity);
SignedDocumentItem signedItem = signedDocumentService.getItem(entityForSignReport(entity), getSignReport(entity).getReportId());
if (signedItem == null) {
SignedDocument signDoc = new SignedDocument();
signDoc.setDescription(entity.getDescription());
signDoc.setNumser(entity.getNumser());
signDoc.setRecordId(reportEntity.getId());
signDoc.setModuleName(ModuleUtils.getModule(reportEntity, servletContext).getId());
signDoc.setSignDate(entity.getLastApproveDate());
SignedDocumentItem item = new SignedDocumentItem();
item.setReportId(reportDefinition.getReport().getReportId());
item.setReportName(reportDefinition.getReport().getName());
signDoc.addItem(item);
signedDocStorage.saveFile(signedPdf, item);
signedDocumentService.addFromApprove(signDoc);
} else {
signedDocStorage.saveFile(signedPdf, signedItem);
}
}
@Override @Override
@Transactional @Transactional
public boolean canApprove(T entity) { public boolean canApprove(T entity) {
@@ -321,7 +393,11 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
return false; return false;
} }
protected Workflow getNextWorkflow(T e) { @Override
@Transactional
public Workflow getNextWorkflow(T entity) {
T e = dao.getById(entity.getId());
AuthItem authItem = null; AuthItem authItem = null;
if (e.getWorkflow() == null) { if (e.getWorkflow() == null) {
return null; return null;
@@ -408,4 +484,98 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
return Constants.PERM_DELETE_NEW; return Constants.PERM_DELETE_NEW;
} }
@Override
@Transactional
public boolean prepareSignData(T entity, Date approveDate) {
SignData data = new SignData();
sessionData.setProperty(Constants.KEY_SIGN_DATA, data);
data.setSignGuid(UUID.randomUUID().toString());
sessionData.setProperty(Constants.KEY_SIGN_GUID, data.getSignGuid());
reportDefinition.clear();
reportDefinition.setSingleObject(entityForSignReport(entity));
Report report = getSignReport(entity);
if (report == null) {
return false;
}
reportDefinition.setReport(report);
Module module = ModuleUtils.getModule(entityForSignReport(entity), servletContext);
reportDefinition.setService((Service<Object>) ModuleUtils.getServiceInstance(module, servletContext));
paramFiller.fill();
Generator gen = genFactory.createGenerator(reportDefinition);
data.setPdfData(gen.generate());
data.setDescription(entity.getDescription());
data.setNumser(entity.getNumser());
data.setSignDate(approveDate);
data.setSigned(signedDocumentService.getItem(entityForSignReport(entity), report.getReportId()) != null);
if (getNextWorkflow(entity).getCentre()) { // viditelné podpisy lze pouze na urovni strediska
if (entity.getState() == RequirementState.NEW) {
data.setAreaId(1);
} else {
loadAuthItems(entity);
int wgCount = 0;
for (Workflow wf : entity.getWorkflow()) {
if (!wf.getCentre()) {
++wgCount;
}
}
data.setAreaId(entity.getAuthorization().size() - wgCount + 1);
}
if (userService.getUserSettings().getSignatureFile() != null) {
data.setSignImg(storage.fileData(userService.getUserSettings().getSignatureFile()));
}
}
return true;
}
protected DataModel entityForSignReport(T entity) {
return entity;
}
private Report getSignReport(T entity) {
Module module = ModuleUtils.getModule(entityForSignReport(entity), servletContext);
Report report = null;
int reportId = Constants.SIGN_REPORT_MAP.get(entity.getClass()) == null ? 0 : Constants.SIGN_REPORT_MAP.get(entity.getClass());
for (Report r : module.getReports()) {
if (r.isSignable()) {
if (reportId == 0) {
report = r;
break;
} else if (reportId == r.getReportId()) {
report = r;
break;
}
}
}
return report;
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void update(T entity) {
entity.getAuthorization().clear();
entity.setState(RequirementState.NEW);
signedDocumentService.deleteForEntity(entity);
super.update(entity);
sendToApprovers(entity);
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())")
public void delete(T entity) {
signedDocumentService.delFromApprove(signedDocumentService.getForEntity(entity));
super.delete(entity);
}
} }
@@ -11,8 +11,8 @@ import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.LazyLoader; import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.invoicing.InvoicingService; import info.bukova.isspst.services.invoicing.InvoicingService;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -60,13 +60,23 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
if ((entity.getSumTotal() != null) if ((entity.getSumTotal() != null)
&& (entity.getSumTotal().compareTo(nextWf.getLimit()) == -1)) && (entity.getSumTotal().compareTo(nextWf.getLimit()) == -1))
{ {
approve(entity, approvers.get(0), approveDate); approve(entity, approvers.get(0), approveDate, null);
return true; return true;
} }
return false; return false;
} }
/**
* Nadlimitní autorizovat bez podpisu
* @param wf Další krok schválení
* @return true, pokud má role nastavený limit- automatické schválení podlimitního požadavku
*/
@Override
protected boolean signatureNotRequired(Workflow wf) {
return wf.getLimit() != null;
}
@Override @Override
protected boolean canAdd(Requirement entity) protected boolean canAdd(Requirement entity)
{ {
@@ -244,11 +254,19 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
@Override @Override
@Transactional @Transactional
public BigDecimal getInvoicedAmount(Requirement req) { public BigDecimal getInvoicedAmount(Requirement req) {
Query query = dao.getQuery("select invoice from Invoicing invoice join invoice.requirement rq where rq.id = :reqId"); Invoicing inv = invoicingService.getForRequirement(req);
query.setParameter("reqId", req.getId());
Invoicing inv = (Invoicing) query.uniqueResult();
return inv != null ? inv.getTotalInvoiced() : null; return inv != null ? inv.getTotalInvoiced() : null;
} }
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void update(Requirement entity) {
super.update(entity);
Invoicing inv = invoicingService.getForRequirement(entity);
if (inv != null) {
invoicingService.delete(inv);
}
}
} }
@@ -4,11 +4,17 @@ import info.bukova.isspst.Constants;
import info.bukova.isspst.data.NumberSeries; import info.bukova.isspst.data.NumberSeries;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.mail.Mailer;
import info.bukova.isspst.mail.MessageBuilder;
import info.bukova.isspst.services.LazyLoader; import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.tripbill.TripBillService; import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.users.UserService;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.LazyInitializationException; import org.hibernate.LazyInitializationException;
import org.hibernate.Query; import org.hibernate.Query;
@@ -25,9 +31,17 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
@Autowired @Autowired
private RequirementTypeService reqTypeService; private RequirementTypeService reqTypeService;
@Autowired @Autowired
private WorkgroupService workgroupService;
@Autowired
private TripBillService tripBillService; private TripBillService tripBillService;
@Autowired
private TripBillApprovalService tripBillApprovalService;
@Autowired
private Mailer mailer;
@Autowired
private MessageBuilder messageBuilder;
@Autowired
private GlobalSettingsService settingsService;
@Autowired
private UserService userService;
@Override @Override
protected TripRequirement createEntity() { protected TripRequirement createEntity() {
@@ -43,18 +57,39 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
@Transactional @Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())") @PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void update(TripRequirement entity) { public void update(TripRequirement entity) {
super.update(entity);
if (entity.getState() == RequirementState.APPROVED) { if (entity.getState() == RequirementState.APPROVED) {
for (TripBill bill : getBills(entity)) { for (TripBill bill : getBills(entity)) {
TripBill newBill = tripBillService.createTripBill(entity); TripBill newBill = tripBillService.createTripBill(entity);
bill.getBillItems().clear(); bill.getBillItems().clear();
bill.getBillItems().addAll(newBill.getBillItems()); bill.getBillItems().addAll(newBill.getBillItems());
TripBillApproval approval = bill.getApproval();
if (approval != null) {
tripBillApprovalService.delete(approval);
}
bill.setApproval(null); bill.setApproval(null);
tripBillService.calculate(bill); tripBillService.calculate(bill);
tripBillService.update(bill); tripBillService.update(bill);
} }
} }
super.update(entity);
}
@Override
protected void postAdd(TripRequirement entity) {
super.postAdd(entity);
sendMailToPassengers(entity, settingsService.getSettings().getReqPassenger());
}
private void sendMailToPassengers(TripRequirement entity, MailMessage messageTemplate) {
if (entity.getBillForPassengers() != null && !entity.getPassengers().isEmpty() && messageTemplate != null) {
MailMessage message = messageBuilder.buildMessage(messageTemplate, entity);
message.setFrom(userService.getCurrent().getEmail());
message.setTo(userService.getEmailsForSend(entity.getPassengers()));
mailer.send(message);
}
} }
@Override @Override
@@ -106,23 +141,53 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
@Override @Override
protected void postApprove(TripRequirement entity) { protected void postApprove(TripRequirement entity) {
if (entity.getState() == RequirementState.APPROVED) { if (entity.getState() != RequirementState.APPROVED) {
return;
}
List<TripBill> billList = getBills(entity);
boolean hasOwned = false;
for (TripBill tb : billList) {
if (tb.getOwnedBy().equals(entity.getOwnedBy())) {
hasOwned = true;
break;
}
}
if (!hasOwned) {
TripBill bill = tripBillService.createTripBill(entity); TripBill bill = tripBillService.createTripBill(entity);
tripBillService.add(bill); tripBillService.add(bill);
bill.setOwnedBy(entity.getOwnedBy()); bill.setOwnedBy(entity.getOwnedBy());
tripBillService.update(bill); tripBillService.update(bill);
}
if (entity.getBillForPassengers() != null && entity.getBillForPassengers()) { if (entity.getBillForPassengers() != null && entity.getBillForPassengers()) {
for (User u : entity.getPassengers()) { for (User u : entity.getPassengers()) {
if (!u.equals(entity.getOwnedBy())) { if (canCreateBill(entity, u, billList)) {
TripBill passBill = tripBillService.createTripBill(entity); TripBill passBill = tripBillService.createPassengersBill(entity);
tripBillService.add(passBill); tripBillService.add(passBill);
passBill.setOwnedBy(u); passBill.setOwnedBy(u);
tripBillService.update(passBill); tripBillService.update(passBill);
} }
} }
sendMailToPassengers(entity, settingsService.getSettings().getConfReqTripPassenger());
} }
} }
private boolean canCreateBill(TripRequirement req, User owner, List<TripBill> bills) {
if (owner.equals(req.getOwnedBy())) {
return false;
}
for (TripBill tb : bills) {
if (tb.getOwnedBy().equals(owner)) {
return false;
}
}
return true;
} }
@Override @Override
@@ -0,0 +1,20 @@
package info.bukova.isspst.services.signeddocs;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.Service;
import java.util.List;
public interface SignedDocumentService extends Service<SignedDocument> {
SignedDocument getForEntity(DataModel entity);
SignedDocumentItem getItem(DataModel entity, long reportId);
void addFromApprove(SignedDocument document);
void delFromApprove(SignedDocument document);
void deleteForEntity(DataModel entity);
public List<SignedDocument> getActualList();
public List<SignedDocument> getArchiveList();
}
@@ -0,0 +1,129 @@
package info.bukova.isspst.services.signeddocs;
import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.Module;
import info.bukova.isspst.ModuleUtils;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.storage.ReportFileStorage;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletContext;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
public class SignedDocumentServiceImpl extends AbstractOwnedService<SignedDocument> implements SignedDocumentService {
@Autowired
private ServletContext servletContext;
@Autowired
private ReportFileStorage signedDocStorage;
@LazyLoader("grid")
@Transactional
public void lazyLoadItems(SignedDocument signedDocument) {
if (signedDocument == null) {
return;
}
SignedDocument sd = dao.getById(signedDocument.getId());
Hibernate.initialize(sd.getItems());
signedDocument.setItems(sd.getItems());
}
@Override
@Transactional
public SignedDocument getForEntity(DataModel entity) {
Module module = ModuleUtils.getModule(entity, servletContext);
if (module == null) {
return null;
}
Query q = dao.getQuery("from SignedDocument where moduleName = :module and recordId = :record");
q.setParameter("module", module.getId());
q.setParameter("record", entity.getId());
return (SignedDocument) q.uniqueResult();
}
@Override
@Transactional
public SignedDocumentItem getItem(DataModel entity, long reportId) {
SignedDocument doc = getForEntity(entity);
if (doc == null) {
return null;
}
for (SignedDocumentItem item : doc.getItems()) {
if (item.getReportId() == reportId) {
return item;
}
}
return null;
}
@Override
public void addFromApprove(SignedDocument document) {
super.add(document);
}
@Override
public void delFromApprove(SignedDocument document) {
if (document == null) {
return;
}
super.delete(document);
for (SignedDocumentItem item : document.getItems()) {
signedDocStorage.removeFile(item);
}
}
@Override
@Transactional
public void deleteForEntity(DataModel entity) {
SignedDocument doc = getForEntity(entity);
if (doc != null) {
delFromApprove(doc);
}
}
private Date getTresholdDate() {
Date date = DateTimeUtils.getDateDelta(DateTimeUtils.getCurrDate(), Calendar.YEAR, -1);
return date;
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<SignedDocument> getActualList() {
Query q = dao.getQuery("from SignedDocument where signDate >= :refDate");
q.setParameter("refDate", this.getTresholdDate());
return q.list();
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<SignedDocument> getArchiveList() {
Query q = dao.getQuery("from SignedDocument where signDate < :refDate");
q.setParameter("refDate", this.getTresholdDate());
return q.list();
}
}
@@ -0,0 +1,18 @@
package info.bukova.isspst.services.tripbill;
import info.bukova.isspst.services.IsspstException;
/**
* @author Pepa Rokos
*/
public class PayException extends IsspstException {
public PayException() {
super();
}
public PayException(String message) {
super(message);
setReason(message);
}
}
@@ -10,5 +10,6 @@ import info.bukova.isspst.services.requirement.RequirementBaseService;
public interface TripBillApprovalService extends RequirementBaseService<TripBillApproval> { public interface TripBillApprovalService extends RequirementBaseService<TripBillApproval> {
public TripBillApproval createApproval(TripBill bill); public TripBillApproval createApproval(TripBill bill);
public void cancelApproval(TripBill bill);
} }
@@ -1,12 +1,18 @@
package info.bukova.isspst.services.tripbill; package info.bukova.isspst.services.tripbill;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.Module;
import info.bukova.isspst.ModuleUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval; import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.services.IsspstException; import info.bukova.isspst.services.IsspstException;
import info.bukova.isspst.services.requirement.RequirementBaseServiceImpl; import info.bukova.isspst.services.requirement.RequirementBaseServiceImpl;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -20,6 +26,10 @@ public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<Trip
@Autowired @Autowired
private RequirementTypeService reqTypeService; private RequirementTypeService reqTypeService;
@Autowired
private TripBillService tripBillService;
@Autowired
private SignedDocumentService signedDocumentService;
@Override @Override
public TripBillApproval createApproval(TripBill bill) { public TripBillApproval createApproval(TripBill bill) {
@@ -33,6 +43,9 @@ public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<Trip
approval.setReqDate(new Date()); approval.setReqDate(new Date());
approval.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP)); approval.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP));
approval.setState(RequirementState.NEW); approval.setState(RequirementState.NEW);
// approval.setNumser(bill.getRequirement().getNumser());
approval.setDescription(StringUtils.localize("TravelOrdersFormTitle") + " \"" + bill.getOwnedBy() + "\" - " + bill.getRequirement().getDescription());
approval.setBill(bill);
bill.setApproval(approval); bill.setApproval(approval);
return approval; return approval;
} }
@@ -48,4 +61,43 @@ public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<Trip
postAdd(entity); postAdd(entity);
} }
@Override
protected DataModel entityForSignReport(TripBillApproval entity) {
return entity.getBill();
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_DELETE') or this.canApprove(#bill.approval)")
public void cancelApproval(TripBill bill) {
bill.setApproval(null);
signedDocumentService.deleteForEntity(bill);
tripBillService.update(bill);
}
@Override
public Module getModule() {
return ModuleUtils.getModule(Constants.MOD_TRIPREQUIREMENTS);
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())")
public void delete(TripBillApproval entity) {
TripBill bill = entity.getBill();
if (bill == null) {
Query q = queryDao.getQuery("FROM TripBill WHERE APPROVAL_ID = :appId");
q.setInteger("appId", entity.getId());
bill = (TripBill) q.uniqueResult();
}
if (bill != null) {
dao.delete(entity);
cancelApproval(bill);
} else {
super.delete(entity);
}
}
} }
@@ -4,16 +4,19 @@ import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import java.util.Date;
import java.util.List; import java.util.List;
public interface TripBillService extends Service<TripBill> { public interface TripBillService extends Service<TripBill> {
public TripBill createTripBill(TripRequirement requirement); public TripBill createTripBill(TripRequirement requirement);
public TripBill createPassengersBill(TripRequirement requirement);
public void loadItems(TripBill bill); public void loadItems(TripBill bill);
public void calculate(TripBill bill); public void calculate(TripBill bill);
public List<TripBill> getMy(); public List<TripBill> getMy();
public void loadOwner(TripBill bill); public void loadOwner(TripBill bill);
public void loadPassengers(TripBill bill); public void loadPassengers(TripBill bill);
public void setPaid(TripBill bill, Date date);
/** /**
* Uloží vyúčtování a nastaví příznak přenosu vyúčtování od žadatele * Uloží vyúčtování a nastaví příznak přenosu vyúčtování od žadatele
@@ -23,6 +23,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implements public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implements
@@ -33,10 +34,23 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implemen
@Override @Override
public TripBill createTripBill(TripRequirement requirement) { public TripBill createTripBill(TripRequirement requirement) {
return createBill(requirement, false);
}
@Override
public TripBill createPassengersBill(TripRequirement requirement) {
return createBill(requirement, true);
}
private TripBill createBill(TripRequirement requirement, boolean passengers) {
TripBill bill = new TripBill(); TripBill bill = new TripBill();
bill.setRequirement(requirement); bill.setRequirement(requirement);
if (!passengers) {
bill.setDownPayment(requirement.getDownPayment());
}
int daysCount = Days.daysBetween((new DateTime(requirement.getTripDate())).withTimeAtStartOfDay(), int daysCount = Days.daysBetween((new DateTime(requirement.getTripDate())).withTimeAtStartOfDay(),
(new DateTime(requirement.getEndDate())).withTimeAtStartOfDay()).getDays() + 1; (new DateTime(requirement.getEndDate())).withTimeAtStartOfDay()).getDays() + 1;
@@ -102,8 +116,8 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implemen
bill.setTotal(bill.getTotal().add(item.getTotal())); bill.setTotal(bill.getTotal().add(item.getTotal()));
} }
if (bill.getRequirement().getDownPayment() != null) { if (bill.getDownPayment() != null) {
bill.setTotal(bill.getTotal().subtract(bill.getRequirement().getDownPayment())); bill.setTotal(bill.getTotal().subtract(bill.getDownPayment()));
} }
} }
@@ -199,6 +213,19 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implemen
bill.getRequirement().setPassengers(tr.getPassengers()); bill.getRequirement().setPassengers(tr.getPassengers());
} }
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_PAY_BILL')")
public void setPaid(TripBill bill, Date date) {
if (bill.getApproval() == null || bill.getApproval().getState() != RequirementState.APPROVED) {
throw new PayException("BillNotApproved");
}
bill.setPaid(true);
bill.setPaidDate(date);
super.update(bill);
}
@Override @Override
@Transactional @Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())") @PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
@@ -239,7 +266,9 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implemen
@Override @Override
public boolean canPrintRecord(TripBill entity) { public boolean canPrintRecord(TripBill entity) {
if (entity.getApproval() != null && entity.getApproval().getState() == RequirementState.APPROVED) { if (entity.getApproval() != null
&& entity.getApproval().getState() == RequirementState.APPROVED
&& (entity.getPaid() == null || !entity.getPaid())) {
return true; return true;
} }
@@ -3,9 +3,6 @@ package info.bukova.isspst.services.users;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.security.AuthMethod; import info.bukova.isspst.security.AuthMethod;
import java.util.Collection;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.ldap.core.DirContextAdapter; import org.springframework.ldap.core.DirContextAdapter;
@@ -16,6 +13,8 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider; import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider;
import org.springframework.security.ldap.userdetails.UserDetailsContextMapper; import org.springframework.security.ldap.userdetails.UserDetailsContextMapper;
import java.util.Collection;
/** /**
* Mapovač doménových uživatelů Active Directory na uživatele aplikace. Pokud uživatel není v aplikační databází, * Mapovač doménových uživatelů Active Directory na uživatele aplikace. Pokud uživatel není v aplikační databází,
* importu je se tam pomoci {@link LdapUserImporter}. Tento objekt se předává do {@link ActiveDirectoryLdapAuthenticationProvider}. * importu je se tam pomoci {@link LdapUserImporter}. Tento objekt se předává do {@link ActiveDirectoryLdapAuthenticationProvider}.
@@ -40,6 +39,7 @@ public class AdUserCtxMapper implements UserDetailsContextMapper {
@Override @Override
public UserDetails mapUserFromContext(DirContextOperations userData, public UserDetails mapUserFromContext(DirContextOperations userData,
String username, Collection<? extends GrantedAuthority> authorities) { String username, Collection<? extends GrantedAuthority> authorities) {
username = username.toLowerCase();
try { try {
User user = (User) userService.loadUserByUsername(username); User user = (User) userService.loadUserByUsername(username);
@@ -7,15 +7,7 @@ import info.bukova.isspst.data.UserSettingsData;
import info.bukova.isspst.security.AuthMethod; import info.bukova.isspst.security.AuthMethod;
import info.bukova.isspst.services.AbstractService; import info.bukova.isspst.services.AbstractService;
import info.bukova.isspst.services.StringXmlMarshaller; import info.bukova.isspst.services.StringXmlMarshaller;
//import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.Unmarshaller;
import org.hibernate.LazyInitializationException; import org.hibernate.LazyInitializationException;
@@ -31,6 +23,13 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
//import info.bukova.isspst.services.LazyLoader;
public class UserServiceImpl extends AbstractService<User> implements UserService { public class UserServiceImpl extends AbstractService<User> implements UserService {
private PasswordEncoder encoder; private PasswordEncoder encoder;
@@ -220,6 +219,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
} }
@Override @Override
@Transactional
public void delete(User entity) { public void delete(User entity) {
workgroupService.loadParents(entity); workgroupService.loadParents(entity);
@@ -234,7 +234,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
@Override @Override
@Transactional @Transactional
public List<User> getUsersForCombo() { public List<User> getUsersForCombo() {
Query q = dao.getQuery("from User u order by u.lastName"); Query q = dao.getQuery("from User u where u.enabled = true order by u.lastName");
return q.list(); return q.list();
} }
@@ -0,0 +1,10 @@
package info.bukova.isspst.signapi;
/**
* @author Pepa Rokos
*/
public interface JnlpGenerator {
public byte[] generate();
}
@@ -0,0 +1,121 @@
package info.bukova.isspst.signapi;
import org.springframework.beans.factory.annotation.Autowired;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.servlet.http.HttpServletRequest;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.ByteArrayOutputStream;
/**
* @author Pepa Rokos
*/
public class JnlpGeneratorImpl implements JnlpGenerator {
@Autowired
private HttpServletRequest request;
@Override
public byte[] generate() {
String sessionId;
if (request.getParameter("id") != null && !request.getParameter("id").isEmpty()) {
sessionId = request.getParameter("id");
} else {
sessionId = request.getSession().getId();
}
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document document = docBuilder.newDocument();
Element root = document.createElement("jnlp");
root.setAttribute("spec", "1.0+");
String signerUrl = request.getRequestURL().toString();
signerUrl = signerUrl.substring(0, signerUrl.indexOf(request.getServletPath())) + "/api/sign";
root.setAttribute("codebase", signerUrl);
root.setAttribute("href", "signer.jnlp" + "?id=" + sessionId);
document.appendChild(root);
Element info = document.createElement("information");
Element title = document.createElement("title");
title.appendChild(document.createTextNode("Signer component"));
info.appendChild(title);
Element vendor = document.createElement("vendor");
vendor.appendChild(document.createTextNode("bukova.info"));
info.appendChild(vendor);
root.appendChild(info);
Element security = document.createElement("security");
security.appendChild(document.createElement("all-permissions"));
root.appendChild(security);
Element resources = document.createElement("resources");
resources.setAttribute("os", "Linux");
Element j2se = document.createElement("j2se");
j2se.setAttribute("version", "1.8+");
Element jar = document.createElement("jar");
jar.setAttribute("href", "pdfsigner.jar");
resources.appendChild(j2se);
resources.appendChild(jar);
root.appendChild(resources);
Element resourcesWin = document.createElement("resources");
resourcesWin.setAttribute("os", "Windows");
Element j2seWin = document.createElement("j2se");
j2seWin.setAttribute("version", "1.8+");
Element jarWin = document.createElement("jar");
jarWin.setAttribute("href", "pdfsignerWin.jar");
resourcesWin.appendChild(j2seWin);
resourcesWin.appendChild(jarWin);
root.appendChild(resourcesWin);
Element appDesc = document.createElement("application-desc");
appDesc.setAttribute("main-class", "info.bukova.pdfsigner.Main");
Element argUrl = document.createElement("argument");
argUrl.appendChild(document.createTextNode(signerUrl + "/data"));
appDesc.appendChild(argUrl);
Element argSession = document.createElement("argument");
argSession.appendChild(document.createTextNode(sessionId));
appDesc.appendChild(argSession);
root.appendChild(appDesc);
System.out.println(signerUrl);
System.out.println(request.getSession().getId());
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(document);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
StreamResult result = new StreamResult(bos);
transformer.transform(source, result);
return bos.toByteArray();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
}
return null;
}
}
@@ -0,0 +1,92 @@
package info.bukova.isspst.signapi;
import java.io.Serializable;
import java.util.Date;
/**
* @author Pepa Rokos
*/
public class SignData implements Serializable {
private byte[] pdfData;
private byte[] signImg;
private int areaId;
private Date signDate;
private String description;
private String numser;
private boolean signed;
private String signGuid;
private boolean signSuccess;
public byte[] getPdfData() {
return pdfData;
}
public void setPdfData(byte[] pdfData) {
this.pdfData = pdfData;
}
public Date getSignDate() {
return signDate;
}
public void setSignDate(Date signDate) {
this.signDate = signDate;
}
public String getNumser() {
return numser;
}
public void setNumser(String numser) {
this.numser = numser;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isSigned() {
return signed;
}
public void setSigned(boolean signed) {
this.signed = signed;
}
public String getSignGuid() {
return signGuid;
}
public void setSignGuid(String signGuid) {
this.signGuid = signGuid;
}
public boolean isSignSuccess() {
return signSuccess;
}
public void setSignSuccess(boolean signSuccess) {
this.signSuccess = signSuccess;
}
public byte[] getSignImg() {
return signImg;
}
public void setSignImg(byte[] signImg) {
this.signImg = signImg;
}
public int getAreaId() {
return areaId;
}
public void setAreaId(int areaId) {
this.areaId = areaId;
}
}
@@ -0,0 +1,28 @@
package info.bukova.isspst.signapi;
import java.io.Serializable;
/**
* @author Pepa Rokos
*/
public class SignUploadResponse implements Serializable {
private boolean ok;
private String errorMessage;
public boolean isOk() {
return ok;
}
public void setOk(boolean ok) {
this.ok = ok;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
}
@@ -0,0 +1,148 @@
package info.bukova.isspst.signapi;
import info.bukova.isspst.Constants;
import info.bukova.isspst.SessionData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/**
* @author Pepa Rokos
*/
@Controller
public class SigningController {
@Autowired
private SessionData sessionData;
@Autowired
private JnlpGenerator jnlpGenerator;
@Autowired
private ServletContext context;
@RequestMapping(value="/sign/data", method= RequestMethod.GET)
public void dataForSign(HttpServletResponse response, HttpServletRequest request) {
SignData data = (SignData) sessionData.getProperty(Constants.KEY_SIGN_DATA);
ObjectOutputStream os = null;
try {
os = new ObjectOutputStream(response.getOutputStream());
response.setContentType("application/x-java-serialized-object");
os.writeObject(data);
os.flush();
os.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@RequestMapping(value="/sign/data", method= RequestMethod.POST)
public void signedData(HttpServletRequest request, HttpServletResponse response) {
ObjectInputStream ois = null;
ObjectOutputStream os = null;
String error = null;
try {
ois = new ObjectInputStream(request.getInputStream());
SignData data = (SignData) ois.readObject();
sessionData.setProperty(Constants.KEY_SIGN_DATA, data);
} catch (IOException e) {
e.printStackTrace();
error = "IO error";
} catch (ClassNotFoundException e) {
e.printStackTrace();
error = "Loading error";
}
try {
SignUploadResponse resp = new SignUploadResponse();
if (error == null) {
resp.setOk(true);
} else {
resp.setOk(false);
resp.setErrorMessage(error);
}
os = new ObjectOutputStream(response.getOutputStream());
response.setContentType("application/x-java-serialized-object");
os.writeObject(resp);
os.flush();
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping(value="/sign/signer.jnlp", method= RequestMethod.GET)
public void jnlp(HttpServletResponse response) {
byte[] data = jnlpGenerator.generate();
sendByte(response, data, "application/x-java-jnlp-file");
}
@RequestMapping(value="/sign/pdfsigner.jar", method= RequestMethod.GET)
public void pdfsigner(HttpServletResponse response) {
sendJar(response, "Linux");
}
@RequestMapping(value="/sign/pdfsignerWin.jar", method= RequestMethod.GET)
public void pdfsignerWin(HttpServletResponse response) {
sendJar(response, "Windows");
}
private void sendJar(HttpServletResponse response, String os) {
File inputJar;
if (os.startsWith("Windows")) {
inputJar = new File(context.getRealPath("/WEB-INF/signer/PDFSignerWin.jar"));
} else {
inputJar = new File(context.getRealPath("/WEB-INF/signer/PDFSigner.jar"));
}
try {
byte[] data = new byte[(int) inputJar.length()];
FileInputStream is = new FileInputStream(inputJar);
is.read(data);
sendByte(response, data, "application/java-archive");
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
private void sendByte(HttpServletResponse response, byte[] data, String contentType) {
ServletOutputStream os = null;
try {
os = response.getOutputStream();
response.setContentType(contentType);
response.setContentLength(data.length);
os.write(data);
os.flush();
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -19,9 +19,9 @@ public abstract class AbstractFileStorage<T> implements FileStorage<T> {
os.flush(); os.flush();
os.close(); os.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); throw new StorageException("File cannot be found: " + file.getName(), e.getCause());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new StorageException("Cannot write file: " + file.getName(), e.getCause());
} finally { } finally {
try { try {
if (os != null) { if (os != null) {
@@ -0,0 +1,10 @@
package info.bukova.isspst.storage;
import info.bukova.isspst.data.SignedDocumentItem;
/**
* @author Pepa Rokos
*/
public interface ReportFileStorage extends FileStorage<SignedDocumentItem> {
}
@@ -0,0 +1,75 @@
package info.bukova.isspst.storage;
import info.bukova.isspst.data.SignedDocumentItem;
import java.io.File;
import java.util.UUID;
/**
* @author Pepa Rokos
*/
public class ReportFileStorageImpl extends AbstractFileStorage<SignedDocumentItem> implements ReportFileStorage {
private String rootPath;
public void setRootPath(String rootPath) {
this.rootPath = rootPath;
}
private String getFilePath(String fileName) {
return rootPath + "/" + fileName;
}
@Override
public void saveFile(byte[] data, SignedDocumentItem signedDocumentItem) {
String fileName = signedDocumentItem.getFileName();
if (fileName == null) {
fileName = UUID.randomUUID().toString() + ".pdf";
}
saveFileDataToPath(data, getFilePath(fileName));
signedDocumentItem.setFileName(fileName);
}
@Override
public void saveFile(File file, SignedDocumentItem fileId) {
throw new UnsupportedOperationException();
}
@Override
public void removeFile(SignedDocumentItem signedDocumentItem) {
removeFileByPath(getFilePath(signedDocumentItem.getFileName()));
}
@Override
public void moveFile(String source, String destination) {
throw new UnsupportedOperationException();
}
@Override
public void createDirectory(String dir) {
throw new UnsupportedOperationException();
}
@Override
public byte[] fileData(SignedDocumentItem signedDocumentItem) {
return fileDataFromPath(getFilePath(signedDocumentItem.getFileName()));
}
@Override
public File file(SignedDocumentItem signedDocumentItem) {
return null;
}
@Override
public boolean dirExists(String path) {
return false;
}
@Override
public String serverPath(SignedDocumentItem signedDocumentItem) {
return null;
}
}
@@ -0,0 +1,19 @@
package info.bukova.isspst.ui;
import org.zkoss.bind.annotation.Init;
public class BindingViewModel<T> extends DocumentViewModel {
private BindingForm<T> dataForm;
@Init
public void initBindingViewModel() {
super.initDocumentViewModel();
dataForm = new BindingForm<T>();
}
public BindingForm<T> getDataForm() {
return this.dataForm;
}
}
@@ -20,28 +20,26 @@ import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
public class FormViewModel<T extends DataModel> extends DocumentViewModel public class FormViewModel<T extends DataModel> extends BindingViewModel<T>
{ {
private T dataBean; private T dataBean;
private Map<String, String> errMessages; private Map<String, String> errMessages;
private Service<T> service; private Service<T> service;
private boolean newRec; private boolean newRec;
private ServiceConstraint<T> constraint; private ServiceConstraint<T> constraint;
private BindingForm<T> dataForm;
@Init @Init
public void initFormViewModel(@ExecutionArgParam("selected") T selected, @ExecutionArgParam("service") Service<T> service) public void initFormViewModel(@ExecutionArgParam("selected") T selected, @ExecutionArgParam("service") Service<T> service)
{ {
super.initDocumentViewModel(); super.initBindingViewModel();
this.dataBean = selected; this.dataBean = selected;
this.service = service; this.service = service;
constraint = new ServiceConstraint<T>(); constraint = new ServiceConstraint<T>();
constraint.setDataBean(selected); constraint.setDataBean(selected);
constraint.setService(service); constraint.setService(service);
dataForm = new BindingForm<T>();
dataForm.setDataBean(selected); this.getDataForm().setDataBean(selected);
if (selected.getId() == 0 && selected.getCreated() == null) if (selected.getId() == 0 && selected.getCreated() == null)
{ {
@@ -186,9 +184,4 @@ public class FormViewModel<T extends DataModel> extends DocumentViewModel
{ {
return true; return true;
} }
public BindingForm<T> getDataForm() {
return dataForm;
}
} }
@@ -5,12 +5,6 @@ import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.filters.Filter; import info.bukova.isspst.filters.Filter;
import info.bukova.isspst.services.IsspstException; import info.bukova.isspst.services.IsspstException;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
@@ -27,6 +21,11 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ListViewModel<T extends DataModel> extends DocumentViewModel public class ListViewModel<T extends DataModel> extends DocumentViewModel
{ {
@@ -185,7 +184,6 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
} }
@Command @Command
@NotifyChange({ "dataList", "dataBean" })
public void delete() { public void delete() {
Messagebox.show(StringUtils.localize("DbReallyDelete"), StringUtils.localize("DbDeleteRecord"), Messagebox.YES Messagebox.show(StringUtils.localize("DbReallyDelete"), StringUtils.localize("DbDeleteRecord"), Messagebox.YES
| Messagebox.NO, Messagebox.QUESTION, | Messagebox.NO, Messagebox.QUESTION,
@@ -277,7 +275,7 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
} }
@Command @Command
@NotifyChange({"selIndex", "dataBean"}) @NotifyChange({"selIndex", "dataBean", "ableToDelete"})
public void afterRender() { public void afterRender() {
if (editBean != null && !editBean.isValid()) { if (editBean != null && !editBean.isValid()) {
return; return;
@@ -1,9 +1,5 @@
package info.bukova.isspst.ui.mail; package info.bukova.isspst.ui.mail;
import static ch.lambdaj.Lambda.filter;
import static ch.lambdaj.Lambda.having;
import static ch.lambdaj.Lambda.on;
import static org.hamcrest.Matchers.startsWith;
import info.bukova.isspst.data.Address; import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.Member; import info.bukova.isspst.data.Member;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
@@ -15,10 +11,6 @@ import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.services.addressbook.AdbService; import info.bukova.isspst.services.addressbook.AdbService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.DocumentViewModel; import info.bukova.isspst.ui.DocumentViewModel;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
@@ -28,6 +20,14 @@ import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.util.ArrayList;
import java.util.List;
import static ch.lambdaj.Lambda.filter;
import static ch.lambdaj.Lambda.having;
import static ch.lambdaj.Lambda.on;
import static org.hamcrest.Matchers.startsWith;
public class MailForm extends DocumentViewModel public class MailForm extends DocumentViewModel
{ {
@@ -69,7 +69,7 @@ public class MailForm extends DocumentViewModel
addressbook = new ArrayList<Address>(); addressbook = new ArrayList<Address>();
} }
users = userService.getAll(); users = userService.getUsersForCombo();
selectedAddresses = new ArrayList<Address>(); selectedAddresses = new ArrayList<Address>();
selectedUsers = new ArrayList<User>(); selectedUsers = new ArrayList<User>();
@@ -1,15 +1,21 @@
package info.bukova.isspst.ui.main; package info.bukova.isspst.ui.main;
import info.bukova.isspst.Constants;
import info.bukova.isspst.SessionData;
import info.bukova.isspst.StringUtils; import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.RequirementBase; import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.services.requirement.ApproveException; import info.bukova.isspst.services.requirement.ApproveException;
import info.bukova.isspst.services.requirement.RequirementBaseService; import info.bukova.isspst.services.requirement.RequirementBaseService;
import info.bukova.isspst.signapi.SignData;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
import org.zkoss.bind.BindUtils; import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ExecutionArgParam; import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
@@ -24,6 +30,12 @@ public class ApproveDialogVM {
private RequirementBase requirement; private RequirementBase requirement;
private ListViewModel grid; private ListViewModel grid;
private Date approveDate; private Date approveDate;
@WireVariable
private SessionData sessionData;
private boolean signed;
private boolean signRequired;
private boolean timer;
private byte[] signedPdf;
public Date getApproveDate() { public Date getApproveDate() {
return approveDate; return approveDate;
@@ -41,12 +53,22 @@ public class ApproveDialogVM {
this.requirement = requirement; this.requirement = requirement;
this.grid = grid; this.grid = grid;
this.approveDate = new Date(); this.approveDate = new Date();
if (service.getNextWorkflow(requirement).getSignature() != null
&& service.getNextWorkflow(requirement).getSignature()) {
this.signed = false;
this.signRequired = true;
} else {
this.signRequired = false;
}
this.timer = false;
} }
@Command @Command
public void approve(@BindingParam("window") Window window) { public void approve(@BindingParam("window") Window window) {
try { try {
service.approve(requirement, approveDate); service.approve(requirement, approveDate, signedPdf);
BindUtils.postNotifyChange(null, null, grid, "dataBean"); BindUtils.postNotifyChange(null, null, grid, "dataBean");
BindUtils.postNotifyChange(null, null, grid, "canApprove"); BindUtils.postNotifyChange(null, null, grid, "canApprove");
BindUtils.postGlobalCommand(null, null, "reload", null); BindUtils.postGlobalCommand(null, null, "reload", null);
@@ -57,4 +79,39 @@ public class ApproveDialogVM {
} }
} }
@Command
@NotifyChange("timer")
public void signPdf() {
if (service.prepareSignData(requirement, approveDate)) {
timer = true;
Executions.getCurrent().sendRedirect("/api/sign/signer.jnlp", "signer");
}
}
@Command
@NotifyChange({"signed", "timer"})
public void onTimer() {
String guid = (String) sessionData.getProperty(Constants.KEY_SIGN_GUID);
SignData data = (SignData) sessionData.getProperty(Constants.KEY_SIGN_DATA);
if (guid.equals(data.getSignGuid()) && data.isSignSuccess()) {
signed = true;
timer = false;
signedPdf = data.getPdfData();
} else {
signed = false;
}
}
public boolean isSigned() {
return signed;
}
public boolean isTimer() {
return timer;
}
public boolean isSignRequired() {
return signRequired;
}
} }
@@ -29,7 +29,6 @@ public class InvoicingList extends ListViewModel<Invoicing> {
public void initInvoicing() { public void initInvoicing() {
service = invoicingService; service = invoicingService;
dataClass = Invoicing.class; dataClass = Invoicing.class;
formZul = "invoicingForm.zul";
dataFilter = new InvoicingFilter(getFilterTemplate()); dataFilter = new InvoicingFilter(getFilterTemplate());
} }
@@ -0,0 +1,30 @@
package info.bukova.isspst.ui.main.invoicing;
import info.bukova.isspst.data.Invoicing;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.Init;
import java.util.ArrayList;
import java.util.List;
public class InvoicingMaterialArchiveList extends InvoicingList {
@Init(superclass = true)
public void initInvoicingMaterialArchiveList()
{
formZul = "/main/invoicing/material/invHeadForm.zul";
}
@Override
protected List<Invoicing> getListFromService() {
try
{
return invoicingService.getMaterialArchiveList();
}
catch (AccessDeniedException e)
{
e.printStackTrace();
return new ArrayList<Invoicing>();
}
}
}
@@ -0,0 +1,30 @@
package info.bukova.isspst.ui.main.invoicing;
import info.bukova.isspst.data.Invoicing;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.Init;
import java.util.ArrayList;
import java.util.List;
public class InvoicingMaterialPendingList extends InvoicingList {
@Init(superclass = true)
public void initInvoicingMaterialPendingList()
{
formZul = "/main/invoicing/material/invHeadForm.zul";
}
@Override
protected List<Invoicing> getListFromService() {
try
{
return invoicingService.getMaterialPendingList();
}
catch (AccessDeniedException e)
{
e.printStackTrace();
return new ArrayList<Invoicing>();
}
}
}
@@ -1,32 +0,0 @@
package info.bukova.isspst.ui.main.invoicing;
import info.bukova.isspst.data.Invoicing;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.Init;
public class InvoicingPendingList extends InvoicingList
{
@Init(superclass = true)
public void initInvoicingPendingList()
{
}
@Override
protected List<Invoicing> getListFromService()
{
try
{
return invoicingService.getPendingList();
}
catch (AccessDeniedException e)
{
// BindUtils.postGlobalCommand(null, null, "disableCentre", null);
// e.printStackTrace();
return new ArrayList<Invoicing>();
}
}
}
@@ -0,0 +1,30 @@
package info.bukova.isspst.ui.main.invoicing;
import info.bukova.isspst.data.Invoicing;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.Init;
import java.util.ArrayList;
import java.util.List;
public class InvoicingServicesArchiveList extends InvoicingList {
@Init(superclass = true)
public void initInvoicingServicesArchiveList()
{
formZul = "/main/invoicing/services/invHeadForm.zul";
}
@Override
protected List<Invoicing> getListFromService() {
try
{
return invoicingService.getServicesArchiveList();
}
catch (AccessDeniedException e)
{
e.printStackTrace();
return new ArrayList<Invoicing>();
}
}
}
@@ -0,0 +1,30 @@
package info.bukova.isspst.ui.main.invoicing;
import info.bukova.isspst.data.Invoicing;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.Init;
import java.util.ArrayList;
import java.util.List;
public class InvoicingServicesPendingList extends InvoicingList {
@Init(superclass = true)
public void initInvoicingServicesPendingList()
{
formZul = "/main/invoicing/services/invHeadForm.zul";
}
@Override
protected List<Invoicing> getListFromService() {
try
{
return invoicingService.getServicesPendingList();
}
catch (AccessDeniedException e)
{
e.printStackTrace();
return new ArrayList<Invoicing>();
}
}
}
@@ -0,0 +1,22 @@
package info.bukova.isspst.ui.renderers;
import info.bukova.isspst.data.JobMapping;
import info.bukova.isspst.data.User;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
/**
* @author Pepa Rokos
*/
public class JobMappingItemRenderer extends GenericListitemRenderer<JobMapping> {
@Override
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm) {
JobMapping jm = getObjectOfStates();
if (jm.getMember() instanceof User && !((User)jm.getMember()).isEnabled()) {
li.setSclass("user-disabled");
}
}
}
@@ -0,0 +1,40 @@
package info.bukova.isspst.ui.renderers;
import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBillApproval;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
/**
* @author Pepa Rokos
*/
public class TripBillApprovalItemRenderer extends GenericListitemRenderer<TripBillApproval> {
@Override
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm) {
RequirementState state = getObjectOfStates().getState();
if (state != null) {
if (state == RequirementState.PARTIALLY) {
li.setSclass("req-select-partially");
}
else if (state == RequirementState.APPROVED) {
Boolean isPaid;
if (getObjectOfStates().getBill() == null) {
isPaid = false;
} else {
isPaid = getObjectOfStates().getBill().getPaid();
}
if ((isPaid != null) && (isPaid.booleanValue() == true)) {
li.setSclass("req-select-approved-project");
}
else {
li.setSclass("req-select-approved");
}
}
}
}
}
@@ -0,0 +1,20 @@
package info.bukova.isspst.ui.renderers;
import info.bukova.isspst.data.User;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
/**
* @author Pepa Rokos
*/
public class UserItemRenderer extends GenericListitemRenderer<User> {
@Override
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm) {
User u = getObjectOfStates();
if (!u.isEnabled()) {
li.setSclass("user-disabled");
}
}
}
@@ -1,9 +1,13 @@
package info.bukova.isspst.ui.reporting; package info.bukova.isspst.ui.reporting;
import info.bukova.isspst.Module;
import info.bukova.isspst.ModuleUtils;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.reporting.Report; import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportDefinition; import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.reporting.ReportType; import info.bukova.isspst.reporting.ReportType;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.ui.DocumentViewModel; import info.bukova.isspst.ui.DocumentViewModel;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
@@ -11,9 +15,12 @@ import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import javax.servlet.ServletContext;
import java.lang.reflect.InvocationTargetException;
import java.util.List; import java.util.List;
public class ReportDialogVM extends DocumentViewModel public class ReportDialogVM extends DocumentViewModel
@@ -25,6 +32,7 @@ public class ReportDialogVM extends DocumentViewModel
private ReportDefinition reportDefinition; private ReportDefinition reportDefinition;
private List<Object> dataList; private List<Object> dataList;
private Object singleObject; private Object singleObject;
private ServletContext ctx;
@Init(superclass = true) @Init(superclass = true)
public void init(@ExecutionArgParam("reports") List<Report> reports, public void init(@ExecutionArgParam("reports") List<Report> reports,
@@ -40,6 +48,8 @@ public class ReportDialogVM extends DocumentViewModel
dataList = data; dataList = data;
this.singleObject = singleObject; this.singleObject = singleObject;
reportDefinition.setService(service); reportDefinition.setService(service);
ctx = Sessions.getCurrent().getWebApp().getServletContext();
} }
public List<Report> getReports() { public List<Report> getReports() {
@@ -59,12 +69,37 @@ public class ReportDialogVM extends DocumentViewModel
this.selected = selected; this.selected = selected;
reportDefinition.setReport(selected); reportDefinition.setReport(selected);
if (selected.isSingleRecord()) { if (selected.isSingleRecord()) {
reportDefinition.setSingleObject(singleObject); setObject(selected);
} else { } else {
reportDefinition.setDataSet(dataList); reportDefinition.setDataSet(dataList);
} }
} }
private void setObject(Report report) {
if (report.getProperty() == null) {
reportDefinition.setSingleObject(singleObject);
} else {
try {
Object o = ReflectionTools.getGetterMethod(singleObject, report.getProperty()).invoke(singleObject);
reportDefinition.setSingleObject(o);
if (!(o instanceof DataModel)) {
return;
}
Module m = ModuleUtils.getModule((DataModel)o, ctx);
if (m != null) {
reportDefinition.setService((Service<Object>) ModuleUtils.getServiceInstance(m, ctx));
}
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
@Command @Command
public void print(@BindingParam("window") Window window) { public void print(@BindingParam("window") Window window) {
if (window != null) { if (window != null) {
@@ -50,7 +50,7 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
this.requirementsItemRenderer = new RequirementsItemRenderer(); this.requirementsItemRenderer = new RequirementsItemRenderer();
} }
private RequirementBaseService<T> getReqService() protected RequirementBaseService<T> getReqService()
{ {
return (RequirementBaseService<T>) service; return (RequirementBaseService<T>) service;
} }
@@ -6,13 +6,6 @@ import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workflow; import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.GlobalCommand;
@@ -24,6 +17,12 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RequirementTypesVM { public class RequirementTypesVM {
@WireVariable @WireVariable
@@ -237,6 +236,18 @@ public class RequirementTypesVM {
win.doModal(); win.doModal();
} }
@Command
@NotifyChange({"selected", "centreSelWorkflow", "wgSelWorkflow"})
public void toggleSignature(@BindingParam("workflow") Workflow workflow) {
if (workflow.getSignature() != null && workflow.getSignature()) {
workflow.setSignature(false);
} else {
workflow.setSignature(true);
}
reqTypeService.update(selected);
}
@GlobalCommand @GlobalCommand
@NotifyChange("selected") @NotifyChange("selected")
public void refresh() { public void refresh() {
@@ -6,13 +6,13 @@ import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.SettingsData; import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.data.Vehicle; import info.bukova.isspst.data.Vehicle;
import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.sort.ReflectionTools; import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.storage.FileStorage; import info.bukova.isspst.storage.FileStorage;
import info.bukova.isspst.ui.DocumentViewModel; import info.bukova.isspst.ui.BindingViewModel;
import info.bukova.isspst.ui.LocaleConverter; import info.bukova.isspst.ui.LocaleConverter;
import info.bukova.isspst.ui.SecurityHelper; import info.bukova.isspst.ui.SecurityHelper;
import info.bukova.isspst.validators.GlobalSettingValidator;
import java.awt.image.RenderedImage; import java.awt.image.RenderedImage;
import java.io.IOException; import java.io.IOException;
@@ -23,6 +23,10 @@ import java.util.Set;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.SimpleForm;
import org.zkoss.bind.Validator;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam; import org.zkoss.bind.annotation.ContextParam;
@@ -33,8 +37,9 @@ import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
public class GlobalSettingsVM extends DocumentViewModel public class GlobalSettingsVM extends BindingViewModel<SettingsData>
{ {
private final static Logger log = LoggerFactory.getLogger(GlobalSettingsVM.class.getName());
@WireVariable @WireVariable
private GlobalSettingsService settingsService; private GlobalSettingsService settingsService;
@@ -45,11 +50,16 @@ public class GlobalSettingsVM extends DocumentViewModel
@WireVariable @WireVariable
private FileStorage storage; private FileStorage storage;
private Validator globalSettingValidator;
@Init(superclass = true) @Init(superclass = true)
public void init() { public void init(@BindingParam("window") Window mainWindow) {
settings = settingsService.getSettings(); settings = settingsService.getSettings();
locConverter = new LocaleConverter(); locConverter = new LocaleConverter();
setRefundsHours(settings.getRefunds().keySet()); setRefundsHours(settings.getRefunds().keySet());
this.getDataForm().setDataBean(this.settings);
this.globalSettingValidator = new GlobalSettingValidator(mainWindow);
} }
public SettingsData getSettings() { public SettingsData getSettings() {
@@ -108,16 +118,35 @@ public class GlobalSettingsVM extends DocumentViewModel
return locConverter; return locConverter;
} }
@Command private void insertString(SimpleForm form, String property, String field) {
@NotifyChange("settings") if (form == null) {
public void insertField(@BindingParam("field") String field, @BindingParam("message") MailMessage message) { log.warn("SimpleForm neexistuje !!!");
message.setText(message.getText() + "[" + field + "]"); return;
}
Set<String> set = form.getFieldNames();
if (set.contains(property)) {
String text = (String) form.getField(property);
text += "[" + field + "]";
form.setField(property, text);
this.getDataForm().bind();
return;
}
log.warn("SimpleForm property '" + property + "' neexistuje !!!");
} }
@Command @Command
@NotifyChange("settings") @NotifyChange("settings")
public void insertUrl(@BindingParam("message") MailMessage message) { public void insertField2Fx(@BindingParam("form") SimpleForm form, @BindingParam("property") String property, @BindingParam("field") String field) {
message.setText(message.getText() + "[-url-]"); this.insertString(form, property, field);
}
@Command
@NotifyChange("settings")
public void insertUrl2Fx(@BindingParam("form") SimpleForm form, @BindingParam("property") String property) {
this.insertString(form, property, Constants.MAIL_URL_KEYWORD);
} }
@Command @Command
@@ -185,4 +214,12 @@ public class GlobalSettingsVM extends DocumentViewModel
return null; return null;
} }
} }
public Validator getGlobalSettingValidator() {
return globalSettingValidator;
}
public void setGlobalSettingValidator(Validator globalSettingValidator) {
this.globalSettingValidator = globalSettingValidator;
}
} }
@@ -0,0 +1,29 @@
package info.bukova.isspst.ui.signeddocs;
import info.bukova.isspst.data.SignedDocument;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.Init;
public class SignedDocsActualList extends SignedDocsList {
@Init(superclass = true)
public void SignedDocsActualListInit() {
}
@Override
protected List<SignedDocument> getListFromService() {
try {
return signedDocumentService.getActualList();
}
catch (AccessDeniedException e) {
// BindUtils.postGlobalCommand(null, null, "disableCentre", null);
// e.printStackTrace();
return new ArrayList<SignedDocument>();
}
}
}
@@ -0,0 +1,30 @@
package info.bukova.isspst.ui.signeddocs;
import info.bukova.isspst.data.SignedDocument;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.Init;
public class SignedDocsArchiveList extends SignedDocsList {
@Init(superclass = true)
public void SignedDocsArchiveListInit() {
}
@Override
protected List<SignedDocument> getListFromService() {
try {
return signedDocumentService.getArchiveList();
}
catch (AccessDeniedException e) {
// BindUtils.postGlobalCommand(null, null, "disableCentre", null);
// e.printStackTrace();
return new ArrayList<SignedDocument>();
}
}
}
@@ -0,0 +1,86 @@
package info.bukova.isspst.ui.signeddocs;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.filters.SignedDocumentFilter;
import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.ui.ListViewModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Window;
import java.util.ArrayList;
import java.util.List;
public class SignedDocsList extends ListViewModel<SignedDocument>
{
@SuppressWarnings("unused")
private final static Logger log = LoggerFactory.getLogger(SignedDocsList.class.getName());
@WireVariable
protected SignedDocumentService signedDocumentService;
protected SignedDocumentItem signedDocumentItem;
protected List<SignedDocumentItem> signedDocumentItems;
@WireVariable
private ReportDefinition reportDefinition;
@Init(superclass = true)
public void initSignedDocsList() {
service = signedDocumentService;
dataClass = SignedDocument.class;
formZul = "form.zul";
dataFilter = new SignedDocumentFilter(getFilterTemplate());
this.signedDocumentItem = null;
this.signedDocumentItems = new ArrayList<SignedDocumentItem>();
}
public SignedDocumentItem getSignedDocumentItem() {
return signedDocumentItem;
}
public void setSignedDocumentItem(SignedDocumentItem signedDocumentItem) {
this.signedDocumentItem = signedDocumentItem;
}
public List<SignedDocumentItem> getSignedDocumentItems() {
return signedDocumentItems;
}
public void setSignedDocumentItems(List<SignedDocumentItem> signedDocumentItems) {
this.signedDocumentItems = signedDocumentItems;
}
@Command
@NotifyChange("signedDocumentItems")
public void onChangeSelectSignedDocs(@BindingParam("ctrl") Listbox lb) {
if (lb == null) {
return;
}
if (lb.getSelectedIndex() > -1) {
this.signedDocumentItems = this.getDataBean().getItems();
}
else {
this.signedDocumentItems = new ArrayList<SignedDocumentItem>();
}
}
@Command
public void onOpen(@BindingParam("item") SignedDocumentItem item) {
reportDefinition.clear();
reportDefinition.setSignedDocItem(item);
Window reportWin = (Window) Executions.createComponents("/app/reporting/report.zul", null, null);
reportWin.doModal();
}
}
@@ -0,0 +1,60 @@
package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.services.tripbill.PayException;
import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.ui.ListViewModel;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window;
import java.util.Date;
/**
* @author Pepa Rokos
*/
public class PayDialogVM {
@WireVariable
private TripBillService tripBillService;
private TripBill bill;
private ListViewModel grid;
private Date payDate;
@Init
public void init(@ExecutionArgParam("bill") TripBill bill,
@ExecutionArgParam("grid") ListViewModel grid) {
this.bill = bill;
this.grid = grid;
}
@Command
public void pay(@BindingParam("window") Window window) {
try {
tripBillService.setPaid(bill, payDate);
BindUtils.postNotifyChange(null, null, grid, "dataBean");
BindUtils.postGlobalCommand(null, null, "reload", null);
window.detach();
} catch (PayException ex) {
Messagebox.show(StringUtils.localize(ex.getReason()), StringUtils.localize("Error"), Messagebox.OK,
Messagebox.ERROR);
} catch (AccessDeniedException ex) {
Messagebox.show(StringUtils.localize("ErrorRights"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
}
}
public Date getPayDate() {
return payDate;
}
public void setPayDate(Date payDate) {
this.payDate = payDate;
}
}
@@ -3,11 +3,13 @@ package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.StringUtils; import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval; import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.data.TripBillItem;
import info.bukova.isspst.data.Vehicle; import info.bukova.isspst.data.Vehicle;
import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.tripbill.TripBillApprovalService; import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.tripbill.TripBillService; import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.ui.FormWithUpload; import info.bukova.isspst.ui.FormWithUpload;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
@@ -19,6 +21,7 @@ import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
public class TripBillForm extends FormWithUpload<TripBill> { public class TripBillForm extends FormWithUpload<TripBill> {
@@ -36,6 +39,11 @@ public class TripBillForm extends FormWithUpload<TripBill> {
vehicles = new ArrayList<Vehicle>(); vehicles = new ArrayList<Vehicle>();
vehicles.add(null); vehicles.add(null);
vehicles.addAll(settingsService.getSettings().getVehicles()); vehicles.addAll(settingsService.getSettings().getVehicles());
TripBill bill = getDataBean();
if (bill.getResultMessageDate() == null) {
bill.setResultMessageDate(new Date());
}
} }
@Command @Command
@@ -56,14 +64,11 @@ public class TripBillForm extends FormWithUpload<TripBill> {
return false; return false;
} }
@Override
@Command @Command
@NotifyChange("errMessages") @NotifyChange("errMessages")
public void save(@BindingParam("window") Window win) public void saveForApproval(@BindingParam("window") Window win)
{ {
if (StringUtils.isNullOrTrimmedEmpty(this.getDataBean().getResultMessage())) if (!canSaveForApproval()) {
{
Messagebox.show(StringUtils.localize("ErrFillTripBillResultMessageText"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
return; return;
} }
@@ -78,6 +83,7 @@ public class TripBillForm extends FormWithUpload<TripBill> {
TripBillApproval approval = tripBillApprovalService.createApproval(getDataBean()); TripBillApproval approval = tripBillApprovalService.createApproval(getDataBean());
tripBillApprovalService.add(approval); tripBillApprovalService.add(approval);
TripBillForm.super.save(editWin); TripBillForm.super.save(editWin);
BindUtils.postGlobalCommand(null, null, "refresh", null);
} else { } else {
TripBillForm.super.save(editWin); TripBillForm.super.save(editWin);
} }
@@ -89,6 +95,26 @@ public class TripBillForm extends FormWithUpload<TripBill> {
} }
private boolean canSaveForApproval() {
if (StringUtils.isNullOrTrimmedEmpty(this.getDataBean().getResultMessage())) {
Messagebox.show(StringUtils.localize("ErrFillTripBillResultMessageText"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
return false;
}
if (getDataBean().getBillItems() != null && !getDataBean().getBillItems().isEmpty()) {
TripBillItem first = getDataBean().getBillItems().get(0);
TripBillItem last = getDataBean().getBillItems().get(getDataBean().getBillItems().size() - 1);
if (first.getToArrival() == null || first.getToDeparture() == null
|| last.getBackArrival() == null || last.getBackDeparture() == null) {
Messagebox.show(StringUtils.localize("ErrFillTripBillResultTimes"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
return false;
}
}
return true;
}
@Override @Override
protected void doSave() { protected void doSave() {
maintainAttachment(); maintainAttachment();
@@ -0,0 +1,34 @@
package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.data.TripBillApproval;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Init;
import java.util.ArrayList;
import java.util.List;
/**
* @author Pepa Rokos
*/
public class TripBillListAll extends TripBillListBase {
@Init(superclass = true)
public void initAllList() {
}
@Override
protected List<TripBillApproval> getListFromService() {
try {
return getReqService().getAll();
} catch (AccessDeniedException e) {
BindUtils.postGlobalCommand(null, null, "disableAll", null);
return new ArrayList<TripBillApproval>();
}
}
@Override
protected void beforeSelectViaUrl() {
BindUtils.postGlobalCommand(null, null, "selectAll", null);
}
}
@@ -0,0 +1,86 @@
package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.User;
import info.bukova.isspst.filters.TripBillApprovalFilter;
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.renderers.TripBillApprovalItemRenderer;
import info.bukova.isspst.ui.requirement.RequirementSubpage;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Pepa Rokos
*/
public class TripBillListBase extends RequirementSubpage<TripBillApproval> {
@WireVariable
private TripBillApprovalService tripBillApprovalService;
private TripBillApprovalItemRenderer itemRenderer;
@WireVariable
private TripBillService tripBillService;
@WireVariable
private UserService userService;
private List<User> allUsers;
@Init(superclass = true)
public void initListBase() {
service = tripBillApprovalService;
itemRenderer = new TripBillApprovalItemRenderer();
dataClass = TripBillApproval.class;
TripBillApproval filter = getFilterTemplate();
TripBill tb = new TripBill();
tb.setRequirement(new TripRequirement());
filter.setBill(tb);
dataFilter = new TripBillApprovalFilter(filter);
allUsers = userService.getUsersForCombo();
}
public TripBillApprovalItemRenderer getItemRenderer() {
return itemRenderer;
}
@Command
public void pay() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("bill", getDataBean().getBill());
params.put("grid", this);
Window payDialog = (Window) Executions.createComponents("payDialog.zul", null, params);
payDialog.doModal();
}
@Command
@Override
public void edit() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("selected", getDataBean().getBill());
tripBillService.loadLazyData(getDataBean().getBill());
Window win = (Window) Executions.createComponents("../requirements/tripBill.zul", null, params);
win.doModal();
}
@Override
public List<User> getAllUsers() {
return allUsers;
}
@GlobalCommand
@NotifyChange({ "dataList", "dataBean", "fullFill" })
public void reloadRelated()
{
this.reload();
}
}
@@ -0,0 +1,34 @@
package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.data.TripBillApproval;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Init;
import java.util.ArrayList;
import java.util.List;
/**
* @author Pepa Rokos
*/
public class TripBillListCentre extends TripBillListBase {
@Init(superclass = true)
public void initListCentre() {
}
@Override
protected List<TripBillApproval> getListFromService() {
try {
return getReqService().getCentreReq();
} catch (AccessDeniedException e) {
BindUtils.postGlobalCommand(null, null, "disableCentre", null);
return new ArrayList<TripBillApproval>();
}
}
@Override
protected void beforeSelectViaUrl() {
BindUtils.postGlobalCommand(null, null, "selectCentre", null);
}
}
@@ -0,0 +1,35 @@
package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.data.TripBillApproval;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Init;
import java.util.ArrayList;
import java.util.List;
/**
* @author Pepa Rokos
*/
public class TripBillListWorkgroup extends TripBillListBase {
@Init(superclass = true)
public void initWorkgroupList() {
}
@Override
protected List<TripBillApproval> getListFromService() {
try {
return getReqService().getWorkgroupReq();
} catch (AccessDeniedException e) {
BindUtils.postGlobalCommand(null, null, "disableWorkgroup", null);
return new ArrayList<TripBillApproval>();
}
}
@Override
protected void beforeSelectViaUrl() {
BindUtils.postGlobalCommand(null, null, "selectWorkgroup", null);
}
}
@@ -1,12 +1,15 @@
package info.bukova.isspst.ui.tripbill; package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval; import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.services.requirement.TripRequirementService; import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.tripbill.TripBillApprovalService; import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.tripbill.TripBillService; import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.requirement.RequirementSubpage; import info.bukova.isspst.ui.requirement.RequirementSubpage;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ExecutionArgParam; import org.zkoss.bind.annotation.ExecutionArgParam;
@@ -14,7 +17,10 @@ import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.util.ArrayList; import java.util.ArrayList;
@@ -33,6 +39,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
private TripBillService tripBillService; private TripBillService tripBillService;
@WireVariable @WireVariable
private TripRequirementService tripRequirementService; private TripRequirementService tripRequirementService;
@WireVariable
private UserService userService;
private TripBill bill; private TripBill bill;
private Map<Integer, Boolean> selTab; private Map<Integer, Boolean> selTab;
@@ -71,11 +79,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
bills.add(this.bill); bills.add(this.bill);
if (bill.getApproval().getState() != RequirementState.APPROVED) { if (selectTab(bill)) {
isSelectedTad = true; isSelectedTad = true;
selTab.put(bill.getId(), true);
} else {
selTab.put(bill.getId(), false);
} }
for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) { for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) {
@@ -83,11 +88,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
tripBillService.loadLazyData(b); tripBillService.loadLazyData(b);
bills.add(b); bills.add(b);
if (!isSelectedTad && b.getApproval().getState() != RequirementState.APPROVED) { if (!isSelectedTad && selectTab(b)) {
setBill(b);
isSelectedTad = true; isSelectedTad = true;
} else {
selTab.put(b.getId(), false);
} }
} }
} }
@@ -99,6 +101,19 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
return bills; return bills;
} }
private boolean selectTab(TripBill bill) {
if (bill.getApproval() != null
&& bill.getApproval().getState() != RequirementState.APPROVED
&& tripBillApprovalService.getNextApprover(bill.getApproval()).contains(userService.getCurrent())) {
setBill(bill);
return true;
} else {
selTab.put(bill.getId(), false);
}
return false;
}
@Command @Command
public void showBill(@BindingParam("bill") TripBill bill) { public void showBill(@BindingParam("bill") TripBill bill) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
@@ -111,10 +126,29 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
@GlobalCommand @GlobalCommand
@NotifyChange("dataBean") @NotifyChange("dataBean")
public void reload() { public void reload() {
if (bill.getApproval() != null) {
setDataBean(tripBillApprovalService.getById(bill.getApproval().getId())); setDataBean(tripBillApprovalService.getById(bill.getApproval().getId()));
} }
}
public Map<Integer, Boolean> getSelTab() { public Map<Integer, Boolean> getSelTab() {
return selTab; return selTab;
} }
@Command
public void cancelApproval() {
Messagebox.show(StringUtils.localize("TripBillCancelApprovalQuestion"), StringUtils.localize("TripBillCancelApprovalTitle"), Messagebox.YES
| Messagebox.NO, Messagebox.QUESTION, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
if (((Integer) event.getData()).intValue() == Messagebox.YES) {
tripBillApprovalService.cancelApproval(bill);
setDataBean(null);
BindUtils.postNotifyChange(null, null, TripBillSummaryVM.this, "bill");
BindUtils.postNotifyChange(null, null, TripBillSummaryVM.this, "dataBean");
BindUtils.postNotifyChange(null, null, TripBillSummaryVM.this, "canApprove");
}
}
});
}
} }
@@ -9,19 +9,20 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.filters.UserFilter; import info.bukova.isspst.filters.UserFilter;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
import info.bukova.isspst.ui.renderers.UserItemRenderer;
import java.util.ArrayList;
import java.util.List;
import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import java.util.ArrayList;
import java.util.List;
public class UsersList extends ListViewModel<User> { public class UsersList extends ListViewModel<User> {
@WireVariable @WireVariable
private UserService userService; private UserService userService;
private UserItemRenderer itemRenderer;
@Init @Init
public void init() { public void init() {
@@ -29,6 +30,7 @@ public class UsersList extends ListViewModel<User> {
dataClass = User.class; dataClass = User.class;
formZul = "userForm.zul"; formZul = "userForm.zul";
dataFilter = new UserFilter(getFilterTemplate()); dataFilter = new UserFilter(getFilterTemplate());
itemRenderer = new UserItemRenderer();
} }
public List<Module> getModules() { public List<Module> getModules() {
@@ -88,5 +90,7 @@ public class UsersList extends ListViewModel<User> {
return true; return true;
} }
public UserItemRenderer getItemRenderer() {
return itemRenderer;
}
} }
@@ -13,11 +13,8 @@ import info.bukova.isspst.services.workgroups.WorkgroupException;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.BigDecimalConverter; import info.bukova.isspst.ui.BigDecimalConverter;
import info.bukova.isspst.ui.FormViewModel; import info.bukova.isspst.ui.FormViewModel;
import info.bukova.isspst.ui.renderers.JobMappingItemRenderer;
import java.util.ArrayList; import info.bukova.isspst.ui.renderers.UserItemRenderer;
import java.util.List;
import java.util.Set;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
@@ -27,8 +24,14 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import static ch.lambdaj.Lambda.*; import java.util.ArrayList;
import static org.hamcrest.Matchers.*; import java.util.List;
import java.util.Set;
import static ch.lambdaj.Lambda.filter;
import static ch.lambdaj.Lambda.having;
import static ch.lambdaj.Lambda.on;
import static org.hamcrest.Matchers.startsWith;
public class WorkgroupForm extends FormViewModel<Workgroup> { public class WorkgroupForm extends FormViewModel<Workgroup> {
@@ -42,6 +45,8 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
private String findUser; private String findUser;
private List<Member> selectedUsers; private List<Member> selectedUsers;
private BigDecimalConverter bdConverter; private BigDecimalConverter bdConverter;
private JobMappingItemRenderer itemRenderer;
private UserItemRenderer userItemRenderer;
@Init(superclass = true) @Init(superclass = true)
public void init() { public void init() {
@@ -49,6 +54,8 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
users.addAll(userService.getAll()); users.addAll(userService.getAll());
selectedUsers = new ArrayList<Member>(); selectedUsers = new ArrayList<Member>();
bdConverter = new BigDecimalConverter(); bdConverter = new BigDecimalConverter();
itemRenderer = new JobMappingItemRenderer();
userItemRenderer = new UserItemRenderer();
} }
public List<Member> getUsers() { public List<Member> getUsers() {
@@ -239,4 +246,11 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
return bdConverter; return bdConverter;
} }
public JobMappingItemRenderer getItemRenderer() {
return itemRenderer;
}
public UserItemRenderer getUserItemRenderer() {
return userItemRenderer;
}
} }
@@ -1,11 +1,12 @@
package info.bukova.isspst.validators; package info.bukova.isspst.validators;
import info.bukova.isspst.StringUtils;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import info.bukova.isspst.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.Property; import org.zkoss.bind.Property;
import org.zkoss.bind.ValidationContext; import org.zkoss.bind.ValidationContext;
import org.zkoss.bind.validator.AbstractValidator; import org.zkoss.bind.validator.AbstractValidator;
@@ -17,7 +18,11 @@ import org.zkoss.zul.Messagebox;
public abstract class BaseValidator extends AbstractValidator public abstract class BaseValidator extends AbstractValidator
{ {
HtmlBasedComponent htmlComponent; private final static Logger log = LoggerFactory.getLogger(BaseValidator.class.getName());
protected ValidationContext ctx;
private HtmlBasedComponent htmlComponent;
protected Logger getLogger() protected Logger getLogger()
{ {
@@ -124,4 +129,38 @@ public abstract class BaseValidator extends AbstractValidator
return (String)value; return (String)value;
} }
protected String getStringProperty(String propertyName) {
if (this.ctx == null) {
log.warn("Neznámý ValidationContext!!!");
return "";
}
if (StringUtils.isNullOrTrimmedEmpty(propertyName)) {
log.warn("Chybné propertyName!!!");
return "";
}
Property property = ctx.getProperties(propertyName)[0];
if (property == null) {
log.warn("Neexistující propertyName!!!");
return "";
}
Object o = property.getValue();
if (o instanceof String) {
return (String) o;
}
else {
log.warn("Chybný typ property '" + propertyName + "'!!!");
return "";
}
}
@Override
public void validate(ValidationContext ctx) {
this.ctx = ctx;
}
} }
@@ -0,0 +1,155 @@
package info.bukova.isspst.validators;
import info.bukova.isspst.Constants;
import info.bukova.isspst.RegExUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.sort.ReflectionTools;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.ValidationContext;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabbox;
import org.zkoss.zul.Window;
public class GlobalSettingValidator extends BaseValidator {
private final static Logger log = LoggerFactory.getLogger(GlobalSettingValidator.class.getName());
private Window mainWindow;
private SettingsData settingsData;
public GlobalSettingValidator(Window mainWindow) {
this.mainWindow = mainWindow;
}
private String SwitchTabs(String idIncludedPage, String idTabBox, String idTab, boolean select) {
if (this.mainWindow == null) {
log.warn("Neznámé okno globálního nastavení!!!");
return "";
}
if (StringUtils.isNullOrEmpty(idTabBox) || StringUtils.isNullOrEmpty(idTab)) {
log.warn("Neznámý Tabbox nebo Tab identifikátor globálního nastavení!!!");
return "";
}
Component component = this.mainWindow;
if (!StringUtils.isNullOrEmpty(idIncludedPage)) {
Component includedPageComponent = component.getFellow(idIncludedPage);
if (includedPageComponent != null) {
component = includedPageComponent;
}
}
Tabbox tabBox = (Tabbox) component.getFellowIfAny(idTabBox, true);
if (tabBox == null) {
log.warn("Neznámý Tabbox identifikátor '" + idTabBox + "' globálního nastavení!!!");
return "";
}
else {
Tab tab = (Tab) component.getFellowIfAny(idTab, true);
if (tab == null) {
log.warn("Neznámý Tab identifikátor '" + idTab + "' globálního nastavení!!!");
return "";
}
else {
if (select) {
tabBox.setSelectedTab(tab);
}
return tab.getLabel();
}
}
}
private void validateMailMessage(String text, String idTab, String idComponent) {
if (this.ctx == null) {
log.warn("Neznámý ValidationContext!!!");
return;
}
List<String> properties = ReflectionTools.getEntityFields(Requirement.class);
properties.add(Constants.MAIL_URL_KEYWORD);
if (StringUtils.isNullOrEmpty(text)) {
return;
}
List<String> matches;
final String regex = "\\[([^\\[\\]]*?)\\]";
matches = RegExUtils.getMatches(text, regex, 1);
String message = "";
for (int i = 0; i < matches.size(); i++) {
String propertyCandidate = matches.get(i);
if (!properties.contains(propertyCandidate)) {
message = "Vlastnost [" + propertyCandidate + "] neexistuje!";
break;
}
}
if (StringUtils.isNullOrEmpty(message)) {
text = text.replaceAll(regex, "");
}
if (StringUtils.isNullOrEmpty(message) && text.contains("[")) {
message = "Chybně použitý speciální znak '[' !\n";
}
if (StringUtils.isNullOrEmpty(message) && text.contains("]")) {
message = "Chybně použitý speciální znak ']' !\n";
}
boolean badCondition = !StringUtils.isNullOrEmpty(message);
if (badCondition) {
this.SwitchTabs("", "idTabBox", "idTabEmails", true);
this.SwitchTabs("idIncludedPageEmails", "idTabBoxEmails", idTab, true);
this.errorMsg(this.ctx, message, idComponent);
}
}
@Override
public void validate(ValidationContext ctx) {
super.validate(ctx);
// Map<String, Property[]> map = ctx.getProperties();
//
// for (Map.Entry<String, Property[]> entry : map.entrySet()) {
// String key = entry.getKey();
// Property[] values = entry.getValue();
// }
String value;
value = this.getStringProperty("newReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsNewRequirement", "idEmailNewReqTemplateText");
value = this.getStringProperty("authReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsAuthRequirement", "idEmailAuthReqTemplateText");
value = this.getStringProperty("confReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsConfirmRequirement", "idEmailConfReqTemplateText");
value = this.getStringProperty("reqPassenger.text");
this.validateMailMessage(value, "idTabEmailsReqTripPassengers", "idEmailReqPassengerTemplateText");
value = this.getStringProperty("confReqTripPassenger.text");
this.validateMailMessage(value, "idTabEmailsConfirmTripPassengers", "idEmailConfReqTripPassengerTemplateText");
}
}
@@ -22,12 +22,25 @@ public class RequirementFormValidator extends BaseValidator
public void validate(ValidationContext ctx) public void validate(ValidationContext ctx)
{ {
Property propertyCentre = ctx.getProperties("centre")[0]; Property propertyCentre = ctx.getProperties("centre")[0];
if (propertyCentre != null) {
Workgroup workgroup = (Workgroup) propertyCentre.getValue(); Workgroup workgroup = (Workgroup) propertyCentre.getValue();
if (workgroup == null) if (workgroup == null) {
{
this.errorMsg(ctx, StringUtils.localize("RequirementCenterIsEmpty"), "idReqCenter"); this.errorMsg(ctx, StringUtils.localize("RequirementCenterIsEmpty"), "idReqCenter");
return; return;
} }
} }
Property propertyDescription = ctx.getProperties("description")[0];
if (propertyDescription != null) {
String description = (String) propertyDescription.getValue();
if (StringUtils.isNullOrTrimmedEmpty(description)) {
this.errorMsg(ctx, StringUtils.localize("ErrMaterialOrServiceDescription"), "idDescription");
return;
}
}
}
} }
+2
View File
@@ -36,5 +36,7 @@
<mapping class="info.bukova.isspst.data.FileMetainfo"></mapping> <mapping class="info.bukova.isspst.data.FileMetainfo"></mapping>
<mapping class="info.bukova.isspst.data.FileContent"></mapping> <mapping class="info.bukova.isspst.data.FileContent"></mapping>
<mapping class="info.bukova.isspst.data.TripBillApproval"></mapping> <mapping class="info.bukova.isspst.data.TripBillApproval"></mapping>
<mapping class="info.bukova.isspst.data.SignedDocument"></mapping>
<mapping class="info.bukova.isspst.data.SignedDocumentItem"></mapping>
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>
@@ -0,0 +1 @@
net.sf.jasperreports.extension.registry.factory.sig=info.bukova.isspst.reporting.SignaturePdfHandler
@@ -1,5 +1,11 @@
# Default file # Default file
AppName=Objednávkový systém SPŠ Třebíč AppName=Informační systém SPŠ Třebíč
AgendaSignedDocuments=Podepsané dokumenty
ActualDocuments=Aktuální dokumenty
AgendaName=Název agendy
SigningDate=Datum podepsání
PrintReports=Tiskové sestavy
FileName=Název souboru
AgendaActRequirements=Aktuální požadavky AgendaActRequirements=Aktuální požadavky
AgendaRequirementsHistory=Ukončené požadavky AgendaRequirementsHistory=Ukončené požadavky
@@ -167,6 +173,8 @@ EMails=E-maily
NewRequirement=Nový požadavek NewRequirement=Nový požadavek
AuthRequirement=Dílčí schválení AuthRequirement=Dílčí schválení
ConfirmRequirement=Schválení ConfirmRequirement=Schválení
ConfirmTripPassengers=Schválení SC - spolucestující
ReqTripPassengers=SC - spolucestujici
InsertField=Vložit pole InsertField=Vložit pole
EnableRequirements=Povolit zadávání požadavků EnableRequirements=Povolit zadávání požadavků
ShippingAddresses=Dodací adresy: ShippingAddresses=Dodací adresy:
@@ -233,9 +241,18 @@ TripBillBack=Zpět
TripBillTotal=Celkem TripBillTotal=Celkem
TripBillSaveApprove=Jestliže máte vše vyplněno, pošlete vyúčtování ke schválení. Vyúčtování zaslané ke schválení už nelze dále upravovat. Odeslat ke schválení? TripBillSaveApprove=Jestliže máte vše vyplněno, pošlete vyúčtování ke schválení. Vyúčtování zaslané ke schválení už nelze dále upravovat. Odeslat ke schválení?
TripBillSave=Odeslat ke schválení? TripBillSave=Odeslat ke schválení?
TripBillCancelApproval=Zrušit schválení a povolit úpravy
TripBillCancelApprovalQuestion=Opravdu zrušít schválení tohoto vyúčtování?
TripBillCancelApprovalTitle=Zrušit schválení
TripBillPaid=Proplaceno
TripBillPaidDate=Datum proplacení
TripBillPay=Proplatit
TripBillSummaryDetail=Detail TripBillSummaryDetail=Detail
TripBilling=Proplacení vyúčtování
BillNotApproved=Vyúčtování není schválené, nelze proplatit.
TripRequirement=Požadavek na služební cestu TripRequirement=Požadavek na služební cestu
ShowTripBill=Zobrazit vyúčtování ShowTripBill=Zobrazit vyúčtování
@@ -340,8 +357,8 @@ SelectGroup=Vybrat skupinu...
RemoveItem=Smazat RemoveItem=Smazat
Confirm=Potvrdit Confirm=Potvrdit
StudentProject = Studentský projekt StudentProject = Zajistím sám
StudentProjectAbr = St. projekt StudentProjectAbr = Zaj. sám
Amount=Částka Amount=Částka
Owner=Vlastník Owner=Vlastník
@@ -375,6 +392,9 @@ InvoicingDescription=Popis
InvoicingInvoiced=Fakturováno InvoicingInvoiced=Fakturováno
InvoicingApplicant=Žadatel InvoicingApplicant=Žadatel
InvoicingMaterial=Fakturace požadavků na materiál
InvoicingServices=Fakturace požadavků na servis
HandleComboKeyFilter=#del HandleComboKeyFilter=#del
HandleComboKey=$#del HandleComboKey=$#del
@@ -396,10 +416,18 @@ Pending = Nevyřízené
Archive = Archiv Archive = Archiv
Completed = Vyřízeno Completed = Vyřízeno
GenerateBillingForPassengers = Generovat vyúčtování pro spolucestující GenerateBillingForPassengers = Generovat společný požadavek a vyúčtování
Passenger = Pasažér Passenger = Pasažér
ChooseThePasseger = Vyberte pasažéra ChooseThePasseger = Vyberte pasažéra
TransportMode = Způsob dopravy TransportMode = Způsob dopravy
ForeignPersons = Cizí osoby ForeignPersons = Cizí osoby
TripBillResultMessageText = Zpráva z pracovní cesty TripBillResultMessageText = Zpráva z pracovní cesty
ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty. ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty.
ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu.
ErrApproveMustBeSigned = Schválení musí být digitálně podepsané.
DigitalSignature = Elektronický podpis
ContextMenu = Volby v kontextovém menu
ErrMaterialOrServiceDescription=Zadejte popis požadavku.
@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="orderRequirement" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="abff8784-0f6e-4a9a-bf8e-f2285ba6e75f">
<property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="284"/>
<property name="ireport.y" value="0"/>
<parameter name="P_LOGO" class="java.lang.String"/>
<parameter name="P_MAIN_ADDRESS" class="java.lang.String"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["/home/pepa/Dokumenty/dev/java/isspst/"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<field name="authorization" class="java.util.List">
<fieldDescription><![CDATA[authorization]]></fieldDescription>
</field>
<field name="centre" class="info.bukova.isspst.data.Workgroup">
<fieldDescription><![CDATA[centre]]></fieldDescription>
</field>
<field name="items" class="java.util.List">
<fieldDescription><![CDATA[items]]></fieldDescription>
</field>
<field name="ownedBy" class="info.bukova.isspst.data.User">
<fieldDescription><![CDATA[ownedBy]]></fieldDescription>
</field>
<field name="numser" class="java.lang.String">
<fieldDescription><![CDATA[numser]]></fieldDescription>
</field>
<field name="reqDate" class="java.util.Date">
<fieldDescription><![CDATA[reqDate]]></fieldDescription>
</field>
<field name="sumTotal" class="java.math.BigDecimal">
<fieldDescription><![CDATA[sumTotal]]></fieldDescription>
</field>
<field name="workgroup" class="info.bukova.isspst.data.Workgroup">
<fieldDescription><![CDATA[workgroup]]></fieldDescription>
</field>
<field name="description" class="java.lang.String">
<fieldDescription><![CDATA[description]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="54" splitType="Stretch">
<image onErrorType="Blank">
<reportElement uuid="692a2c5d-a058-4f16-8c03-dd0739d45ffb" x="0" y="0" width="100" height="54">
<printWhenExpression><![CDATA[$P{P_LOGO} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_LOGO}]]></imageExpression>
</image>
<textField isBlankWhenNull="true">
<reportElement uuid="42aa4bd4-8b58-4e06-b7d9-ab3f1082b739" x="100" y="0" width="455" height="20"/>
<textElement textAlignment="Center">
<font isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="3672bded-2358-40b4-a0f3-037e7fc50fa3" x="100" y="20" width="455" height="20"/>
<textElement textAlignment="Center">
<font isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Protokol o předběžné kontrole]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="41" splitType="Stretch">
<textField>
<reportElement uuid="d1468362-4eba-425c-8534-f80eab528580" x="0" y="20" width="83" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{numser}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="b9b69697-354b-4cb0-a84c-a41fea872d15" x="0" y="0" width="83" height="20"/>
<textElement/>
<text><![CDATA[Poř. číslo]]></text>
</staticText>
<textField>
<reportElement uuid="09f38f15-b1e4-4975-997c-e70f19078c24" x="83" y="20" width="140" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[""+$F{centre}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="8e7dfc80-cdf7-4777-b0f2-35a98e02a339" x="223" y="20" width="140" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[""+$F{workgroup}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="2f5cd1fb-4f7e-4e9f-ba7c-b1f7b288a625" x="363" y="20" width="113" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[""+$F{ownedBy}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="8eaf7add-3fe8-4115-9154-27c4b8904650" x="476" y="20" width="79" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{reqDate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="01cebcaf-0e12-4a09-8956-590d45e19eef" x="83" y="0" width="140" height="20"/>
<textElement/>
<text><![CDATA[Středisko]]></text>
</staticText>
<staticText>
<reportElement uuid="17ac2428-7d56-411b-bcd9-7348df757b84" x="223" y="0" width="140" height="20"/>
<textElement/>
<text><![CDATA[Komise]]></text>
</staticText>
<staticText>
<reportElement uuid="f7790fa3-c39e-41ad-b94d-93c69afb14a9" x="363" y="0" width="113" height="20"/>
<textElement/>
<text><![CDATA[Vytvořil]]></text>
</staticText>
<staticText>
<reportElement uuid="93d65bd9-27b6-4952-a8eb-d57b14665d2b" x="476" y="0" width="79" height="20"/>
<textElement/>
<text><![CDATA[Datum]]></text>
</staticText>
<line>
<reportElement uuid="b93cc333-922f-404d-86d1-3af92064c807" x="0" y="40" width="555" height="1"/>
<graphicElement>
<pen lineStyle="Solid"/>
</graphicElement>
</line>
<line>
<reportElement uuid="f47cde5f-e0f7-4578-b3d7-4b1774284e0b" x="0" y="0" width="555" height="1"/>
</line>
<line>
<reportElement uuid="9ab3a189-c15e-4031-bc2e-ff329d4400c4" x="475" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="5c7c3117-8911-426d-ba2a-1b2ca842801d" x="362" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="a0968b35-779d-4b3c-9168-edfaa22e4cc3" x="554" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="2e919fcb-44aa-4a7a-bc86-8a6597f702e3" x="222" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="cf230cb5-d75e-41c5-8a26-5c65fdbddd82" x="82" y="0" width="1" height="40"/>
</line>
<line>
<reportElement uuid="da4a873e-2347-4362-9f29-59eb20b6d40b" x="-1" y="0" width="1" height="41"/>
</line>
</band>
</pageHeader>
<detail>
<band height="78" splitType="Stretch">
<subreport>
<reportElement uuid="6ba491d5-dc90-4be4-b70e-d7aae44ad3ce" x="0" y="4" width="554" height="73"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{items})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "orderRequirementItems.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<summary>
<band height="72" splitType="Stretch">
<staticText>
<reportElement uuid="f170d5a4-9595-4aee-8b1f-dc761b603a40" x="-1" y="10" width="59" height="20"/>
<textElement/>
<text><![CDATA[Příkazce:]]></text>
</staticText>
<genericElement>
<reportElement uuid="af57c2c2-8459-4647-9506-cc900edad55a" x="61" y="0" width="148" height="42"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[1]]></valueExpression>
</genericElementParameter>
</genericElement>
<staticText>
<reportElement uuid="c33d945b-9a1e-456a-bf36-c3e761540b78" x="223" y="10" width="100" height="20"/>
<textElement/>
<text><![CDATA[Správce rozpočtu:]]></text>
</staticText>
<genericElement>
<reportElement uuid="13896576-2961-40c4-a186-b89f54676644" x="323" y="0" width="148" height="42"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[3]]></valueExpression>
</genericElementParameter>
</genericElement>
<staticText>
<reportElement uuid="f37ccd3c-f71f-4c6e-a850-a9699f73e867" x="-1" y="52" width="555" height="20"/>
<textElement/>
<text><![CDATA[Pověření pracovníci potvrzují svými podpisy provedení předběžné kontroly v souladu se zákonem č. 320/2001 Sb.]]></text>
</staticText>
</band>
</summary>
</jasperReport>
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="orderRequirementItems" pageWidth="552" pageHeight="842" columnWidth="552" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="7908f48d-e554-48b1-b4dd-c11ef78facbd">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="textItem" class="java.lang.String">
<fieldDescription><![CDATA[textItem]]></fieldDescription>
</field>
<field name="quantity" class="java.math.BigDecimal">
<fieldDescription><![CDATA[quantity]]></fieldDescription>
</field>
<field name="total" class="java.math.BigDecimal">
<fieldDescription><![CDATA[total]]></fieldDescription>
</field>
<field name="description" class="java.lang.String">
<fieldDescription><![CDATA[description]]></fieldDescription>
</field>
<variable name="sumTotal" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{total}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="31" splitType="Stretch">
<staticText>
<reportElement uuid="a09b3d2e-cf95-4881-93c6-708e11b6c085" x="2" y="2" width="211" height="29"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<text><![CDATA[Text položky]]></text>
</staticText>
<staticText>
<reportElement uuid="1b89a66f-1905-4c2c-a60a-8c493f7a7d9d" x="215" y="2" width="61" height="29"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<text><![CDATA[Množství]]></text>
</staticText>
<staticText>
<reportElement uuid="b38f8df2-e54a-4245-a9cb-7620ce2136f2" x="276" y="2" width="77" height="29"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<text><![CDATA[Předpokládaná celková cena]]></text>
</staticText>
<staticText>
<reportElement uuid="9ee00ce3-4d8a-4383-be96-e92301bff873" x="353" y="2" width="199" height="29"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<text><![CDATA[Poznámka]]></text>
</staticText>
<line>
<reportElement uuid="2d2a338f-570f-476c-97b0-5c6dde159fbe" x="352" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="6a7b4ebd-13ff-4174-b7a7-5e2d52e4556a" x="551" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="23a1033c-ab45-41fa-8fe0-4b7266efec08" x="275" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="440059ef-8740-4aa7-9a9f-444331d74065" x="214" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="4d61086f-7725-4cf7-bba0-084f02a4f7d1" x="0" y="0" width="1" height="31"/>
</line>
<line>
<reportElement uuid="004f8f2d-a8e6-470b-b0ca-97df8d0f82f7" x="0" y="-1" width="552" height="1"/>
</line>
<line>
<reportElement uuid="939c6d77-7055-4443-8495-e0f9ef3c231f" x="1" y="30" width="550" height="1"/>
</line>
</band>
</columnHeader>
<detail>
<band height="21" splitType="Stretch">
<textField>
<reportElement uuid="5723f178-f940-4925-ad9a-1fa697eb49c7" x="2" y="0" width="211" height="20"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{textItem}]]></textFieldExpression>
</textField>
<textField pattern="###0.00;-###0.00">
<reportElement uuid="6ff7e0cc-488f-4195-bccc-69b3e155cc13" x="276" y="0" width="76" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="dd95129e-6e74-4421-86e4-35484ebccdb0" x="353" y="0" width="199" height="20"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
</textField>
<textField pattern="###0.00;-###0.00">
<reportElement uuid="557ae236-bf5e-44b3-ba24-84c68fbeb5c5" x="215" y="0" width="60" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{quantity}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="8c57dfc4-31ce-44d4-b7b1-879b52dfb0fa" x="0" y="20" width="552" height="1"/>
</line>
<line>
<reportElement uuid="ffd7b1b5-43a6-4514-b4f4-12c7ab88a240" x="0" y="0" width="1" height="20"/>
</line>
<line>
<reportElement uuid="a11c2dbf-c5ee-4149-bde7-02166952e438" x="214" y="0" width="1" height="20"/>
</line>
<line>
<reportElement uuid="ee379730-e4de-4d94-9089-5f1e1de0533c" x="275" y="0" width="1" height="20"/>
</line>
<line>
<reportElement uuid="7e562dde-1389-4dad-9dce-bc746cbf86e1" x="352" y="0" width="1" height="20"/>
</line>
<line>
<reportElement uuid="3f1e7aab-88dd-4a0c-9da2-3d20d93e1ace" x="551" y="0" width="1" height="20"/>
</line>
</band>
</detail>
<summary>
<band height="21" splitType="Stretch">
<textField pattern="###0.00;-###0.00">
<reportElement uuid="1d885404-1f6d-4249-ba4d-80ded0762cc8" x="276" y="0" width="76" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{sumTotal}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="078354a7-cce2-4bd5-9e2c-a410d73e23fc" x="215" y="0" width="61" height="20"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Celkem]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Binary file not shown.
+24 -56
View File
@@ -2,7 +2,7 @@
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBill" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="20" uuid="f59e8277-a431-4cdc-abaa-c82c1cf193af"> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBill" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="20" uuid="f59e8277-a431-4cdc-abaa-c82c1cf193af">
<property name="ireport.zoom" value="1.5"/> <property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/> <property name="ireport.x" value="0"/>
<property name="ireport.y" value="378"/> <property name="ireport.y" value="3"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression> <defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter> </parameter>
@@ -57,13 +57,7 @@
<band splitType="Stretch"/> <band splitType="Stretch"/>
</background> </background>
<pageHeader> <pageHeader>
<band height="275" splitType="Stretch"> <band height="237" splitType="Stretch">
<image onErrorType="Blank">
<reportElement uuid="f9a1f9fe-b6d4-4b1d-972a-59d43b380a5b" x="440" y="206" width="130" height="43">
<printWhenExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE}]]></imageExpression>
</image>
<staticText> <staticText>
<reportElement uuid="6e60bd03-48b9-4555-91ab-757532d93e6a" x="10" y="61" width="143" height="20"/> <reportElement uuid="6e60bd03-48b9-4555-91ab-757532d93e6a" x="10" y="61" width="143" height="20"/>
<textElement> <textElement>
@@ -182,25 +176,8 @@ tuzemské pracovní cesty]]></text>
<textElement textAlignment="Left"/> <textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[$F{resultMessageDate}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{resultMessageDate}]]></textFieldExpression>
</textField> </textField>
<staticText>
<reportElement uuid="b2b60eec-df87-4385-a6d9-8d3f80cc319a" x="1" y="229" width="295" height="20"/>
<textElement>
<font isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Se způsobem provedení souhlasí:]]></text>
</staticText>
<line> <line>
<reportElement uuid="0cf99b2a-b025-4a50-bcb5-8e371536bb77" x="296" y="249" width="276" height="1"/> <reportElement uuid="c67f7840-5e38-4eed-ab3f-e4907ac33b5c" x="0" y="236" width="572" height="1"/>
</line>
<staticText>
<reportElement uuid="17876cb8-7666-48f4-9275-f7a70cd08ff9" x="296" y="253" width="276" height="20"/>
<textElement textAlignment="Center">
<font isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Datum a podpis oprávněné osoby]]></text>
</staticText>
<line>
<reportElement uuid="c67f7840-5e38-4eed-ab3f-e4907ac33b5c" x="0" y="272" width="572" height="1"/>
</line> </line>
<line> <line>
<reportElement uuid="e3530085-daa8-4675-bf3a-d98c775be07e" x="0" y="55" width="571" height="1"/> <reportElement uuid="e3530085-daa8-4675-bf3a-d98c775be07e" x="0" y="55" width="571" height="1"/>
@@ -209,10 +186,10 @@ tuzemské pracovní cesty]]></text>
<reportElement uuid="47e4e70d-fb5f-4266-889a-4149c71efa42" x="-1" y="0" width="572" height="1"/> <reportElement uuid="47e4e70d-fb5f-4266-889a-4149c71efa42" x="-1" y="0" width="572" height="1"/>
</line> </line>
<line> <line>
<reportElement uuid="d4738137-17c1-4721-b222-7187988c1b06" x="-1" y="1" width="1" height="272"/> <reportElement uuid="d4738137-17c1-4721-b222-7187988c1b06" x="-1" y="1" width="1" height="236"/>
</line> </line>
<line> <line>
<reportElement uuid="bf83547c-60d9-4f95-a5f1-db0763ba17cb" x="571" y="1" width="1" height="272"/> <reportElement uuid="bf83547c-60d9-4f95-a5f1-db0763ba17cb" x="571" y="1" width="1" height="236"/>
</line> </line>
<textField isBlankWhenNull="true"> <textField isBlankWhenNull="true">
<reportElement uuid="8af60406-55bf-46f0-82e9-865dc9edbdb4" x="196" y="82" width="375" height="20"> <reportElement uuid="8af60406-55bf-46f0-82e9-865dc9edbdb4" x="196" y="82" width="375" height="20">
@@ -236,11 +213,6 @@ tuzemské pracovní cesty]]></text>
</textElement> </textElement>
<textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression> <textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd. MM. yyyy" isBlankWhenNull="false">
<reportElement uuid="d8f79af9-b603-4103-9f78-a98ef574447e" x="340" y="229" width="100" height="20"/>
<textElement verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression>
</textField>
</band> </band>
</pageHeader> </pageHeader>
<detail> <detail>
@@ -360,12 +332,6 @@ tuzemské pracovní cesty]]></text>
<textElement textAlignment="Center" verticalAlignment="Middle"/> <textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Doplatek - přeplatek]]></text> <text><![CDATA[Doplatek - přeplatek]]></text>
</staticText> </staticText>
<image onErrorType="Blank">
<reportElement uuid="0a136d64-9565-4ed7-9baa-3b68aa98eada" x="450" y="106" width="113" height="36">
<printWhenExpression><![CDATA[$P{P_USER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_USER_SIGNATURE}]]></imageExpression>
</image>
<staticText> <staticText>
<reportElement uuid="c200a476-63ba-4c3d-8e17-298b5928b0dd" x="1" y="76" width="240" height="15"/> <reportElement uuid="c200a476-63ba-4c3d-8e17-298b5928b0dd" x="1" y="76" width="240" height="15"/>
<textElement> <textElement>
@@ -421,18 +387,6 @@ tuzemské pracovní cesty]]></text>
</detail> </detail>
<summary> <summary>
<band height="194" splitType="Prevent"> <band height="194" splitType="Prevent">
<image onErrorType="Blank">
<reportElement uuid="4c553957-3ab2-4f19-af01-577f5d3cef40" x="438" y="103" width="130" height="46">
<printWhenExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE}]]></imageExpression>
</image>
<image onErrorType="Blank">
<reportElement uuid="2e42de6e-3f15-42c0-8a1d-5a21809f3193" x="290" y="103" width="130" height="46">
<printWhenExpression><![CDATA[$P{P_APPROVER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_APPROVER_SIGNATURE}]]></imageExpression>
</image>
<staticText> <staticText>
<reportElement uuid="58e4cf15-a8e1-4b4d-b491-ad4a1825f0a3" x="281" y="5" width="30" height="15"/> <reportElement uuid="58e4cf15-a8e1-4b4d-b491-ad4a1825f0a3" x="281" y="5" width="30" height="15"/>
<textElement/> <textElement/>
@@ -472,11 +426,6 @@ tuzemské pracovní cesty]]></text>
</textElement> </textElement>
<text><![CDATA[Účtovaná náhrada byla přezkoušena a upravena na Kč:]]></text> <text><![CDATA[Účtovaná náhrada byla přezkoušena a upravena na Kč:]]></text>
</staticText> </staticText>
<staticText>
<reportElement uuid="4aca1ec1-c2dc-47b9-a973-40ded5f52d29" x="260" y="103" width="290" height="20"/>
<textElement/>
<text><![CDATA[Datum a podpis zaměstnance, který upravil vyúčtování]]></text>
</staticText>
<line> <line>
<reportElement uuid="2665a0ca-420d-46dc-9085-522ed3950c44" x="291" y="149" width="130" height="1"/> <reportElement uuid="2665a0ca-420d-46dc-9085-522ed3950c44" x="291" y="149" width="130" height="1"/>
</line> </line>
@@ -571,6 +520,25 @@ tuzemské pracovní cesty]]></text>
<line> <line>
<reportElement uuid="5e5a7c99-962e-4c99-b3ba-dbed5315f5aa" x="-1" y="-2" width="1" height="195"/> <reportElement uuid="5e5a7c99-962e-4c99-b3ba-dbed5315f5aa" x="-1" y="-2" width="1" height="195"/>
</line> </line>
<staticText>
<reportElement uuid="4aca1ec1-c2dc-47b9-a973-40ded5f52d29" x="260" y="103" width="290" height="20"/>
<textElement/>
<text><![CDATA[Datum a podpis zaměstnance, který upravil vyúčtování]]></text>
</staticText>
<genericElement>
<reportElement uuid="3753147d-3c79-4377-b296-3281ab3d54b3" x="291" y="103" width="130" height="46"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[2]]></valueExpression>
</genericElementParameter>
</genericElement>
<genericElement>
<reportElement uuid="14ae63ff-6be2-4419-9f39-8c9c8d2daf42" x="438" y="107" width="130" height="42"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[1]]></valueExpression>
</genericElementParameter>
</genericElement>
</band> </band>
</summary> </summary>
</jasperReport> </jasperReport>
Binary file not shown.
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBillItems" pageWidth="572" pageHeight="752" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="0bbe694d-dbb2-4b58-b789-2587f37c94a8"> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBillItems" pageWidth="572" pageHeight="752" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="0bbe694d-dbb2-4b58-b789-2587f37c94a8">
<property name="ireport.zoom" value="2.0"/> <property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="496"/> <property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/> <property name="ireport.y" value="0"/>
<queryString> <queryString>
<![CDATA[]]> <![CDATA[]]>
@@ -381,28 +381,28 @@ výdaje]]></text>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{endWork}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{endWork}]]></textFieldExpression>
</textField> </textField>
<textField pattern="HH:mm" isBlankWhenNull="true"> <textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="034668ea-fa09-4967-bf1a-32b937c04729" x="292" y="0" width="32" height="15"/> <reportElement uuid="034668ea-fa09-4967-bf1a-32b937c04729" x="292" y="0" width="32" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{distance}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{distance}]]></textFieldExpression>
</textField> </textField>
<textField pattern="HH:mm" isBlankWhenNull="true"> <textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="d9ee1631-7830-44e2-a23d-63be94701d24" x="292" y="15" width="32" height="15"/> <reportElement uuid="d9ee1631-7830-44e2-a23d-63be94701d24" x="292" y="15" width="32" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{distanceAmount}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{distanceAmount}]]></textFieldExpression>
</textField> </textField>
<textField pattern="HH:mm" isBlankWhenNull="true"> <textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="89be17a9-f8cc-4cb6-8254-2e660ab44807" x="324" y="0" width="32" height="15"/> <reportElement uuid="89be17a9-f8cc-4cb6-8254-2e660ab44807" x="324" y="0" width="32" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{fuelConsumption}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{fuelConsumption}]]></textFieldExpression>
</textField> </textField>
<textField pattern="HH:mm" isBlankWhenNull="true"> <textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="5aceac93-7265-4937-b23f-ec83288f6f90" x="324" y="15" width="32" height="15"/> <reportElement uuid="5aceac93-7265-4937-b23f-ec83288f6f90" x="324" y="15" width="32" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/> <font size="8"/>
@@ -0,0 +1,353 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripRequirement" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0b7fa2d2-d452-4a1f-b1c0-2d8e16a22525">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="387"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Passengers" uuid="89ee82de-f017-493e-85d1-439a0ff3be72">
<queryString>
<![CDATA[]]>
</queryString>
<field name="fullName" class="java.lang.String">
<fieldDescription><![CDATA[fullName]]></fieldDescription>
</field>
</subDataset>
<subDataset name="dataset1" uuid="2030e480-17f9-4ac5-a8f1-7499b269f3b4"/>
<parameter name="P_USER_SIGNATURE" class="java.lang.String"/>
<parameter name="P_APPROVE_DATE" class="java.util.Date"/>
<parameter name="P_APPROVER_SIGNATURE" class="java.lang.String"/>
<parameter name="P_LOGO" class="java.lang.String"/>
<parameter name="P_MAIN_ADDRESS" class="java.lang.String"/>
<parameter name="P_PREV_APPROVE_DATE" class="java.util.Date"/>
<parameter name="P_PREV_APPROVER_SIGNATURE" class="java.lang.String"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<field name="ownedBy" class="info.bukova.isspst.data.User"/>
<field name="reqDate" class="java.util.Date"/>
<field name="from" class="java.lang.String"/>
<field name="tripDate" class="java.util.Date"/>
<field name="to" class="java.lang.String"/>
<field name="description" class="java.lang.String"/>
<field name="end" class="java.lang.String"/>
<field name="endDate" class="java.util.Date"/>
<field name="passengers" class="java.util.Collection"/>
<field name="foreignPersons" class="java.lang.String"/>
<field name="vehicle" class="info.bukova.isspst.data.Vehicle"/>
<field name="vehicle.code" class="java.lang.String"/>
<field name="requireDownPayment" class="java.lang.Boolean"/>
<field name="downPayment" class="java.math.BigDecimal"/>
<field name="ownedBy.address" class="info.bukova.isspst.data.UsersAddress"/>
<field name="ownedBy.address.street" class="java.lang.String"/>
<field name="ownedBy.address.houseNumber" class="java.lang.String"/>
<field name="ownedBy.address.zipCode" class="java.lang.String"/>
<field name="ownedBy.address.city" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<image onErrorType="Blank">
<reportElement uuid="ef1dc796-f5c6-4036-99eb-26e7b6b7abbc" x="0" y="0" width="100" height="79" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{P_LOGO} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_LOGO}]]></imageExpression>
</image>
<textField>
<reportElement uuid="3e2074cd-220c-4c9a-b94c-a0a254cc24a6" x="100" y="0" width="471" height="34"/>
<textElement textAlignment="Center">
<font isBold="true" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="a7a82c52-e8b8-41cf-b13a-ebc54d30d04f" x="101" y="34" width="470" height="45"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="14" isBold="true" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[CESTOVNÍ PŘÍKAZ
k tuzemské pracovní cestě]]></text>
</staticText>
</band>
</title>
<detail>
<band height="529" splitType="Stretch">
<staticText>
<reportElement uuid="f6445d7f-1e96-4d17-9f1d-27eaa8f15022" x="0" y="7" width="143" height="20"/>
<textElement/>
<text><![CDATA[Příjmení, jméno, titul:]]></text>
</staticText>
<staticText>
<reportElement uuid="6f073490-98cc-445b-8b51-81facf335657" x="0" y="27" width="100" height="20"/>
<textElement/>
<text><![CDATA[Bydliště:]]></text>
</staticText>
<staticText>
<reportElement uuid="a3e2a5d3-ea50-48bd-94ea-4530f6624b52" x="0" y="51" width="572" height="20"/>
<textElement textAlignment="Center">
<font size="12" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Souhlasím s vysláním na pracovní cestu]]></text>
</staticText>
<staticText>
<reportElement uuid="306f2b85-5dc6-40a6-8c44-76ed46831680" x="0" y="76" width="143" height="20"/>
<textElement/>
<text><![CDATA[Požaduji poskytnutí zálohy:]]></text>
</staticText>
<line>
<reportElement uuid="029f1b4c-5f59-4a5e-8d3d-b644af41b657" x="301" y="121" width="271" height="1"/>
</line>
<staticText>
<reportElement uuid="2f0f450a-b89d-4862-b82e-4eb1e9861927" x="301" y="128" width="271" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Datum a podpis]]></text>
</staticText>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="dd5f12d3-9ce1-4565-83ed-fe9004e3a6c3" x="301" y="101" width="77" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{reqDate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="a2912fef-ae4a-4c7e-b08c-3f5f6b92a534" x="0" y="157" width="572" height="20"/>
<textElement textAlignment="Center">
<font size="16" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[PODMÍNKY PRACOVNÍ CESTY]]></text>
</staticText>
<line>
<reportElement uuid="b415fa20-91d9-4772-9b73-fd26b6cf32a3" x="0" y="177" width="572" height="1"/>
</line>
<line>
<reportElement uuid="74a5cf40-10b4-4f99-8945-5e14323a7b98" x="0" y="253" width="572" height="1"/>
</line>
<line>
<reportElement uuid="a3a337aa-8b1c-4f4f-abc0-4b5a6cba04d5" x="0" y="156" width="572" height="1"/>
</line>
<staticText>
<reportElement uuid="ed4e3928-9a68-4f61-9876-254547efa04e" x="0" y="180" width="143" height="27"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Počátek cesty (místo, datum, hodina)]]></text>
</staticText>
<textField>
<reportElement uuid="ed4a676e-2647-4a91-a1b5-1ff326f50359" x="0" y="208" width="143" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{from}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="fd80824e-0a50-4e37-abd5-1c8bf92ded4a" x="0" y="228" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{tripDate}]]></textFieldExpression>
</textField>
<textField pattern="hh:mm">
<reportElement uuid="4d004341-3dc5-4b77-a0f2-d93c93aff176" x="90" y="228" width="53" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{tripDate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="36c8b801-3fdf-4464-99d7-4f07539d76f8" x="143" y="180" width="143" height="27"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Místo jednání]]></text>
</staticText>
<textField>
<reportElement uuid="6e9e44fe-3022-4802-854e-607238cb21be" x="143" y="208" width="143" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{to}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="398372d7-7995-42fa-a53a-f50b0f8936db" x="286" y="179" width="143" height="27"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Účel cesty]]></text>
</staticText>
<staticText>
<reportElement uuid="3dbc8b8d-7ac4-40d8-b43c-89e81d26f15c" x="429" y="180" width="143" height="26"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Konec cesty (místo, datum)]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement uuid="3b52420d-1c84-4042-bc88-16f4f36a3af8" x="286" y="208" width="143" height="40"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3e9b796b-fc9e-42e4-93d6-a966ce78c771" x="429" y="208" width="143" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{end}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="6ae75bed-b03b-4857-b624-71daeb35513d" x="429" y="228" width="143" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{endDate}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="ad778808-c5cc-419c-b34f-fc84effc1958" x="186" y="7" width="181" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{ownedBy}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="deafc33f-99ed-483e-8682-57a18872941d" x="0" y="265" width="143" height="20"/>
<textElement/>
<text><![CDATA[Spolucestující:]]></text>
</staticText>
<staticText>
<reportElement uuid="ab2fbb7c-28d3-4e6b-beb9-93c6fc8745c8" x="0" y="307" width="348" height="20"/>
<textElement/>
<text><![CDATA[Určený dopravní prostředek (u vlastního vozidla druh a reg. značka):]]></text>
</staticText>
<textField>
<reportElement uuid="1a52f009-c560-443a-9b84-cd9502b6b0c5" x="348" y="307" width="60" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{vehicle.code}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="8355e20a-124b-4c63-ab9c-4d64be5b912e" x="0" y="327" width="572" height="40"/>
<textElement textAlignment="Center"/>
<text><![CDATA[A - autobus, V - vlak
AUV - auto vlastní, AUS - auto služební, AUC - auto cizí
L - letadlo, P - pěšky, T - taxi]]></text>
</staticText>
<staticText>
<reportElement uuid="94f07671-9d8f-4542-9afe-f1c0b8ae1a02" x="0" y="369" width="143" height="20"/>
<textElement/>
<text><![CDATA[Ubytování:]]></text>
</staticText>
<staticText>
<reportElement uuid="b1cd5f7d-48fc-4f1b-82e1-69f81026b5ac" x="0" y="398" width="143" height="20"/>
<textElement/>
<text><![CDATA[Poskytnutí zálohy ve výši:]]></text>
</staticText>
<line>
<reportElement uuid="57398205-845b-4633-89db-3b0c4b31f03c" x="301" y="418" width="271" height="1"/>
</line>
<staticText>
<reportElement uuid="e33b0435-12e0-4d9f-9d3f-44f54eed9505" x="301" y="423" width="271" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Datum a podpis oprávněné osoby]]></text>
</staticText>
<staticText>
<reportElement uuid="cad8d17d-5fdc-41a8-a74d-54ea34e4cdad" x="0" y="449" width="100" height="20"/>
<textElement/>
<text><![CDATA[Povolená záloha]]></text>
</staticText>
<staticText>
<reportElement uuid="2b462c95-65b1-4295-ac47-7d2ac3e16f40" x="0" y="469" width="143" height="20"/>
<textElement/>
<text><![CDATA[Pokladní doklad číslo]]></text>
</staticText>
<staticText>
<reportElement uuid="4cfe5623-901b-4508-9161-920d90cd0405" x="301" y="449" width="100" height="20"/>
<textElement/>
<text><![CDATA[Vyplacená dne:]]></text>
</staticText>
<line>
<reportElement uuid="39f180e0-0300-4087-89b2-dbd9441d1e94" x="149" y="500" width="280" height="1"/>
</line>
<staticText>
<reportElement uuid="a7218a5e-4d69-41fe-a26b-a51dd240cfb1" x="149" y="508" width="280" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Podpis pokladníka]]></text>
</staticText>
<line direction="BottomUp">
<reportElement uuid="0276901c-8949-4307-a4a6-efa1a9b83341" x="571" y="-79" width="1" height="607"/>
</line>
<line direction="BottomUp">
<reportElement uuid="01ad15ce-276d-4fb8-af37-d896fa7eb77a" x="-1" y="-79" width="1" height="607"/>
</line>
<line>
<reportElement uuid="31fec8f3-7de4-4c34-934e-dbc2ad813c49" x="-1" y="-80" width="573" height="1"/>
</line>
<line>
<reportElement uuid="11f1abd0-78a2-4cee-9553-c960a59a00d3" x="-1" y="528" width="573" height="1"/>
</line>
<line>
<reportElement uuid="00689195-f270-4b32-9878-74c6d5d353cd" x="-1" y="0" width="573" height="1"/>
</line>
<line>
<reportElement uuid="0d8ef0ad-db1e-4be9-8153-b3a885fb8ace" x="0" y="148" width="572" height="1"/>
</line>
<line>
<reportElement uuid="c9713d6e-9b2e-4ce6-8837-3fbbe320fa8b" x="143" y="178" width="1" height="75"/>
</line>
<line>
<reportElement uuid="4e1fb287-81be-477a-95c2-96691d638916" x="285" y="178" width="1" height="75"/>
</line>
<line>
<reportElement uuid="bc2f55db-f6e3-46eb-81cd-1b4161ceeffd" x="428" y="178" width="1" height="75"/>
</line>
<line>
<reportElement uuid="0e93a41e-d13e-4f12-83cb-70d69bb3c0fb" x="0" y="442" width="572" height="1"/>
</line>
<staticText>
<reportElement uuid="548c1550-c12d-42b3-a297-c9be96dbb2e8" x="144" y="76" width="31" height="20">
<printWhenExpression><![CDATA[$F{requireDownPayment}]]></printWhenExpression>
</reportElement>
<textElement/>
<text><![CDATA[Ano]]></text>
</staticText>
<staticText>
<reportElement uuid="e06aba6d-b74d-4ab1-9737-1134a6ac6519" x="144" y="76" width="32" height="20">
<printWhenExpression><![CDATA[$F{requireDownPayment} == null || $F{requireDownPayment} == false]]></printWhenExpression>
</reportElement>
<textElement/>
<text><![CDATA[Ne]]></text>
</staticText>
<textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
<reportElement uuid="ac95738d-56c8-4ee2-8721-cad00e1b06e4" x="144" y="398" width="57" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{downPayment}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement uuid="954e517f-5d23-4166-b776-7c31b4409ddd" x="378" y="69" width="183" height="50">
<printWhenExpression><![CDATA[$P{P_USER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_USER_SIGNATURE}]]></imageExpression>
</image>
<textField pattern="dd. MM. yyyy" isBlankWhenNull="true">
<reportElement uuid="97daa8a7-dab0-4104-babb-c3889faac21a" x="301" y="399" width="77" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression>
<anchorNameExpression><![CDATA["SIGN_1"]]></anchorNameExpression>
</textField>
<textField>
<reportElement uuid="16e5c4e2-a366-4eca-ad27-7db7fef6771c" x="186" y="27" width="375" height="20">
<printWhenExpression><![CDATA[$F{ownedBy.address} != null]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{ownedBy.address}]]></textFieldExpression>
</textField>
<subreport>
<reportElement uuid="b8144a34-f2c4-4b5a-9f48-b74b5dc99e8c" x="143" y="265" width="428" height="20"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{passengers})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "tripRequirementPassengers.jasper"]]></subreportExpression>
</subreport>
<textField isBlankWhenNull="true">
<reportElement uuid="f8e2f8b5-373d-46fd-9c61-5a6c1da44351" x="143" y="285" width="428" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{foreignPersons}]]></textFieldExpression>
</textField>
<genericElement>
<reportElement uuid="c1d18650-66b9-425c-acbe-7b4e952bfd16" x="378" y="369" width="183" height="48"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[1]]></valueExpression>
</genericElementParameter>
</genericElement>
</band>
</detail>
</jasperReport>

Some files were not shown because too many files have changed in this diff Show More