示例#1
0
void dspBankrecHistory::sFillList()
{
  XSqlQuery dspFillList;
  dspFillList.prepare( "SELECT bankrec_username, "
             "       bankrec_posted,"
             "       bankrec_postdate,"
             "       bankrec_opendate,"
             "       bankrec_enddate,"
             "       bankrec_openbal,"
             "       bankrec_endbal "
             "FROM bankrec "
             "WHERE (bankrec_id=:bankrecid);" );
  dspFillList.bindValue(":bankrecid", _bankrec->id());
  dspFillList.exec();
  if(dspFillList.first())
  {
    _poster->setText(dspFillList.value("bankrec_username").toString());
    _postdate->setDate(dspFillList.value("bankrec_postdate").toDate());
    
    ParameterList params;
    params.append("treeView", true);
    if (! setParams(params))
      return;
    
    MetaSQLQuery mql = mqlLoad("bankrecHistory", "reconciled");
    dspFillList = mql.toQuery(params);
    _rec->populate(dspFillList, true);
    if (dspFillList.lastError().type() != QSqlError::NoError)
    {
      systemError(this, dspFillList.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
    else
      _rec->expandAll();
    
    if (_showUnreconciled->isChecked())
    {
      ParameterList params2;
      params2.append("treeView", true);
      if (! setParams(params2))
        return;
      
      MetaSQLQuery mql2 = mqlLoad("bankrecHistory", "unreconciled");
      dspFillList = mql2.toQuery(params2);
      _unrec->populate(dspFillList, true);
      if (dspFillList.lastError().type() != QSqlError::NoError)
      {
        systemError(this, dspFillList.lastError().databaseText(), __FILE__, __LINE__);
        return;
      }
      else
        _unrec->expandAll();
    }
  }
}
示例#2
0
void voucherItem::sFillList()
{
    MetaSQLQuery distmql = mqlLoad("voucherItem", "distributions");

    ParameterList params;
    params.append("none", tr("None"));
    params.append("poitem_id", _poitemid);
    params.append("vohead_id", _voheadid);
    XSqlQuery distq = distmql.toQuery(params);
    _vodist->populate(distq);
    if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Retrieving Voucher Item Information"),
                             distq, __FILE__, __LINE__))
    {
        reject();
        return;
    }

    // Fill univoiced receipts list
    MetaSQLQuery recmql = mqlLoad("voucherItem", "receipts");

    params.append("receiving", tr("Receiving"));
    params.append("reject", tr("Reject"));
    XSqlQuery recq = recmql.toQuery(params);
    _uninvoiced->populate(recq, true);
    if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Retrieving Voucher Item Information "),
                             recq, __FILE__, __LINE__))
    {
        reject();
        return;
    }

    // Display the total distributed amount
    XSqlQuery totalDist;
    totalDist.prepare( "SELECT SUM(vodist_amount) AS totalamount "
                       "FROM vodist "
                       "WHERE ( (vodist_vohead_id=:vohead_id)"
                       "  AND   (vodist_poitem_id=:poitem_id) );" );
    totalDist.bindValue(":vohead_id", _voheadid);
    totalDist.bindValue(":poitem_id", _poitemid);
    totalDist.exec();
    if (totalDist.first())
        _totalDistributed->setLocalValue(totalDist.value("totalamount").toDouble() +
                                         _tax->localValue() +
                                         _freightToVoucher->localValue());
    else if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Retrieving Voucher Item Information"),
                                  totalDist, __FILE__, __LINE__))
    {
        reject();
        return;
    }
}
void updateItemSiteLeadTimes::sUpdate()
{
  ParameterList params;
  _warehouse->appendValue(params);
  _classCode->appendValue(params);

  XSqlQuery updateUpdate;
  QProgressDialog progress;
  progress.setWindowModality(Qt::ApplicationModal);
  
  MetaSQLQuery mql = mqlLoad("updateItemsiteLeadTimes", "load");
  updateUpdate = mql.toQuery(params);
  if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Loading Item Site Lead Times"),
                           updateUpdate, __FILE__, __LINE__))
  {
    return;
  }
  
  int count=0;
  progress.setMaximum(updateUpdate.size());
  XSqlQuery update;
  while (updateUpdate.next())
  {
    progress.setLabelText(tr("Site: %1\n"
                             "Item: %2 - %3")
                          .arg(updateUpdate.value("warehous_code").toString())
                          .arg(updateUpdate.value("item_number").toString())
                          .arg(updateUpdate.value("item_descrip1").toString()));
    
    ParameterList rparams = params;
    rparams.append("itemsite_id", updateUpdate.value("itemsite_id"));
    rparams.append("leadTimePad", _leadTimePad->value());
    MetaSQLQuery mql2 = mqlLoad("updateItemsiteLeadTimes", "update");
    update = mql2.toQuery(rparams);
    if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Updating Item Site Lead Times"),
                             update, __FILE__, __LINE__))
    {
      return;
    }
    
    if (progress.wasCanceled())
      break;
    
    count++;
    progress.setValue(count);
  }

  accept();
}
示例#4
0
void contactMerge::sFillList()
{

  if ((_mode->currentIndex() == 0) || (_mode->currentIndex() == 2)) // cMerge or cMergePurge
  {
    ParameterList params;
    params.append("searchText", _search->text());
    params.append("searchContactName", QVariant(_searchContact->isChecked()));
    params.append("searchPhone", QVariant(_searchPhone->isChecked()));
    params.append("searchEmail", QVariant(_searchEmail->isChecked()));
    params.append("searchNumber", QVariant(_searchNumber->isChecked()));
    params.append("searchName", QVariant(_searchName->isChecked()));
    params.append("showInactive", QVariant(_showInactive->isChecked()));
    params.append("ignoreBlanks", QVariant(!_blanks->isChecked()));
    params.append("IndentedDups", QVariant(_showGroup->isChecked()));
    params.append("CheckHnfc", QVariant(_showGroup->isChecked() && _checkHonorific->isChecked()));
    params.append("CheckFirst", QVariant(_showGroup->isChecked() && _checkFirst->isChecked()));
    params.append("CheckMiddle", QVariant(_showGroup->isChecked() && _checkMiddle->isChecked()));
    params.append("CheckLast", QVariant(_showGroup->isChecked() && _checkLast->isChecked()));
    params.append("CheckSuffix", QVariant(_showGroup->isChecked() && _checkSuffix->isChecked()));
    params.append("CheckPhone", QVariant(_showGroup->isChecked() && _checkPhone->isChecked()));
    params.append("CheckEmail", QVariant(_showGroup->isChecked() && _checkEmail->isChecked()));
    MetaSQLQuery mql = mqlLoad("contactmerge", "search");
    XSqlQuery qry = mql.toQuery(params);
    if (qry.lastError().type() != QSqlError::NoError)
    {
      systemError(this, qry.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
    _cntct->populate(qry, true);
  }
  else
  {
    ParameterList params;
    MetaSQLQuery mql = mqlLoad("contactmerge", "merged");
    XSqlQuery qry = mql.toQuery(params);
    if (qry.lastError().type() != QSqlError::NoError)
    {
      systemError(this, qry.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
    _cntct->populate(qry, true);
  }

  _cntct->expandAll();
  sPopulateSources();
  sPopulateTarget();
}
void dspSummarizedBacklogByWarehouse::sFillList()
{
  XSqlQuery dspFillList;
  ParameterList params;
  if (setParams(params))
  {
    display::sFillList();

//    if (list()->topLevelItemCount())
//    {
      MetaSQLQuery totm = mqlLoad("summarizedBacklogByWarehouse", "totals");
      dspFillList = totm.toQuery(params);
      if (dspFillList.first())
        _totalSalesOrders->setText(dspFillList.value("totalorders").toString());
      else if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Retrieving Sales Order Information"),
                                    dspFillList, __FILE__, __LINE__))
      {
        return;
      }

      MetaSQLQuery cntm = mqlLoad("summarizedBacklogByWarehouse", "counts");
      dspFillList = cntm.toQuery(params);
      if (dspFillList.first())
        _totalLineItems->setText(dspFillList.value("totalitems").toString());
      else if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Retrieving Sales Order Information"),
                                    dspFillList, __FILE__, __LINE__))
      {
        return;
      }

      MetaSQLQuery qtym = mqlLoad("summarizedBacklogByWarehouse", "qtys");
      dspFillList = qtym.toQuery(params);
      if (dspFillList.first())
        _totalQty->setText(dspFillList.value("f_totalqty").toString());
      else if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Retrieving Sales Order Information"),
                                    dspFillList, __FILE__, __LINE__))
      {
        return;
      }
