BrightSide Workbench Full Report + Source Code
org.turro.financials.business.CompanyModelWrapper Class Reference

Public Member Functions

 CompanyModelWrapper (ContractItemSet items)
 
CategoryModel getSalesExpensesModel (List< Contract > contracts)
 
CategoryModel getStoresModel (List< Contract > contracts)
 
CategoryModel getParticipantsModel (List< Contract > contracts)
 
CategoryModel getProvidersModel (List< Contract > contracts)
 
CategoryModel getCustomersModel (List< Contract > contracts)
 
CategoryModel getSaleStoresModel (List< Contract > contracts)
 
CategoryModel getExpenseStoresModel (List< Contract > contracts)
 

Detailed Description

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

Definition at line 36 of file CompanyModelWrapper.java.

Constructor & Destructor Documentation

◆ CompanyModelWrapper()

org.turro.financials.business.CompanyModelWrapper.CompanyModelWrapper ( ContractItemSet  items)

Definition at line 40 of file CompanyModelWrapper.java.

40  {
41  this.items = items;
42  }

Member Function Documentation

◆ getCustomersModel()

CategoryModel org.turro.financials.business.CompanyModelWrapper.getCustomersModel ( List< Contract contracts)

Definition at line 111 of file CompanyModelWrapper.java.

111  {
112  SimpleCategoryModel cm = new SimpleCategoryModel();
113  for(ContractItem ci : items) {
114  if(exists(contracts, ci.getId())) {
115  for(ValueItem vi : ci.getParticipants().getCustomers()) {
116  setModelValue(cm, ci.getName(), vi.getName(), vi.getValue());
117  }
118  }
119  }
120  return cm;
121  }

◆ getExpenseStoresModel()

CategoryModel org.turro.financials.business.CompanyModelWrapper.getExpenseStoresModel ( List< Contract contracts)

Definition at line 135 of file CompanyModelWrapper.java.

135  {
136  SimpleCategoryModel cm = new SimpleCategoryModel();
137  for(ContractItem ci : items) {
138  if(exists(contracts, ci.getId())) {
139  for(ValueItem vi : ci.getValues().getExpenses()) {
140  setModelValue(cm, ci.getName(), vi.getName(), vi.getValue());
141  }
142  }
143  }
144  return cm;
145  }

◆ getParticipantsModel()

CategoryModel org.turro.financials.business.CompanyModelWrapper.getParticipantsModel ( List< Contract contracts)

Definition at line 87 of file CompanyModelWrapper.java.

87  {
88  SimpleCategoryModel cm = new SimpleCategoryModel();
89  for(ContractItem ci : items) {
90  if(exists(contracts, ci.getId())) {
91  for(ValueItem vi : ci.getParticipants()) {
92  setModelValue(cm, ci.getName(), vi.getName(), vi.getValue());
93  }
94  }
95  }
96  return cm;
97  }

◆ getProvidersModel()

CategoryModel org.turro.financials.business.CompanyModelWrapper.getProvidersModel ( List< Contract contracts)

Definition at line 99 of file CompanyModelWrapper.java.

99  {
100  SimpleCategoryModel cm = new SimpleCategoryModel();
101  for(ContractItem ci : items) {
102  if(exists(contracts, ci.getId())) {
103  for(ValueItem vi : ci.getParticipants().getProviders()) {
104  setModelValue(cm, ci.getName(), vi.getName(), vi.getValue());
105  }
106  }
107  }
108  return cm;
109  }

◆ getSalesExpensesModel()

CategoryModel org.turro.financials.business.CompanyModelWrapper.getSalesExpensesModel ( List< Contract contracts)

Definition at line 44 of file CompanyModelWrapper.java.

44  {
45  SimpleCategoryModel cm = new SimpleCategoryModel();
46  // Ensure all months exist with zero value and ordered
47  MonthItemSet mis = new MonthItemSet();
48  for(ContractItem ci : items) {
49  if(exists(contracts, ci.getId())) {
50  for(MonthItem mi : ci.getMonths()) {
51  mis.getMonth(mi.getYear(), mi.getMonth());
52  }
53  }
54  }
55  for(MonthItem mi : mis) {
56  setModelValue(cm, I_.get("Sales"), mi.getStringId(), 0);
57  setModelValue(cm, I_.get("Expenses"), mi.getStringId(), 0);
58  setModelValue(cm, I_.get("Profit"), mi.getStringId(), 0);
59  }
60  // Add values
61  for(ContractItem ci : items) {
62  if(exists(contracts, ci.getId())) {
63  for(MonthItem mi : ci.getMonths()) {
64  double sales = mi.getMovements().getValues().getSalesAmount();
65  double expenses = mi.getMovements().getValues().getExpensesAmount();
66  setModelValue(cm, I_.get("Sales"), mi.getStringId(), sales);
67  setModelValue(cm, I_.get("Expenses"), mi.getStringId(), expenses);
68  setModelValue(cm, I_.get("Profit"), mi.getStringId(), sales - expenses);
69  }
70  }
71  }
72  return cm;
73  }
Here is the call graph for this function:

◆ getSaleStoresModel()

CategoryModel org.turro.financials.business.CompanyModelWrapper.getSaleStoresModel ( List< Contract contracts)

Definition at line 123 of file CompanyModelWrapper.java.

123  {
124  SimpleCategoryModel cm = new SimpleCategoryModel();
125  for(ContractItem ci : items) {
126  if(exists(contracts, ci.getId())) {
127  for(ValueItem vi : ci.getValues().getSales()) {
128  setModelValue(cm, ci.getName(), vi.getName(), vi.getValue());
129  }
130  }
131  }
132  return cm;
133  }

◆ getStoresModel()

CategoryModel org.turro.financials.business.CompanyModelWrapper.getStoresModel ( List< Contract contracts)

Definition at line 75 of file CompanyModelWrapper.java.

75  {
76  SimpleCategoryModel cm = new SimpleCategoryModel();
77  for(ContractItem ci : items) {
78  if(exists(contracts, ci.getId())) {
79  for(ValueItem vi : ci.getValues()) {
80  setModelValue(cm, ci.getName(), vi.getName(), vi.getValue());
81  }
82  }
83  }
84  return cm;
85  }

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