PdcPuchaseInvoiceLineList.AddExtraLine: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Line 13: Line 13:


<source lang="vb">
<source lang="vb">
dim objPIList
dim objPIL
dim objPILLink


  if IsValid(objPI) then
    set objPIList = objPI.PurchaseInvoiceLineList
    if IsValid(objPIList) then
      objPI.Save
      set objPILLink = objPIList.GetLineByPos("001")
      if IsValid(objPILLink) then
        set objPIL = objPIList.AddExtraLine(edt_Extra.Hint, "" , objPILLink.ID)
        if IsValid(objPIL) then
        mmo_Log.Lines.Add "Regel " & objPIL.Pos & " toegevoegd (" & objPIL.ID & ")" & " CostKind = " & objPIL.CostKind
        else
          mmo_Log.Lines.Add pdc.LastError
        end if 'IsValid(objPIL)
      end if 'IsValid(objPILLink)
    end if 'IsValid(objPIList)
  else
    msgbox "Kies of maak eerst een inkoopfactuur."
  end if 'IsValid(objPI)
</source>
</source>


== Availability ==
== Availability ==
Available since March 2015 (From version 5.0 onwards).
Available since March 2015 (From version 5.0 onwards).

Revision as of 12:30, 13 April 2015

Declaration

AddExtraLine(intExCostID as integer, strExCostDescr, strLinkToPos as String) as PdcPurchaseInvoiceLine. Enter the ID of the extra costs line in the FCKOST table, or its description. In case the line needs to be linked to another line in the same invoice, enter the ID.

Description

The method adds a purchase invoice line for extra costs, optionally linked to another invoice line.

Notes

When the line that the extra line is to be linked to, is also created in your script, save the invoice first to obtain the ID of the line.

Code example

dim objPIList
dim objPIL
dim objPILLink

  if IsValid(objPI) then
    set objPIList = objPI.PurchaseInvoiceLineList
    if IsValid(objPIList) then
      objPI.Save
      set objPILLink = objPIList.GetLineByPos("001")
      if IsValid(objPILLink) then
        set objPIL = objPIList.AddExtraLine(edt_Extra.Hint, "" , objPILLink.ID)
        if IsValid(objPIL) then
        mmo_Log.Lines.Add "Regel " & objPIL.Pos & " toegevoegd (" & objPIL.ID & ")" & " CostKind = " & objPIL.CostKind
        else
          mmo_Log.Lines.Add pdc.LastError
        end if 'IsValid(objPIL)
      end if 'IsValid(objPILLink)
    end if 'IsValid(objPIList)
  else
    msgbox "Kies of maak eerst een inkoopfactuur."
  end if 'IsValid(objPI)

Availability

Available since March 2015 (From version 5.0 onwards).