Venice
Sales::DeleteItrDetail
 
Deletes an Intrastat detail from the document.
 
void DeleteItrDetail (
    SHORT sIndex
)
 
Parameters
sIndex
[in] The index of the Intrastat detail, starting from 0.
 
Remarks
If the parameter sIndex is an invalid index (refers to a not existing Intrastat detail) an exception is thrown. You can use GetItrDetail to check whether an index is valid, in which case it returns true.
 
See Also
CreateSales
Handling accounting documents using the SDK
PrepareDocument
GetNumItrDetails
GetItrDetail
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Remove the Intrastat details with unformatted commodity code = '85203219'
short sNumItrDets;
bool bWrite = false;

pSales->PrepareDocument (paUpdate);

sNumItrDets = pSales->GetNumItrDetails ();

if (sNumItrDets != 0)
{
    VARIANT vCommodityCode;
    
    for (short sItrDet = sNumItrDets - 1; sItrDet >= 0; sItrDet--)
    {
        if (pSales->GetItrDetail (sItrDet, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &vCommodityCode, NULL, NULL) && CString (vCommodityCode.bstrVal) == "85203219")
        {
            pSales->DeleteItrDetail (sItrDet);
            
            bWrite = true;
        }
    }
}

if (bWrite)
    pSales->WriteDocument (rmFullReport);
else
    pSales->CancelDocument ();

C#
 
// Remove the Intrastat details with unformatted commodity code = '85203219'
short sNumItrDets;
bool bWrite = false;

oSales.PrepareDocument (ePrepareAction.paUpdate);

sNumItrDets = oSales.GetNumItrDetails ();

if (sNumItrDets != 0)
{
    object oCommodityCode, oDummy;
    
    for (short sItrDet = (short)(sNumItrDets - 1); sItrDet >= 0; sItrDet--)
    {
        if (oSales.GetItrDetail (sItrDet, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oCommodityCode, out oDummy, out oDummy) && oCommodityCode.ToString () == "85203219")
        {
            oSales.DeleteItrDetail (sItrDet);
            
            bWrite = true;
        }
    }
}

if (bWrite)
    oSales.WriteDocument (eReportMode.rmFullReport);
else
    oSales.CancelDocument ();

VBS
 
' Remove the Intrastat details with unformatted commodity code = '85203219'
Dim sNumItrDets
Dim bWrite

Call oSales.PrepareDocument(paUpdate)

sNumItrDets = oSales.GetNumItrDetails()

If sNumItrDets <> 0 Then
    Dim oCommodityCode, oDummy
    Dim sItrDet

    For sItrDet = sNumItrDets - 1 To 0 Step -1
        If oSales.GetItrDetail(sItrDet, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oCommodityCode, oDummy, oDummy) And oCommodityCode = "85203219" Then
            Call oSales.DeleteItrDetail(sItrDet)
            
            bWrite = True
        End If
    Next
End If

If bWrite Then
    Call oSales.WriteDocument(rmFullReport)
Else
    Call oSales.CancelDocument()
End If

VB.NET
 
' Remove the Intrastat details with unformatted commodity code = '85203219'
Dim sNumItrDets As Short
Dim bWrite As Boolean

oSales.PrepareDocument(ePrepareAction.paUpdate)

sNumItrDets = oSales.GetNumItrDetails()

If sNumItrDets <> 0 Then
    Dim oCommodityCode, oDummy As Object

    For sItrDet As Short = sNumItrDets - 1 To 0 Step -1
        If oSales.GetItrDetail(sItrDet, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oCommodityCode, oDummy, oDummy) And oCommodityCode = "85203219" Then
            oSales.DeleteItrDetail(sItrDet)
            
            bWrite = True
        End If
    Next
End If

If bWrite Then
    oSales.WriteDocument(eReportMode.rmFullReport)
Else
    oSales.CancelDocument()
End If