37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
|
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
|
using Sarand.Net.Standard.Base.Bus;
|
|
using Sarand.Net.Standard.Base.ReferenceData;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
|
{
|
|
//=======================================================================
|
|
// Transaction Helper.
|
|
//=======================================================================
|
|
public static class SbmTransactionHelper
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Currency.
|
|
|
|
/// <summary>Work out how many currency decimals should be used for the specified transaction.</summary>
|
|
public static ushort GetCurrencyDecimals(SbmInternals internals, SbmTransaction transaction)
|
|
{
|
|
if (SysId.IsValid(transaction?.CurrencyId))
|
|
{
|
|
SaCurrency currency = internals.GetCurrencyById(transaction.CurrencyId);
|
|
if (currency != null)
|
|
return SbmInternals.GetCurrencyDecimals(currency.Decimals);
|
|
}
|
|
return internals.GetCurrentCurrencyDecimals();
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|