示例#1
0
void ShiptoEdit::setId(int pId)
{
  if (pId != -1)
  {
    XSqlQuery shipto( QString( "SELECT shipto_num, shipto_name, shipto_address1, shipto_cust_id "
                               "FROM shipto "
                               "WHERE (shipto_id=%1);" )
                      .arg(pId) );
    if (shipto.first())
    {
      _id = pId;
      _valid = TRUE;

      setText(shipto.value("shipto_num").toString());

      if (shipto.value("shipto_cust_id").toInt() != _custid)
      {
        _custid = shipto.value("shipto_cust_id").toInt();
        emit newCustid(_id);
      }

      emit newId(_id);
      emit valid(_valid);
      emit nameChanged(shipto.value("shipto_name").toString());
      emit address1Changed(shipto.value("shipto_address1").toString());
    }
  }
  else
  {
    clear();

    _custid = -1;
    emit newCustid(_custid);
  }
}
void InvoiceLineEdit::setId(const int pId)
{
  XSqlQuery query;
  query.prepare( "SELECT cohead_id, invchead_cust_id, invchead_invcnumber "
                 "FROM invchead LEFT OUTER JOIN cohead ON (invchead_ordernumber=cohead_number) "
                 "WHERE (invchead_id=:id);" );
  query.bindValue(":id", pId);
  query.exec();
  if (query.first())
  {
    _custid = query.value("invchead_cust_id").toInt();
    _coheadid = query.value("cohead_id").toInt();
    _invoiceNumber = query.value("invchead_invcnumber").toString();
    _id = pId;
    _valid = true;

    setText(_invoiceNumber);
  }
  else
  {
    _custid = -1;
    _coheadid = -1;
    _invoiceNumber = "";
    _id = -1;
    _valid = false;

    setText("");
  }

  emit newCustid(_custid);
  emit newCoheadid(_coheadid);
  emit newInvoiceNumber(_invoiceNumber);
  emit newId(_id);
  emit valid(_valid);
}
示例#3
0
void ShiptoEdit::setId(int pId)
{
  if (pId == _id)
    return;

  VirtualClusterLineEdit::setId(pId);

  if (pId != -1)
  {
      emit nameChanged(_name);
      emit address1Changed(_description);
  }
  else
  {
    _custid = -1;
    _extraClause = " (false) ";
    emit newCustid(_custid);
  }
}
示例#4
0
void ShiptoEdit::setCustid(int pCustid)
{
  if (pCustid != _custid)
  {
    clear();

    _custid = pCustid;
    emit newCustid(pCustid);

    if (_custid == -1)
    {
      setEnabled(FALSE);
      emit disableList(TRUE);
    }
    else
    {
      setEnabled(TRUE);
      emit disableList(FALSE);
    }
  }
}
示例#5
0
void ShiptoEdit::setCustid(int pCustid)
{
  if (pCustid == _custid)
    return;

  clear();
  _custid = pCustid;

  if (_custid != -1)
  {
    _extraClause = QString(" (shipto_cust_id=%1) ").arg(_custid);
    setNewPriv("MaintainShiptos");
  }
  else
  {
    _extraClause = " (false) ";
    setNewPriv("");
  }

  sUpdateMenu();

  emit newCustid(pCustid);
  emit disableList(_custid == -1);
}