PdcPuchaseInvoiceLineList.AddExtraLine: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Declaration ==
== Declaration ==
AddExtraLine(intExCostID as integer, strExCostDescr, strLinkToPos as String) as [[PdcPurchaseInvoiceLine]].
AddExtraLine(intExCostID as integer, strExCostDescr, intLinkToPos as Integer) as [[PdcPurchaseInvoiceLine]].
Enter the ID of the extra costs line in the FCKOST table, or its description.  
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.
In case the line needs to be linked to another line in the same invoice, enter the ID.
Line 13: Line 13:


<source lang="vb">
<source lang="vb">
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)
</source>
</source>


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

Latest revision as of 14:29, 16 January 2017

Declaration

AddExtraLine(intExCostID as integer, strExCostDescr, intLinkToPos as Integer) 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)