Skip to content

Commit

Permalink
Added net/gross to function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Kwiedor committed Nov 23, 2020
1 parent a8606b0 commit 2b078cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ For this I have worked it all out as follows. The funny thing is that the ID doe

**1 = Stk, 2 = m², 3 = m, 4 = kg, 5 = t, 6 = lfm, 7 = pauschal, 8 = m³, 9 = Std, 10 = km, 11 = %, 12 = Tag(e), 13 = l**

In sevDesk the price is transferred in gross, therefore we have added a calculation of the gross value to the function. So you set the net value + the VAT in the function.

```go
Position, err := NewPosition(Position{"45", "1", "16", "Backups", "9", "invoiceID", "token"})
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions position.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"encoding/json"
"net/http"
"net/url"
"strconv"
"strings"
)

type Position struct {
Price string
PriceNet int
Quantity string
TaxRate string
TaxRate int
Name string
UnityID string
InvoiceID string
Expand Down Expand Up @@ -136,9 +137,9 @@ func NewPosition(config Position) (PositionReturn, error) {

// Define body data
body := url.Values{}
body.Set("price", config.Price)
body.Set("price", strconv.Itoa(config.PriceNet+(config.PriceNet*config.TaxRate/100)))
body.Set("quantity", config.Quantity)
body.Set("taxRate", config.TaxRate)
body.Set("taxRate", strconv.Itoa(config.TaxRate))
body.Set("name", config.Name)
body.Set("unity[id]", config.UnityID)
body.Set("unity[objectName]", "Unity")
Expand Down

0 comments on commit 2b078cc

Please sign in to comment.