Purch::UpdateItrDetail (Interface: Purch)
 
Updates an Intrastat detail in the document.
 
void UpdateItrDetail (
    SHORT sIndex,
    DOUBLE dAmountDocC,
    DOUBLE dMass,
    DOUBLE dSupplUnits,
    enum eStatProc eStatProc,
    enum eNatTrans eNatTrans,
    enum eRegion eRegion,
    enum eTransport eTransport,
    enum eDelivCond eDelivCond,
    BSTR bsCommodityCode,
    BSTR bsCountry,
    BSTR bsCountryOrigin
)
 
Parameters
sIndex
[in] The index of the Intrastat detail, starting from 0.
dAmountDocC
[in] The amount (in document currency) of the Intrastat detail.
dMass
[in] The mass of the Intrastat detail.
dSupplUnits
[in] The supplementary units of the Intrastat detail.
eStatProc
[in] A value of the 'eStatProc' enumeration.
eNatTrans
[in] A value of the 'eNatTrans' enumeration.
eRegion
[in] A value of the 'eRegion' enumeration.
eTransport
[in] A value of the 'eTransport' enumeration.
eDelivCond
[in] A value of the 'eDelivCond' enumeration.
bsCommodityCode
[in] The unformatted commodity code of the Intrastat detail.
bsCountry
[in] The country code of the partner of the Intrastat detail.
bsCountryOrigin
[in] The country code of origin of the Intrastat detail.
 
Remarks
If the parameter sIndex is an invalid index (refers to a not existing Intrastat detail) an exception is thrown. You can use GetItrDetail to check whether an index is valid, in which case it returns true.
 
See Also
CreatePurch
Handling accounting documents using the SDK
PrepareDocument
GetNumItrDetails
GetItrDetail
WriteDocument
CancelDocument
 
Samples
 
C++
 
// Update the region of all Intrastat details of the current document from reWallonia to reFlanders
VARIANT vAmountDocC, vMass, vSupplUnits, vStatProc, vNatTrans, vRegion, vTransport, vDelivCond, vCommodityCode, vCountry, vCountryOrigin;
short sNumItrDets;
bool bWrite = false;

pPurch->PrepareDocument (paUpdate);

sNumItrDets = pPurch->GetNumItrDetails ();

for (short sItrDet = 0; sItrDet < sNumItrDets; sItrDet++)
{
    if (pPurch->GetItrDetail (sItrDet, &vAmountDocC, &vMass, &vSupplUnits, &vStatProc, &vNatTrans, &vRegion, &vTransport, &vDelivCond, &vCommodityCode, &vCountry, &vCountryOrigin) && (eRegion)vRegion.bVal == reWallonia)
    {
        pPurch->UpdateItrDetail (sItrDet, vAmountDocC.dblVal, vMass.dblVal, vSupplUnits.dblVal, (eStatProc)vStatProc.bVal, (eNatTrans)vNatTrans.bVal, reFlanders, (eTransport)vTransport.bVal, (eDelivCond)vDelivCond.bVal, vCommodityCode.bstrVal, vCountry.bstrVal, vCountryOrigin.bstrVal);
        bWrite = true;
    }
}

if (bWrite)
    pPurch->WriteDocument (rmFullReport);
else
    pPurch->CancelDocument ();

C#
 
// Update the region of all Intrastat details of the current document from reWallonia to reFlanders
object oAmountDocC, oMass, oSupplUnits, oStatProc, oNatTrans, oRegion, oTransport, oDelivCond, oCommodityCode, oCountry, oCountryOrigin;
short sNumItrDets;
bool bWrite = false;

oPurch.PrepareDocument (ePrepareAction.paUpdate);

sNumItrDets = oPurch.GetNumItrDetails ();

for (short sItrDet = 0; sItrDet < sNumItrDets; sItrDet++)
{
    if (oPurch.GetItrDetail (sItrDet, out oAmountDocC, out oMass, out oSupplUnits, out oStatProc, out oNatTrans, out oRegion, out oTransport, out oDelivCond, out oCommodityCode, out oCountry, out oCountryOrigin) && (eRegion)((byte)oRegion) == eRegion.reWallonia)
    {
        oPurch.UpdateItrDetail (sItrDet, (double)oAmountDocC, (double)oMass, (double)oSupplUnits, (eStatProc)((byte)oStatProc), (eNatTrans)((byte)oNatTrans), eRegion.reFlanders, (eTransport)((byte)oTransport), (eDelivCond)((byte)oDelivCond), oCommodityCode.ToString (), oCountry.ToString (), oCountryOrigin.ToString ());
        bWrite = true;
    }
}

if (bWrite)
    oPurch.WriteDocument (eReportMode.rmFullReport);
else
    oPurch.CancelDocument ();

VBS
 
' Update the region of all Intrastat details of the current document from reWallonia to reFlanders
Dim oAmountDocC, oMass, oSupplUnits, oStatProc, oNatTrans, oRegion, oTransport, oDelivCond, oCommodityCode, oCountry, oCountryOrigin
Dim sItrDet, sNumItrDets
Dim bWrite

Call oPurch.PrepareDocument(paUpdate)

sNumItrDets = oPurch.GetNumItrDetails()
bWrite = False

For sItrDet = 0 To sNumItrDets - 1
    If oPurch.GetItrDetail(sItrDet, oAmountDocC, oMass, oSupplUnits, oStatProc, oNatTrans, oRegion, oTransport, oDelivCond, oCommodityCode, oCountry, oCountryOrigin) And oRegion = reWallonia Then
        Call oPurch.UpdateItrDetail(sItrDet, oAmountDocC, oMass, oSupplUnits, oStatProc, oNatTrans, reFlanders, oTransport, oDelivCond, oCommodityCode, oCountry, oCountryOrigin)
        bWrite = True
    End If
Next

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

VB.NET
 
' Update the region of all Intrastat details of the current document from reWallonia to reFlanders
Dim oAmountDocC, oMass, oSupplUnits, oStatProc, oNatTrans, oRegion, oTransport, oDelivCond, oCommodityCode, oCountry As Object, oCountryOrigin As Object
Dim sNumItrDets As Short
Dim bWrite As Boolean

oPurch.PrepareDocument(ePrepareAction.paUpdate)

sNumItrDets = oPurch.GetNumItrDetails()
bWrite = False

For sItrDet As Short = 0 To sNumItrDets - 1
    If oPurch.GetItrDetail(sItrDet, oAmountDocC, oMass, oSupplUnits, oStatProc, oNatTrans, oRegion, oTransport, oDelivCond, oCommodityCode, oCountry, oCountryOrigin) And oRegion = eRegion.reWallonia Then
        oPurch.UpdateItrDetail(sItrDet, oAmountDocC, oMass, oSupplUnits, oStatProc, oNatTrans, eRegion.reFlanders, oTransport, oDelivCond, oCommodityCode, oCountry, oCountryOrigin)
        bWrite = True
    End If
Next
    
If bWrite Then
    oPurch.WriteDocument(eReportMode.rmFullReport)
Else
    oPurch.CancelDocument()
End If