BrightSide Workbench Full Report + Source Code
m303/ModelEntry.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2011 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
package
org.turro.financials.treasury.m303;
19
20
import
java.util.List;
21
import
java.util.Set;
22
import
java.util.TreeSet;
23
import
org.turro.jpa.Dao;
24
import
org.turro.util.CompareUtil;
25
30
public
class
ModelEntry
implements
Comparable<ModelEntry> {
31
32
private
int
exercise;
33
private
EntryQuarter
[] quarter =
new
EntryQuarter
[4];
34
private
ModelSet
set
;
35
private
ModelType
type;
36
private
Set<Integer> vats;
37
38
public
ModelEntry
(
ModelSet
set
,
ModelType
type,
int
exercise) {
39
this.
set
=
set
;
40
this.type = type;
41
this.exercise = exercise;
42
quarter[0] =
new
EntryQuarter
(
this
, 1);
43
quarter[1] =
new
EntryQuarter
(
this
, 2);
44
quarter[2] =
new
EntryQuarter
(
this
, 3);
45
quarter[3] =
new
EntryQuarter
(
this
, 4);
46
}
47
48
public
Dao
getDao
() {
49
return
set
.getDao();
50
}
51
52
public
int
getExercise
() {
53
return
exercise;
54
}
55
56
public
EntryQuarter
getQuarter
(
int
index) {
57
return
quarter[index];
58
}
59
60
public
ModelType
getType
() {
61
return
type;
62
}
63
64
@Override
65
public
int
compareTo
(
ModelEntry
o) {
66
return
CompareUtil.compare(type.
getOrder
(), o.type.
getOrder
());
67
}
68
69
public
Set<Integer>
getPossibleVats
() {
70
if
(vats ==
null
) {
71
vats =
new
TreeSet<Integer>();
72
List<String> l =
getDao
().getResultList(
73
"select distinct e.account.id from RegisterEntry e "
+
74
"where year(e.register.registerDate) = ? "
+
75
"and e.register.view.id = 1 "
+
76
"and (e.register.exclude = FALSE and e.register.closing = FALSE and e.register.regularizeVAT = FALSE) "
+
77
"and e.account.id like ?"
,
78
new
Object[] {
getExercise
(),
getType
().
getVatAccount
() });
79
for
(String s : l) {
80
vats.add(Integer.valueOf(s.substring(7)));
81
}
82
}
83
return
vats;
84
}
85
86
}
org.turro.financials.treasury.m303.EntryQuarter
Definition:
EntryQuarter.java:31
org.turro.financials.treasury.m303.ModelEntry
Definition:
m303/ModelEntry.java:30
org.turro.financials.treasury.m303.ModelEntry.getExercise
int getExercise()
Definition:
m303/ModelEntry.java:52
org.turro.financials.treasury.m303.ModelEntry.getDao
Dao getDao()
Definition:
m303/ModelEntry.java:48
org.turro.financials.treasury.m303.ModelEntry.ModelEntry
ModelEntry(ModelSet set, ModelType type, int exercise)
Definition:
m303/ModelEntry.java:38
org.turro.financials.treasury.m303.ModelEntry.getType
ModelType getType()
Definition:
m303/ModelEntry.java:60
org.turro.financials.treasury.m303.ModelEntry.getQuarter
EntryQuarter getQuarter(int index)
Definition:
m303/ModelEntry.java:56
org.turro.financials.treasury.m303.ModelEntry.getPossibleVats
Set< Integer > getPossibleVats()
Definition:
m303/ModelEntry.java:69
org.turro.financials.treasury.m303.ModelEntry.compareTo
int compareTo(ModelEntry o)
Definition:
m303/ModelEntry.java:65
org.turro.financials.treasury.m303.ModelSet
Definition:
m303/ModelSet.java:34
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
m303
ModelEntry.java
Generated on Tue Mar 12 2024 07:01:20 for BrightSide by
1.9.1