本文整理汇总了C++中XTreeWidgetItem::altId方法的典型用法代码示例。如果您正苦于以下问题:C++ XTreeWidgetItem::altId方法的具体用法?C++ XTreeWidgetItem::altId怎么用?C++ XTreeWidgetItem::altId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XTreeWidgetItem 的用法示例。
在下文中一共展示了XTreeWidgetItem::altId方法的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sChecksToggleCleared
void reconcileBankaccount::sChecksToggleCleared()
{
XTreeWidgetItem *item = (XTreeWidgetItem*)_checks->currentItem();
if(0 == item)
return;
_checks->scrollToItem(item);
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") ));
else
{
populate();
if (q.lastError().type() != QSqlError::NoError)
{
systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
return;
}
}
}
开发者ID:,项目名称:,代码行数:29,代码来源:
示例2: sPopulateMenu
void dspBacklogByCustomer::sPopulateMenu(QMenu *pMenu)
{
bool hasParents = FALSE;
bool hasChildren = FALSE;
QList<XTreeWidgetItem*> selected = _soitem->selectedItems();
for (int i = 0; i < selected.size(); i++)
{
XTreeWidgetItem *cursor = (XTreeWidgetItem*)(selected[i]);
if ( (cursor->altId() == -1) && (!hasParents) )
hasParents = TRUE;
if ( (cursor->altId() != -1) && (!hasChildren) )
hasChildren = TRUE;
}
int menuItem;
if (selected.size() == 1)
{
menuItem = pMenu->insertItem(tr("Edit Order..."), this, SLOT(sEditOrder()), 0);
if (!_privileges->check("MaintainSalesOrders"))
pMenu->setItemEnabled(menuItem, FALSE);
menuItem = pMenu->insertItem(tr("View Order..."), this, SLOT(sViewOrder()), 0);
if ((!_privileges->check("MaintainSalesOrders")) && (!_privileges->check("ViewSalesOrders")))
pMenu->setItemEnabled(menuItem, FALSE);
if (hasChildren)
{
pMenu->insertSeparator();
menuItem = pMenu->insertItem(tr("Edit Item..."), this, SLOT(sEditItem()), 0);
if (!_privileges->check("MaintainSalesOrders"))
pMenu->setItemEnabled(menuItem, FALSE);
menuItem = pMenu->insertItem(tr("View Item..."), this, SLOT(sViewItem()), 0);
if ((!_privileges->check("MaintainSalesOrders")) && (!_privileges->check("ViewSalesOrders")))
pMenu->setItemEnabled(menuItem, FALSE);
}
}
if (hasParents)
{
pMenu->insertSeparator();
menuItem = pMenu->insertItem(tr("Print Packing List..."), this, SLOT(sPrintPackingList()), 0);
if (!_privileges->check("PrintPackingLists"))
pMenu->setItemEnabled(menuItem, FALSE);
menuItem = pMenu->insertItem(tr("Add to Packing List Batch..."), this, SLOT(sAddToPackingListBatch()), 0);
if (!_privileges->check("MaintainPackingListBatch"))
pMenu->setItemEnabled(menuItem, FALSE);
}
}
开发者ID:,项目名称:,代码行数:54,代码来源:
示例3: altId
int XTreeWidgetItemProto::altId() const
{
XTreeWidgetItem *item = qscriptvalue_cast<XTreeWidgetItem*>(thisObject());
if (item)
return item->altId();
return -1;
}
开发者ID:Dinesh-Ramakrishnan,项目名称:qt-client,代码行数:7,代码来源:xtreewidgetitemproto.cpp
示例4: sClear
void selectPayments::sClear()
{
bool update = FALSE;
QList<XTreeWidgetItem*> list = _apopen->selectedItems();
XTreeWidgetItem * cursor = 0;
q.prepare("SELECT clearPayment(:apopen_id) AS result;");
for(int i = 0; i < list.size(); i++)
{
cursor = (XTreeWidgetItem*)list.at(i);
q.bindValue(":apopen_id", cursor->altId());
q.exec();
if (q.first())
{
int result = q.value("result").toInt();
if (result < 0)
{
systemError(this, cursor->text(0) + " " + cursor->text(2) + "\n" +
storedProcErrorLookup("clearPayment", result),
__FILE__, __LINE__);
return;
}
}
else if (q.lastError().type() != QSqlError::NoError)
{
systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
return;
}
update = TRUE;
}
if(update)
omfgThis->sPaymentsUpdated(-1, -1, TRUE);
}
开发者ID:,项目名称:,代码行数:33,代码来源:
示例5: sClear
void selectPayments::sClear()
{
XSqlQuery selectClear;
bool update = false;
QList<XTreeWidgetItem*> list = _apopen->selectedItems();
XTreeWidgetItem * cursor = 0;
selectClear.prepare("SELECT clearPayment(:apopen_id) AS result;");
for(int i = 0; i < list.size(); i++)
{
cursor = (XTreeWidgetItem*)list.at(i);
selectClear.bindValue(":apopen_id", cursor->altId());
selectClear.exec();
if (selectClear.first())
{
int result = selectClear.value("result").toInt();
if (result < 0)
{
ErrorReporter::error(QtCriticalMsg, this, cursor->text(0) + " " + cursor->text(2) + "\n" +
tr(" Error Clearing Payment Information"),
storedProcErrorLookup("clearPayment", result),
__FILE__, __LINE__);
return;
}
}
else if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Clearing Payment Information"),
selectClear, __FILE__, __LINE__))
{
return;
}
update = true;
}
if(update)
omfgThis->sPaymentsUpdated(-1, -1, true);
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:35,代码来源:selectPayments.cpp
示例6: sPopulateMenu
void dspVendorAPHistory::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *pSelected, int)
{
QAction *menuItem;
XTreeWidgetItem * item = (XTreeWidgetItem*)pSelected;
if (item->id() != -1)
{
menuItem = pMenu->addAction(tr("Edit..."), this, SLOT(sEdit()));
menuItem->setEnabled(_privileges->check("EditAPOpenItem"));
pMenu->addAction(tr("View A/P Open..."), this, SLOT(sView()));
menuItem = pMenu->addAction(tr("View G/L Series..."), this, SLOT(sViewGLSeries()));
menuItem->setEnabled(_privileges->check("ViewGLTransactions"));
if(item->altId() == -1 && item->text(1)==tr("Voucher"))
{
menuItem = pMenu->addAction(tr("View Voucher..."), this, SLOT(sViewVoucher()));
menuItem->setEnabled(_privileges->check("ViewVouchers") || _privileges->check("MaintainVouchers"));
if(item->rawValue("amount")==item->rawValue("balance"))
{
pMenu->addSeparator();
menuItem = pMenu->addAction(tr("Void"), this, SLOT(sVoidVoucher()));
menuItem->setEnabled(_privileges->check("VoidPostedVouchers"));
}
}
}
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:30,代码来源:dspVendorAPHistory.cpp
示例7: sPrint
void reprintCreditMemos::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 = _cmhead->selectedItems();
for (int i = 0; i < selected.size(); i++)
{
XTreeWidgetItem *cursor = (XTreeWidgetItem*)selected[i];
for (int j = 0; j < _watermarks->topLevelItemCount(); j++)
{
QTreeWidgetItem *watermark = _watermarks->topLevelItem(j);
q.prepare("SELECT findCustomerForm(:cust_id, 'C') AS _reportname;");
q.bindValue(":cust_id", cursor->altId());
q.exec();
if (q.first())
{
ParameterList params;
params.append("cmhead_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
{
orReport::endMultiPrint(&printer);
return;
}
}
else
QMessageBox::critical(this, tr("Cannot Find Credit Memo Form"),
tr("<p>The Invoice Form '%1' cannot be found. "
"One or more of the selected Credit Memos "
"cannot be printed until a Customer Form "
"Assignment is updated to remove any "
"references to this Credit Memo Form or "
"this Credit Memo Form is created." )
.arg(q.value("_reportname").toString()) );
}
}
}
orReport::endMultiPrint(&printer);
_cmhead->clearSelection();
_close->setText(tr("&Close"));
_print->setEnabled(FALSE);
}
开发者ID:,项目名称:,代码行数:58,代码来源:
示例8: expcatId
int itemSourceSearch::expcatId()
{
XTreeWidgetItem * item = (XTreeWidgetItem*)_itemsrc->currentItem();
if(item)
{
if(item->altId() == 2)
return item->id();
}
return -1;
}
开发者ID:hescoinc,项目名称:qt-client,代码行数:10,代码来源:itemSourceSearch.cpp
示例9: sFixAll
void fixSerial::sFixAll()
{
QList<XTreeWidgetItem*> all = _serial->findItems("", Qt::MatchContains);
for (int i = 0; i < all.size(); i++)
{
XTreeWidgetItem *currItem = static_cast<XTreeWidgetItem*>(all[i]);
if (currItem->altId() > 0)
fixOne(currItem);
}
sFillList();
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:11,代码来源:fixSerial.cpp
示例10: sToggleRestricted
void itemSite::sToggleRestricted()
{
XTreeWidgetItem * locitem = static_cast<XTreeWidgetItem*>(_restricted->currentItem());
if(0 == locitem)
return;
if(-1 != locitem->altId())
{
q.prepare("DELETE FROM locitem WHERE (locitem_id=:locitem_id); ");
q.bindValue(":locitem_id", locitem->altId());
q.exec();
}
else
{
q.prepare("INSERT INTO locitem(locitem_location_id, locitem_item_id) VALUES (:location_id, :item_id);");
q.bindValue(":location_id", locitem->id());
q.bindValue(":item_id", _item->id());
q.exec();
}
sFillRestricted();
}
开发者ID:,项目名称:,代码行数:22,代码来源:
示例11: sChecksToggleCleared
void reconcileBankaccount::sChecksToggleCleared()
{
XSqlQuery reconcileChecksToggleCleared;
XTreeWidgetItem *item = (XTreeWidgetItem*)_checks->currentItem();
if(0 == item)
return;
_checks->scrollToItem(item);
double rate = item->rawValue("doc_exchrate").toDouble();
double baseamount = item->rawValue("base_amount").toDouble();
double amount = item->rawValue("amount").toDouble();
if (_allowEdit->isChecked() && item->text(0) != tr("Yes"))
{
ParameterList params;
params.append("transtype", "check");
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
{
reconcileChecksToggleCleared.prepare("SELECT toggleBankrecCleared(:bankrecid, :source, :sourceid, :currrate, :amount) AS cleared");
reconcileChecksToggleCleared.bindValue(":bankrecid", _bankrecid);
reconcileChecksToggleCleared.bindValue(":sourceid", item->id());
if(item->altId()==1)
reconcileChecksToggleCleared.bindValue(":source", "GL");
else if(item->altId()==2)
reconcileChecksToggleCleared.bindValue(":source", "SL");
else if(item->altId()==3)
reconcileChecksToggleCleared.bindValue(":source", "AD");
reconcileChecksToggleCleared.bindValue(":currrate", rate);
reconcileChecksToggleCleared.bindValue(":amount", amount);
reconcileChecksToggleCleared.exec();
if(reconcileChecksToggleCleared.first())
item->setText(0, (reconcileChecksToggleCleared.value("cleared").toBool() ? tr("Yes") : tr("No") ));
else
{
populate();
if (reconcileChecksToggleCleared.lastError().type() != QSqlError::NoError)
{
systemError(this, reconcileChecksToggleCleared.lastError().databaseText(), __FILE__, __LINE__);
return;
}
}
}
}
开发者ID:adammorawski,项目名称:qt-client,代码行数:59,代码来源:reconcileBankaccount.cpp
示例12: sCollapsed
void dspFinancialReport::sCollapsed( QTreeWidgetItem * item )
{
for (int i = 0; i < item->childCount(); i++)
{
XTreeWidgetItem *child = (XTreeWidgetItem*)item->child(i);
if(child->altId() == -1)
{
for (int i = 1; i < _layout->columnCount(); i++)
item->setText(i, child->text(i));
return;
}
}
}
开发者ID:,项目名称:,代码行数:13,代码来源:
示例13: sPrintPackingList
void dspBacklogByCustomer::sPrintPackingList()
{
QList<XTreeWidgetItem*> selected = _soitem->selectedItems();
for (int i = 0; i < selected.size(); i++)
{
XTreeWidgetItem *cursor = (XTreeWidgetItem*)(selected[i]);
if (cursor->altId() == -1)
{
ParameterList params;
params.append("sohead_id", cursor->id());
printPackingList newdlg(this, "", TRUE);
newdlg.set(params);
newdlg.exec();
}
}
}
开发者ID:,项目名称:,代码行数:17,代码来源:
示例14: toString
QString XTreeWidgetItemProto::toString() const
{
QString returnVal = QString("XTreeWidgetItem");
XTreeWidgetItem *item = qscriptvalue_cast<XTreeWidgetItem*>(thisObject());
if (item)
{
QStringList data;
for (int i = 0; i < item->columnCount(); i++)
data << item->text(i);
returnVal += QString("(id = %1, altId = %2, data = [%3])")
.arg(item->id()).arg(item->altId()).arg(data.join(", "));
}
else
returnVal += "(unknown)";
return "[" + returnVal + "]";
}
开发者ID:Dinesh-Ramakrishnan,项目名称:qt-client,代码行数:17,代码来源:xtreewidgetitemproto.cpp
示例15: sAddToPackingListBatch
void dspBacklogByCustomer::sAddToPackingListBatch()
{
QList<XTreeWidgetItem*> selected = _soitem->selectedItems();
for (int i = 0; i < selected.size(); i++)
{
XTreeWidgetItem *cursor = (XTreeWidgetItem*)(selected[i]);
if (cursor->altId() == -1)
{
q.prepare("SELECT addToPackingListBatch(:sohead_id) AS result;");
q.bindValue(":sohead_id", cursor->id());
q.exec();
if (q.lastError().type() != QSqlError::NoError)
{
systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
return;
}
}
}
}
开发者ID:,项目名称:,代码行数:19,代码来源:
示例16: sFillList
void financialLayout::sFillList()
{
XSqlQuery financialFillList;
int pId = -1, pType = -1;
XTreeWidgetItem * item = (XTreeWidgetItem*)(_layout->currentItem());
if(0 != item)
{
pId = item->id();
pType = item->altId();
}
_layout->clear();
_lastStack.clear();
_last = 0;
if (_adHoc->isChecked())
{
insertFlGroupAdHoc(-1, "", 0, pId, pType);
}
else
{
insertFlGroup(-1, "", 0, pId, pType);
}
_layout->expandAll();
item = (XTreeWidgetItem*)(_layout->currentItem());
if(0 != item)
_layout->scrollToItem(item);
financialFillList.prepare ("SELECT flcol_id, flcol_name, flcol_descrip "
" FROM flcol "
" WHERE flcol_flhead_id=:flhead_id "
" ORDER BY flcol_name, flcol_descrip; ");
financialFillList.bindValue(":flhead_id", _flheadid);
financialFillList.exec();
_layouts->populate(financialFillList);
if (financialFillList.lastError().type() != QSqlError::NoError)
{
systemError(this, financialFillList.lastError().databaseText(), __FILE__, __LINE__);
return;
}
}
开发者ID:,项目名称:,代码行数:42,代码来源:
示例17: sToggleReceiving
//.........这里部分代码省略.........
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::NoError)
{
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);" );
}
q.bindValue(":voitem_id", _voitemid);
q.bindValue(":vohead_id", _voheadid);
q.bindValue(":poitem_id", _poitemid);
q.bindValue(":voitem_close", QVariant(_closePoitem->isChecked()));
q.bindValue(":voitem_qty", _qtyToVoucher->toDouble());
q.bindValue(":voitem_freight", _freightToVoucher->localValue());
q.exec();
if (q.lastError().type() != QSqlError::NoError)
{
systemError(this, _rejectedMsg.arg(q.lastError().databaseText()),
__FILE__, __LINE__);
reject();
return;
}
//Update the receipt record
if (item->text(3) == "Yes")
{
if (item->altId() == 1)
q.prepare( "UPDATE recv "
"SET recv_vohead_id=:vohead_id,recv_voitem_id=:voitem_id "
"WHERE (recv_id=:target_id);" );
else if (item->altId() == 2)
q.prepare( "UPDATE poreject "
"SET poreject_vohead_id=:vohead_id,poreject_voitem_id=:voitem_id "
"WHERE (poreject_id=:target_id);" );
}
else
{
if (item->altId() == 1)
q.prepare( "UPDATE recv "
"SET recv_vohead_id=NULL,recv_voitem_id=NULL "
"WHERE ((recv_id=:target_id)"
" AND (recv_vohead_id=:vohead_id));" );
else if (item->altId() == 2)
q.prepare( "UPDATE poreject "
"SET poreject_vohead_id=NULL,poreject_voitem_id=NULL "
"WHERE ((poreject_id=:target_id)"
" AND (poreject_vohead_id=:vohead_id));" );
}
q.bindValue(":vohead_id", _voheadid);
q.bindValue(":voitem_id", _voitemid);
q.bindValue(":target_id", item->id());
q.exec();
if (q.lastError().type() != QSqlError::NoError)
{
systemError(this, _rejectedMsg.arg(q.lastError().databaseText()),
__FILE__, __LINE__);
reject();
return;
}
}
开发者ID:,项目名称:,代码行数:101,代码来源:
示例18: 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
示例19: 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,代码来源:
示例20: 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:Dinesh-Ramakrishnan,项目名称:qt-client,代码行数:80,代码来源:printChecksReview.cpp
注:本文中的XTreeWidgetItem::altId方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论