virtual void help(const string &command, ParameterList ¶ms) const { if (command == "-i" || command == "--input" || command == "-o" || command == "--output") { cout << "Set current input/output file.\n" << "Usage:\n" << "\tmesher ((--input|-i)|(--output|-o)) (path)\n\n" << "The command is transitory and passive.\n" << "Any further instance of the command will override any previous one.\n" << "Executive commands will use the most recently bound pathname.\n" << endl; params.clear(); } else if (command == "-c" || command == "--convert") { string inf,outf,op; if (0 < params.size()) inf = params[0]; if (1 < params.size()) outf = params[1]; if (2 < params.size()) op = params[2]; params.clear(); ConversionImplList& registry = getRegistry(); for (ConversionImplList::iterator cit=registry.begin(); cit!=registry.end(); ++cit) cit->second->conversionHelp(inf, outf, op); } else { cerr << "Warning: ConvertHandler::help() received an unrecognized command" << endl; } }
bool display::setParams(ParameterList & params) { bool ret = _data->setParams(params); if(engine() && engine()->globalObject().property("setParams").isFunction()) { QScriptValue paramArg = ParameterListtoScriptValue(engine(), params); QScriptValue tmp = engine()->globalObject().property("setParams").call(QScriptValue(), QScriptValueList() << paramArg); ret = ret && tmp.toBool(); params.clear(); ParameterListfromScriptValue(paramArg, params); } return ret; }
void shipOrder::sHandleTo() { XSqlQuery shipHandleTo; _coitem->clear(); _shipment->setEnabled(false); _shipment->removeOrderLimit(); sHandleButtons(); shipHandleTo.prepare("SELECT tohead_freight_curr_id, tohead_destname," " tohead_destaddress1," " SUM(toitem_freight) + tohead_freight AS freight " "FROM tohead JOIN toitem ON (toitem_tohead_id=tohead_id) " "WHERE ((toitem_status<>'X')" " AND (tohead_src_warehous_id=:warehous_id)" " AND (tohead_id=:tohead_id)) " "GROUP BY tohead_freight_curr_id, tohead_destname," " tohead_destaddress1, tohead_freight;"); shipHandleTo.bindValue(":tohead_id", _order->id()); shipHandleTo.bindValue(":warehous_id", _warehouse->id()); shipHandleTo.exec(); if (shipHandleTo.first()) { _freight->setId(shipHandleTo.value("tohead_freight_curr_id").toInt()); _freight->setLocalValue(shipHandleTo.value("freight").toDouble()); _billToName->setText(tr("Transfer Order")); _shipToName->setText(shipHandleTo.value("tohead_destname").toString()); _shipToAddr1->setText(shipHandleTo.value("tohead_destaddress1").toString()); } else if (shipHandleTo.lastError().type() != QSqlError::NoError) { systemError(this, shipHandleTo.lastError().databaseText(), __FILE__, __LINE__); return; } QString sql("SELECT shiphead_id " "FROM shiphead " "<? if exists(\"shiphead_id\") ?>" "WHERE (shiphead_id=<? value(\"shiphead_id\") ?>)" "<? else ?>" "WHERE (shiphead_number=getOpenShipment('TO', <? value(\"tohead_id\") ?>, <? value(\"warehous_id\") ?>))" "<? endif ?>" ";" ); ParameterList params; params.append("tohead_id", _order->id()); params.append("warehous_id", _warehouse->id()); if (_shipment->isValid()) params.append("shiphead_id", _shipment->id()); MetaSQLQuery mql(sql); shipHandleTo = mql.toQuery(params); if (shipHandleTo.first()) { if (_shipment->id() != shipHandleTo.value("shiphead_id").toInt()) _shipment->setId(shipHandleTo.value("shiphead_id").toInt()); if (shipHandleTo.next()) { _shipment->setType("TO"); _shipment->limitToOrder(_order->id()); _shipment->setEnabled(true); } } else if (shipHandleTo.lastError().type() != QSqlError::NoError) { systemError(this, shipHandleTo.lastError().databaseText(), __FILE__, __LINE__); return; } else if (_shipment->isValid()) { params.clear(); params.append("tohead_id", _order->id()); params.append("warehous_id", _warehouse->id()); MetaSQLQuery mql(sql); shipHandleTo = mql.toQuery(params); if (shipHandleTo.first()) { _shipment->setId(shipHandleTo.value("shiphead_id").toInt()); if (shipHandleTo.next()) { _shipment->setType("TO"); _shipment->limitToOrder(_order->id()); _shipment->setEnabled(true); } } else if (shipHandleTo.lastError().type() != QSqlError::NoError) { systemError(this, shipHandleTo.lastError().databaseText(), __FILE__, __LINE__); return; } else _shipment->clear(); } else { QMessageBox::warning(this, tr("Nothing to ship"), tr("<p>You may not ship this Transfer Order because " "no stock has been issued to shipping for it.")); _order->setFocus(); return; } }
void shipOrder::sHandleSo() { XSqlQuery shipHandleSo; _coitem->clear(); _shipment->setEnabled(false); _shipment->removeOrderLimit(); sHandleButtons(); shipHandleSo.prepare( "SELECT DISTINCT" " cohead_holdtype, cust_name, cohead_shiptoname, " " cohead_shiptoaddress1, cohead_curr_id, cohead_freight " "FROM cohead JOIN custinfo ON (cust_id=cohead_cust_id)" " JOIN coitem ON (coitem_cohead_id=cohead_id)" " JOIN itemsite ON (itemsite_id=coitem_itemsite_id) " "WHERE ((cohead_id=:sohead_id)" " AND (itemsite_warehous_id=:warehous_id));" ); shipHandleSo.bindValue(":sohead_id", _order->id()); shipHandleSo.bindValue(":warehous_id", _warehouse->id()); shipHandleSo.exec(); if (shipHandleSo.first()) { QString msg; if ( (shipHandleSo.value("cohead_holdtype").toString() == "C")) msg = storedProcErrorLookup("shipShipment", -12); else if (shipHandleSo.value("cohead_holdtype").toString() == "P") msg = storedProcErrorLookup("shipShipment", -13); else if (shipHandleSo.value("cohead_holdtype").toString() == "R") msg = storedProcErrorLookup("shipShipment", -14); else if (shipHandleSo.value("cohead_holdtype").toString() == "S") msg = storedProcErrorLookup("shipShipment", -15); if (! msg.isEmpty()) { QMessageBox::warning(this, tr("Cannot Ship Order"), msg); if (_captive) { _reject = true; // so set() can return an error reject(); // this only works if shipOrder has been exec()'ed } else { _order->setId(-1); return; } } _freight->setId(shipHandleSo.value("cohead_curr_id").toInt()); _freight->setLocalValue(shipHandleSo.value("cohead_freight").toDouble()); _billToName->setText(shipHandleSo.value("cust_name").toString()); _shipToName->setText(shipHandleSo.value("cohead_shiptoname").toString()); _shipToAddr1->setText(shipHandleSo.value("cohead_shiptoaddress1").toString()); QString sql("SELECT shiphead_id " "FROM shiphead " "<? if exists(\"shiphead_id\") ?>" "WHERE (shiphead_id=<? value(\"shiphead_id\") ?>)" "<? else ?>" "WHERE (shiphead_number=getOpenShipment('SO', <? value(\"sohead_id\") ?>, <? value(\"warehous_id\") ?>))" "<? endif ?>" ";" ); ParameterList params; params.append("sohead_id", _order->id()); params.append("warehous_id", _warehouse->id()); if (_shipment->isValid()) params.append("shiphead_id", _shipment->id()); MetaSQLQuery mql(sql); shipHandleSo = mql.toQuery(params); if (shipHandleSo.first()) { if (_shipment->id() != shipHandleSo.value("shiphead_id").toInt()) _shipment->setId(shipHandleSo.value("shiphead_id").toInt()); if (shipHandleSo.next()) { _shipment->setType("SO"); _shipment->limitToOrder(_order->id()); _shipment->setEnabled(true); } } else if (shipHandleSo.lastError().type() != QSqlError::NoError) { systemError(this, shipHandleSo.lastError().databaseText(), __FILE__, __LINE__); return; } else if (_shipment->isValid()) { params.clear(); params.append("sohead_id", _order->id()); params.append("warehous_id", _warehouse->id()); MetaSQLQuery mql(sql); shipHandleSo = mql.toQuery(params); if (shipHandleSo.first()) { _shipment->setId(shipHandleSo.value("shiphead_id").toInt()); if (shipHandleSo.next()) { _shipment->setType("SO"); _shipment->limitToOrder(_order->id()); _shipment->setEnabled(true); } } else if (shipHandleSo.lastError().type() != QSqlError::NoError) { systemError(this, shipHandleSo.lastError().databaseText(), __FILE__, __LINE__); return; } else _shipment->clear(); } else { QMessageBox::warning(this, tr("Nothing to ship"), tr("<p>You may not ship this Sales Order because " "no stock has been issued to shipping for it.")); _order->setFocus(); return; } } else if (shipHandleSo.lastError().type() != QSqlError::NoError) { systemError(this, shipHandleSo.lastError().databaseText(), __FILE__, __LINE__); return; } }
virtual QString toString(MetaSQLInfo * mif, const ParameterList & params, int * nBreaks = 0, bool * isContinue = 0) { //qDebug("MetaSQLBlock::toString()"); QString results = QString::null; MetaSQLOutput * output = 0; bool b = false, myContinue = false, found; int myBreaks = 0; int i = 0, n = 0, ii = 0; QList<QVariant> list; QVariant v, t; ParameterList pList; QString str; switch(_block) { case BlockIf: case BlockElseIf: //qDebug(" BlockIf/BlockEleseIf"); b = _if_func->toVariant(params, nBreaks, isContinue).toBool(); if(_if_not) b = !b; if(b) { //qDebug(" Expression evaluated TRUE"); for(i = 0; i < _items.size(); i++) { output = _items.at(i); results += output->toString(mif, params, nBreaks, isContinue); if(nBreaks && *nBreaks) break; } } else if(_alt) { //qDebug(" Expression evaluated FALSE"); results = _alt->toString(mif, params, nBreaks, isContinue); } break; case BlockForEach: //qDebug(" BlockForEach"); // HERE v = params.value(_loopVar, &found); if(found) { list = v.toList(); for(i = 0; i < list.count(); i++) { str = _loopVar + "__FOREACH_POS__"; // create a new params list with our special var added in pList.clear(); pList.append(str, i); for(n = 0; n < params.count(); n++) { if(params.name(n) != str) { pList.append(params.name(n), params.value(n)); } } myBreaks = 0; myContinue = false; // execute the block for(ii = 0; ii < _items.size(); ii++) { output = _items.at(ii); results += output->toString(mif, pList, &myBreaks, &myContinue); if(myBreaks) break; } if(myBreaks > 0) { myBreaks--; if(myBreaks > 0 || !myContinue) { if(nBreaks) *nBreaks = myBreaks; if(isContinue) *isContinue = myContinue; break; } } } } break; case BlockElse: case BlockGeneric: //qDebug(" BlockElse/BlockGeneric"); for(i = 0; i < _items.size(); i++) { output = _items.at(i); results += output->toString(mif, params, nBreaks, isContinue); if(nBreaks && *nBreaks) break; } break; default: qDebug("Encountered unknown Block type %d.", _block); }; return results; }
int AuthorizeDotNetProcessor::doCredit(const int pccardid, const QString &pcvv, const double pamount, const double ptax, const bool ptaxexempt, const double pfreight, const double pduty, const int pcurrid, QString &pneworder, QString &preforder, int &pccpayid, ParameterList &pparams) { Q_UNUSED(pcvv); if (DEBUG) qDebug("AN:doCredit(%d, pcvv, %f, %f, %d, %f, %f, %d, %s, %s, %d)", pccardid, pamount, ptax, ptaxexempt, pfreight, pduty, pcurrid, pneworder.toLatin1().data(), preforder.toLatin1().data(), pccpayid); int returnValue = 0; double amount = pamount; int currid = pcurrid; bool tryVoid = false; QString approvalCode; QString request; returnValue = buildFollowup(pccpayid, preforder, amount, currid, request, "CREDIT"); if (returnValue != 0) return returnValue; XSqlQuery anq; anq.prepare("SELECT ccpay_card_pan_trunc," " (ccpay_transaction_datetime > CURRENT_DATE" " AND ccpay_amount = :amount) AS tryVoid," " ccpay_r_code," " formatbytea(decrypt(setbytea(ccard_number)," " setbytea(:key),'bf')) AS ccard_number" " FROM ccpay LEFT OUTER JOIN ccard ON (ccpay_ccard_id=ccard_id)" " WHERE (ccpay_id=:ccpayid);"); anq.bindValue(":ccpayid", pccpayid); anq.bindValue(":key", omfgThis->_key); anq.bindValue(":now", QDateTime::currentDateTime()); anq.bindValue(":amount", amount); anq.exec(); if (anq.first()) { QString cardnum = anq.value("ccpay_card_pan_trunc").toString(); if (cardnum.isEmpty()) cardnum = anq.value("ccard_number").toString(); APPENDFIELD(request, "x_card_num", cardnum.right(4)); tryVoid = anq.value("tryVoid").toBool(); approvalCode = anq.value("ccpay_r_code").toString(); } else if (anq.lastError().type() != QSqlError::NoError) { _errorMsg = anq.lastError().databaseText(); return -1; } QString response; returnValue = sendViaHTTP(request, response); if (returnValue < 0) return returnValue; returnValue = handleResponse(response, pccardid, "R", amount, currid, pneworder, preforder, pccpayid, pparams); // TODO: make more precise - look for return code 54 if (returnValue < 0 && tryVoid) { int voidResult = 0; QString tmpErrorMsg = _errorMsg; ParameterList voidParams; _errorMsg.clear(); voidResult = doVoidPrevious(pccardid, pcvv, amount, currid, pneworder, preforder, approvalCode, pccpayid, voidParams); if (voidResult >= 0) { returnValue = voidResult; pparams.clear(); while (! voidParams.isEmpty()) pparams.append(voidParams.takeFirst()); } else _errorMsg = tmpErrorMsg; } return returnValue; }