PdcPuchaseInvoiceLineList.AddExtraLine: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:


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


  set objPI = pdc.Logistics.PurchaseInvoices.Active
   if IsValid(objPI) then
   if IsValid(objPI) then
     set objPIList = objPI.PurchaseInvoiceLineList
     set objPIList = objPI.PurchaseInvoiceLineList
Line 25: Line 27:
         set objPIL = objPIList.AddExtraLine(edt_Extra.Hint, "" , objPILLink.ID)
         set objPIL = objPIList.AddExtraLine(edt_Extra.Hint, "" , objPILLink.ID)
         if IsValid(objPIL) then
         if IsValid(objPIL) then
        mmo_Log.Lines.Add "Regel " & objPIL.Pos & " toegevoegd (" & objPIL.ID & ")" & " CostKind = " & objPIL.CostKind
          mmo_Log.Lines.Add "Line" & objPIL.Pos & " added(" & objPIL.ID & ")" & " CostKind = " & objPIL.CostKind
         else
         else
           mmo_Log.Lines.Add pdc.LastError
           mmo_Log.Lines.Add pdc.LastError
Line 32: Line 34:
     end if 'IsValid(objPIList)
     end if 'IsValid(objPIList)
   else
   else
     msgbox "Kies of maak eerst een inkoopfactuur."
     msgbox "No purchase invoice found."
   end if 'IsValid(objPI)
   end if 'IsValid(objPI)
</source>
</source>

Revision as of 11:06, 19 August 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 objPI
dim objPIList
dim objPIL
dim objPILLink

  set objPI = pdc.Logistics.PurchaseInvoices.Active
  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 "Line" & objPIL.Pos & " added(" & 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 "No purchase invoice found."
  end if 'IsValid(objPI)

Availability

Available since July 2015 (Version 5.1 onwards)