acceptedmodel->setQuery("SELECT orders.key, orders.time_order,
orders.phone, orders.address, orders.address_finished,
operators.operator_name, orders.time_driver_lock,
orders.time_driver_wait, orders.time_driver_go,
carting.carting_name, drivers.nickname FROM orders LEFT JOIN carting
ON orders.typecarting=carting.key LEFT JOIN operators ON
operators.key=orders.operator_open LEFT JOIN drivers on
orders.driver=drivers.key WHERE orders.isaccepted=TRUE ORDER BY
time_order;");
if (acceptedmodel->lastError().isValid())
{
acceptedmodel->lastError().databaseText());
return;
}
acceptedmodel->setHeaderData(0, Qt::Horizontal, tr("Num"));
acceptedmodel->setHeaderData(1, Qt::Horizontal, tr("Order time"));
acceptedmodel->setHeaderData(2, Qt::Horizontal, tr("Call to"));
acceptedmodel->setHeaderData(3, Qt::Horizontal, tr("Address"));
acceptedmodel->setHeaderData(4, Qt::Horizontal, tr("Go to"));
acceptedmodel->setHeaderData(5, Qt::Horizontal, tr("Order
operator"));
acceptedmodel->setHeaderData(6, Qt::Horizontal, tr("Driver go to"));
acceptedmodel->setHeaderData(7, Qt::Horizontal, tr("Driver wait"));
acceptedmodel->setHeaderData(8, Qt::Horizontal, tr("Driver out"));
acceptedmodel->setHeaderData(9, Qt::Horizontal, tr("Carting"));
acceptedmodel->setHeaderData(10, Qt::Horizontal, tr("Nick"));
acceptedtableView->setModel(acceptedmodel);
acceptedselection=acceptedtableView->selectionModel();
connect(acceptedselection,
SIGNAL(currentChanged
(const QModelIndex &,
const QModelIndex &)),
this,
SLOT(SetAcceptedIndex
(const acceptedtableView->resizeColumnsToContents();
}
acceptedmodel=new QSqlQueryModel(this);
acceptedmodel->setQuery("SELECT orders.key, orders.time_order,
orders.phone, orders.address, orders.address_finished,
operators.operator_name, orders.time_driver_lock,
orders.time_driver_wait, orders.time_driver_go,
carting.carting_name, drivers.nickname FROM orders LEFT JOIN carting
ON orders.typecarting=carting.key LEFT JOIN operators ON
operators.key=orders.operator_open LEFT JOIN drivers on
orders.driver=drivers.key WHERE orders.isaccepted=TRUE ORDER BY
time_order;");
if (acceptedmodel->lastError().isValid())
{
QMessageBox::information(this, tr("Qtaxi"),
acceptedmodel->lastError().databaseText());
return;
}
acceptedmodel->setHeaderData(0, Qt::Horizontal, tr("Num"));
acceptedmodel->setHeaderData(1, Qt::Horizontal, tr("Order time"));
acceptedmodel->setHeaderData(2, Qt::Horizontal, tr("Call to"));
acceptedmodel->setHeaderData(3, Qt::Horizontal, tr("Address"));
acceptedmodel->setHeaderData(4, Qt::Horizontal, tr("Go to"));
acceptedmodel->setHeaderData(5, Qt::Horizontal, tr("Order
operator"));
acceptedmodel->setHeaderData(6, Qt::Horizontal, tr("Driver go to"));
acceptedmodel->setHeaderData(7, Qt::Horizontal, tr("Driver wait"));
acceptedmodel->setHeaderData(8, Qt::Horizontal, tr("Driver out"));
acceptedmodel->setHeaderData(9, Qt::Horizontal, tr("Carting"));
acceptedmodel->setHeaderData(10, Qt::Horizontal, tr("Nick"));
acceptedtableView->setModel(acceptedmodel);
acceptedselection=acceptedtableView->selectionModel();
connect(acceptedselection, SIGNAL(currentChanged(const QModelIndex
&, const QModelIndex &)), this, SLOT(SetAcceptedIndex(const
QModelIndex &)));
acceptedtableView->resizeColumnsToContents();
}
To copy to clipboard, switch view to plain text mode
Bookmarks