# Datev Export

As this function calls customized SQL scripts, it will add SQL parameters from the function call to the SQL calls.

* @company
* @dateFrom
* @dateUntil

Those parameters can be used within the SQL statements.

### Needed output columns from SQL scripts

* sqlDataRead script
  * Auftragsnummer
  * Artikelnummer
  * ArtikelRecordId
  * Paragraph13b
  * NettoWert
  * BruttoWert
  * Debitorenkonto
  * Kreditorenkonto
  * Sachkonto
  * SteuerID
  * Buchungsschluessel
  * Buchungstext
  * Rechnungsdatum
  * Rechnungsnummer
  * Leistungsdatum
  * AttachementId
  * BuchungszaehlerTabelle (nvarchar that defines the tabel, where the booking counter is stored)
  * BuchungszaehlerSpalte (nvarchar that devines the column for the booking counter)
  * IstAutomatikKonto
  * IstInnerbetrieblich
* sqlMainData script
  * Kundennummer
  * Konto
  * Firmenname
  * Nachname
  * Vorname
  * Anrede
  * Adresstyp
  * Strasse
  * Hausnummer
  * PLZ
  * Stadt
  * Zusatzinformation
* sqlGetCounter script
  * This script needs to return the actual booking counter as number.

### SQL script examples

* sqlDataRead Example
* sqlMainData Example
* sqlGetCounter Example

### Example Usages

```javascript
 brixxApi.businessBrixx({
    functionName:"DatevExport",
    sqlDataRead:"getDatevData",
    sqlMainData:"getDatevMainData",
    sqlGetCounter:"getDatevBookingCounter",
    exportFromDate: moment().subtract(2,'months').startOf('month').format('YYYY-MM-DD'),
    exportUntilDate: moment().subtract(2,'months').endOf('month').format('YYYY-MM-DD'),
    consultantNumber: 1234567,
    clientNumber: 12345,
    company: 1,
    isDownload: true
 });
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://brixxbox.gitbook.io/brixxbox-documentation/client-api-reference/functions/businessbrixx/datev-export.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
