|
Updates an analytical detail for one accounting detail and analytical type. |
|
|
void UpdateAnaDetail ( 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. |
| If the parameter sIndex is an invalid index (refers to a not existing analytical detail) an exception is thrown. You can use GetAnaDetail to check whether an index is valid, in which case it returns true. |
|
|
See Also |
|
|
|
Samples |
|
|
C++ |
|
// Update the analytical centre code of all analytical details of all details of the current document from 'CETN' to 'CENT'
VARIANT vAmountDocC, vQuantity, vPercentage, vValue1, vAnaAccount, vAnaKind, vRemark, vText1;
short sNumDetails;
bool bWrite = false;
pSales->PrepareDocument (paUpdate);
sNumDetails = pSales->GetNumDetails ();
for (short sDetail = 0; sDetail < sNumDetails; sDetail++)
{
short sNumAnaDets = pSales->GetNumAnaDetails (sDetail, aetCent);
for (short sAnaDet = 0; sAnaDet < sNumAnaDets; sAnaDet++)
{
if (pSales->GetAnaDetail (sDetail, sAnaDet, aetCent, &vAmountDocC, &vQuantity, &vPercentage, &vValue1, &vAnaAccount, &vAnaKind, &vRemark, &vText1) && CString (vAnaAccount.bstrVal) == "CETN")
{
pSales->UpdateAnaDetail (sDetail, sAnaDet, aetCent, vAmountDocC.dblVal, vQuantity.dblVal, vPercentage.dblVal, vValue1.dblVal, "CENT", vAnaKind.bstrVal, vRemark.bstrVal, vText1.bstrVal);
bWrite = true;
}
}
}
if (bWrite)
pSales->WriteDocument (rmFullReport);
else
pSales->CancelDocument ();
|
|
|
C# |
|
// Update the analytical centre code of all analytical details of all details of the current document from 'CETN' to 'CENT'
object oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1;
short sNumDetails;
bool bWrite = false;
oSales.PrepareDocument (ePrepareAction.paUpdate);
sNumDetails = oSales.GetNumDetails ();
for (short sDetail = 0; sDetail < sNumDetails; sDetail++)
{
short sNumAnaDets = oSales.GetNumAnaDetails (sDetail, eAnaEntType.aetCent);
for (short sAnaDet = 0; sAnaDet < sNumAnaDets; sAnaDet++)
{
if (oSales.GetAnaDetail (sDetail, sAnaDet, eAnaEntType.aetCent, out oAmountDocC, out oQuantity, out oPercentage, out oValue1, out oAnaAccount, out oAnaKind, out oRemark, out oText1) && oAnaAccount.ToString () == "CETN")
{
oSales.UpdateAnaDetail (sDetail, sAnaDet, eAnaEntType.aetCent, (double)oAmountDocC, (double)oQuantity, (double)oPercentage, (double)oValue1, "CENT", oAnaKind.ToString (), oRemark.ToString (), oText1.ToString ());
bWrite = true;
}
}
}
if (bWrite)
oSales.WriteDocument (eReportMode.rmFullReport);
else
oSales.CancelDocument ();
|
|
|
VBS |
|
' Update the analytical centre code of all analytical details of all details of the current document from 'CETN' to 'CENT'
Dim oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1
Dim sNumDetails, sDetail
Dim bWrite
Call oSales.PrepareDocument(paUpdate)
sNumDetails = oSales.GetNumDetails()
bWrite = False
For sDetail = 0 To sNumDetails - 1
Dim sNumAnaDets, sAnaDet
sNumAnaDets = oSales.GetNumAnaDetails(sDetail, aetCent)
For sAnaDet = 0 To sNumAnaDets - 1
If oSales.GetAnaDetail(sDetail, sAnaDet, aetCent, oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1) And oAnaAccount = "CETN" Then
Call oSales.UpdateAnaDetail(sDetail, sAnaDet, aetCent, oAmountDocC, oQuantity, oPercentage, oValue1, "CENT", oAnaKind, oRemark, oText1)
bWrite = True
End If
Next
Next
If bWrite Then
Call oSales.WriteDocument(rmFullReport)
Else
Call oSales.CancelDocument()
End If
|
|
|
VB.NET |
|
' Update the analytical centre code of all analytical details of all details of the current document from 'CETN' to 'CENT'
Dim oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1 As Object
Dim sNumDetails As Short
Dim bWrite As Boolean
oSales.PrepareDocument(ePrepareAction.paUpdate)
sNumDetails = oSales.GetNumDetails()
bWrite = False
For sDetail As Short = 0 To sNumDetails - 1
Dim sNumAnaDets As Short
sNumAnaDets = oSales.GetNumAnaDetails(sDetail, eAnaEntType.aetCent)
For sAnaDet As Short = 0 To sNumAnaDets - 1
If oSales.GetAnaDetail(sDetail, sAnaDet, eAnaEntType.aetCent, oAmountDocC, oQuantity, oPercentage, oValue1, oAnaAccount, oAnaKind, oRemark, oText1) And oAnaAccount = "CETN" Then
oSales.UpdateAnaDetail(sDetail, sAnaDet, eAnaEntType.aetCent, oAmountDocC, oQuantity, oPercentage, oValue1, "CENT", oAnaKind, oRemark, oText1)
bWrite = True
End If
Next
Next
If bWrite Then
oSales.WriteDocument(eReportMode.rmFullReport)
Else
oSales.CancelDocument()
End If
|
|