当前位置: 首页>>代码示例>>C++>>正文


C++ XSqlQuery::size方法代码示例

本文整理汇总了C++中XSqlQuery::size方法的典型用法代码示例。如果您正苦于以下问题:C++ XSqlQuery::size方法的具体用法?C++ XSqlQuery::size怎么用?C++ XSqlQuery::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XSqlQuery的用法示例。


在下文中一共展示了XSqlQuery::size方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: size

int XSqlQueryProto::size()
{
  XSqlQuery *item = qscriptvalue_cast<XSqlQuery*>(thisObject());
  if (item)
    return item->size();
  return 0;
}
开发者ID:xtuple,项目名称:qt-client,代码行数:7,代码来源:xsqlqueryproto.cpp

示例2: sPrint

void assignLotSerial::sPrint()
{
  QPrinter printer(QPrinter::HighResolution);
  bool setupPrinter = true;
  bool userCanceled = false;
  QString label;
  QString presetPrinter(xtsettingsValue(QString("%1.defaultPrinter").arg(objectName())).toString());

  XSqlQuery qlabel;
  qlabel.prepare("SELECT ls_id, itemsite_controlmethod "
                 "FROM itemlocdist "
                 "LEFT OUTER JOIN itemsite ON (itemlocdist_itemsite_id = itemsite_id) "
                 "JOIN ls ON (itemlocdist_ls_id=ls_id) "
                 "WHERE (itemlocdist_series=:itemlocdist_series) "
                 "ORDER BY ls_number;");
  qlabel.bindValue(":itemlocdist_series", _itemlocSeries);
  qlabel.exec();
  if (qlabel.first()) {
    if (qlabel.value("itemsite_controlmethod").toString() == "L")
      label = tr("Lot#:");
    else
      label = tr("Serial#:");

    if (presetPrinter.isEmpty()) {
      if (orReport::beginMultiPrint(&printer, userCanceled) == false) {
        if(!userCanceled) {
          systemError(this, tr("<p>Could not initialize printing system for "
                               "multiple reports."));
          return;
        }
      }
    }
    else {
      printer.setPrinterName(presetPrinter);
      orReport::beginMultiPrint(&printer);
    }

    for (int i = 0; i < qlabel.size(); i++) {
      ParameterList params;
      params.append("label", label);
      params.append("ls_id", qlabel.value("ls_id").toInt());

      orReport report("LotSerialLabel", params);
      if (report.isValid() && report.print(&printer, setupPrinter))
        setupPrinter = false;
      else {
        report.reportError(this);
        break;
      }
      qlabel.next();
    }
    orReport::endMultiPrint(&printer);
  }
  else if (q.lastError().type() != QSqlError::NoError) {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:58,代码来源:assignLotSerial.cpp

示例3: generateHTML

QString ExportHelper::generateHTML(QString qtext, ParameterList &params, QString &errmsg)
{
  if (DEBUG)
    qDebug("ExportHelper::generateHTML(%s..., %d params, errmsg) entered",
           qPrintable(qtext.left(80)), params.size());
  if (qtext.isEmpty())
    return QString::null;

  QTextDocument    doc(0);
  QTextCursor      cursor(&doc);
  QTextTableFormat tablefmt;

  bool valid;
  QVariant includeheaderVar = params.value("includeHeaderLine", &valid);
  bool includeheader = (valid ? includeheaderVar.toBool() : false);
  if (DEBUG)
    qDebug("generateHTML(qtest, params, errmsg) includeheader = %d, valid = %d",
           includeheader, valid);

  MetaSQLQuery mql(qtext);
  XSqlQuery qry = mql.toQuery(params);
  if (qry.first())
  {
    int cols = qry.record().count();
    int expected = qry.size();
    if (includeheader)
      expected++;

    // presize the table
    cursor.insertTable((expected < 0 ? 1 : expected), cols, tablefmt);
    if (includeheader)
    {
      tablefmt.setHeaderRowCount(1);
      for (int p = 0; p < cols; p++)
      {
        cursor.insertText(qry.record().fieldName(p));
        cursor.movePosition(QTextCursor::NextCell);
      }
    }

    do {
      for (int i = 0; i < cols; i++)
      {
        cursor.insertText(qry.value(i).toString());
        cursor.movePosition(QTextCursor::NextCell);
      }
    } while (qry.next());
  }
  if (qry.lastError().type() != QSqlError::NoError)
    errmsg = qry.lastError().text();

  return doc.toHtml();
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:53,代码来源:exporthelper.cpp

示例4: sUpdate

void updateItemSiteLeadTimes::sUpdate()
{
  ParameterList params;
  _warehouse->appendValue(params);
  _classCode->appendValue(params);

  XSqlQuery updateUpdate;
  QProgressDialog progress;
  progress.setWindowModality(Qt::ApplicationModal);
  
  MetaSQLQuery mql = mqlLoad("updateItemsiteLeadTimes", "load");
  updateUpdate = mql.toQuery(params);
  if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Loading Item Site Lead Times"),
                           updateUpdate, __FILE__, __LINE__))
  {
    return;
  }
  
  int count=0;
  progress.setMaximum(updateUpdate.size());
  XSqlQuery update;
  while (updateUpdate.next())
  {
    progress.setLabelText(tr("Site: %1\n"
                             "Item: %2 - %3")
                          .arg(updateUpdate.value("warehous_code").toString())
                          .arg(updateUpdate.value("item_number").toString())
                          .arg(updateUpdate.value("item_descrip1").toString()));
    
    ParameterList rparams = params;
    rparams.append("itemsite_id", updateUpdate.value("itemsite_id"));
    rparams.append("leadTimePad", _leadTimePad->value());
    MetaSQLQuery mql2 = mqlLoad("updateItemsiteLeadTimes", "update");
    update = mql2.toQuery(rparams);
    if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Updating Item Site Lead Times"),
                             update, __FILE__, __LINE__))
    {
      return;
    }
    
    if (progress.wasCanceled())
      break;
    
    count++;
    progress.setValue(count);
  }

  accept();
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:49,代码来源:updateItemSiteLeadTimes.cpp

