void WomatlCluster::constructor() { setupUi(this); _valid = FALSE; _id = -1; _woid = -1; _type = (Push | Pull | Mixed); _source = WoMaterial; _sourceId = -1; _required = 0.0; _issued = 0.0; connect(_itemNumber, SIGNAL(newID(int)), SLOT(sPopulateInfo(int))); if(_x_metrics) { _qtyIssued->setPrecision(decimalPlaces("qty")); _qtyPer->setPrecision(decimalPlaces("qtyper")); _qtyRequired->setPrecision(decimalPlaces("qty")); _scrap->setPrecision(decimalPlaces("percent")); } setFocusProxy(_itemNumber); }
void CurrDisplay::setFormat(CurrDisplayFormats pFormat) { if (DEBUG) qDebug("%s::setFormat(%d)", qPrintable(objectName()), pFormat); int precision = _decimals + _localScale; _format = pFormat; switch (pFormat) { case SalesPrice: precision = decimalPlaces("salesprice"); break; case PurchPrice: precision = decimalPlaces("purchprice"); break; case ExtPrice: precision = decimalPlaces("extprice"); break; case Cost: precision = decimalPlaces("cost"); break; case Money: default: precision = decimalPlaces("curr"); break; } _decimals = precision - _localScale; if (DEBUG) qDebug("%s::setFormat(%d) returning with _format %d, _decimals %d", qPrintable(objectName()), pFormat, _format, _decimals); }
/** Gets the number of decimal places in order to report a number with the given number of non-zero digits. */ Int_t decimalPlaces(Double_t number, Int_t nonzeroDigits = 2) { if (number < 0) return decimalPlaces(-number, nonzeroDigits); if (number == 0) return nonzeroDigits; Int_t decimals = nonzeroDigits - 1; while (number < 1) { ++decimals; number *= 10; } return decimals; }
bool dspItemCostsByClassCode::setParams(ParameterList ¶ms) { if (!display::setParams(params)) return false; params.append("byClassCode"); _classCode->appendValue(params); if(_onlyShowZeroStd->isChecked()) params.append("onlyShowZeroStdCosts"); if(_onlyShowZeroLast->isChecked()) params.append("onlyShowZeroLastCosts"); if(_onlyShowDiff->isChecked()) params.append("onlyShowDiffCosts"); if(!_showInactive->isChecked()) params.append("onlyShowActive"); if(_cbPurchase->isChecked()) params.append("showPurchased"); if(_cbMfg->isChecked()) params.append("showMfg"); if(_cbOS->isChecked()) params.append("showOS"); if(_cbCosting->isChecked()) params.append("showCosting"); if(_cbPlan->isChecked()) params.append("showPlanning"); if(_cbOther->isChecked()) params.append("showOther"); XSqlQuery qq; qq.exec("SELECT locale_cost_scale " "FROM locale, usr " "WHERE ((usr_locale_id=locale_id) AND (usr_username=getEffectiveXtUser()));"); if (qq.first()) params.append("costscale", qq.value("locale_cost_scale").toInt()); else params.append("costscale", decimalPlaces("cost")); return true; }
updatePrices::updatePrices(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) : XDialog(parent, name, modal, fl) { XSqlQuery updateupdatePrices; setupUi(this); // signals and slots connections connect(_byItem, SIGNAL(toggled(bool)), this, SLOT(sHandleBy(bool))); connect(_byItemGroup, SIGNAL(toggled(bool)), this, SLOT(sHandleBy(bool))); connect(_byProductCategory, SIGNAL(toggled(bool)), this, SLOT(sHandleBy(bool))); connect(_close, SIGNAL(clicked()), this, SLOT(close())); connect(_add, SIGNAL(clicked()), this, SLOT(sAdd())); connect(_addAll, SIGNAL(clicked()), this, SLOT(sAddAll())); connect(_remove, SIGNAL(clicked()), this, SLOT(sRemove())); connect(_removeAll, SIGNAL(clicked()), this, SLOT(sRemoveAll())); connect(_update, SIGNAL(clicked()), this, SLOT(sUpdate())); connect(_showEffective, SIGNAL(clicked()), this, SLOT(populate())); connect(_showExpired, SIGNAL(clicked()), this, SLOT(populate())); connect(_showCurrent, SIGNAL(clicked()), this, SLOT(populate())); connect(_value, SIGNAL(clicked()), this, SLOT(sHandleCharPrice())); connect(_percent, SIGNAL(clicked()), this, SLOT(sHandleCharPrice())); connect(_avail, SIGNAL(itemSelected(int)), _add, SLOT(animateClick())); connect(_sel, SIGNAL(itemSelected(int)), _remove, SLOT(animateClick())); _updateBy->setValidator(new XDoubleValidator(-100, 9999, decimalPlaces("curr"), _updateBy)); MetaSQLQuery mql = mqlLoad("updateprices", "createselsched"); ParameterList params; updateupdatePrices = mql.toQuery(params); if (updateupdatePrices.lastError().type() != QSqlError::NoError) systemError(this, updateupdatePrices.lastError().databaseText(), __FILE__, __LINE__); _avail->addColumn(tr("Schedule"), -1, Qt::AlignLeft, true, "ipshead_name"); _avail->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "ipshead_descrip"); _avail->addColumn(tr("Effective"), -1, Qt::AlignLeft, true, "ipshead_effective"); _avail->addColumn(tr("Expires"), -1, Qt::AlignLeft, true, "ipshead_expires"); _avail->setSelectionMode(QAbstractItemView::ExtendedSelection); _sel->addColumn(tr("Schedule"), -1, Qt::AlignLeft, true, "ipshead_name"); _sel->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "ipshead_descrip"); _group->hide(); // _value->setChecked(true); populate(); }
CharacteristicAssignmentPrivate(characteristicAssignment *p) : parent(p), _template(false), idCol(0), nameCol(0), typeCol(0) { priceVal = new XDoubleValidator(0, 9999999.0, decimalPlaces("purchprice"), parent); if (targetTypeMap.isEmpty()) { XSqlQuery q("SELECT * FROM source WHERE source_charass != '';"); while (q.next()) { targetTypeMap.insert(q.value("source_charass").toString(), parent->tr(q.value("source_descrip") .toString().toLatin1())); } } }
GUIClient::GUIClient(const QString &pDatabaseURL, const QString &pUsername) { _menuBar = 0; _activeWindow = 0; _shown = false; _databaseURL = pDatabaseURL; _username = pUsername; __saveSizePositionEventFilter = new SaveSizePositionEventFilter(this); _splash->showMessage(tr("Initializing Internal Data"), SplashTextAlignment, SplashTextColor); qApp->processEvents(); _showTopLevel = false; if(_preferences->value("InterfaceWindowOption") == "TopLevel") _showTopLevel = true; __itemListSerial = 0; __custListSerial = 0; _q.exec("SELECT startOfTime() AS sot, endOfTime() AS eot;"); if (_q.first()) { _startOfTime = _q.value("sot").toDate(); _endOfTime = _q.value("eot").toDate(); } else systemError( this, tr( "A Critical Error occurred at %1::%2.\n" "Please immediately log out and contact your Systems Adminitrator." ) .arg(__FILE__) .arg(__LINE__) ); /* TODO: either separate validators for extprice, purchprice, and salesprice or replace every field that uses _moneyVal, _negMoneyVal, _priceVal, and _costVal with CurrCluster or CurrDisplay */ _qtyVal = new QDoubleValidator(0, 99999999.0, decimalPlaces("qty"), this); _transQtyVal = new QDoubleValidator(-99999999.0, 99999999.0, decimalPlaces("qty"), this); _qtyPerVal = new QDoubleValidator(0, 99999999.0, decimalPlaces("qtyper"), this); _scrapVal = new QDoubleValidator(0, 9999.0, decimalPlaces("percent"), this); _percentVal = new QDoubleValidator(0, 9999.0, decimalPlaces("percent"), this); _moneyVal = new QDoubleValidator(0, 9999999999.0, decimalPlaces("curr"), this); _negMoneyVal = new QDoubleValidator(-9999999999.0,9999999999.0, decimalPlaces("curr"), this); _priceVal = new QDoubleValidator(0, 9999999.0, decimalPlaces("purchprice"), this); _costVal = new QDoubleValidator(0, 9999999.0, decimalPlaces("cost"), this); _ratioVal = new QDoubleValidator(0, 9999999999.0, decimalPlaces("uomratio"), this); _weightVal = new QDoubleValidator(0, 99999999.0, decimalPlaces("weight"), this); _runTimeVal = new QDoubleValidator(0, 99999999.0, 2, this); _orderVal = new QIntValidator(0, 999999, this); _dayVal = new QIntValidator(0, 9999, this); #ifdef Q_WS_MACX _assClient = new QAssistantClient((qApp->applicationDirPath() + "/../Resources"), this); #else _assClient = new QAssistantClient(qApp->applicationDirPath(), this); #endif connect(_assClient, SIGNAL(error(const QString &)), this, SLOT(sReportError(const QString &))); QStringList commands; commands //<< "-hideSidebar" << "-profile" #ifdef Q_WS_MACX << qApp->applicationDirPath() + QString("/../Resources/helpXTupleGUIClient/XTupleGUIClient.adp"); #else << qApp->applicationDirPath() + QString("/helpXTupleGUIClient/XTupleGUIClient.adp");
void distributeToLocation::populate() { if (_mode == cLocation) { q.prepare( "SELECT formatLocationName(location_id) AS locationname, COALESCE(subild.itemlocdist_qty, 0) AS qty, " " qtyLocation(location_id, NULL, NULL, NULL, topild.itemlocdist_itemsite_id, topild.itemlocdist_order_type, topild.itemlocdist_order_id) AS availqty " "FROM location LEFT OUTER JOIN itemlocdist AS subild" " ON ( (subild.itemlocdist_source_type='L')" " AND (subild.itemlocdist_source_id=location_id)" " AND (subild.itemlocdist_itemlocdist_id=:itemlocdist_id) ) " " LEFT OUTER JOIN itemlocdist AS topild" " ON (topild.itemlocdist_id=:itemlocdist_id) " "WHERE (location_id=:location_id);" ); q.bindValue(":itemlocdist_id", _sourceItemlocdistid); q.bindValue(":location_id", _locationid); } else if (_mode == cItemloc) { q.prepare( "SELECT formatLocationName(location_id) AS locationname," " COALESCE(itemlocdist_qty, 0) AS qty, " " itemloc_qty AS availqty " "FROM itemloc LEFT OUTER JOIN" " location ON (itemloc_location_id=location_id) LEFT OUTER JOIN" " itemlocdist ON ((itemlocdist_source_type='I')" " AND (itemlocdist_source_id=itemloc_id)" " AND (itemlocdist_itemlocdist_id=:itemlocdist_id) ) " "WHERE (itemloc_id=:itemloc_id);" ); q.bindValue(":itemlocdist_id", _sourceItemlocdistid); q.bindValue(":itemloc_id", _itemlocdistid); } q.exec(); if (q.first()) { _locationQty->setDouble(q.value("qty").toDouble()); _location->setText(q.value("locationname").toString()); _availToDistribute = q.value("availqty").toDouble(); } q.prepare( "SELECT parent.lotserial AS lotserial," " qtydistrib," " qtytagged," " (qtydistrib - qtytagged) AS qtybalance " "FROM ( SELECT formatlotserialnumber(itemlocdist_ls_id) AS lotserial, itemlocdist_qty AS qtydistrib" " FROM itemlocdist" " WHERE (itemlocdist_id=:itemlocdist_id) ) AS parent," " ( SELECT COALESCE(SUM(itemlocdist_qty), 0) AS qtytagged" " FROM itemlocdist" " WHERE (itemlocdist_itemlocdist_id=:itemlocdist_id) ) AS child;" ); q.bindValue(":itemlocdist_id", _sourceItemlocdistid); q.exec(); if (q.first()) { _lotSerial = q.value("lotserial").toString(); _qtyToDistribute->setDouble(q.value("qtydistrib").toDouble()); _qtyTagged->setDouble(q.value("qtytagged").toDouble()); _qtyBalance->setDouble(q.value("qtybalance").toDouble()); _balance = round(q.value("qtybalance").toDouble() * pow(10, decimalPlaces("qty"))) / pow(10, decimalPlaces("qty")); double locQty = _balance; if (_mode == cItemloc || _mode == cLocation) // lot/serial or Location { // if we want to take stuff away and we have stuff to take away if (locQty < 0 && _availToDistribute > 0) locQty = qMax(-_availToDistribute, locQty); // if we want to take stuff away but don't have anything to take away else if (locQty < 0) locQty = 0; } _locationQty->setDouble(locQty); } else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } }
void HLTDatasets::report(const Char_t* luminosity, const Char_t* outputPrefix, const Int_t significantDigits) const { TString outputPath; outputPath.Form("%s%s_", outputPrefix ? outputPrefix : "", scenarioName.Data()); if (outputPrefix) { TString outputDir = gSystem->DirName(outputPath); if (outputDir.Length() && outputDir != "." && gSystem->mkdir(outputDir, kTRUE) != 0) { std::cerr << "ERROR : Could not create output directory " << outputDir << std::endl; return; } } // Make additional compilations of samples std::vector<SampleDiagnostics> diagnostics; const UInt_t numDiagnostics = compileSamples(diagnostics); const UInt_t numSamples = size(); //.. Create output file ..................................................... TString tablesPrefix = outputPath + "newtriggers"; std::ofstream tablesFile (tablesPrefix + ".tex"); tablesFile << "\\documentclass[amsmath,amssymb]{revtex4}" << std::endl; tablesFile << "\\usepackage{longtable}" << std::endl; tablesFile << "\\usepackage{color}" << std::endl; tablesFile << "\\begin{document}" << std::endl; tablesFile << "\\begin{center}" << std::endl; tablesFile << "{\\large Instantaneous Luminosity " << luminosity << "~cm$^{-2}$~s$^{-1}$}" << std::endl; tablesFile << "\\end{center}" << std::endl; tablesFile << "\\tableofcontents" << std::endl; tablesFile << "\\clearpage" << std::endl << std::endl << std::endl; //........................................................................... // Store dataset definition const UInt_t numDatasets = datasetsConfig.size(); if (diagnostics[1 + RATE_SAMPLE].numConstituentSamples > 0) { tablesFile << "\\section{Primary Datasets}\\label{primaryDatasets}" << std::endl; tablesFile << "The ``rate'' samples are:" << std::endl; tablesFile << "\\begin{itemize}" << std::endl; for (UInt_t iSample = 0; iSample < numSamples; ++iSample) if (at(iSample).typeOfSample == RATE_SAMPLE) tablesFile << "\\item " << latexEscape(at(iSample).name) << std::endl; tablesFile << "\\end{itemize}" << std::endl; tablesFile << std::endl; } if (diagnostics[1 + PHYSICS_SAMPLE].numConstituentSamples > 0) { tablesFile << "The ``physics'' samples are:" << std::endl; tablesFile << "\\begin{itemize}" << std::endl; for (UInt_t iSample = 0; iSample < numSamples; ++iSample) if (at(iSample).typeOfSample == PHYSICS_SAMPLE) tablesFile << "\\item " << latexEscape(at(iSample).name) << std::endl; tablesFile << "\\end{itemize}" << std::endl; tablesFile << std::endl; } tablesFile << "\\begin{longtable}{|c|c|l|}" << std::endl; // tablesFile << "\\begin{tabular}{|c|c|l|}" << std::endl; tablesFile << "\\hline" << std::endl; tablesFile << "{\\bf Primary Dataset} & {\\bf Rate in Hz (" << TString(diagnostics[0].name).ReplaceAll("samples", " samples") << ")} & {\\bf Triggers (OR-ed)} \\\\" << std::endl; tablesFile << "\\hline" << std::endl; tablesFile << "\\endfirsthead" << std::endl; tablesFile << "\\hline" << std::endl; tablesFile << "{\\bf Primary Dataset} & {\\bf Rate in Hz (" << TString(diagnostics[0].name).ReplaceAll("samples", " samples") << ")} & {\\bf Triggers (OR-ed)} \\\\" << std::endl; tablesFile << "\\hline" << std::endl; tablesFile << "\\endhead" << std::endl; tablesFile << "\\hline" << std::endl; tablesFile << "\\endfoot" << std::endl; tablesFile << "\\hline" << std::endl; tablesFile << "\\endlastfoot" << std::endl; Double_t overheadRate = 0; for (UInt_t iSet = 0; iSet < numDatasets; ++iSet) { const Dataset& dataset = diagnostics[0][iSet]; if (dataset.isNewTrigger) continue; overheadRate += dataset.rate; Double_t rateErr = TMath::Sqrt(dataset.rateUncertainty2); Int_t decimals = decimalPlaces(rateErr); tablesFile << latexEscape(dataset.name.Data()) << " & " << TString::Format("%.*f", decimals, dataset.rate) << " $\\pm$ " << TString::Format("%.*f", decimals, rateErr) << " & " ; const UInt_t numTriggers = dataset.size(); for (UInt_t iTrig = 0; iTrig < numTriggers; ++iTrig) tablesFile << (iTrig ? " & & " : "") << latexEscape(dataset[iTrig].name) << " \\\\" << std::endl; tablesFile << "\\hline" << std::endl; } // end loop over datasets overheadRate -= diagnostics[0].passedRate; Double_t passedRateErr = TMath::Sqrt(diagnostics[0].passedRateUncertainty2); Int_t decimals = decimalPlaces(passedRateErr); tablesFile << "\\multicolumn{3}{l}{Total rate is ("; tablesFile << TString::Format("%.*f", decimals, diagnostics[0].passedRate) << " $\\pm$ " << TString::Format("%.*f", decimals, passedRateErr) << ") Hz, plus " << TString::Format("%.*f", decimals, overheadRate) << " Hz of datasets storage overhead" ; tablesFile << "} \\\\ \\hline" << std::endl; // tablesFile << "\\end{tabular}" << std::endl; tablesFile << "\\end{longtable}" << std::endl; tablesFile << std::endl; tablesFile << "\\clearpage" << std::endl; tablesFile << "%================================================================================" << std::endl; tablesFile << std::endl << std::endl; // Store one page per new trigger for (UInt_t iSet = 0; iSet < numDatasets; ++iSet) { const Dataset& dataset = datasetsConfig[iSet]; if (! dataset.isNewTrigger) continue; // Start of section for this trigger TString title = latexEscape(dataset.name); const UInt_t numTriggers = dataset.size(); tablesFile << "\\section{Contribution of " << title << "}"; tablesFile << "\\label{" << TString(dataset.name).ReplaceAll("_","") << "Contribution}" << std::endl; tablesFile << "The rate that would be added by "; if (numTriggers > 1) { tablesFile << title << "~$\\equiv$~("; for (UInt_t iTrig = 0; iTrig < numTriggers; ++iTrig) tablesFile << (iTrig ? "~$\\vee$~" : "") << latexEscape(dataset[iTrig].name); tablesFile << ")"; } else tablesFile << title; tablesFile << " to the various primary datasets. " << std::endl; tablesFile << "The ``contribution'' is the (new) rate added by " << title << " as a percent of the original dataset rate. "; tablesFile << std::endl << std::endl; for (UInt_t iSample = 0; iSample < numDiagnostics; ++iSample) { const SampleDiagnostics& sample = diagnostics[iSample]; ////std::cout << " +++ " << sample.name << " = " << sample.numProcessedEvents << std::endl; if (sample.typeOfSample == PHYSICS_SAMPLE && sample.numProcessedEvents > 0) { TString errata; errata.Form("{\\bf %s}~:~", TString(sample.name).ReplaceAll("samples", " samples").Data()); sample[iSet].report(tablesFile, sample, errata, significantDigits); } } // end loop over samples tablesFile << "\\clearpage" << std::endl; tablesFile << "%================================================================================" << std::endl; tablesFile << std::endl << std::endl; } // end loop over datasets //.. Latex it ............................................................... tablesFile << std::endl << std::endl << "\\end{document}" << std::endl; tablesFile.close(); TString pdfIt; pdfIt.Form("latex %s.tex ; latex %s.tex ; latex %s.tex ; dvipdf %s.dvi %s.pdf", tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data()); //pdfIt += TString::Format(" & (rm %s.aux %s.dvi %s.tex %s.log %s.toc)", tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data()); pdfIt += TString::Format(" ; rm %s.aux %s.dvi %s.log %s.toc", tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data(), tablesPrefix.Data()); // RR commenting the latex xompilation for now // if (gSystem->Exec(pdfIt) == 0) std::clog << " + " << tablesPrefix << ".pdf" << std::endl; // else std::clog << " - " << tablesPrefix << ".pdf --- FAILED to compile tex file!" << std::endl; //........................................................................... }
void Dataset::report(std::ofstream& output, const std::vector<Dataset>& datasets, const Char_t* errata, const Int_t significantDigits) const { Double_t rateErr = TMath::Sqrt(rateUncertainty2); Int_t decimals = decimalPlaces(rateErr); //.. Table formatting ....................................................... output << "\\begin{longtable}{|l|c|c|c|}" << std::endl; output << "\\multicolumn{4}{l}{"; if (errata) output << errata; output << "Stand-alone rate of " << latexEscape(name) << " is "; output << TString::Format("%.*f", decimals, rate) << "~$\\pm$~"; output << TString::Format("%.*f", decimals, rateErr) << " Hz" << std::endl; output << "} \\\\" << std::endl; output << "\\hline " << std::endl; output << "{\\bf Primary Dataset} & "; output << "{\\bf Orig. Dataset Rate (Hz)} & "; output << "{\\bf Rate Added (Hz)} & "; output << "{\\bf Contribution (\\%)} \\\\ " << std::endl; output << "\\hline" << std::endl; output << "\\endfirsthead " << std::endl << std::endl; output << "\\multicolumn{4}{l}{\\bf \\bfseries -- continued from previous page --} \\\\" << std::endl; output << "\\hline " << std::endl; output << "{\\bf Primary Dataset} & "; output << "{\\bf Dataset Rate (Hz)} & "; output << "{\\bf Rate Added (Hz)} & "; output << "{\\bf Contribution (\\%)} \\\\ " << std::endl; output << "\\hline" << std::endl; output << "\\endhead " << std::endl << std::endl; output << "\\hline \\multicolumn{4}{|r|}{{Continued on next page}} \\\\ \\hline " << std::endl; output << "\\endfoot " << std::endl; output << "\\hline " << std::endl; output << "\\endlastfoot " << std::endl; //........................................................................... const UInt_t numDatasets = datasetIndices.size(); for (UInt_t iSet = 0; iSet < numDatasets; ++iSet) { const Dataset& dataset = datasets[datasetIndices[iSet]]; const Double_t addedUncertainty= TMath::Sqrt(addedUncertainty2[iSet]); output << "\\color{blue}" << latexEscape(dataset.name) << " & "; if (dataset.rate > 0) output << TString::Format("%.*f", decimals, dataset.rate) << " $\\pm$ " << TString::Format("%.*f", decimals, TMath::Sqrt(dataset.rateUncertainty2)) << " & "; else output << " (n/a) & "; output << TString::Format("%.*f", decimals, addedRate[iSet]) << " $\\pm$ " << TString::Format("%.*f", decimals, addedUncertainty) << " & "; if (dataset.rate > 0) output << TString::Format("%.*g", significantDigits, 100*addedRate[iSet]/dataset.rate) << " $\\pm$ " << TString::Format("%.*g", significantDigits, 100*addedUncertainty/dataset.rate); else output << " (n/a) "; output << " \\\\ "; output << std::endl; } // end loop over compared datasets output << "\\hline " << std::endl; output << "\\end{longtable}" << std::endl << std::endl; }
int KLocale::decimalPlaces() const { return d->decimalPlaces(); }
itemPricingScheduleItem::itemPricingScheduleItem(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) : XDialog(parent, name, modal, fl) { XSqlQuery itemitemPricingScheduleItem; setupUi(this); _save = _buttonBox->button(QDialogButtonBox::Save); _save->setEnabled(false); connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave())); connect(_item, SIGNAL(newId(int)), this, SLOT(sUpdateCosts(int))); connect(_price, SIGNAL(idChanged(int)), _actCost, SLOT(setId(int))); connect(_price, SIGNAL(idChanged(int)), _stdCost, SLOT(setId(int))); connect(_price, SIGNAL(idChanged(int)), _listPrice, SLOT(setId(int))); connect(_price, SIGNAL(effectiveChanged(const QDate&)), _actCost, SLOT(setEffective(const QDate&))); connect(_price, SIGNAL(effectiveChanged(const QDate&)), _stdCost, SLOT(setEffective(const QDate&))); connect(_price, SIGNAL(effectiveChanged(const QDate&)), _listPrice, SLOT(setEffective(const QDate&))); connect(_price, SIGNAL(valueChanged()), this, SLOT(sUpdateMargins())); connect(_itemSelected, SIGNAL(toggled(bool)), this, SLOT(sTypeChanged(bool))); connect(_discountSelected, SIGNAL(toggled(bool)), this, SLOT(sTypeChanged(bool))); connect(_markupSelected, SIGNAL(toggled(bool)), this, SLOT(sTypeChanged(bool))); connect(_freightSelected, SIGNAL(toggled(bool)), this, SLOT(sTypeChanged(bool))); connect(_qtyUOM, SIGNAL(newID(int)), this, SLOT(sQtyUOMChanged())); connect(_priceUOM, SIGNAL(newID(int)), this, SLOT(sPriceUOMChanged())); connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_dscbyItem, SIGNAL(toggled(bool)), this, SLOT(sCheckEnable())); connect(_dscbyprodcat, SIGNAL(toggled(bool)), this, SLOT(sCheckEnable())); connect(_markupbyItem, SIGNAL(toggled(bool)), this, SLOT(sCheckEnable())); connect(_markupbyprodcat, SIGNAL(toggled(bool)), this, SLOT(sCheckEnable())); connect(_item, SIGNAL(valid(bool)), this, SLOT(sCheckEnable())); connect(_dscitem, SIGNAL(valid(bool)), this, SLOT(sCheckEnable())); connect(_markupitem, SIGNAL(valid(bool)), this, SLOT(sCheckEnable())); connect(_prodcat, SIGNAL(valid(bool)), this, SLOT(sCheckEnable())); connect(_markupProdcat, SIGNAL(valid(bool)), this, SLOT(sCheckEnable())); _ipsheadid = -1; _ipsitemid = -1; _ipsfreightid = -1; _invuomid = -1; _listpricesched = false; _charprice->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft, true, "char_name" ); _charprice->addColumn(tr("Value"), -1, Qt::AlignLeft, true, "ipsitemchar_value" ); _charprice->addColumn(tr("Price"), _priceColumn,Qt::AlignRight, true, "ipsitemchar_price" ); _qtyBreak->setValidator(omfgThis->qtyVal()); _qtyBreakCat->setValidator(omfgThis->qtyVal()); _markupQtyBreakCat->setValidator(omfgThis->qtyVal()); _qtyBreakFreight->setValidator(omfgThis->weightVal()); _discount->setValidator(new XDoubleValidator(-999, 999, decimalPlaces("percent"), this)); _fixedAmtDiscount->setValidator(omfgThis->negMoneyVal()); _markup->setValidator(new XDoubleValidator(-999, 999, decimalPlaces("percent"), this)); _fixedAmtMarkup->setValidator(omfgThis->negMoneyVal()); _pricingRatio->setPrecision(omfgThis->percentVal()); _stdMargin->setPrecision(omfgThis->percentVal()); _actMargin->setPrecision(omfgThis->percentVal()); _item->setType(ItemLineEdit::cSold | ItemLineEdit::cActive); _zoneFreight->setType(XComboBox::ShippingZones); _shipViaFreight->setType(XComboBox::ShipVias); _freightClass->setType(XComboBox::FreightClasses); _tab->setTabEnabled(_tab->indexOf(_configuredPrices),false); itemitemPricingScheduleItem.exec("SELECT uom_name FROM uom WHERE (uom_item_weight);"); if (itemitemPricingScheduleItem.first()) { QString uom = itemitemPricingScheduleItem.value("uom_name").toString(); QString title (tr("Price per ")); title += uom; _perUOMFreight->setText(title); _qtyBreakFreightUOM->setText(uom); } if (_metrics->boolean("WholesalePriceCosting")) _markupLit->setText(tr("Markup Percent (Wholesale Price):")); else _markupLit->setText(tr("Markup Percent (Inventory Cost):")); /* Not used anywhere in the code _rejectedMsg = tr("The application has encountered an error and must " "stop editing this Pricing Schedule.\n%1"); */ }
QString xmoney::toDbString() const { return QString("(%1,%2)").arg(formatNumber(amount(), decimalPlaces()), currency().isEmpty() ? "\"\"" : currency()); }