Search in sources :

Example 1 with TableCreator

use of org.broadleafcommerce.common.util.TableCreator in project BroadleafCommerce by BroadleafCommerce.

the class OrderServiceImpl method printOrder.

@Override
public void printOrder(Order order, Log log) {
    if (!log.isDebugEnabled()) {
        return;
    }
    TableCreator tc = new TableCreator(new TableCreator.Col[] { new TableCreator.Col("Order Item", 30), new TableCreator.Col("Qty"), new TableCreator.Col("Unit Price"), new TableCreator.Col("Avg Adj"), new TableCreator.Col("Total Adj"), new TableCreator.Col("Total Price") });
    for (OrderItem oi : order.getOrderItems()) {
        tc.addRow(new String[] { oi.getName(), String.valueOf(oi.getQuantity()), String.valueOf(oi.getPriceBeforeAdjustments(true)), String.valueOf(oi.getAverageAdjustmentValue()), String.valueOf(oi.getTotalAdjustmentValue()), String.valueOf(oi.getTotalPrice()) });
    }
    tc.addSeparator().withGlobalRowHeaderWidth(15).addRow("Subtotal", order.getSubTotal()).addRow("Order Adj.", order.getOrderAdjustmentsValue()).addRow("Tax", order.getTotalTax()).addRow("Shipping", order.getTotalShipping()).addRow("Total", order.getTotal()).addSeparator();
    log.debug(tc.toString());
}
Also used : TableCreator(org.broadleafcommerce.common.util.TableCreator) OrderItem(org.broadleafcommerce.core.order.domain.OrderItem) DiscreteOrderItem(org.broadleafcommerce.core.order.domain.DiscreteOrderItem) GiftWrapOrderItem(org.broadleafcommerce.core.order.domain.GiftWrapOrderItem) BundleOrderItem(org.broadleafcommerce.core.order.domain.BundleOrderItem)

Aggregations

TableCreator (org.broadleafcommerce.common.util.TableCreator)1 BundleOrderItem (org.broadleafcommerce.core.order.domain.BundleOrderItem)1 DiscreteOrderItem (org.broadleafcommerce.core.order.domain.DiscreteOrderItem)1 GiftWrapOrderItem (org.broadleafcommerce.core.order.domain.GiftWrapOrderItem)1 OrderItem (org.broadleafcommerce.core.order.domain.OrderItem)1