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;
}
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());
}
}
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());
}
}
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());
}
}
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;
}
Aggregations