PdcPurchaseInvoices.CreateIncomingGoodsProcessor: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Declaration ==
== Declaration ==
CreateIncomingGoodsProcessor(CalculationNo as String) as [[PdcCalculation]]
CreateIncomingGoodsProcessor(aPurchaseOrderLineID as integer) as [[IIncomingGoodsProcessor]]


== Description ==
== Description ==
Opens and returns an existing Calculation object
Creates a new incominggoods object for the applied purchaseorderline ID.


== Notes ==
== Notes ==
The open calculation method returns an existing calculation object, without form. To show this calculation, you have to call the 'Show' method of the calculation object.
Creates a new incominggoods object for the applied purchaseorderline ID.
After fill and processing the object, the result returns true on succes.


CalculationNo = Number of the calculation that should be opened
aPurchaseOrderLineID =ID of the purchaseorderline


== Code example ==
== Code example ==
Line 81: Line 82:


== Availability ==
== Availability ==
Available since April 2014 (version 4.3 onwards).
Available since September 2017 (version 5.3 onwards).

Latest revision as of 13:16, 12 October 2020

Declaration

CreateIncomingGoodsProcessor(aPurchaseOrderLineID as integer) as IIncomingGoodsProcessor

Description

Creates a new incominggoods object for the applied purchaseorderline ID.

Notes

Creates a new incominggoods object for the applied purchaseorderline ID. After fill and processing the object, the result returns true on succes.

aPurchaseOrderLineID =ID of the purchaseorderline

Code example

This example creates an incominggood line for id 583.
VBScript

dim oIcProc

  set oIcProc = pdc.logistics.incominggoods.CreateIncomingGoodsProcessor(583)
  oIcProc.DeliveryDate = Date
  oIcProc.QuantityDelivered = 364
  oIcProc.ToLocation = "C13"

  'For a partial delivery without afterdelivery: oIncGd.ForceDeliveryComplete = True

  If Not oIcProc.Process() Then
    msgbox pdc.lasterror
  End If
  set oIcProc = nothing


This example creates an incominggood line for all positions of purchaseorder 583.
VB.NET

Dim AllOK As Boolean = True
Dim qoPO As PDCEXT.IDBQuery = PDC.App.Database.OpenQuery(PDCEXT.pdcConnectionKind.pdcConData)

qoPO.SQL = $"select bk_nr, bk_levnr, in_id, in_besh 
              from bk_bestel inner join 
                  totinkoop on upper(bk_nr) = upper(in_nr)
              where bk_id = :PurchaseOID"
qoPO.SetParamInt("PurchaseOID", 583)
If qoPO.Execute Then
  qoPO.FirstRecord()
  If Not qoPO.Eof Then
    If Not qoPO.GetBool("in_levcomp") Then
      Do While Not qoPO.Eof
        Dim oIncGd As PDCEXT.IIncomingGoodsProcessor = PDC.App.Logistics.IncomingGoods.CreateIncomingGoodsProcessor(qoPO.GetInt("in_id"))
        oIncGd.DeliveryDate = Date.Today
        oIncGd.QuantityDelivered = qoPO.GetBool("in_besh")
        'For a partial delivery without afterdelivery: oIncGd.ForceDeliveryComplete = True
        'when a location is mandatory: oIncGd.ToLocation = "17A"

        If Not oIncGd.Process() Then
          AllOK = False
          ErrSb.AppendLine($"Purchaseorder id {vPOID} (functionname): Error creating incominggoods for purchaseorderline {qoPO.GetInt("in_id")}.")
          ErrSb.AppendLine($"{PDC.App.LastError}.")
          Exit Do
        End If

        qoPO.NextRecord()
      Loop
    Else
      AllOK = False
      ErrSb.AppendLine($"Purchaseorder id {vPOID} (functionname): Purchaseorderline {qoPO.GetInt("in_id")} is already booked.")
    End If    
  Else
    AllOK = False
    ErrSb.AppendLine($"Purchaseorder id {vPOID} (functionname): This purchaseorder has no lines.")
  End If
Else
  AllOK = False
  ErrSb.AppendLine($"Error on loading purchaseorder data {vPOID} (functionname):")
  ErrSb.AppendLine($"Message: {PDCQueries.GetStr(PDC.App.LastError)}")
  ErrSb.AppendLine($"SQL: {qoPO.SQL}")
End If
releaseObject(qoPO)

Return AllOK


Availability

Available since September 2017 (version 5.3 onwards).