My Products
Help
danielboylan
CONTRIBUTOR *

When to get invoice from VBNXT

by danielboylan

Hi,

When retrieving an invoice through API, what parameters should we check to ensure to invoice is ready for sending through EDI? 

Also, is there an easy way to check if a customer has EDI invoice activated in "Grunndata Kunder - Sendemåte for dokumenter"? 

1 REPLY 1

by Øyvind Årseth

Hi @danielboylan 
Assuming the ordre is not yet invoiced, you could check if the order is in a status ready for invoicing, is that matches your scenario(?)
Here's an example showing orders in status "Ready for invoice", omittting orders marked for batch invoicing.
Apart from that, it depends on what you mean by "ready for sending through EDI":

query OrdersReadyForInvoice ($cid: Int) {
    useCompany(no: $cid){
        order (filter: {
            orderStatus1: {_is_on: 1},
            orderPreferences: {_is_off: 4}}) {
            totalCount
            items {
              orderNo
              customerNo
              sumBeforeGroupDiscountDomestic
            }
        }
    }
}

I suppose you would have to query customers for a value in Document delivery method 1, something like this: 

query OrdersReadyForInvoice ($cid: Int) {
    useCompany(no: $cid){
       associate(filter: {
            customerNo: {_gt: 0},
            documentDeliveryMethod1: {_is_on: 8}}) {
            totalCount
            items {
              customerNo
              name
              documentDeliveryMethod1
            }
        }
    }
}

where "8" is the bitvalue representing EDI, if that's what you are looking for specifically.