Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef RECORDLIST_H
00027 #define RECORDLIST_H
00028
00029 #include <QGpCoreTools.h>
00030
00031 #include "Global.h"
00032 #include "AccountingRecord.h"
00033
00034 class Group;
00035
00036 class RecordList : public QList<AccountingRecord *>
00037 {
00038 TRANSLATIONS("RecordList")
00039 public:
00040 RecordList();
00041 ~RecordList();
00042
00043 void setMode(Mode m) {_mode=m;}
00044
00045 bool read(QString fileName, bool warning, AtomicBoolean &terminate);
00046 void removeNull();
00047 void print() const;
00048 void print(Group::Category c) const;
00049 void match(RecordList& o);
00050 QString report() const;
00051 double countValid() const;
00052 void preprocess(const QString& contract);
00053 bool setSupplierEquivalences(const QString& fileName, bool warning);
00054 void preprocess();
00055 void clear();
00056 QStringList contracts() const;
00057
00058 static bool write(const QString& fileName, const RecordList &r1, const RecordList& r2);
00059 private:
00060 void setContract(const QString& contract);
00061 void keepContractOnly(const QString& c);
00062 void removeSupplier(const QString& s);
00063 bool readHeaderSifac(QTextStream& s, LineParser& lp, int& lineNumber);
00064 bool readHeaderGeslab(QTextStream& s, LineParser& lp, int& lineNumber);
00065 bool readHeaderSorgho(LineParser& lp, int columnIndex[], const char *columnTitle[]);
00066 bool readSifac(QTextStream& s, LineParser& lp, int& lineNumber, AtomicBoolean& terminate);
00067 bool readGeslab(QTextStream& s, LineParser& lp, int& lineNumber, AtomicBoolean& terminate);
00068 bool readSorgho(QTextStream& s, LineParser& lp, int& lineNumber, AtomicBoolean& terminate);
00069 void sumSifac();
00070 void sumGeslab();
00071 void sumSorgho();
00072 void groupCandidates(Group::Category good, Group::Category ambiguous,
00073 const QList<AccountingRecord *>& candidates1,
00074 const QList<AccountingRecord *>& candidates2);
00075
00076 void setN2();
00077 int indexAfter(double amount) const;
00078
00079 Mode _mode;
00080 QString _fileName;
00081 int _n2;
00082 QList<Group *> _groups;
00083 QHash<QString, QString> _supplierEquivalence;
00084 };
00085
00086 #endif // RECORDLIST_H