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


C++ XTreeWidgetItem::id方法代码示例

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


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

示例1: sReceiptsToggleCleared

void reconcileBankaccount::sReceiptsToggleCleared()
{
  XTreeWidgetItem *item = (XTreeWidgetItem*)_receipts->currentItem();
  XTreeWidgetItem *child = 0;
  bool setto = true;

  if(0 == item)
    return;

  _receipts->scrollToItem(item);
  if(item->altId() == 3)
  {
    setto = item->text(0) == tr("No");
    for (int i = 0; i < item->childCount(); i++)
    {
      child = item->child(i);
      if(child->text(0) != (setto ? tr("Yes") : tr("No")))
      {
        q.prepare("SELECT toggleBankrecCleared(:bankrecid, :source, :sourceid) AS cleared");
        q.bindValue(":bankrecid", _bankrecid);
        q.bindValue(":sourceid", child->id());
        if(child->altId()==1)
          q.bindValue(":source", "GL");
        else if(child->altId()==2)
          q.bindValue(":source", "AD");
        q.exec();
        if(q.first())
          child->setText(0, (q.value("cleared").toBool() ? tr("Yes") : tr("No") ));
	else if (q.lastError().type() != QSqlError::NoError)
	{
	  systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	  return;
	}
      }
    }
    item->setText(0, (setto ? tr("Yes") : tr("No")));
  }
  else
  {
    q.prepare("SELECT toggleBankrecCleared(:bankrecid, :source, :sourceid) AS cleared");
    q.bindValue(":bankrecid", _bankrecid);
    q.bindValue(":sourceid", item->id());
    if(item->altId()==1)
      q.bindValue(":source", "GL");
    else if(item->altId()==2)
      q.bindValue(":source", "AD");
    q.exec();
    if(q.first())
    {
      item->setText(0, (q.value("cleared").toBool() ? tr("Yes") : tr("No") ));

      item = (XTreeWidgetItem*)item->QTreeWidgetItem::parent();
      if(item != 0 && item->altId() == 3)
      {
        setto = true;
	for (int i = 0; i < item->childCount(); i++)
        {
          setto = (setto && (item->child(i)->text(0) == tr("Yes")));
        }
        item->setText(0, (setto ? tr("Yes") : tr("No")));
      }
    }
    else
    {
      populate();
      if (q.lastError().type() != QSqlError::NoError)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return;
      }
    }
  }
}
开发者ID:,项目名称:,代码行数:73,代码来源:

示例2: sReceiptsToggleCleared

