BrightSide Workbench Full Report + Source Code
org.turro.financials.entity.Register Class Reference
Inheritance diagram for org.turro.financials.entity.Register:
Collaboration diagram for org.turro.financials.entity.Register:

Public Member Functions

Set< BookRegistergetBookRegisters ()
 
void setBookRegisters (Set< BookRegister > bookRegisters)
 
boolean isClosing ()
 
void setClosing (boolean closing)
 
Document getDocument ()
 
void setDocument (Document document)
 
boolean isExclude ()
 
void setExclude (boolean exclude)
 
long getId ()
 
void setId (long id)
 
long getIdRegister ()
 
void setIdRegister (long idRegister)
 
Date getRegisterDate ()
 
void setRegisterDate (Date registerDate)
 
Set< RegisterEntrygetRegisterEntries ()
 
void setRegisterEntries (Set< RegisterEntry > registerEntries)
 
boolean isRegularizeIRPF ()
 
void setRegularizeIRPF (boolean regularizeIRPF)
 
boolean isRegularizeVAT ()
 
void setRegularizeVAT (boolean regularizeVAT)
 
RegisterView getView ()
 
void setView (RegisterView view)
 
Object entityId ()
 
boolean isEmpty ()
 
void prepareSave ()
 
Collection< Collection > collections ()
 
double getDebit ()
 
double getCredit ()
 
void reuseLines (Collection< RegisterEntry > entries)
 
void killUnusedBooks (Set< Long > bookDefs)
 
String getBookString ()
 
AmountSet getAmounts (Collection< String > majors)
 
DocumentAmounts getDocumentAmounts ()
 
MappingSet getSerializerMappings ()
 
- Public Member Functions inherited from org.turro.jpa.entity.IDaoEntity
default boolean isNew ()
 
default void prepareDelete ()
 
default void removeEmpties ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 40 of file Register.java.

Member Function Documentation

◆ collections()

Collection<Collection> org.turro.financials.entity.Register.collections ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 196 of file Register.java.

196  {
197  return List.of(getBookRegisters(), getRegisterEntries());
198  }
Set< BookRegister > getBookRegisters()
Definition: Register.java:75
Set< RegisterEntry > getRegisterEntries()
Definition: Register.java:135

◆ entityId()

Object org.turro.financials.entity.Register.entityId ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 170 of file Register.java.

170  {
171  return id;
172  }

◆ getAmounts()

AmountSet org.turro.financials.entity.Register.getAmounts ( Collection< String >  majors)

Definition at line 287 of file Register.java.

287  {
288  if(as == null) {
289  as = new AmountSet();
290  if(document != null) {
291  for(RegisterEntry re : registerEntries) {
292  Account acc = re.getAccount();
293  for(String major : majors) {
294  if(acc.getId().startsWith(major)) {
295  double tax = Integer.valueOf(acc.getId().substring(5)) / 10.0;
296  if(tax > 0) {
297  double amount = re.getDebit() + re.getCredit();
298  as.addAmount(new Amount(tax, amount / (tax / 100.0), 0.0, 0.0, 2));
299  }
300  break;
301  }
302  }
303  }
304  }
305  }
306  return as;
307  }
Here is the call graph for this function:

◆ getBookRegisters()

Set<BookRegister> org.turro.financials.entity.Register.getBookRegisters ( )

Definition at line 75 of file Register.java.

75  {
76  return bookRegisters;
77  }
Here is the caller graph for this function:

◆ getBookString()

String org.turro.financials.entity.Register.getBookString ( )

Definition at line 273 of file Register.java.

273  {
274  StringBuilder sb = new StringBuilder();
275  for(BookRegister br : getBookRegisters()) {
276  if(sb.length() > 0) {
277  sb.append(" | ");
278  }
279  sb.append(br.getBookDefinition().getDescription());
280  sb.append(" [" + (br.getBookOrder() == 0 ? "<auto>" : br.getBookOrder()) +"]");
281  }
282  return sb.toString();
283  }

◆ getCredit()

double org.turro.financials.entity.Register.getCredit ( )

Definition at line 210 of file Register.java.

210  {
211  double r = 0;
212  for(RegisterEntry re : registerEntries) {
213  r += re.getCredit();
214  }
215  return r;
216  }

