BrightSide Workbench Full Report + Source Code
m303m/ModelEntry.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2016 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
package
org.turro.financials.treasury.m303m;
20
21
import
java.util.List;
22
import
java.util.Set;
23
import
java.util.TreeSet;
24
import
org.turro.financials.treasury.m303.ModelType;
25
import
org.turro.jpa.Dao;
26
import
org.turro.util.CompareUtil;
27
32
public
class
ModelEntry
implements
Comparable<ModelEntry> {
33
34
private
int
exercise;
35
private
EntryMonth
[] month =
new
EntryMonth
[12];
36
private
ModelSet
set
;
37
private
ModelType
type;
38
private
Set<Integer> vats;
39
40
public
ModelEntry
(
ModelSet
set
,
ModelType
type,
int
exercise) {
41
this.
set
=
set
;
42
this.type = type;
43
this.exercise = exercise;
44
month[0] =
new
EntryMonth
(
this
, 1);
45
month[1] =
new
EntryMonth
(
this
, 2);
46
month[2] =
new
EntryMonth
(
this
, 3);
47
month[3] =
new
EntryMonth
(
this
, 4);
48
month[4] =
new
EntryMonth
(
this
, 5);
49
month[5] =
new
EntryMonth
(
this
, 6);
50
month[6] =
new
EntryMonth
(
this
, 7);
51
month[7] =
new
EntryMonth
(
this
, 8);
52
month[8] =
new
EntryMonth
(
this
, 9);
53
month[9] =
new
EntryMonth
(
this
, 10);
54
month[10] =
new
EntryMonth
(
this
, 11);
55
month[11] =
new
EntryMonth
(
this
, 12);
56
}
57
58
public
Dao
getDao
() {
59
return
set
.getDao();
60
}
61
62
public
int
getExercise
() {
63
return
exercise;
64
}
65
66
public
EntryMonth
getMonth
(
int
index) {
67
return
month[index];
68
}
69
70
public
ModelType
getType
() {
71
return
type;
72
}
73
74
@Override
75
public
int
compareTo
(
ModelEntry
o) {
76
return
CompareUtil.compare(type.
getOrder
(), o.type.
getOrder
());
77
}
78
79
public
Set<Integer>
getPossibleVats
() {
80
if
(vats ==
null
) {
81
vats =
new
TreeSet<Integer>();
82
List<String> l =
getDao
().getResultList(
83
"select distinct e.account.id from RegisterEntry e "
+
84
"where year(e.register.registerDate) = ? "
+
85
"and e.register.view.id = 1 "
+
86
"and (e.register.exclude = FALSE and e.register.closing = FALSE and e.register.regularizeVAT = FALSE) "
+
87
"and e.account.id like ?"
,
88
new
Object[] {
getExercise
(),
getType
().
getVatAccount
() });
89
for
(String s : l) {
90
vats.add(Integer.valueOf(s.substring(7)));
91
}
92
}
93
return
vats;
94
}
95
96
}
org.turro.financials.treasury.m303m.EntryMonth
Definition:
EntryMonth.java:32
org.turro.financials.treasury.m303m.ModelEntry
Definition:
m303m/ModelEntry.java:32
org.turro.financials.treasury.m303m.ModelEntry.compareTo
int compareTo(ModelEntry o)
Definition:
m303m/ModelEntry.java:75
org.turro.financials.treasury.m303m.ModelEntry.getMonth
EntryMonth getMonth(int index)
Definition:
m303m/ModelEntry.java:66
org.turro.financials.treasury.m303m.ModelEntry.getExercise
int getExercise()
Definition:
m303m/ModelEntry.java:62
org.turro.financials.treasury.m303m.ModelEntry.getDao
Dao getDao()
Definition:
m303m/ModelEntry.java:58
org.turro.financials.treasury.m303m.ModelEntry.getType
ModelType getType()
Definition:
m303m/ModelEntry.java:70
org.turro.financials.treasury.m303m.ModelEntry.ModelEntry
ModelEntry(ModelSet set, ModelType type, int exercise)
Definition:
m303m/ModelEntry.java:40
org.turro.financials.treasury.m303m.ModelEntry.getPossibleVats
Set< Integer > getPossibleVats()
Definition:
m303m/ModelEntry.java:79
org.turro.financials.treasury.m303m.ModelSet
Definition:
m303m/ModelSet.java:36
org.turro.jpa.Dao
Definition:
Dao.java:52
org.turro.financials.treasury.m303.ModelType
Definition:
m303/ModelType.java:24
org.turro.financials.treasury.m303.ModelType.getOrder
int getOrder()
Definition:
m303/ModelType.java:58
org.turro.financials.treasury.m303.ModelType.getVatAccount
String getVatAccount()
Definition:
m303/ModelType.java:62
TurroProjects
Public
BrightSide
bsfinancials-treasury
src
main
java
org
turro
financials
treasury
m303m
ModelEntry.java
Generated on Tue Mar 12 2024 07:01:20 for BrightSide by
1.9.1