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

SOAP: CurrentInvoice_CreateFromDataArray: Contain no valid Invoice Lines

0

Hello,

I am trying to create and book invoice - I do it in two steps

1) On first step I create invoice with CurrentInvoice_CreateFromDataArray

2) On second step I do CurrentInvoice_Book with ID I am getting from CurrentInvoice_CreateFromDataArrayResult

But my invoice draft (created in first step) is not valid, probably because NetAmount is zero so I am getting this error on second step:

Cannot book the current invoice: One or more invoices contain no valid invoice lines.

But why NetAmount is zero in e-conomics (I am sending precise amount, which is not zero, but 2000.00 ) ?

                $createinvoice = $client->CurrentInvoice_CreateFromDataArray(
                    array('dataArray' =>
                        array(
               
                            'CurrentInvoiceData' => array (
                            'DebtorHandle'    => array('Number' => 555),
                            'DebtorName' => "Iris Martin",
                            'TermOfPaymentHandle'    => array('Id' => 1 ),
                            'Date' => date("c"),
                            'DueDate' => date('c', strtotime("+".$daysToAdd." days")),
                            'CurrencyHandle'    => array('Code' => 'DKK' ),
                            'ExchangeRate' => '1.00',
                            'IsVatIncluded' => false,
                            'DeliveryDate' => date("c"),
                            'NetAmount' => 2000.00,
                            'VatAmount' => 0.00,
                            'GrossAmount' => 2000.00,
                            'Margin' => 30.00,
                            'MarginAsPercent' => 5.00
                            )
                        )
                    )
                )->CurrentInvoice_CreateFromDataArrayResult;

 

So what is not okay with request? Why Net Amount is Zero here (see img below)? while I am sending NetAmount as 2000.00 ?

created Dec 18, 2015 by webmat
0% Accept Rate
Q 6 A 0 C 1

1 Answer

0
Hi Webmat

If you create an invoice in GUI you cannot book that either wihtout adding lines.

Amount on an invoice is the total based on the linedata.

Please create one or more invoice lines in order to progress.
answered Dec 18, 2015 by olej
Thank you, I am trying to create Line for invoice,

but this function

https://api.e-conomic.com/secure/api1/economicwebservice.asmx?op=CurrentInvoiceLine_CreateFromDataArray

Gives me an error: SOAP-ERROR: Encoding: object has no 'Number' property

But I added all fields which are required according to this documentation
(including Number, which  received from function CurrentInvoice_CreateFromDataArray)

https://api.e-conomic.com/secure/api1/economicwebservice.asmx?WSDL



MinOccurs means required, is that correct?

Maybe I am using wrong documentation? Do you think you could could
provide me link to correct version of documentation?

To This function

$bookinvoice = $client->CurrentInvoiceLine_CreateFromDataArray(
                            array('dataArray' =>
                                    array(
                                            'CurrentInvoiceLineData' => array (
                                            'Handle'    => array('Id' => $invoiceId),
                                            'Number' => $invoiceId,
                                            'DeliveryDate' => date("c"),
                                            'Quantity' => 1.00,
                                            'UnitNetPrice' => $project->goal,
                                            'DiscountAsPercent' => 0.00,
                                            'TotalNetAmount' => $project->goal,
                                            'TotalMargin' => 20.00, //  
                                            'MarginAsPercent' => $marginaspercent
                                        )
                                    )
                            )
                    );

Is Number id we received as a result of invoice creation function? (CurrentInvoice_CreateFromDataArray)

Please let me know,
Thanks,
Nat
Visma e-conomic A/S
...