Venice
Purch::DeleteAnaDetail
 
Deletes an analytical detail of one accounting detail and analytical type.
 
void DeleteAnaDetail (
    SHORT sAccIndex,
    SHORT sAnaIndex,
    enum eAnaEntType eAnaEntType
)
 
Parameters
sAccIndex
[in] The index of the detail line where the analytical detail line belongs to, starting from 0.
sAnaIndex
[in] The index of the analytical detail line, starting from 0.
eAnaEntType
[in] A value of the 'eAnaEntType' enumeration.
 
Remarks
If the parameter sIndex is an invalid index (refers to a not existing analytical detail) an exception is thrown. You can use GetAnaDetail to check whether an index is valid, in which case it returns true.
 
See Also
CreatePurch
Handling accounting documents using the SDK
PrepareDocument
GetManualIndex
GetNumAnaDetails
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Remove all the analytical centre details of the first manual detail of the current document
short sManualIndex;
bool bWrite = false;

pPurch->PrepareDocument (paUpdate);

sManualIndex = pPurch->GetManualIndex ();

if (sManualIndex != -1)
{
    short sNumAnaDets = pPurch->GetNumAnaDetails (sManualIndex, aetCent);
    
    if (sNumAnaDets != 0)
    {
        for (short sAnaDet = sNumAnaDets - 1; sAnaDet >= 0; sAnaDet--)
        {
            pPurch->DeleteAnaDetail (sManualIndex, sAnaDet, aetCent);
        }
        
        bWrite = true;
    }
}
    
if (bWrite)
    pPurch->WriteDocument (rmFullReport);
else    
    pPurch->CancelDocument ();

C#
 
// Remove all the analytical centre details of the first manual detail of the current document
short sManualIndex;
bool bWrite = false;

oPurch.PrepareDocument (ePrepareAction.paUpdate);

sManualIndex = oPurch.GetManualIndex ();

if (sManualIndex != -1)
{
    short sNumAnaDets = oPurch.GetNumAnaDetails (sManualIndex, eAnaEntType.aetCent);
    
    if (sNumAnaDets != 0)
    {
        for (short sAnaDet = (short)(sNumAnaDets - 1); sAnaDet >= 0; sAnaDet--)
        {
            oPurch.DeleteAnaDetail (sManualIndex, sAnaDet, eAnaEntType.aetCent);
        }
        
        bWrite = true;
    }
}

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

VBS
 
' Remove all the analytical centre details of the first manual detail of the current document
Dim sManualIndex
Dim bWrite

Call oPurch.PrepareDocument(paUpdate)

sManualIndex = oPurch.GetManualIndex()
bWrite = False

If sManualIndex <> -1 Then
    Dim sNumAnaDets, sAnaDet
    
    sNumAnaDets = oPurch.GetNumAnaDetails(sManualIndex, aetCent)
    
    If sNumAnaDets <> 0 Then
        For sAnaDet = sNumAnaDets - 1 To 0 Step -1
            Call oPurch.DeleteAnaDetail(sManualIndex, sAnaDet, aetCent)
        Next
        
        bWrite = True
    End If
End If

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

VB.NET
 
' Remove all the analytical centre details of the first manual detail of the current document
Dim sManualIndex As Short
Dim bWrite As Boolean

oPurch.PrepareDocument(ePrepareAction.paUpdate)

sManualIndex = oPurch.GetManualIndex()
bWrite = True

If sManualIndex <> -1 Then
    Dim sNumAnaDets As Short
    
    sNumAnaDets = oPurch.GetNumAnaDetails(sManualIndex, eAnaEntType.aetCent)
    
    If sNumAnaDets <> 0 Then
        For sAnaDet As Short = sNumAnaDets - 1 To 0 Step -1
            oPurch.DeleteAnaDetail(sManualIndex, sAnaDet, eAnaEntType.aetCent)
        Next
    End If
End If

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