示例#1
0
void dspReservations::sFillList()
{
  _allocations->clear();

  if (_item->isValid())
  {
    MetaSQLQuery mql = mqlLoad(":so/displays/Reservations/FillListDetail.mql");


    ParameterList params;
    params.append("warehous_id", _warehouse->id());
    params.append("item_id",	   _item->id());

    q = mql.toQuery(params);

    double runningBal = 0;
    XTreeWidgetItem *last = 0;

    while (q.next())
    {
      runningBal += q.value("coitem_qtyreserved").toDouble();

      last = new XTreeWidgetItem(_allocations, last,
				 q.value("source_id").toInt(),
				 q.value("order_number"),
				 q.value("totalqty"),
				 q.value("relievedqty"), q.value("balanceqty"),
				 formatQty(runningBal), q.value("duedate") );
      last->setTextColor(5, "red");
    }
    if (q.lastError().type() != QSqlError::None)
    {
      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }

    QString avails("SELECT formatQty(itemsite_qtyonhand) AS f_qoh,"
		   "       formatQty(qtyunreserved(itemsite_id)) AS f_unreserved "
		   "FROM itemsite "
		   "WHERE ((itemsite_item_id=<? value(\"item_id\") ?>)"
		   "  AND  (itemsite_warehous_id=<? value(\"warehous_id\") ?>));");
    MetaSQLQuery availm(avails);
    q = availm.toQuery(params);
    if (q.first())
    {
      _qoh->setText(q.value("f_qoh").toString());
      _available->setText(q.value("f_unreserved").toString());
    }
    else if (q.lastError().type() != QSqlError::None)
    {
      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
  }
}
void assessFinanceCharges::sFillList()
{
  _invoiceList->clear();
  XSqlQuery arFillInvoiceList;
  MetaSQLQuery mql = mqlLoad("assessFinanceCharges", "detail");
  ParameterList params;
  _customerSelector->appendValue(params);
  params.append("assessmentDate", _assessmentDate->date());
  arFillInvoiceList = mql.toQuery(params);
  _invoiceList->populate(arFillInvoiceList);
}
示例#3
0
void dspBankrecHistory::sFillList()
{
    q.prepare( "SELECT bankrec_username, "
               "       bankrec_posted,"
               "       bankrec_postdate,"
               "       bankrec_opendate,"
               "       bankrec_enddate,"
               "       bankrec_openbal,"
               "       bankrec_endbal "
               "FROM bankrec "
               "WHERE (bankrec_id=:bankrecid);" );
    q.bindValue(":bankrecid", _bankrec->id());
    q.exec();
    if(q.first())
    {
        _poster->setText(q.value("bankrec_username").toString());
        _postdate->setDate(q.value("bankrec_postdate").toDate());

        ParameterList params;
        params.append("treeView", true);
        if (! setParams(params))
            return;

        MetaSQLQuery mql = mqlLoad("bankrecHistory", "reconciled");
        q = mql.toQuery(params);
        _rec->populate(q, true);
        if (q.lastError().type() != QSqlError::NoError)
        {
            systemError(this, q.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");
            q = mql2.toQuery(params2);
            _unrec->populate(q, true);
            if (q.lastError().type() != QSqlError::NoError)
            {
                systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
                return;
            }
            else
                _unrec->expandAll();
        }
    }
}
void cashReceiptsEditList::sFillList()
{
    XSqlQuery cashFillList;
    ParameterList params;
    if (! setParams(params))
        return;

    MetaSQLQuery mql = mqlLoad("unpostedCashReceipts", "detail");
    cashFillList = mql.toQuery(params);
    _cashrcpt->populate(cashFillList);
}
示例#5
0
void itemSourceList::sFillList()
{
  XSqlQuery itemFillList;
  MetaSQLQuery mql = mqlLoad("itemSources", "detail");

  ParameterList params;
  params.append("item_id", _item->id());
  params.append("onlyShowActive", true);
  itemFillList = mql.toQuery(params);
  _itemsrc->populate(itemFillList);
}
void updatePrices::sRemove()
{
  XSqlQuery updateRemove;
  MetaSQLQuery mql = mqlLoad("updateprices", "remove");
  ParameterList params;
  params.append("ipshead_id", _sel->id());
  updateRemove = mql.toQuery(params);
  if (updateRemove.lastError().type() != QSqlError::NoError)
    systemError(this, updateRemove.lastError().databaseText(), __FILE__, __LINE__);
  populate();
}
void printPackingListBatchByShipvia::sPopulateShipVia()
{
  ParameterList params;
  if (_metrics->boolean("MultiWhs"))
    params.append("MultiWhs");
  MetaSQLQuery mql = mqlLoad("packingListBatchByShipVia", "shipVia");
  q = mql.toQuery(params);

  _shipvia->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
}
示例#8
0
void creditMemoItem::sPopulateUOM()
{
  if (_item->id() != -1)
  {
    // Get list of active, valid Selling UOMs
    MetaSQLQuery muom = mqlLoad("uoms", "item");
    
    ParameterList params;
    params.append("uomtype", "Selling");
    params.append("item_id", _item->id());
    
    // Include Global UOMs
    if (_privileges->check("MaintainUOMs"))
    {
      params.append("includeGlobal", true);
      params.append("global", tr("-Global"));
    }
    
    // Also have to factor UOMs previously used on Sales Credit now inactive
    if (_cmitemid != -1)
    {
      XSqlQuery cmuom;
      cmuom.prepare("SELECT cmitem_qty_uom_id, cmitem_price_uom_id "
                    "  FROM cmitem"
                    " WHERE(cmitem_id=:cmitem_id);");
      cmuom.bindValue(":cmitem_id", _cmitemid);
      cmuom.exec();
      if (ErrorReporter::error(QtCriticalMsg, this, tr("Getting Sales Credit UOMs"),
                               cmuom, __FILE__, __LINE__))
        return;
      else if (cmuom.first())
      {
        params.append("uom_id", cmuom.value("cmitem_qty_uom_id"));
        params.append("uom_id2", cmuom.value("cmitem_price_uom_id"));
      }
    }
    
    XSqlQuery uom = muom.toQuery(params);
    if (ErrorReporter::error(QtCriticalMsg, this, tr("Getting UOMs"),
                             uom, __FILE__, __LINE__))
      return;
    
    int saveqtyuomid = _qtyUOM->id();
    int savepriceuomid = _pricingUOM->id();
    disconnect(_qtyUOM,     SIGNAL(newID(int)), this, SLOT(sQtyUOMChanged()));
    disconnect(_pricingUOM, SIGNAL(newID(int)), this, SLOT(sPriceUOMChanged()));
    _qtyUOM->populate(uom);
    _pricingUOM->populate(uom);
    _qtyUOM->setId(saveqtyuomid);
    _pricingUOM->setId(savepriceuomid);
    connect(_qtyUOM,     SIGNAL(newID(int)), this, SLOT(sQtyUOMChanged()));
    connect(_pricingUOM, SIGNAL(newID(int)), this, SLOT(sPriceUOMChanged()));
  }
示例#9
0
void dspMRPDetail::sFillItemsites()
{
  ParameterList params;

  if (! setParams(params))
    return;

  MetaSQLQuery mql = mqlLoad("mrpDetail", "item");

  q = mql.toQuery(params);
  _itemsite->populate(q, true);
}
示例#10
0
void selectPayments::sFillList()
{
  XSqlQuery selectFillList;
  if(_ignoreUpdates)
    return;

//  if (_vendorgroup->isSelectedVend())
//    _apopen->showColumn(9);
//  else
//    _apopen->hideColumn(9);

  if ( (_selectDate->currentIndex() == 1 && !_onOrBeforeDate->isValid())  ||
        (_selectDate->currentIndex() == 2 && (!_startDate->isValid() || !_endDate->isValid())) )
    return;

  int _currid = -1;
  if (_bankaccnt->isValid())
  {
    selectFillList.prepare( "SELECT bankaccnt_curr_id "
               "FROM bankaccnt "
               "WHERE (bankaccnt_id=:bankaccnt_id);" );
    selectFillList.bindValue(":bankaccnt_id", _bankaccnt->id());
    selectFillList.exec();
    if (selectFillList.first())
      _currid = selectFillList.value("bankaccnt_curr_id").toInt();
  }

  ParameterList params;
  if (! setParams(params))
    return;
  params.append("voucher", tr("Voucher"));
  params.append("debitMemo", tr("Debit Memo"));
  params.append("creditMemo", tr("Credit Memo"));
  if (_selectDate->currentIndex()==1)
    params.append("olderDate", _onOrBeforeDate->date());
  else if (_selectDate->currentIndex()==2)
  {
    params.append("startDate", _startDate->date());
    params.append("endDate", _endDate->date());
  }
  if (_currid >= 0)
    params.append("curr_id", _currid);

  MetaSQLQuery mql = mqlLoad("apOpenItems", "selectpayments");
  selectFillList = mql.toQuery(params);
  _apopen->populate(selectFillList,true);
  if (selectFillList.lastError().type() != QSqlError::NoError)
  {
    systemError(this, selectFillList.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#11
0
void unpostedInvoices::sFillList()
{
  MetaSQLQuery mql = mqlLoad("invoices", "detail");
  ParameterList params;
  params.append("unpostedOnly");
  q = mql.toQuery(params);
  _invchead->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#12
0
void packingListBatch::sFillList()
{
  ParameterList params;
  setParams(params);
  MetaSQLQuery mql = mqlLoad("packingListBatch", "detail");
  q = mql.toQuery(params);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  _pack->populate(q, true);
}
示例#13
0
void priceList::sFillList()
{
  bool    ok = false;
  QString errString;
  MetaSQLQuery pricelistm = MQLUtil::mqlLoad("pricelist", "detail",
                                          errString, &ok);
  if (! ok)
  {
    ErrorReporter::error(QtCriticalMsg, this, tr("Error Occurred"),
                         tr("%1: %2")
                         .arg(windowTitle())
                         .arg(errString),__FILE__,__LINE__);
    return;
  }

  ParameterList pricelistp;
  pricelistp.append("na",               tr("N/A"));
  pricelistp.append("customer",         tr("Customer"));
  pricelistp.append("shipTo",           tr("Cust. Ship-To"));
  pricelistp.append("shipToPattern",    tr("Cust. Ship-To Pattern"));
  pricelistp.append("custType",         tr("Cust. Type"));
  pricelistp.append("custTypePattern",  tr("Cust. Type Pattern"));
  pricelistp.append("shipZone",         tr("Shipping Zone"));
  pricelistp.append("saleType",         tr("Sale Type"));
  pricelistp.append("sale",             tr("Sale"));
  pricelistp.append("listPrice",        tr("List Price"));
  pricelistp.append("nominal",          tr("Nominal"));
  pricelistp.append("discount",         tr("Discount"));
  pricelistp.append("markup",           tr("Markup"));
  pricelistp.append("item_id",          _item->id());
  pricelistp.append("warehous_id",      _warehouse->id());
  pricelistp.append("prodcat_id",       _prodcatid);
  pricelistp.append("cust_id",          _cust->id());
  pricelistp.append("custtype_id",      _custtypeid);
  pricelistp.append("custtype_code",    _custtypecode);
  pricelistp.append("saletype_id",      _saletypeid);
  pricelistp.append("shipzone_id",      _shipzoneid);
  pricelistp.append("shipto_id",        _shiptoid);
  pricelistp.append("shipto_num",       _shiptonum);
  pricelistp.append("curr_id",          _curr_id);
  pricelistp.append("effective",        _effective);
  pricelistp.append("asof",             _asOf);
  pricelistp.append("qty",              _qty->toDouble());
  pricelistp.append("item_listcost",    _listCost->toDouble());
  pricelistp.append("item_unitcost",    _unitCost->toDouble());
  pricelistp.append("item_listprice",   _listPrice->toDouble());
  pricelistp.append("listpricesched",   _listpriceschedule);

  XSqlQuery pricelistq = pricelistm.toQuery(pricelistp);
  _price->populate(pricelistq, true);
}
示例#14
0
void dspRunningAvailability::sFillList()
{
  if (_item->isValid())
  {
    q.prepare( "SELECT itemsite_qtyonhand,"
               "       CASE WHEN(itemsite_useparams) THEN itemsite_reorderlevel ELSE 0.0 END AS reorderlevel,"
               "       CASE WHEN(itemsite_useparams) THEN itemsite_ordertoqty   ELSE 0.0 END AS ordertoqty,"
               "       CASE WHEN(itemsite_useparams) THEN itemsite_multordqty   ELSE 0.0 END AS multorderqty "
               "FROM item, itemsite "
               "WHERE ( (itemsite_item_id=item_id)"
               " AND (itemsite_warehous_id=:warehous_id)"
               " AND (item_id=:item_id) );" );
    q.bindValue(":item_id", _item->id());
    q.bindValue(":warehous_id", _warehouse->id());
    q.exec();
    if (q.first())
    {
      _qoh->setDouble(q.value("itemsite_qtyonhand").toDouble());
      _reorderLevel->setDouble(q.value("reorderlevel").toDouble());
      _orderMultiple->setDouble(q.value("multorderqty").toDouble());
      _orderToQty->setDouble(q.value("ordertoqty").toDouble());

      MetaSQLQuery mql = mqlLoad("runningAvailability", "detail");
      ParameterList params;
      setParams(params);
      params.append("qoh",          q.value("itemsite_qtyonhand").toDouble());

      q = mql.toQuery(params);
      _availability->populate(q, true);
      if (q.lastError().type() != QSqlError::NoError)
      {
	systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
	return;
      }
      sHandleResort();
    }
    else if (q.lastError().type() != QSqlError::NoError)
    {
      systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
      return;
    }
  }
  else
  {
    _qoh->setText("0.00");
    _reorderLevel->setText("0.00");
    _orderMultiple->setText("0.00");
    _orderToQty->setText("0.00");
  }
}
示例#15
0
void dspCountTagsByItem::sFillList()
{
  MetaSQLQuery mql = mqlLoad("countTags", "detail");
  ParameterList params;
  if (! setParams(params))
    return;
  q = mql.toQuery(params);
  _cnttag->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
void unappliedARCreditMemos::sFillList()
{
  MetaSQLQuery mql = mqlLoad("arCreditMemos", "unapplied");
  
  ParameterList params;
  
  XSqlQuery qry = mql.toQuery(params);
  _aropen->populate(qry);
  if (qry.lastError().type() != QSqlError::NoError)
  {
    systemError(this, qry.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#17
0
void dspJobCosting::sFillList(int, bool)
{
    ParameterList params;
    if (! setParams(params))
        return;
    MetaSQLQuery mql = mqlLoad("manufacture", "jobcosting");
    q = mql.toQuery(params);
    _cost->populate(q, TRUE);
    if (q.lastError().type() != QSqlError::NoError)
    {
        systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
        return;
    }
}
示例#18
0
void contactMerge::sRestore()
{
  MetaSQLQuery mql = mqlLoad("contactmerge", "restore");

  ParameterList params;
  params.append("cntct_id", _cntct->id());
  q = mql.toQuery(params);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  sFillList();
}
示例#19
0
void dspBreederDistributionVarianceByWarehouse::sFillList()
{
  ParameterList params;
  if (! setParams(params))
    return;
  MetaSQLQuery mql = mqlLoad("breederDistributionVariance", "detail");
  q = mql.toQuery(params);
  _brdvar->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#20
0
void selectedPayments::sFillList()
{
  ParameterList params;
  if (! setParams(params))
    return;
  MetaSQLQuery mql = mqlLoad("apOpenItems", "selectedpayments");
  q = mql.toQuery(params);
  _apselect->populate(q,true);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#21
0
void saleType::populate()
{
  MetaSQLQuery mql = mqlLoad("saletype", "table");
  ParameterList params;
  params.append("ViewMode");
  params.append("saletype_id", _saletypeid);
  XSqlQuery saleTypePopulate = mql.toQuery(params);
  if (saleTypePopulate.first())
  {
    _code->setText(saleTypePopulate.value("saletype_code"));
    _description->setText(saleTypePopulate.value("saletype_descr"));
    _active->setChecked(saleTypePopulate.value("saletype_active").toBool());
  }
}
示例#22
0
void openReturnAuthorizations::sFillList()
{
  MetaSQLQuery mql = mqlLoad("returnAuthorizations", "detail");
  ParameterList params;
  setParams(params);
  q = mql.toQuery(params);
  _ra->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  _ra->setDragString("raheadid=");
}
示例#23
0
void dspBookingsByCustomerGroup::sFillList()
{
  MetaSQLQuery mql = mqlLoad("salesOrderItems", "detail");
  ParameterList params;
  if (! setParams(params))
    return;
  q = mql.toQuery(params);
  _soitem->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#24
0
void dspTimePhasedOpenAPItems::sFillStd()
{
  MetaSQLQuery mql = mqlLoad("apAging", "detail");
  ParameterList params;
  if (! setParams(params))
    return;
  q = mql.toQuery(params);
  _apopen->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#25
0
void dspPlannedOrdersByItem::sFillList()
{
  ParameterList params;
  if (! setParams(params))
    return;
  MetaSQLQuery mql = mqlLoad("schedule", "plannedorders");
  q = mql.toQuery(params);
  _planord->populate(q, TRUE);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#26
0
void dspLaborVarianceByWorkCenter::sFillList()
{
  ParameterList params;
  if (! setParams(params))
    return;
  MetaSQLQuery mql = mqlLoad("manufacture", "laborvariance");
  q = mql.toQuery(params);
  _woopervar->populate(q);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
void pricingScheduleAssignments::sFillList()
{
  MetaSQLQuery mql = mqlLoad("pricingScheduleAssignment", "detail");

  ParameterList params;
  if (_listpricesched)
    params.append("listpricesched", true);
  XSqlQuery ps = mql.toQuery(params);
  if(!ErrorReporter::error(QtCriticalMsg, this, tr("Pricing Schedule Assignments "),
                         ps.lastError(), __FILE__, __LINE__))
  {
    _ipsass->populate(ps, true);
  }
}
示例#28
0
void dspPurchaseReqsByItem::sFillList()
{
  ParameterList params;
  if (! setParams(params))
    return;
  MetaSQLQuery mql = mqlLoad("purchase", "purchaserequests");
  q = mql.toQuery(params);
  _pr->populate(q, TRUE);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
}
示例#29
0
void contactMerge::sPopulateSources()
{
  ParameterList params;
  params.append("target", QVariant(false));

  MetaSQLQuery mql = mqlLoad("contactmerge", "populate");
  q = mql.toQuery(params);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  _srccntct->populate(q);
}
void unappliedARCreditMemos::sFillList()
{
  MetaSQLQuery mql = mqlLoad("arCreditMemos", "unapplied");
  
  ParameterList params;
  
  XSqlQuery qry = mql.toQuery(params);
  _aropen->populate(qry);
  if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Retrieving Unapplied AR Credit Memo Information"),
                                qry, __FILE__, __LINE__))
  {
    return;
  }
}