Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ public class Messages extends NLS
public static String LabelConsumerPriceIndex;
public static String LabelConvertBuySellIntoDeliveryTransactions;
public static String LabelCopyToClipboard;
public static String LabelCostMethod;
public static String LabelCountry;
public static String LabelCreateAccountFirst;
public static String LabelCrosshair;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Convert buy/sell transactions into

LabelCopyToClipboard = Copy to Clipboard

LabelCostMethod = Acquisition cost method

LabelCountry = Country

LabelCreateAccountFirst = First, create a {0} account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Convertir les transaccions de comp
LabelCopyToClipboard = Copiar al porta-retalls
LabelCostMethod = M\u00E8tode del cost d'adquisici\u00F3

LabelCountry = Pa\u00EDs

LabelCreateAccountFirst = Primer crea un compte {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,8 @@ LabelConvertBuySellIntoDeliveryTransactions = P\u0159evod n\u00E1kupn\u00EDch/pr

LabelCopyToClipboard = Zkop\u00EDrovat do schr\u00E1nky

LabelCostMethod = Metoda po\u0159izovac\u00EDch n\u00E1klad\u016F

LabelCountry = Zem\u011B

LabelCreateAccountFirst = Nejprve si vytvo\u0159te \u00FA\u010Det {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Konverter k\u00F8b/salg transaktio

LabelCopyToClipboard = Kopier til udklipsholder

LabelCostMethod = Anskaffelsesprismetoden

LabelCountry = Land

LabelCreateAccountFirst = Opret f\u00F8rst en {0}-konto.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,8 @@ LabelConvertBuySellIntoDeliveryTransactions = K\u00E4ufe/Verk\u00E4ufe in Ein-/A

LabelCopyToClipboard = In Zwischenablage kopieren

LabelCostMethod = Anschaffungskostenmethode

LabelCountry = Land

LabelCreateAccountFirst = Lege zuerst ein {0}-Konto an.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Convertir las transacciones de com

LabelCopyToClipboard = Copiar al portapapeles

LabelCostMethod = M\u00E9todo del costo de adquisici\u00F3n

LabelCountry = Pa\u00EDs

LabelCreateAccountFirst = Primero crea una cuenta {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Convertir les op\u00E9rations d'ac

LabelCopyToClipboard = Copier dans le presse-papier

LabelCostMethod = M\u00E9thode du co\u00FBt d'achat

LabelCountry = Pays

LabelCreateAccountFirst = Commence par cr\u00E9er un compte {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Converti operazioni di acquisto/ve

LabelCopyToClipboard = Copia negli appunti

LabelCostMethod = Metodo del costo di acquisizione

LabelCountry = Nazione

LabelCreateAccountFirst = Prima crea un account {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Aan-/verkopen converteren naar ink
LabelCopyToClipboard = Kopi\u00EBren naar klembord
LabelCostMethod = Aanschaffingskostenmethode
LabelCountry = Land
LabelCreateAccountFirst = Maak eerst een {0}-account aan.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Konwertuj transakcje kupna/sprzeda

LabelCopyToClipboard = Skopiuj do schowka

LabelCostMethod = Metoda ceny nabycia

LabelCountry = Kraj

LabelCreateAccountFirst = Najpierw utw\u00F3rz konto {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Converter transa\u00E7\u00F5es de

LabelCopyToClipboard = Copiar para a \u00E1rea de transfer\u00EAncia

LabelCostMethod = M\u00E9todo do custo de aquisi\u00E7\u00E3o

LabelCountry = Pa\u00EDs

LabelCreateAccountFirst = Primeiro, crie uma conta {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Converter transa\u00E7\u00F5es de

LabelCopyToClipboard = Copiar para a \u00E1rea de transfer\u00EAncia

LabelCostMethod = M\u00E9todo do custo de aquisi\u00E7\u00E3o

LabelCountry = Pa\u00EDs

LabelCreateAccountFirst = Primeiro, crie uma conta {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = \u041F\u0440\u0435\u043E\u0431\u04

LabelCopyToClipboard = \u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432 \u0411\u0443\u0444\u0435\u0440

LabelCostMethod = \u041C\u0435\u0442\u043E\u0434 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0441\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u0438 \u043F\u0440\u0438\u043E\u0431\u0440\u0435\u0442\u0435\u043D\u0438\u044F

LabelCountry = \u0421\u0442\u0440\u0430\u043D\u0430

LabelCreateAccountFirst = \u0421\u043D\u0430\u0447\u0430\u043B\u0430 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0441\u044F, \u0441\u043E\u0437\u0434\u0430\u0432 \u0443\u0447\u0435\u0442\u043D\u0443\u044E \u0437\u0430\u043F\u0438\u0441\u044C {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Prevod n\u00E1kupn\u00FDch/predajn
LabelCopyToClipboard = Kop\u00EDrovanie do schr\u00E1nky
LabelCostMethod = Met\u00F3da obstar\u00E1vac\u00EDch n\u00E1kladov
LabelCountry = Krajina
LabelCreateAccountFirst = Najprv si vytvorte \u00FA\u010Det {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Al\u0131m/sat\u0131m i\u015Flemler

LabelCopyToClipboard = Panoya Kopyala

LabelCostMethod = Edinme maliyeti y\u00F6ntemi

LabelCountry = \u00DClke

LabelCreateAccountFirst = \u00D6ncelikle bir {0} hesab\u0131 olu\u015Fturun.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = Chuy\u1EC3n \u0111\u1ED5i giao d\u

LabelCopyToClipboard = Sao ch\u00E9p v\u00E0o clipboard

LabelCostMethod = Ph\u01B0\u01A1ng ph\u00E1p chi ph\u00ED mua s\u1EAFm

LabelCountry = Qu\u1ED1c gia

LabelCreateAccountFirst = Tr\u01B0\u1EDBc ti\u00EAn, h\u00E3y t\u1EA1o m\u1ED9t t\u00E0i kho\u1EA3n {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = \u5C06\u4E70\u5165/\u5356\u51FA\u6

LabelCopyToClipboard = \u590D\u5236\u81F3\u526A\u8D34\u677F

LabelCostMethod = \u8D2D\u7F6E\u6210\u672C\u6CD5

LabelCountry = \u56FD\u5BB6\u6216\u5730\u533A

LabelCreateAccountFirst = \u8BF7\u521B\u5EFA\u4E00\u4E2A {0} \u8D26\u6237\u3002
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ LabelConvertBuySellIntoDeliveryTransactions = \u5C07\u8CB7\u8CE3\u4EA4\u6613\u8F
LabelCopyToClipboard = \u8907\u88FD\u5230\u526A\u8CBC\u677F
LabelCostMethod = \u8CFC\u7F6E\u6210\u672C\u6CD5
LabelCountry = \u570B\u5BB6
LabelCreateAccountFirst = \u5148\u5EFA\u7ACB\u4E00\u500B {0} \u5E33\u6236\u3002
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;

import name.abuchen.portfolio.model.CostMethod;
import name.abuchen.portfolio.model.Dashboard.Widget;
import name.abuchen.portfolio.money.CurrencyConverter;
import name.abuchen.portfolio.snapshot.filter.ClientFilter;
Expand Down Expand Up @@ -134,7 +135,7 @@ public void linkActivated(HyperlinkEvent e)
GrossNetType grossNetType = get(GrossNetTypeConfig.class).getValue();

part.activateView(PaymentsView.class, new PaymentsViewInput(tab, startYear, Optional.of(filterIdent),
mode, grossNetType == GrossNetType.GROSS, false));
mode, grossNetType == GrossNetType.GROSS, false, CostMethod.FIFO));
}
});

Expand All @@ -154,7 +155,7 @@ public Supplier<PaymentsViewModel> getUpdateTask()
return () -> (PaymentsViewModel) getDashboardData().getCache().computeIfAbsent(key, k -> {
PaymentsViewModel model = new PaymentsViewModel(converter, getClient());
PaymentsViewModel.Mode mode = earningsType.getPaymentsViewModelMode();
model.configure(startYear, mode, grossNetType == GrossNetType.GROSS, false);
model.configure(startYear, mode, grossNetType == GrossNetType.GROSS, false, CostMethod.FIFO);
model.setFilteredClient(clientFilter.filter(getClient()));
model.recalculate();
return model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.inject.Inject;

import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.CostMethod;
import name.abuchen.portfolio.model.Dashboard.Widget;
import name.abuchen.portfolio.money.CurrencyConverter;
import name.abuchen.portfolio.ui.editor.PortfolioPart;
Expand Down Expand Up @@ -45,7 +46,7 @@ protected void linkActivated()

part.activateView(PaymentsView.class,
new PaymentsViewInput(0 /* monthly table */, startYear, Optional.of(clientFilterId), mode,
grossNetType == GrossNetType.GROSS, false));
grossNetType == GrossNetType.GROSS, false, CostMethod.FIFO));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import name.abuchen.portfolio.model.AccountTransaction;
import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.CostMethod;
import name.abuchen.portfolio.model.Dashboard.Widget;
import name.abuchen.portfolio.model.Transaction.Unit;
import name.abuchen.portfolio.money.CurrencyConverter;
Expand Down Expand Up @@ -75,7 +76,8 @@ protected void linkActivated()
String clientFilterId = get(ClientFilterConfig.class).getSelectedItem().getId();

part.activateView(PaymentsView.class, new PaymentsViewInput(
0 /* monthly table */, startYear, Optional.of(clientFilterId), mode, true, false));
0 /* monthly table */, startYear, Optional.of(clientFilterId), mode, true, false,
CostMethod.FIFO));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.swt.widgets.Control;

import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.CostMethod;
import name.abuchen.portfolio.money.CurrencyConverterImpl;
import name.abuchen.portfolio.money.ExchangeRateProviderFactory;
import name.abuchen.portfolio.snapshot.filter.ClientFilter;
Expand All @@ -30,6 +31,7 @@
import name.abuchen.portfolio.ui.editor.AbstractFinanceView;
import name.abuchen.portfolio.ui.util.ClientFilterMenu;
import name.abuchen.portfolio.ui.util.DropDown;
import name.abuchen.portfolio.ui.util.LabelOnly;
import name.abuchen.portfolio.ui.util.SimpleAction;
import name.abuchen.portfolio.ui.views.panes.HistoricalPricesPane;
import name.abuchen.portfolio.ui.views.panes.InformationPanePage;
Expand Down Expand Up @@ -85,7 +87,7 @@ public void setupModel()
loadSavedFilterIdAndSetFilteredClientToModel();

model.configure(viewInput.getYear(), viewInput.getMode(), viewInput.isUseGrossValue(),
viewInput.isUseConsolidateRetired());
viewInput.isUseConsolidateRetired(), viewInput.getCostMethod());

model.setHideTotalsAtTheTop(preferences.getBoolean(PaymentsViewInput.TOP));
model.setHideTotalsAtTheBottom(preferences.getBoolean(PaymentsViewInput.BOTTOM));
Expand All @@ -95,6 +97,7 @@ public void setupModel()
viewInput.setMode(model.getMode());
viewInput.setUseGrossValue(model.usesGrossValue());
viewInput.setUseConsolidateRetired(model.usesConsolidateRetired());
viewInput.setCostMethod(model.getCostMethod());
});
}

