Examples of TrPosition


Examples of org.jabusuite.transaction.position.TrPosition

    @Transient
    public double getSalesPriceSumFromPositions(List<TrPosition> positions) {
        double sum = 0;
        Iterator<TrPosition> it = positions.iterator();
        while (it.hasNext()) {
            TrPosition position = it.next();

            if (position instanceof NormalPosition) {
                sum += ((NormalPosition) position).getSalesPrice();
            } else if (position instanceof DiscountPosition) {
                sum += ((DiscountPosition) position).getValue();
            }

            if (position.getSubPositions() != null) {
                sum += getSalesPriceSumFromPositions(position.getSubPositions());
            }
        }
        return sum;
    }
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

    @Transient
    public double getCostPriceSumFromPositions(List<TrPosition> positions) {
        double sum = 0;
        Iterator<TrPosition> it = positions.iterator();
        while (it.hasNext()) {
            TrPosition position = it.next();
            if (position instanceof NormalPosition) {
                sum += ((NormalPosition) position).getCostPrice();
            }
            if (position.getSubPositions() != null) {
                sum += getCostPriceSumFromPositions(position.getSubPositions());
            }
        }
        return sum;
    }
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

     */
    @Transient
    protected VATSumList getVATSums(List<TrPosition> positions, VATSumList vatSums) {
        Iterator<TrPosition> it = positions.iterator();
        while (it.hasNext()) {
            TrPosition position = it.next();
            if (position instanceof NormalPosition) {
                ArticleVAT vat = ((NormalPosition) position).getVat();
                if (vat != null) {
                    logger.debug("Position: " + position.getPosNumber() + ": " + ((NormalPosition) position).getVATValue());
                    VATSum vatSum = vatSums.getVatSum(vat);
                    if (vatSum == null) { //add a new vat-sum
                        logger.debug("Adding vat-sum for vat " + vat.getName());
                        vatSum = new VATSum();
                        vatSum.setVat(vat);
                        vatSums.add(vatSum);
                    }
                    vatSum.setSum(vatSum.getSum() + ((NormalPosition) position).getVATValue());
                }
            }
            if (position.getSubPositions() != null) {
                vatSums = this.getVATSums(position.getSubPositions(), vatSums);
            }
        }
        return vatSums;
    }
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

     */
    @Transient
    protected void setPosParents(List<TrPosition> positions, TrPosition parentPosition) {
        Iterator<TrPosition> it = positions.iterator();
        while (it.hasNext()) {
            TrPosition position = it.next();
            if (position.getTransaction() != null) {
                position.setTransaction(this);
            } else if (parentPosition != null) {
                position.setParentPosition(parentPosition);
            }
            if (position.getSubPositions() != null) {
                setPosParents(position.getSubPositions(), position);
            }
        }
    }
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

        boolean found = false;

        Iterator<TrPosition> it = positions.iterator();

        while ((!found) && (it.hasNext())) {
            TrPosition subPosition = it.next();
            if (subPosition.getId() == position.getId()) {
                found = true;
            } else if (subPosition.getSubPositions() != null) {
                found = positionExists(position, subPosition.getSubPositions());
            }
        }
        return found;
    }
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

     * @param positions
     */
    public void deleteOldPositions(EntityManager manager, BusinessTransaction transaction, List<TrPosition> positions) {
        Iterator<TrPosition> it = positions.iterator();
        while (it.hasNext()) {
            TrPosition position = it.next();
            if (!positionExists(position, transaction.getPositions())) {
                deletePosition(manager, position);
            } else if ((position.getSubPositions() != null) && (position.getSubPositions().size() > 0)) {
                deleteOldPositions(manager, transaction, position.getSubPositions());
            }
        } //while
    }
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

     */
    protected void setSortIndexes(List<TrPosition> positions) {
        Iterator<TrPosition> it = positions.iterator();
        int posIndex = 0;
        while (it.hasNext()) {
            TrPosition position = it.next();
            position.setSortIndex(posIndex);
            if (position.getSubPositions() != null) {
                setSortIndexes(position.getSubPositions());
            }
            posIndex++;
        } //while
    }
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

    protected void addPositions(TrPositionTreeNode parentNode, List<TrPosition> positions) {
        if (positions != null) {
            Iterator<TrPosition> it = positions.iterator();
            while (it.hasNext()) {
                TrPosition position = it.next();
                TrPositionTreeNode node = new TrPositionTreeNode(position.getPosNumber(), position);
                parentNode.add(node);
                if (position.getSubPositions() != null) {
                    addPositions(node, position.getSubPositions());
                }
            }
        }
    }
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

     * @see echopointng.treetable.DefaultTreeTableModel#getValueAt(java.lang.Object, int)
     */
    @Override
    public Object getValueAt(Object node, int column) {
        if ((node!=null) && (node instanceof TrPositionTreeNode)) {
            TrPosition position = ((TrPositionTreeNode) node).getPosition();
            logger.debug("Showing position");
            String s;
            if (position != null) {
                logger.debug(position.getPosNumber() + " " + position.getId());
                ((TrPositionTreeNode) node).setUserObject(position.getPosNumber());
                switch (column) {
                    case 0:
                        return position.getPosNumber();
                    case 1:
                        if ((position instanceof ArticlePosition) && (((ArticlePosition)position).getArticle()!=null) && (((ArticlePosition)position).getArticle().getUserNo()!=null))
                            return ((ArticlePosition)position).getArticle().getUserNo();
                        else
                            return "";
                    case 2:
                        s = "";
                        if (position instanceof NormalPosition) {
                            s = String.valueOf(((NormalPosition) position).getQuantity());
                        }
                        return s;
                    case 3:
                        s = position.getShortText(ClientGlobals.getMainDbLanguage());
                        if (s == null) {
                            s = "";
                        }
                        return s;
                    case 4:
View Full Code Here

Examples of org.jabusuite.transaction.position.TrPosition

                private static final long serialVersionUID = 1L;

                public void stateChanged(ChangeEvent arg0) {
                    logger.debug("Index: " + getMinSelectedIndex() + ", " + getMaxSelectedIndex());
                    TrPosition position = getSelectedPosition();
                    if (position != null) {
                        logger.debug("Selected position: " + position.getId() + " " + position.getPosNumber());
                    }
                /*
                TreePath path = getPathForRow(getMinSelectedIndex());
                if ((path!=null) && (path.getLastPathComponent()!=null)) {
                logger.debug(path.getLastPathComponent().getClass().getCanonicalName());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.