Venice
SInvce::DeleteItrDetail
 
Deletes an Intrastat detail from the invoice.
 
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
CreateSInvce
Handling invoicing 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;

pSInvce->PrepareDocument (paUpdate);

sNumItrDets = pSInvce->GetNumItrDetails ();

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

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

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

oSInvce.PrepareDocument (ePrepareAction.paUpdate);

sNumItrDets = oSInvce.GetNumItrDetails ();

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

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

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

Call oSInvce.PrepareDocument(paUpdate)

sNumItrDets = oSInvce.GetNumItrDetails()

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

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

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

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

oSInvce.PrepareDocument(ePrepareAction.paUpdate)

sNumItrDets = oSInvce.GetNumItrDetails()

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

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

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