Expand Down Expand Up @@ -192,6 +195,24 @@ protected void addButtons(ToolBarManager toolBar)
manager.add(action);
}

EnumSet<Mode> supportCostMethod = EnumSet.of(Mode.TRADES, Mode.ALL);
if (supportCostMethod.contains(model.getMode()))
{
manager.add(new LabelOnly(Messages.LabelCostMethod));

Action action = new SimpleAction(CostMethod.FIFO.getLabel(),
a -> model.setCostMethod(CostMethod.FIFO));
action.setChecked(model.getCostMethod().useFifo());
manager.add(action);

action = new SimpleAction(CostMethod.MOVING_AVERAGE.getLabel(),
a -> model.setCostMethod(CostMethod.MOVING_AVERAGE));
action.setChecked(!model.getCostMethod().useFifo());
manager.add(action);
}

manager.add(new Separator());

Action action = new SimpleAction(Messages.LabelPaymentsUseConsolidateRetired,
a -> model.setUseConsolidateRetired(!model.usesConsolidateRetired()));
action.setChecked(model.usesConsolidateRetired());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.eclipse.jface.preference.IPreferenceStore;

import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.CostMethod;
import name.abuchen.portfolio.ui.util.ClientFilterMenu;
import name.abuchen.portfolio.ui.views.payments.PaymentsViewModel.Mode;

