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

Order_RegisterAsSent

0

I can not make this line work(it is at the bottom in my script):

$orderAsSent = $client->Order_RegisterAsSent(array("Id" => $orderHandle))->Order_RegisterAsSentResult->orderHandle; // $orderhandle creates the order

 

I have created an order and set orderlines, everythings work, but can not register it as send.

$debtorHandle = $client->Debtor_FindByNumber(array('number' => $debtor_number))->Debtor_FindByNumberResult; //Finder debitoren
$orderHandle = $client->Order_Create(array('debtorHandle' => $debtorHandle))->Order_CreateResult;// opretter ordrebekræftelsen med debito
while ($kurv = $stmt_kurv->fetch()) {
$productName = $kurv['varenavn'];
$productNumber = $kurv['varenr'];
$productAmount = $kurv['antal'];
$productPrice = $kurv['pris'];
$debtor_number = $kurv['firma_id']; 
$productUnit = $kurv['unit'];
$productCost = $kurv['pris'];
 
   $order_createarray = array();
            $ec_createarray = array(
'Handle' => $orderHandle,
            'Number' => $productNumber,
            'Name'   => $productName,
'SalesPrice' => $productPrice,
            'CostPrice' => $productCost,
            'IsAccessible'   => true,
            'Volume' => 00
);
            if($i >$count_kurv) { break; }
   $superarray = $order_createarray;
     
$numberHandle = $client->Product_FindByNumber(array('number' => $productNumber))->Product_FindByNumberResult; //finder produktet via varenr.
   $unitHandle = $client->Unit_FindByNumber(array('number' => $productUnit))->Unit_FindByNumberResult; //finder enhed via varenr.
$result = $client->Product_CreateFromDataArray(array('id' => $productNumber, 'dataArray' => $superarray))->Product_CreateFromDataArrayResult; 
   
$orderLineHandle = $client->OrderLine_Create(array( 'orderHandle' => $orderHandle))->OrderLine_CreateResult;
$client->OrderLine_SetProduct(array(
                                            'orderLineHandle' => $orderLineHandle,
                                            'valueHandle' => $numberHandle
                                        ));
$client->OrderLine_SetDescription(array(
                                            'orderLineHandle' => $orderLineHandle,
                                            'value' => $productName
                                        ));
            $client->OrderLine_SetQuantity(array(
                                            'orderLineHandle' => $orderLineHandle,
                                            'value' => $productAmount
                                        ));
$client->OrderLine_SetUnit(array(
                                            'orderLineHandle' => $orderLineHandle,
                                            'valueHandle' => $unitHandle
                                        ));
 
            $client->OrderLine_SetUnitNetPrice(array(
                                        'orderLineHandle' => $orderLineHandle,
                                        'value' => $productPrice
                                    ));
$orderAsSent = $client->Order_RegisterAsSent(array("Id" => $orderHandle))->Order_RegisterAsSentResult->orderHandle; // $orderhandle creates the order
created Nov 1, 2015 by suulut
50% Accept Rate

edited Nov 1, 2015 by suulut
Q 8 A 5 C 2

1 Answer

0
Hi Suulut,

There is nothing in you example that I can see is wrong. Can you be a little more specific than just that it doesn't work.

How does it fail? Do you get an error code from the API. If you get an error code from the API I can probably help you. Paste the error code in here and I will see what I can find.
answered Nov 18, 2015 by rbb
Visma e-conomic A/S
...