mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
26 lines
609 B
C++
26 lines
609 B
C++
#include "TransactionBase.h"
|
|
#include <iomanip>
|
|
|
|
|
|
TransactionBase::TransactionBase(const std::string& memo)
|
|
: mMemo(memo)
|
|
{
|
|
|
|
}
|
|
|
|
std::string TransactionBase::amountToString(google::protobuf::int64 amount)
|
|
{
|
|
std::stringstream ss;
|
|
double dAmount = amount / 10000.0;
|
|
ss << std::fixed << std::setprecision(2) << dAmount;
|
|
std::string amountString = ss.str();
|
|
if (amountString.find('.') != amountString.npos) {
|
|
int pointPlace = amountString.find('.');
|
|
if (amountString.substr(pointPlace+1) == "00") {
|
|
amountString = amountString.substr(0, pointPlace);
|
|
}
|
|
}
|
|
return amountString;
|
|
//return ss.str();
|
|
}
|