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


C++ XTreeWidgetItem类代码示例

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


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

示例1: printer

void reprintInvoices::sPrint()
{
  QPrinter printer(QPrinter::HighResolution);
  bool     setupPrinter = TRUE;

  bool userCanceled = false;
  if (orReport::beginMultiPrint(&printer, userCanceled) == false)
  {
    if(!userCanceled)
      systemError(this, tr("Could not initialize printing system for multiple reports."));
    return;
  }
  QList<QTreeWidgetItem*> selected = _invoice->selectedItems();
  for (int i = 0; i < selected.size(); i++)
  {
    XTreeWidgetItem *cursor = (XTreeWidgetItem*)selected[i];

    for (int j = 0; j < _watermarks->topLevelItemCount(); j++)
    {
      q.prepare("SELECT findCustomerForm(:cust_id, 'I') AS _reportname;");
      q.bindValue(":cust_id", cursor->altId());
      q.exec();
      if (q.first())
      {
	ParameterList params;
	params.append("invchead_id", cursor->id());
	params.append("showcosts", ((_watermarks->topLevelItem(j)->text(2) == tr("Yes")) ? "TRUE" : "FALSE") );
	params.append("watermark", _watermarks->topLevelItem(j)->text(1));

	orReport report(q.value("_reportname").toString(), params);
	if (report.isValid())
	{
	  if (report.print(&printer, setupPrinter))
		 setupPrinter = FALSE;
	      else 
	      {
		report.reportError(this);
		orReport::endMultiPrint(&printer);
		return;
	      }
	}
	else
	  QMessageBox::critical( this, tr("Cannot Find Invoice Form"),
				 tr( "The Invoice Form '%1' cannot be found.\n"
				     "One or more of the selected Invoices cannot be printed until a Customer Form Assignment\n"
				     "is updated to remove any references to this Invoice Form or this Invoice Form is created." )
				 .arg(q.value("_reportname").toString()) );
      }
      else if (q.lastError().type() != QSqlError::None)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return;
      }
    }
    if (_metrics->boolean("EnableBatchManager"))
    {
      // TODO: Check for EDI and handle submission to Batch here
      q.prepare("SELECT CASE WHEN (COALESCE(shipto_ediprofile_id, -2) = -2)"
	      "              THEN COALESCE(cust_ediprofile_id,-1)"
	      "            ELSE COALESCE(shipto_ediprofile_id,-2)"
	      "       END AS result,"
	      "       COALESCE(cust_emaildelivery, false) AS custom"
	      "  FROM cust, invchead"
	      "       LEFT OUTER JOIN shipto"
	      "         ON (invchead_shipto_id=shipto_id)"
	      "  WHERE ((invchead_cust_id=cust_id)"
	      "    AND  (invchead_id=:invchead_id)); ");
      q.bindValue(":invchead_id", cursor->id());
      q.exec();
      if(q.first())
      {
	if(q.value("result").toInt() == -1)
	{
	  if(q.value("custom").toBool())
	  {
	    ParameterList params;
	    params.append("invchead_id", cursor->id());
  
	    deliverInvoice newdlg(this, "", TRUE);
	    newdlg.set(params);
	    newdlg.exec();
	  }
	}
	else
	{
	  ParameterList params;
	  params.append("action_name", "TransmitInvoice");
	  params.append("invchead_id", cursor->id());
  
	  submitAction newdlg(this, "", TRUE);
	  newdlg.set(params);
	  newdlg.exec();
	}
      }
    }
    else if (q.lastError().type() != QSqlError::None)
    {
      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: tr

void dspARApplications::sFillList()
{
  if ( (_selectedCustomer->isChecked()) && (!_cust->isValid()) )
  {
    QMessageBox::warning( this, tr("Select Customer"),
                          tr("You must select a Customer whose A/R Applications you wish to view.") );
    _cust->setFocus();
    return;
  }

  if (!_dates->startDate().isValid())
  {
    QMessageBox::critical( this, tr("Enter Start Date"),
                           tr("You must enter a valid Start Date.") );
    _dates->setFocus();
    return;
  }

  if (!_dates->endDate().isValid())
  {
    QMessageBox::critical( this, tr("Enter End Date"),
                           tr("You must enter a valid End Date.") );
    _dates->setFocus();
    return;
  }

  if ( (!_cashReceipts->isChecked()) && (!_creditMemos->isChecked()) )
  {
    QMessageBox::critical( this, tr("Select Document Type"),
                           tr("You must indicate which Document Type(s) you wish to view.") );
    _cashReceipts->setFocus();
    return;
  }

  QString sql( "SELECT arapply_id, cust_number, cust_name,"
               "       formatDate(arapply_postdate) AS f_postdate,"
	       "       arapply_source_doctype, arapply_fundstype, "
               "       CASE WHEN (arapply_source_doctype IN ('C','R')) THEN TEXT(arapply_source_docnumber)"
               "            ELSE arapply_refnumber"
               "         END AS source,"
               "       arapply_target_doctype,"
               "       TEXT(arapply_target_docnumber) AS target,"
               "       formatMoney(arapply_applied) AS f_applied, arapply_applied "
               "FROM arapply, custinfo "
               "WHERE ( (arapply_cust_id=cust_id)"
               " AND (arapply_postdate BETWEEN <? value(\"startDate\") ?> AND <? value(\"endDate\") ?>)"
               " AND (arapply_source_doctype IN ("
	       "<? if exists(\"creditMemos\") ?>"
	       "  <? if exists(\"cashReceipts\") ?>"
	       "	'K', 'C', 'R' "
	       "  <? else ?>"
	       "	'C', 'R' "
	       "  <? endif ?>"
	       "<? else ?>"
	       "	'K' "
	       "<? endif ?>"
	       "))"
	       "<? if exists(\"cust_id\") ?>"
	       "  AND (cust_id=<? value(\"cust_id\") ?>)"
	       "<? elseif exists(\"custtype_id\") ?>"
	       "  AND (cust_custtype_id=<? value(\"custtype_id\") ?>)"
	       "<? elseif exists(\"custtype_pattern\") ?>"
	       "  AND (cust_custtype_id IN (SELECT custtype_id FROM custtype"
	       "                            WHERE (custtype_code ~ <? value(\"custtype_id\") ?>)))"
	       "<? endif ?>"
	       ") "
	       "ORDER BY arapply_postdate, source;"
	       );

  ParameterList params;

  if (_cashReceipts->isChecked())
    params.append("cashReceipts");

  if (_creditMemos->isChecked())
    params.append("creditMemos");

  params.append("startDate", _dates->startDate());
  params.append("endDate", _dates->endDate());

  if (_selectedCustomer->isChecked())
    params.append("cust_id", _cust->id());
  else if (_selectedCustomerType->isChecked())
    params.append("custtype_id", _customerTypes->id());
  else if (_customerTypePattern->isChecked())
    params.append("custtype_pattern", _customerType->text());

  MetaSQLQuery mql(sql);
  q = mql.toQuery(params);
  if (q.first())
  {
    _arapply->clear();

    double total = 0;

    XTreeWidgetItem* last = 0;
    do
    {
      QString fundstype = q.value("arapply_fundstype").toString();
      QString doctype;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: sToggleReceiving

void voucherItem::sToggleReceiving(QTreeWidgetItem *pItem)
{
  double n;
  QString s;
  XTreeWidgetItem* item = (XTreeWidgetItem*)pItem;
  if(item->id() == -1)
    return;
  if (item->text(3) == "Yes")
  {
    item->setText(3, "No");
    if (item->text(0) == "Receiving")
    {
    	n = _qtyToVoucher->toDouble();
    	_qtyToVoucher->setText(item->text(2));
    	n = n - _qtyToVoucher->toDouble();
    	_qtyToVoucher->setText(s.setNum(n));

      n = _uninvoicedReceived->toDouble();
      _uninvoicedReceived->setText(item->text(2));
      n = n + _uninvoicedReceived->toDouble();
      _uninvoicedReceived->setText(s.setNum(n));
    }
    else
    {
    	n = _qtyToVoucher->toDouble();
    	_qtyToVoucher->setText(item->text(2));
    	n = n + _qtyToVoucher->toDouble();
    	_qtyToVoucher->setText(s.setNum(n));

      n = _uninvoicedRejected->toDouble();
      _uninvoicedRejected->setText(item->text(2));
      n = n + _rejected->toDouble();
      _uninvoicedRejected->setText(s.setNum(n));
    }
  }
  else 
  {
    item->setText(3, "Yes");
    if (item->text(0) == "Receiving")
    {
    	n = _qtyToVoucher->toDouble();
    	_qtyToVoucher->setText(item->text(2));
    	n = n + _qtyToVoucher->toDouble();
    	_qtyToVoucher->setText(s.setNum(n));

      n = _uninvoicedReceived->toDouble();
      _uninvoicedReceived->setText(item->text(2));
      n = n - _uninvoicedReceived->toDouble();
      _uninvoicedReceived->setText(s.setNum(n));
    }
    else
    {
      n = _qtyToVoucher->toDouble();
      _qtyToVoucher->setText(item->text(2));
      n = n - _qtyToVoucher->toDouble();
      _qtyToVoucher->setText(s.setNum(n));

      n = _uninvoicedRejected->toDouble();
      _uninvoicedRejected->setText(item->text(2));
      n = n - _uninvoicedRejected->toDouble();
      _uninvoicedRejected->setText(s.setNum(n));
    }
  }

//Check PO Close flag

  if ( ((_ordered->toDouble() <= (_received->toDouble() - _rejected->toDouble()))) && (_uninvoicedReceived->toDouble() == 0) && (_uninvoicedRejected->toDouble() == 0) )
        _closePoitem->setChecked(true);
  else
	_closePoitem->setChecked(false);
  
//  Save the voitem information
  if (_voitemid != -1)
  {
    q.prepare( "UPDATE voitem "
               "SET voitem_qty=:voitem_qty "
               "WHERE (voitem_id=:voitem_id);" );
    q.bindValue(":voitem_id", _voitemid);
  }
  else
  {
//  Get next voitem id
    q.prepare("SELECT NEXTVAL('voitem_voitem_id_seq') AS voitemid");
    q.exec();
    if (q.first())
      _voitemid = (q.value("voitemid").toInt());
    else if (q.lastError().type() != QSqlError::None)
    {
      systemError(this, _rejectedMsg.arg(q.lastError().databaseText()),
                  __FILE__, __LINE__);
      reject();
      return;
    }
    
    q.prepare( "INSERT INTO voitem "
               "(voitem_id, voitem_vohead_id, voitem_poitem_id, voitem_close, voitem_qty, voitem_freight) "
               "VALUES "
               "(:voitem_id, :vohead_id, :poitem_id, :voitem_close, :voitem_qty, :voitem_freight);" );
  }

//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: mql

void dspCostedIndentedBOM::sFillList()
{
  if (! _item->isValid())
    return;

  MetaSQLQuery mql( "SELECT bomdata_bomwork_id AS id,"
                    "       CASE WHEN bomdata_bomwork_parent_id = -1 AND "
                    "                 bomdata_bomwork_id = -1 THEN"
                    "                     -1"
                    "            ELSE bomdata_item_id"
                    "       END AS altid,"
                    "       *,"
                    "<? if exists(\"useStandardCosts\") ?>"
                    "       bomdata_stdunitcost AS unitcost,"
                    "       bomdata_stdextendedcost AS extendedcost, "
                    "<? elseif exists(\"useActualCosts\") ?>"
                    "       bomdata_actunitcost AS unitcost,"
                    "       bomdata_actextendedcost AS extendedcost, "
                    "<? endif ?>"
                    "       'qtyper' AS bomdata_qtyper_xtnumericrole,"
                    "       'percent' AS bomdata_scrap_xtnumericrole,"
                    "       'cost' AS unitcost_xtnumericrole,"
                    "       'cost' AS extendedcost_xtnumericrole,"
                    "       CASE WHEN COALESCE(bomdata_effective, startOfTime()) <= startOfTime() THEN <? value(\"always\") ?> END AS bomdata_effective_qtdisplayrole,"
                    "       CASE WHEN COALESCE(bomdata_expires, endOfTime()) <= endOfTime() THEN <? value(\"never\") ?> END AS bomdata_expires_qtdisplayrole,"
                    "       CASE WHEN bomdata_expired THEN 'expired'"
                    "            WHEN bomdata_future  THEN 'future'"
                    "       END AS qtforegroundrole,"
                    "       bomdata_bomwork_level - 1 AS xtindentrole "
                    "FROM indentedbom(<? value(\"item_id\") ?>,"
                    "                 <? value(\"revision_id\") ?>,0,0)");
  ParameterList params;
  if (! setParams(params))
    return;
  q = mql.toQuery(params);
  _bomitem->populate(q, true);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  q.prepare( "SELECT formatCost(SUM(bomdata_actextendedcost)) AS actextendedcost,"
             "       formatCost(SUM(bomdata_stdextendedcost)) AS stdextendedcost,"
             "       formatCost(actcost(:item_id)) AS actual,"
             "       formatCost(stdcost(:item_id)) AS standard "
             "FROM indentedbom(:item_id,"
             "                 :revision_id,0,0)"
             "WHERE (bomdata_bomwork_level=1) "
             "GROUP BY actual, standard;" );
  q.bindValue(":item_id", _item->id());
  q.bindValue(":revision_id",_revision->id());
  q.exec();
  if (q.first())
  {
    XTreeWidgetItem *last = new XTreeWidgetItem(_bomitem, -1, -1);
    last->setText(0, tr("Total Cost"));
    if(_useStandardCosts->isChecked())
      last->setText(9, q.value("stdextendedcost").toString());
    else
      last->setText(9, q.value("actextendedcost").toString());

    last = new XTreeWidgetItem( _bomitem, -1, -1);
    last->setText(0, tr("Actual Cost"));
    last->setText(9, q.value("actual").toString());

    last = new XTreeWidgetItem( _bomitem, -1, -1);
    last->setText(0, tr("Standard Cost"));
    last->setText(9, q.value("standard").toString());
  }
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  _bomitem->expandAll();
}
开发者ID:,项目名称:,代码行数:77,代码来源:

示例5: sql


//.........这里部分代码省略.........
               "        AND (coitem_status NOT IN ('C', 'X'))"
               "        AND (cohead_cust_id=cust_id)"
               "<? if exists(\"custtype_id\") ?>"
               "        AND (cust_custtype_id=<? value(\"custtype_id\") ?>)"
               "<? elseif exists(\"custtype_pattern\") ?>"
               "        AND (cust_custtype_id IN (SELECT custtype_id "
               "                                    FROM custtype "
               "                                   WHERE(custtype_code ~ <? value(\"custtype_pattern\") ?>)))"
               "<? endif ?>"
               ")) AS data "
               " <? if exists(\"onlyShowShortages\") ?>"
               "WHERE ( ((qoh + ordered - allocated) < 0)"
               " OR ((qoh + ordered - sobalance) < 0) ) "
               "<? endif ?>"
               "ORDER BY cohead_id, cohead_number, item_number"
               "<? if exists(\"showWoSupply\") ?> ,"
               "wo_duedate"
               "<? endif ?>"
               ";");
    
  ParameterList params;             
  _custtype->appendValue(params);
  if (_onlyShowShortages->isChecked())
    params.append("onlyShowShortages");
  if (_showWoSupply->isChecked())
    params.append("showWoSupply");
  if (_useReservationNetting->isChecked())
    params.append("useReservationNetting");
  
  MetaSQLQuery mql(sql);
  q = mql.toQuery(params);
  if (q.first())
  {
    XTreeWidgetItem *coitem = NULL, *cohead = NULL;
    XTreeWidgetItem *wo = NULL;
    int coitemid = -1;
    int coheadid = -1;
      
    do
    {
      if (coitemid != q.value("coitem_id").toInt())
      {
        if(coheadid != q.value("cohead_id").toInt())
        {
          coheadid = q.value("cohead_id").toInt();
          cohead = new XTreeWidgetItem(_avail, cohead, coheadid, -2,
                                       q.value("cohead_number"), q.value("custname"));
          if(q.value("onpacklist").toBool())
            cohead->setTextColor("green");
        }

        coitemid = q.value("coitem_id").toInt();
        coitem = new XTreeWidgetItem( cohead, coitem,
                                             q.value("itemsite_id").toInt(), q.value("coitem_id").toInt(),
                                             q.value("item_number"),
                                             q.value("item_description"), q.value("uom_name"),
                                             q.value("f_qoh"), q.value("f_sobalance"),
                                             q.value("f_allocated"), q.value("f_ordered"),
                                             q.value("f_soavail"), q.value("f_totalavail"),
                                             q.value("f_atshipping"), q.value("f_scheddate") );

        if (q.value("qoh").toDouble() < 0)
          coitem->setTextColor(3, "red");
        else if (q.value("qoh").toDouble() < q.value("reorderlevel").toDouble())
          coitem->setTextColor(3, "orange");
开发者ID:,项目名称:,代码行数:66,代码来源:

示例6: mqlLoad

void dspSalesHistoryByParameterList::sFillList()
{
  if (!checkParameters())
    return;

  _sohist->clear();
  
  MetaSQLQuery mql = mqlLoad(":/so/displays/SalesHistory.mql");
  ParameterList params;
  _dates->appendValue(params);
  _warehouse->appendValue(params);
  _parameter->appendValue(params);
  params.append("orderByInvcdateItem");
  q = mql.toQuery(params);

  if (q.first())
  {
    double totalUnits = 0.0;
    double totalSales = 0.0;
    double totalCosts = 0.0;
    bool exchangeError = false;
    XTreeWidgetItem *last = 0;

    do
    {
      if (q.value("baseunitprice").toDouble() < 0.0)
        exchangeError = true;
      QString invoicedate = tr("Return");
      if (q.value("cohist_invcdate").toString() != "")
        invoicedate = formatDate(q.value("cohist_invcdate").toDate());
        
      last = new XTreeWidgetItem( _sohist, last, q.value("cohist_id").toInt(),
				 q.value("cohist_ordernumber"),
				 q.value("invoicenumber"),
				 formatDate(q.value("cohist_orderdate").toDate()),
				 invoicedate,
				 q.value("item_number"),
				 q.value("itemdescription"),
				 formatQty(q.value("cohist_qtyshipped").toDouble()),
				 formatSalesPrice(q.value("baseunitprice").toDouble()),
				 formatMoney(q.value("baseextprice").toDouble()),
				 formatCost(q.value("cohist_unitcost").toDouble()),
				 formatMoney(q.value("extcost").toDouble()) );
 
      totalUnits += q.value("cohist_qtyshipped").toDouble();
      totalSales += q.value("baseextprice").toDouble();
      totalCosts += q.value("extcost").toDouble();
    }
    while (q.next());

    XTreeWidgetItem *totals = new XTreeWidgetItem(_sohist, last, -1,
						  QVariant(tr("Totals")));
    totals->setText(6, formatQty(totalUnits));
    totals->setText(EXTPRICE_COL, formatMoney(totalSales));
    totals->setText(EXTCOST_COL, formatCost(totalCosts));

    if ( (exchangeError) && (_showPrices->isChecked()) )
      QMessageBox::warning( this, tr("Currency Exchange Rate Error"),
                            tr("One or more of the Prices could not be converted to Base Currency.\n"
                               "These Prices have been set to a negative value.") );
  }
}
开发者ID:,项目名称:,代码行数:62,代码来源:

示例7: sViewDocument

void dspGLTransactions::sViewDocument()
{
  XTreeWidgetItem * item = (XTreeWidgetItem*)_gltrans->currentItem();
  if(0 == item)
    return;

  ParameterList params;
  if(item->rawValue("gltrans_doctype").toString() == "VO")
  {
    q.prepare("SELECT vohead_id, vohead_misc"
              "  FROM vohead"
              " WHERE (vohead_number=:vohead_number)");
    q.bindValue(":vohead_number", item->rawValue("docnumber").toString());
    q.exec();
    if(!q.first())
      return;

    params.append("vohead_id", q.value("vohead_id").toInt());
    params.append("mode", "view");
    
    if(q.value("vohead_misc").toBool())
    {
      miscVoucher *newdlg = new miscVoucher();
      newdlg->set(params);
      omfgThis->handleNewWindow(newdlg);
    }
    else
    {
      voucher *newdlg = new voucher();
      newdlg->set(params);
      omfgThis->handleNewWindow(newdlg);
    }

  }
  else if(item->rawValue("gltrans_doctype").toString() == "IN")
  {
    q.prepare("SELECT invchead_id"
              "  FROM invchead"
              " WHERE (invchead_invcnumber=:invchead_invcnumber)");
    q.bindValue(":invchead_invcnumber", item->rawValue("docnumber").toString());
    q.exec();
    if(!q.first())
      return;

    invoice::viewInvoice(q.value("invchead_id").toInt());
  }
  else if(item->rawValue("gltrans_doctype").toString() == "PO")
  {
    q.prepare("SELECT pohead_id"
              "  FROM pohead"
              " WHERE (pohead_number=:pohead_number)");
    q.bindValue(":pohead_number", item->rawValue("docnumber").toString());
    q.exec();
    if(!q.first())
      return;

    params.append("pohead_id", q.value("pohead_id").toInt());
    params.append("mode", "view");

    purchaseOrder *newdlg = new purchaseOrder();
    newdlg->set(params);
    omfgThis->handleNewWindow(newdlg);
  }
  else if(item->rawValue("gltrans_doctype").toString() == "SH")
  {
    q.prepare("SELECT shiphead_id"
              "  FROM shiphead"
              " WHERE (shiphead_number=:shiphead_number)");
    q.bindValue(":shiphead_number", item->rawValue("docnumber").toString());
    q.exec();
    if(!q.first())
      return;

    params.append("shiphead_id", q.value("shiphead_id").toInt());

    dspShipmentsByShipment *newdlg = new dspShipmentsByShipment();
    newdlg->set(params);
    omfgThis->handleNewWindow(newdlg);
  }
  else if( (item->rawValue("gltrans_doctype").toString() == "CM") || (item->rawValue("gltrans_doctype").toString() == "DM") )
  {
    if(item->rawValue("gltrans_source").toString() == "A/P")
    {
      q.prepare("SELECT apopen_id"
                "  FROM apopen"
                " WHERE (apopen_docnumber=:docnumber)");
      q.bindValue(":docnumber", item->rawValue("docnumber").toString());
      q.exec();
      if(!q.first())
        return;

      params.append("mode", "view");
      params.append("apopen_id", q.value("apopen_id").toInt());
      apOpenItem newdlg(this, "", TRUE);
      newdlg.set(params);
      newdlg.exec();
    }
    else if(item->rawValue("gltrans_source").toString() == "A/R")
    {
      q.prepare("SELECT aropen_id"
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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