Venice
Purch::UpdateAnaDetail
 
Updates an analytical detail for one accounting detail and analytical type.
 
void UpdateAnaDetail (
    SHORT sAccIndex,
    SHORT sAnaIndex,
    enum eAnaEntType eAnaEntType,
    DOUBLE dAmountDocC,
    DOUBLE dQuantity,
    DOUBLE dPercentage,
    DOUBLE dValue1,
    BSTR bsAnaAccount,
    BSTR bsAnaKind,
    BSTR bsRemark,
    BSTR bsText1
)
 
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.
dAmountDocC
[in] The amount (in document currency ) of the analytical detail.
dQuantity
[in] The quantity of the analytical detail.
dPercentage
[in] The percentage that has to be distributed for the analytical detail.
dValue1
[in] The free value of the analytical detail.
bsAnaAccount
[in] The analytical account of the analytical detail.
bsAnaKind
[in] The analytical kind of the analytical detail.
bsRemark
[in] The remark of the analytical detail.
bsText1
[in] The free text of the analytical detail.
 
Remarks
If a value is provided for the parameter dAmountDocC and no value is provided for the parameter dPercentage the percentages is automatically calculated by the SDK.
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
GetNumDetails
GetNumAnaDetails
GetAnaDetail
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Update the analytical centre code of all analytical details of all details of the current document from 'CETN' to 'CENT'
VARIANT vAmountDocC, vQuantity, vPercentage, vValue1, vAnaAccount, vAnaKind, vRemark, vText1;
short sNumDetails;
bool bWrite = false;

pPurch->PrepareDocument (paUpdate);

sNumDetails = pPurch->GetNumDetails ();

for (short sDetail = 0; sDetail < sNumDetails; sDetail++)
{
    short sNumAnaDets = pPurch->GetNumAnaDetails (sDetail, aetCent);
    
    for (short sAnaDet = 0; sAnaDet < sNumAnaDets; sAnaDet++)
    {
        if (pPurch->GetAnaDetail (sDetail, sAnaDet, aetCent, &vAmountDocC, &vQuantity, &vPercentage, &vValue1, &vAnaAccount, &vAnaKind, &vRemark, &vText1) && CString (vAnaAccount.bstrVal) == "CETN")
        {
            pPurch->UpdateAnaDetail (sDetail, sAnaDet, aetCent, vAmountDocC.dblVal, vQuantity.dblVal, vPercentage.dblVal, vValue1.dblVal, "CENT", vAnaKind.bstrVal, vRemark.bstrVal, vText1.bstrVal);
            bWrite = true;
        }
    }
}

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

C#
 
// Update the analytical centre code of all analytical details of all details of the current document from 'CETN' to 'CENT'
object oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1;
short sNumDetails;
bool bWrite = false;

oPurch.PrepareDocument (ePrepareAction.paUpdate);

sNumDetails = oPurch.GetNumDetails ();

for (short sDetail = 0; sDetail < sNumDetails; sDetail++)
{
    short sNumAnaDets = oPurch.GetNumAnaDetails (sDetail, eAnaEntType.aetCent);
    
    for (short sAnaDet = 0; sAnaDet < sNumAnaDets; sAnaDet++)
    {
        if (oPurch.GetAnaDetail (sDetail, sAnaDet, eAnaEntType.aetCent, out oAmountDocC, out oQuantity, out oPercentage, out oValue1, out oAnaAccount, out oAnaKind, out oRemark, out oText1) && oAnaAccount.ToString () == "CETN")
        {
            oPurch.UpdateAnaDetail (sDetail, sAnaDet, eAnaEntType.aetCent, (double)oAmountDocC, (double)oQuantity, (double)oPercentage, (double)oValue1, "CENT", oAnaKind.ToString (), oRemark.ToString (), oText1.ToString ());
            bWrite = true;
        }
    }
}

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

VBS
 
' Update the analytical centre code of all analytical details of all details of the current document from 'CETN' to 'CENT'
Dim oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1
Dim sNumDetails, sDetail
Dim bWrite

Call oPurch.PrepareDocument(paUpdate)

sNumDetails = oPurch.GetNumDetails()
bWrite = False

For sDetail = 0 To sNumDetails - 1
    Dim sNumAnaDets, sAnaDet
    
    sNumAnaDets = oPurch.GetNumAnaDetails(sDetail, aetCent)
    
    For sAnaDet = 0 To sNumAnaDets - 1
        If oPurch.GetAnaDetail(sDetail, sAnaDet, aetCent, oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1) And oAnaAccount = "CETN" Then
            Call oPurch.UpdateAnaDetail(sDetail, sAnaDet, aetCent, oAmountDocC, oQuantity, oPercentage, oValue1, "CENT", oAnaKind, oRemark, oText1)
            bWrite = True
        End If
    Next
Next

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

VB.NET
 
' Update the analytical centre code of all analytical details of all details of the current document from 'CETN' to 'CENT'
Dim oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1 As Object
Dim sNumDetails As Short
Dim bWrite As Boolean

oPurch.PrepareDocument(ePrepareAction.paUpdate)

sNumDetails = oPurch.GetNumDetails()
bWrite = False

For sDetail As Short = 0 To sNumDetails - 1
    Dim sNumAnaDets As Short
    
    sNumAnaDets = oPurch.GetNumAnaDetails(sDetail, eAnaEntType.aetCent)
    
    For sAnaDet As Short = 0 To sNumAnaDets - 1
        If oPurch.GetAnaDetail(sDetail, sAnaDet, eAnaEntType.aetCent, oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1) And oAnaAccount = "CETN" Then
            oPurch.UpdateAnaDetail(sDetail, sAnaDet, eAnaEntType.aetCent, oAmountDocC, oQuantity, oPercentage, oValue1, "CENT", oAnaKind, oRemark, oText1)
            bWrite = True
        End If
    Next
Next

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