Click or drag to resize

clsImportExchangeRateForPlanning Class

The MARIProject Exchange rate is used for transactions not linked to a date and an daily exchange rate of SAP Business One.

This rate is for example necessary, when a user plans a sales position into the furture. The planned revenue in the system currency will be calculated based on this monthly exchange rate.

Changing exhange rates in the past will recalculate the planning lines and time bookings lines for contracts linked to foreign currencies.

Use MPInterface.bImportExchangeRateForPlanning(clsImportExchangeRateForPlanning, clsImportBaseeImportMode) to import.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportExchangeRateForPlanning

Namespace:  MARIInterface
Assembly:  MARIInterface (in MARIInterface.dll) Version: 8.0.0.100
Syntax
public class clsImportExchangeRateForPlanning : clsImportBase

The clsImportExchangeRateForPlanning type exposes the following members.

Constructors
  NameDescription
Public methodclsImportExchangeRateForPlanning
Initializes a new instance of the clsImportExchangeRateForPlanning class
Top
Methods
Fields
  NameDescription
Public fieldCurrency
ISO Currency Code. Has to be different to the system currency of MARIProject.
Public fieldExchangeRate
ExchangeRate Between the Currency and the MARIProject System Currency
Public fieldPeriodFrom
The new MARIProject Exchange Rate will start at the given period. YYYYMMM
Top
Remarks
Examples
Set an exchange rate in MARIProject for the given period into the future.
/// <summary>
/// Setting the MARIProject month exchange rate for planning cost (also in the future) for contracts in a foreign currency
/// </summary>
/// <param name="sCurrency">EUR, USD, CAD</param>
/// <param name="sngExRate">1.12</param>
/// <param name="lPeriodStart">2020012</param>
/// <returns></returns>
private bool FillExchangeRate(string sCurrency, decimal cExRate, int lPeriodStart) {

    clsImportExchangeRateForPlanning oNewRate = new clsImportExchangeRateForPlanning();
    oNewRate.Currency = sCurrency; // USD versus system currency EUR. or CAD versus system currency USD
    oNewRate.ExchangeRate = cExRate; // Depending on the settings in the first SBO database the rate has to be used as USD/EUR or EUR/USD
    oNewRate.PeriodFrom = lPeriodStart;
    if (oMPInterface.bImportExchangeRateForPlanning(oNewRate, MARIInterface.clsImportBase.eImportMode.ValidateAndImport)) {
        Log($"FillExchangeRate({sCurrency},{cExRate},{lPeriodStart}) Saved.");
        oMPInterface.oErrors.Clear();
        return true;
    } else {
        LogFail($"FillExchangeRate({sCurrency},{cExRate},{lPeriodStart}): {oMPInterface.oErrors.PrintErrors()}");
        return false;
    }
}
See Also