Search in sources :

Example 6 with OfferCost

use of com.autentia.tnt.businessobject.OfferCost in project TNTConcept by autentia.

the class OfferBean method getCostss.

/**
 * Get the list of all costss
 *
 * @return the list of all costss
 */
public List<SelectItem> getCostss() {
    List<OfferCost> refs = OfferCostManager.getDefault().getAllEntities(null, new SortCriteria("name"));
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    for (OfferCost ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) SelectItem(javax.faces.model.SelectItem) OfferCost(com.autentia.tnt.businessobject.OfferCost) ArrayList(java.util.ArrayList)

Example 7 with OfferCost

use of com.autentia.tnt.businessobject.OfferCost in project TNTConcept by autentia.

the class OfferBeanTest method createCostsIn2009Test.

@Test
public void createCostsIn2009Test() {
    final OfferBean offerBean = new OfferBean();
    offerBean.create();
    final GregorianCalendar calendar = new GregorianCalendar(2009, 8, 31);
    offerBean.setCreationDate(calendar.getTime());
    offerBean.createCosts();
    for (OfferCost offerCost : offerBean.getCosts()) {
        assertEquals(IVA16, offerCost.getIva());
    }
}
Also used : GregorianCalendar(java.util.GregorianCalendar) OfferCost(com.autentia.tnt.businessobject.OfferCost) Test(org.junit.Test)

Example 8 with OfferCost

use of com.autentia.tnt.businessobject.OfferCost in project TNTConcept by autentia.

the class OfferBeanTest method createCostsInLastDayOf18Test.

@Test
public void createCostsInLastDayOf18Test() {
    OfferBean offerBean = new OfferBean();
    offerBean.create();
    final GregorianCalendar calendar = new GregorianCalendar(2012, 7, 31);
    offerBean.setCreationDate(calendar.getTime());
    offerBean.createCosts();
    for (OfferCost offerCost : offerBean.getCosts()) {
        assertEquals(IVA18, offerCost.getIva());
    }
}
Also used : GregorianCalendar(java.util.GregorianCalendar) OfferCost(com.autentia.tnt.businessobject.OfferCost) Test(org.junit.Test)

Example 9 with OfferCost

use of com.autentia.tnt.businessobject.OfferCost in project TNTConcept by autentia.

the class OfferBeanTest method createCostsInFirstDayOf18Test.

@Test
public void createCostsInFirstDayOf18Test() {
    OfferBean offerBean = new OfferBean();
    offerBean.create();
    final GregorianCalendar calendar = new GregorianCalendar(2010, 6, 1);
    offerBean.setCreationDate(calendar.getTime());
    offerBean.createCosts();
    for (OfferCost offerCost : offerBean.getCosts()) {
        assertEquals(IVA18, offerCost.getIva());
    }
}
Also used : GregorianCalendar(java.util.GregorianCalendar) OfferCost(com.autentia.tnt.businessobject.OfferCost) Test(org.junit.Test)

Example 10 with OfferCost

use of com.autentia.tnt.businessobject.OfferCost in project TNTConcept by autentia.

the class BillManager method convertFromOfferCostsToBillBreakDowns.

private Set<BillBreakDown> convertFromOfferCostsToBillBreakDowns(final Bill bill, final Set<OfferCost> offerCosts) {
    final Set<BillBreakDown> billBreakDowns = new LinkedHashSet<BillBreakDown>();
    if (offerCosts != null) {
        for (OfferCost cost : offerCosts) {
            if (cost.isBillable()) {
                BillBreakDown billBreakDown = new BillBreakDown();
                billBreakDown.setConcept(cost.getName());
                billBreakDown.setUnits(cost.getUnits());
                billBreakDown.setAmount(cost.getCost());
                billBreakDown.setIva(cost.getIva());
                billBreakDown.setBill(bill);
                billBreakDowns.add(billBreakDown);
            }
        }
    }
    return billBreakDowns;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) OfferCost(com.autentia.tnt.businessobject.OfferCost) BillBreakDown(com.autentia.tnt.businessobject.BillBreakDown)

Aggregations

OfferCost (com.autentia.tnt.businessobject.OfferCost)10 GregorianCalendar (java.util.GregorianCalendar)4 LinkedHashSet (java.util.LinkedHashSet)4 Test (org.junit.Test)4 BigDecimal (java.math.BigDecimal)2 BillBreakDown (com.autentia.tnt.businessobject.BillBreakDown)1 Interaction (com.autentia.tnt.businessobject.Interaction)1 Offer (com.autentia.tnt.businessobject.Offer)1 OfferRole (com.autentia.tnt.businessobject.OfferRole)1 SortCriteria (com.autentia.tnt.dao.SortCriteria)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 SelectItem (javax.faces.model.SelectItem)1