SDeliv::InsertStkDetail (Interface: SDeliv)
 
Inserts a new distribution for a detail.
 
void InsertStkDetail (
    SHORT sDetIndex,
    SHORT sStkIndex,
    DOUBLE dQuantity,
    BSTR bsLocation,
    BSTR bsSerialNumber
)
 
Parameters
sDetIndex
[in] The index of the detail where the distribution belongs to, starting from 0.
sStkIndex
[in] The index of the distribution, starting from 0.
dQuantity
[in] The quantity that is distributed (in stock units).
bsLocation
[in] The location of the article.
bsSerialNumber
[in] The serial number of the article.
 
Remarks
The parameter sStkIndex can have the value -1 (sDetIndex must be a valid index!). In this case the new distribution is inserted after the existing ones.
If sStkIndex refers to an existing index, the new distribution is inserted at this index and all following distributions are moved to the next index.
 
See Also
CreateSDeliv
Handling invoicing documents using the SDK
PrepareDocument
NeedStkDistrib
GetDetail
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Insert a new distribution (after the other distributions) for the first detail of the current document
bool bWrite = false;

pSDeliv->PrepareDocument (paUpdate);

if (pSDeliv->NeedStkDistrib (0))
{
    VARIANT vQuantity;

    if (pSDeliv->GetDetail (0, &vQuantity, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
    {
        pSDeliv->InsertStkDetail (0, -1, vQuantity.dblVal, "Location A", "");
        bWrite = true;
    }
}

if (bWrite)
    pSDeliv->WriteDocument (rmFullReport, VARIANT_FALSE, VARIANT_FALSE);
else
    pSDeliv->CancelDocument ();

C#
 
// Insert a new distribution (after the other distributions) for the first detail of the current document
bool bWrite = false;

oSDeliv.PrepareDocument (ePrepareAction.paUpdate);

if (oSDeliv.NeedStkDistrib (0))
{
    object oQuantity, oDummy;

    if (oSDeliv.GetDetail (0, out oQuantity, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy))
    {
        oSDeliv.InsertStkDetail (0, -1, ((double)oQuantity), "Location A", "");
        bWrite = true;        
    }
}

if (bWrite)
    oSDeliv.WriteDocument (eReportMode.rmFullReport, false, false);
else
    oSDeliv.CancelDocument ();

VBS
 
' Insert a new distribution (after the other distributions) for the first detail of the current document
Dim bWrite

Call oSDeliv.PrepareDocument(paUpdate)

bWrite = False

If oSDeliv.NeedStkDistrib(0) Then
    Dim oQuantity, oDummy

    If oSDeliv.GetDetail(0, oQuantity, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy) Then
        Call oSDeliv.InsertStkDetail(0, -1, oQuantity, "Location A", "")
        bWrite = True
    End If
End If

If bWrite Then
    Call oSDeliv.WriteDocument(rmFullReport, False, False)
Else
    Call oSDeliv.CancelDocument()
End If

VB.NET
 
' Insert a new distribution (after the other distributions) for the first detail of the current document
Dim bWrite As Boolean

oSDeliv.PrepareDocument(ePrepareAction.paUpdate)

bWrite = False

If oSDeliv.NeedStkDistrib(0) Then
    Dim oQuantity, oDummy As Object

    If oSDeliv.GetDetail(0, oQuantity, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy) Then
        oSDeliv.InsertStkDetail(0, -1, oQuantity, "Location A", "")
        bWrite = True
    End If
End If

If bWrite Then
    oSDeliv.WriteDocument(eReportMode.rmFullReport, False, False)
Else
    oSDeliv.CancelDocument()
End If