# 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
 });
```
