Venice
SDeliv::UpdateStkDetail
 
Updates a distribution for a detail.
 
void UpdateStkDetail (
    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
If the parameter sIndex is an invalid index (refers to a not existing distribution) an exception is thrown. You can use GetStkDetail to check whether an index is valid, in which case it returns true.
 
See Also
CreateSDeliv
Handling invoicing documents using the SDK
PrepareDocument
GetNumDetails
GetNumStkDetails
GetStkDetail
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Update the location code of all distributions of all details of the current document from 'LOC_A' to 'LOC_B'
VARIANT vQuantity, vLocation, vSerialNumber;
short sNumDetails;
bool bWrite = false;

pSDeliv->PrepareDocument (paUpdate);

sNumDetails = pSDeliv->GetNumDetails ();

for (short sDetail = 0; sDetail < sNumDetails; sDetail++)
{
    short sNumStkDets = pSDeliv->GetNumStkDetails (sDetail);
    
    for (short sStkDet = 0; sStkDet < sNumStkDets; sStkDet++)
    {
        if (pSDeliv->GetStkDetail (sDetail, sStkDet, &vQuantity, &vLocation, &vSerialNumber) && CString (vLocation.bstrVal) == "LOC_A")
        {
            pSDeliv->UpdateStkDetail (sDetail, sStkDet, vQuantity.dblVal, "LOC_B", vSerialNumber.bstrVal);
            bWrite = true;
        }
    }
}

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

C#
 
// Update the location code of all distributions of all details of the current document from 'LOC_A' to 'LOC_B'
object oQuantity, oLocation, oSerialNumber;
short sNumDetails;
bool bWrite = false;

oSDeliv.PrepareDocument (ePrepareAction.paUpdate);

sNumDetails = oSDeliv.GetNumDetails ();

for (short sDetail = 0; sDetail < sNumDetails; sDetail++)
{
    short sNumStkDets = oSDeliv.GetNumStkDetails (sDetail);
    
    for (short sStkDet = 0; sStkDet < sNumStkDets; sStkDet++)
    {
        if (oSDeliv.GetStkDetail (sDetail, sStkDet, out oQuantity, out oLocation, out oSerialNumber) && oLocation.ToString () == "LOC_A")
        {
            oSDeliv.UpdateStkDetail (sDetail, sStkDet, (double)oQuantity, "LOC_B", oSerialNumber.ToString ());
            bWrite = true;
        }
    }
}

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

VBS
 
' Update the location code of all distributions of all details of the current document from 'LOC_A' to 'LOC_B'
Dim oQuantity, oLocation, oSerialNumber
Dim sNumDetails, sDetail
Dim bWrite

Call oSDeliv.PrepareDocument(paUpdate)

sNumDetails = oSDeliv.GetNumDetails()
bWrite = False

For sDetail = 0 To sNumDetails - 1
    Dim sNumStkDets, sStkDet
    
    sNumStkDets = oSDeliv.GetNumStkDetails(sDetail)
    
    For sStkDet = 0 To sNumStkDets - 1
        If oSDeliv.GetStkDetail(sDetail, sStkDet, oQuantity, oLocation, oSerialNumber) And oLocation = "LOC_A" Then
            Call oSDeliv.UpdateStkDetail(sDetail, sStkDet, oQuantity, "LOC_B", oSerialNumber)
            bWrite = True
        End If
    Next
Next

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

VB.NET
 
' Update the location code of all distributions of all details of the current document from 'LOC_A' to 'LOC_B'
Dim oQuantity, oLocation, oSerialNumber As Object
Dim sNumDetails As Short
Dim bWrite As Boolean

oSDeliv.PrepareDocument(ePrepareAction.paUpdate)

sNumDetails = oSDeliv.GetNumDetails()
bWrite = False

For sDetail As Short = 0 To sNumDetails - 1
    Dim sNumStkDets As Short
    
    sNumStkDets = oSDeliv.GetNumStkDetails(sDetail)
    
    For sStkDet As Short = 0 To sNumStkDets - 1
        If oSDeliv.GetStkDetail(sDetail, sStkDet, oQuantity, oLocation, oSerialNumber) And oLocation = "LOC_A" Then
            oSDeliv.UpdateStkDetail(sDetail, sStkDet, oQuantity, "LOC_B", oSerialNumber)
            bWrite = True
        End If
    Next
Next

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