void dspSalesOrdersByCustomerPO::sFillList() { _so->clear(); if (_poNumber->text().stripWhiteSpace().length() == 0) return; if (_dates->allValid()) { MetaSQLQuery mql = mqlLoad(":/so/displays/SalesOrders.mql"); ParameterList params; _dates->appendValue(params); params.append("noLines", tr("No Lines")); params.append("closed", tr("Closed")); params.append("open", tr("Open")); params.append("partial", tr("Partial")); params.append("poNumber", _poNumber->text()); q = mql.toQuery(params); XTreeWidgetItem *last = 0; while (q.next()) { last = new XTreeWidgetItem(_so, last, q.value("cohead_id").toInt(), q.value("cust_number"), q.value("cust_name"), q.value("cohead_number"), formatDate(q.value("cohead_orderdate").toDate()), formatDate(q.value("min_scheddate").toDate()), q.value("order_status"), q.value("cohead_shiptoname"), q.value("cohead_custponumber") ); } } }
/* editStudent edit an existing student, and display details as defaults for input in: pointer to a student to edit out: none */ void editStudent(struct STUDENT *s) { char firstName[32]; // store input first name char lastName[32]; // store input last name int completedCredits; // store input credits struct DATE enrollmentDate; // store input enrollment date // store an "empty date" to compare with entered date to indicate no change struct DATE noDate = {0}; do { // display what # student we're editing printf("\nEditing Student #%d\n", numStudents + 1); // input first name & update only if input not empty printf("First name: [%s] ", s->firstName); strcpy(firstName, inputString("", 32)); if (strcmp(firstName, "") == 0) strcpy(firstName, s->firstName); // input last name & update only if input not empty printf("Last name: [%s] ", s->lastName); strcpy(lastName, inputString("", 32)); if (strcmp(lastName, "") == 0) strcpy(lastName, s->lastName); // input completed credits & update only if input not empty printf("Completed credits: [%d] ", s->completedCredits); completedCredits = inputInteger(""); if (completedCredits == 0) completedCredits = s->completedCredits; // input enrollment date & update only if input not empty printf("Enrollment date (mm/dd/yyyy): [%s] ", formatDate(s->enrollmentDate)); enrollmentDate = inputDate(""); // since inputDate returns a struct DATE, we must check against an "empty" date if (compDates(enrollmentDate, noDate) == 0) enrollmentDate = s->enrollmentDate; // print details entered printf("\nFirst name: %s\n" "Last name: %s\n" "Completed credits: %d\n" "Enrollment date: %s\n", firstName, lastName, completedCredits, formatDate(enrollmentDate)); // confirm with user whether info correct, repeat input if not } while (!confirm("\nInfo correct (y/n) ?")); // store entered data back into the record pointed to by s strcpy(s->firstName, firstName); strcpy(s->lastName, lastName); s->completedCredits = completedCredits; s->enrollmentDate = enrollmentDate; }
/* * student_submission_time: 13/Oct/2014 10:31:15 * assignment_due_time: 13/Oct/2014 23:59:00 * calendar_days_late: 0 */ void showLateDays(const std::string& filename) { Map<std::string, std::string> lineMap; std::string text; if (fileExists(filename)) { text = readEntireFile(filename); } else { text = std::string("student_submission_time: unknown\n") + "assignment_due_time: unknown\n" + "calendar_days_late: unknown\n" + "details: " + filename + " not found!"; } if (STATIC_VARIABLE(FLAGS).graphicalUI) { for (std::string line : stringSplit(text, "\n")) { if (stringContains(line, ": ")) { std::string key = line.substr(0, line.find(": ")); std::string value = line.substr(line.find(": ") + 2); lineMap.put(key, value); } } std::string message; std::string dueTime = lineMap["assignment_due_time"]; std::string submitTime = lineMap["student_submission_time"]; std::string daysLate = lineMap["calendar_days_late"]; std::string details = lineMap["details"]; if (dueTime != "unknown") { dueTime = formatDate(dueTime); } if (submitTime != "unknown") { submitTime = formatDate(submitTime); } message += "<html><table>"; if (!details.empty()) { message += "<tr><td><b>NOTE:</b></td><td>" + details + "</td></tr>"; } message += "<tr><td><b>due</b></td><td>" + dueTime + "</td></tr>"; message += "<tr><td><b>submitted</b></td><td>" + submitTime + "</td></tr>"; message += "<tr><td><b>cal.days late</b></td><td>" + daysLate + "</td></tr>"; message += "</table></html>"; GOptionPane::showMessageDialog(message, filename, GOptionPane::PLAIN); } else { std::cout << AUTOGRADER_OUTPUT_SEPARATOR << std::endl; std::cout << "Contents of " << filename << ":" << std::endl; std::cout << text; if (!endsWith(text, '\n')) { std::cout << std::endl; } std::cout << AUTOGRADER_OUTPUT_SEPARATOR << std::endl; } }
void Raids::checkRaids() { if(!getRunning()){ uint64_t now = OTSYS_TIME(); for(RaidList::iterator it = raidList.begin(); it != raidList.end(); ++it){ if(now >= (getLastRaidEnd() + (*it)->getMargin())){ if(MAX_RAND_RANGE*CHECK_RAIDS_INTERVAL/(*it)->getInterval() >= (uint32_t)random_range(0, MAX_RAND_RANGE)){ #ifdef __DEBUG_RAID__ char buffer[32]; time_t tmp = time(NULL); formatDate(tmp, buffer); std::cout << buffer << " [Notice] Raids: Starting raid " << (*it)->getName() << std::endl; #endif setRunning(*it); (*it)->startRaid(); break; } } } } checkRaidsEvent = Scheduler::getScheduler().addEvent(createSchedulerTask(CHECK_RAIDS_INTERVAL*1000, boost::bind(&Raids::checkRaids, this))); }
std::string ForexConnectWrapper::getTradesAsYAML() { std::string rv; IO2GTableManager *tableManager = getLoadedTableManager(); IO2GTradesTable *tradesTable = (IO2GTradesTable *)tableManager->getTable(Trades); IO2GTradeTableRow *tradeRow = NULL; IO2GTableIterator tableIterator; while (tradesTable->getNextRow(tableIterator, tradeRow)) { bool isLong = (strncmp(tradeRow->getBuySell(), "B", 1) == 0); double d = tradeRow->getOpenTime(); std::string openDateTime; formatDate(d, openDateTime); IO2GOfferRow *offer = getTableRow<IO2GOfferRow, IO2GOffersTableResponseReader>(Offers, tradeRow->getOfferID(), &findOfferRowByOfferId, &getOffersReader); rv.append("- symbol: ").append(offer->getInstrument()).append("\n"); offer->release(); rv.append(" id: ").append(tradeRow->getTradeID()).append("\n"); rv.append(" direction: ").append(isLong ? "long" : "short").append("\n"); rv.append(" openPrice: ").append(double2str(tradeRow->getOpenRate())).append("\n"); rv.append(" size: ").append(int2str(tradeRow->getAmount())).append("\n"); rv.append(" openDate: ").append(openDateTime).append("\n"); rv.append(" pl: ").append(double2str(tradeRow->getGrossPL())).append("\n"); tradeRow->release(); } tradesTable->release(); tableManager->release(); return rv; }
QString FtpFileSystem::listDir(){ QString fullPath = appendPath(mBaseDir, mCurDir); QDir dir(fullPath); if (!(dir.exists())) return NULL; dir.setSorting(QDir::Size | QDir::Reversed); QString buffer; QFileInfoList list = dir.entryInfoList(); for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); if (fileInfo.fileName()=="." || fileInfo.fileName() == "..") continue; QString dirLabel = fileInfo.isDir()?"d":"-"; bool writable = isWritable(fileInfo.fileName()); bool readable = isReadable(fileInfo.fileName()); QString sfileSize = fileInfo.isDir()?"512":QString::number(fileInfo.size()); QDateTime dt = fileInfo.lastModified(); QString lastModified = formatDate(dt); // qDebug() << fileInfo.fileName(); buffer = buffer % QString("%1%5%6-r--r-- 1 root root %2 %3 %4\r\n").arg(dirLabel).arg(sfileSize).arg(lastModified).arg(fileInfo.fileName()) .arg(readable?"r":"-").arg(writable?"w":"-"); } return buffer; }
void Logger::logMessage(const char* channel, eLogType type, int32_t level, const std::string& message, const char* func) { fprintf(m_file, "%s", formatDate(time(NULL)).c_str()); if(channel) fprintf(m_file, " [%s] ", channel); if(strcmp(func, "") != 0) fprintf(m_file, " %s ", func); std::string type_str; switch(type) { case LOGTYPE_EVENT: type_str = "event"; break; case LOGTYPE_WARNING: type_str = "warning"; break; case LOGTYPE_ERROR: type_str = "error"; break; default: type_str = "unknown"; break; } fprintf(m_file, " %s:", type_str.c_str()); fprintf(m_file, " %s\n", message.c_str()); fflush(m_file); }
int32_t TextLogger::overflow(int32_t c) { if(c == '\n') { GUI::getInstance()->m_logText += "\r\n"; SendMessage(GetDlgItem(GUI::getInstance()->m_mainWindow, ID_LOG), WM_SETTEXT, 0, (LPARAM)GUI::getInstance()->m_logText.c_str()); GUI::getInstance()->m_lineCount++; SendMessage(GUI::getInstance()->m_logWindow, EM_LINESCROLL, 0, GUI::getInstance()->m_lineCount); displayDate = true; } else { if(displayDate) { GUI::getInstance()->m_logText += "["; GUI::getInstance()->m_logText += formatDate(time(NULL)); GUI::getInstance()->m_logText += "] "; displayDate = false; } GUI::getInstance()->m_logText += (char)c; } #ifdef __GUI_LOGS__ FILE* file = fopen("logs.txt", "a"); if(file) { fprintf(file, "%c", c); fclose(file); } #endif return(c); }
void displayTimePhased::sFillList() { ParameterList params; if(!setParams(params)) return; if(_data->_baseColumns == -1) _data->_baseColumns = list()->columnCount(); list()->clear(); list()->setColumnCount(_data->_baseColumns); _columnDates.clear(); _column = 0; QList<XTreeWidgetItem*> selected = _data->_periods->selectedItems(); for (int i = 0; i < selected.size(); i++) { PeriodListViewItem *cursor = (PeriodListViewItem*)selected[i]; QString bucketname = QString("bucket_%1").arg(cursor->id()); list()->addColumn(formatDate(cursor->startDate()), _qtyColumn, Qt::AlignRight, true, bucketname); _columnDates.append(DatePair(cursor->startDate(), cursor->endDate())); } display::sFillList(); }
void dspTimePhasedCapacityByWorkCenter::sFillList() { _columnDates.clear(); _load->setColumnCount(1); QString sql("SELECT wrkcnt_id, wrkcnt_code "); int columns = 1; QList<QTreeWidgetItem*> selected = _periods->selectedItems(); for (int i = 0; i < selected.size(); i++) { PeriodListViewItem *cursor = (PeriodListViewItem*)selected[i]; sql += QString(", formatTime(workCenterCapacity(wrkcnt_id, %1)) AS bucket%2") .arg(cursor->id()) .arg(columns++); _load->addColumn(formatDate(cursor->startDate()), _qtyColumn, Qt::AlignRight); _columnDates.append(DatePair(cursor->startDate(), cursor->endDate())); } sql += " FROM wrkcnt "; if (_warehouse->isSelected()) sql += "WHERE (wrkcnt_warehous_id=:warehous_id) "; sql += "ORDER BY wrkcnt_code;"; q.prepare(sql); _warehouse->bindValue(q); q.exec(); _load->populate(q); }
void printPrices(IO2GSession *session, IO2GResponse *response) { if (response != 0) { if (response->getType() == MarketDataSnapshot) { std::cout << "Request with RequestID='" << response->getRequestID() << "' is completed:" << std::endl; O2G2Ptr<IO2GResponseReaderFactory> factory = session->getResponseReaderFactory(); if (factory) { O2G2Ptr<IO2GMarketDataSnapshotResponseReader> reader = factory->createMarketDataSnapshotReader(response); if (reader) { char sTime[20]; for (int ii = reader->size() - 1; ii >= 0; ii--) { DATE dt = reader->getDate(ii); formatDate(dt, sTime); if (reader->isBar()) { printf("DateTime=%s, BidOpen=%f, BidHigh=%f, BidLow=%f, BidClose=%f, AskOpen=%f, AskHigh=%f, AskLow=%f, AskClose=%f, Volume=%i\n", sTime, reader->getBidOpen(ii), reader->getBidHigh(ii), reader->getBidLow(ii), reader->getBidClose(ii), reader->getAskOpen(ii), reader->getAskHigh(ii), reader->getAskLow(ii), reader->getAskClose(ii), reader->getVolume(ii)); } else { printf("DateTime=%s, Bid=%f, Ask=%f\n", sTime, reader->getBid(ii), reader->getAsk(ii)); } } } } } } }
// ECMA 15.9.2 static JSValue* callDate(ExecState* exec, JSObject*, JSValue*, const ArgList&) { time_t localTime = time(0); tm localTM; getLocalTime(&localTime, &localTM); GregorianDateTime ts(localTM); return jsNontrivialString(exec, formatDate(ts) + " " + formatTime(ts, false)); }
/* addStudents function with loop to add students one at a time in: none out: none */ void addStudents() { // declarations char firstName[32]; // store input first name char lastName[32]; // store input last name int completedCredits; // store input completed credits struct DATE enrollmentDate; // store input enrollment date struct STUDENT *s; // pointer to a student record // print header printf("Add Students\n============\n\n" "Start entering students. Leave first name blank to stop.\n\n"); // outer loop for entering another student do { // inner loop for repeating incorrect entry do { // print # entering printf("Student #%d\n", numStudents + 1); // get input from user strcpy(firstName, inputString("First name: ", 32)); if (strcmp(firstName, "") == 0) return; strcpy(lastName, inputString("Last name: ", 32)); if (strcmp(lastName, "") == 0) return; completedCredits = inputInteger("Completed credits: "); enrollmentDate = inputDate("Enrollment date (mm/dd/yyyy): "); // display input info back to user printf("\nFirst name: %s\n" "Last name: %s\n" "Completed credits: %d\n" "Enrollment date: %s\n", firstName, lastName, completedCredits, formatDate(enrollmentDate)); // repeat if info incorrect } while (!confirm("Info correct (y/n) ?")); // get pointer to new student s = &students[numStudents]; // put info into array at pointer strcpy(s->firstName, firstName); strcpy(s->lastName, lastName); s->completedCredits = completedCredits; s->enrollmentDate = enrollmentDate; // increment # of students numStudents ++; // loop if user wants to input another student } while (confirm("Add another student (y/n) ?")); }
void dspBacklogByItem::sFillList() { _soitem->clear(); if (_item->isValid()) { MetaSQLQuery mql = mqlLoad(":/so/displays/SalesOrderItems.mql"); ParameterList params; _dates->appendValue(params); _warehouse->appendValue(params); params.append("item_id", _item->id()); params.append("openOnly"); params.append("orderByScheddate"); q = mql.toQuery(params); XTreeWidgetItem *last = 0; double totalBacklog = 0.0; while (q.next()) { last = new XTreeWidgetItem(_soitem, last, q.value("cohead_id").toInt(), q.value("coitem_id").toInt(), q.value("cohead_number"), q.value("coitem_linenumber"), q.value("cust_name"), formatDate(q.value("cohead_orderdate").toDate()), formatDate(q.value("coitem_scheddate").toDate()), q.value("uom_name"), formatQty(q.value("coitem_qtyord").toDouble()), formatQty(q.value("coitem_qtyshipped").toDouble()), formatQty(q.value("qtybalance").toDouble()), formatMoney(q.value("baseextpricebalance").toDouble()) ); totalBacklog += q.value("baseextpricebalance").toDouble(); } if (_showPrices->isChecked()) { last = new XTreeWidgetItem(_soitem, last, -1, -1, "", "", tr("Total Backlog"), "", "", "", "", "", formatMoney(totalBacklog) ); } } else _soitem->clear(); }
bool ChatChannel::talk(std::string nick, MessageClasses type, std::string text) { for(UsersMap::iterator it = m_users.begin(); it != m_users.end(); ++it) it->second->sendChannelMessage(nick, text, type, m_id); if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open()) *m_file << "[" << formatDate() << "] " << nick << ": " << text << std::endl; return true; }
// ECMA 15.9.2 static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec) { GregorianDateTime ts; msToGregorianDateTime(exec, currentTimeMS(), false, ts); DateConversionBuffer date; DateConversionBuffer time; formatDate(ts, date); formatTime(ts, time); return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time)); }
bool gen_hist_job() { TwsXml file; if( ! file.openFile(filep) ) { return false; } time_t t_begin = min_begin_date( endDateTimep, durationStrp ); DEBUG_PRINTF("skipping expiries before: '%s'", time_t_local(t_begin).c_str() ); xmlNodePtr xn; int count_docs = 0; /* NOTE We are dumping single HistRequests but we should build and dump a HistTodo object */ while( (xn = file.nextXmlNode()) != NULL ) { count_docs++; PacketContractDetails *pcd = PacketContractDetails::fromXml( xn ); int myProp_reqMaxContractsPerSpec = -1; for( size_t i = 0; i < pcd->constList().size(); i++ ) { const IB::ContractDetails &cd = pcd->constList()[i]; IB::Contract c = cd.summary; // DEBUG_PRINTF("contract, %s %s", c.symbol.c_str(), c.expiry.c_str()); if( exp_mode != EXP_KEEP ) { c.includeExpired = get_inc_exp(c.secType.c_str()); } if( myProp_reqMaxContractsPerSpec > 0 && (size_t)myProp_reqMaxContractsPerSpec <= i ) { break; } if( skip_expiry(c.expiry, t_begin) ) { // DEBUG_PRINTF("skipping expiry: '%s'", c.expiry.c_str()); continue; } for( char **wts = wts_list; *wts != NULL; wts++ ) { HistRequest hR; hR.initialize( c, endDateTimep, durationStrp, barSizeSettingp, *wts, useRTHp, formatDate() ); PacketHistData phd; phd.record( 0, hR ); phd.dumpXml(); } } delete pcd; } fprintf( stderr, "notice, %d xml docs parsed from file '%s'\n", count_docs, filep ); return true; }
void printSampleParams(std::string &sProcName, LoginParams *loginParams, SampleParams *sampleParams) { std::cout << "Running " << sProcName << " with arguments:" << std::endl; // Login (common) information if (loginParams) { std::cout << loginParams->getLogin() << " * " << loginParams->getURL() << " " << loginParams->getConnection() << " " << loginParams->getSessionID() << " " << loginParams->getPin() << std::endl; } // Sample specific information if (sampleParams) { std::cout << "Instrument='" << sampleParams->getInstrument() << "', " << "Timeframe='" << sampleParams->getTimeframe() << "', "; if (isNaN(sampleParams->getDateFrom())) { std::cout << "DateFrom='', "; } else { char sDateFrom[20]; formatDate(sampleParams->getDateFrom(), sDateFrom); std::cout << "DateFrom='" << sDateFrom << "', "; } if (isNaN(sampleParams->getDateTo())) { std::cout << "DateTo='', "; } else { char sDateTo[20]; formatDate(sampleParams->getDateTo(), sDateTo); std::cout << "DateTo='" << sDateTo << "', "; } std::cout << std::endl; } }
error_t sntpClientTest(void) { error_t error; time_t unixTime; IpAddr ipAddr; NtpTimestamp timestamp; DateTime date; //Debug message TRACE_INFO("\r\n\r\nResolving server name...\r\n"); //Resolve SNTP server name error = getHostByName(NULL, "0.fr.pool.ntp.org", &ipAddr, 0); //Any error to report? if(error) { //Debug message TRACE_INFO("Failed to resolve server name!\r\n"); //Exit immediately return error; } //Debug message TRACE_INFO("Requesting time from SNTP server %s\r\n", ipAddrToString(&ipAddr, NULL)); //Retrieve current time from NTP server using SNTP protocol error = sntpClientGetTimestamp(NULL, &ipAddr, ×tamp); //Any error to report? if(error) { //Debug message TRACE_INFO("Failed to retrieve NTP timestamp!\r\n"); } else { //Unix time starts on January 1st, 1970 unixTime = timestamp.seconds - 2208988800; //Convert Unix timestamp to date convertUnixTimeToDate(unixTime, &date); //Debug message TRACE_INFO("Current date/time: %s\r\n", formatDate(&date, NULL)); //Move cursor lcdSetCursor(8, 0); //Refresh LCD display printf("%04u/%02u/%02u %02u:%02u:%02u", date.year, date.month, date.day, date.hours, date.minutes, date.seconds); } //Return status code return error; }
// ECMA 15.9.2 static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec) { time_t localTime = time(0); tm localTM; getLocalTime(&localTime, &localTM); GregorianDateTime ts(exec, localTM); DateConversionBuffer date; DateConversionBuffer time; formatDate(ts, date); formatTime(ts, time); return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time)); }
// ECMA 15.9.2 static AJValue JSC_HOST_CALL callDate(ExecState* exec, AJObject*, AJValue, const ArgList&) { time_t localTime = time(0); tm localTM; getLocalTime(&localTime, &localTM); GregorianDateTime ts(exec, localTM); DateConversionBuffer date; DateConversionBuffer time; formatDate(ts, date); formatTime(ts, time); return jsMakeNontrivialString(exec, date, " ", time); }
string FAT::listDirectory() { if (currentDir == NULL){ stringstream ss; ss << "Nombre," << "Tipo," << "Fecha de Creacion," << "Tamaño de Archivo,"; for (int i = 0; i < 512; i++){ if (!_root[i]._free){ d_entry* tmpEntry = &_root[i]; ss << tmpEntry->name << "," << tmpEntry->_dir << "," << formatDate(tmpEntry->_cDate) << "," << tmpEntry->_size << ","; } } string c = ss.str(); c.erase(remove(--c.end(),c.end(), ','), c.end()); return c; } else { stringstream ss; ss << "Nombre," << "Tipo," << "Fecha de Creacion," << "Tamaño de Archivo,"; d_entry* workingDir = currentDir; unsigned short currentIndex = workingDir->_cluster; while (_FAT[currentIndex] != 0xFFFF){ //mientras no se encuentre el bloque final del directorio for (int i = 0; i < 128; i++){ if (!_dataRegion[currentIndex].entries[i]._free){ d_entry* tmpEntry = &_dataRegion[currentIndex].entries[i]; ss << tmpEntry->name << "," << tmpEntry->_dir << "," << formatDate(tmpEntry->_cDate) << "," << tmpEntry->_size << ","; } } currentIndex = _FAT[currentIndex]; } for (int i = 0; i < 128; i++){ d_entry tmpEntry = _dataRegion[currentIndex].entries[i]; if (!_dataRegion[currentIndex].entries[i]._free){ d_entry* tmpEntry = &_dataRegion[currentIndex].entries[i]; ss << tmpEntry->name << "," << tmpEntry->_dir << "," << formatDate(tmpEntry->_cDate) << "," << tmpEntry->_size << ","; } } string c = ss.str(); c.erase(remove(--c.end(),c.end(), ','), c.end()); return c; } }
ostream& operator<<(ostream& out, Venda v) { string linha; linha += to_string(v.cliente); linha += ';'; linha += formatDate(v.data, DATE_FORMAT_PT_BR_SHORT); linha += ';'; linha += to_string(v.produto); linha += ';'; linha += to_string(v.quantidade); linha += ';'; linha += v.forma_pag; linha += ";\n"; return out << linha; }
void showTime(std::stringstream& str, uint32_t time) { if(time == 0xFFFFFFFF){ str << "permanent"; } else if(time == 0){ str << "serversave"; } else{ char buffer[32]; formatDate((time_t)time, buffer); str << buffer; } }
void dspTimePhasedProductionByItem::sCalculate() { _columnDates.clear(); while (_production->columns() > 3) _production->removeColumn(3); QString sql("SELECT itemsite_id, item_number, warehous_code, item_invuom"); int columns = 1; XListViewItem *cursor = _periods->firstChild(); if (cursor != 0) { do { if (_periods->isSelected(cursor)) { sql += QString(", formatQty(summProd(itemsite_id, %2)) AS bucket%1") .arg(columns++) .arg(cursor->id()); _production->addColumn(formatDate(((PeriodListViewItem *)cursor)->startDate()), _qtyColumn, Qt::AlignRight); _columnDates.append(DatePair(((PeriodListViewItem *)cursor)->startDate(), ((PeriodListViewItem *)cursor)->endDate())); } } while ((cursor = cursor->nextSibling()) != 0); } sql += " FROM itemsite, item, warehous " "WHERE ((itemsite_item_id=item_id)" " AND (itemsite_warehous_id=warehous_id)"; if (_warehouse->isSelected()) sql += " AND (itemsite_warehous_id=:warehous_id)"; if (_plannerCode->isSelected()) sql += "AND (itemsite_plancode_id=:plancode_id)"; else if (_plannerCode->isPattern()) sql += "AND (itemsite_plancode_id IN (SELECT plancode_id FROM plancode WHERE (plancode_code ~ :plancode_pattern))) "; sql += ") " "ORDER BY item_number;"; q.prepare(sql); _warehouse->bindValue(q); _plannerCode->bindValue(q); q.exec(); _production->populate(q); }
void dspTimePhasedBookingsByCustomer::sFillList() { if (!_periods->isPeriodSelected()) { if (isVisible()) QMessageBox::warning( this, tr("Select Calendar Periods"), tr("Please select one or more Calendar Periods") ); return; } _soitem->clear(); _soitem->setColumnCount(2); _columnDates.clear(); QString sql("SELECT cust_id, cust_number, cust_name"); int columns = 1; QList<QTreeWidgetItem*> selected = _periods->selectedItems(); for (int i = 0; i < selected.size(); i++) { PeriodListViewItem *cursor = (PeriodListViewItem*)selected[i]; QString bucketname = QString("bucket%1").arg(columns++); sql += QString(", bookingsByCustomerValue(cust_id, %1) AS %2," " 'curr' AS %3_xtnumericrole, 0 AS %4_xttotalrole ") .arg(cursor->id()) .arg(bucketname) .arg(bucketname) .arg(bucketname); _soitem->addColumn(formatDate(cursor->startDate()), _qtyColumn, Qt::AlignRight, true, bucketname); _columnDates.append(DatePair(cursor->startDate(), cursor->endDate())); } sql += " FROM cust "; if (_customerType->isSelected()) sql += "WHERE (cust_custtype_id=:custtype_id) "; else if (_customerType->isPattern()) sql += "WHERE (cust_custtype_id IN (SELECT custtype_id FROM custtype WHERE (custtype_code ~ :custtype_pattern))) "; sql += "ORDER BY cust_number;"; q.prepare(sql); _customerType->bindValue(q); q.exec(); _soitem->populate(q); }
EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::s_info)) return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) return JSValue::encode(jsNontrivialString(exec, "Invalid Date")); DateConversionBuffer date; formatDate(*gregorianDateTime, date); return JSValue::encode(jsNontrivialString(exec, date)); }
JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { if (!thisValue.isObject(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); if (isnan(milli)) return jsNontrivialString(exec, "Invalid Date"); GregorianDateTime t; thisDateObj->msToGregorianDateTime(milli, utc, t); return jsNontrivialString(exec, formatDate(t)); }
void XDateEdit::setDate(const QDate &pDate, bool pAnnounce) { if (DEBUG) qDebug("%s::setDate(%s, %d) with _currentDate %s, _allowNull %d", qPrintable(parent() ? parent()->objectName() : objectName()), qPrintable(pDate.toString()), pAnnounce, qPrintable(_currentDate.toString()), _allowNull); if (pDate.isNull()) setNull(); else { if(!pAnnounce) { if(determineIfStd() && (_siteId != -1)) return checkDate(pDate); } else { pAnnounce = (pDate != _currentDate); } _currentDate = pDate; _valid = _currentDate.isValid(); _parsed = _valid; if (DEBUG) qDebug("%s::setDate() setting text", qPrintable(parent() ? parent()->objectName() : objectName())); if ((_allowNull) && (_currentDate == _nullDate)) setText(_nullString); else setText(formatDate(pDate)); if (DEBUG) qDebug("%s::setDate() done setting text", qPrintable(parent() ? parent()->objectName() : objectName())); } if (pAnnounce) { if (DEBUG) qDebug("%s::setDate() emitting newDate(%s)", qPrintable(parent() ? parent()->objectName() : objectName()), qPrintable(_currentDate.toString())); emit newDate(_currentDate); } }
QVariant QtHistory::data(const QModelIndex& index, int role) const { if (index.row() < 0 || index.row() >= _mementoIdList.size()) { return QVariant(); } int id = _mementoIdList[index.row()]; HistoryMementoCollection * collection = _cHistory.getHistory().getHistoryMementoCollection(); HistoryMemento* memento = collection->getMemento(id); if (!memento) { LOG_ERROR("Couldn't get memento for id " + String::fromNumber(id)); return QVariant(); } if (role == Qt::DisplayRole) { switch (index.column()) { case 0: return textForMementoState(memento->getState()); case 1: return QVariant(formatName(memento->getPeer(), _isWengoAccountConnected)); case 2: return QVariant(formatDate(qDateTimeForMemento(memento))); case 3: //VOXOX - CJC - 2009.05.31 Only show duration for calls if(memento->getState() == HistoryMemento::OutgoingCall || memento->getState()== HistoryMemento::IncomingCall ||memento->getState() == HistoryMemento::MissedCall || memento->getState() == HistoryMemento::RejectedCall){ return QVariant(formatDuration(qTimeForDuration(memento->getDuration()))); }else{ return QVariant(""); } default: return QVariant(); } } else if (role == Qt::DecorationRole) { if (index.column() == 0) { return QVariant(iconForMementoState(memento->getState())); } else { return QVariant(); } } else if (role == Qt::UserRole) { return QVariant(id); } return QVariant(); }