SOrder::DeleteStkDetail (Interface: SOrder)
 
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
CreateSOrder
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;

pSOrder->PrepareDocument (paUpdate);

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

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

oSOrder.PrepareDocument (ePrepareAction.paUpdate);

sNumStkDets = oSOrder.GetNumStkDetails (0);

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

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

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

Call oSOrder.PrepareDocument(paUpdate)

bWrite = False

sNumStkDets = oSOrder.GetNumStkDetails(0)

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

If bWrite Then
    Call oSOrder.WriteDocument(rmFullReport, False, False)
Else
    Call oSOrder.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

oSOrder.PrepareDocument(ePrepareAction.paUpdate)

bWrite = True

sNumStkDets = oSOrder.GetNumStkDetails(0)

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

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