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

Create invoiceline on currentinvoice from PHP

0
Hi,

I am trying to create an invoiceline on a currentinvoice from PHP. The currentinvoice was also created via PHP. I get the following error:

Caught exception: Economic.Api.Exceptions.ServerException(E00000): An internal error has occurred. (id=76dfbe0a-7574-45c4-b33a-b7104f63e9fd) SoapFault Object ( [message:protected] => Economic.Api.Exceptions.ServerException(E00000): An internal error has occurred. (id=76dfbe0a-7574-45c4-b33a-b7104f63e9fd) [string:Exception:private] => [code:protected] => 0 [file:protected] => /customers/c/8/f/cenvation.com/httpd.www/php/EconomicClass.php [line:protected] => 61 [trace:Exception:private] => Array ( [0] => Array ( [file] => /customers/c/8/f/cenvation.com/httpd.www/php/EconomicClass.php [line] => 61 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => CurrentInvoiceLine_CreateFromData [1] => Array ( [0] => Array ( [Number] => 1 [Handle] => Array ( [Id] => 1 [Number] => 1 ) [UnitHandle] => Array ( [Number] => 1 ) [Description] => Min linje [InvoiceHandle] => stdClass Object ( [Id] => 45 ) [DeliveryDate] => 2009-07-23T21:48:00.011111 [ProductHandle] => stdClass Object ( [Number] => 101 ) [Quantity] => 2 [UnitCostPrice] => 1 [UnitNetPrice] => 2.5 [DiscountAsPercent] => 50 [TotalNetAmount] => 2.5 [TotalMargin] => 1.5 [MarginAsPercent] => 40 ) ) ) ) [1] => Array ( [file] => /customers/c/8/f/cenvation.com/httpd.www/php/EconomicClass.php [line] => 61 [function] => CurrentInvoiceLine_CreateFromData [class] => SoapClient [type] => -> [args] => Array ( [0] => Array ( [Number] => 1 [Handle] => Array ( [Id] => 1 [Number] => 1 ) [UnitHandle] => Array ( [Number] => 1 ) [Description] => Min linje [InvoiceHandle] => stdClass Object ( [Id] => 45 ) [DeliveryDate] => 2009-07-23T21:48:00.011111 [ProductHandle] => stdClass Object ( [Number] => 101 ) [Quantity] => 2 [UnitCostPrice] => 1 [UnitNetPrice] => 2.5 [DiscountAsPercent] => 50 [TotalNetAmount] => 2.5 [TotalMargin] => 1.5 [MarginAsPercent] => 40 ) ) ) [2] => Array ( [file] => /customers/c/8/f/cenvation.com/httpd.www/timereg/Test.php [line] => 9 [function] => Test [class] => EconomicClass [type] => -> [args] => Array ( ) ) ) [previous:Exception:private] => [faultstring] => Economic.Api.Exceptions.ServerException(E00000): An internal error has occurred. (id=76dfbe0a-7574-45c4-b33a-b7104f63e9fd) [faultcode] => soap:Server [detail] => )

 

This is the code:

public function Test()
    {
    try {
    

      $debtorHandle = $this->client->Debtor_FindByNumber(array('number' => '1234123434'))->Debtor_FindByNumberResult;
      $invoiceHandle = $this->client->CurrentInvoice_Create(array('debtorHandle' => $debtorHandle))->CurrentInvoice_CreateResult;
      $this->client->CurrentInvoiceLine_CreateFromData(array(
         'Number' => 1,
         'Handle' => array("Id" => 1, "Number" => 1),
         'UnitHandle' => array("Number" => 1),
         'Description' => "Min linje",
         'InvoiceHandle' => $invoiceHandle,
         'DeliveryDate' => '2009-07-23T21:48:00.011111',
         'ProductHandle' => $this->client->Product_FindByNumber(array('number' => "101"))->Product_FindByNumberResult,
         'Quantity' => 2,
         'UnitCostPrice' => 2.5,
         'UnitNetPrice' => 2.5,
         'DiscountAsPercent' => 50,
         'UnitCostPrice' => 1.0,
         'TotalNetAmount' => 2.5,
         'TotalMargin' => 1.5,
         'MarginAsPercent' => 40))->CurrentInvoiceLine_CreateFromDataResult;
     echo 'Oprettet ok';
     } catch (SoapFault $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
    print_r($e);
}
    }
created Jan 11, 2015 by brians
0% Accept Rate
Q 4 A 0 C 0

1 Answer

0
Hi Brian

 

Please contact API support if this is still an issue.
answered Feb 25, 2015 by olej
Visma e-conomic A/S
...