Search in sources :

Example 6 with OfferRole

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

the class DuplicateOfferTest method insertOfferRoles.

/**
 * Inserta costes imputables a personal en la ofertas
 */
private void insertOfferRoles() {
    final Set<OfferRole> offerRoles = new LinkedHashSet<OfferRole>(2);
    final OfferRole chapista = new OfferRole();
    chapista.setCostPerHour(new BigDecimal(30));
    chapista.setExpectedHours(10);
    chapista.setIva(new BigDecimal(16));
    chapista.setName("chapista");
    chapista.setOffer(offer);
    final OfferRole pintor = new OfferRole();
    pintor.setCostPerHour(new BigDecimal(25));
    pintor.setExpectedHours(30);
    pintor.setIva(new BigDecimal(16));
    pintor.setName("pintor");
    pintor.setOffer(offer);
    offerRoles.add(chapista);
    offerRoles.add(pintor);
    offer.setRoles(offerRoles);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) OfferRole(com.autentia.tnt.businessobject.OfferRole) BigDecimal(java.math.BigDecimal)

Example 7 with OfferRole

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

the class FromOfferToBillTest method insertOfferRoles.

/**
 * Inserta costes imputables a personal en la ofertas
 */
private void insertOfferRoles() {
    final Set<OfferRole> offerRoles = new LinkedHashSet<OfferRole>(2);
    final OfferRole chapista = new OfferRole();
    chapista.setCostPerHour(new BigDecimal(30));
    chapista.setExpectedHours(10);
    chapista.setIva(new BigDecimal(16));
    chapista.setName("chapista");
    chapista.setOffer(offer);
    final OfferRole pintor = new OfferRole();
    pintor.setCostPerHour(new BigDecimal(25));
    pintor.setExpectedHours(30);
    pintor.setIva(new BigDecimal(16));
    pintor.setName("pintor");
    pintor.setOffer(offer);
    offerRoles.add(chapista);
    offerRoles.add(pintor);
    offer.setRoles(offerRoles);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) OfferRole(com.autentia.tnt.businessobject.OfferRole) BigDecimal(java.math.BigDecimal)

Example 8 with OfferRole

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

the class OfferBean method getRoless.

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

Example 9 with OfferRole

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

the class OfferBeanTest method createRolesInFirstDayOf18Test.

@Test
public void createRolesInFirstDayOf18Test() {
    OfferBean offerBean = new OfferBean();
    offerBean.create();
    final GregorianCalendar calendar = new GregorianCalendar(2010, 6, 1);
    offerBean.setCreationDate(calendar.getTime());
    offerBean.createRoles();
    for (OfferRole offerRole : offerBean.getRoles()) {
        assertEquals(IVA18, offerRole.getIva());
    }
}
Also used : GregorianCalendar(java.util.GregorianCalendar) OfferRole(com.autentia.tnt.businessobject.OfferRole) Test(org.junit.Test)

Aggregations

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