示例5: setupCharacteristics

void displayPrivate::setupCharacteristics(QStringList uses)
{
  QString column;
  QString name;
  QString sql = QString("SELECT char_id, char_name, char_type "
                        "FROM char "
                        "  JOIN charuse ON char_id = charuse_char_id"
                        " WHERE char_search "
                        "   AND charuse_target_type IN ('%1')"
                        " ORDER BY char_name;").arg(uses.join("','"));
  XSqlQuery chars;
  chars.exec(sql);
  if (chars.size() <= 0)
  {
    qWarning() << "Could not find any characteristics matching" << uses;
  }
  while (chars.next())
  {
    characteristic::Type chartype = (characteristic::Type)chars.value("char_type").toInt();
    column = QString("char%1").arg(chars.value("char_id").toString());
    name = chars.value("char_name").toString();
    _list->addColumn(name, -1, Qt::AlignLeft , false, column );
    if (chartype == characteristic::Text)
    {
      _charidstext.append(chars.value("char_id").toInt());
      _parameterWidget->append(name, column, ParameterWidget::Text);
    }
    else if (chartype == characteristic::List)
    {
      _charidslist.append(chars.value("char_id").toInt());
      QString sql =   QString("SELECT charopt_value, charopt_value "
                              "FROM charopt "
                              "WHERE (charopt_char_id=%1);")
          .arg(chars.value("char_id").toInt());
      _parameterWidget->append(name, column, ParameterWidget::Multiselect, QVariant(), false, sql);
    }
    else if (chartype == characteristic::Date)
    {
      _charidsdate.append(chars.value("char_id").toInt());
      QString start = QApplication::translate("display", "Start Date", 0);
      QString end = QApplication::translate("display", "End Date", 0);
      _parameterWidget->append(name + " " + start, column + "startDate", ParameterWidget::Date);
      _parameterWidget->append(name + " " + end, column + "endDate", ParameterWidget::Date);
    }
  }
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:46,代码来源:display.cpp

示例6: sCreate

void createPlannedOrdersByPlannerCode::sCreate(ParameterList params)
{
  XSqlQuery createCreate;
  QProgressDialog progress;
  progress.setWindowModality(Qt::ApplicationModal);

  MetaSQLQuery mql = mqlLoad("schedule", "load");
  createCreate = mql.toQuery(params);
  if (createCreate.lastError().type() != QSqlError::NoError)
  {
    systemError(this, createCreate.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  int count=0;
  progress.setMaximum(createCreate.size());
  XSqlQuery create;
  while (createCreate.next())
  {
    progress.setLabelText(tr("Site: %1\n"
                             "Item: %2 - %3")
                          .arg(createCreate.value("warehous_code").toString())
                          .arg(createCreate.value("item_number").toString())
                          .arg(createCreate.value("item_descrip1").toString()));

    ParameterList rparams = params;
    rparams.append("itemsite_id", createCreate.value("itemsite_id"));
    MetaSQLQuery mql2 = mqlLoad("schedule", "create");
    create = mql2.toQuery(rparams);
    if (create.lastError().type() != QSqlError::NoError)
    {
      systemError(this, create.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }

    if (progress.wasCanceled())
      break;

    count++;
    progress.setValue(count);
  }

  accept();
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:44,代码来源:createPlannedOrdersByPlannerCode.cpp

示例7: setId

void UsernameLineEdit::setId(const int pId)
{
  QString sql("SELECT usr_username AS number, "
              " usr_propername AS name "
              " FROM usr"
              " WHERE ((usr_id=:id)");

  if(UsersActive == _type)
    sql += " AND (usr_active)";
  else if(UsersInactive == _type)
    sql += " AND (NOT usr_active)";

  sql += " );";

  XSqlQuery query;
  query.prepare(sql);
  query.bindValue(":id", pId);
  query.exec();
  setStrikeOut(!query.size());
  if(query.first())
  {
    _id = pId;
    _valid = true;
    _username = query.value("number").toString();
    setText(_username);
    _name = query.value("name").toString();
  }
  else
  {
    _id = -1;
    _valid = false;
    _name = QString();
    _description = QString();
  }

  emit newId(_id);
  emit valid(_valid);
  emit parsed();
  _parsed = true;
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:40,代码来源:usernameCluster.cpp

示例8: if

configureIM::configureIM(QWidget* parent, const char* name, bool /*modal*/, Qt::WFlags fl)
    : XAbstractConfigure(parent, fl)
{
  XSqlQuery configureconfigureIM;
  setupUi(this);

  if (name)
    setObjectName(name);

  //Inventory
  //Disable multi-warehouse if PostBooks
  if (_metrics->value("Application") == "PostBooks")
    _multiWhs->hide();
  else
  {
    configureconfigureIM.exec("SELECT * "
	   "FROM whsinfo");
    if (configureconfigureIM.size() > 1)
    {
      _multiWhs->setCheckable(FALSE);
      _multiWhs->setTitle("Multiple Sites");
    }
    else
      _multiWhs->setChecked(_metrics->boolean("MultiWhs"));
      
    if (_metrics->value("TONumberGeneration") == "M")
      _toNumGeneration->setCurrentIndex(0); 
    else if (_metrics->value("TONumberGeneration") == "A")
      _toNumGeneration->setCurrentIndex(1);
    else if (_metrics->value("TONumberGeneration") == "O")
      _toNumGeneration->setCurrentIndex(2);

    _toNextNum->setValidator(omfgThis->orderVal());
    configureconfigureIM.exec( "SELECT orderseq_number AS tonumber "
	    "FROM orderseq "
	    "WHERE (orderseq_name='ToNumber');" );
    if (configureconfigureIM.first())
      _toNextNum->setText(configureconfigureIM.value("tonumber").toString());
    else if (configureconfigureIM.lastError().type() != QSqlError::NoError)
      systemError(this, configureconfigureIM.lastError().databaseText(), __FILE__, __LINE__);

    _enableToShipping->setChecked(_metrics->boolean("EnableTOShipping"));
    _transferOrderChangeLog->setChecked(_metrics->boolean("TransferOrderChangeLog"));
  }

  _eventFence->setValue(_metrics->value("DefaultEventFence").toInt());
  _itemSiteChangeLog->setChecked(_metrics->boolean("ItemSiteChangeLog"));
  _warehouseChangeLog->setChecked(_metrics->boolean("WarehouseChangeLog"));
  
  if (_metrics->boolean("PostCountTagToDefault"))
    _postToDefault->setChecked(TRUE);
  else
    _doNotPost->setChecked(TRUE);

  _defaultTransWhs->setId(_metrics->value("DefaultTransitWarehouse").toInt());

  QString countSlipAuditing = _metrics->value("CountSlipAuditing");
  if (countSlipAuditing == "N")
    _noSlipChecks->setChecked(TRUE);
  else if (countSlipAuditing == "W")
    _checkOnUnpostedWarehouse->setChecked(TRUE);
  else if (countSlipAuditing == "A")
    _checkOnUnposted->setChecked(TRUE);
  else if (countSlipAuditing == "X")
    _checkOnAllWarehouse->setChecked(TRUE);
  else if (countSlipAuditing == "B")
    _checkOnAll->setChecked(TRUE);
    
  QString avgCostingMethod = _metrics->value("CountAvgCostMethod");
  if (avgCostingMethod == "STD")
    _useStdCost->setChecked(TRUE);
  else if (avgCostingMethod == "ACT")
  {
    _useAvgCost->setChecked(TRUE);
    _useActCost->setChecked(TRUE);
  }
  else if (avgCostingMethod == "AVG")
    _useAvgCost->setChecked(TRUE);
  else
    _useStdCost->setChecked(TRUE);
    
  if(_metrics->value("Application") != "PostBooks")
  {
    configureconfigureIM.exec("SELECT DISTINCT itemsite_controlmethod "
	      "FROM itemsite "
	      "WHERE (itemsite_controlmethod IN ('L','S'));");
    if (configureconfigureIM.first())
    {
      _lotSerial->setChecked(TRUE);
      _lotSerial->setEnabled(FALSE);
    }
    else
      _lotSerial->setChecked(_metrics->boolean("LotSerialControl"));
  }
  else
    _lotSerial->hide();
  _setDefLoc->setChecked(_metrics->boolean("SetDefaultLocations"));

// Shipping and Receiving
  QString metric = _metrics->value("ShipmentNumberGeneration");
//.........这里部分代码省略.........
开发者ID:Dinesh-Ramakrishnan,项目名称:qt-client,代码行数:101,代码来源:configureIM.cpp

示例9: sListPrices

void creditMemoItem::sListPrices()
{
  XSqlQuery creditListPrices;
  creditListPrices.prepare( "SELECT currToCurr(ipshead_curr_id, :curr_id, ipsprice_price, :effective) AS price"
             "       FROM ipsass, ipshead, ipsprice "
             "       WHERE ( (ipsass_ipshead_id=ipshead_id)"
             "        AND (ipsprice_ipshead_id=ipshead_id)"
             "        AND (ipsprice_item_id=:item_id)"
             "        AND (ipsass_cust_id=:cust_id)"
             "        AND (COALESCE(LENGTH(ipsass_shipto_pattern), 0) = 0)"
             "        AND (CURRENT_DATE BETWEEN ipshead_effective AND (ipshead_expires - 1) ) )"

             "       UNION SELECT ipsprice_price AS price"
             "       FROM ipsass, ipshead, ipsprice "
             "       WHERE ( (ipsass_ipshead_id=ipshead_id)"
             "        AND (ipsprice_ipshead_id=ipshead_id)"
             "        AND (ipsprice_item_id=:item_id)"
             "        AND (ipsass_shipto_id=:shipto_id)"
             "        AND (ipsass_shipto_id != -1)"
             "        AND (CURRENT_DATE BETWEEN ipshead_effective AND (ipshead_expires - 1)) )"

             "       UNION SELECT ipsprice_price AS price"
             "       FROM ipsass, ipshead, ipsprice, custinfo "
             "       WHERE ( (ipsass_ipshead_id=ipshead_id)"
             "        AND (ipsprice_ipshead_id=ipshead_id)"
             "        AND (ipsprice_item_id=:item_id)"
             "        AND (ipsass_custtype_id=cust_custtype_id)"
             "        AND (cust_id=:cust_id)"
             "        AND (CURRENT_DATE BETWEEN ipshead_effective AND (ipshead_expires - 1)) )"

             "       UNION SELECT ipsprice_price AS price"
             "       FROM ipsass, ipshead, ipsprice, custtype, custinfo "
             "       WHERE ( (ipsass_ipshead_id=ipshead_id)"
             "        AND (ipsprice_ipshead_id=ipshead_id)"
             "        AND (ipsprice_item_id=:item_id)"
             "        AND (coalesce(length(ipsass_custtype_pattern), 0) > 0)"
             "        AND (custtype_code ~ ipsass_custtype_pattern)"
             "        AND (cust_custtype_id=custtype_id)"
             "        AND (cust_id=:cust_id)"
             "        AND (CURRENT_DATE BETWEEN ipshead_effective AND (ipshead_expires - 1)))"

             "       UNION SELECT ipsprice_price AS price"
             "       FROM ipsass, ipshead, ipsprice, shiptoinfo "
             "       WHERE ( (ipsass_ipshead_id=ipshead_id)"
             "        AND (ipsprice_ipshead_id=ipshead_id)"
             "        AND (ipsprice_item_id=:item_id)"
             "        AND (shipto_id=:shipto_id)"
             "        AND (COALESCE(LENGTH(ipsass_shipto_pattern), 0) > 0)"
             "        AND (shipto_num ~ ipsass_shipto_pattern)"
             "        AND (ipsass_cust_id=:cust_id)"
             "        AND (CURRENT_DATE BETWEEN ipshead_effective AND (ipshead_expires - 1)) )"

             "       UNION SELECT ipsprice_price AS price"
             "       FROM sale, ipshead, ipsprice "
             "       WHERE ((sale_ipshead_id=ipshead_id)"
             "        AND (ipsprice_ipshead_id=ipshead_id)"
             "        AND (ipsprice_item_id=:item_id)"
             "        AND (CURRENT_DATE BETWEEN sale_startdate AND (sale_enddate - 1)) ) "

             "       UNION SELECT (item_listprice - (item_listprice * cust_discntprcnt)) AS price "
             "       FROM item, custinfo "
             "       WHERE ( (item_sold)"
             "        AND (NOT item_exclusive)"
             "        AND (item_id=:item_id)"
             "        AND (cust_id=:cust_id) );");
  creditListPrices.bindValue(":item_id", _item->id());
  creditListPrices.bindValue(":cust_id", _custid);
  creditListPrices.bindValue(":shipto_id", _shiptoid);
  creditListPrices.bindValue(":curr_id", _netUnitPrice->id());
  creditListPrices.bindValue(":effective", _netUnitPrice->effective());
  creditListPrices.exec();
  if (creditListPrices.size() == 1)
  {
	creditListPrices.first();
	_netUnitPrice->setLocalValue(creditListPrices.value("price").toDouble() * (_priceinvuomratio / _priceRatio));
  }
  else
  {
    ParameterList params;
    params.append("cust_id", _custid);
    params.append("shipto_id", _shiptoid);
    params.append("item_id", _item->id());
    params.append("warehous_id", _warehouse->id());
    // don't params.append("qty", ...) as we don't know how many were purchased
    params.append("curr_id", _netUnitPrice->id());
    params.append("effective", _netUnitPrice->effective());

    priceList newdlg(this);
    newdlg.set(params);
    if (newdlg.exec() == XDialog::Accepted)
    {
      _netUnitPrice->setLocalValue(newdlg._selectedPrice * (_priceinvuomratio / _priceRatio));
      sCalculateDiscountPrcnt();
    }
  }
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:96,代码来源:creditMemoItem.cpp

示例10: sParse

void ItemLineEdit::sParse()
{
  if (DEBUG)
    qDebug("%s::sParse() entered with parsed %d, text [%s], "
           "_useValidationQuery %d, _useQuery %d",
           qPrintable(objectName()), _parsed, qPrintable(text()),
           _useValidationQuery, _useQuery);
  if (!_parsed)
  {
    _parsed = TRUE;

    if (text().length() == 0)
    {
      setId(-1);
      return;
    }
    else if (_useValidationQuery)
    {
      XSqlQuery item;
      if (completer())
        item.prepare("SELECT item_id"
                     "  FROM item"
                     " WHERE ((POSITION(:searchString IN item_number) = 1)"
                     "     OR (POSITION(:searchString IN item_upccode) = 1));");
      else
        item.prepare("SELECT item_id"
                     "  FROM item"
                     " WHERE (item_number = :searchString"
                     "     OR item_upccode = :searchString);");

      item.bindValue(":searchString", text().trimmed().toUpper());
      item.exec();
      while (item.next())
      {
        int itemid = item.value("item_id").toInt();
        XSqlQuery oneq;
        oneq.prepare(_validationSql);
        oneq.bindValue(":item_id", itemid);
        oneq.exec();
        if (oneq.size() > 1)
        {
          ParameterList params;
          params.append("search", text().trimmed().toUpper());
          params.append("searchNumber");
          params.append("searchUpc");
          sSearch(params);
          return;
        }
        else if (oneq.first())
        {
          setId(itemid);
          return;
        }
      }
    }
    else if (_useQuery)
    {
      XSqlQuery item;
      item.prepare(_sql);
      item.exec();
      if (item.first())
      {
        do
        {
          if (item.value("item_number").toString().startsWith(text().trimmed().toUpper()) ||
              item.value("item_upccode").toString().startsWith(text().trimmed().toUpper()))
          {
            setId(item.value("item_id").toInt());
            return;
          }
        }
        while (item.next());
      }
    }
    else
    {
      XSqlQuery item;

      QString pre( "SELECT DISTINCT item_id, item_number AS number, "
                   "(item_descrip1 || ' ' || item_descrip2) AS name, "
                   "item_upccode AS description " );

      QStringList clauses;
      clauses = _extraClauses;
      clauses << "((POSITION(:searchString IN item_number) = 1)"
              " OR (POSITION(:searchString IN item_upccode) = 1))";
      item.prepare(buildItemLineEditQuery(pre, clauses, QString::null, _type, true)
                               .replace(";"," ORDER BY item_number LIMIT 1;"));
      item.bindValue(":searchString", QString(text().trimmed().toUpper()));
      item.exec();
      if (item.first())
      {
        setId(item.value("item_id").toInt());
        return;
      }
    }
    setId(-1);
  }
}
开发者ID:TEKOA-azurfluh,项目名称:qt-client,代码行数:99,代码来源:itemCluster.cpp

示例11: sPopulateItemInfo

void purchaseOrderItem::sPopulateItemInfo(int pItemid)
{
  XSqlQuery item;
  if (pItemid != -1 && _mode == cNew)
  {
      item.prepare("SELECT stdCost(item_id) AS stdcost, "
                   "       getItemTaxType(item_id, pohead_taxzone_id) AS taxtype_id, "
                   "       item_tax_recoverable, COALESCE(item_maxcost, 0.0) AS maxcost "
                   "FROM item, pohead "
                   "WHERE ( (item_id=:item_id) "
                   "  AND   (pohead_id=:pohead_id) );");
      item.bindValue(":item_id", pItemid);
      item.bindValue(":pohead_id", _poheadid);
      item.exec();

      if (item.first())
      {
          // Reset order qty cache
          _orderQtyCache = -1;

          if(_metrics->boolean("RequireStdCostForPOItem") && item.value("stdcost").toDouble() == 0.0)
          {
            QMessageBox::critical( this, tr("Selected Item Missing Cost"),
                    tr("<p>The selected item has no Std. Costing information. "
                       "Please see your controller to correct this situation "
                       "before continuing."));
            _item->setId(-1);
            return;
          }

        _taxtype->setId(item.value("taxtype_id").toInt());
        _taxRecoverable->setChecked(item.value("item_tax_recoverable").toBool());
        _maxCost = item.value("maxcost").toDouble();

        sPopulateItemsiteInfo();
        sPopulateItemChar();

        item.prepare("SELECT itemsrc_id "
                     "FROM itemsrc, pohead "
                     "WHERE ( (itemsrc_vend_id=pohead_vend_id)"
                     " AND (itemsrc_item_id=:item_id)"
                     " AND (:effective BETWEEN itemsrc_effective AND (itemsrc_expires - 1))"
                     " AND (itemsrc_active)"
                     " AND (pohead_id=:pohead_id) );" );
        item.bindValue(":item_id", pItemid);
        item.bindValue(":pohead_id", _poheadid);
        item.bindValue(":effective", _unitPrice->effective());
        item.exec();
        if (item.size() == 1)
        {
          item.first();

          if (item.value("itemsrc_id").toInt() != _itemsrcid)
            sPopulateItemSourceInfo(item.value("itemsrc_id").toInt());
        }
        else if (item.size() > 1)
        {
          bool isCurrent = false;
          while (item.next())
          {
            if (item.value("itemsrc_id").toInt() == _itemsrcid)
              isCurrent = true;
          }
          if (!isCurrent)
          {
            _vendorItemNumber->clear();
            sVendorItemNumberList();
          }
        }
        else
        {
          _itemsrcid = -1;

          _vendorItemNumber->clear();
          _vendorDescrip->clear();
          _vendorUOM->setText(_item->uom());
          _uom->setText(_item->uom());
          _minOrderQty->clear();
          _orderQtyMult->clear();
          _invVendorUOMRatio->setDouble(1.0);
          _earliestDate->setDate(omfgThis->dbDate());
          _manufName->setId(-1);
          _manufItemNumber->clear();
          _manufItemDescrip->clear();

          _invVendUOMRatio = 1;
          _minimumOrder = 0;
          _orderMultiple = 0;
        }
      }
  }
}
开发者ID:szuke,项目名称:qt-client,代码行数:92,代码来源:purchaseOrderItem.cpp

示例12: setModelData


//.........这里部分代码省略.........
		model->setData(index, QString());
		model->setData(model->index(index.row(), POITEM_ITEMSITE_ID_COL), QVariant());
		model->setData(model->index(index.row(), WAREHOUS_ID_COL), QVariant());
		model->setData(model->index(index.row(), WAREHOUS_CODE_COL), QString());
		model->setData(index, QString());
		hitError = true;
		break;
	      }
          else if (ErrorReporter::error(QtCriticalMsg, 0, tr("Error Retrieving Standard Cost Information"),
                                        stdcostq, __FILE__, __LINE__))
          {
            hitError = true;
            break;
          }
	    }

	    XSqlQuery itemsrcq;
	    itemsrcq.prepare( "SELECT pohead_vend_id, itemsrc_id, itemsrc_vend_item_number,"
		       "       itemsrc_vend_item_descrip, itemsrc_vend_uom,"
		       "       itemsrc_minordqty,"
		       "       itemsrc_multordqty,"
		       "       itemsrc_invvendoruomratio,"
                       "       itemsrc_manuf_name,"
                       "       itemsrc_manuf_item_number,"
                       "       itemsrc_manuf_item_descrip,"
		       "       (CURRENT_DATE + itemsrc_leadtime) AS earliestdate "
		       "FROM pohead, itemsrc "
		       "WHERE ( (itemsrc_vend_id=pohead_vend_id)"
		       " AND (itemsrc_item_id=:item_id)"
		       " AND (pohead_id=:pohead_id) );" );
	    itemsrcq.bindValue(":item_id", item->id());
	    itemsrcq.bindValue(":pohead_id", model->headId());
	    itemsrcq.exec();
            if (itemsrcq.size() > 1)
            {
              itemsrcq.first();
              ParameterList params;
              params.append("vend_id",  itemsrcq.value("pohead_vend_id").toInt());
              params.append("search", item->itemNumber());
              itemSourceSearch newdlg(0, "", true);
              newdlg.set(params);
              if(newdlg.exec() == XDialog::Accepted)
              {
                int itemsrcid = newdlg.itemsrcId();
                if(itemsrcid != -1)
                {
                  itemsrcq.prepare( "SELECT itemsrc_id, itemsrc_vend_item_number,"
                             "       itemsrc_vend_item_descrip, itemsrc_vend_uom,"
                             "       itemsrc_minordqty,"
                             "       itemsrc_multordqty,"
                             "       itemsrc_invvendoruomratio,"
                             "       itemsrc_manuf_name,"
                             "       itemsrc_manuf_item_number,"
                             "       itemsrc_manuf_item_descrip,"
                             "       (CURRENT_DATE + itemsrc_leadtime) AS earliestdate "
                             "FROM pohead, itemsrc "
                             "WHERE (itemsrc_id=:itemsrc_id);" );
                  itemsrcq.bindValue(":itemsrc_id", itemsrcid);
                  itemsrcq.exec();
                }
              }
              else
                itemsrcq.clear();
            }
	    if (itemsrcq.first())
	    {
开发者ID:dwatson78,项目名称:qt-client,代码行数:67,代码来源:poitemTableView.cpp


注:本文中的XSqlQuery::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。