In this article
The Calculate sales data dialog allows you to determine the book profit or loss from a security sale. It provides two main functions within a single dialog:
- Calculate the Sale Result (independent of the selected row): By clicking "Calculate profit or loss" button, you can immediately see a preview of the sale result based on the data entered (or automatically retrieved) without recording any transaction. This function works even if you are not starting from the net sale transaction row.
- Create the Sales Record (requires the net sale transaction row): By clicking "Create sales record" button, you instruct the program to generate the necessary accounting entries for the sale. To do this, you must start from the sale transaction row in the Transactions table, which records the net sale of the security.
Start from the Sale Transaction Row
When creating the actual sales record, the program needs to know which transaction to update or supplement with additional entries (such as fees, net proceeds, exchange differences, etc.). Therefore, you must begin with the row that already documents the net sale of the security.
If this row already includes:
- Item (Security ID)
- Quantity
- Unit Price (Market Price)
- Exchange Rate (for multi-currency accounting)
The dialog retrieves them automatically. Otherwise, you will need to enter them in the dialog.
This sale transaction row is currently the only row that must be entered manually. Once it exists, the program can create and add all other entries automatically.
How to use the dialog
When you execute this command, a dialog titled "Calculate book profit/loss on sale" opens.
Here, you must enter specific details about the sale, including:
- Security Data:
- Id (ISIN): Select the security from the dropdown.
- Type: Displays whether the security is a Stock or a Bond
- Quantity/Nominal Value: Enter the quantity of the security being sold.
- Current Price: The market price per unit at which the security is being sold.
- Current Exchange Rate: If applicable, enter the exchange rate for the transaction currency.
- Bank Charges: Specify any bank fees related to the sale. If not present, the record line is not added
- Other Charges: Enter any additional costs associated with the transaction, If not present, the record line is not added.
- Accrued Interests: If selling bonds, include the accrued interest amount (enabled only with bonds).
- Results Preview: Once the required data is entered, clicking "Calculate profit or loss" generates a preview showing:
- Actual Quantity: The number of units held before the transaction.
- Book Value per Unit: The average purchase price of the security.
- Total Book Value: The total purchase value of the securities being sold.
- Total at Current Price: The total market value of the securities at the entered price.
- Book Profit/Loss: The difference between the book value and the sale value.
- Exchange Rate Profit/Loss: If the security is in a different currency, the profit or loss due to exchange rate variations.
Amounts are shows using the number of decimals available in the column where the value would be placed in the Transactions table.
The Sale recording
Once you are satisfied with the preview, you can click "Create sales record" to finalize the transaction. The program will then present a confirmation dialog showing the entries to be added or modified, allowing you to review everything before proceeding.
- Upon confirmation, the program updates the accounting records with any new or modified entries.
- If the quantity is zero or the calculated profit/loss is zero, no transaction is created.
- The program also adds a transaction identifier to the ExternalReference column (both for the starting row and any newly added rows) to prevent duplications if you run the command multiple times on the same sale row.
- If the program detects an existing record for this sale, it will ask whether you want to overwrite it.
This feature ensures that securities sales are correctly recorded, while giving you full control over transactions before they are finalized.
In the example shown in the photo, placeholder accounts have been used. These are essentially used when no accounts are defined in the Accounts Settings dialog.
Troubleshooting
- The selected row does not contain the Security ID: This message is shown when you are trying to create sales records having selected a row without a valid security id. Each row on which changes are made must contain the valid id of a title in the Items table.
- The selected row does not contain a valid sale Quantity: This message is shown when you are trying to create sales records having selected a row with a positive quantity, this could happen if you forget to put the minus '-' sign before the quantity or if you selecte a purchase row.
- The selected row in the Transactions table is not correct: This message is shown when you are trying to create sales records having selected a row that is not the security sale row.
- The selected row in the Transactions table is not valid: The selected row in the transactions table is not a valid row.
- Item: CHXXX not found: The selected item does not exists in the Items table.
- Item: CHXXX without assigned type. Define the type in the Items table: This message is shown when you are trying to create sales records having selected an item for which a reference unit (ReferenceUnit column) has not been defined in the item table.