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 remove water draft from invoice?

0
Hi,

I have a problem when create a invoice. The water draft always in it. How could i remove it. My code below:


  $cino = array(Number = $number);

  $objInvoice = $client-CurrentInvoice_Create(array('debtorHandle'=$cino));

  $objLineHandle =$client-CurrentInvoiceLine_Create(array('invoiceHandle'=array('Id'=$objInvoice-Id)));
  $intLineID = $objLineHandle-CurrentInvoiceLine_CreateResult-Id;
  $intLineNr = $objLineHandle-CurrentInvoiceLine_CreateResult-Number;

  if($type == 2){
    $myProno = array('Number' = 1);
  }elseif($type == 3){
    $myProno = array('Number' = 2);
  }
  $myProduct = $client-Product_GetData(array('entityHandle' = $myProno))-Product_GetDataResult;
  $ProductGroupHandle = $myProduct-ProductGroupHandle;

  $client-CurrentInvoiceLine_SetProduct(array(
  'currentInvoiceLineHandle'=array('Id'=$intLineID,'Number'=$intLineNr),
  'valueHandle'=array('Number'= $ProductGroupHandle-Number) //static in this case
  ));

  $client-CurrentInvoiceLine_SetDescription(array(
  'currentInvoiceLineHandle'=array('Id'=$intLineID,'Number'=$intLineNr),
  'value'= $myProduct-Name
  ));

  $client-CurrentInvoiceLine_SetUnitNetPrice(array(
  'currentInvoiceLineHandle'=array('Id'=$intLineID,'Number'=$intLineNr),
  'value'= $myProduct-SalesPrice //price of unit, netto
  ));
  $client-CurrentInvoiceLine_SetQuantity(array(
  'currentInvoiceLineHandle'=array('Id'=$intLineID,'Number'=$intLineNr),
  'value'= (float) 1 //product quantity
  ));

  $client-CurrentInvoiceLine_SetDescription(array('currentInvoiceLineHandle' = $newCurrentInvoiceLineHandle, 'value'= $myProduct-Name));
  $client-CurrentInvoiceLine_SetProduct(array('currentInvoiceLineHandle' = $newCurrentInvoiceLineHandle, 'valueHandle'= $ProductGroupHandle-Number));
  $client-CurrentInvoiceLine_SetUnitNetPrice(array('currentInvoiceLineHandle' = $newCurrentInvoiceLineHandle, 'value'= $myProduct-SalesPrice));
  $client-CurrentInvoiceLine_SetQuantity(array('currentInvoiceLineHandle' = $newCurrentInvoiceLineHandle, 'value' = 1));

  $result = $client-CurrentInvoice_Book(array('currentInvoiceHandle' = $objLineHandle))-CurrentInvoice_BookResult;
  $invoiceData = $client-Invoice_GetPdf(array('invoiceHandle'=$result))-Invoice_GetPdfResult;



Anyone kindly help me with that.

Thanks.
created Aug 10, 2012 by ciman
0% Accept Rate
Q 2 A 0 C 0

1 Answer

0
Hi,

The draft is automatically removed from a draft once it is booked.

Until then it is not possible to remove it.
answered Sep 3, 2012 by nkn
Visma e-conomic A/S
...