void reconcileBankaccount::sReceiptsToggleCleared()
{
  XSqlQuery reconcileReceiptsToggleCleared;
  XTreeWidgetItem *item = (XTreeWidgetItem*)_receipts->currentItem();
  XTreeWidgetItem *child = 0;
  bool setto = true;

  if(0 == item)
    return;

  _receipts->scrollToItem(item);

  if(item->altId() == 9)
  {
    setto = item->text(0) == tr("No");
    for (int i = 0; i < item->childCount(); i++)
    {
      child = item->child(i);
      if(child->text(0) != (setto ? tr("Yes") : tr("No")))
      {
        double rate = QLocale().toDouble(child->text(6));
        double baseamount = QLocale().toDouble(child->text(7));
        double amount = QLocale().toDouble(child->text(8));

        if (_allowEdit->isChecked() && child->text(0) != tr("Yes"))
        {
          ParameterList params;
          params.append("transtype", "receipt");
          params.append("bankaccntid", _bankaccnt->id());
          params.append("bankrecid", _bankrecid);
          params.append("sourceid", child->id());
          if(child->altId()==1)
            params.append("source", "GL");
          else if(child->altId()==2)
            params.append("source", "SL");
          else if(child->altId()==3)
            params.append("source", "AD");
          toggleBankrecCleared newdlg(this, "", TRUE);
          newdlg.set(params);
          newdlg.exec();
        }
        else
        {
          reconcileReceiptsToggleCleared.prepare("SELECT toggleBankrecCleared(:bankrecid, :source, :sourceid, :currrate, :amount) AS cleared");
          reconcileReceiptsToggleCleared.bindValue(":bankrecid", _bankrecid);
          reconcileReceiptsToggleCleared.bindValue(":sourceid", child->id());
          if(child->altId()==1)
            reconcileReceiptsToggleCleared.bindValue(":source", "GL");
          else if(child->altId()==2)
            reconcileReceiptsToggleCleared.bindValue(":source", "SL");
          else if(child->altId()==3)
            reconcileReceiptsToggleCleared.bindValue(":source", "AD");
          reconcileReceiptsToggleCleared.bindValue(":currrate", rate);
          reconcileReceiptsToggleCleared.bindValue(":amount", amount);
          reconcileReceiptsToggleCleared.exec();
          if(reconcileReceiptsToggleCleared.first())
            child->setText(0, (reconcileReceiptsToggleCleared.value("cleared").toBool() ? tr("Yes") : tr("No") ));
          else if (reconcileReceiptsToggleCleared.lastError().type() != QSqlError::NoError)
          {
            systemError(this, reconcileReceiptsToggleCleared.lastError().databaseText(), __FILE__, __LINE__);
            return;
          }
        }
      }
    }
    item->setText(0, (setto ? tr("Yes") : tr("No")));
    populate();
  }
  else
  {
    double rate = QLocale().toDouble(item->text(6));
    double baseamount = QLocale().toDouble(item->text(7));
    double amount = QLocale().toDouble(item->text(8));
    
    if (_allowEdit->isChecked() && item->text(0) != tr("Yes"))
    {
      ParameterList params;
      params.append("transtype", "receipt");
      params.append("bankaccntid", _bankaccnt->id());
      params.append("bankrecid", _bankrecid);
      params.append("sourceid", item->id());
      if(item->altId()==1)
        params.append("source", "GL");
      else if(item->altId()==2)
        params.append("source", "SL");
      else if(item->altId()==3)
        params.append("source", "AD");
      toggleBankrecCleared newdlg(this, "", TRUE);
      newdlg.set(params);
      newdlg.exec();
      populate();
    }
    else
    {
      reconcileReceiptsToggleCleared.prepare("SELECT toggleBankrecCleared(:bankrecid, :source, :sourceid, :currrate, :amount) AS cleared");
      reconcileReceiptsToggleCleared.bindValue(":bankrecid", _bankrecid);
      reconcileReceiptsToggleCleared.bindValue(":sourceid", item->id());
      if(item->altId()==1)
        reconcileReceiptsToggleCleared.bindValue(":source", "GL");
      else if(item->altId()==2)
//.........这里部分代码省略.........
开发者ID:adammorawski,项目名称:qt-client,代码行数:101,代码来源:reconcileBankaccount.cpp

示例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: sConvert

void dspQuotesByCustomer::sConvert()
{
  if ( QMessageBox::information( this, tr("Convert Selected Quote(s)"),
                                 tr("Are you sure that you want to convert the selected Quote(s) to Sales Order(s)?" ),
                                 tr("&Yes"), tr("&No"), QString::null, 0, 1 ) == 0)
  {
    XSqlQuery check;
    check.prepare( "SELECT quhead_number, cust_creditstatus "
                   "FROM quhead, cust "
                   "WHERE ( (quhead_cust_id=cust_id)"
                   " AND (quhead_id=:quhead_id) );" );

    XSqlQuery convert;
    convert.prepare("SELECT convertQuote(:quhead_id) AS sohead_id;");

    int counter = 0;
    int soheadid = -1;

    QList<QTreeWidgetItem*> selected = _so->selectedItems();
    for (int i = 0; i < selected.size(); i++)
    {
      XTreeWidgetItem *cursor = (XTreeWidgetItem*)selected[i];
      check.bindValue(":quhead_id", cursor->id());
      check.exec();
      if (check.first())
      {
	if ( (check.value("cust_creditstatus").toString() == "H") && (!_privileges->check("CreateSOForHoldCustomer")) )
	{
	  QMessageBox::warning( this, tr("Cannot Convert Quote"),
				tr( "Quote #%1 is for a Customer that has been placed on a Credit Hold and you do not have\n"
				    "privilege to create Sales Orders for Customers on Credit Hold.  The selected\n"
				    "Customer must be taken off of Credit Hold before you may create convert this Quote." )
				.arg(check.value("quhead_number").toString()) );
	  return;
	}	

	if ( (check.value("cust_creditstatus").toString() == "W") && (!_privileges->check("CreateSOForWarnCustomer")) )
	{
	  QMessageBox::warning( this, tr("Cannot Convert Quote"),
				tr( "Quote #%1 is for a Customer that has been placed on a Credit Warning and you do not have\n"
				    "privilege to create Sales Orders for Customers on Credit Warning.  The selected\n"
				    "Customer must be taken off of Credit Warning before you may create convert this Quote." )
				.arg(check.value("quhead_number").toString()) );
	  return;
	}	
      }
      else
      {
	systemError( this, tr("A System Error occurred at %1::%2.")
			   .arg(__FILE__)
			   .arg(__LINE__) );
	continue;
      }

      convert.bindValue(":quhead_id", cursor->id());
      convert.exec();
      if (convert.first())
      { 
	soheadid = convert.value("sohead_id").toInt();
	if(soheadid < 0)
	{
	  QMessageBox::warning( this, tr("Cannot Convert Quote"),
				tr( "Quote #%1 has one or more line items without a warehouse specified.\n"
				    "These line items must be fixed before you may convert this quote." )
				.arg(check.value("quhead_number").toString()) );
	  return;
	}
	counter++;
	omfgThis->sSalesOrdersUpdated(soheadid);
      }
      else
      {
	systemError( this, tr("A System Error occurred at %1::%2.")
			   .arg(__FILE__)
			   .arg(__LINE__) );
	return;
      }
    }

    if (counter)
      omfgThis->sQuotesUpdated(-1);

    if (counter == 1)
      salesOrder::editSalesOrder(soheadid, true);
  }
}
开发者ID:,项目名称:,代码行数:86,代码来源:

示例5: sViewDocument

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

  ParameterList params;
  if(item->rawValue("sltrans_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("sltrans_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("sltrans_doctype").toString() == "PO")
  {
    QStringList docnumber = item->rawValue("docnumber").toString().split("-");
    q.prepare("SELECT pohead_id"
              "  FROM pohead"
              " WHERE (pohead_number=:docnumber)");
    q.bindValue(":docnumber", docnumber[0]);
    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("sltrans_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("sltrans_doctype").toString() == "CM") || (item->rawValue("sltrans_doctype").toString() == "DM") )
  {
    if(item->rawValue("sltrans_source").toString() == "A/P")
    {
      q.prepare("SELECT apopen_id"
                "  FROM apopen"
                " WHERE ((apopen_docnumber=:docnumber) "
                "  AND (apopen_doctype='C'));");
      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("sltrans_source").toString() == "A/R")
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例6: sViewDocument

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

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

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

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

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

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

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

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

    dspShipmentsByShipment *newdlg = new dspShipmentsByShipment();
    newdlg->set(params);
    omfgThis->handleNewWindow(newdlg, Qt::ApplicationModal);
  }
  else if( (item->rawValue("gltrans_doctype").toString() == "CM") || (item->rawValue("gltrans_doctype").toString() == "DM") )
  {
    if(item->rawValue("gltrans_source").toString() == "A/P")
    {
      dspViewDocument.prepare("SELECT apopen_id"
                "  FROM apopen"
                " WHERE ( (apopen_docnumber=:docnumber) "
                "  AND (apopen_journalnumber=:journalnumber)"
                "  AND (apopen_doctype IN ('C', 'D')) );");
      dspViewDocument.bindValue(":docnumber", item->rawValue("docnumber").toString());
      dspViewDocument.bindValue(":journalnumber", item->rawValue("gltrans_journalnumber").toString());
      dspViewDocument.exec();
      if(!dspViewDocument.first())
        return;

      params.append("mode", "view");
      params.append("apopen_id", dspViewDocument.value("apopen_id").toInt());
      apOpenItem newdlg(this, "", TRUE);
      newdlg.set(params);
//.........这里部分代码省略.........
开发者ID:Dinesh-Ramakrishnan,项目名称:qt-client,代码行数:101,代码来源:dspGLTransactions.cpp

示例7: sComplete

/*
  TODO: refactor printChecks/printChecksReview so that printChecks
	hands printChecksReview a list of checks to be reviewed
	instead of populating printChecksReview directly.  Then
	printChecksReview could populate its GUI from this list.
	This will allow printChecksReview to have real error reporting
	and recovery: requery the db for the entire passed-in list
	and show the current state of each check so the user can
	decide what to reprocess if there were errors.
*/
void printChecksReview::sComplete()
{
  XSqlQuery checkPrint;
  checkPrint.prepare( "SELECT markCheckAsPrinted(:check_id) AS result;");

  XSqlQuery checkVoid;
  checkVoid.prepare( "SELECT voidCheck(:check_id) AS result;" );

  XSqlQuery checkReplace;
  checkReplace.prepare( "SELECT replaceVoidedCheck(:check_id) AS result;" );

  // no returns in the loop: process as much as possible, regardless of errors
  for (int i = 0; i < _checks->topLevelItemCount(); i++)
  {
    XTreeWidgetItem *cursor = (XTreeWidgetItem*)(_checks->topLevelItem(i));

    switch(cursor->altId())
    {
      case ActionPrinted:
        checkPrint.bindValue(":check_id", cursor->id());
        checkPrint.exec();
	if (checkPrint.first())
	{
	  int result = checkPrint.value("result").toInt();
	  if (result < 0)
	    systemError(this, storedProcErrorLookup("markCheckPrinted", result), __FILE__, __LINE__);
	}
	else if (checkPrint.lastError().type() != QSqlError::NoError)
	  systemError(this, checkPrint.lastError().databaseText(), __FILE__, __LINE__);
        break;
      case ActionVoided:
        checkVoid.bindValue(":check_id", cursor->id());
        checkVoid.exec();
	if (checkVoid.first())
	{
	  int result = checkVoid.value("result").toInt();
	  if (result < 0)
	    systemError(this, storedProcErrorLookup("voidCheck", result), __FILE__, __LINE__);
	}
	else if (checkVoid.lastError().type() != QSqlError::NoError)
	  systemError(this, checkVoid.lastError().databaseText(), __FILE__, __LINE__);
        break;
      case ActionReplaced:
        checkVoid.bindValue(":check_id", cursor->id());
        checkVoid.exec();
	if (checkVoid.first())
	{
	  int result = checkVoid.value("result").toInt();
	  if (result < 0)
	    systemError(this, storedProcErrorLookup("voidCheck", result), __FILE__, __LINE__);
	}
	else if (checkVoid.lastError().type() != QSqlError::NoError)
	  systemError(this, checkVoid.lastError().databaseText(), __FILE__, __LINE__);
        checkReplace.bindValue(":check_id", cursor->id());
        checkReplace.exec();
	if (checkReplace.first())
	{
	  int result = checkReplace.value("result").toInt();
	  if (result < 0)
	    systemError(this, storedProcErrorLookup("replaceVoidedCheck", result), __FILE__, __LINE__);
	}
	else if (checkReplace.lastError().type() != QSqlError::NoError)
	  systemError(this, checkReplace.lastError().databaseText(), __FILE__, __LINE__);
        break;
    }
  }
  // TODO: after refactoring, handle any errors in the loop here and *return*

  close();
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:80,代码来源:printChecksReview.cpp

示例8: sPrint

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,代码来源:


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