pointage/AccountingRecord.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of pointage.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created: 2013-01-17
00021 **  Authors:
00022 **    Marc Wathelet (ISTerre, Grenoble, France)
00023 **
00024 ***************************************************************************/
00025 
00026 #ifndef ACCOUNTINGRECORD_H
00027 #define ACCOUNTINGRECORD_H
00028 
00029 #include <QGpCoreTools.h>
00030 
00031 #include "Group.h"
00032 
00033 class AccountingRecord
00034 {
00035   TRANSLATIONS("AccountingRecord")
00036 public:
00037   AccountingRecord();
00038   AccountingRecord(const AccountingRecord& o);
00039   ~AccountingRecord();
00040 
00041   int fileIndex() const {return _fileIndex;}
00042   void setFileIndex(int i) {_fileIndex=i;}
00043 
00044   const QString& supplier() const {return _supplier;}
00045   void setSupplier(QString s, const QHash<QString, QString>& map);
00046 
00047   const QString& numprec() const {return _numprec;}
00048   void setNumprec(const QString& n) {_numprec=n;}
00049 
00050   const QString& contract() const {return _contract;}
00051   void setContract(const QString& c) {_contract=c;}
00052 
00053   const double& amount() const {return _amount;}
00054   void setAmount(const double& a) {_amount=a;}
00055   bool setAmount(QString a);
00056 
00057   const QString& implantation() const {return _invoiceNumber;}
00058   void setImplantation(const QString& i) {_invoiceNumber=i;}
00059 
00060   const QString& invoiceNumber() const {return _invoiceNumber;}
00061   void setInvoiceNumber(const QString& i) {_invoiceNumber=i;}
00062 
00063   const QString& orderNumber() const {return _orderNumber;}
00064   void setOrderNumber(const QString& o) {_orderNumber=o;}
00065 
00066   const QString& pieceNumber() const {return _pieceNumber;}
00067   void setPieceNumber(const QString& p) {_pieceNumber=p;}
00068 
00069   const QString& pieceWording() const {return _pieceWording;}
00070   void setPieceWording(const QString& p) {_pieceWording=p;}
00071 
00072   Group::Category category() const;
00073   void setGroup(Group * g) {_group=g;}
00074 
00075   void addChild(AccountingRecord *r);
00076   const QList<AccountingRecord *>& children() const {return _children;}
00077 
00078   static bool compareString(QString s1, QString s2);
00079   static bool lessThanFileIndex(const AccountingRecord * r1, const AccountingRecord * r2);
00080   static bool lessThanOrderNumber(const AccountingRecord *r1, const AccountingRecord *r2);
00081   static bool lessThanNumprec(const AccountingRecord *r1, const AccountingRecord *r2);
00082   static bool lessThanAmount(const AccountingRecord * r1, const AccountingRecord * r2);
00083   static bool lessThanPieceNumber(const AccountingRecord * r1, const AccountingRecord * r2);
00084 
00085   void print() const;
00086   void printChildren() const;
00087   static void header(QTextStream& s, Mode m);
00088   void write(QTextStream& s, Mode m) const;
00089   static void skip(QTextStream& s, Mode m);
00090   static void headerSifac(QTextStream& s);
00091   static void headerGeslab(QTextStream& s);
00092   static void headerSorgho(QTextStream& s);
00093   static void skipSifac(QTextStream& s);
00094   static void skipGeslab(QTextStream& s);
00095   static void skipSorgho(QTextStream& s);
00096 private:
00097   static QString removeTypicalErrors(QString s);
00098   static int * histogram(QString s);
00099   void writeSifac(QTextStream& s) const;
00100   void writeGeslab(QTextStream& s) const;
00101   void writeSorgho(QTextStream& s) const;
00102 
00103   int _fileIndex;
00104   QString _supplier, _numprec, _contract,
00105           _invoiceNumber, _orderNumber,
00106           _pieceNumber, _pieceWording;
00107   double _amount;
00108   Group * _group;
00109   QList<AccountingRecord *> _children;
00110 };
00111 
00112 #endif // ACCOUNTINGRECORD_H
00113 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines