> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# InvoiceEntry

> Represents invoice entries and lets you create new or modify existing invoice entries

Represents invoice entries and lets you create new or modify existing invoice entries

## Constructors

### InvoiceEntry()

```crmscript theme={null}
InvoiceEntry
```

Initializes a new instance of the InvoiceEntry class.

## Methods

## getDiscount()

Gets the discount of the current InvoiceEntry object in percent.

```crmscript theme={null}
String getDiscount()
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The discount in percent as a String-representation of a number with 2 decimals accuracy.

<Note>
  The save-function calculates the discount in percent and money. So if the discount is set in money (setDiscountMoney(Float)), you have to save the entry before getting the corresponding value in percent.
</Note>

## getDiscountMoney()

Gets the discount of the current InvoiceEntry object in money.

```crmscript theme={null}
String getDiscountMoney()
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The discount in money as a String-representation of a number with 2 decimals accuracy.

<Note>
  The save-function calculates the discount in percent and money. So if the discount is set in percent (setDiscount()), you have to save the entry before getting the corresponding value in money with this function.
</Note>

## getPricePrUnit()

Returns the price per unit of the current InvoiceEntry object.

```crmscript theme={null}
String getPricePrUnit()
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Price per unit as a String-representation of a number with 2 decimals accuracy.

## getValue(String)

Gets the value of the specified field.

```crmscript theme={null}
String getValue(String field)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The value of the field.

<Note>
  Available fields:

  * messageId the id which this invoice entry is connected to
  * description the descriptive text of this invoice entry
  * type ID of the type for this invoice entry
  * quantity the number of units invoiced
  * pricePrUnit price per unit (precision 2)
  * discount discount in percentage for this invoice entry (precision 2)
  * discountMoney discount in money (precision 2)
  * date the date for this invoice entry
</Note>

## load(Integer)

Loads an existing InvoiceEntry object.

```crmscript theme={null}
Bool load(Integer id)
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool)

## save()

Saves the existing InvoiceEntry object and returns the ID.

```crmscript theme={null}
Integer save()
```

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The ID of the saved InvoiceEntry object.

## setDiscount(Float)

Sets the discount of the current InvoiceEntry object with the given percent.

```crmscript theme={null}
Void setDiscount(Float percent)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

<Note>
  If discount is set in both percent and money, the save-function use the money-version.
</Note>

## setDiscountMoney(Float)

Sets the discount of the current InvoiceEntry object with the given money.

```crmscript theme={null}
Void setDiscountMoney(Float money)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

<Note>
  If both setDiscount() and this function has been used, the save-function uses the discount in money.
</Note>

## setPricePrUnit(Float)

Sets the price per unit for the current InvoiceEntry object with the given price.

```crmscript theme={null}
Void SetPricePrUnit(Float price)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

## setValue(String,String)

Sets a field of the current InvoiceEntry object with the given value.

```crmscript theme={null}
Void setValue(String field, String value)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

<Note>
  Available fields:

  * messageId the ID of the message which this invoice entry is connected to
  * description a description of the invoice entry
  * type the ID of the type which this invoice entry will be saved as
  * quantity number of invoiced unites (this can be a float value)
  * pricePrUnit price pr. unit (this can be a float value of precision 2)
  * discount discount given in percentage (float value of precision 2). If discountMoney is also specified, this field will be ignored
  * discountMoney discount in money
  * date the date of the invoice entry
</Note>


## Related topics

- [Namespace CRMScript.Native](/en/automation/crmscript/reference/CRMScript.Native.md)
- [CRMScript Reference](/en/automation/crmscript/reference/index.md)
- [invoice_entry table](/en/database/tables/invoice-entry.md)
- [invoice_type table](/en/database/tables/invoice-type.md)
- [invoice table](/en/database/tables/invoice.md)
- [ej_message table](/en/database/tables/ej-message.md)
