docs: @Override
    public final void makeCartTotals(final Map<String, Object> pRqVs,
      final TradingSettings pTs, final CartLn pCartLn, final AccSettings pAs,
        final TaxDestination pTxRules) throws Exception {
      BigDecimal txTot = BigDecimal.ZERO;
      BigDecimal txTotSe = BigDecimal.ZERO;
      String descr = null;
      if (pTxRules != null) {
          descr = "Tax rules: aggregate/invoice basis/zip/RM = " + pTxRules
      .getSalTaxUseAggregItBas() + "/" + pTxRules.getSalTaxIsInvoiceBase()
    + "/" + pTxRules.getRegZip() + "/" + pTxRules.getSalTaxRoundMode();
        boolean isDbgSh = getLogger().getDbgSh(this.getClass())
          && getLogger().getDbgFl() < 13001 && getLogger().getDbgCl() > 13003;
        if (isDbgSh) {
          String txCat;
          if (pCartLn.getTxCat() != null) {
            txCat = pCartLn.getTxCat().getItsName();
          } else {
            txCat = "-";
          }
          getLogger().debug(pRqVs, SrvShoppingCart.class,
            "Item: name/tax category/disabled = " + pCartLn.getItsName() + "/"
              + txCat + "/" + pCartLn.getDisab());
        }
        for (CartTxLn ctl : pCartLn.getItsOwner().getTaxes()) {
          if (!ctl.getDisab() && (ctl.getSeller() == null
            && pCartLn.getSeller() == null || ctl.getSeller() != null
              && pCartLn.getSeller() != null && pCartLn.getSeller().getItsId()
                .getItsId().equals(ctl.getSeller().getItsId().getItsId()))) {
            ctl.setDisab(true);
          }
        }
        //data storage for aggregate rate
        //and non-aggregate invoice basis taxes included:
        List<CartLn> txdLns = null;
        //data storages for non-aggregate rate
        //except invoice basis with included taxes:
        List<Tax> txs = null; //taxes
        List<Double> txTotTaxb = null; //tax's totals/taxables
        List<Double> txPerc = null; //tax's percents for invoice basis
        String query;
        if (!pTxRules.getSalTaxUseAggregItBas()
          && !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
          //non-aggregate except invoice basis with included taxes:
          txs = new ArrayList<Tax>();
          txTotTaxb = new ArrayList<Double>();
          if (!pTxRules.getSalTaxIsInvoiceBase()) {
            //item basis:
            query = lazyGetQuTxItBas();
          } else {
            //invoice basis, taxes excluded:
            txPerc = new ArrayList<Double>();
            query = lazyGetQuTxInvBas();
          }
        } else { //non-aggregate invoice basis with included taxes
          //and aggregate for others:
          txdLns = new ArrayList<CartLn>();
          if (!pTxRules.getSalTaxIsInvoiceBase()) { //item basis
            query = lazyGetQuTxItBasAggr();
          } else { //invoice basis:
            query = lazyGetQuTxInvBasAggr();
          }
        }
        String condSel;
        if (pCartLn.getSeller() == null) {
          condSel = " is null";
        } else {
          condSel = "=" + pCartLn.getSeller().getItsId().getItsId();
        }
        query = query.replace(":CARTID", pCartLn.getItsOwner().getBuyer()
          .getItsId().toString()).replace(":CONDSEL", condSel);
        IRecordSet<RS> recordSet = null;
        try {
          recordSet = getSrvDatabase().retrieveRecords(query);
          if (recordSet.moveToFirst()) {
            do {
              Long txId = recordSet.getLong("TAXID");
              String txNm = recordSet.getString("TAXNAME");
              Tax tax = new Tax();
              tax.setItsId(txId);
              tax.setItsName(txNm);
              if (!pTxRules.getSalTaxUseAggregItBas()
                && !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
                //non-aggregate except invoice basis with included taxes:
                txs.add(tax);
                if (!pTxRules.getSalTaxIsInvoiceBase()) {
                  //item basis, taxes excluded/included:
                  txTotTaxb.add(recordSet.getDouble("TOTALTAX"));
                } else {
                  //invoice basis, taxes excluded:
                  txPerc.add(recordSet.getDouble("ITSPERCENTAGE"));
                  txTotTaxb.add(recordSet.getDouble("SUBTOTAL"));
                }
              } else { //non-aggregate invoice basis with included taxes
                //and aggregate for others:
                Double percent = recordSet.getDouble("ITSPERCENTAGE");
                Long tcId = recordSet.getLong("TAXCATID");
                if (!pTxRules.getSalTaxIsInvoiceBase()) { //item basis:
                  Long clId = recordSet.getLong("CLID");
                  CartLn txdLn = makeTxdLine(txdLns, clId, tcId, tax, percent,
                    pAs);
                  txdLn.setTotTx(BigDecimal.valueOf(recordSet
                    .getDouble("TOTALTAXES"))
                      .setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
                } else { //invoice basis:
                  CartLn txdLn = makeTxdLine(txdLns, tcId, tcId, tax, percent,
                    pAs);
                  txdLn.setTot(BigDecimal.valueOf(recordSet
                    .getDouble("ITSTOTAL"))
                      .setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
                  txdLn.setSubt(BigDecimal.valueOf(recordSet
                    .getDouble("SUBTOTAL"))
                      .setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
                }
              }
            } while (recordSet.moveToNext());
          }
        } finally {
          if (recordSet != null) {
            recordSet.close();
          }
        }
        if (!pTxRules.getSalTaxUseAggregItBas()
          && !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
          //non-aggregate except invoice basis with included taxes:
          for (int i = 0; i < txs.size(); i++) {
            CartTxLn ctl = findCreateTaxLine(pRqVs, pCartLn.getItsOwner(),
              txs.get(i), pCartLn.getSeller(), false);
            Double txTotd;
            if (!pTxRules.getSalTaxIsInvoiceBase()) {
              //item basis, taxes excluded/included:
              txTotd = txTotTaxb.get(i);
            } else {
              //invoice basis, taxes excluded:
              txTotd = txTotTaxb.get(i) * txPerc.get(i) / 100.0;
              ctl.setTaxab(BigDecimal.valueOf(txTotTaxb.get(i)));
            }
            ctl.setTot(BigDecimal.valueOf(txTotd).setScale(pAs.
              getPricePrecision(), pTxRules.getSalTaxRoundMode()));
            if (ctl.getIsNew()) {
              getSrvOrm().insertEntity(pRqVs, ctl);
              ctl.setIsNew(false);
            } else {
              getSrvOrm().updateEntity(pRqVs, ctl);
            }
          }
        } else { //non-aggregate invoice basis with included taxes
          //and aggregate for others:
          BigDecimal bd100 = new BigDecimal("100.00");
          Comparator<InvItemTaxCategoryLine> cmpr = Collections
            .reverseOrder(new CmprTaxCatLnRate());
          for (CartLn txdLn : txdLns) {
            int ti = 0;
            //aggregate rate line scoped storages:
            BigDecimal taxAggegated = null;
            BigDecimal taxAggrAccum = BigDecimal.ZERO;
            Collections.sort(txdLn.getTxCat().getTaxes(), cmpr);
            for (InvItemTaxCategoryLine itcl : txdLn.getTxCat().getTaxes()) {
              ti++;
              if (taxAggegated == null) {
                if (pTxRules.getSalTaxIsInvoiceBase()) { //invoice basis:
                  if (!pTs.getTxExcl()) {
                    taxAggegated = txdLn.getTot().subtract(txdLn.getTot().divide(
                  BigDecimal.ONE.add(txdLn.getTxCat().getAggrOnlyPercent().divide(
                bd100)), pAs.getPricePrecision(), pTxRules.getSalTaxRoundMode()));
                  } else {
                    taxAggegated = txdLn.getSubt().multiply(txdLn.getTxCat()
                  .getAggrOnlyPercent()).divide(bd100, pAs.getPricePrecision(),
                pTxRules.getSalTaxRoundMode());
                  }
                } else {
                  //item basis, taxes included/excluded
                  taxAggegated = txdLn.getTotTx();
                }
              }
              if (ti < txdLn.getTxCat().getTaxes().size()) {
                txdLn.setTotTx(taxAggegated.multiply(itcl.getItsPercentage())
                  .divide(txdLn.getTxCat().getAggrOnlyPercent(),
                    pAs.getPricePrecision(), pTxRules.getSalTaxRoundMode()));
                taxAggrAccum = taxAggrAccum.add(txdLn.getTotTx());
              } else { //the rest or only tax:
                txdLn.setTotTx(taxAggegated.subtract(taxAggrAccum));
              }
              CartTxLn ctl = findCreateTaxLine(pRqVs, pCartLn.getItsOwner(),
                itcl.getTax(), pCartLn.getSeller(), true);
              ctl.setTot(ctl.getTot().add(txdLn.getTotTx()));
              if (pTxRules.getSalTaxIsInvoiceBase()) {
                if (pTs.getTxExcl()) {
                  ctl.setTaxab(ctl.getTaxab().add(txdLn.getSubt()));
                } else {
                  ctl.setTaxab(ctl.getTaxab().add(txdLn.getTot()));
                }
              }
              if (ctl.getIsNew()) {
                getSrvOrm().insertEntity(pRqVs, ctl);
                ctl.setIsNew(false);
              } else {
                getSrvOrm().updateEntity(pRqVs, ctl);
              }
            }
          }
        }
        for (CartTxLn ctl : pCartLn.getItsOwner().getTaxes()) {
          if (!ctl.getDisab()) {
            if (ctl.getSeller() == null && pCartLn.getSeller() == null
              || ctl.getSeller() != null && pCartLn.getSeller() != null
                && pCartLn.getSeller().getItsId().getItsId()
                  .equals(ctl.getSeller().getItsId().getItsId())) {
              txTotSe = txTotSe.add(ctl.getTot());
            }
            txTot = txTot.add(ctl.getTot());
          } else if (ctl.getSeller() == null && pCartLn.getSeller() == null
            || ctl.getSeller() != null && pCartLn.getSeller() != null
              && pCartLn.getSeller().getItsId().getItsId()
                .equals(ctl.getSeller().getItsId().getItsId())) {
            getSrvOrm().updateEntity(pRqVs, ctl);
          }
        }
      }
      BigDecimal tot = BigDecimal.ZERO;
      BigDecimal totSe = BigDecimal.ZERO;
      for (CartLn cl : pCartLn.getItsOwner().getItems()) {
        if (!cl.getDisab()) {
          if (cl.getSeller() == null && pCartLn.getSeller() == null
            || cl.getSeller() != null && pCartLn.getSeller() != null
              && pCartLn.getSeller().getItsId().getItsId()
                .equals(cl.getSeller().getItsId().getItsId())) {
            totSe = totSe.add(cl.getTot());
          }
          tot = tot.add(cl.getTot());
        }
      }
      pCartLn.getItsOwner().setTotTx(txTot);
      pCartLn.getItsOwner().setSubt(tot.subtract(txTot));
      pCartLn.getItsOwner().setTot(tot);
      pCartLn.getItsOwner().setDescr(descr);
      getSrvOrm().updateEntity(pRqVs, pCartLn.getItsOwner());
      CartTot cartTot = null;
      for (CartTot ct : pCartLn.getItsOwner().getTotals()) {
        if (!ct.getDisab() && (ct.getSeller() == null && pCartLn
          .getSeller() == null || ct.getSeller() != null && pCartLn
            .getSeller() != null && pCartLn.getSeller().getItsId().getItsId()
              .equals(ct.getSeller().getItsId().getItsId()))) {
          cartTot = ct;
          break;
        }
      }
      if (totSe.compareTo(BigDecimal.ZERO) == 0 && cartTot != null) {
        //last seller's line has been deleted, disable enabled:
        cartTot.setDisab(true);
        getSrvOrm().updateEntity(pRqVs, cartTot);
      } else if (totSe.compareTo(BigDecimal.ZERO) == 1) {
        if (cartTot == null) {
          for (CartTot ct : pCartLn.getItsOwner().getTotals()) {
            if (ct.getDisab()) {
              cartTot = ct;
              cartTot.setDisab(false);
              break;
            }
          }
        }
        if (cartTot == null) {
          cartTot = new CartTot();
          cartTot.setItsOwner(pCartLn.getItsOwner());
          cartTot.setIsNew(true);
        }
        cartTot.setSeller(pCartLn.getSeller());
        cartTot.setTotTx(txTotSe);
        cartTot.setSubt(totSe.subtract(txTotSe));
        cartTot.setTot(totSe);
        if (cartTot.getIsNew()) {
          getSrvOrm().insertEntity(pRqVs, cartTot);
        } else {
          getSrvOrm().updateEntity(pRqVs, cartTot);
        }
      }
    }