void printShippingForm::sHandleTo() { if (_to->isValid()) { _so->setId(-1); QString sql("SELECT tohead_id AS order_id, tohead_destname AS shipto, " " tohead_destaddress1 AS addr1, shiphead_order_type, " " shiphead_id, shiphead_shipchrg_id, shiphead_shipped, " " COALESCE(shiphead_shipform_id, tohead_shipform_id) AS shipform_id " "FROM tohead, shiphead " "WHERE ((tohead_id=shiphead_order_id)" " AND (shiphead_order_type='TO')" " AND (tohead_id=<? value(\"tohead_id\") ?> )" "<? if exists(\"shiphead_id\") ?>" " AND (shiphead_id=<? value(\"shiphead_id\") ?> )" "<? endif ?>" ") " "ORDER BY shiphead_shipped " "LIMIT 1;"); ParameterList params; MetaSQLQuery mql(sql); params.append("tohead_id", _to->id()); if (_shipment->isValid()) params.append("shiphead_id", _shipment->id()); q = mql.toQuery(params); if (q.first()) { if (_shipment->id() != q.value("shiphead_id").toInt()) _shipment->setId(q.value("shiphead_id").toInt()); _shipToName->setText(q.value("shipto").toString()); _shipToAddr1->setText(q.value("addr1").toString()); _shippingForm->setId(q.value("shipform_id").toInt()); _shipchrg->setId(q.value("shiphead_shipchrg_id").toInt()); } else if (q.lastError().type() != QSqlError::None) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } else if (_shipment->isValid()) { _shipment->setId(-1); sHandleTo(); } else { QMessageBox::critical(this, tr("Could not find data"), tr("<p>Could not find a Shipment for this Transfer Order.")); depopulate(); } } else { depopulate(); } }
void QScriptDebuggerLocalsModelPrivate::repopulate(QScriptDebuggerLocalsModelNode *node) { if (node->populationState != QScriptDebuggerLocalsModelNode::Populated) return; depopulate(node); if (node->property.value().type() == QScriptDebuggerValue::ObjectValue) populateIndex(indexFromNode(node)); }
void printShippingForm::sHandleOrder() { if (_order->isSO()) sHandleSo(); else if (_order->isTO()) sHandleTo(); else { _shipment->removeOrderLimit(); _shipment->clear(); depopulate(); } }
void printShippingForm::sHandleShipment() { if (_shipment->isValid()) { ParameterList params; MetaSQLQuery mql = mqlLoad("shippingForm", "shipment"); params.append("shiphead_id", _shipment->id()); if (_metrics->boolean("MultiWhs")) params.append("MultiWhs"); if (_order->isValid() && _order->isSO()) params.append("sohead_id", _order->id()); if (_order->isValid() && _order->isTO()) params.append("tohead_id", _order->id()); q = mql.toQuery(params); if (q.first()) { int orderid = q.value("order_id").toInt(); if ((q.value("shiphead_order_type").toString() == "SO") && ((_order->id() != orderid) || (!_order->isSO()))) _order->setId(orderid, "SO"); else if ((q.value("shiphead_order_type").toString() == "TO") && ((_order->id() != orderid) || (!_order->isTO()))) _order->setId(orderid,"TO"); _shipToName->setText(q.value("shipto").toString()); _shipToAddr1->setText(q.value("addr1").toString()); _shippingForm->setId(q.value("shipform_id").toInt()); _shipchrg->setId(q.value("shiphead_shipchrg_id").toInt()); } else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } else { QMessageBox::critical(this, tr("Could not find data"), tr("<p>Could not find shipment on this order.")); _shipment->setId(-1); } } else { depopulate(); } }
void printShippingForm::sHandleTo() { _shipment->clear(); _shipment->setType(ShipmentClusterLineEdit::TransferOrder); _shipment->limitToOrder(_order->id()); QString sql("SELECT tohead_id AS order_id, tohead_destname AS shipto, " " tohead_destaddress1 AS addr1, shiphead_order_type, " " shiphead_id, shiphead_shipchrg_id, shiphead_shipped, " " COALESCE(shiphead_shipform_id, tohead_shipform_id) AS shipform_id " "FROM tohead, shiphead " "WHERE ((tohead_id=shiphead_order_id)" " AND (shiphead_order_type='TO')" " AND (tohead_id=<? value(\"tohead_id\") ?> )" "<? if exists(\"shiphead_id\") ?>" " AND (shiphead_id=<? value(\"shiphead_id\") ?> )" "<? endif ?>" ") " "ORDER BY shiphead_shipped " "LIMIT 1;"); ParameterList params; MetaSQLQuery mql(sql); params.append("tohead_id", _order->id()); if (_shipment->isValid()) params.append("shiphead_id", _shipment->id()); q = mql.toQuery(params); if (q.first()) { if (_shipment->id() != q.value("shiphead_id").toInt()) _shipment->setId(q.value("shiphead_id").toInt()); _shipToName->setText(q.value("shipto").toString()); _shipToAddr1->setText(q.value("addr1").toString()); _shippingForm->setId(q.value("shipform_id").toInt()); _shipchrg->setId(q.value("shiphead_shipchrg_id").toInt()); } else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } else depopulate(); }
void printShippingForm::sHandleShipment() { if (_shipment->isValid()) { ParameterList params; MetaSQLQuery mql = mqlLoad(":/sr/forms/printShippingForm/HandleShipment.mql"); params.append("shiphead_id", _shipment->id()); if (_metrics->boolean("MultiWhs")) params.append("MultiWhs"); if (_so->isValid()) params.append("sohead_id", _so->id()); if (_to->isValid()) params.append("tohead_id", _to->id()); q = mql.toQuery(params); if (q.first()) { int orderid = q.value("order_id").toInt(); if (q.value("shiphead_order_type").toString() == "SO" && _so->id() != orderid) { _to->setId(-1); _so->setId(orderid); } else if (q.value("shiphead_order_type").toString() == "TO" && _to->id() != orderid) { _so->setId(-1); _to->setId(orderid); } _shipToName->setText(q.value("shipto").toString()); _shipToAddr1->setText(q.value("addr1").toString()); _shippingForm->setId(q.value("shipform_id").toInt()); _shipchrg->setId(q.value("shiphead_shipchrg_id").toInt()); } else if (q.lastError().type() != QSqlError::None) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } else if (_so->isValid()) { _so->setId(-1); sHandleShipment(); } else if (_to->isValid()) { _to->setId(-1); sHandleShipment(); } else { QMessageBox::critical(this, tr("Could not find data"), tr("<p>Could not find a Sales Order or " "Transfer Order for this Shipment.")); depopulate(); } } else { depopulate(); } }