Expand All @@ -17,6 +18,8 @@ public class PaymentsViewInput
private static final String KEY_USE_GROSS_VALUE = PaymentsView.class.getSimpleName() + "-use-gross-value"; //$NON-NLS-1$
private static final String KEY_USE_CONSOLIDATE_RETIRED = PaymentsView.class.getSimpleName()
+ "-use-consolidate-retired"; //$NON-NLS-1$
private static final String KEY_COST_METHOD = PaymentsView.class.getSimpleName() + "-cost-method"; //$NON-NLS-1$

// for legacy reasons, the key is stored with the name PaymentsViewModel
private static final String KEY_USED_FILTER = PaymentsViewModel.class.getSimpleName();

Expand All @@ -35,16 +38,18 @@ public class PaymentsViewInput
private PaymentsViewModel.Mode mode;
private boolean useGrossValue;
private boolean useConsolidateRetired;
private CostMethod costMethod;

public PaymentsViewInput(int tab, int year, Optional<String> clientFilterId, Mode mode, boolean useGrossValue,
boolean useConsolidateRetired)
boolean useConsolidateRetired, CostMethod costMethod)
{
this.tab = tab;
this.year = year;
this.clientFilterId = clientFilterId;
this.mode = mode;
this.useGrossValue = useGrossValue;
this.useConsolidateRetired = useConsolidateRetired;
this.costMethod = costMethod;
}

