Venice
Finan::InsertAnaDetail
 
Inserts a new analytical detail for one accounting detail and analytical type.
 
void InsertAnaDetail (
    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.
The parameter sAnaIndex can have the value -1 (sAccIndex must be a valid index!). In this case the new analytical detail is inserted after the existing analytical details.
If sIndex refers to an existing index, the new analytical detail is inserted at this index and all following analytical details are moved to the next index.
 
See Also
CreateFinan
Handling accounting documents using the SDK
PrepareDocument
GetManualIndex
NeedAnaDistrib
GetDetail
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Insert an analytical centre detail (after the other analytical details) for the first manual detail of the current document
short sManualIndex;
bool bWrite = false;

pFinan->PrepareDocument (paUpdate);

sManualIndex = pFinan->GetManualIndex ();

if (sManualIndex != -1 && pFinan->NeedAnaDistrib (sManualIndex, aetCent))
{
    VARIANT vAmountDocC;

    if (pFinan->GetDetail (sManualIndex, &vAmountDocC, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
    {
        pFinan->InsertAnaDetail (sManualIndex, -1, aetCent, 0.2*vAmountDocC.dblVal, 0.0, 20.0, 0.0, "CENT", "KIND", "Inserted via SDK", "");
        bWrite = true;
    }
}

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

C#
 
// Insert an analytical centre detail (after the other analytical details) for the first manual detail of the current document
short sManualIndex;
bool bWrite = false;

oFinan.PrepareDocument (ePrepareAction.paUpdate);

sManualIndex = oFinan.GetManualIndex ();

if (sManualIndex != -1 && oFinan.NeedAnaDistrib (sManualIndex, eAnaEntType.aetCent))
{
    object oAmountDocC, oDummy;

    if (oFinan.GetDetail (sManualIndex, out oAmountDocC, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy, out oDummy))
    {
        oFinan.InsertAnaDetail (sManualIndex, -1, eAnaEntType.aetCent, 0.2*((double)oAmountDocC), 0.0, 20.0, 0.0, "CENT", "KIND", "Inserted via SDK", "");
        bWrite = true;        
    }
}

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

VBS
 
' Insert an analytical centre detail (after the other analytical details) for the first manual detail of the current document
Dim sManualIndex
Dim bWrite

Call oFinan.PrepareDocument(paUpdate)

sManualIndex = oFinan.GetManualIndex()
bWrite = False

If sManualIndex <> -1 And oFinan.NeedAnaDistrib(sManualIndex, aetCent) Then
    Dim oAmountDocC, oDummy

    If oFinan.GetDetail(sManualIndex, oAmountDocC, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy) Then
        Call oFinan.InsertAnaDetail(sManualIndex, -1, aetCent, oAmountDocC / 5, 0.0, 20.0, 0.0, "CENT", "KIND", "Inserted via SDK", "")
        bWrite = True
    End If
End If

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

VB.NET
 
' Insert an analytical centre detail (after the other analytical details) for the first manual detail of the current document
Dim sManualIndex As Short
Dim bWrite As Boolean

oFinan.PrepareDocument(ePrepareAction.paUpdate)

sManualIndex = oFinan.GetManualIndex()
bWrite = False

If sManualIndex <> -1 And oFinan.NeedAnaDistrib(sManualIndex, eAnaEntType.aetCent) Then
    Dim oAmountDocC, oDummy As Object

    If oFinan.GetDetail(sManualIndex, oAmountDocC, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy, oDummy) Then
        oFinan.InsertAnaDetail(sManualIndex, -1, eAnaEntType.aetCent, oAmountDocC / 5, 0.0, 20.0, 0.0, "CENT", "KIND", "Inserted via SDK", "")
        bWrite = True
    End If
End If

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