first re-commit.
This commit is contained in:
77
libMiniCash/mcsalesitemmap.cpp
Normal file
77
libMiniCash/mcsalesitemmap.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
/***************************************************************************
|
||||
|
||||
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 <mcsalesitemmap.h>
|
||||
#include <mcsalesmodel.h>
|
||||
#include <mcsalesitemmap.h>
|
||||
|
||||
|
||||
/**
|
||||
* @brief speichert verkaufte Artikel.
|
||||
*
|
||||
* Speichert verkaufte Artikel pro Kunde nach der laufenden Nummer des Artikels
|
||||
*/
|
||||
|
||||
MCSalesItemMap::MCSalesItemMap()
|
||||
: QMap<QString, MCSalesItem>()
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user