/*************************************************************************** libMiniCash Copyright © 2013-2022 christoph holzheuer c.holzheuer@sourceworx.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ***************************************************************************/ #include #include #include /** * @brief speichert verkaufte Artikel. * * Speichert verkaufte Artikel pro Kunde nach der laufenden Nummer des Artikels */ MCSalesItemMap::MCSalesItemMap() : QMap() { } /** * @brief einen neuen Eintrag erzeugen * * @param id Die Kunden- bzw. Verkäufernummer * @param num Die laufende Nummer des verkauften Artikels * @param strprice der Preis des Artikels */ void MCSalesItemMap::appendItem( const QString& id, const QString& num, const QString& strprice ) { // doppelt vergebene laufende nummern werden // gekennzeichnet: '025' -> '#025' QString key = num; if( contains( num ) ) { key = '#' + num; } // Wir wollen beim Dateiformat kompatibel bleiben: // 0003 1211 012 2,00 02-13-2013 10:39:55 // also: float mit komma, ohne Euro-Zeichen insert( key, MCSalesItem( id, key, MCSalesModel::toDoubleLocale( strprice ) ) ); } /** * @brief Dump nach cout zu debugging-zwecken */ void MCSalesItemMap::dump() const { MCSalesItemMap::const_iterator pos = begin(); for( ; pos != end(); ++pos ) { qDebug() << "key:" << pos.key() << " value: " << pos.value().toString(); } qDebug() << Qt::endl; }