public int getTab()
Expand Down Expand Up @@ -107,6 +112,16 @@ public void setUseConsolidateRetired(boolean useConsolidateRetired)
this.useConsolidateRetired = useConsolidateRetired;
}

public CostMethod getCostMethod()
{
return costMethod;
}

public void setCostMethod(CostMethod costMethod)
{
this.costMethod = costMethod;
}

public static PaymentsViewInput fromPreferences(IPreferenceStore preferences, Client client)
{
int tab = preferences.getInt(KEY_TAB);
Expand Down Expand Up @@ -136,7 +151,21 @@ public static PaymentsViewInput fromPreferences(IPreferenceStore preferences, Cl
boolean useGrossValue = preferences.getBoolean(KEY_USE_GROSS_VALUE);
boolean useConsolidateRetired = preferences.getBoolean(KEY_USE_CONSOLIDATE_RETIRED);

return new PaymentsViewInput(tab, year, clientFilterId, mode, useGrossValue, useConsolidateRetired);
prefMode = preferences.getString(KEY_COST_METHOD);
var costMethod = CostMethod.FIFO;
if (prefMode != null && !prefMode.isEmpty())
{
try
{
costMethod = CostMethod.valueOf(prefMode);
}
catch (Exception ignore)
{ // use default cost method : FIFO
}
}

return new PaymentsViewInput(tab, year, clientFilterId, mode, useGrossValue, useConsolidateRetired,
costMethod);
}

public void writeToPreferences(IPreferenceStore preferences, Client client)
Expand All @@ -146,6 +175,7 @@ public void writeToPreferences(IPreferenceStore preferences, Client client)
preferences.setValue(KEY_MODE, mode.name());
preferences.setValue(KEY_USE_GROSS_VALUE, useGrossValue);
preferences.setValue(KEY_USE_CONSOLIDATE_RETIRED, useConsolidateRetired);
preferences.setValue(KEY_COST_METHOD, costMethod.name());

ClientFilterMenu.saveSelectedFilter(client, KEY_USED_FILTER, clientFilterId.orElse("")); //$NON-NLS-1$
}
Expand Down
Loading