Esempio n. 1
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);
}
void dspBillingSelections::sFillList()
{
  MetaSQLQuery mql = mqlLoad("billingSelections", "detail");
  ParameterList params;
  q = mql.toQuery(params);
  _cobill->populate(q);
}
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;
  }
}
Esempio n. 4
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;
  }
}
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);
}
Esempio n. 7
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;
  }
}
Esempio n. 8
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;
  }
}
Esempio n. 9
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");
  }
}
Esempio n. 10
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()));
}
Esempio n. 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;
    }
  }
}
reprintInvoices::reprintInvoices(QWidget    *parent,
                                 const char *name,
                                 bool        modal,
                                 Qt::WFlags  fl)
    : reprintMulticopyDocument("InvoiceCopies",     "InvoiceWatermark",
                               "InvoiceShowPrices",
                               parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  list()->addColumn(tr("Invoice #"),      _orderColumn, Qt::AlignRight, true, "docnumber");
  list()->addColumn(tr("Doc. Date"),       _dateColumn, Qt::AlignCenter,true, "invchead_invcdate");
  list()->addColumn(tr("Cust. #"),                  -1, Qt::AlignLeft,  true, "cust_number");
  list()->addColumn(tr("Customer"),                 -1, Qt::AlignLeft,  true, "cust_name");
  list()->addColumn(tr("Total Amount"),_bigMoneyColumn, Qt::AlignRight, true, "extprice" );
  list()->addColumn(tr("Balance"),     _bigMoneyColumn, Qt::AlignRight, true, "balance" );
  list()->addColumn(tr("Report"),                   -1, Qt::AlignLeft,  false,"reportname");

  QString      errmsg;
  bool         ok  = false;
  MetaSQLQuery mql = MQLUtil::mqlLoad("invoices", "detail", errmsg, &ok);
  if (! ok)
    ErrorReporter::error(QtCriticalMsg, this, tr("Error Getting Invoices"),
                         errmsg, __FILE__, __LINE__);

  setDoctype("IN");
  setReportKey("invchead_id");
  _docListQueryString = mql.getSource();
}
Esempio n. 13
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();
}
Esempio n. 14
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);
}
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;
    }
  }
}
Esempio n. 16
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);
  }
}
Esempio n. 17
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;
}
Esempio n. 18
0
void display::sFillList(ParameterList pParams, bool forceSetParams)
{
  emit fillListBefore();
  if (forceSetParams || !pParams.count())
  {
    if (!setParams(pParams))
      return;
  }
  int itemid = _data->_list->id();
  bool ok = true;
  QString errorString;
  MetaSQLQuery mql = MQLUtil::mqlLoad(_data->metasqlGroup, _data->metasqlName, errorString, &ok);
  if(!ok)
  {
    systemError(this, errorString, __FILE__, __LINE__);
    return;
  }
  XSqlQuery xq = mql.toQuery(pParams);
  _data->_list->populate(xq, itemid, _data->_useAltId);
  if (xq.lastError().type() != QSqlError::NoError)
  {
    systemError(this, xq.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  emit fillListAfter();
}
Esempio n. 19
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") );
        }
    }
}
Esempio n. 20
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);
}
Esempio n. 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);
}
Esempio n. 22
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);
}
Esempio n. 23
0
void postCountTags::sPost()
{
  ParameterList postp;
  if (! setParams(postp))
    return;

  bool    valid = false;
  QString errmsg;
  MetaSQLQuery postm = MQLUtil::mqlLoad("postCountTags", "post",
                                        errmsg, &valid);
  if (! valid)
  {
    QMessageBox::critical(this, tr("Query Error"), errmsg);
    return;
  }

  XSqlQuery postq = postm.toQuery(postp);
  if (postq.first())
  {
    int result = postq.value("result").toInt();
    if (result < 0)
    {
      QMessageBox::critical(this, tr("One or More Posts Failed"),
                            storedProcErrorLookup("postCountTag", result));
      return;
    }
  }
  else if (postq.lastError().type() != QSqlError::NoError)
  {
    QMessageBox::critical(this, tr("Database Error"), postq.lastError().text());
    return;
  }

  accept();
}
Esempio n. 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();
}
Esempio n. 25
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;
  }
}
Esempio n. 26
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();
}
void dspBillingSelections::sFillList()
{
  XSqlQuery dspFillList;
  MetaSQLQuery mql = mqlLoad("billingSelections", "detail");
  ParameterList params;
  dspFillList = mql.toQuery(params);
  _cobill->populate(dspFillList);
}
Esempio n. 28
0
void contactMerge::sPopulateCntctMenu(QMenu *pMenu)
{
  if (_cntct->id() == -1)
    return;

  QAction *menuItem;

  if (_cntct->altId() == 0 || // cNone
      _cntct->altId() == 4)  // cError
  {
    menuItem = pMenu->addAction(tr("Set as Source..."), this, SLOT(sAdd()));
  }

  if (_cntct->altId() != 1) // cTarget
  {
    menuItem = pMenu->addAction(tr("Set as Target..."), this, SLOT(sSetTarget()));
  }

  if (_cntct->altId() == 1 || // cTarget
      _cntct->altId() == 2)  // cSource
  {
    menuItem = pMenu->addAction(tr("Deselect..."), this, SLOT(sDeselectCntct()));
  }

  if (_cntct->altId() == 3) // cMerged
  {
    menuItem = pMenu->addAction(tr("Restore..."), this, SLOT(sRestore()));
    menuItem = pMenu->addAction(tr("Purge..."), this, SLOT(sPurge()));
  }

  pMenu->addSeparator();

  menuItem = pMenu->addAction(tr("Edit..."), this, SLOT(sCntctEdit()));
  menuItem->setEnabled(_privileges->check("MaintainContacts"));

  menuItem = pMenu->addAction(tr("View..."), this, SLOT(sCntctView()));
  menuItem->setEnabled(_privileges->check("MaintainContacts") || _privileges->check("ViewContacts"));

  if (_cntct->altId() != 3) // cMerged
  {
    // Check to see if this contact is used, if not add delete action
    ParameterList params;
    params.append("cntct_id", _cntct->id());
    MetaSQLQuery mql = mqlLoad("contactmerge", "contactused");
    q = mql.toQuery(params);
    if (q.lastError().type() != QSqlError::NoError)
    {
      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
    if (q.first() && !q.value("used").toBool())
    {
        menuItem = pMenu->addAction(tr("Delete"), this, SLOT(sCntctDelete()));
        menuItem->setEnabled(_privileges->check("MaintainContacts"));
    }
  }
}
void updatePrices::closeEvent(QCloseEvent * /*pEvent*/)
{
  XSqlQuery updatecloseEvent;
  MetaSQLQuery mql = mqlLoad("updateprices", "dropselsched");
  ParameterList params;
  updatecloseEvent = mql.toQuery(params);
  if (updatecloseEvent.lastError().type() != QSqlError::NoError)
    systemError(this, updatecloseEvent.lastError().databaseText(), __FILE__, __LINE__);
}
Esempio n. 30
0
void dspBookingsBySalesRep::sFillList()
{
  MetaSQLQuery mql = mqlLoad("salesOrderItems", "detail");
  ParameterList params;
  if (! setParams(params))
    return;
  q = mql.toQuery(params);
  _soitem->populate(q);
}