Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/checkprinting/checkprinting.cpp
| Show First 20 Lines • Show All 203 Lines • ▼ Show 20 Line(s) | 175 | for (it = d->m_transactions.constBegin(); it != d->m_transactions.constEnd(); ++it) { | |||
|---|---|---|---|---|---|
| 204 | checkHTML.replace("$PAYEE_POSTCODE", file->payee((*it).split().payeeId()).postcode()); | 204 | checkHTML.replace("$PAYEE_POSTCODE", file->payee((*it).split().payeeId()).postcode()); | ||
| 205 | checkHTML.replace("$PAYEE_STATE", file->payee((*it).split().payeeId()).state()); | 205 | checkHTML.replace("$PAYEE_STATE", file->payee((*it).split().payeeId()).state()); | ||
| 206 | checkHTML.replace("$AMOUNT_STRING", converter.convert((*it).split().value().abs(), currency.smallestAccountFraction())); | 206 | checkHTML.replace("$AMOUNT_STRING", converter.convert((*it).split().value().abs(), currency.smallestAccountFraction())); | ||
| 207 | checkHTML.replace("$AMOUNT_DECIMAL", MyMoneyUtils::formatMoney((*it).split().value().abs(), currency)); | 207 | checkHTML.replace("$AMOUNT_DECIMAL", MyMoneyUtils::formatMoney((*it).split().value().abs(), currency)); | ||
| 208 | checkHTML.replace("$MEMO", (*it).split().memo()); | 208 | checkHTML.replace("$MEMO", (*it).split().memo()); | ||
| 209 | const auto currencyId = (*it).transaction().commodity(); | 209 | const auto currencyId = (*it).transaction().commodity(); | ||
| 210 | const auto accountcurrency = MyMoneyFile::instance()->currency(currencyId); | 210 | const auto accountcurrency = MyMoneyFile::instance()->currency(currencyId); | ||
| 211 | checkHTML.replace("$TRANSACTIONCURRENCY", accountcurrency.tradingSymbol()); | 211 | checkHTML.replace("$TRANSACTIONCURRENCY", accountcurrency.tradingSymbol()); | ||
| 212 | int numSplits = (*it).transaction().splitCount(); | 212 | int numSplits = (int)(*it).transaction().splitCount(); | ||
| 213 | const int maxSplits = 11; | 213 | const int maxSplits = 11; | ||
| 214 | for (int i = 0; i < maxSplits; ++i) { | 214 | for (int i = maxSplits-1; i >= 0 ; i--) { | ||
| 215 | const QString valueVariable = QString("$SPLITVALUE%1").arg(i); | 215 | const QString valueVariable = QString("$SPLITVALUE%1").arg(i); | ||
| 216 | const QString accountVariable = QString("$SPLITACCOUNTNAME%1").arg(i); | 216 | const QString accountVariable = QString("$SPLITACCOUNTNAME%1").arg(i); | ||
| 217 | if (i < numSplits) { | 217 | if (i < numSplits) { | ||
| 218 | checkHTML.replace( valueVariable, MyMoneyUtils::formatMoney((*it).transaction().splits()[i].value().abs(), currency)); | 218 | checkHTML.replace( valueVariable, MyMoneyUtils::formatMoney((*it).transaction().splits()[i].value().abs(), currency)); | ||
| 219 | checkHTML.replace( accountVariable, (file->account((*it).transaction().splits()[i].accountId())).name()); | 219 | checkHTML.replace( accountVariable, (file->account((*it).transaction().splits()[i].accountId())).name()); | ||
| 220 | } else { | 220 | } else { | ||
| 221 | checkHTML.replace( valueVariable, " "); | 221 | checkHTML.replace( valueVariable, " "); | ||
| 222 | checkHTML.replace( accountVariable, " "); | 222 | checkHTML.replace( accountVariable, " "); | ||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||