Venice
Purch::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
CreatePurch
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;

pPurch->PrepareDocument (paUpdate);

sNumItrDets = pPurch->GetNumItrDetails ();

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

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

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

oPurch.PrepareDocument (ePrepareAction.paUpdate);

sNumItrDets = oPurch.GetNumItrDetails ();

if (sNumItrDets != 0)
{
    object oCommodityCode, oDummy;
    
    for (short sItrDet = (short)(sNumItrDets - 1); sItrDet >= 0; sItrDet--)
    {
        if (oPurch.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")
        {
            oPurch.DeleteItrDetail (sItrDet);
            
            bWrite = true;
        }
    }
}

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

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

Call oPurch.PrepareDocument(paUpdate)

sNumItrDets = oPurch.GetNumItrDetails()

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

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

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

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

oPurch.PrepareDocument(ePrepareAction.paUpdate)

sNumItrDets = oPurch.GetNumItrDetails()

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

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

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