◆ getDebit()

double org.turro.financials.entity.Register.getDebit ( )

Definition at line 202 of file Register.java.

202  {
203  double r = 0;
204  for(RegisterEntry re : registerEntries) {
205  r += re.getDebit();
206  }
207  return r;
208  }

◆ getDocument()

Document org.turro.financials.entity.Register.getDocument ( )

Definition at line 91 of file Register.java.

91  {
92  return document;
93  }
Here is the caller graph for this function:

◆ getDocumentAmounts()

DocumentAmounts org.turro.financials.entity.Register.getDocumentAmounts ( )

Definition at line 311 of file Register.java.

311  {
312  if(da == null) {
313  if(document != null) {
314  da = document.getAmounts();
315  }
316  }
317  return da;
318  }

◆ getId()

long org.turro.financials.entity.Register.getId ( )

Definition at line 107 of file Register.java.

107  {
108  return id;
109  }
Here is the caller graph for this function:

◆ getIdRegister()

long org.turro.financials.entity.Register.getIdRegister ( )

Definition at line 115 of file Register.java.

115  {
116  return idRegister;
117  }
Here is the caller graph for this function:

◆ getRegisterDate()

Date org.turro.financials.entity.Register.getRegisterDate ( )

Definition at line 123 of file Register.java.

123  {
124  return registerDate;
125  }
Here is the caller graph for this function:

◆ getRegisterEntries()

Set<RegisterEntry> org.turro.financials.entity.Register.getRegisterEntries ( )

Definition at line 135 of file Register.java.

135  {
136  return registerEntries;
137  }
Here is the caller graph for this function:

◆ getSerializerMappings()

MappingSet org.turro.financials.entity.Register.getSerializerMappings ( )

Definition at line 322 of file Register.java.

322  {
323  MappingSet set = new MappingSet();
324  set.addMapping(Register.class, 1,
325  new String[] { "idRegister", "registerDate" },
326  new String[] { "view", "registerEntries" });
327  set.addMapping(RegisterView.class, 2,
328  new String[] { "id", "name" },
329  null);
330  set.addMapping(RegisterEntry.class, 2,
331  new String[] { "debit", "credit", "approved", "conciliated" },
332  new String[] { "account" } );
333  set.addMapping(Account.class, 3,
334  new String[] { "id", "description" },
335  null);
336  return set;
337  }

◆ getView()

RegisterView org.turro.financials.entity.Register.getView ( )

Definition at line 159 of file Register.java.

159  {
160  return view;
161  }
Here is the caller graph for this function:

◆ isClosing()

boolean org.turro.financials.entity.Register.isClosing ( )

Definition at line 83 of file Register.java.

83  {
84  return closing;
85  }

◆ isEmpty()

boolean org.turro.financials.entity.Register.isEmpty ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 175 of file Register.java.

175  {
176  removeEmpties();
177  return registerEntries.isEmpty() ||
178  view == null ||
179  registerDate == null;
180  }
Here is the caller graph for this function:

◆ isExclude()

boolean org.turro.financials.entity.Register.isExclude ( )

Definition at line 99 of file Register.java.

99  {
100  return exclude;
101  }

◆ isRegularizeIRPF()

boolean org.turro.financials.entity.Register.isRegularizeIRPF ( )

Definition at line 143 of file Register.java.

143  {
144  return regularizeIRPF;
145  }

◆ isRegularizeVAT()

boolean org.turro.financials.entity.Register.isRegularizeVAT ( )

Definition at line 151 of file Register.java.

151  {
152  return regularizeVAT;
153  }

◆ killUnusedBooks()

void org.turro.financials.entity.Register.killUnusedBooks ( Set< Long >  bookDefs)

Definition at line 256 of file Register.java.

256  {
257  Iterator<BookRegister> it = getBookRegisters().iterator();
258  while(it.hasNext()) {
259  boolean used = false;
260  BookRegister br = it.next();
261  for(long bd : bookDefs) {
262  if(br.getBookDefinition().getId() == bd) {
263  used = true;
264  break;
265  }
266  }
267  if(!used) {
268  it.remove();
269  }
270  }
271  }
Here is the call graph for this function:

◆ prepareSave()

void org.turro.financials.entity.Register.prepareSave ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 183 of file Register.java.

