Venice
SInvce::DeleteStkDetail
 
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
CreateSInvce
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;

pSInvce->PrepareDocument (paUpdate);

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

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

oSInvce.PrepareDocument (ePrepareAction.paUpdate);

sNumStkDets = oSInvce.GetNumStkDetails (0);

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

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

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

Call oSInvce.PrepareDocument(paUpdate)

bWrite = False

sNumStkDets = oSInvce.GetNumStkDetails(0)

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

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

oSInvce.PrepareDocument(ePrepareAction.paUpdate)

bWrite = True

sNumStkDets = oSInvce.GetNumStkDetails(0)

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

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