Finan::UpdateAnaDetail (Interface: Finan)
 
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
CreateFinan
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;

pFinan->PrepareDocument (paUpdate);

sNumDetails = pFinan->GetNumDetails ();

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

if (bWrite)
    pFinan->WriteDocument (rmFullReport);
else
    pFinan->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;

oFinan.PrepareDocument (ePrepareAction.paUpdate);

sNumDetails = oFinan.GetNumDetails ();

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

if (bWrite)
    oFinan.WriteDocument (eReportMode.rmFullReport);
else
    oFinan.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 oFinan.PrepareDocument(paUpdate)

sNumDetails = oFinan.GetNumDetails()
bWrite = False

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

If bWrite Then
    Call oFinan.WriteDocument(rmFullReport)
Else
    Call oFinan.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

oFinan.PrepareDocument(ePrepareAction.paUpdate)

sNumDetails = oFinan.GetNumDetails()
bWrite = False

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

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