void ShipmentClusterLineEdit::setStatus(ShipmentStatus pstatus) { if (pstatus != _status) { switch (pstatus) { case AllStatus: clearExtraClause(); break; case Shipped: setExtraClause(" (shiphead_shipped = TRUE) "); break; case Unshipped: setExtraClause(" (shiphead_shipped = FALSE) "); break; default: QMessageBox::critical(this, tr("Invalid Shipment Status"), tr("<p>ShipmentClusterLineEdit::setStatus received " "an invalid ShipmentStatus %1").arg(pstatus)); return; break; } } _status = pstatus; }
void ShipmentClusterLineEdit::setType(ShipmentType ptype) { if (ptype != _type) { switch (ptype) { case All: clearExtraClause(); break; case SalesOrder: setExtraClause(" (shiphead_order_type='SO') "); break; case TransferOrder: setExtraClause(" (shiphead_order_type='TO') "); break; default: QMessageBox::critical(this, tr("Invalid Shipment Type"), tr("<p>ShipmentClusterLineEdit::setType received " "an invalid ShipmentType %1").arg(ptype)); return; break; } } _type = ptype; }
void CrmClusterLineEdit::sSearch() { QString oldextra = extraClause(); setExtraClause(QString(oldextra.isEmpty() ? " " : (oldextra + " AND ")) + QString("hasPrivOnObject('VIEW', '%1')").arg(_objtype)); VirtualClusterLineEdit::sSearch(); setExtraClause(oldextra); }
void RaLineEdit::setAllowedStatuses(const RaLineEdit::RaStatuses p) { if (p & (Open | Closed) || p == 0) clearExtraClause(); else if (p & Open) setExtraClause(" AND (rahead_status='O') "); else if (p & Closed) setExtraClause(" AND (rahead_status='C') "); else clearExtraClause(); _statuses = p; }
void CLineEdit::setType(CLineEditTypes pType) { _type = pType; QStringList list; switch (_type) { case ActiveCustomers: list.append("active"); // fall-through case AllCustomers: list.append("iscustomer"); _subtype = CRMAcctLineEdit::Cust; break; case ActiveProspects: list.append("active"); // fall-through case AllProspects: list.append("NOT iscustomer"); _subtype = CRMAcctLineEdit::Prospect; break; case ActiveCustomersAndProspects: list.append("active"); // fall-through case AllCustomersAndProspects: _subtype = CRMAcctLineEdit::CustAndProspect; break; } list.removeDuplicates(); setExtraClause(list.join(" AND ")); }
void OrderLineEdit::setExtraClause(const OrderTypes pTypes, const QString &pClause) { if (pTypes == AnyType || ((pTypes & Purchase) && ((pTypes & Return) || ! _x_metrics->boolean("EnableReturnAuth")) && (pTypes & Sales) && ((pTypes & Transfer) || ! _x_metrics->boolean("MultiWhs")))) _allClause = pClause; else { // not else if because multiple flags can be set if (pTypes | Purchase) setExtraClause("PO", pClause); if (pTypes | Return) setExtraClause("RA", pClause); if (pTypes | Sales) setExtraClause("SO", pClause); if (pTypes | Transfer) setExtraClause("TO", pClause); } VirtualClusterLineEdit::setExtraClause(buildExtraClause()); }
void RaLineEdit::setAllowedStatuses(const RaLineEdit::RaStatuses p) { if (p & (Open | Closed) || p == 0) clearExtraClause(); else if (p & Open) setExtraClause(" AND EXISTS ( SELECT raitem_id " " FROM ratiem " " WHERE ((raitem_status='O') " " AND (raitem_rahead_id=rahead_id)) "); else if (p & Closed) setExtraClause(" AND NOT EXISTS ( SELECT raitem_id " " FROM ratiem " " WHERE ((raitem_status='O') " " AND (raitem_rahead_id=rahead_id)) "); else clearExtraClause(); _statuses = p; }
// should limitToOrder and removeOrderLimit be at the lineedit level? void ShipmentCluster::limitToOrder(const int head_id) { if (head_id > 0) { switch (static_cast<ShipmentClusterLineEdit*>(_number)->type()) { case ShipmentClusterLineEdit::SalesOrder: setExtraClause(QString(" ((shiphead_order_id=%1)" "AND (shiphead_order_type='SO')) ").arg(head_id)); break; case ShipmentClusterLineEdit::TransferOrder: setExtraClause(QString(" ((shiphead_order_id=%1)" "AND (shiphead_order_type='TO')) ").arg(head_id)); break; case ShipmentClusterLineEdit::All: default: setExtraClause(QString(" (shiphead_order_id=%1) ").arg(head_id)); break; } } // else // removeOrderLimit(); }
void CmLineEdit::setCustId(int pCust) { { _custId = pCust; setExtraClause(QString(" (aropen_cust_id='%1') " " AND (aropen_doctype='C') AND (aropen_open) " " AND aropen_amount - aropen_paid - " "(SELECT COALESCE(SUM(checkhead_amount),0) " " FROM checkhead,checkitem " " WHERE ((checkhead_id=checkitem_checkhead_id) " " AND (NOT checkhead_posted) " " AND (NOT checkhead_void) " " AND (checkitem_aropen_id=aropen_id))) > 0 ").arg(pCust)); } }
// should limitToOrder and removeOrderLimit be at the lineedit level? void ShipmentCluster::limitToOrder(const int head_id) { if (head_id > 0) { switch (static_cast<ShipmentClusterLineEdit*>(_number)->type()) { case ShipmentClusterLineEdit::SalesOrder: setExtraClause(QString(" ((shiphead_order_id=%1)" "AND (shiphead_order_type='SO')) ").arg(head_id)); break; case ShipmentClusterLineEdit::TransferOrder: setExtraClause(QString(" ((shiphead_order_id=%1)" "AND (shiphead_order_type='TO')) ").arg(head_id)); break; case ShipmentClusterLineEdit::All: default: setExtraClause(QString(" (shiphead_order_id=%1) ").arg(head_id)); break; } switch (static_cast<ShipmentClusterLineEdit*>(_number)->status()) { case ShipmentClusterLineEdit::Shipped: if (!extraClause().isEmpty()) setExtraClause(extraClause().append(" AND ")); setExtraClause(extraClause().append(" (shiphead_shipped = TRUE) ")); break; case ShipmentClusterLineEdit::Unshipped: if (!extraClause().isEmpty()) setExtraClause(extraClause().append(" AND ")); setExtraClause(extraClause().append(" (shiphead_shipped = FALSE) ")); break; case ShipmentClusterLineEdit::AllStatus: default: // do nothing; break; } } // else // removeOrderLimit(); }