/*************************************************************************** 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. ***************************************************************************/ #ifndef MCSALESMODEL_H #define MCSALESMODEL_H #include #include #include /** * @brief Das Itemmodel zur Anzeige der verkauften Artikel * * @see QStandardItemModel * @see QTreeView * * MCSalesModel ist ein QStandardItemModel zur Anzeige der verkauften Artikel an einer Kasse. * Mit @see appendEntry wurde eine neue Methode hinzugefügt: Hier werden die Werte der * Eingabefelder formatiert und per ("flacher") TreeView angezeigt. * */ class LIBMINICASH_EXPORT MCSalesModel : public QStandardItemModel { Q_OBJECT public: static QString formatInt( int count, int len=4 ); /// Macht aus int x den String 000x zum schönaussehen. static QString toCurrency( double amount ); /// Formatiert einen double als String im Währungsformat: 2.3 -> 2,30 EUR static double toDoubleLocale( QString amount ); /// Macht aus einem Zahlen-String in deutscher Schreibweise: 1,50 (statt 1.5) einen double. static double fromCurrency( QString amount ); /// Versucht, das EUR-Zeichen abzusäbeln: "23,20 EUR" wird zu 23.2 explicit MCSalesModel( QObject* parent = nullptr ); void appendEntry( const QString& trCount, const QString &trSellerID, const QString &trItemNo, const QString &trPrice ); void appendTransactions( QTextStream& input ); }; #endif // MCSALESMODEL_H