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

Public Member Functions

 FixedAssetWrapper (FixedAsset asset)
 
FixedAsset save (DocumentLinesGrid lines)
 
void loadLines (FilterGrid filterGrid, final Command command)
 
- Public Member Functions inherited from org.turro.financials.model.asset.FixedAssetWrapper
FixedAsset save ()
 
boolean delete ()
 
boolean canDelete ()
 
void keepRelations (Set< DocumentLine > docLines)
 
double getInvestment ()
 
double getDepreciated ()
 
double getToDepreciate (Date date)
 
Collection< RegisterEntrygetEntries ()
 

Static Public Member Functions

static void doDepreciations (Page page)
 
- Static Public Member Functions inherited from org.turro.financials.model.asset.FixedAssetWrapper
static LineType getBuyLineType ()
 
static DocumentDefinition getInvestmentProviderModel ()
 
static Collection< FixedAssetgetAssets ()
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.financials.model.asset.FixedAssetWrapper
FixedAsset asset
 

Detailed Description

Constructor & Destructor Documentation

◆ FixedAssetWrapper()

org.turro.financials.assets.FixedAssetWrapper.FixedAssetWrapper ( FixedAsset  asset)

Member Function Documentation

◆ doDepreciations()

static void org.turro.financials.assets.FixedAssetWrapper.doDepreciations ( Page  page)
static

Definition at line 125 of file bsfinancials-www/src/main/java/org/turro/financials/assets/FixedAssetWrapper.java.

125  {
126  InputDialog.getInput(page, I_.get("Depreciations"), "Date",
127  new Date(), null, 0, new Command() {
128  @Override
129  public Object execute(Context context) {
130  Date date = (Date) context.get("value");
131  if(date != null) {
132  for(RegisterView v : ViewWrapper.getViews()) {
133  RegisterGenerator rg = new RegisterGenerator();
134  for(FixedAsset asset : getAssets()) {
135  if(asset.getView().getId() == v.getId()) {
136  double toDepreciate = new FixedAssetWrapper(asset).getToDepreciate(date);
137  if(!Zero.near(toDepreciate, 2)) {
138  Set<RegisterEntry> sre = rg.addAmount(v, null, asset.getStore(), asset.getDepreciationLineType(),
139  asset.getId() + "-" + asset.getName(), toDepreciate);
140  for(RegisterEntry re : sre) {
141  re.setPath(FinancialsPU.getObjectPath(asset));
142  }
143  }
144  }
145  }
146  if(rg.getRegister() != null && !(rg.getRegister().getRegisterEntries().isEmpty())) {
147  rg.getRegister().setView(v);
148  rg.getRegister().setRegisterDate(date);
149  FinancialsMenu.showRegister(rg.getRegister());
150  }
151  }
152  }
153  return null;
154  }
155  });
156  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadLines()

void org.turro.financials.assets.FixedAssetWrapper.loadLines ( FilterGrid  filterGrid,
final Command  command 
)

Definition at line 80 of file bsfinancials-www/src/main/java/org/turro/financials/assets/FixedAssetWrapper.java.

80  {
81  final DocumentLinesListbox docLines = new DocumentLinesListbox(getPossibleLines(filterGrid));
82  docLines.setMultiple(true);
83  docLines.setCheckmark(true);
84  docLines.setShowContract(true);
85  docLines.setSelectFirst(false);
86 
87  SelectionDialog.getComponent(
88  Framework.getCurrent().getPage(),
89  I_.get("Documents"),
90  docLines, "80%", "80%", new Command() {
91  @Override
92  public Object execute(Context context) {
93  if(docLines != null) {
94  for(DocumentLine dl : docLines.getObjectValues()) {
95  asset.getDocumentLines().add(dl);
96  }
97  if(command != null) command.execute(context);
98  }
99  return null;
100  }
101  });
102  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save()

FixedAsset org.turro.financials.assets.FixedAssetWrapper.save ( DocumentLinesGrid  lines)

Definition at line 58 of file bsfinancials-www/src/main/java/org/turro/financials/assets/FixedAssetWrapper.java.

58  {
59  if(asset.isEmpty()) return null;
60  for(Component row : lines.getRows().getChildren()) {
61  if(((Row)row).getValue() instanceof DocumentLine) {
62  Checkbox cb = (Checkbox) row.getAttribute("cb");
63  if(cb != null && cb.isChecked()) {
64  DocumentLine dl = (DocumentLine) ((Row)row).getValue();
65  Iterator<DocumentLine> it = asset.getDocumentLines().iterator();
66  while(it.hasNext()) {
67  if(it.next().getId() == dl.getId()) {
68  it.remove();
69  dl.setContractPreference(dl.getDocument().getDefaultContractPreference());
70  new DocumentWrapper(dl.getDocument()).save(null, null);
71  break;
72  }
73  }
74  }
75  }
76  }
77  return super.save();
78  }
Here is the call graph for this function:

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