Purch::InsertDetail2 (Interface: Purch)
 
Inserts a new extended accounting detail in the document.
 
void InsertDetail2 (
    SHORT sIndex,
    DOUBLE dAmountDocC,
    DOUBLE dQuantity,
    DOUBLE dValue1,
    BSTR bsAccount,
    BSTR bsRemark,
    BSTR bsText1,
    VARIANT_BOOL bInterCompany,
    BSTR bsCutOffAccount,
    DATE dteCutOffStart,
    DATE dteCutOffEnd
)
 
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.
bInterCompany
[in] The inter-company flag of the detail.
bsCutOffAccount
[in] The cut off account number of the detail.
dteCutOffStart
[in] The cut off start date of the detail.
dteCutOffEnd
[in] The cut off end date of the detail.
 
Remarks
The parameter sIndex can have the value -1. In this case the new detail is inserted after the existing details.
If sIndex refers to an existing index, the new detail is inserted at this index and all following details are moved to the next index.
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
InsertDetail
PrepareDocument
GetManualIndex
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Insert a new text line before the first manual detail of the current document
short sManualIndex;

pPurch->PrepareDocument (paUpdate);

sManualIndex = pPurch->GetManualIndex ();

if (sManualIndex != -1)
{
    pPurch->InsertDetail2 (sManualIndex, 0.0, 0.0, 0.0, "", "Inserted via SDK", "", VARIANT_FALSE, "", COleDateTime (0, 0, 0, 0, 0, 0).m_dt, COleDateTime (0, 0, 0, 0, 0, 0).m_dt);

    pPurch->WriteDocument (rmFullReport);
}
else
    pPurch->CancelDocument ();

C#
 
// Insert a new text line before the first manual detail of the current document
short sManualIndex;

oPurch.PrepareDocument (ePrepareAction.paUpdate);

sManualIndex = oPurch.GetManualIndex ();

if (sManualIndex != -1)
{
    oPurch.InsertDetail2 (sManualIndex, 0.0, 0.0, 0.0, "", "Inserted via SDK", "", false, "", new DateTime (), new DateTime ());

    oPurch.WriteDocument (eReportMode.rmFullReport);
}
else
    oPurch.CancelDocument ();

VBS
 
' Insert a new text line before the first manual detail of the current document
Dim sManualIndex
Dim dtDate

Call oPurch.PrepareDocument(paUpdate)

sManualIndex = oPurch.GetManualIndex()

If sManualIndex <> -1 Then
    Call oPurch.InsertDetail2(sManualIndex, 0.0, 0.0, 0.0, "", "Inserted via SDK", "", False, "", dtDate, dtDate)

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

VB.NET
 
' Insert a new text line before the first manual detail of the current document
Dim sManualIndex As Short
Dim dtDate As Date

oPurch.PrepareDocument(ePrepareAction.paUpdate)

sManualIndex = oPurch.GetManualIndex()

If sManualIndex <> -1 Then
    oPurch.InsertDetail2(sManualIndex, 0.0, 0.0, 0.0, "", "Inserted via SDK", "", False, "", dtDate, dtDate)

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