reprintInvoices::reprintInvoices(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); connect(_print, SIGNAL(clicked()), this, SLOT(sPrint())); connect(_query, SIGNAL(clicked()), this, SLOT(sQuery())); connect(_numOfCopies, SIGNAL(valueChanged(int)), this, SLOT(sHandleInvoiceCopies(int))); connect(_watermarks, SIGNAL(itemSelected(int)), this, SLOT(sEditWatermark())); _invoice->addColumn( tr("Invoice #"), _orderColumn, Qt::AlignRight, true, "invchead_invcnumber"); _invoice->addColumn( tr("Doc. Date"), _dateColumn, Qt::AlignCenter,true, "invchead_invcdate"); _invoice->addColumn( tr("Customer"), -1, Qt::AlignLeft, true, "customer"); _invoice->addColumn( tr("Total Amount"), _bigMoneyColumn, Qt::AlignRight, true, "extprice" ); _invoice->addColumn( tr("Balance"), _bigMoneyColumn, Qt::AlignRight, true, "balance" ); _invoice->setSelectionMode(QAbstractItemView::ExtendedSelection); _watermarks->addColumn( tr("Copy #"), _dateColumn, Qt::AlignCenter ); _watermarks->addColumn( tr("Watermark"), -1, Qt::AlignLeft ); _watermarks->addColumn( tr("Show Prices"), _dateColumn, Qt::AlignCenter ); _numOfCopies->setValue(_metrics->value("InvoiceCopies").toInt()); if (_numOfCopies->value()) { for (int i = 0; i < _watermarks->topLevelItemCount(); i++) { _watermarks->topLevelItem(i)->setText(1, _metrics->value(QString("InvoiceWatermark%1").arg(i))); _watermarks->topLevelItem(i)->setText(2, ((_metrics->value(QString("InvoiceShowPrices%1").arg(i)) == "t") ? tr("Yes") : tr("No"))); } } }
/* * Constructs a reprintInvoices as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ reprintInvoices::reprintInvoices(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : QDialog(parent, name, modal, fl) { setupUi(this); // signals and slots connections connect(_print, SIGNAL(clicked()), this, SLOT(sPrint())); connect(_query, SIGNAL(clicked()), this, SLOT(sQuery())); connect(_numOfCopies, SIGNAL(valueChanged(int)), this, SLOT(sHandleInvoiceCopies(int))); connect(_watermarks, SIGNAL(itemSelected(int)), this, SLOT(sEditWatermark())); _invoice->addColumn( tr("Invoice #"), _orderColumn, Qt::AlignRight ); _invoice->addColumn( tr("Doc. Date"), _dateColumn, Qt::AlignCenter ); _invoice->addColumn( tr("Customer"), -1, Qt::AlignLeft ); _invoice->setSelectionMode(Q3ListView::Extended); _watermarks->addColumn( tr("Copy #"), _dateColumn, Qt::AlignCenter ); _watermarks->addColumn( tr("Watermark"), -1, Qt::AlignLeft ); _watermarks->addColumn( tr("Show Prices"), _dateColumn, Qt::AlignCenter ); _numOfCopies->setValue(_metrics->value("InvoiceCopies").toInt()); if (_numOfCopies->value()) { int counter = 0; XListViewItem *cursor = _watermarks->firstChild(); for (; cursor; cursor = cursor->nextSibling(), counter++) { cursor->setText(1, _metrics->value(QString("InvoiceWatermark%1").arg(counter))); cursor->setText(2, ((_metrics->value(QString("InvoiceShowPrices%1").arg(counter)) == "t") ? tr("Yes") : tr("No"))); } } }
double CMusikLibrary::GetSum(const wxString & sField, const MusikSongIdArray & idarray ) const { if ( !idarray.GetCount()) return 0.0; wxString sQuery(wxT("select sum(") + sField +wxT(") from songs where songid in (")); idarray.AddCommaSeparated(sQuery); sQuery << wxT(");"); //--- run query ---// double totsize = 0.0; m_pDB->Exec(ConvQueryToMB( sQuery ),&totsize); return totsize; }
dspCapacityBufferStatusByWorkCenter::dspCapacityBufferStatusByWorkCenter(QWidget* parent, const char* name, Qt::WFlags fl) : XWidget(parent, name, fl) { setupUi(this); connect(_print, SIGNAL(clicked()), this, SLOT(sPrint())); connect(_query, SIGNAL(clicked()), this, SLOT(sQuery())); _wrkcnt->populate( "SELECT wrkcnt_id, (wrkcnt_code || '-' || wrkcnt_descrip) " "FROM wrkcnt " "ORDER BY wrkcnt_code;" ); _roughCut->addColumn(tr("Site"), _whsColumn, Qt::AlignCenter,true, "warehous_code"); _roughCut->addColumn(tr("Work Center"), -1, Qt::AlignLeft, true, "wrkcnt_code"); _roughCut->addColumn(tr("Total Setup"), _timeColumn, Qt::AlignRight, true, "sutime"); _roughCut->addColumn(tr("Total Run"), _timeColumn, Qt::AlignRight, true, "rntime"); _roughCut->addColumn(tr("Daily Capacity"),_uomColumn, Qt::AlignRight, true, "dailycap"); _roughCut->addColumn(tr("Days Load"), _uomColumn, Qt::AlignRight, true, "daysload"); _roughCut->addColumn(tr("Buffer Status"), _uomColumn, Qt::AlignRight, true, "bufrsts"); }
dspRoughCutByWorkCenter::dspRoughCutByWorkCenter(QWidget* parent, const char* name, Qt::WFlags fl) : XWidget(parent, name, fl) { setupUi(this); QButtonGroup* _workCenterGroupInt = new QButtonGroup(this); _workCenterGroupInt->addButton(_allWorkCenters); _workCenterGroupInt->addButton(_selectedWorkCenter); connect(_print, SIGNAL(clicked()), this, SLOT(sPrint())); connect(_query, SIGNAL(clicked()), this, SLOT(sQuery())); connect(_roughCut, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*,QTreeWidgetItem*))); _roughCut->addColumn(tr("Site"), _whsColumn, Qt::AlignCenter, true, "warehous_code" ); _roughCut->addColumn(tr("Work Center"), -1, Qt::AlignLeft, true, "wrkcnt_code" ); _roughCut->addColumn(tr("Total Setup"), _timeColumn, Qt::AlignRight, true, "setuptime" ); _roughCut->addColumn(tr("Setup $"), _costColumn, Qt::AlignRight, true, "setupcost" ); _roughCut->addColumn(tr("Total Run"), _timeColumn, Qt::AlignRight, true, "runtime" ); _roughCut->addColumn(tr("Run $"), _costColumn, Qt::AlignRight, true, "runcost" ); _dates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE); _dates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE); }
int MainWindow::loadSpreadsheet(QString orderBy) { if (!dbAvailable()) { qDebug() << "Cannot load: db not available"; return -1; } m_sheetLoadBusy = 1; loadUsercols(); QSqlQuery q(m_db); QString sQuery("SELECT * FROM zbr_property ORDER BY " + orderBy); if (!q.exec(sQuery)) { qDebug() << "Query failed for load:" << q.lastError().text(); m_sheetLoadBusy = 0; return -1; } int loaded = 0; m_urlToRow.clear(); m_dbidToRow.clear(); m_zpidToRow.clear(); // Add to spreadsheet int numRows = q.size(); ui->tblData->setRowCount(numRows); qDebug() << "Got num rows:" << numRows << " cols:" << ui->tblData->columnCount(); assertTableHeaders(); int rowIndex = 0; while (q.next()) { if (rowIndex >= numRows) { ui->tblData->setRowCount(numRows = rowIndex + 1); } /*** id INTEGER PRIMARY KEY AUTOINCREMENT,\ zpid INTEGER NOT NULL,\ when_checked INTEGER NOT NULL,\ detail_url TEXT NOT NULL,\ lot_size TEXT,\ year_built INTEGER,\ price INTEGER,\ bedrooms TEXT,\ baths TEXT,\ sqft INTEGER,\ zestimate INTEGER,\ schools TEXT,\ schools_avg REAL,\ hoa_fee TEXT,\ address TEXT,\ city TEXT,\ county TEXT,\ zip TEXT,\ state TEXT,\ user1 TEXT,\ ****/ QString sUrl(q.value("detail_url").toString()); m_dbidToRow[q.value("id").toInt()] = rowIndex; m_zpidToRow[q.value("zpid").toInt()] = rowIndex; m_urlToRow[sUrl] = rowIndex; setTableCell(rowIndex, COL_URL, sUrl ); setTableCell(rowIndex, COL_DBID, q.value("id").toString() ); setTableCell(rowIndex, COL_LOT, sortableLotSize(q.value("lot_size").toString()) ); setTableCell(rowIndex, COL_YEAR, q.value("year_built").toString() ); setTableCell(rowIndex, COL_PRICE, q.value("price").toString() ); setTableCell(rowIndex, COL_BR, q.value("bedrooms").toString() ); setTableCell(rowIndex, COL_BA, q.value("baths").toString() ); setTableCell(rowIndex, COL_SQFT, q.value("sqft").toString() ); setTableCell(rowIndex, COL_ZESTIMATE, q.value("zestimate").toString() ); setTableCell(rowIndex, COL_SCHOOLS, q.value("schools").toString() ); setTableCell(rowIndex, COL_HOA, q.value("hoa_fee").toString() ); setTableCell(rowIndex, COL_ADDRESS, q.value("address").toString() ); setTableCell(rowIndex, COL_CITY, q.value("city").toString() ); setTableCell(rowIndex, COL_COUNTY, q.value("county").toString() ); setTableCell(rowIndex, COL_ZIP, q.value("zip").toString() ); setTableCell(rowIndex, COL_STATE, q.value("state").toString() ); QString sLat(q.value("latitude").toString()); QString sLong(q.value("longitude").toString()); if (!sLat.isEmpty() && !sLong.isEmpty() && sLat.toInt() != 0) { setTableCell(rowIndex, COL_GEO, QString().sprintf("%.6f,%.6f", sLat.toDouble() / 1000000.0, sLong.toDouble() / 1000000.0 ) ); setDistanceColumn(rowIndex); } // Display user columns int col; for (col = COL_START_USER; col < ui->tblData->columnCount(); col++) { QString name(QString().sprintf("user%d", col - COL_START_USER + 1)); setTableCell(rowIndex, col, q.value(name).toString() ); } rowIndex++; } m_sheetLoadBusy = 0; return loaded; }