BrightSide Workbench Full Report + Source Code
org.turro.financials.model.register.ClosingRegisters Class Reference

Public Member Functions

 ClosingRegisters (String startString, String endString, String operatingString)
 
boolean existsClosingRegisters (int exercise)
 
void deleteClosingRegisters (int exercise)
 
void createClosingRegisters (int exercise)
 
Collection< RegistergenerateClosingRegisters (int exercise)
 
Set< AccountItemgetNotClosed (int exercise)
 
Double get129 (int exercise)
 
Collection< Integer > getExercises ()
 
Collection< RegistergetClosureRegisters (int exercise)
 

Detailed Description

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

Definition at line 34 of file ClosingRegisters.java.

Constructor & Destructor Documentation

◆ ClosingRegisters()

org.turro.financials.model.register.ClosingRegisters.ClosingRegisters ( String  startString,
String  endString,
String  operatingString 
)

Definition at line 39 of file ClosingRegisters.java.

39  {
40  this.startString = startString;
41  this.endString = endString;
42  this.operatingString = operatingString;
43  }

Member Function Documentation

◆ createClosingRegisters()

void org.turro.financials.model.register.ClosingRegisters.createClosingRegisters ( int  exercise)

Definition at line 57 of file ClosingRegisters.java.

57  {
58  for(Register r : generateClosingRegisters(exercise)) {
59  if(!r.isEmpty()) {
60  new RegisterWrapper(r).save();
61  }
62  }
63  }
Collection< Register > generateClosingRegisters(int exercise)
Here is the call graph for this function:

◆ deleteClosingRegisters()

void org.turro.financials.model.register.ClosingRegisters.deleteClosingRegisters ( int  exercise)

Definition at line 50 of file ClosingRegisters.java.

50  {
51  Collection<Register> list = getClosureRegisters(exercise);
52  for(Register r : list) {
53  new RegisterWrapper(r).delete();
54  }
55  }
Collection< Register > getClosureRegisters(int exercise)
Here is the call graph for this function:

◆ existsClosingRegisters()

boolean org.turro.financials.model.register.ClosingRegisters.existsClosingRegisters ( int  exercise)

Definition at line 45 of file ClosingRegisters.java.

45  {
46  Collection<Register> list = getClosureRegisters(exercise);
47  return list != null && !(list.isEmpty());
48  }
Here is the call graph for this function:

◆ generateClosingRegisters()

Collection<Register> org.turro.financials.model.register.ClosingRegisters.generateClosingRegisters ( int  exercise)

Definition at line 65 of file ClosingRegisters.java.

65  {
66  List<Register> list = new ArrayList<>();
67  Set amounts = getAmounts(exercise);
68  list.addAll(generateOperatingRegisters(exercise, amounts));
69  list.addAll(generateCloseAndStartRegisters(exercise, amounts));
70  return list;
71  }
Here is the caller graph for this function:

◆ get129()

Double org.turro.financials.model.register.ClosingRegisters.get129 ( int  exercise)

Definition at line 84 of file ClosingRegisters.java.

84  {
85  Dao dao = new FinancialsPU();
86  return (Double) dao.getSingleResultOrNull(
87  "select sum(round(re.debit - re.credit, 4) + 0.0) " +
88  "from RegisterEntry as re " +
89  "where year(re.register.registerDate) = ? " +
90  "and re.account.id = ?",
91  new Object[] { exercise, AccountFormat.expand("129") });
92  }
Here is the call graph for this function:

◆ getClosureRegisters()

Collection<Register> org.turro.financials.model.register.ClosingRegisters.getClosureRegisters ( int  exercise)

Definition at line 189 of file ClosingRegisters.java.

189  {
190  Dao dao = new FinancialsPU();
191  List<Register> list = dao.getResultList(
192  "select reg from Register reg " +
193  "where ( " +
194  "year(reg.registerDate) = ? " +
195  "and month(reg.registerDate) = 12 " +
196  "and reg.exclude = TRUE and reg.closing = TRUE " +
197  ") or ( " +
198  "year(reg.registerDate) = ? " +
199  "and month(reg.registerDate) = 1 " +
200  "and reg.exclude = FALSE and reg.closing = TRUE " +
201  ") and reg.document is null",
202  new Object[] { exercise, exercise + 1});
203  return list;
204  }
Here is the caller graph for this function:

◆ getExercises()

Collection<Integer> org.turro.financials.model.register.ClosingRegisters.getExercises ( )

Definition at line 94 of file ClosingRegisters.java.

94  {
95  Dao dao = new FinancialsPU();
96  return dao.getResultList(
97  "select distinct year(reg.registerDate) from Register reg");
98  }

◆ getNotClosed()

Set<AccountItem> org.turro.financials.model.register.ClosingRegisters.getNotClosed ( int  exercise)

Definition at line 73 of file ClosingRegisters.java.

73  {
74  Dao dao = new FinancialsPU();
75  return new AccountSet(dao.getResultList(
76  "select new org.turro.financials.model.register.AccountItem(re.register.view.id, re.account.id, sum(round(re.debit - re.credit, 4) + 0.0)) " +
77  "from RegisterEntry as re " +
78  "where year(re.register.registerDate) = ? " +
79  "group by re.register.view.id, re.account.id " +
80  "having sum(round(re.debit - re.credit, 4) + 0.0) <> 0.0",
81  new Object[] { exercise}));
82  }

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