|
Deletes an accounting detail from the document. |
|
|
void DeleteDetail ( SHORT sIndex ) |
|
|
Parameters | sIndex | [in] The index of the detail, starting from 0. | | 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. |
|
|
See Also |
|
|
|
Samples |
|
|
C++ |
|
// Delete the detail with remark = 'Remove this line!' of the current document
VARIANT vRemark;
short sNumDets;
bool bNext = true, bWrite = false;
pSales->PrepareDocument (paUpdate);
sNumDets = pSales->GetNumDetails ();
for (short sDetail = 0; bNext && sDetail < sNumDets; sDetail++)
{
if (pSales->GetDetail (sDetail, NULL, NULL, NULL, NULL, &vRemark, NULL) && CString (vRemark.bstrVal) == "Remove this line!")
{
pSales->DeleteDetail (sDetail);
bWrite = true;
bNext = false;
}
}
if (bWrite)
pSales->WriteDocument (rmFullReport);
else
pSales->CancelDocument ();
|
|
|
C# |
|
// Delete the detail with remark = 'Remove this line!' of the current document
object oRemark, oDummy;
short sNumDets;
bool bNext = true, bWrite = false;
oSales.PrepareDocument (ePrepareAction.paUpdate);
sNumDets = oSales.GetNumDetails ();
for (short sDetail = 0; bNext && sDetail < sNumDets; sDetail++)
{
if (oSales.GetDetail (sDetail, out oDummy, out oDummy, out oDummy, out oDummy, out oRemark, out oDummy) && oRemark.ToString () == "Remove this line!")
{
oSales.DeleteDetail (sDetail);
bWrite = true;
bNext = false;
}
}
if (bWrite)
oSales.WriteDocument (eReportMode.rmFullReport);
else
oSales.CancelDocument ();
|
|
|
VBS |
|
' Delete the detail with remark = 'Remove this line!' of the current document
Dim oRemark, oDummy
Dim sDetail, sNumDets
Dim bWrite
bWrite = False
Call oSales.PrepareDocument(paUpdate)
sNumDets = oSales.GetNumDetails()
For sDetail = 0 To sNumDets - 1
If oSales.GetDetail(sDetail, oDummy, oDummy, oDummy, oDummy, oRemark, oDummy) And oRemark = "Remove this line!" Then
Call oSales.DeleteDetail(sDetail)
bWrite = True
Exit For
End If
Next
If bWrite Then
Call oSales.WriteDocument(rmFullReport)
Else
Call oSales.CancelDocument()
End If
|
|
|
VB.NET |
|
' Delete the detail with remark = 'Remove this line!' of the current document
Dim oRemark, oDummy As Object
Dim sNumDets As Short
Dim bWrite As Boolean
bWrite = False
oSales.PrepareDocument(ePrepareAction.paUpdate)
sNumDets = oSales.GetNumDetails()
For sDetail As Short = 0 To sNumDets - 1
If oSales.GetDetail(sDetail, oDummy, oDummy, oDummy, oDummy, oRemark, oDummy) And oRemark = "Remove this line!" Then
oSales.DeleteDetail(sDetail)
bWrite = True
Exit For
End If
Next
If bWrite Then
oSales.WriteDocument(eReportMode.rmFullReport)
Else
oSales.CancelDocument()
End If
|
|