Brief description of class still missing. More...
#include <AccountingRecord.h>
Public Member Functions | |
| AccountingRecord () | |
| AccountingRecord (const AccountingRecord &o) | |
| void | addChild (AccountingRecord *r) |
| const double & | amount () const |
| Group::Category | category () const |
| const QList< AccountingRecord * > & | children () const |
| const QString & | contract () const |
| int | fileIndex () const |
| const QString & | implantation () const |
| const QString & | invoiceNumber () const |
| const QString & | numprec () const |
| const QString & | orderNumber () const |
| const QString & | pieceNumber () const |
| const QString & | pieceWording () const |
| void | print () const |
| void | printChildren () const |
| void | setAmount (const double &a) |
| bool | setAmount (QString a) |
| void | setContract (const QString &c) |
| void | setFileIndex (int i) |
| void | setGroup (Group *g) |
| void | setImplantation (const QString &i) |
| void | setInvoiceNumber (const QString &i) |
| void | setNumprec (const QString &n) |
| void | setOrderNumber (const QString &o) |
| void | setPieceNumber (const QString &p) |
| void | setPieceWording (const QString &p) |
| void | setSupplier (QString s, const QHash< QString, QString > &map) |
| const QString & | supplier () const |
| void | write (QTextStream &s, Mode m) const |
| ~AccountingRecord () | |
Static Public Member Functions | |
| static bool | compareString (QString s1, QString s2) |
| static void | header (QTextStream &s, Mode m) |
| static void | headerGeslab (QTextStream &s) |
| static void | headerSifac (QTextStream &s) |
| static void | headerSorgho (QTextStream &s) |
| static bool | lessThanAmount (const AccountingRecord *r1, const AccountingRecord *r2) |
| static bool | lessThanFileIndex (const AccountingRecord *r1, const AccountingRecord *r2) |
| static bool | lessThanNumprec (const AccountingRecord *r1, const AccountingRecord *r2) |
| static bool | lessThanOrderNumber (const AccountingRecord *r1, const AccountingRecord *r2) |
| static bool | lessThanPieceNumber (const AccountingRecord *r1, const AccountingRecord *r2) |
| static void | skip (QTextStream &s, Mode m) |
| static void | skipGeslab (QTextStream &s) |
| static void | skipSifac (QTextStream &s) |
| static void | skipSorgho (QTextStream &s) |
Brief description of class still missing.
Full description of class still missing
Valid: similar supplier and one identical amount Error: similar supplier and one distinct amount Missing: similar supplier and several identical amounts, but wrong number None: no similar supplier, not found
Description of constructor still missing
References TRACE.
Referenced by addChild().
{
TRACE;
_group=0;
_fileIndex=0;
_amount=0.0;
}
| AccountingRecord::AccountingRecord | ( | const AccountingRecord & | o | ) |
References TRACE.
{
TRACE;
_fileIndex=o._fileIndex;
_numprec=o._numprec;
_supplier=o._supplier;
_contract=o._contract;
_pieceNumber=o._pieceNumber;
_pieceWording=o._pieceWording;
_invoiceNumber=o._invoiceNumber;
_orderNumber=o._orderNumber;
_amount=o._amount;
_group=o._group;
_children=o._children;
}
| void AccountingRecord::addChild | ( | AccountingRecord * | r | ) |
References AccountingRecord().
{
if(_children.isEmpty()) {
_children.append(new AccountingRecord(*this));
_fileIndex=-1;
}
_children.append(r);
_amount+=r->_amount;
if(!_pieceNumber.contains(r->_pieceNumber)) {
_pieceNumber+=", "+r->_pieceNumber;
}
if(!_invoiceNumber.contains(r->_invoiceNumber)) {
_invoiceNumber+=", "+r->_invoiceNumber;
}
}
| const double& AccountingRecord::amount | ( | ) | const [inline] |
Referenced by Group::lessThan(), RecordList::match(), and RecordList::removeNull().
{return _amount;}
| Group::Category AccountingRecord::category | ( | ) | const |
References Group::category(), and Group::None.
Referenced by RecordList::countValid(), RecordList::match(), RecordList::print(), print(), and RecordList::report().
{
if(_group) {
return _group->category();
} else {
return Group::None;
}
}
| const QList<AccountingRecord *>& AccountingRecord::children | ( | ) | const [inline] |
{return _children;}
| bool AccountingRecord::compareString | ( | QString | s1, |
| QString | s2 | ||
| ) | [static] |
Referenced by RecordList::match().
{
s1=removeTypicalErrors(s1);
s2=removeTypicalErrors(s2);
if(s2.length()<s1.length()) {
qSwap(s1, s2);
}
QStringList wordList=s1.split(" ");
for(QStringList::iterator it=wordList.begin(); it!=wordList.end(); it++) {
if(!s2.contains(*it)) {
return false;
}
}
return true;
}
| const QString& AccountingRecord::contract | ( | ) | const [inline] |
Referenced by RecordList::contracts().
{return _contract;}
| int AccountingRecord::fileIndex | ( | ) | const [inline] |
{return _fileIndex;}
| void AccountingRecord::header | ( | QTextStream & | s, |
| Mode | m | ||
| ) | [static] |
References Geslab, headerGeslab(), headerSifac(), headerSorgho(), Sifac, and Sorgho.
Referenced by RecordList::write().
{
switch(m) {
case Sifac:
headerSifac(s);
break;
case Geslab:
headerGeslab(s);
break;
case Sorgho:
headerSorgho(s);
break;
}
}
| void AccountingRecord::headerGeslab | ( | QTextStream & | s | ) | [static] |
References QGpCoreTools::tr().
Referenced by header().
{
s << tr("Invoice\tOrder\tSupplier\tAmount");
}
| void AccountingRecord::headerSifac | ( | QTextStream & | s | ) | [static] |
References QGpCoreTools::tr().
Referenced by header().
{
s << tr("DocPrec\tPiece\tSupplier\tAmount");
}
| void AccountingRecord::headerSorgho | ( | QTextStream & | s | ) | [static] |
References QGpCoreTools::tr().
Referenced by header().
{
s << tr("Implantation\tOrder\tPiece\tPieceWording\tSupplier\tAmount");
}
| const QString& AccountingRecord::implantation | ( | ) | const [inline] |
{return _invoiceNumber;}
| const QString& AccountingRecord::invoiceNumber | ( | ) | const [inline] |
{return _invoiceNumber;}
| bool AccountingRecord::lessThanAmount | ( | const AccountingRecord * | r1, |
| const AccountingRecord * | r2 | ||
| ) | [static] |
Referenced by RecordList::match(), Group::setList1(), and Group::setList2().
{
if(r1->_amount<r2->_amount) {
return true;
} else if(r1->_amount>r2->_amount) {
return false;
} else {
return r1->_supplier<r2->_supplier;
}
}
| bool AccountingRecord::lessThanFileIndex | ( | const AccountingRecord * | r1, |
| const AccountingRecord * | r2 | ||
| ) | [static] |
{
return r1->_fileIndex<r2->_fileIndex;
}
| bool AccountingRecord::lessThanNumprec | ( | const AccountingRecord * | r1, |
| const AccountingRecord * | r2 | ||
| ) | [static] |
{
if(r1->_numprec<r2->_numprec) {
return true;
} else if(r1->_numprec>r2->_numprec) {
return false;
} else {
return r1->_pieceNumber<r2->_pieceNumber;
}
}
| bool AccountingRecord::lessThanOrderNumber | ( | const AccountingRecord * | r1, |
| const AccountingRecord * | r2 | ||
| ) | [static] |
{
if(r1->_orderNumber<r2->_orderNumber) {
return true;
} else if(r1->_orderNumber>r2->_orderNumber) {
return false;
} else {
return r1->_fileIndex<r2->_fileIndex;
}
}
| bool AccountingRecord::lessThanPieceNumber | ( | const AccountingRecord * | r1, |
| const AccountingRecord * | r2 | ||
| ) | [static] |
{
if(r1->_pieceNumber<r2->_pieceNumber) {
return true;
} else if(r1->_pieceNumber>r2->_pieceNumber) {
return false;
} else {
return r1->_fileIndex<r2->_fileIndex;
}
}
| const QString& AccountingRecord::numprec | ( | ) | const [inline] |
{return _numprec;}
| const QString& AccountingRecord::orderNumber | ( | ) | const [inline] |
{return _orderNumber;}
| const QString& AccountingRecord::pieceNumber | ( | ) | const [inline] |
{return _pieceNumber;}
| const QString& AccountingRecord::pieceWording | ( | ) | const [inline] |
{return _pieceWording;}
| void AccountingRecord::print | ( | ) | const |
References Group::Ambiguous, category(), Group::Cents, Group::CentsAmbiguous, Group::DistinctAmount, QGpCoreTools::endl(), Group::None, Group::SameAmount, Group::SameAmountAmbiguous, QGpCoreTools::tr(), and Group::Valid.
Referenced by RecordList::print().
{
QString cat;
switch(category()) {
case Group::None: cat=tr("none "); break;
case Group::Valid: cat=tr("valid "); break;
case Group::Ambiguous: cat=tr("ambiguous "); break;
case Group::SameAmount: cat=tr("same amount "); break;
case Group::SameAmountAmbiguous: cat=tr("same amount ambiguous "); break;
case Group::Cents: cat=tr("cents "); break;
case Group::CentsAmbiguous: cat=tr("cents ambiguous "); break;
case Group::DistinctAmount: cat=tr("distinct amount "); break;
}
App::stream() << cat
<< (_fileIndex>0 ? QString::number(_fileIndex).rightJustified(5, ' ') : "---")
<< QString::number(_amount,'f', 2).rightJustified(10, ' ')
<< " " << _supplier << endl;
}
| void AccountingRecord::printChildren | ( | ) | const |
Referenced by RecordList::print().
{
for(QList<AccountingRecord *>::const_iterator it=_children.begin(); it!=_children.end(); it++) {
App::stream() << " > ";
(*it)->print();
}
}
| void AccountingRecord::setAmount | ( | const double & | a | ) | [inline] |
{_amount=a;}
| bool AccountingRecord::setAmount | ( | QString | a | ) |
{
// Get rid of ',' from numbers
if(!a.isEmpty()) {
QRegExp rx("\\.([0-9]{3}),");
a.replace(rx, "\\1.");
bool ok=true;
double n=a.toDouble(&ok);
if(ok) {
_amount=n;
return true;
}
return ok;
}
return true;
}
| void AccountingRecord::setContract | ( | const QString & | c | ) | [inline] |
{_contract=c;}
| void AccountingRecord::setFileIndex | ( | int | i | ) | [inline] |
{_fileIndex=i;}
| void AccountingRecord::setGroup | ( | Group * | g | ) | [inline] |
{_group=g;}
| void AccountingRecord::setImplantation | ( | const QString & | i | ) | [inline] |
{_invoiceNumber=i;}
| void AccountingRecord::setInvoiceNumber | ( | const QString & | i | ) | [inline] |
{_invoiceNumber=i;}
| void AccountingRecord::setNumprec | ( | const QString & | n | ) | [inline] |
{_numprec=n;}
| void AccountingRecord::setOrderNumber | ( | const QString & | o | ) | [inline] |
{_orderNumber=o;}
| void AccountingRecord::setPieceNumber | ( | const QString & | p | ) | [inline] |
{_pieceNumber=p;}
| void AccountingRecord::setPieceWording | ( | const QString & | p | ) | [inline] |
{_pieceWording=p;}
| void AccountingRecord::setSupplier | ( | QString | s, |
| const QHash< QString, QString > & | map | ||
| ) |
{
s=s.toLower();
s.replace(QRegExp("[éèêë]"),"e"); // Special characters
s.replace(QRegExp("[íìîï]"),"i");
s.replace(QRegExp("[áàâä]"),"a");
s.replace(QRegExp("[úùûü]"),"u");
s.replace(QRegExp("[óòôö]"),"o");
s.replace("æ","ae");
s.replace("œ","oe");
s.replace("ñ","n");
s.replace("ç","c");
s.replace(QRegExp("^m[ml]{,2}e{,1}\\.{,1} "),""); // Removes M/Mme/Mlle
s.replace(QRegExp(" sarl$"), "");
s.replace(QRegExp(" s\\.?a\\.?s?\\.?$"), "");
s.replace(QRegExp(" ltd$"), "");
QHash<QString, QString>::const_iterator it=map.find(s);
if(it!=map.end()) {
_supplier=it.value();
} else {
_supplier=s;
}
}
| void AccountingRecord::skip | ( | QTextStream & | s, |
| Mode | m | ||
| ) | [static] |
References Geslab, Sifac, skipGeslab(), skipSifac(), skipSorgho(), and Sorgho.
Referenced by Group::write(), and RecordList::write().
{
switch(m) {
case Sifac:
skipSifac(s);
break;
case Geslab:
skipGeslab(s);
break;
case Sorgho:
skipSorgho(s);
break;
}
}
| void AccountingRecord::skipGeslab | ( | QTextStream & | s | ) | [static] |
Referenced by skip().
{
s << "\t\t\t";
}
| void AccountingRecord::skipSifac | ( | QTextStream & | s | ) | [static] |
Referenced by skip().
{
s << "\t\t\t";
}
| void AccountingRecord::skipSorgho | ( | QTextStream & | s | ) | [static] |
Referenced by skip().
{
s << "\t\t\t\t\t";
}
| const QString& AccountingRecord::supplier | ( | ) | const [inline] |
Referenced by Group::lessThan(), and RecordList::match().
{return _supplier;}
| void AccountingRecord::write | ( | QTextStream & | s, |
| Mode | m | ||
| ) | const |