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

Public Member Functions

 RegisterGenerator ()
 
int getFractionDigits ()
 
Register getRegister ()
 
void setRegister (Register register)
 
void addAccount (Account account, String concept, double balance)
 
void addAccount (Contract store, String concept, double debit, double credit)
 
void addAccount (Account account, String concept, double debit, double credit)
 
Set< RegisterEntryaddAmount (RegisterView view, Contract contract, Contract store, LineType lineType, String concept, double amount)
 

Detailed Description

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

Definition at line 34 of file RegisterGenerator.java.

Constructor & Destructor Documentation

◆ RegisterGenerator()

org.turro.financials.model.register.RegisterGenerator.RegisterGenerator ( )

Definition at line 39 of file RegisterGenerator.java.

39  {
40  fractionDigits = CompanyWrapper.getCompanyCurrency().getDefaultFractionDigits();
41  }
Here is the call graph for this function:

Member Function Documentation

◆ addAccount() [1/3]

void org.turro.financials.model.register.RegisterGenerator.addAccount ( Account  account,
String  concept,
double  balance 
)

Definition at line 58 of file RegisterGenerator.java.

58  {
59  if(!Zero.near(balance, fractionDigits)) {
60  if(balance < 0) {
61  addAccount(account, concept, 0.0, -balance);
62  } else {
63  addAccount(account, concept, balance, 0.0);
64  }
65  }
66  }
void addAccount(Account account, String concept, double balance)
static boolean near(double value, int digits)
Definition: Zero.java:30
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addAccount() [2/3]

void org.turro.financials.model.register.RegisterGenerator.addAccount ( Account  account,
String  concept,
double  debit,
double  credit 
)

Definition at line 79 of file RegisterGenerator.java.

79  {
80  if(register == null) {
81  register = new Register();
82  }
83  if(Strings.isBlank(account.getDescription())) {
84  MajorAccount ma = account.getParent();
85  if(ma != null) {
86  account.setDescription(ma.getDescription());
87  }
88  }
89  if(!(Zero.near(debit, fractionDigits))) {
90  RegisterEntry re = new RegisterEntry();
91  re.setAccount(account);
92  re.setConcept(concept);
93  re.setCredit(0.0);
94  re.setDebit(new Round(debit).decimals(fractionDigits).value());
95  re.setRegister(register);
96  register.getRegisterEntries().add(re);
97  re.roundIt(fractionDigits);
98  }
99  if(!(Zero.near(credit, fractionDigits))) {
100  RegisterEntry re = new RegisterEntry();
101  re.setAccount(account);
102  re.setConcept(concept);
103  re.setCredit(new Round(credit).decimals(fractionDigits).value());
104  re.setDebit(0.0);
105  re.setRegister(register);
106  register.getRegisterEntries().add(re);
107  re.roundIt(fractionDigits);
108  }
109  }
void setDescription(String description)
Definition: Account.java:45
Here is the call graph for this function:

◆ addAccount() [3/3]

void org.turro.financials.model.register.RegisterGenerator.addAccount ( Contract  store,
String  concept,
double  debit,
double  credit 
)

Definition at line 68 of file RegisterGenerator.java.

68  {
69  String accStr = "%ctd.%ct",
71  accStr = accStr.replaceAll("\\%ctd", asCash)
72  .replaceAll("\\%ct", "" + store.getId());
73  Account account = new Account();
74  account.setId(AccountFormat.expand(accStr));
75  account.setDescription(store.getFullDescription());
76  addAccount(account, concept, debit, credit);
77  }
ContractDefinition getContractDefinition()
Definition: Contract.java:125
Here is the call graph for this function:

◆ addAmount()

Set<RegisterEntry> org.turro.financials.model.register.RegisterGenerator.addAmount ( RegisterView  view,
Contract  contract,
Contract  store,
LineType  lineType,
String  concept,
double  amount 
)

Definition at line 111 of file RegisterGenerator.java.

111  {
112  Set<RegisterEntry> set = addEntries(view, contract, store, lineType, concept, amount);
113  if(register == null) {
114  register = new Register();
115  }
116  for(RegisterEntry re : set) {
117  re.setRegister(register);
118  register.getRegisterEntries().add(re);
119  }
120  return set;
121  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFractionDigits()

int org.turro.financials.model.register.RegisterGenerator.getFractionDigits ( )

Definition at line 43 of file RegisterGenerator.java.

43  {
44  return fractionDigits;
45  }

◆ getRegister()

Register org.turro.financials.model.register.RegisterGenerator.getRegister ( )

Definition at line 47 of file RegisterGenerator.java.

47  {
48  if(register == null) {
49  register = new Register();
50  }
51  return register;
52  }
Here is the caller graph for this function:

◆ setRegister()

void org.turro.financials.model.register.RegisterGenerator.setRegister ( Register  register)

Definition at line 54 of file RegisterGenerator.java.

54  {
55  this.register = register;
56  }

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