use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class FromOfferToBillTest method testConversionWithoutConceptsAndSaving.
/**
* Comprobacion de que se haga la conversion guardando sin conceptos
*/
@Test
public void testConversionWithoutConceptsAndSaving() {
final BillManager billManager = (BillManager) SpringUtilsForTesting.getSpringBean("managerBill");
final BillDAO billDAO = (BillDAO) SpringUtilsForTesting.getSpringBean("daoBill");
insertInitialData();
Bill bill = billManager.convertFromOfferToBill(offer);
// esto deberia hacerlo el usuario a traves de la página
bill = insertDataByUserInWeb(bill);
billDAO.insert(bill);
if (bill.getTotal().floatValue() != new BigDecimal(0).floatValue()) {
fail("es una factura sin conceptos ... el total deberia ser de 0 en vez de '" + bill.getTotal() + "'");
}
}
use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class BillExpirationDateBean method updateExpirationDate.
// private Set<BillPayment> billPayment = new LinkedHashSet<BillPayment>();
public void updateExpirationDate() {
// TODO extract login name to a properties file
authenticateAs(ConfigurationUtil.getDefault().getAdminUser());
List<Bill> bills = BillManager.getDefault().getAllEntities(null, new SortCriteria("name"));
for (Bill b : bills) {
Date creationDate = b.getCreationDate();
creationDate.setMonth(creationDate.getMonth() + 1);
if (!b.getBillPayment().isEmpty()) {
for (BillPayment bp : b.getBillPayment()) {
bp.setExpirationDate(creationDate);
}
} else {
// creamos el billPayment para el expirationDate
createBillPayment(b);
for (BillPayment bp : b.getBillPayment()) {
bp.setExpirationDate(creationDate);
}
}
}
}
use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class BillManager method getAllEntities.
/**
* Get a list of bills between start and end dates
* @param search
* @param sort
* @param start
* @param end
* @return
*/
public List<Bill> getAllEntities(BillSearch search, SortCriteria sort, Date start, Date end) {
List<Bill> res = billDAO.search(search, sort);
List<Bill> list = new ArrayList<Bill>();
Calendar calendar = Calendar.getInstance();
// Recorremos la lista de Bills
for (Bill item : res) {
if (item.getExpiration() != null) {
// Metemos en el calendar la fecha del item
calendar.setTime(item.getExpiration());
// Si la fecha está dentro del rango de fechas seleccionado se añade a la lista con la fecha calculada del próximo pago
if ((calendar.getTimeInMillis() >= start.getTime()) && (calendar.getTimeInMillis() <= end.getTime())) {
// Añadimos a la lista
list.add(item);
}
}
}
return list;
}
use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class NOFBean method getAllNOFIssuedBills.
public List<GenericNOF> getAllNOFIssuedBills() {
/**
** Facturas emitidas impagadas que vencen en el periodo ***
*/
/**
** Facturas emitidas impagadas ya vencidas ***
*/
/**
** Facturas recibidas impagadas que vencen en el periodo ***
*/
/**
** Facturas recibidas impagadas ya vencidas ***
*/
int years = ConfigurationUtil.getDefault().getYearsBackSearchNotPaidBillsNOF();
List<BillType> billTypes = new ArrayList<BillType>();
billTypes.add(BillType.ISSUED);
billSearch.setBillTypes(billTypes);
billSearch.setState(BillState.EMITTED);
billSearch.setStartEndBillDate(calculateStartEndByPassedYear(years));
List<Bill> total = billManager.getAllEntities(billSearch, new SortCriteria("creationDate", true), new GregorianCalendar(1900, 1, 1).getTime(), getEndDate());
return convertFromBillToGenericNOF(total);
}
Aggregations