//    }
//    else
//    {
//      _totalSalesOrders->clear();
//      _totalLineItems->clear();
//      _totalQty->clear();
//    }
  }
}
void returnAuthorizationWorkbench::sFillListReview()
{ 
  _ra->clear();

  //Fill Review List
  if (_closed->isChecked() && !_dates->allValid())
  {
    QMessageBox::information( this, tr("Invalid Dates"),
			      tr("<p>Invalid dates specified. Please specify a "
				 "valid date range.") );
    _dates->setFocus();
    return;
  }
  else if ((_receipts->isChecked()) || (_shipments->isChecked()) || 
	        (_payment->isChecked()) || (_closed->isChecked()) ||
			(_unauthorized->isChecked()))
  {
    MetaSQLQuery mql = mqlLoad("returnauthorizationworkbench", "review");
    ParameterList params;
    setParams(params);

    XSqlQuery rareview = mql.toQuery(params);
    _ra->populate(rareview);
    if (rareview.lastError().type() != QSqlError::NoError)
    {
      systemError(this, rareview.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
  }
}
示例#7
0
void postSubLedger::sFillList()
{
  MetaSQLQuery mql = mqlLoad("postSubLedger", "detail");
  ParameterList params;
  _subLedgerDates->appendValue(params);
  params.append("AP", tr("Accounts Payable"));
  params.append("AR", tr("Accounts Receivable"));
  params.append("GL", tr("General Ledger"));
  params.append("IM", tr("Inventory Management"));
  params.append("PD", tr("Products"));
  params.append("PO", tr("Purchase Order"));
  params.append("SO", tr("Sales Order"));
  params.append("SR", tr("Shipping and Receiving"));
  params.append("WO", tr("Work Order"));
  params.append("Other", tr("Other"));
  if (_preview->isChecked())
    params.append("preview");

  XSqlQuery qry;
  qry = mql.toQuery(params);
  _sources->populate(qry, true);
  _sources->expandAll();
  if (qry.lastError().type() != QSqlError::NoError)
  {
    systemError(this, qry.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#8
0
void postSubLedger::sPost()
{
  QStringList sources;
  QList<int> journalnumbers;
  XSqlQuery qry;
  MetaSQLQuery mql = mqlLoad("postSubLedger", "post");
  QList<XTreeWidgetItem*> selected = _sources->selectedItems();
  for (int i = 0; i < selected.size(); i++)
    sources << selected.at(i)->rawValue("sltrans_source").toString();

  ParameterList params;
  _subLedgerDates->appendValue(params);
  params.append("distDate", _distDate->date());
  params.append("source_list", sources);

  XSqlQuery jrnls;
  jrnls = mql.toQuery(params);
  if (jrnls.lastError().type() != QSqlError::NoError)
  {
    systemError(this, jrnls.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  while (jrnls.next())
    journalnumbers << jrnls.value("result").toInt();

  if (_print->isChecked() && journalnumbers.size())
    sPrint(journalnumbers);

  sFillList();
}
示例#9
0
void viewCheckRun::sFillList()
{
  QMenu * printMenu = new QMenu;
  if (_vendorgroup->isAll())
    printMenu->addAction(tr("Check Run..."), this, SLOT(sPrintCheckRun()));
  printMenu->addAction(tr("Edit List"),   this, SLOT(sPrintEditList()));
  _print->setMenu(printMenu);   

  QMenu * postMenu = new QMenu;
  if (_vendorgroup->isAll())
    postMenu->addAction(tr("Post All..."), this, SLOT(sPostChecks()));
  _postCheck->setMenu(postMenu); 
  
  MetaSQLQuery mql = mqlLoad("checkRegister", "detail");
  ParameterList params;
  params.append("bankaccnt_id", _bankaccnt->id());
  params.append("showTotal");
  params.append("newOnly");
  params.append("showDetail");
  _vendorgroup->appendValue(params);
  q = mql.toQuery(params);
  _check->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#10
0
void selectPayments::sClearAll()
{
  XSqlQuery selectClearAll;
  MetaSQLQuery mql = mqlLoad("selectPayments", "clearall");
  ParameterList params;
  if (! setParams(params))
    return;
  selectClearAll = mql.toQuery(params);
  if (selectClearAll.first())
  {
    int result = selectClearAll.value("result").toInt();
    if (result < 0)
    {
      ErrorReporter::error(QtCriticalMsg, this, tr("Error Clearing Payment Information"),
                             storedProcErrorLookup("clearPayment", result),
                             __FILE__, __LINE__);
      return;
    }
  }
  else if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Clearing Payment Information"),
                                selectClearAll, __FILE__, __LINE__))
  {
    return;
  }

  omfgThis->sPaymentsUpdated(-1, -1, true);
}
示例#11
0
void vendorPriceList::sFillList()
{
  XSqlQuery priceq;
  MetaSQLQuery mql = mqlLoad("itemSources", "prices");
  ParameterList params;
  params.append("itemsrc_id", _itemsrcid);
  params.append("nominal",tr("Nominal"));
  params.append("discount",tr("Discount"));
  params.append("price", tr("Price"));
  params.append("fixed", tr("Fixed"));
  params.append("percent", tr("Percent"));
  params.append("mixed", tr("Mixed"));
  params.append("all", tr("All"));
  params.append("stock", tr("Into Stock"));
  params.append("dropship", tr("Drop Ship"));

  priceq = mql.toQuery(params);
  _price->populate(priceq, true);

  priceq = mql.toQuery(params);
  if (priceq.first())
  _unitPrice->setId(priceq.value("itemsrcp_curr_id").toInt());
  _extendedPrice->setId(priceq.value("itemsrcp_curr_id").toInt());

  _price->clearSelection();
  for (int i = 0; i < _price->topLevelItemCount(); i++)
  {
    if ( _qty->toDouble() >= _price->topLevelItem(i)->text(0).toDouble() )
    {
    _price->setCurrentItem(_price->topLevelItem(i));
    _price->scrollToItem(_price->topLevelItem(i));
      break;
    }
  }
}
示例#12
0
void dspCreditCardTransactions::sFillList()
{
  _CCAmount->clear();
  
  MetaSQLQuery mql = mqlLoad("ccpayments", "list");
  ParameterList params;
  _customerSelector->appendValue(params);
  if (_processed->isChecked())
    params.append("processed");
  else if (_pending->isChecked())
    params.append("authorizations");
  if (!_expired->isChecked())
    params.append("validOnly");
  params.append("ccValidDays", _validDays->value());
  params.append("preauth",    tr("Preauthorization"));
  params.append("charge",     tr("Charge"));
  params.append("refund",     tr("Refund"));
  params.append("authorized", tr("Authorized"));
  params.append("approved",   tr("Approved"));
  params.append("declined",   tr("Declined"));
  params.append("voided",     tr("Voided"));
  params.append("noapproval", tr("No Approval Code"));
  q = mql.toQuery(params);
  _preauth->populate(q,true);
}
示例#13
0
void itemPricingSchedule::sFillList(int pIpsitemid)
{
    XSqlQuery itemFillList;
    MetaSQLQuery mql = mqlLoad("itemPricingSchedule", "detail");
    ParameterList params;
    params.append("ipshead_id", _ipsheadid);
    params.append("warehous_id", _warehouse->id());
    params.append("item",tr("Item"));
    params.append("prodcat", tr("Prod. Cat."));
    params.append("flatrate", tr("Flat Rate"));
    params.append("peruom", tr("Price Per UOM"));
    params.append("nominal",tr("Nominal"));
    params.append("discount",tr("Discount"));
    params.append("markup",tr("Markup"));
    params.append("freight", tr("Freight"));
    params.append("price", tr("Price"));
    params.append("fixed", tr("Fixed"));
    params.append("percent", tr("Percent"));
    params.append("mixed", tr("Mixed"));
    params.append("allsites", tr("All Sites"));
    params.append("allzones", tr("All Shipping Zones"));

    itemFillList = mql.toQuery(params);

    if (pIpsitemid == -1)
        _ipsitem->populate(itemFillList, true);
    else
        _ipsitem->populate(itemFillList, pIpsitemid, true);

    _currency->setEnabled(_ipsitem->topLevelItemCount() <= 0);
}
示例#14
0
void saleType::sSave()
{
  XSqlQuery saleTypeSave;

  QList<GuiErrorCheck> errors;
  errors << GuiErrorCheck(_code->text().length() == 0, _code,
                          tr("You must enter a valid Sale Type Code "
                             "before continuing"))
     ;

  if (GuiErrorCheck::reportErrors(this, tr("Cannot Save Sale Type"), errors))
    return;

  MetaSQLQuery mql = mqlLoad("saletype", "table");
  ParameterList params;
  if (_mode == cNew)
    params.append("NewMode");
  else
  {
    params.append("EditMode");
    params.append("saletype_id", _saletypeid);
  }
  params.append("saletype_code", _code->text());
  params.append("saletype_descr", _description->text());
  params.append("saletype_active", QVariant(_active->isChecked()));
  saleTypeSave = mql.toQuery(params);
  if (saleTypeSave.first() && _mode == cNew)
    _saletypeid = saleTypeSave.value("saletype_id").toInt();

  done(_saletypeid);
}
示例#15
0
void dspInventoryHistoryByParameterList::sFillList()
{
  _invhist->clear();

  if (!_dates->startDate().isValid())
  {
    QMessageBox::critical( this, tr("Enter Start Date"),
                           tr("Please enter a valid Start Date.") );
    _dates->setFocus();
    return;
  }

  if (!_dates->endDate().isValid())
  {
    QMessageBox::critical( this, tr("Enter End Date"),
                           tr("Please enter a valid End Date.") );
    _dates->setFocus();
    return;
  }

  ParameterList params;
  setParams(params);
  MetaSQLQuery mql = mqlLoad("inventoryHistory", "detail");
  q = mql.toQuery(params);

  if (q.first())
  {
    _invhist->populate(q, true);
  }
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
void maintainShipping::sFillList()
{
  XSqlQuery maintainFillList;
  ParameterList params;

  _parameterWidget->appendValue(params);

  if (_metrics->boolean("MultiWhs"))
    params.append("MultiWhs");

  if (_metrics->boolean("EnableSOReservationsByLocation"))
    params.append("includeDistributions");
  
  params.append("notPrinted",	tr("No"));
  params.append("dirty",	tr("Dirty"));
  params.append("printed",	tr("Yes"));

  MetaSQLQuery mql = mqlLoad("maintainShipping", "detail");
  maintainFillList = mql.toQuery(params);
  maintainFillList.exec();
  _ship->populate(maintainFillList, true);
  _ship->expandAll();
  if (maintainFillList.lastError().type() != QSqlError::NoError)
  {
    systemError(this, maintainFillList.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
void dspBillingSelections::sFillList()
{
  MetaSQLQuery mql = mqlLoad("billingSelections", "detail");
  ParameterList params;
  q = mql.toQuery(params);
  _cobill->populate(q);
}
void applyARCreditMemo::populate()
{
  XSqlQuery applypopulate;
  applypopulate.prepare( "SELECT aropen_cust_id, aropen_docnumber, aropen_docdate,"
             "       (aropen_amount - aropen_paid - COALESCE(prepared,0.0) - COALESCE(cashapplied,0.0)) AS available,"
             "       COALESCE(SUM(currToCurr(arcreditapply_curr_id, "
             "				     aropen_curr_id, "
             "				     arcreditapply_amount, "
             "				     current_date)), 0) AS f_applied, "
             "	     aropen_curr_id "
             "FROM aropen LEFT OUTER JOIN arcreditapply ON (arcreditapply_source_aropen_id=aropen_id) "
             "       LEFT OUTER JOIN (SELECT aropen_id AS prepared_aropen_id,"
             "                               COALESCE(SUM(checkitem_amount + checkitem_discount),0) AS prepared"
             "                          FROM checkhead JOIN checkitem ON (checkitem_checkhead_id=checkhead_id)"
             "                                     JOIN aropen ON (checkitem_aropen_id=aropen_id)"
             "                         WHERE ((NOT checkhead_posted)"
             "                           AND  (NOT checkhead_void))"
             "                         GROUP BY aropen_id) AS sub1"
             "         ON (prepared_aropen_id=aropen_id)"
             "       LEFT OUTER JOIN (SELECT aropen_id AS cash_aropen_id,"
             "                               SUM(cashrcptitem_amount + cashrcptitem_discount) * -1.0 AS cashapplied"
             "                          FROM cashrcpt JOIN cashrcptitem ON (cashrcptitem_cashrcpt_id=cashrcpt_id)"
             "                                     JOIN aropen ON (cashrcptitem_aropen_id=aropen_id)"
             "                         WHERE ((NOT cashrcpt_posted)"
             "                           AND  (NOT cashrcpt_void))"
             "                         GROUP BY aropen_id ) AS sub2"
             "         ON (cash_aropen_id=aropen_id)"
             "WHERE (aropen_id=:aropen_id) "
             "GROUP BY aropen_cust_id, aropen_docnumber, aropen_docdate,"
             "         aropen_amount, aropen_paid, aropen_curr_id, prepared, cashapplied;" );
  applypopulate.bindValue(":aropen_id", _aropenid);
  applypopulate.exec();
  if (applypopulate.first())
  {
    _available->set(applypopulate.value("available").toDouble(),
		    applypopulate.value("aropen_curr_id").toInt(),
		    applypopulate.value("aropen_docdate").toDate(), false);
    _cust->setId(applypopulate.value("aropen_cust_id").toInt());
    _applied->setLocalValue(applypopulate.value("f_applied").toDouble());
    _balance->setLocalValue(_available->localValue() - _applied->localValue());
    _docNumber->setText(applypopulate.value("aropen_docnumber").toString());
    _docDate->setDate(applypopulate.value("aropen_docdate").toDate(), true);
  }
  else
      systemError(this, applypopulate.lastError().databaseText(), __FILE__, __LINE__);

  MetaSQLQuery mql = mqlLoad("arOpenApplications", "detail");
  ParameterList params;
  params.append("cust_id",          _cust->id());
  params.append("debitMemo",        tr("Debit Memo"));
  params.append("invoice",          tr("Invoice"));
  params.append("source_aropen_id", _aropenid);
  applypopulate = mql.toQuery(params);
  _aropen->populate(applypopulate);
  if (applypopulate.lastError().type() != QSqlError::NoError)
  {
    systemError(this, applypopulate.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
void selectPayments::sClearAll()
{
  XSqlQuery selectClearAll;
  MetaSQLQuery mql = mqlLoad("selectPayments", "clearall");
  ParameterList params;
  if (! setParams(params))
    return;
  selectClearAll = mql.toQuery(params);
  if (selectClearAll.first())
  {
    int result = selectClearAll.value("result").toInt();
    if (result < 0)
    {
      systemError(this, storedProcErrorLookup("clearPayment", result),
                  __FILE__, __LINE__);
      return;
    }
  }
  else if (selectClearAll.lastError().type() != QSqlError::NoError)
  {
    systemError(this, selectClearAll.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  omfgThis->sPaymentsUpdated(-1, -1, true);
}
示例#20
0
QObject * ScriptToolbox::executeDbQuery(const QString & group, const QString & name, const ParameterList & params)
{
  ScriptQuery * sq = new ScriptQuery(_engine);
  MetaSQLQuery mql = mqlLoad(group, name);
  sq->setQuery(mql.toQuery(params));
  return sq;
}
示例#21
0
void itemSourceSearch::sFillList()
{
  XSqlQuery itemFillList;
  _itemsrc->clear();
  MetaSQLQuery mql = mqlLoad("itemSources", "search");
  ParameterList params;
  params.append("vend_id", _vendid);
  params.append("item_id", _itemid);
  params.append("non", tr("Non-Inventory"));
  if(_searchNumber->isChecked())
    params.append("searchNumber", _search->text());
  if(_searchVendNumber->isChecked())
    params.append("searchVendNumber", _search->text());
  if(_searchDescrip1->isChecked())
    params.append("searchDescrip1", _search->text());
  if(_searchDescrip2->isChecked())
    params.append("searchDescrip2", _search->text());
  if(_searchVendDescrip->isChecked())
    params.append("searchVendDescrip", _search->text());
  if(_searchManufName->isChecked())
    params.append("searchManufName", _search->text());
  if(_searchManufNumber->isChecked())
    params.append("searchManufNumber", _search->text());

  itemFillList = mql.toQuery(params);
  _itemsrc->populate(itemFillList, TRUE);
}
示例#22
0
void dspShipmentsByDate::sFillList()
{
  _ship->clear();

  if (!_dates->startDate().isValid())
  {
    QMessageBox::warning( this, tr("Enter Start Date"),
                          tr("<p>You must enter a Start Date before running this query.") );
    _dates->setFocus();
    return;
  }

  if (!_dates->endDate().isValid())
  {
    QMessageBox::warning( this, tr("Enter End Date"),
                          tr("<p>You must enter a End Date before running this query.") );
    _dates->setFocus();
    return;
  }

  ParameterList params;
  setParams(params);
  MetaSQLQuery fillm = mqlLoad("shipments", "detail");
  q = fillm.toQuery(params);
  if (q.first())
  {
    _ship->populate(q, true);
  }
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#23
0
void dspSalesOrdersByCustomerPO::sFillList()
{
    _so->clear();
    if (_poNumber->text().stripWhiteSpace().length() == 0)
        return;

    if (_dates->allValid())
    {
        MetaSQLQuery mql = mqlLoad(":/so/displays/SalesOrders.mql");
        ParameterList params;
        _dates->appendValue(params);
        params.append("noLines", tr("No Lines"));
        params.append("closed", tr("Closed"));
        params.append("open", tr("Open"));
        params.append("partial", tr("Partial"));
        params.append("poNumber", _poNumber->text());

        q = mql.toQuery(params);
        XTreeWidgetItem *last = 0;
        while (q.next())
        {
            last = new XTreeWidgetItem(_so, last,
                                       q.value("cohead_id").toInt(),
                                       q.value("cust_number"),
                                       q.value("cust_name"),
                                       q.value("cohead_number"),
                                       formatDate(q.value("cohead_orderdate").toDate()),
                                       formatDate(q.value("min_scheddate").toDate()),
                                       q.value("order_status"),
                                       q.value("cohead_shiptoname"),
                                       q.value("cohead_custponumber") );
        }
    }
}
示例#24
0
void contactMerge::sPopulateTarget()
{
  QString grpTitle = tr("Target Contact");
  ParameterList params;
  params.append("target", QVariant(true));

  MetaSQLQuery mql = mqlLoad("contactmerge", "populate");
  q = mql.toQuery(params);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  if (q.first())
  {
    _target->setId(q.value("cntct_id").toInt());
    _targetGroup->setTitle(grpTitle + " (#" + q.value("cntct_number").toString() + ")");
  }
  else
  {
    _target->setId(-1);
    _targetGroup->setTitle(grpTitle);
  }

  sHandleProcess();
}
示例#25
0
void contactMerge::sProcess()
{
  ParameterList params;
  QString qry;

  if ((_mode->currentIndex() == 0) || (_mode->currentIndex() == 2)) // cMerge or cMergePurge
  {
    if (_mode->currentIndex() == 2 && !purgeConfirm()) // cMergePurge
      return;
    qry = "merge";
    if  (_mode->currentIndex() == 2)
      params.append("purge", true);
    else
      params.append("purge", false);
  }
  else if (_mode->currentIndex() == 1) // cPurge
  {
    if (!purgeConfirm())
      return;
    qry = "purge";
  }
  else
  {
    qry = "restore";
  }

  MetaSQLQuery mql = mqlLoad("contactmerge", qry);
  q = mql.toQuery(params);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  sFillList();
}
示例#26
0
void todoList::sFillList()
{
  if (!_todolist->isChecked() && !_incidents->isChecked() && !_projects->isChecked())
  {
    _todoList->clear();
    return;
  }

  MetaSQLQuery mql = mqlLoad("todolist", "detail");
  ParameterList params;
  setParams(params);

  XSqlQuery itemQ = mql.toQuery(params);

  _todoList->populate(itemQ, true);

  if (itemQ.lastError().type() != QSqlError::NoError)
  {
    systemError(this, itemQ.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  handlePrivs();

  _total->setText(QString::number(_todoList->topLevelItemCount()));
}
示例#27
0
void dspPOsByVendor::sFillList()
{
  MetaSQLQuery mql = mqlLoad(":/po/displays/POsByVendor/FillListDetail.mql");

  ParameterList params;
  setParams(params);

  q = mql.toQuery(params);
  if (q.lastError().type() != QSqlError::None)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  _poitem->clear();
  XTreeWidgetItem *last = 0;
  while (q.next())
  {
    last = new XTreeWidgetItem(_poitem, last,
			       q.value("pohead_id").toInt(), -1,
			       q.value("pohead_number"),
			       q.value("warehousecode"),
			       q.value("poitemstatus"), q.value("vend_number"),
			       q.value("f_date"));
    if (q.value("late").toBool())
      last->setTextColor(4, "red");
  }
}
示例#28
0
void dspOrders::sFillList()
{
  _orders->clear();

  if ( (_item->isValid()) &&
       ( (_leadTime->isChecked()) || (_byDays->isChecked()) ||
         ((_byDate->isChecked()) && (_date->isValid())) ||
         (_byRange->isChecked() && _startDate->isValid() && _endDate->isValid()) ) )
  {
    MetaSQLQuery mql = mqlLoad("orders", "detail");
    ParameterList params;
    params.append("warehous_id", _warehouse->id());
    params.append("item_id",     _item->id());
    params.append("itemType",    _item->itemType());
    if (_leadTime->isChecked())
      params.append("useLeadTime");
    else if (_byDays->isChecked())
      params.append("days",      _days->value());
    else if (_byDate->isChecked())
      params.append("date",      _date->date());
    else if (_byRange->isChecked())
    {
      params.append("startDate", _startDate->date());
      params.append("endDate",   _endDate->date());
    }

    q = mql.toQuery(params);
    _orders->populate(q, true);
  }
}
示例#29
0
void dspSummarizedBacklogByWarehouse::sFillList()
{
  ParameterList params;
  if (setParams(params))
  {
    display::sFillList();

    if (list()->topLevelItemCount())
    {
      MetaSQLQuery totm = mqlLoad("summarizedBacklogByWarehouse", "totals");
      q = totm.toQuery(params);
      if (q.first())
        _totalSalesOrders->setText(q.value("totalorders").toString());
      else if (q.lastError().type() != QSqlError::NoError)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return;
      }

      MetaSQLQuery cntm = mqlLoad("summarizedBacklogByWarehouse", "counts");
      q = cntm.toQuery(params);
      if (q.first())
        _totalLineItems->setText(q.value("totalitems").toString());
      else if (q.lastError().type() != QSqlError::NoError)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return;
      }

      MetaSQLQuery qtym = mqlLoad("summarizedBacklogByWarehouse", "qtys");
      q = qtym.toQuery(params);
      if (q.first())
        _totalQty->setText(q.value("f_totalqty").toString());
      else if (q.lastError().type() != QSqlError::NoError)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return;
      }
    }
    else
    {
      _totalSalesOrders->clear();
      _totalLineItems->clear();
      _totalQty->clear();
    }
  }
}
void dspBillingSelections::sFillList()
{
  XSqlQuery dspFillList;
  MetaSQLQuery mql = mqlLoad("billingSelections", "detail");
  ParameterList params;
  dspFillList = mql.toQuery(params);
  _cobill->populate(dspFillList);
}