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


C++ XListViewItem类代码示例

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


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

示例1: sPopulateMenu

void dspBacklogByCustomer::sPopulateMenu(Q3PopupMenu *pMenu)
{
  int  selectionCount = 0;
  bool multiSelection = FALSE;
  bool hasParents     = FALSE;
  bool hasChildren    = FALSE;
  for (XListViewItem *cursor = _soitem->firstChild(); cursor; cursor = cursor->itemBelow())
  {
    if (cursor->isSelected())
    {
      if ( (++selectionCount > 1) && (!multiSelection) )
        multiSelection = TRUE;

      if ( (cursor->altId() == -1) && (!hasParents) )
        hasParents = TRUE;

      if ( (cursor->altId() != -1) && (!hasChildren) )
        hasChildren = TRUE;
    }
  }

  int menuItem;

  if (selectionCount == 1)
  {
    menuItem = pMenu->insertItem(tr("Edit Order..."), this, SLOT(sEditOrder()), 0);
    if (!_privleges->check("MaintainSalesOrders"))
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("View Order..."), this, SLOT(sViewOrder()), 0);
    if ((!_privleges->check("MaintainSalesOrders")) && (!_privleges->check("ViewSalesOrders")))
      pMenu->setItemEnabled(menuItem, FALSE);

    if (hasChildren)
    {
      pMenu->insertSeparator();

      menuItem = pMenu->insertItem(tr("Edit Item..."), this, SLOT(sEditItem()), 0);
      if (!_privleges->check("MaintainSalesOrders"))
        pMenu->setItemEnabled(menuItem, FALSE);

      menuItem = pMenu->insertItem(tr("View Item..."), this, SLOT(sViewItem()), 0);
      if ((!_privleges->check("MaintainSalesOrders")) && (!_privleges->check("ViewSalesOrders")))
        pMenu->setItemEnabled(menuItem, FALSE);
    }
  }

  if (hasParents)
  {
    pMenu->insertSeparator();

    menuItem = pMenu->insertItem(tr("Print Packing List..."), this, SLOT(sPrintPackingList()), 0);
    if (!_privleges->check("PrintPackingLists"))
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("Add to Packing List Batch..."), this, SLOT(sAddToPackingListBatch()), 0);
    if (!_privleges->check("MaintainPackingListBatch"))
      pMenu->setItemEnabled(menuItem, FALSE);
  }
}
开发者ID:,项目名称:,代码行数:60,代码来源:

示例2: QDialog

