Package net.xoetrope.xui.data

Examples of net.xoetrope.xui.data.XModel


            }

            for (GenericValue orderAdjustment : adjustments) {
                BigDecimal amount = orderAdjustment.getBigDecimal("amount");
                BigDecimal sourcePercentage = orderAdjustment.getBigDecimal("sourcePercentage");
                XModel adjustmentLine = Journal.appendNode(model, "tr", "adjustment", "");
                Journal.appendNode(adjustmentLine, "td", "sku", "");
                Journal.appendNode(adjustmentLine, "td", "desc",
                        UtilProperties.getMessage(resource, "PosSalesDiscount", locale));
                if (UtilValidate.isNotEmpty(amount)) {
                    Journal.appendNode(adjustmentLine, "td", "qty", "");
                    Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(amount));
                } else if (UtilValidate.isNotEmpty(sourcePercentage)) {
                    BigDecimal percentage = sourcePercentage.movePointLeft(2).negate(); // sourcePercentage is negative and must be show as a positive value (it's a discount not an amount)
                    Journal.appendNode(adjustmentLine, "td", "qty", UtilFormatOut.formatPercentage(percentage));
                    amount = cart.getItemTotal().add(itemsAdjustmentsAmount).multiply(percentage); // itemsAdjustmentsAmount is negative
                    Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(amount.negate())); // amount must be shown as a negative value
                }
                Journal.appendNode(adjustmentLine, "td", "index", "-1");
            }

            XModel taxLine = Journal.appendNode(model, "tr", "tax", "");
            Journal.appendNode(taxLine, "td", "sku", "");

            Journal.appendNode(taxLine, "td", "desc", UtilProperties.getMessage(resource, "PosSalesTax", locale));
            Journal.appendNode(taxLine, "td", "qty", "");
            Journal.appendNode(taxLine, "td", "price", UtilFormatOut.formatPrice(taxAmount));
            Journal.appendNode(taxLine, "td", "index", "-1");

            XModel totalLine = Journal.appendNode(model, "tr", "total", "");
            Journal.appendNode(totalLine, "td", "sku", "");
            Journal.appendNode(totalLine, "td", "desc", UtilProperties.getMessage(resource, "PosGrandTotal", locale));
            Journal.appendNode(totalLine, "td", "qty", "");
            Journal.appendNode(totalLine, "td", "price", UtilFormatOut.formatPrice(total));
            Journal.appendNode(totalLine, "td", "index", "-1");
View Full Code Here


                    amount = cart.getGrandTotal().subtract(cart.getPaymentTotal());
                } else {
                    amount = inf.amount;
                }

                XModel paymentLine = Journal.appendNode(model, "tr", Integer.toString(i), "");
                Journal.appendNode(paymentLine, "td", "sku", "");
                Journal.appendNode(paymentLine, "td", "desc", descString);
                Journal.appendNode(paymentLine, "td", "qty", "-");
                Journal.appendNode(paymentLine, "td", "price", UtilFormatOut.formatPrice(amount.negate()));
                Journal.appendNode(paymentLine, "td", "index", Integer.toString(i));
