My Products
Help
Anonymous
Not applicable

rotRut information on invoiceLines get different result depending on the order, CustomerInvoice

by Anonymous (Updated ‎17-12-2020 12:50 by Yıldırım VISMA )

Hello!

 

We have a customer that uses the rut/rot functionality through the API on the CustomerInvoice endpoint. When we have a 0-line in the beginning we get the wrong amount summed up on the total sum of the rot/rut tab. But when we change order of the lines and don't have a 0-line in the beginning we get the right total sum on the rot/rut tab. 

 

When trying to replicate this problem in the UI by doing it manually it doesn't occur so I am pretty sure it's something in the API that causes this. 

 

When using this JSON: 

{

"domesticServicesDeductibleDocument": {
"value": true
},
"rotRutDetails": {
"distributedAutomaticaly": {
"value": false
},
"type": {
"value": "Rot"
},

"estate": {
"value": "fridas"
},
"distribution": [
{
"operation": "Insert",
"lineNbr": {
"value": 0
},
"personalId": {
"value": "199001010101"
},
"amount": {
"value": 270
},
"extra": {
"value": true
}
}
]
},

"invoiceLines": [
{

"domesticServicesDeductible": {
"value": false
},
"itemType": {
"value": "OtherCost"
},
"typeOfWork": {
"value": "Construction"
},

"operation": "Insert",

"lineNumber": {
"value": 0
},
"description": {
"value": "VÃ¥rt ordernummer: 29488"
},
"quantity": {
"value": 0
},
"unitPriceInCurrency": {
"value": 0
},

"uom": {
"value": "ST"
}

},

{

"domesticServicesDeductible": {
"value": true
},
"itemType": {
"value": "Service"
},
"typeOfWork": {
"value": "Construction"
},

"operation": "Insert",

"lineNumber": {
"value": 1
},
"description": {
"value": "2020-11-27 Ordinarie arbetstid"
},
"quantity": {
"value": 1
},
"unitPriceInCurrency": {
"value": 720
},

"uom": {
"value": "ST"
}

},

{

"domesticServicesDeductible": {
"value": false
},
"itemType": {
"value": "MaterialCost"
},
"typeOfWork": {
"value": "Construction"
},

"operation": "Insert",

"lineNumber": {
"value": 2
},
"description": {
"value": "Stadsresa"
},
"quantity": {
"value": 1
},
"unitPriceInCurrency": {
"value": 300
},

"uom": {
"value": "ST"
}

},
{

"domesticServicesDeductible": {
"value": false
},
"itemType": {
"value": "MaterialCost"
},
"typeOfWork": {
"value": "Construction"
},

"operation": "Insert",

"lineNumber": {
"value": 3
},
"description": {
"value": "Motor för 3-vägsventil"
},
"quantity": {
"value": 1
},
"unitPriceInCurrency": {
"value": 734
},

"uom": {
"value": "ST"
}

},


],
"sendToAutoInvoice": {
"value": true
},

"customerNumber": {
"value": "10001"
},

"hold": {
"value": false
},

"invoiceText": {
"value": "API test"
}
}

 

I get a total of 2 585,00 SEK as a sum on "MaterialCost" in the UI (Rot/Rut tab) but when I use the JSON bellow I get 1 292,50 SEK as a total sum on "MaterialCost" (Rot/Rut tab) and this sum is the correct amount, that's when I use this:

 

{

"domesticServicesDeductibleDocument": {
"value": true
},
"rotRutDetails": {
"distributedAutomaticaly": {
"value": false
},
"type": {
"value": "Rot"
},

"estate": {
"value": "fridas"
},
"distribution": [
{
"operation": "Insert",
"lineNbr": {
"value": 0
},
"personalId": {
"value": "199001010101"
},
"amount": {
"value": 270
},
"extra": {
"value": true
}
}
]
},

"invoiceLines": [
{

"domesticServicesDeductible": {
"value": false
},
"itemType": {
"value": "MaterialCost"
},
"typeOfWork": {
"value": "Construction"
},

"operation": "Insert",

"lineNumber": {
"value": 0
},
"description": {
"value": "Motor för 3-vägsventil"
},
"quantity": {
"value": 1
},
"unitPriceInCurrency": {
"value": 734
},

"uom": {
"value": "ST"
}

},

{

"domesticServicesDeductible": {
"value": true
},
"itemType": {
"value": "Service"
},
"typeOfWork": {
"value": "Construction"
},

"operation": "Insert",

"lineNumber": {
"value": 1
},
"description": {
"value": "2020-11-27 Ordinarie arbetstid"
},
"quantity": {
"value": 1
},
"unitPriceInCurrency": {
"value": 720
},

"uom": {
"value": "ST"
}

},

{

"domesticServicesDeductible": {
"value": false
},
"itemType": {
"value": "MaterialCost"
},
"typeOfWork": {
"value": "Construction"
},

"operation": "Insert",

"lineNumber": {
"value": 2
},
"description": {
"value": "Stadsresa"
},
"quantity": {
"value": 1
},
"unitPriceInCurrency": {
"value": 300
},

"uom": {
"value": "ST"
}

},


{

"domesticServicesDeductible": {
"value": false
},
"itemType": {
"value": "OtherCost"
},
"typeOfWork": {
"value": "Construction"
},

"operation": "Insert",

"lineNumber": {
"value": 3
},
"description": {
"value": "VÃ¥rt ordernummer: 29488"
},
"quantity": {
"value": 0
},
"unitPriceInCurrency": {
"value": 0
},

"uom": {
"value": "ST"
}

},

],
"sendToAutoInvoice": {
"value": true
},

"customerNumber": {
"value": "10001"
},

"hold": {
"value": false
},

"invoiceText": {
"value": "API test"
}

}

 

The only difference is that I have changed place on lineNbr 0 and 3 but the lines still contain the same information. 

 

The customer has to use a first 0 row to state the orderNbr from another system and it needs to be done on the invoiceLine level. 

 

Why do we get different results depending on how we send the rows? As I wrote higher up we don't get the same result when creating the invoice manually in the UI and is there some way to prevent this from happening? 

 

/Frida 

 

8 REPLIES 8

by Magnus Johnsen

Hi!

It seems like the lies with using V1 for the customerInvoice endpoint. Please update your call to use the V2 endpoint and let us know if this solves your issue:

/controller/api/v2/customerinvoice

by Magnus Johnsen

@KonsultVn @Anonymous 
This gets fixed by the changes made to the CustomerInvoice endpoint regarding ROT/RUT planned to be released today:
Visma.net Financials API updates for version 8.32.0 (January 2021)

Anonymous
Not applicable

by Anonymous

Hi again! 

 

We still experience this problem even after the release 12/1 and I looked at the document you linked to and it only mentions that Rot/Rut is now available on the Sales Order endpoint, was there any update on the Customer Invoice endpoint in that release? 

 

/Frida 

by Magnus Johnsen

We'll check in with the development team again and get back to you. 

KonsultVn
CHAMPION ***

by KonsultVn

Hi again!

Have you had any chance to look into this? 

Have a nice day!

/Frida 

by Magnus Johnsen

The issue is still with the team, we have asked for an ETA and will let you know as soon as we get a reply.

by Magnus Johnsen

The team are still investigating this issue, we'll provide more information as soon as the team has found the cause for the issue and can move towards a solution. 

by Magnus Johnsen

Hi,

We're looking in to this.

We'll do some more testing and report it to the development team.