@nexim/financial-calculate
Version:
Provides a set of utils to handle common financial operations.
26 lines (16 loc) • 999 B
Markdown
[@nexim/financial-calculate](../README.md) / calculatePercentageProfit
# Function: calculatePercentageProfit()
> **calculatePercentageProfit**(`sellingPrice`: `number`, `costPrice`: `number`, `decimal`: `number`): `number`
Calculates the profit percentage between the selling price and the cost price.
## Parameters
| Parameter | Type | Default value | Description |
| -------------- | -------- | ------------- | ------------------------------------------------------------------- |
| `sellingPrice` | `number` | `undefined` | The selling price of the item. |
| `costPrice` | `number` | `undefined` | The cost price of the item. |
| `decimal` | `number` | `2` | The number of decimal places to round the result to (default is 2). |
## Returns
`number`
## Example
```ts
calculatePercentageProfit(100, 80); // Returns 25.00
```