SDeliv::DeleteDetail (Interface: SDeliv)
 
Deletes a detail from the sales delivery.
 
void DeleteDetail (
    SHORT sIndex
)
 
Parameters
sIndex
[in] The index of the detail, starting from 0.
 
Remarks
If the parameter sIndex is an invalid index (refers to a not existing detail) an exception is thrown. You can use GetDetail to check whether an index is valid, in which case it returns true.
 
See Also
CreateSDeliv
Handling invoicing documents using the SDK
PrepareDocument
GetNumDetails
GetDetail
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Delete the detail with remark = 'Remove this line!' of the current document
VARIANT vRemark;
short sNumDets;
bool bNext = true, bWrite = false;

pSDeliv->PrepareDocument (paUpdate);

sNumDets = pSDeliv->GetNumDetails ();

for (short sDetail = 0; bNext && sDetail < sNumDets; sDetail++)
{
    if (pSDeliv->GetDetail (sDetail, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &vRemark, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) && CString (vRemark.bstrVal) == "Remove this line!")
    {
        pSDeliv->DeleteDetail (sDetail);
        bWrite = true;
        bNext = false;
    }
}

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

C#
 
// Delete the detail with remark = 'Remove this line!' of the current document
object oRemark, oDummy;
short sNumDets;
bool bNext = true, bWrite = false;

oSDeliv.PrepareDocument (ePrepareAction.paUpdate);

sNumDets = oSDeliv.GetNumDetails ();

for (short sDetail = 0; bNext && sDetail < sNumDets; sDetail++)
{
    if (oSDeliv.GetDetail (sDetail, 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 oRemark, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy) && oRemark.ToString () == "Remove this line!")
    {
        oSDeliv.DeleteDetail (sDetail);
        bWrite = true;
        bNext = false;
    }
}

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

VBS
 
' Delete the detail with remark = 'Remove this line!' of the current document
Dim oRemark, oDummy
Dim sDetail, sNumDets
Dim bWrite

bWrite = False

Call oSDeliv.PrepareDocument(paUpdate)

sNumDets = oSDeliv.GetNumDetails()

For sDetail = 0 To sNumDets - 1
    If oSDeliv.GetDetail(sDetail, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oRemark, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy) And oRemark = "Remove this line!" Then
        Call oSDeliv.DeleteDetail(sDetail)
        bWrite = True
        Exit For
    End If
Next

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

VB.NET
 
' Delete the detail with remark = 'Remove this line!' of the current document
Dim oRemark, oDummy As Object
Dim sNumDets As Short
Dim bWrite As Boolean

bWrite = False

oSDeliv.PrepareDocument(ePrepareAction.paUpdate)

sNumDets = oSDeliv.GetNumDetails()

For sDetail As Short = 0 To sNumDets - 1
    If oSDeliv.GetDetail(sDetail, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oRemark, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy) And oRemark = "Remove this line!" Then
        oSDeliv.DeleteDetail(sDetail)
        bWrite = True
        Exit For
    End If
Next

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