PdcPurchaseInvoices.CreateIncomingGoodsProcessor
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).