Search in sources :

Example 1 with DataNotReadyException

use of org.jaffa.modules.printing.services.exceptions.DataNotReadyException in project jaffa-framework by jaffa-projects.

the class InvoiceDataBean method populate.

public void populate() throws FrameworkException, ApplicationExceptions {
    if (PENDING_ORDER_NO.equals(orderNo))
        throw new ApplicationExceptions(new DataNotReadyException(new String[] { "OrderNo", PENDING_ORDER_NO }));
    int lines = 1;
    if (VALID_ORDER_NO.equals(orderNo))
        lines = 20;
    else if (VALID_ORDER_NO2.equals(orderNo) || VALID_LABEL.equals(orderNo))
        lines = 2;
    else
        throw new ApplicationExceptions(new DataNotFoundException(new String[] { "OrderNo", VALID_ORDER_NO }));
    this.orderTotal = 0;
    // this.orderNo="PO0019657-A";
    // this.shippingAddress="A building 2building 3building 4building\nSome Road 2SomeRoad 3SomeRoad 4SomeRoad\nSome City 1SomeCity 2SomeCity 3SomeCity\nUtah 1Utah 2Utah 3Utah 4Utah 5Utah 6Utah 7Utah\nUT 98765 123412353tew5tgwe523451235125125";
    this.shippingAddress = "A building\nSome Road\nSome City\nUtah\nUT 98765";
    this.vendorAddress = "Acme Road\nAcmeville\nUtah\nUT 98765";
    this.vendorCode = "AM001-2";
    this.vendorName = "ACME Inc.";
    this.orderDate = DateOnly.addDay(new DateOnly(), -7);
    this.needDate = DateOnly.addDay(new DateOnly(), 2);
    this.remarks = "See additional pages";
    this.item = new ArrayList();
    for (int i = 0; i < lines && i < partList.length; i++) {
        InvoiceLineItem it = new InvoiceLineItem();
        this.item.add(it);
        it.setItemNo(i + 1);
        long qty = quantityList[i];
        double price = priceList[i];
        it.setQuantity(new Long(qty));
        it.setDescription(partList[i]);
        it.setUnitPrice(new Double(price));
        it.setExtendedPrice(new Double(price * qty));
        this.orderTotal += price * qty;
        System.out.println(it.toString());
    }
}
Also used : DataNotReadyException(org.jaffa.modules.printing.services.exceptions.DataNotReadyException) DataNotFoundException(org.jaffa.modules.printing.services.exceptions.DataNotFoundException) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) ArrayList(java.util.ArrayList) DateOnly(org.jaffa.datatypes.DateOnly)

Aggregations

ArrayList (java.util.ArrayList)1 DateOnly (org.jaffa.datatypes.DateOnly)1 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)1 DataNotFoundException (org.jaffa.modules.printing.services.exceptions.DataNotFoundException)1 DataNotReadyException (org.jaffa.modules.printing.services.exceptions.DataNotReadyException)1