Sales::InsertDetail (Interface: Sales)
 
Inserts a new accounting detail in the document.
 
void InsertDetail (
    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
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
CreateSales
Handling accounting documents using the SDK
InsertDetail2
PrepareDocument
GetManualIndex
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Insert a new text line before the first manual detail of the current document
short sManualIndex;

pSales->PrepareDocument (paUpdate);

sManualIndex = pSales->GetManualIndex ();

if (sManualIndex != -1)
{
    pSales->InsertDetail (sManualIndex, 0.0, 0.0, 0.0, "", "Inserted via SDK", "");

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

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

oSales.PrepareDocument (ePrepareAction.paUpdate);

sManualIndex = oSales.GetManualIndex ();

if (sManualIndex != -1)
{
    oSales.InsertDetail (sManualIndex, 0.0, 0.0, 0.0, "", "Inserted via SDK", "");

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

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

Call oSales.PrepareDocument(paUpdate)

sManualIndex = oSales.GetManualIndex()

If sManualIndex <> -1 Then
    Call oSales.InsertDetail(sManualIndex, 0.0, 0.0, 0.0, "", "Inserted via SDK", "")

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

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

oSales.PrepareDocument(ePrepareAction.paUpdate)

sManualIndex = oSales.GetManualIndex()

If sManualIndex <> -1 Then
    oSales.InsertDetail(sManualIndex, 0.0, 0.0, 0.0, "", "Inserted via SDK", "")

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