Esempio n. 1
0
int MatKatalog::load()
{
    Katalog::load();
    int cnt = 0;

    QSqlQuery q("SELECT matID, chapterID, material, unitID, perPack, priceIn, "
                "priceOut, modifyDate, enterDate FROM stockMaterial");
    q.exec();
    while ( q.next() ) {
        cnt++;
        int id = q.value( 0 ).toInt();
        int chapterID = q.value( 1 ).toInt();
        const QString material = q.value( 2 ).toString();
        int unitID = q.value( 3 ).toInt();
        double pPack = q.value( 4 ).toDouble();
        double priceIn = q.value( 5 ).toDouble();
        double priceOut = q.value(6 ).toDouble();
        QDate lastMod = q.value( 7 ).toDate();
        QDate entered = q.value( 8 ).toDate();

        StockMaterial *mat = new StockMaterial( id, chapterID, material, unitID,
                                                pPack, Geld( priceIn ), Geld( priceOut ) );
        mat->setEnterDate( entered );
        mat->setLastModified( lastMod );
        mAllMaterial.append( mat );

    }

    return cnt;
}