/*
 *  Constructs a reprintInvoices as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
reprintInvoices::reprintInvoices(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
  setupUi(this);


  // signals and slots connections
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_query, SIGNAL(clicked()), this, SLOT(sQuery()));
  connect(_numOfCopies, SIGNAL(valueChanged(int)), this, SLOT(sHandleInvoiceCopies(int)));
  connect(_watermarks, SIGNAL(itemSelected(int)), this, SLOT(sEditWatermark()));

  _invoice->addColumn( tr("Invoice #"), _orderColumn, Qt::AlignRight  );
  _invoice->addColumn( tr("Doc. Date"), _dateColumn,  Qt::AlignCenter );
  _invoice->addColumn( tr("Customer"),  -1,           Qt::AlignLeft   );
  _invoice->setSelectionMode(Q3ListView::Extended);

  _watermarks->addColumn( tr("Copy #"),      _dateColumn, Qt::AlignCenter );
  _watermarks->addColumn( tr("Watermark"),   -1,          Qt::AlignLeft   );
  _watermarks->addColumn( tr("Show Prices"), _dateColumn, Qt::AlignCenter );

  _numOfCopies->setValue(_metrics->value("InvoiceCopies").toInt());
  if (_numOfCopies->value())
  {
    int           counter = 0;
    XListViewItem *cursor = _watermarks->firstChild();

    for (; cursor; cursor = cursor->nextSibling(), counter++)
    {
      cursor->setText(1, _metrics->value(QString("InvoiceWatermark%1").arg(counter)));
      cursor->setText(2, ((_metrics->value(QString("InvoiceShowPrices%1").arg(counter)) == "t") ? tr("Yes") : tr("No")));
    }
  }
}
开发者ID:,项目名称:,代码行数:41,代码来源:

示例3: buildParameters

ParameterList rptTimePhasedProductionByPlannerCode::buildParameters()
{
  ParameterList params;

  _plannerCode->appendValue(params);
  _warehouse->appendValue(params);

  XListViewItem *cursor = _periods->firstChild();
  QList<QVariant> periodList;
  while (cursor)
  {
    if (cursor->isSelected())
      periodList.append(cursor->id());

    cursor = cursor->nextSibling();
  }
  params.append("period_id_list", periodList);

  if (_capacityUnits->isChecked())
    params.append("capacityUnits");
  else if(_altCapacityUnits->isChecked())
    params.append("altCapacityUnits");
  else if(_inventoryUnits->isChecked())
    params.append("inventoryUnits");

  if(_showInactive->isChecked())
    params.append("showInactive");

  return params;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例4: if

ParameterList rptTimePhasedBookingsByProductCategory::buildParameters()
{
  ParameterList params;

  _productCategory->appendValue(params);
  _warehouse->appendValue(params);

  if(_inventoryUnits->isChecked())
    params.append("inventoryUnits");
  else if(_capacityUnits->isChecked())
    params.append("capacityUnits");
  else if(_altCapacityUnits->isChecked())
    params.append("altCapacityUnits");
  else if(_salesDollars->isChecked())
    params.append("salesDollars");

  XListViewItem *cursor = _periods->firstChild();
  QList<QVariant> periodList;
  while (cursor)
  {
    if (cursor->isSelected())
      periodList.append(cursor->id());

    cursor = cursor->nextSibling();
  }
  params.append("period_id_list", periodList);

  return params;
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例5: while

void dspTimePhasedProductionByItem::sCalculate()
{
  _columnDates.clear();
  while (_production->columns() > 3)
    _production->removeColumn(3);

  QString sql("SELECT itemsite_id, item_number, warehous_code, item_invuom");

  int columns = 1;
  XListViewItem *cursor = _periods->firstChild();
  if (cursor != 0)
  {
    do
    {
      if (_periods->isSelected(cursor))
      {
        sql += QString(", formatQty(summProd(itemsite_id, %2)) AS bucket%1")
               .arg(columns++)
               .arg(cursor->id());
  
        _production->addColumn(formatDate(((PeriodListViewItem *)cursor)->startDate()), _qtyColumn, Qt::AlignRight);

        _columnDates.append(DatePair(((PeriodListViewItem *)cursor)->startDate(), ((PeriodListViewItem *)cursor)->endDate()));
      }
    }
    while ((cursor = cursor->nextSibling()) != 0);
  }

  sql += " FROM itemsite, item, warehous "
         "WHERE ((itemsite_item_id=item_id)"
         " AND (itemsite_warehous_id=warehous_id)";

  if (_warehouse->isSelected())
    sql += " AND (itemsite_warehous_id=:warehous_id)";
 
  if (_plannerCode->isSelected())
    sql += "AND (itemsite_plancode_id=:plancode_id)";
  else if (_plannerCode->isPattern())
    sql += "AND (itemsite_plancode_id IN (SELECT plancode_id FROM plancode WHERE (plancode_code ~ :plancode_pattern))) ";

  sql += ") "
         "ORDER BY item_number;";

  q.prepare(sql);
  _warehouse->bindValue(q);
  _plannerCode->bindValue(q);
  q.exec();
  _production->populate(q);
}
开发者ID:,项目名称:,代码行数:49,代码来源:

示例6: sEditWatermark

void reprintInvoices::sEditWatermark()
{
  XListViewItem *cursor = _watermarks->selectedItem();
  ParameterList params;
  params.append("watermark", cursor->text(1));
  params.append("showPrices", (cursor->text(2) == tr("Yes")));

  editICMWatermark newdlg(this, "", TRUE);
  newdlg.set(params);
  if (newdlg.exec() == QDialog::Accepted)
  {
    cursor->setText(1, newdlg.watermark());
    cursor->setText(2, ((newdlg.showPrices()) ? tr("Yes") : tr("No")));
  }
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例7: sPrintPackingList

void dspBacklogByCustomer::sPrintPackingList()
{
  for (XListViewItem *cursor = _soitem->firstChild(); cursor; cursor = cursor->itemBelow())
  {
    if ( (cursor->isSelected()) && (cursor->altId() == -1) )
    {
      ParameterList params;
      params.append("sohead_id", cursor->id());

      printPackingList newdlg(this, "", TRUE);
      newdlg.set(params);
      newdlg.exec();
    }
  }
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例8: sPrint

void rptTimePhasedRoughCutByWorkCenter::sPrint()
{
  if (_periods->isPeriodSelected())
  {
    ParameterList params;

    if (_selectedWorkCenter->isChecked())
      params.append("wkrcnt_id", _workCenters->id());

    _warehouse->appendValue(params);

    XListViewItem *cursor = _periods->firstChild();
    QList<QVariant> periodList;
    while (cursor)
    {
      if (cursor->isSelected())
        periodList.append(cursor->id());
      
      cursor = cursor->nextSibling();
    }
    params.append("period_id_list", periodList);
      
    orReport report("TimePhasedRoughCutByWorkCenter", params);
    if (report.isValid())
      report.print();
    else
    {
      report.reportError(this);
      reject();
    }

    if (_captive)
      accept();
  }
  else
    QMessageBox::critical( this, tr("Incomplete criteria"),
                       tr( "The criteria you specified is not complete. Please make sure all\n"
                           "fields are correctly filled out before running the report." ) );

}
开发者ID:,项目名称:,代码行数:40,代码来源:

示例9: sAddToPackingListBatch

void dspBacklogByCustomer::sAddToPackingListBatch()
{
  for (XListViewItem *cursor = _soitem->firstChild(); cursor; cursor = cursor->itemBelow())
  {
    if ( (cursor->isSelected()) && (cursor->altId() == -1) )
    {
      q.prepare("SELECT addToPackingListBatch(:sohead_id, :cosmisc_id) AS result;");
      q.bindValue(":sohead_id", cursor->id());
      q.bindValue(":cosmisc_id", cursor->altId());
      q.exec();
      if (q.lastError().type() != QSqlError::None)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return;
      }
    }
  }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例10: sql

void dspSalesHistoryByItem::sFillList()
{
  _sohist->clear();

  if (!checkParameters())
    return;

  QString sql( "SELECT cohist_id, cust_name, cohist_ordernumber,"
               "       formatDate(cohist_orderdate) AS f_orderdate,"
               "       CASE WHEN (cohist_invcnumber='-1') THEN 'Credit'"
               "            ELSE TEXT(cohist_invcnumber)"
               "       END AS invoicenumber,"
               "       formatDate(cohist_invcdate, 'Return') AS f_invcdate,"
               "       cohist_qtyshipped, formatQty(cohist_qtyshipped) AS f_shipped " );

  if (_showPrices->isChecked())
    sql += ", formatSalesPrice(cohist_unitprice) AS f_price,"
           "  round(cohist_qtyshipped * cohist_unitprice, 2) AS extprice,"
           "  formatMoney(round(cohist_qtyshipped * cohist_unitprice, 2)) AS f_extprice ";

  if (_showCosts->isChecked())
    sql += ", formatSalesPrice(cohist_unitcost) AS f_cost,"
           "  (cohist_qtyshipped * cohist_unitcost) AS extcost,"
           "  formatMoney(cohist_qtyshipped * cohist_unitcost) AS f_extcost ";

  sql += "FROM cohist, cust, itemsite, item "
         "WHERE ( (cohist_itemsite_id=itemsite_id)"
         " AND (cohist_cust_id=cust_id)"
         " AND (itemsite_item_id=item_id)"
         " AND (item_id=:item_id)"
         " AND (cohist_invcdate BETWEEN :startDate AND :endDate) ";

  if (_warehouse->isSelected())
    sql += " AND (itemsite_warehous_id=:warehous_id)";

  if (_customerType->isSelected())
    sql += " AND (cust_custtype_id=:custtype_id)";
  else if (_customerType->isPattern())
    sql += " AND (cust_custtype_id IN (SELECT custtype_id FROM custtype WHERE (custtype_code ~ :custtype_pattern)))";

  sql += ") "
         "ORDER BY cohist_invcdate, cust_number; ";

  q.prepare(sql);
  _customerType->bindValue(q);
  _warehouse->bindValue(q);
  _dates->bindValue(q);
  q.bindValue(":item_id", _item->id());
  q.exec();
  if (q.first())
  {
    double totalSales = 0.0;
    double totalUnits = 0.0;
    double totalCost  = 0.0;

    do
    {
      XListViewItem *last = new XListViewItem( _sohist, _sohist->lastItem(),
                                               q.value("cohist_id").toInt(),
                                               q.value("cust_name"), q.value("cohist_ordernumber"),
                                               q.value("f_orderdate"), q.value("invoicenumber"),
                                               q.value("f_invcdate"), q.value("f_shipped") );

      if (_showPrices->isChecked())
      {
        last->setText(6, q.value("f_price"));
        last->setText(7, q.value("f_extprice"));

        if (_showCosts->isChecked())
        {
          last->setText(8, q.value("f_cost"));
          last->setText(9, q.value("f_extcost"));
        }
      }
      else if (_showCosts->isChecked())
      {
        last->setText(6, q.value("f_cost"));
        last->setText(7, q.value("f_extcost"));
      }
 
      totalUnits += q.value("cohist_qtyshipped").toDouble();
      totalSales += q.value("extprice").toDouble();
      totalCost  += q.value("extcost").toDouble();
    }
    while (q.next());

    XListViewItem *totals = new XListViewItem(_sohist, _sohist->lastItem(), -1, QVariant(tr("Totals")));
    totals->setText(5, formatQty(totalUnits));

    if (_showPrices->isChecked())
    {
      totals->setText(7, formatMoney(totalSales));

      if (_showCosts->isChecked())
        totals->setText(9, formatMoney(totalCost));
    }
    else if (_showCosts->isChecked())
      totals->setText(7, formatMoney(totalSales));
  }
}
开发者ID:,项目名称:,代码行数:100,代码来源:

示例11: tr

void printShippingForms::sPrint()
{
  if (!_printNew->isChecked() && !_printDirty->isChecked())
  {
    QMessageBox::warning( this, tr("Cannot Print Shipping Forms"),
                          tr("You must indicate if you wish to print Shipping Forms for New and/or Changed Shipments.") );
    return;
  }

  QString sql( "SELECT shiphead_id, report_name "
               "FROM shiphead, cohead, shipform, report "
               "WHERE ( (NOT shiphead_shipped)"
               " AND (shiphead_cohead_id=cohead_id)"
               " AND (shipform_report_id=report_id)"
               " AND (shipform_id=COALESCE(shiphead_shipform_id, cohead_shipform_id))"
               " AND (shiphead_sfstatus IN (" );

  if (_printNew->isChecked())
  {
    sql += "'N'";

    if (_printDirty->isChecked())
      sql += ", 'D'";
  }
  else if (_printDirty->isChecked())
    sql += "'D'";
  sql += ")) ) "
         "ORDER BY shiphead_id;";

  XSqlQuery reports;
  reports.exec(sql);
  if (reports.first())
  {
    QPrinter printer;

    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;
    }

    do
    {
      XListViewItem *cursor = _shipformWatermarks->firstChild();
      for (int counter = 0; cursor; cursor = cursor->nextSibling(), counter++ )
      {
        ParameterList params;

        params.append("cosmisc_id", reports.value("shiphead_id").toInt());
        params.append("shiphead_id", reports.value("shiphead_id").toInt());

        params.append("watermark", cursor->text(1));

#if 0
        params.append("shipchrg_id", _shipchrg->id());

#endif

        if (cursor->text(2) == tr("Yes"))
          params.append("showcosts");

        orReport report(reports.value("report_name").toString(), params);
        if (report.print(&printer, setupPrinter))
          setupPrinter = FALSE;
        else
        {
          report.reportError(this);
	  orReport::endMultiPrint(&printer);
          return;
        }
      }

      XSqlQuery setStatus;
      setStatus.prepare( "UPDATE shiphead "
                         "SET shiphead_sfstatus='P' "
                         "WHERE (shiphead_id=:shiphead_id);" );
      setStatus.bindValue(":shiphead_id", reports.value("shiphead_id").toInt());
      setStatus.exec();
    }
    while (reports.next());
    orReport::endMultiPrint(&printer);

    if (_captive)
      accept();
  }
  else
    QMessageBox::warning( this, tr("Cannot Print Shipping Forms"),
                          tr("There are no New or Changed Shipments for which Shipping Forms should be printed.") );

}
开发者ID:,项目名称:,代码行数:93,代码来源:

示例12: indentedWhereUsed

void dspIndentedWhereUsed::sFillList()
{
  _bomitem->clear();

  if (_item->isValid())
  {
    q.prepare("SELECT indentedWhereUsed(:item_id) AS workset_id;");
    q.bindValue(":item_id", _item->id());
    q.exec();
    if (q.first())
    {
      int worksetid = q.value("workset_id").toInt();

      QString sql( "SELECT bomwork_id, item_id, bomwork_parent_id,"
                   "       bomwork_seqnumber, item_number, item_invuom,"
                   "       (item_descrip1 || ' ' || item_descrip2) AS itemdescription,"
                   "       formatQtyPer(bomwork_qtyper) AS qtyper,"
                   "       formatScrap(bomwork_scrap) AS scrap,"
                   "       formatDate(bomwork_effective, 'Always') AS effective,"
                   "       formatDate(bomwork_expires, 'Never') AS expires "
                   "FROM bomwork, item "
                   "WHERE ( (bomwork_item_id=item_id)"
                   " AND (bomwork_set_id=:bomwork_set_id)" );

      if (!_showExpired->isChecked())
        sql += " AND (bomwork_expires > CURRENT_DATE)";

      if (!_showFuture->isChecked())
        sql += " AND (bomwork_effective <= CURRENT_DATE)";

      sql += ") "
             "ORDER BY bomwork_level, item_number DESC;";

      q.prepare(sql);
      q.bindValue(":bomwork_set_id", worksetid);
      q.exec();
      while (q.next())
      {
        if (q.value("bomwork_parent_id").toInt() == -1)
          new XListViewItem( _bomitem, q.value("bomwork_id").toInt(), q.value("item_id").toInt(),
                             q.value("bomwork_seqnumber"), q.value("item_number"),
                             q.value("itemdescription"), q.value("item_invuom"),
                             q.value("qtyper"), q.value("scrap"),
                             q.value("effective"), q.value("expires") );
        else
        {
          XListViewItem *cursor = _bomitem->firstChild();
          if (cursor)
          {
            do
            {
              if (cursor->id() == q.value("bomwork_parent_id").toInt())
              {
                new XListViewItem( cursor, q.value("bomwork_id").toInt(), q.value("item_id").toInt(),
                                   q.value("bomwork_seqnumber"), q.value("item_number"),
                                   q.value("itemdescription"), q.value("item_invuom"),
                                   q.value("qtyper"), q.value("scrap"),
                                   q.value("effective"), q.value("expires") );
                cursor->setOpen(TRUE);

                break;
              }
            }
            while ((cursor = cursor->itemBelow()) != NULL);
          }
        }
      }

      q.prepare("SELECT deleteBOMWorkset(:workset_id) AS result;");
      q.bindValue(":bomwork_set_id", worksetid);
      q.exec();
    }
  }
}
开发者ID:,项目名称:,代码行数:74,代码来源:

示例13: XListViewItem

void billingEditList::sFillList()

{

  _cobill->clear();



  q.exec("SELECT * FROM billingEditList;");

  if (q.first())

  {

    int           thisOrderid;

    int           orderid    = -9999;

    XListViewItem *orderLine = NULL;

    XListViewItem *lastLine  = NULL;

    XListViewItem *selected  = NULL;



//  Fill the list with the query contents

    do

    {

      thisOrderid = q.value("orderid").toInt();



//  Check to see if this a new order number

      if (thisOrderid != orderid)

      {

//  New order number, make a new list item header

        orderid  = thisOrderid;

        lastLine = NULL;



        XListViewItem *thisLine = new XListViewItem( _cobill, orderLine, q.value("orderid").toInt(), q.value("itemid").toInt(),

                                                     q.value("documentnumber"), q.value("ordernumber"),

                                                     q.value("cust_number"), q.value("billtoname") );

        orderLine = thisLine;



//  Add the distribution line

        thisLine = new XListViewItem( orderLine, q.value("orderid").toInt(), -1,

                                      "", "",

                                      q.value("sence"), q.value("account"),

                                      "", "", "", q.value("extprice") );

        if (q.value("account") == "Not Assigned")

        {

          thisLine->setColor("red");

          orderLine->setColor("red");

        }



//  If we are looking for a selected order and this is it, cache it

        if (thisOrderid == _orderid)

          selected = orderLine;

      }

      else

      {

        XListViewItem *itemLine = new XListViewItem( orderLine, lastLine, q.value("orderid").toInt(), q.value("itemid").toInt(),

                                                     "", "",

                                                     q.value("item"), q.value("itemdescrip"),

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

示例14: indentedBOM

void dspCostedIndentedBOM::sFillList()
{
  double totalCosts = 0;

  _bomitem->clear();

  if (_item->isValid())
  {
    q.prepare("SELECT indentedBOM(:item_id) AS bomwork_set_id;");
    q.bindValue(":item_id", _item->id());
    q.exec();
    if (q.first())
    {
      int _worksetid = q.value("bomwork_set_id").toInt();

      QString sql( "SELECT bomwork_id, item_id, bomwork_parent_id,"
                   "       bomwork_seqnumber, item_number, item_invuom,"
                   "       (item_descrip1 || ' ' || item_descrip2) AS itemdescription,"
                   "       formatQtyPer(bomwork_qtyper) AS qtyper,"
                   "       formatScrap(bomwork_scrap) AS scrap,"
                   "       formatDate(bomwork_effective, 'Always') AS effective,"
                   "       formatDate(bomwork_expires, 'Never') AS expires," );

     if (_useStandardCosts->isChecked())
       sql += " formatCost(bomwork_stdunitcost) AS f_unitcost,"
              " formatCost(bomwork_qtyper * (1 + bomwork_scrap) * bomwork_stdunitcost) AS f_extendedcost,"
              " (bomwork_qtyper * (1 + bomwork_scrap) * bomwork_stdunitcost) AS extendedcost,";
     else if (_useActualCosts->isChecked())
       sql += " formatCost(bomwork_actunitcost) AS f_unitcost,"
              " formatCost(bomwork_qtyper * (1 + bomwork_scrap) * bomwork_actunitcost) AS f_extendedcost,"
              " (bomwork_qtyper * (1 + bomwork_scrap) * bomwork_actunitcost) AS extendedcost,";

      sql += " bomwork_level "
             "FROM bomwork, item "
             "WHERE ((bomwork_item_id=item_id)"
             " AND (bomwork_set_id=:bomwork_set_id)"
             " AND (CURRENT_DATE BETWEEN bomwork_effective AND (bomwork_expires - 1))) "

             "UNION SELECT -1 AS bomwork_id, -1 AS item_id, -1 AS bomwork_parent_id,"
             "             99999 AS bomwork_seqnumber, costelem_type AS item_number, '' AS item_invuom,"
             "             '' AS itemdescription,"
             "             '' AS qtyper, '' AS scrap, '' AS effective, '' AS expires,";

     if (_useStandardCosts->isChecked())
       sql += " formatCost(itemcost_stdcost) AS f_unitcost,"
              " formatCost(itemcost_stdcost) AS f_extendedcost,"
              " itemcost_stdcost AS extendedcost,";
     else if (_useActualCosts->isChecked())
       sql += " formatCost(currToBase(itemcost_curr_id, itemcost_actcost, CURRENT_DATE)) AS f_unitcost,"
              " formatCost(currToBase(itemcost_curr_id, itemcost_actcost, CURRENT_DATE)) AS f_extendedcost,"
              " currToBase(itemcost_curr_id, itemcost_actcost, CURRENT_DATE) AS extendedcost,";

     sql += " -1 AS bomwork_level "
            "FROM itemcost, costelem "
            "WHERE ( (itemcost_costelem_id=costelem_id)"
            " AND (NOT itemcost_lowlevel)"
            " AND (itemcost_item_id=:item_id) ) "

            "ORDER BY bomwork_level, bomwork_seqnumber, item_number;";

      q.prepare(sql);
      q.bindValue(":bomwork_set_id", _worksetid);
      q.bindValue(":item_id", _item->id());
      q.exec();
      XListViewItem *last = NULL;

      while (q.next())
      {
        if (q.value("bomwork_parent_id").toInt() == -1)
        {
          if (q.value("bomwork_id").toInt() == -1)
          {
            last = new XListViewItem( _bomitem, last, -1, -1,
                                      "", q.value("item_number"),
                                      "", "", "", "", "" );
            last->setText(7, "");
            last->setText(8, q.value("f_unitcost").toString());
            last->setText(9, q.value("f_extendedcost").toString());
          }
          else
          {
            last = new XListViewItem( _bomitem, last, q.value("bomwork_id").toInt(), q.value("item_id").toInt(),
                                      q.value("bomwork_seqnumber"), q.value("item_number"),
                                      q.value("itemdescription"), q.value("item_invuom"),
                                      q.value("qtyper"), q.value("scrap"),
                                      q.value("effective"), q.value("expires"),
                                      q.value("f_unitcost"), q.value("f_extendedcost") );
          }

          totalCosts += q.value("extendedcost").toDouble();
        }
        else
        {
          XListViewItem *cursor = _bomitem->firstChild();
          if (cursor)
          {
            do
            {
              if (cursor->id() == q.value("bomwork_parent_id").toInt())
              {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例15: systemError

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

  XListViewItem *cursor = _invoice->firstChild();
  bool userCanceled = false;
  if (orReport::beginMultiPrint(&printer, userCanceled) == false)
  {
    if(!userCanceled)
      systemError(this, tr("Could not initialize printing system for multiple reports."));
    return;
  }
  while (cursor != 0)
  {
    if (_invoice->isSelected(cursor))
    {
      int counter = 0;

      for ( XListViewItem *watermark = _watermarks->firstChild();
            watermark; watermark = watermark->nextSibling(), counter++ )
      {
        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", ((watermark->text(2) == tr("Yes")) ? "TRUE" : "FALSE") );
          params.append("watermark", watermark->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)
      {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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