本文整理汇总了C++中MyMoneyFile::openingBalanceTransaction方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMoneyFile::openingBalanceTransaction方法的具体用法?C++ MyMoneyFile::openingBalanceTransaction怎么用?C++ MyMoneyFile::openingBalanceTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMoneyFile
的用法示例。
在下文中一共展示了MyMoneyFile::openingBalanceTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeAccountEntry
void MyMoneyQifWriter::writeAccountEntry(QTextStream &s, const QString& accountId, const QDate& startDate, const QDate& endDate)
{
MyMoneyFile* file = MyMoneyFile::instance();
MyMoneyAccount account;
account = file->account(accountId);
MyMoneyTransactionFilter filter(accountId);
filter.setDateFilter(startDate, endDate);
QValueList<MyMoneyTransaction> list = file->transactionList(filter);
QString openingBalanceTransactionId;
s << "!Type:" << m_qifProfile.profileType() << endl;
if(!startDate.isValid() || startDate <= account.openingDate()) {
s << "D" << m_qifProfile.date(account.openingDate()) << endl;
openingBalanceTransactionId = file->openingBalanceTransaction(account);
MyMoneySplit split;
if(!openingBalanceTransactionId.isEmpty()) {
MyMoneyTransaction openingBalanceTransaction = file->transaction(openingBalanceTransactionId);
split = openingBalanceTransaction.splitByAccount(account.id(), true /* match */);
}
s << "T" << m_qifProfile.value('T', split.value()) << endl;
} else {
s << "D" << m_qifProfile.date(startDate) << endl;
s << "T" << m_qifProfile.value('T', file->balance(accountId, startDate.addDays(-1))) << endl;
}
s << "CX" << endl;
s << "P" << m_qifProfile.openingBalanceText() << endl;
s << "L";
if(m_qifProfile.accountDelimiter().length())
s << m_qifProfile.accountDelimiter()[0];
s << account.name();
if(m_qifProfile.accountDelimiter().length() > 1)
s << m_qifProfile.accountDelimiter()[1];
s << endl;
s << "^" << endl;
QValueList<MyMoneyTransaction>::ConstIterator it;
signalProgress(0, list.count());
int count = 0;
for(it = list.begin(); it != list.end(); ++it) {
// don't include the openingBalanceTransaction again
if((*it).id() != openingBalanceTransactionId)
writeTransactionEntry(s, *it, accountId);
signalProgress(++count, 0);
}
}