API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

How to create a supplier invoice without product

0

Hi. I need to create a supplier invoice with the most basic information: creditor, invoice number, invoice date, description and total. ?

I can't see how to specify the invoice date and the description. Also it seems that a product must be specified.

This is (part of) my code so far:

            CreditorHandle creditorHandle = session.creditorFindByNumber(creditor);
            if (creditorHandle == null) {
                error("No such creditor:" + creditor);
            }
            CurrentSupplierInvoiceData supplierInvoice = new CurrentSupplierInvoiceData();
            supplierInvoice.setCreditorHandle(creditorHandle);
            CurrentSupplierInvoiceHandle currentSupplierInvoiceHandle = session.currentSupplierInvoiceCreateFromData(supplierInvoice);
 
            ProductHandle productHandle = session.productFindByNumber("115");
 
            CurrentSupplierInvoiceLineData invoiceLine = new CurrentSupplierInvoiceLineData();
            invoiceLine.setInvoiceHandle(currentSupplierInvoiceHandle);
            invoiceLine.setInvoiceId(123);
            invoiceLine.setNumber(1);
            invoiceLine.setQuantity(new BigDecimal("1.0"));
            invoiceLine.setUnitPrice(new BigDecimal("12.25"));
            invoiceLine.setProductHandle(productHandle);
            session.currentSupplierInvoiceLineCreateFromData(invoiceLine);

 

created Nov 6, 2013 by MichaelT
40% Accept Rate

edited Nov 13, 2013 by MichaelT
Q 5 A 0 C 1

1 Answer

0
Hi MichaelT,

Yes, you do need to add an invoice line with a product in order to be able to create a supplier invoice.

Also note, that this product must belong to a product group with "Inventory withdrawal" enabled. FYI: missing this part of it will result in a "Product is not valid for inventory" error.

Hope this helps,

Morten Schmidt, API Support
answered Nov 11, 2013 by Morten Schmidt
Hi. I don't see where to enable "Inventory withdrawal". In the edit Product Group dialog, I can change: No., Name, Account/Invoices liable to VAT and Account/Invoices not liable to VAT.

Also, can you set the invoice date for a supplier invoice?
Hi MichaelT,

You should see an "Inventory" tab page in the "Edit Product Group" dialog.
If you don't, it means that you haven't enabled Inventory (or "Stock" as it is sometimes referred to).

Please note that Inventory is a premium feature, that you have to pay extra for.

Br Morten Schmidt, API Support
Visma e-conomic A/S
...