creditMemo::creditMemo(QWidget* parent, const char* name, Qt::WindowFlags fl) : XWidget(parent, name, fl) { setupUi(this); connect(_memoNumber, SIGNAL(editingFinished()), this, SLOT(sCheckCreditMemoNumber())); connect(_copyToShipto, SIGNAL(clicked()), this, SLOT(sCopyToShipto())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_invoiceList, SIGNAL(clicked()), this, SLOT(sInvoiceList())); connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_shipTo, SIGNAL(newId(int)), this, SLOT(populateShipto(int))); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_taxLit, SIGNAL(leftClickedURL(const QString&)), this, SLOT(sTaxDetail())); connect(_subtotal, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_tax, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_miscCharge, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_freight, SIGNAL(valueChanged()), this, SLOT(sFreightChanged())); connect(_taxzone, SIGNAL(newID(int)), this, SLOT(sTaxZoneChanged())); connect(_cust, SIGNAL(newCrmacctId(int)), _billToAddr, SLOT(setSearchAcct(int))); connect(_cust, SIGNAL(newCrmacctId(int)), _shipToAddr, SLOT(setSearchAcct(int))); connect(_cust, SIGNAL(newId(int)), _shipTo, SLOT(setCustid(int))); connect(_shipToName, SIGNAL(textChanged(QString)), this, SLOT(sConvertShipto())); connect(_shipToAddr, SIGNAL(changed()), this, SLOT(sConvertShipto())); #ifndef Q_OS_MAC _invoiceList->setMaximumWidth(25); #endif _custtaxzoneid = -1; _freightCache = 0; _taxzoneidCache = -1; _NumberGen = -1; _memoNumber->setValidator(omfgThis->orderVal()); _commission->setValidator(omfgThis->scrapVal()); _currency->setLabel(_currencyLit); _shipTo->setNameVisible(false); _shipTo->setDescriptionVisible(false); _cmitem->addColumn(tr("#"), _seqColumn, Qt::AlignCenter, true, "cmitem_linenumber" ); _cmitem->addColumn(tr("Item"), _itemColumn, Qt::AlignLeft, true, "item_number" ); _cmitem->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "description" ); _cmitem->addColumn(tr("Site"), _whsColumn, Qt::AlignCenter, true, "warehous_code" ); _cmitem->addColumn(tr("Qty UOM"), _uomColumn, Qt::AlignLeft, true, "qtyuom" ); _cmitem->addColumn(tr("Returned"), _qtyColumn, Qt::AlignRight, true, "cmitem_qtyreturned" ); _cmitem->addColumn(tr("Credited"), _qtyColumn, Qt::AlignRight, true, "cmitem_qtycredit" ); _cmitem->addColumn(tr("Price UOM"), _uomColumn, Qt::AlignLeft, true, "priceuom" ); _cmitem->addColumn(tr("Price"), _priceColumn, Qt::AlignRight, true, "cmitem_unitprice" ); _cmitem->addColumn(tr("Extended"), _moneyColumn, Qt::AlignRight, true, "extprice" ); _miscChargeAccount->setType(GLCluster::cRevenue | GLCluster::cExpense); }
creditMemo::creditMemo(QWidget* parent, const char* name, Qt::WFlags fl) : XWidget(parent, name, fl) { setupUi(this); connect(_memoNumber, SIGNAL(lostFocus()), this, SLOT(sCheckCreditMemoNumber())); connect(_copyToShipto, SIGNAL(clicked()), this, SLOT(sCopyToShipto())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_invoiceList, SIGNAL(clicked()), this, SLOT(sInvoiceList())); connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_shipToNumber, SIGNAL(lostFocus()), this, SLOT(sParseShipToNumber())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_shipToList, SIGNAL(clicked()), this, SLOT(sShipToList())); connect(_taxLit, SIGNAL(leftClickedURL(const QString&)), this, SLOT(sTaxDetail())); connect(_subtotal, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_tax, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_miscCharge, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_freight, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_freight, SIGNAL(valueChanged()), this, SLOT(sFreightChanged())); connect(_taxauth, SIGNAL(newID(int)), this, SLOT(sTaxAuthChanged())); #ifndef Q_WS_MAC _invoiceList->setMaximumWidth(25); _shipToList->setMaximumWidth(25); #endif _taxcurrid = -1; _custtaxauthid = -1; _taxauthidCache = -1; _taxCache.clear(); _shiptoid = -1; _memoNumber->setValidator(omfgThis->orderVal()); _commission->setValidator(omfgThis->scrapVal()); _currency->setLabel(_currencyLit); _cmitem->addColumn(tr("#"), _seqColumn, Qt::AlignCenter, true, "cmitem_linenumber" ); _cmitem->addColumn(tr("Item"), _itemColumn, Qt::AlignLeft, true, "item_number" ); _cmitem->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "description" ); _cmitem->addColumn(tr("Site"), _whsColumn, Qt::AlignCenter, true, "warehous_code" ); _cmitem->addColumn(tr("Qty UOM"), _uomColumn, Qt::AlignLeft, true, "qtyuom" ); _cmitem->addColumn(tr("Returned"), _qtyColumn, Qt::AlignRight, true, "cmitem_qtyreturned" ); _cmitem->addColumn(tr("Credited"), _qtyColumn, Qt::AlignRight, true, "cmitem_qtycredit" ); _cmitem->addColumn(tr("Price UOM"), _uomColumn, Qt::AlignLeft, true, "priceuom" ); _cmitem->addColumn(tr("Price"), _priceColumn, Qt::AlignRight, true, "cmitem_unitprice" ); _cmitem->addColumn(tr("Extended"), _moneyColumn, Qt::AlignRight, true, "extprice" ); }
taxDetail::taxDetail(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); connect(_amountA, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_amountB, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_amountC, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_calculate, SIGNAL(clicked()), this, SLOT(sCalculateTax())); connect(_cancel, SIGNAL(clicked()), this, SLOT(sCancel())); connect(_taxCode, SIGNAL(newID(int)), this, SLOT(sCalculateTax())); connect(_taxCode, SIGNAL(newID(int)), this, SLOT(sPopulate())); _blankDetailDescriptions = false; clear(); _taxCodeInitialized = false; sCalculateTotal(); }
void taxDetail::sCalculateTax() { XSqlQuery calcq; calcq.prepare("SELECT calculateTax(:tax_id, :subtotal, 0, 'A') AS ratea," " calculateTax(:tax_id, :subtotal, 0, 'B') AS rateb," " calculateTax(:tax_id, :subtotal, 0, 'C') AS ratec;" ); calcq.bindValue(":tax_id", _taxCode->id()); calcq.bindValue(":subtotal", _subtotal->localValue()); calcq.exec(); if(calcq.first()) { _amountA->setLocalValue(calcq.value("ratea").toDouble()); _amountB->setLocalValue(calcq.value("rateb").toDouble()); _amountC->setLocalValue(calcq.value("ratec").toDouble()); sCalculateTotal(); } else if (calcq.lastError().type() != QSqlError::None) { systemError(this, calcq.lastError().databaseText(), __FILE__, __LINE__); return; } }
enum SetResponse taxDetail::set(const ParameterList & pParams ) { QVariant param; bool valid; _readonly = pParams.inList("readOnly") || (!pParams.inList("readOnly") && !_privileges->check("OverrideTax")); // tax_id first so signal/slot cascade doesn't overwrite passed-in A,B,C param = pParams.value("tax_id", &valid); _blankDetailDescriptions = !valid; if (valid) _taxCode->setId(param.toInt()); else clear(); _taxCodeInitialized = true; param = pParams.value("curr_id", &valid); if (valid) _total->setId(param.toInt()); param = pParams.value("date", &valid); if (valid) _total->setEffective(param.toDate()); param = pParams.value("valueA", &valid); if (valid) { _aCache = param.toDouble(); _amountA->setLocalValue(_aCache); } param = pParams.value("valueB", &valid); if (valid) { _bCache = param.toDouble(); _amountB->setLocalValue(_bCache); } param = pParams.value("valueC", &valid); if (valid) { _cCache = param.toDouble(); _amountC->setLocalValue(_cCache); } param = pParams.value("pctA", &valid); if (valid) { _aPctCache = param.toDouble(); _prcntA->setText(QString::number(_aPctCache)); } param = pParams.value("pctB", &valid); if (valid) { _bPctCache = param.toDouble(); _prcntB->setText(QString::number(_bPctCache)); } param = pParams.value("pctC", &valid); if (valid) { _cPctCache = param.toDouble(); _prcntC->setText(QString::number(_cPctCache)); } param = pParams.value("subtotal", &valid); if (valid) _subtotal->setLocalValue(param.toDouble()); sCalculateTotal(); if (_taxCode->id() == -1 || _subtotal->isZero()) { _calculate->setEnabled(FALSE); _calculate->hide(); } if (_readonly) { _taxCode->setEnabled(FALSE); _calculate->setEnabled(FALSE); _calculate->hide(); _save->hide(); _cancel->setText(tr("&Close")); } return NoError; }
invoice::invoice(QWidget* parent, const char* name, Qt::WFlags fl) : XWidget(parent, fl) { if(name) setObjectName(name); setupUi(this); connect(_close, SIGNAL(clicked()), this, SLOT(sClose())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_cust, SIGNAL(newId(int)), _shipTo, SLOT(setCustid(int))); connect(_cust, SIGNAL(newId(int)), this, SLOT(sPopulateCustomerInfo(int))); connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_view, SIGNAL(clicked()), this, SLOT(sView())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_copyToShipto, SIGNAL(clicked()), this, SLOT(sCopyToShipto())); connect(_taxLit, SIGNAL(leftClickedURL(const QString&)), this, SLOT(sTaxDetail())); connect(_shipTo, SIGNAL(newId(int)), this, SLOT(populateShipto(int))); connect(_shipToName, SIGNAL(textChanged(const QString&)), this, SLOT(sShipToModified())); connect(_subtotal, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_tax, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_miscAmount, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_freight, SIGNAL(valueChanged()), this, SLOT(sFreightChanged())); connect(_allocatedCM, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_outstandingCM, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_authCC, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_shipToAddr, SIGNAL(changed()), this, SLOT(sShipToModified())); connect(_shipToPhone, SIGNAL(textChanged(const QString&)), this, SLOT(sShipToModified())); connect(_authCC, SIGNAL(idChanged(int)), this, SLOT(populateCCInfo())); connect(_allocatedCM, SIGNAL(idChanged(int)), this, SLOT(populateCMInfo())); connect(_outstandingCM, SIGNAL(idChanged(int)), this, SLOT(populateCMInfo())); connect(_authCC, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(populateCCInfo())); connect(_allocatedCM, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(populateCMInfo())); connect(_outstandingCM, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(populateCMInfo())); connect(_invcitem, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool))); connect(_invcitem, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool))); connect(_invcitem, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick())); connect(_taxzone, SIGNAL(newID(int)), this, SLOT(sTaxZoneChanged())); connect(_shipChrgs, SIGNAL(newID(int)), this, SLOT(sHandleShipchrg(int))); connect(_cust, SIGNAL(newCrmacctId(int)), _billToAddr, SLOT(setSearchAcct(int))); connect(_cust, SIGNAL(newCrmacctId(int)), _shipToAddr, SLOT(setSearchAcct(int))); setFreeFormShipto(false); _custtaxzoneid = -1; _invcheadid = -1; _taxzoneidCache = -1; _loading = false; _freightCache = 0; _shipTo->setNameVisible(false); _shipTo->setDescriptionVisible(false); _invcitem->addColumn(tr("#"), _seqColumn, Qt::AlignCenter, true, "invcitem_linenumber" ); _invcitem->addColumn(tr("Order #"), _itemColumn, Qt::AlignLeft, true, "soitemnumber" ); _invcitem->addColumn(tr("Item"), _itemColumn, Qt::AlignLeft, true, "itemnumber" ); _invcitem->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "itemdescription" ); _invcitem->addColumn(tr("Qty. UOM"), _uomColumn, Qt::AlignLeft, true, "qtyuom" ); _invcitem->addColumn(tr("Ordered"), _qtyColumn, Qt::AlignRight, true, "invcitem_ordered" ); _invcitem->addColumn(tr("Billed"), _qtyColumn, Qt::AlignRight, true, "invcitem_billed" ); _invcitem->addColumn(tr("Price UOM"), _uomColumn, Qt::AlignLeft, true, "priceuom" ); _invcitem->addColumn(tr("Price"), _moneyColumn, Qt::AlignRight, true, "invcitem_price" ); _invcitem->addColumn(tr("Extended"), _bigMoneyColumn, Qt::AlignRight, true, "extprice" ); _custCurrency->setLabel(_custCurrencyLit); _project->setType(ProjectLineEdit::SalesOrder); if(!_metrics->boolean("UseProjects")) _project->hide(); _miscAmount->setAllowNegative(true); _commission->setValidator(omfgThis->percentVal()); _weight->setValidator(omfgThis->weightVal()); _paymentLit->hide(); _payment->hide(); // Issue 9895: if no objections over time, we should ultimately remove this. _recurring->setParent(-1, "I"); _recurring->setMax(_metrics->value("RecurringInvoiceBuffer").toInt()); _miscChargeAccount->setType(GLCluster::cRevenue | GLCluster::cExpense); }
invoice::invoice(QWidget* parent, const char* name, Qt::WFlags fl) : QMainWindow(parent, fl) { if(name) setObjectName(name); setupUi(this); (void)statusBar(); connect(_close, SIGNAL(clicked()), this, SLOT(sClose())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_cust, SIGNAL(newId(int)), this, SLOT(sPopulateCustomerInfo(int))); connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_view, SIGNAL(clicked()), this, SLOT(sView())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_shipToList, SIGNAL(clicked()), this, SLOT(sShipToList())); connect(_copyToShipto, SIGNAL(clicked()), this, SLOT(sCopyToShipto())); connect(_taxLit, SIGNAL(leftClickedURL(const QString&)), this, SLOT(sTaxDetail())); connect(_shipToNumber, SIGNAL(lostFocus()), this, SLOT(sParseShipToNumber())); connect(_shipToNumber, SIGNAL(returnPressed()), this, SLOT(sParseShipToNumber())); connect(_shipToName, SIGNAL(textChanged(const QString&)), this, SLOT(sShipToModified())); connect(_subtotal, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_tax, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_miscAmount, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_freight, SIGNAL(valueChanged()), this, SLOT(sFreightChanged())); connect(_allocatedCM, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_outstandingCM, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_authCC, SIGNAL(valueChanged()), this, SLOT(sCalculateTotal())); connect(_shipToAddr, SIGNAL(changed()), this, SLOT(sShipToModified())); connect(_shipToPhone, SIGNAL(textChanged(const QString&)), this, SLOT(sShipToModified())); connect(_authCC, SIGNAL(idChanged(int)), this, SLOT(populateCCInfo())); connect(_allocatedCM, SIGNAL(idChanged(int)), this, SLOT(populateCMInfo())); connect(_outstandingCM, SIGNAL(idChanged(int)), this, SLOT(populateCMInfo())); connect(_authCC, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(populateCCInfo())); connect(_allocatedCM, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(populateCMInfo())); connect(_outstandingCM, SIGNAL(effectiveChanged(const QDate&)), this, SLOT(populateCMInfo())); connect(_invcitem, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool))); connect(_invcitem, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool))); connect(_invcitem, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick())); connect(_taxauth, SIGNAL(newID(int)), this, SLOT(sTaxAuthChanged())); statusBar()->hide(); setFreeFormShipto(false); #ifndef Q_WS_MAC _shipToList->setMaximumWidth(25); #endif _taxCache.clear(); _custtaxauthid = -1; _invcheadid = -1; _shiptoid = -1; _taxauthidCache = -1; _loading = false; _invcitem->addColumn(tr("#"), _seqColumn, Qt::AlignCenter ); _invcitem->addColumn(tr("Item"), _itemColumn, Qt::AlignLeft ); _invcitem->addColumn(tr("Description"), -1, Qt::AlignLeft ); _invcitem->addColumn(tr("Qty. UOM"), _uomColumn, Qt::AlignLeft ); _invcitem->addColumn(tr("Ordered"), _qtyColumn, Qt::AlignRight ); _invcitem->addColumn(tr("Billed"), _qtyColumn, Qt::AlignRight ); _invcitem->addColumn(tr("Price UOM"), _uomColumn, Qt::AlignLeft ); _invcitem->addColumn(tr("Price"), _moneyColumn, Qt::AlignRight ); _invcitem->addColumn(tr("Extended"), _bigMoneyColumn, Qt::AlignRight ); _custCurrency->setLabel(_custCurrencyLit); _project->setType(ProjectLineEdit::SalesOrder); if(!_metrics->boolean("UseProjects")) _project->hide(); }