View Full Code Here

    public void appendChangeDataModel(XModel model) {
        if (cart != null) {
            BigDecimal changeDue = this.getTotalDue().negate();
            if (changeDue.compareTo(BigDecimal.ZERO) >= 0) {
                XModel changeLine = Journal.appendNode(model, "tr", "", "");
                Journal.appendNode(changeLine, "td", "sku", "");
                Journal.appendNode(changeLine, "td", "desc", "Change");
                Journal.appendNode(changeLine, "td", "qty", "-");
                Journal.appendNode(changeLine, "td", "price", UtilFormatOut.formatPrice(changeDue));
            }
View Full Code Here

                BigDecimal quantity = item.getQuantity();
                BigDecimal unitPrice = item.getBasePrice();
                BigDecimal subTotal = unitPrice.multiply(quantity);
                BigDecimal adjustment = item.getOtherAdjustments();

                XModel line = Journal.appendNode(model, "tr", ""+cart.getItemIndex(item), "");
                Journal.appendNode(line, "td", "sku", item.getProductId());
                Journal.appendNode(line, "td", "desc", item.getName());
                Journal.appendNode(line, "td", "qty", UtilFormatOut.formatQuantity(quantity));
                Journal.appendNode(line, "td", "price", UtilFormatOut.formatPrice(subTotal));
                Journal.appendNode(line, "td", "index", Integer.toString(cart.getItemIndex(item)));

                if (this.isAggregatedItem(item.getProductId())) {
                    // put alterations here
                    ProductConfigWrapper pcw = null;
                    // product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
                    // pcw = new ProductConfigWrapper(delegator, session.getDispatcher(), productId, null, null, null, null, null, null);
                    pcw = item.getConfigWrapper();
                    List<ConfigOption> selected = pcw.getSelectedOptions();
                    for (ConfigOption configoption : selected) {
                        if (configoption.isSelected()) {
                            XModel option = Journal.appendNode(model, "tr", ""+cart.getItemIndex(item), "");
                            Journal.appendNode(option, "td", "sku", "");
                            Journal.appendNode(option, "td", "desc", configoption.getDescription());
                            Journal.appendNode(option, "td", "qty", "");
                            Journal.appendNode(option, "td", "price", UtilFormatOut.formatPrice(configoption.getPrice()));
                            Journal.appendNode(option, "td", "index", Integer.toString(cart.getItemIndex(item)));
                        }
                    }
                }

                if (adjustment.compareTo(BigDecimal.ZERO) != 0) {
                    // append the promo info
                    XModel promo = Journal.appendNode(model, "tr", "itemadjustment", "");
                    Journal.appendNode(promo, "td", "sku", "");
                    Journal.appendNode(promo, "td", "desc", UtilProperties.getMessage(resource, "PosItemDiscount", locale));
                    Journal.appendNode(promo, "td", "qty", "");
                    Journal.appendNode(promo, "td", "price", UtilFormatOut.formatPrice(adjustment));
                }
View Full Code Here

            }

            for (GenericValue orderAdjustment : adjustments) {
                BigDecimal amount = orderAdjustment.getBigDecimal("amount");
                BigDecimal sourcePercentage = orderAdjustment.getBigDecimal("sourcePercentage");
                XModel adjustmentLine = Journal.appendNode(model, "tr", "adjustment", "");
                Journal.appendNode(adjustmentLine, "td", "sku", "");
                Journal.appendNode(adjustmentLine, "td", "desc",
                        UtilProperties.getMessage(resource, "PosSalesDiscount", locale));
                if (UtilValidate.isNotEmpty(amount)) {
                    Journal.appendNode(adjustmentLine, "td", "qty", "");
                    Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(amount));
                } else if (UtilValidate.isNotEmpty(sourcePercentage)) {
                    BigDecimal percentage = sourcePercentage.movePointLeft(2).negate(); // sourcePercentage is negative and must be show as a positive value (it's a discount not an amount)
                    Journal.appendNode(adjustmentLine, "td", "qty", UtilFormatOut.formatPercentage(percentage));
                    amount = cart.getItemTotal().add(itemsAdjustmentsAmount).multiply(percentage); // itemsAdjustmentsAmount is negative
                    Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(amount.negate())); // amount must be shown as a negative value
                }
                Journal.appendNode(adjustmentLine, "td", "index", "-1");
            }

            XModel taxLine = Journal.appendNode(model, "tr", "tax", "");
            Journal.appendNode(taxLine, "td", "sku", "");

            Journal.appendNode(taxLine, "td", "desc", UtilProperties.getMessage(resource, "PosSalesTax", locale));
            Journal.appendNode(taxLine, "td", "qty", "");
            Journal.appendNode(taxLine, "td", "price", UtilFormatOut.formatPrice(taxAmount));
            Journal.appendNode(taxLine, "td", "index", "-1");

            XModel totalLine = Journal.appendNode(model, "tr", "total", "");
            Journal.appendNode(totalLine, "td", "sku", "");
            Journal.appendNode(totalLine, "td", "desc", UtilProperties.getMessage(resource, "PosGrandTotal", locale));
            Journal.appendNode(totalLine, "td", "qty", "");
            Journal.appendNode(totalLine, "td", "price", UtilFormatOut.formatPrice(total));
            Journal.appendNode(totalLine, "td", "index", "-1");
View Full Code Here

                    amount = cart.getGrandTotal().subtract(cart.getPaymentTotal());
                } else {
                    amount = inf.amount;
                }

                XModel paymentLine = Journal.appendNode(model, "tr", Integer.toString(i), "");
                Journal.appendNode(paymentLine, "td", "sku", "");
                Journal.appendNode(paymentLine, "td", "desc", descString);
                Journal.appendNode(paymentLine, "td", "qty", "-");
                Journal.appendNode(paymentLine, "td", "price", UtilFormatOut.formatPrice(amount.negate()));
                Journal.appendNode(paymentLine, "td", "index", Integer.toString(i));
View Full Code Here

    public void appendChangeDataModel(XModel model) {
        if (cart != null) {
            BigDecimal changeDue = this.getTotalDue().negate();
            if (changeDue.compareTo(BigDecimal.ZERO) >= 0) {
                XModel changeLine = Journal.appendNode(model, "tr", "", "");
                Journal.appendNode(changeLine, "td", "sku", "");
                Journal.appendNode(changeLine, "td", "desc", "Change");
                Journal.appendNode(changeLine, "td", "qty", "-");
                Journal.appendNode(changeLine, "td", "price", UtilFormatOut.formatPrice(changeDue));
            }
View Full Code Here

        Color backgoundColor = style.getStyleAsColor(XStyle.COLOR_BACK);
        jtable.setBackground(backgoundColor); // TODO This line is not working
        jpanel.setBorder(jtable.getBorder()); // TODO there is a small shift between the vertical header grid lines and the other vertical grid lines. This line is not working

        // initialize the journal table header
        XModel jmodel = createModel();
        if (jmodel != null) {
            this.appendEmpty(jmodel);
            jtable.setModel(jmodel);

            for (int i = 0; i < width.length; i++) {
View Full Code Here

        }
        jtable.setSelectedRow(0);
    }

    public String getSelectedSku() {
        XModel jmodel = jtable.getXModel();
        XModel model = jmodel.get(jtable.getSelectedRow() + 1);
        return model.getValueAsString("sku");
    }
View Full Code Here

        XModel model = jmodel.get(jtable.getSelectedRow() + 1);
        return model.getValueAsString("sku");
    }

    public String getSelectedIdx() {
        XModel jmodel = jtable.getXModel();
        XModel model = jmodel.get(jtable.getSelectedRow() + 1);
        return model.getId();
    }
View Full Code Here

TOP

Related Classes of net.xoetrope.xui.data.XModel

Copyright © 2018 www.massapicom. 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.