|
Updates a distribution for a detail. |
|
|
void UpdateStkDetail ( SHORT sDetIndex, SHORT sStkIndex, DOUBLE dQuantity, BSTR bsLocation, BSTR bsSerialNumber ) |
|
|
Parameters | sDetIndex | [in] The index of the detail where the distribution belongs to, starting from 0. | sStkIndex | [in] The index of the distribution, starting from 0. | dQuantity | [in] The quantity that is distributed (in stock units). | bsLocation | [in] The location of the article. | bsSerialNumber | [in] The serial number of the article. | | Remarks |
| If the parameter sIndex is an invalid index (refers to a not existing distribution) an exception is thrown. You can use GetStkDetail to check whether an index is valid, in which case it returns true. |
|
|
See Also |
|
|
|
Samples |
|
|
C++ |
|
// Update the location code of all distributions of all details of the current document from 'LOC_A' to 'LOC_B'
VARIANT vQuantity, vLocation, vSerialNumber;
short sNumDetails;
bool bWrite = false;
pSInvce->PrepareDocument (paUpdate);
sNumDetails = pSInvce->GetNumDetails ();
for (short sDetail = 0; sDetail < sNumDetails; sDetail++)
{
short sNumStkDets = pSInvce->GetNumStkDetails (sDetail);
for (short sStkDet = 0; sStkDet < sNumStkDets; sStkDet++)
{
if (pSInvce->GetStkDetail (sDetail, sStkDet, &vQuantity, &vLocation, &vSerialNumber) && CString (vLocation.bstrVal) == "LOC_A")
{
pSInvce->UpdateStkDetail (sDetail, sStkDet, vQuantity.dblVal, "LOC_B", vSerialNumber.bstrVal);
bWrite = true;
}
}
}
if (bWrite)
pSInvce->WriteDocument (rmFullReport, VARIANT_FALSE, VARIANT_FALSE);
else
pSInvce->CancelDocument ();
|
|
|
C# |
|
// Update the location code of all distributions of all details of the current document from 'LOC_A' to 'LOC_B'
object oQuantity, oLocation, oSerialNumber;
short sNumDetails;
bool bWrite = false;
oSInvce.PrepareDocument (ePrepareAction.paUpdate);
sNumDetails = oSInvce.GetNumDetails ();
for (short sDetail = 0; sDetail < sNumDetails; sDetail++)
{
short sNumStkDets = oSInvce.GetNumStkDetails (sDetail);
for (short sStkDet = 0; sStkDet < sNumStkDets; sStkDet++)
{
if (oSInvce.GetStkDetail (sDetail, sStkDet, out oQuantity, out oLocation, out oSerialNumber) && oLocation.ToString () == "LOC_A")
{
oSInvce.UpdateStkDetail (sDetail, sStkDet, (double)oQuantity, "LOC_B", oSerialNumber.ToString ());
bWrite = true;
}
}
}
if (bWrite)
oSInvce.WriteDocument (eReportMode.rmFullReport, false, false);
else
oSInvce.CancelDocument ();
|
|
|
VBS |
|
' Update the location code of all distributions of all details of the current document from 'LOC_A' to 'LOC_B'
Dim oQuantity, oLocation, oSerialNumber
Dim sNumDetails, sDetail
Dim bWrite
Call oSInvce.PrepareDocument(paUpdate)
sNumDetails = oSInvce.GetNumDetails()
bWrite = False
For sDetail = 0 To sNumDetails - 1
Dim sNumStkDets, sStkDet
sNumStkDets = oSInvce.GetNumStkDetails(sDetail)
For sStkDet = 0 To sNumStkDets - 1
If oSInvce.GetStkDetail(sDetail, sStkDet, oQuantity, oLocation, oSerialNumber) And oLocation = "LOC_A" Then
Call oSInvce.UpdateStkDetail(sDetail, sStkDet, oQuantity, "LOC_B", oSerialNumber)
bWrite = True
End If
Next
Next
If bWrite Then
Call oSInvce.WriteDocument(rmFullReport, False, False)
Else
Call oSInvce.CancelDocument()
End If
|
|
|
VB.NET |
|
' Update the location code of all distributions of all details of the current document from 'LOC_A' to 'LOC_B'
Dim oQuantity, oLocation, oSerialNumber As Object
Dim sNumDetails As Short
Dim bWrite As Boolean
oSInvce.PrepareDocument(ePrepareAction.paUpdate)
sNumDetails = oSInvce.GetNumDetails()
bWrite = False
For sDetail As Short = 0 To sNumDetails - 1
Dim sNumStkDets As Short
sNumStkDets = oSInvce.GetNumStkDetails(sDetail)
For sStkDet As Short = 0 To sNumStkDets - 1
If oSInvce.GetStkDetail(sDetail, sStkDet, oQuantity, oLocation, oSerialNumber) And oLocation = "LOC_A" Then
oSInvce.UpdateStkDetail(sDetail, sStkDet, oQuantity, "LOC_B", oSerialNumber)
bWrite = True
End If
Next
Next
If bWrite Then
oSInvce.WriteDocument(eReportMode.rmFullReport, False, False)
Else
oSInvce.CancelDocument()
End If
|
|