183  {
184  IDaoEntity.super.prepareSave();
185  if(idRegister == 0) {
186  idRegister = IdUtils.getMaxLongIdFromLong(
187  new FinancialsPU(), "Register", "idRegister",
188  new String[] {
189  "year(registerDate) = " + new CheckDate(registerDate).getYear(),
190  "view.id = " + view.getId()
191  });
192  }
193  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reuseLines()

void org.turro.financials.entity.Register.reuseLines ( Collection< RegisterEntry entries)

Definition at line 218 of file Register.java.

218  {
219  Iterator<RegisterEntry> it1 = getRegisterEntries().iterator();
220  Iterator<RegisterEntry> it2 = entries.iterator();
221  RegisterEntry re1, re2 = null;
222  while(it1.hasNext()) {
223  re1 = it1.next();
224  if(it2.hasNext()) {
225  re2 = it2.next();
226  } else {
227  re2 = null;
228  }
229  // new lines is finished
230  if(re2 == null) {
231  re1.clearLine();
232  } else {
233  re1.assignValuesFrom(re2);
234  re1.setRegister(this);
235  }
236  re2 = null;
237  }
238  // there are still new lines
239  if(re2 != null) {
240  re1 = new RegisterEntry();
241  re1.assignValuesFrom(re2);
242  re1.setRegister(this);
243  registerEntries.add(re1);
244  }
245  while(it2.hasNext()) {
246  re2 = it2.next();
247  re1 = new RegisterEntry();
248  re1.assignValuesFrom(re2);
249  re1.setRegister(this);
250  registerEntries.add(re1);
251  }
252  }
Here is the call graph for this function:

◆ setBookRegisters()

void org.turro.financials.entity.Register.setBookRegisters ( Set< BookRegister bookRegisters)

Definition at line 79 of file Register.java.

79  {
80  this.bookRegisters = bookRegisters;
81  }

◆ setClosing()

void org.turro.financials.entity.Register.setClosing ( boolean  closing)

Definition at line 87 of file Register.java.

87  {
88  this.closing = closing;
89  }

◆ setDocument()

void org.turro.financials.entity.Register.setDocument ( Document  document)

Definition at line 95 of file Register.java.

95  {
96  this.document = document;
97  }
Here is the caller graph for this function:

◆ setExclude()

void org.turro.financials.entity.Register.setExclude ( boolean  exclude)

Definition at line 103 of file Register.java.

103  {
104  this.exclude = exclude;
105  }

◆ setId()

void org.turro.financials.entity.Register.setId ( long  id)

Definition at line 111 of file Register.java.

111  {
112  this.id = id;
113  }

◆ setIdRegister()

void org.turro.financials.entity.Register.setIdRegister ( long  idRegister)

Definition at line 119 of file Register.java.

119  {
120  this.idRegister = idRegister;
121  }
Here is the caller graph for this function:

◆ setRegisterDate()

void org.turro.financials.entity.Register.setRegisterDate ( Date  registerDate)

Definition at line 127 of file Register.java.

127  {
128  if(this.registerDate != null && !new CheckDate(this.registerDate).sameYear(registerDate)) {
129  bookRegisters.clear();
130  idRegister = 0;
131  }
132  this.registerDate = registerDate;
133  }
Here is the caller graph for this function:

◆ setRegisterEntries()

void org.turro.financials.entity.Register.setRegisterEntries ( Set< RegisterEntry registerEntries)

Definition at line 139 of file Register.java.

139  {
140  this.registerEntries = registerEntries;
141  }

◆ setRegularizeIRPF()

void org.turro.financials.entity.Register.setRegularizeIRPF ( boolean  regularizeIRPF)

Definition at line 147 of file Register.java.

147  {
148  this.regularizeIRPF = regularizeIRPF;
149  }

◆ setRegularizeVAT()

void org.turro.financials.entity.Register.setRegularizeVAT ( boolean  regularizeVAT)

Definition at line 155 of file Register.java.

155  {
156  this.regularizeVAT = regularizeVAT;
157  }

◆ setView()

void org.turro.financials.entity.Register.setView ( RegisterView  view)

Definition at line 163 of file Register.java.

163  {
164  this.view = view;
165  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: