Purch::UpdateDetail (Interface: Purch)
 
Updates an accounting detail in the document.
 
void UpdateDetail (
    SHORT sIndex,
    DOUBLE dAmountDocC,
    DOUBLE dQuantity,
    DOUBLE dValue1,
    BSTR bsAccount,
    BSTR bsRemark,
    BSTR bsText1
)
 
Parameters
sIndex
[in] The index of the detail, starting from 0.
dAmountDocC
[in] The amount (in document currency) of the detail.
dQuantity
[in] The quantity of the detail.
dValue1
[in] The free value of the detail.
bsAccount
[in] The account number of the detail.
bsRemark
[in] The remark of the detail.
bsText1
[in] The free text of the detail.
 
Remarks
If the parameter sIndex is an invalid index (refers to a not existing detail) an exception is thrown. You can use GetDetail to check whether an index is valid, in which case it returns true.
If an analytical entry proposal exists for the provided account (parameter bsAccount), the detail is automatically distributed according to this proposal.
 
See Also
CreatePurch
Handling accounting documents using the SDK
UpdateDetail2
UpdateDetailSel
UpdateDetailSel2
PrepareDocument
GetManualIndex
GetDetail
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Update the remark of the first manual detail of the current document to 'Updated via SDK'
short sManualIndex;
bool bWrite = false;

pPurch->PrepareDocument (paUpdate);

sManualIndex = pPurch->GetManualIndex ();

if (sManualIndex != -1)
{
    VARIANT vAmountDocC, vQuantity, vValue1, vAccount, vRemark, vText1;
    if (pPurch->GetDetail (sManualIndex, &vAmountDocC, &vQuantity, &vValue1, &vAccount, &vRemark, &vText1))
    {
        pPurch->UpdateDetail (sManualIndex, vAmountDocC.dblVal, vQuantity.dblVal, vValue1.dblVal, vAccount.bstrVal, "Updated via SDK", vText1.bstrVal);
        bWrite = true;
    }
}

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

C#
 
// Update the remark of the first manual detail of the current document to 'Updated via SDK'
short sManualIndex;
bool bWrite = false;

oPurch.PrepareDocument (ePrepareAction.paUpdate);

sManualIndex = oPurch.GetManualIndex ();

if (sManualIndex != -1)
{
    object oAmountDocC, oQuantity, oValue1, oAccount, oRemark, oText1;

    if (oPurch.GetDetail (sManualIndex, out oAmountDocC, out oQuantity, out oValue1, out oAccount, out oRemark, out oText1))
    {
        oPurch.UpdateDetail (sManualIndex, (double)oAmountDocC, (double)oQuantity, (double)oValue1, oAccount.ToString (), "Updated via SDK", oText1.ToString ());
        bWrite = true;
    }
}

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

VBS
 
' Update the remark of the first manual detail of the current document to 'Updated via SDK'
Dim sManualIndex
Dim bWrite

bWrite = False

Call oPurch.PrepareDocument(paUpdate)

sManualIndex = oPurch.GetManualIndex()

If sManualIndex <> -1 Then
    Dim oAmountDocC, oQuantity, oValue1, oAccount, oRemark, oText1

    If oPurch.GetDetail(sManualIndex, oAmountDocC, oQuantity, oValue1, oAccount, oRemark, oText1) Then
        Call oPurch.UpdateDetail(sManualIndex, oAmountDocC, oQuantity, oValue1, oAccount, "Updated via SDK", oText1)
        bWrite = True
    End If
End If

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

VB.NET
 
' Update the remark of the first manual detail of the current document to 'Updated via SDK'
Dim sManualIndex As Short
Dim bWrite As Boolean

oPurch.PrepareDocument(ePrepareAction.paUpdate)

sManualIndex = oPurch.GetManualIndex()
bWrite = False

If sManualIndex <> -1 Then
    Dim oAmountDocC, oQuantity, oValue1, oAccount, oRemark, oText1 As Object

    If oPurch.GetDetail(sManualIndex, oAmountDocC, oQuantity, oValue1, oAccount, oRemark, oText1) Then
        oPurch.UpdateDetail(sManualIndex, oAmountDocC, oQuantity, oValue1, oAccount, "Updated via SDK", oText1)
        bWrite = True
    End If
End If

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