void dspInventoryAvailabilityByParameterList::sPopulateMenu(QMenu *menu, QTreeWidgetItem *selected) { XTreeWidgetItem * item = (XTreeWidgetItem*)selected; int menuItem; menuItem = menu->insertItem(tr("View Inventory History..."), this, SLOT(sViewHistory()), 0); if (!_privileges->check("ViewInventoryHistory")) menu->setItemEnabled(menuItem, FALSE); menu->insertSeparator(); menuItem = menu->insertItem(tr("View Allocations..."), this, SLOT(sViewAllocations()), 0); if (item->rawValue("allocated").toDouble() == 0.0) menu->setItemEnabled(menuItem, FALSE); menuItem = menu->insertItem(tr("View Orders..."), this, SLOT(sViewOrders()), 0); if (item->rawValue("ordered").toDouble() == 0.0) menu->setItemEnabled(menuItem, FALSE); menuItem = menu->insertItem(tr("Running Availability..."), this, SLOT(sRunningAvailability()), 0); menu->insertSeparator(); if (((XTreeWidgetItem *)selected)->altId() == 1) { menuItem = menu->insertItem(tr("Create P/R..."), this, SLOT(sCreatePR()), 0); if (!_privileges->check("MaintainPurchaseRequests")) menu->setItemEnabled(menuItem, FALSE); menuItem = menu->insertItem(tr("Create P/O..."), this, SLOT(sCreatePO()), 0); if (!_privileges->check("MaintainPurchaseOrders")) menu->setItemEnabled(menuItem, FALSE); menu->insertSeparator(); } else if (((XTreeWidgetItem *)selected)->altId() == 2) { menuItem = menu->insertItem(tr("Create W/O..."), this, SLOT(sCreateWO()), 0); if (!_privileges->check("MaintainWorkOrders")) menu->setItemEnabled(menuItem, FALSE); menuItem = menu->insertItem(tr("Post Misc. Production..."), this, SLOT(sPostMiscProduction()), 0); if (!_privileges->check("PostMiscProduction")) menu->setItemEnabled(menuItem, FALSE); menu->insertSeparator(); } menu->insertItem(tr("View Substitute Availability..."), this, SLOT(sViewSubstituteAvailability()), 0); menu->insertSeparator(); menuItem = menu->insertItem(tr("Issue Count Tag..."), this, SLOT(sIssueCountTag()), 0); if (!_privileges->check("IssueCountTags")) menu->setItemEnabled(menuItem, FALSE); menuItem = menu->insertItem(tr("Enter Misc. Inventory Count..."), this, SLOT(sEnterMiscCount()), 0); if (!_privileges->check("EnterMiscCounts")) menu->setItemEnabled(menuItem, FALSE); }
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")); } } } }
void dspVendorAPHistory::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *pSelected) { int menuItem; XTreeWidgetItem * item = (XTreeWidgetItem*)pSelected; if (item->id() != -1) { menuItem = pMenu->insertItem(tr("Edit..."), this, SLOT(sEdit()), 0); if (!_privileges->check("EditSalesHistory")) pMenu->setItemEnabled(menuItem, FALSE); pMenu->insertItem(tr("View A/P Open..."), this, SLOT(sView()), 0); menuItem = pMenu->insertItem(tr("View G/L Series..."), this, SLOT(sViewGLSeries()), 0); if (!_privileges->check("ViewGLTransactions")) pMenu->setItemEnabled(menuItem, FALSE); if(item->altId() == -1 && item->text(1)==tr("Voucher")) { menuItem = pMenu->insertItem(tr("View Voucher..."), this, SLOT(sViewVoucher()), 0); if (!_privileges->check("ViewVouchers")) pMenu->setItemEnabled(menuItem, FALSE); if(item->rawValue("amount")==item->rawValue("balance")) { pMenu->insertSeparator(); menuItem = pMenu->insertItem(tr("Void"), this, SLOT(sVoidVoucher()), 0); if (!_privileges->check("MaintainAPMemos")) pMenu->setItemEnabled(menuItem, FALSE); } } } }
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; } } } }
void dspGLTransactions::sPopulateMenu(QMenu * menuThis, QTreeWidgetItem* pItem) { menuThis->insertItem(tr("View..."), this, SLOT(sViewTrans()), 0); menuThis->insertItem(tr("View GL Series..."), this, SLOT(sViewSeries()), 0); XTreeWidgetItem * item = (XTreeWidgetItem*)pItem; if(0 == item) return; if(item->rawValue("gltrans_doctype").toString() == "VO") menuThis->insertItem(tr("View Voucher..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "IN") menuThis->insertItem(tr("View Invoice..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "PO") menuThis->insertItem(tr("View Purchase Order..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "SH") menuThis->insertItem(tr("View Shipment..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "CM") menuThis->insertItem(tr("View Credit Memo..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "DM") menuThis->insertItem(tr("View Debit Memo..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "SO") menuThis->insertItem(tr("View Sales Order..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "WO") menuThis->insertItem(tr("View WO History..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_source").toString() == "I/M") menuThis->insertItem(tr("View Inventory History..."), this, SLOT(sViewDocument())); }
void dspJournals::sPopulateMenu(QMenu * menuThis, QTreeWidgetItem* pItem, int) { XTreeWidgetItem * item = (XTreeWidgetItem*)pItem; if(0 == item) return; menuThis->addAction(tr("View..."), this, SLOT(sViewTrans())); QAction* viewSeriesAct = menuThis->addAction(tr("View Journal Series..."), this, SLOT(sViewSeries())); viewSeriesAct->setDisabled(item->data(0, Xt::DeletedRole).toBool()); if(item->rawValue("sltrans_doctype").toString() == "VO") menuThis->addAction(tr("View Voucher..."), this, SLOT(sViewDocument())); else if(item->rawValue("sltrans_doctype").toString() == "IN") menuThis->addAction(tr("View Invoice..."), this, SLOT(sViewDocument())); else if(item->rawValue("sltrans_doctype").toString() == "PO") menuThis->addAction(tr("View Purchase Order..."), this, SLOT(sViewDocument())); else if(item->rawValue("sltrans_doctype").toString() == "SH") menuThis->addAction(tr("View Shipment..."), this, SLOT(sViewDocument())); else if(item->rawValue("sltrans_doctype").toString() == "CM") menuThis->addAction(tr("View Credit Memo..."), this, SLOT(sViewDocument())); else if(item->rawValue("sltrans_doctype").toString() == "DM") menuThis->addAction(tr("View Debit Memo..."), this, SLOT(sViewDocument())); else if(item->rawValue("sltrans_doctype").toString() == "SO") menuThis->addAction(tr("View Sales Order..."), this, SLOT(sViewDocument())); else if(item->rawValue("sltrans_doctype").toString() == "WO") menuThis->addAction(tr("View WO History..."), this, SLOT(sViewDocument())); else if(item->rawValue("sltrans_source").toString() == "I/M") menuThis->addAction(tr("View Inventory History..."), this, SLOT(sViewDocument())); }
void dspPoItemsByItem::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *pSelected, int) { QAction *menuItem; XTreeWidgetItem *item = dynamic_cast<XTreeWidgetItem*>(pSelected); if (item && item->rawValue("poitem_status") == "U") { menuItem = pMenu->addAction(tr("Edit Order..."), this, SLOT(sEditOrder())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); } menuItem = pMenu->addAction(tr("View Order..."), this, SLOT(sViewOrder())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders") || _privileges->check("ViewPurchaseOrders")); menuItem = pMenu->addAction(tr("Running Availability..."), this, SLOT(sRunningAvailability())); menuItem->setEnabled(_privileges->check("ViewInventoryAvailability")); pMenu->addSeparator(); if (item && item->rawValue("poitem_status") == "U") { menuItem = pMenu->addAction(tr("Edit Item..."), this, SLOT(sEditItem())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); } menuItem = pMenu->addAction(tr("View Item..."), this, SLOT(sViewItem())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders") || _privileges->check("ViewPurchaseOrders")); if (item && item->rawValue("poitem_status") != "C") { menuItem = pMenu->addAction(tr("Reschedule..."), this, SLOT(sReschedule())); menuItem->setEnabled(_privileges->check("ReschedulePurchaseOrders")); menuItem = pMenu->addAction(tr("Change Qty..."), this, SLOT(sChangeQty())); menuItem->setEnabled(_privileges->check("ChangePurchaseOrderQty")); pMenu->addSeparator(); } if (item && item->rawValue("poitem_status") == "O") { menuItem = pMenu->addAction(tr("Close Item..."), this, SLOT(sCloseItem())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); } else if (item && item->rawValue("poitem_status") == "C") { menuItem = pMenu->addAction(tr("Open Item..."), this, SLOT(sOpenItem())); menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders")); } }
void createFiscalYear::sHandleButtons() { XTreeWidgetItem *lastFY = _fy->topLevelItem(0); bool newAP = _choose->code() == "PERIOD" && _period->allValid() && lastFY && lastFY->rawValue("start").toDate() <= QDate::currentDate() && lastFY->rawValue("end").toDate() >= QDate::currentDate(); bool newFY = _choose->code() == "NEWFY" && _firstDay->isValid() && _style->isValid(); bool copyFY = _choose->code() == "COPYFY" && _fy->id() != -1; _save->setEnabled(newAP || newFY || copyFY); }
void editOwners::sModifyAll() { if(!_newOwner->isValid()) { QMessageBox::critical( this, tr("No New Owner"), tr("A new owner must be selected before you can continue.")); _newOwner->setFocus(); return; } int ret = QMessageBox::warning(this, tr("Confirm Ownership Modification"), tr("<p>Are you sure that you want to change the new owner " "to '%1' for the selected records?") .arg(_newOwner->username()), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if(ret == QMessageBox::Yes) { QList<XTreeWidgetItem*> all = _list->findItems("", Qt::MatchContains); for (int i = 0; i < all.size(); i++) { XTreeWidgetItem *currentItem = static_cast<XTreeWidgetItem*>(all[i]); if (currentItem->rawValue("type_name").toString() != "") modifyOne(currentItem); } sFillList(); } }
QVariant XTreeWidgetItemProto::rawValue(const QString pName) { XTreeWidgetItem *item = qscriptvalue_cast<XTreeWidgetItem*>(thisObject()); if (item) return item->rawValue(pName); return QVariant(); }
void selectPayments::sVoidVoucher() { bool update = false; QList<XTreeWidgetItem*> list = _apopen->selectedItems(); XTreeWidgetItem * cursor = 0; XSqlQuery dspVoidVoucher; dspVoidVoucher.prepare("SELECT voidApopenVoucher(:apopen_id, :voidDate) AS result;"); for(int i = 0; i < list.size(); i++) { cursor = (XTreeWidgetItem*)list.at(i); if ( (cursor->rawValue("doctype") == tr("Voucher")) && (cursor->rawValue("selected") == 0.0) ) { XDateInputDialog newdlg(this, "", true); ParameterList params; params.append("label", tr("On what date did you void the Voucher?")); params.append("default", cursor->rawValue("apopen_docdate")); newdlg.set(params); int returnVal = newdlg.exec(); if (returnVal == XDialog::Accepted) { QDate voidDate = newdlg.getDate(); dspVoidVoucher.bindValue(":apopen_id", cursor->id()); dspVoidVoucher.bindValue(":voidDate", voidDate); dspVoidVoucher.exec(); if(dspVoidVoucher.first()) { if(dspVoidVoucher.value("result").toInt() < 0) { ErrorReporter::error(QtCriticalMsg, this, tr("Error Voiding Voucher"), dspVoidVoucher, __FILE__, __LINE__); return; } } else { ErrorReporter::error(QtCriticalMsg, this, tr("Voiding Voucher"), dspVoidVoucher, __FILE__, __LINE__); return; } update = true; } } } if(update) sFillList(); }
void createFiscalYear::sHandleChoice(int selection) { QWidget *page = NULL; XTreeWidgetItem *lastFY = _fy->topLevelItem(0); bool fyExists = (lastFY != NULL); bool fyIsCurrent = fyExists && lastFY->rawValue("start").toDate() <= QDate::currentDate() && lastFY->rawValue("end").toDate() >= QDate::currentDate(); _fy->setEnabled(hasPriv(cEdit)); _period->setEnabled(hasPriv(cEdit)); _period->setVisible(fyIsCurrent); _noFYLit->setVisible(! fyIsCurrent); _fy->setVisible(fyExists); _noFYToCopyLit->setVisible(! fyExists); _save->setText(saveButtonText); if (! hasPriv()) page = _noPrivPage; else switch (selection) { case 1: page = _newPeriodPage; break; case 2: page = _newFYPage; break; case 3: page = _copyFYPage; _save->setText(tr("Copy Fiscal Year")); break; default: qWarning() << "Probable bug at" << __FILE__ << __LINE__ << ":" << selection; } if (page) { _stack->setCurrentWidget(page); } sHandleButtons(); }
void dspCountSlipsByWarehouse::sFillList() { if (DEBUG) qDebug("dspCountSlipsByWarehouse::sFillList() about to populate _cntslip"); display::sFillList(); if (_numericSlips->isChecked() && list()->topLevelItemCount() > 1) { if (DEBUG) qDebug("dspCountSlipsByWarehouse::sFillList() looking for slip # gaps " "in %d items", list()->topLevelItemCount()); XTreeWidgetItem *last =list()->topLevelItem(0); int slipNumber = last->rawValue("slipnumber").toInt(); for (int i = 1; i < list()->topLevelItemCount(); i++) { XTreeWidgetItem *curr = list()->topLevelItem(i); if (DEBUG) qDebug("row %d has slipNumber %d and current %d", i, slipNumber, curr->rawValue("slipnumber").toInt()); if (slipNumber == (curr->rawValue("slipnumber").toInt() - 1) || slipNumber == -1) slipNumber = curr->rawValue("slipnumber").toInt(); else if (slipNumber >= 0) { if (slipNumber == curr->rawValue("slipnumber").toInt() - 2) curr = new XTreeWidgetItem( list(), last, -1, QVariant("----"), "----", "----", "----", tr("Missing Slip #%1").arg(slipNumber + 1), "----", "----", "----" ); else curr = new XTreeWidgetItem( list(), last, -1, QVariant("----"), "----", "----", "----", tr("Missing Slips #%1 to #%2").arg(slipNumber + 1).arg(curr->rawValue("slipnumber").toInt() - 1), "----", "----", "----" ); curr->setTextColor(namedColor("error")); slipNumber = -1; //i++; // 'cause we just added an item! } last = curr; } } }
void listRecurringInvoices::sHandleSelection() { XTreeWidgetItem *selected = 0; QList<XTreeWidgetItem *> selectedlist = _invchead->selectedItems(); if (selectedlist.size() > 0) selected = (XTreeWidgetItem *)(selectedlist[0]); if (selected) _edit->setEnabled(_privileges->check("MaintainMiscInvoices") && !selected->rawValue("invchead_posted").toBool()); }
void commentTypes::sHandleButtons() { bool enableButtons; XTreeWidgetItem *selected = (XTreeWidgetItem*)_cmnttype->currentItem(); if (selected) enableButtons = ! selected->rawValue("cmnttype_sys").toBool(); else enableButtons = FALSE; _edit->setEnabled(enableButtons); _delete->setEnabled(enableButtons); }
void dspSalesHistoryByCustomer::sInvoiceInformation() { XTreeWidgetItem * item = (XTreeWidgetItem*)_sohist->currentItem(); if(0 == item) return; ParameterList params; params.append("invoiceNumber", item->rawValue("invoicenumber").toString()); dspInvoiceInformation *newdlg = new dspInvoiceInformation(); newdlg->set(params); omfgThis->handleNewWindow(newdlg); }
void dspAROpenItems::sVoidInvoiceDetails() { XSqlQuery dspVoidInvoiceDetails; XTreeWidgetItem *pItem = list()->currentItem(); if(pItem->rawValue("posted") != 0 && QMessageBox::question(this, tr("Void Posted Invoice?"), tr("<p>This Invoice has already been posted. " "Are you sure you want to void it?"), QMessageBox::Yes, QMessageBox::No | QMessageBox::Default) == QMessageBox::No) { return; } XSqlQuery rollback; rollback.prepare("ROLLBACK;"); XSqlQuery post; post.prepare("SELECT voidInvoice(:invchead_id) AS result;"); dspVoidInvoiceDetails.exec("BEGIN;"); // because of possible lot, serial, or location distribution cancelations post.bindValue(":invchead_id", list()->currentItem()->id("docnumber")); post.exec(); if (post.first()) { int result = post.value("result").toInt(); if (result < 0) { rollback.exec(); systemError(this, storedProcErrorLookup("voidInvoice", result), __FILE__, __LINE__); return; } else if (distributeInventory::SeriesAdjust(result, this) == XDialog::Rejected) { rollback.exec(); QMessageBox::information( this, tr("Void Invoice"), tr("Transaction Canceled") ); return; } dspVoidInvoiceDetails.exec("COMMIT;"); sFillList(); } else if (post.lastError().type() != QSqlError::NoError) { rollback.exec(); systemError(this, tr("A System Error occurred voiding Invoice.\n%1") .arg(post.lastError().databaseText()), __FILE__, __LINE__); } }
void selectPayments::sVoidVoucher() { bool update = false; QList<XTreeWidgetItem*> list = _apopen->selectedItems(); XTreeWidgetItem * cursor = 0; XSqlQuery dspVoidVoucher; dspVoidVoucher.prepare("SELECT voidApopenVoucher(:apopen_id) AS result;"); for(int i = 0; i < list.size(); i++) { cursor = (XTreeWidgetItem*)list.at(i); if ( (cursor->rawValue("doctype") == tr("Voucher")) && (cursor->rawValue("selected") == 0.0) ) { dspVoidVoucher.bindValue(":apopen_id", cursor->id()); dspVoidVoucher.exec(); if(dspVoidVoucher.first()) { if(dspVoidVoucher.value("result").toInt() < 0) { systemError( this, tr("A System Error occurred at %1::%2, Error #%3.") .arg(__FILE__) .arg(__LINE__) .arg(dspVoidVoucher.value("result").toInt()) ); return; } } else { ErrorReporter::error(QtCriticalMsg, this, tr("Voiding Voucher"), dspVoidVoucher, __FILE__, __LINE__); return; } update = true; } } if(update) sFillList(); }
void commentTypes::sHandleButtons() { XTreeWidgetItem *selected = (XTreeWidgetItem*)_cmnttype->currentItem(); if (selected && _privileges->check("MaintainCommentTypes")) { _edit->setEnabled(true); _delete->setEnabled(!selected->rawValue("cmnttype_sys").toBool()); } else { _edit->setEnabled(false); _delete->setEnabled(false); } }
void dspSummarizedBankrecHistory::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *selected, int) { QAction *menuItem; XTreeWidgetItem * item = (XTreeWidgetItem*)selected; if (item->rawValue("bankrec_posted").toBool()) { XSqlQuery menu; menu.prepare("SELECT bankrec_id " "FROM bankrec " "WHERE (bankrec_bankaccnt_id=:bankrec_bankaccnt_id) " " AND (bankrec_opendate > :bankrec_enddate) " " AND (bankrec_posted);"); menu.bindValue(":bankrec_bankaccnt_id", _bankaccnt->id()); menu.bindValue(":bankrec_enddate", item->rawValue("bankrec_enddate").toDate()); menu.exec(); if (!menu.first()) { menuItem = pMenu->addAction(tr("Reopen..."), this, SLOT(sReopen())); menuItem->setEnabled(_privileges->check("MaintainBankRec")); } } }
void viewCheckRun::sHandleItemSelection() { XTreeWidgetItem *selected = _check->currentItem(); bool select = false; if (! selected) { _void->setEnabled(FALSE); _delete->setEnabled(FALSE); _replace->setEnabled(FALSE); select = true; _edit->setEnabled(FALSE); return; } if (selected->rawValue("checkhead_void").toBool()) { _void->setEnabled(FALSE); _delete->setEnabled(TRUE); _replace->setEnabled(TRUE); _edit->setEnabled(FALSE); } else if (! selected->rawValue("checkhead_void").isNull() && ! selected->rawValue("checkhead_void").toBool()) { // This was not allowing voiding of ACH checks. No strong case could be // made to disallow this since ACH is manuall at this time. Should that // requirement change this is the original line //_void->setEnabled(selected->rawValue("checkhead_ach_batch").isNull()); _void->setEnabled(true); _delete->setEnabled(FALSE); _replace->setEnabled(FALSE); select = selected->rawValue("checkhead_ach_batch").isNull(); _edit->setEnabled(selected->rawValue("checkhead_misc").toBool() && ! selected->rawValue("checkhead_printed").toBool()); } QMenu * printMenu = new QMenu; if (select) printMenu->addAction(tr("Selected Check..."), this, SLOT(sPrint())); if (_vendorgroup->isAll()) printMenu->addAction(tr("Check Run..."), this, SLOT(sPrintCheckRun())); printMenu->addAction(tr("Edit List"), this, SLOT(sPrintEditList())); _print->setMenu(printMenu); QMenu * postMenu = new QMenu; if (selected->rawValue("checkhead_printed").toBool() && _privileges->check("PostPayments")) postMenu->addAction(tr("Selected Check..."), this, SLOT(sPost())); if (_vendorgroup->isAll()) postMenu->addAction(tr("All Checks..."), this, SLOT(sPostChecks())); _postCheck->setMenu(postMenu); }
void dspInvoiceRegister::sFillList() { display::sFillList(); list()->expandAll(); // calculate subtotals and grand total for debit and credit columns and add rows for them double debittotal = 0.0; double credittotal = 0.0; for (int i = 0; i < list()->topLevelItemCount(); i++) { double debitsum = 0.0; double creditsum = 0.0; XTreeWidgetItem *item = 0; for (int j = 0; j < list()->topLevelItem(i)->childCount(); j++) { item = list()->topLevelItem(i)->child(j); // qDebug("in loop @ %d %p", j, item); if (item) { debitsum += item->rawValue("debit").toDouble(); creditsum += item->rawValue("credit").toDouble(); debittotal += item->rawValue("debit").toDouble(); credittotal += item->rawValue("credit").toDouble(); } } if (item) { // qDebug("adding subtotal %p", item); item = new XTreeWidgetItem(list()->topLevelItem(i), -1, -1, tr("Subtotal")); item->setData(list()->column("debit"), Qt::EditRole, formatMoney(debitsum)); item->setData(list()->column("credit"), Qt::EditRole, formatMoney(creditsum)); } } XTreeWidgetItem *item = new XTreeWidgetItem(list(), -1, -1, tr("Total")); item->setData(list()->column("debit"), Qt::EditRole, formatMoney(debittotal)); item->setData(list()->column("credit"), Qt::EditRole, formatMoney(credittotal)); }
void dspVoucherRegister::sPopulateMenu(QMenu * menuThis, QTreeWidgetItem*, int) { menuThis->addAction(tr("View..."), this, SLOT(sViewTrans())); XTreeWidgetItem *item = dynamic_cast<XTreeWidgetItem*>(list()->currentItem()); if(0 == item) return; QString doctype = item->rawValue("gltrans_doctype").toString(); if (doctype == "VO") menuThis->addAction(tr("View Voucher..."), this, SLOT(sViewDocument())); else if (doctype == "IN") menuThis->addAction(tr("View Invoice..."), this, SLOT(sViewDocument())); else if (doctype == "PO") menuThis->addAction(tr("View Purchase Order..."), this, SLOT(sViewDocument())); }
void listRecurringInvoices::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem* pItem, int) { QAction *menuItem; XTreeWidgetItem *item = dynamic_cast<XTreeWidgetItem *>(pItem); if(0 == item) return; if(!item->rawValue("invchead_posted").toBool()) { menuItem = pMenu->addAction(tr("Edit..."), this, SLOT(sEdit())); menuItem->setEnabled(_privileges->check("MaintainMiscInvoices")); } menuItem = pMenu->addAction(tr("View..."), this, SLOT(sView())); menuItem->setEnabled(_privileges->check("MaintainMiscInvoices") || _privileges->check("ViewMiscInvoices")); }
void dspSalesHistoryByCustomer::sPopulateMenu(QMenu *pMenu) { int menuItem; XTreeWidgetItem * item = (XTreeWidgetItem*)_sohist->currentItem(); menuItem = pMenu->insertItem(tr("Edit..."), this, SLOT(sEdit()), 0); if (!_privileges->check("EditSalesHistory")) pMenu->setItemEnabled(menuItem, FALSE); pMenu->insertItem(tr("View..."), this, SLOT(sView()), 0); if (item->rawValue("invoicenumber").toString().length() > 0) { pMenu->insertSeparator(); menuItem = pMenu->insertItem(tr("Invoice Information..."), this, SLOT(sInvoiceInformation()), 0); } }
void selectPayments::sPopulateMenu(QMenu *pMenu,QTreeWidgetItem *selected) { QString status(selected->text(1)); QAction *menuItem; XTreeWidgetItem * item = (XTreeWidgetItem*)selected; if (_apopen->currentItem()->text("doctype") == tr("Voucher")) { menuItem = pMenu->addAction(tr("View Voucher..."), this, SLOT(sViewVoucher())); menuItem->setEnabled(_privileges->check("ViewVouchers") || _privileges->check("MaintainVouchers")); if(item->rawValue("selected") == 0.0) { menuItem = pMenu->addAction(tr("Void Voucher..."), this, SLOT(sVoidVoucher())); menuItem->setEnabled(_privileges->check("VoidPostedVouchers")); } } XSqlQuery menu; menu.prepare( "SELECT apopen_status FROM apopen WHERE apopen_id=:apopen_id;"); menu.bindValue(":apopen_id", _apopen->id()); menu.exec(); if (menu.first()) { menuItem = pMenu->addAction(tr("Edit A/P Open..."), 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(menu.value("apopen_status").toString() == "O") { menuItem = pMenu->addAction(tr("On Hold"), this, SLOT(sOnHold())); menuItem->setEnabled(_privileges->check("EditAPOpenItem")); } if(menu.value("apopen_status").toString() == "H") { menuItem = pMenu->addAction(tr("Open"), this, SLOT(sOpen())); menuItem->setEnabled(_privileges->check("EditAPOpenItem")); } } }
void dspAROpenItems::sEditInvoiceDetails() { XTreeWidgetItem *pItem = list()->currentItem(); if(pItem->rawValue("posted") != 0 && QMessageBox::question(this, tr("Edit Posted Invoice?"), tr("<p>This Invoice has already been posted. " "Are you sure you want to edit it?"), QMessageBox::Yes, QMessageBox::No | QMessageBox::Default) == QMessageBox::No) { return; } ParameterList params; params.append("invchead_id", list()->currentItem()->id("docnumber")); params.append("mode", "edit"); invoice* newdlg = new invoice(this); newdlg->set(params); omfgThis->handleNewWindow(newdlg); }
void dspItemsByClassCode::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *selected) { XTreeWidgetItem * xselected = static_cast<XTreeWidgetItem*>(selected); int menuItem; menuItem = pMenu->insertItem(tr("Edit Item Master..."), this, SLOT(sEdit()), 0); if (!_privileges->check("MaintainItemMasters")) pMenu->setItemEnabled(menuItem, FALSE); if (xselected && (xselected->rawValue("type").toString() == "M")) { menuItem = pMenu->insertItem(tr("Edit Bill of Material..."), this, SLOT(sEditBOM()), 0); if (!_privileges->check("MaintainBOMs")) pMenu->setItemEnabled(menuItem, FALSE); menuItem = pMenu->insertItem(tr("View Bill of Material..."), this, SLOT(sViewBOM()), 0); if ( (!_privileges->check("MaintainBOMs")) && (!_privileges->check("ViewBOMs")) ) pMenu->setItemEnabled(menuItem, FALSE); } }
void dspVoucherRegister::sViewDocument() { XSqlQuery dspViewDocument; XTreeWidgetItem *item = dynamic_cast<XTreeWidgetItem*>(list()->currentItem()); if(0 == item) return; QString doctype = item->rawValue("gltrans_doctype").toString(); QString docnumber = item->rawValue("gltrans_docnumber").toString(); ParameterList params; if(doctype == "VO") { dspViewDocument.prepare("SELECT vohead_id, vohead_misc" " FROM vohead" " WHERE (vohead_number=:vohead_number)"); dspViewDocument.bindValue(":vohead_number", docnumber); 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); } else { voucher *newdlg = new voucher(); newdlg->set(params); omfgThis->handleNewWindow(newdlg); } } else if(doctype == "IN") { dspViewDocument.prepare("SELECT invchead_id" " FROM invchead" " WHERE (invchead_invcnumber=:invchead_invcnumber)"); dspViewDocument.bindValue(":invchead_invcnumber", docnumber); dspViewDocument.exec(); if(!dspViewDocument.first()) return; invoice::viewInvoice(dspViewDocument.value("invchead_id").toInt()); } else if(doctype == "PO") { dspViewDocument.prepare("SELECT pohead_id" " FROM pohead" " WHERE (pohead_number=:pohead_number)"); dspViewDocument.bindValue(":pohead_number", docnumber); 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); } }
void dspCountSlipsByWarehouse::sFillList() { QString sql("SELECT cntslip_id, "); if (_numericSlips->isChecked()) sql += "toNumeric(cntslip_number, 0) AS slipnumber," "cntslip_number AS slipnumber_qtdisplayrole," ; else sql += "cntslip_number AS slipnumber, "; sql += " invcnt_tagnumber, warehous_code," " item_number, (item_descrip1 || ' ' || item_descrip2) AS descrip," " cntslip_entered, getUsername(cntslip_user_id) AS user," " cntslip_qty, 'qty' AS cntslip_qty_xtnumericrole," " cntslip_posted " "FROM cntslip, invcnt, itemsite, item, warehous " "WHERE ((cntslip_cnttag_id=invcnt_id)" " AND (invcnt_itemsite_id=itemsite_id)" " AND (itemsite_item_id=item_id)" " AND (itemsite_warehous_id=warehous_id)" " AND (cntslip_entered BETWEEN :startDate AND :endDate)"; if (!_showUnposted->isChecked()) sql += " AND (cntslip_posted)"; if (_warehouse->isSelected()) sql += " AND (itemsite_warehous_id=:warehous_id)"; sql += ") " "ORDER BY cntslip_number"; if (DEBUG) qDebug("dspCountSlipsByWarehouse::sFillList() about to populate _cntslip"); q.prepare(sql); _dates->bindValue(q); _warehouse->bindValue(q); q.exec(); _cntslip->populate(q); if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } if (_numericSlips->isChecked() && _cntslip->topLevelItemCount() > 1) { if (DEBUG) qDebug("dspCountSlipsByWarehouse::sFillList() looking for slip # gaps " "in %d items", _cntslip->topLevelItemCount()); XTreeWidgetItem *last =_cntslip->topLevelItem(0); int slipNumber = last->rawValue("slipnumber").toInt(); for (int i = 1; i < _cntslip->topLevelItemCount(); i++) { XTreeWidgetItem *curr = _cntslip->topLevelItem(i); if (DEBUG) qDebug("row %d has slipNumber %d and current %d", i, slipNumber, curr->rawValue("slipnumber").toInt()); if (slipNumber == (curr->rawValue("slipnumber").toInt() - 1) || slipNumber == -1) slipNumber = curr->rawValue("slipnumber").toInt(); else if (slipNumber >= 0) { if (slipNumber == curr->rawValue("slipnumber").toInt() - 2) curr = new XTreeWidgetItem( _cntslip, last, -1, QVariant("----"), "----", "----", "----", tr("Missing Slip #%1").arg(slipNumber + 1), "----", "----", "----" ); else curr = new XTreeWidgetItem( _cntslip, last, -1, QVariant("----"), "----", "----", "----", tr("Missing Slips #%1 to #%2").arg(slipNumber + 1).arg(curr->rawValue("slipnumber").toInt() - 1), "----", "----", "----" ); curr->setTextColor(namedColor("error")); slipNumber = -1; //i++; // 'cause we just added an item! } last = curr; } } }