SDeliv::DeleteStkDetail (Interface: SDeliv)
 
Deletes a distribution of a detail.
 
void DeleteStkDetail (
    SHORT sDetIndex,
    SHORT sStkIndex
)
 
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.
 
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
GetNumStkDetails
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Remove all the distributions of the first detail of the current document
short sNumStkDets;
bool bWrite = false;

pSDeliv->PrepareDocument (paUpdate);

sNumStkDets = pSDeliv->GetNumStkDetails (0);
    
if (sNumStkDets != 0)
{
    for (short sStkDet = sNumStkDets - 1; sStkDet >= 0; sStkDet--)
    {
        pSDeliv->DeleteStkDetail (0, sStkDet);
    }
    
    bWrite = true;
}
    
if (bWrite)
    pSDeliv->WriteDocument (rmFullReport, VARIANT_FALSE, VARIANT_FALSE);
else    
    pSDeliv->CancelDocument ();

C#
 
// Remove all the distributions of the first detail of the current document
short sNumStkDets;
bool bWrite = false;

oSDeliv.PrepareDocument (ePrepareAction.paUpdate);

sNumStkDets = oSDeliv.GetNumStkDetails (0);

if (sNumStkDets != 0)
{
    for (short sStkDet = (short)(sNumStkDets - 1); sStkDet >= 0; sStkDet--)
    {
        oSDeliv.DeleteStkDetail (0, sStkDet);
    }
    
    bWrite = true;
}

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

VBS
 
' Remove all the distributions of the first detail of the current document
Dim sNumStkDets, sStkDet
Dim bWrite

Call oSDeliv.PrepareDocument(paUpdate)

bWrite = False

sNumStkDets = oSDeliv.GetNumStkDetails(0)

If sNumStkDets <> 0 Then
    For sStkDet = sNumStkDets - 1 To 0 Step -1
        Call oSDeliv.DeleteStkDetail(0, sStkDet)
    Next
    
    bWrite = True
End If

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

VB.NET
 
' Remove all the distributions of the first detail of the current document
Dim sNumStkDets As Short
Dim bWrite As Boolean

oSDeliv.PrepareDocument(ePrepareAction.paUpdate)

bWrite = True

sNumStkDets = oSDeliv.GetNumStkDetails(0)

If sNumStkDets <> 0 Then
    For sStkDet As Short = sNumStkDets - 1 To 0 Step -1
        oSDeliv.DeleteStkDetail(0, sStkDet)
    Next
End If

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