treeStoklarStokBilgisi->clear();
treeStoklarStokBilgisi->setUpdatesEnabled( false );
QString arananStokNo
= lineStoklarParcaNo
->text
();
QString arananAciklama
= lineStoklarAciklama
->text
();
QString arananMakina
= comboStoklarMakina
->currentText
();
query = "SELECT stok.stokid, stokisim, parcano FROM stok LEFT JOIN stokindex ON stokindex.stokid = stok.stokid WHERE stok.stokid IN (SELECT stokid FROM stokindex WHERE parcano like '" + arananStokNo + "%')";
if (radioMakina->isChecked())
{
query += " AND stokid IN (SELECT makinaindex.stokid FROM makinaindex, makina WHERE makinaindex.makinaid=makina.makinaid AND makina.makina_isim ~*'" + arananMakina + "')";
}
anas.exec(query);
while(anas.next())
{
//aciklama = anas.value(1).toString();
//stokno = anas.value(0).toString();
// i->setStatusTip(0, stokno);
i->setText(0, anas.value(2).toString());
i->setText(1, anas.value(1).toString());
i->setText(2, anas.value(0).toString());
parnox.exec("SELECT parcano FROM stokindex WHERE stokid=" + stokno + " ORDER BY sorulma DESC");
int iR=1;
while(parnox.next())
{
if(iR==1)
{
i->setStatusTip(0, parnox.value(0).toString());
i->setText(0, parnox.value(0).toString());
i->setText(1, aciklama);
i->setText(2, stokno);
iR++;
}
else if(iR>1)
{
alti->setStatusTip(0, parnox.value(0).toString());
alti->setText(0, parnox.value(0).toString());
alti->setStatusTip(1, stokno);
alti->setText(2, stokno);
}
}
}
treeStoklarStokBilgisi->setUpdatesEnabled( true );
treeStoklarStokBilgisi->clear();
treeStoklarStokBilgisi->setUpdatesEnabled( false );
QSqlDatabase cachedb = QSqlDatabase::database("cachedb");
QSqlQuery anas("", cachedb);
QString query;
QString arananStokNo = lineStoklarParcaNo->text();
QString arananAciklama = lineStoklarAciklama->text();
QString arananMakina = comboStoklarMakina->currentText();
query = "SELECT stok.stokid, stokisim, parcano FROM stok LEFT JOIN stokindex ON stokindex.stokid = stok.stokid WHERE stok.stokid IN (SELECT stokid FROM stokindex WHERE parcano like '" + arananStokNo + "%')";
if (radioMakina->isChecked())
{
query += " AND stokid IN (SELECT makinaindex.stokid FROM makinaindex, makina WHERE makinaindex.makinaid=makina.makinaid AND makina.makina_isim ~*'" + arananMakina + "')";
}
anas.exec(query);
while(anas.next())
{
QTreeWidgetItem *i = new QTreeWidgetItem(treeStoklarStokBilgisi);
QString aciklama;
QString stokno;
//aciklama = anas.value(1).toString();
//stokno = anas.value(0).toString();
// i->setStatusTip(0, stokno);
i->setText(0, anas.value(2).toString());
i->setText(1, anas.value(1).toString());
i->setText(2, anas.value(0).toString());
QSqlQuery parnox;
QSqlQuery parnox("", cachedb);
parnox.exec("SELECT parcano FROM stokindex WHERE stokid=" + stokno + " ORDER BY sorulma DESC");
int iR=1;
while(parnox.next())
{
if(iR==1)
{
i->setStatusTip(0, parnox.value(0).toString());
i->setText(0, parnox.value(0).toString());
i->setText(1, aciklama);
i->setText(2, stokno);
iR++;
}
else if(iR>1)
{
QTreeWidgetItem *alti = new QTreeWidgetItem(i);
alti->setStatusTip(0, parnox.value(0).toString());
alti->setText(0, parnox.value(0).toString());
alti->setStatusTip(1, stokno);
alti->setText(2, stokno);
}
}
}
treeStoklarStokBilgisi->setUpdatesEnabled( true );
To copy to clipboard, switch view to plain text mode
Bookmarks