PdcPurchaseInvoices.CreateIncomingGoodsProcessor: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Created page with "dim oIcProc set oIcProc = pdc.logistics.incominggoods.CreateIncomingGoodsProcessor(583) oIcProc.DeliveryDate = Date oIcProc.QuantityDelivered = 364 oIcProc.ToLocation..."
 
No edit summary
Line 1: Line 1:
== Declaration ==
CreateIncomingGoodsProcessor(CalculationNo as String) as [[PdcCalculation]]
== Description ==
Opens and returns an existing Calculation object
== 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.
CalculationNo = Number of the calculation that should be opened
== Code example ==
This example creates an incominggood line for id 583.<br>
VBScript<br>
<source lang="vb">
dim oIcProc
dim oIcProc


Line 6: Line 21:
   oIcProc.ToLocation = "C13"
   oIcProc.ToLocation = "C13"


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


   If Not oIcProc.Process() Then
   If Not oIcProc.Process() Then
Line 12: Line 27:
   End If
   End If
   set oIcProc = nothing
   set oIcProc = nothing
</source>
<br>
This example creates an incominggood line for all positions of purchaseorder 583.<br>
VB.NET<br>
<source lang="vb">
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
</source>
== Availability ==
Available since April 2014 (version 4.3 onwards).

Revision as of 13:06, 12 October 2020

Declaration

CreateIncomingGoodsProcessor(CalculationNo as String) as PdcCalculation

Description

Opens and returns an existing Calculation object

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.

CalculationNo = Number of the calculation that should be opened

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 April 2014 (version 4.3 onwards).