use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class CreditTitleBean method getBillss.
/**
* Get the list of all billss
* @return the list of all billss
*/
public List<SelectItem> getBillss() {
List<Bill> refs = BillManager.getDefault().getAllEntities(null, new SortCriteria("name"));
ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
for (Bill ref : refs) {
ret.add(new SelectItem(ref, ref.getName()));
}
return ret;
}
use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class CreditTitleManager method payBillIfRequired.
private void payBillIfRequired(final CreditTitle creditTitle) {
if (checkIfPayBillIfRequired(creditTitle)) {
for (Bill bill : creditTitle.getBills()) {
bill.setState(BillState.PAID);
BillManager.getDefault().updateEntity(bill);
}
}
}
use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class BillAndBillPaymentTest method insertInitialData.
/**
* Metodo encargado de insertar datos muy generales pero que son necesarios
* en la gestion de facturas
*/
private void insertInitialData() {
final BillDAO billDAO = (BillDAO) SpringUtilsForTesting.getSpringBean("daoBill");
final ProjectDAO projectDAO = (ProjectDAO) SpringUtilsForTesting.getSpringBean("daoProject");
final Project project = new Project();
projectDAO.insert(project);
bill = new Bill();
bill.setCreationDate(new Date());
bill.setState(BillState.EMITTED);
bill.setNumber("200901");
bill.setName("Factura por servicios");
bill.setProject(project);
bill.setStartBillDate(new Date());
bill.setEndBillDate(new Date());
bill.setState(BillState.EMITTED);
bill.setOrderNumber("12");
billDAO.insert(bill);
}
use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class FromOfferToBillTest method testConversionWithoutConceptsAndNoSaving.
/**
* Comprobacion de que se haga la conversion sin guardar ni tener en cuenta conceptos
*/
@Test
public void testConversionWithoutConceptsAndNoSaving() {
final BillManager billManager = (BillManager) SpringUtilsForTesting.getSpringBean("managerBill");
insertInitialData();
final Bill bill = billManager.convertFromOfferToBill(offer);
// comprobaciones
if (bill.getState() != BillState.EMITTED) {
fail("el estado debe ser '" + BillState.EMITTED + "' en vez de '" + bill.getState() + "'");
}
if (bill.getBillType() != BillType.ISSUED) {
fail("el estado debe ser '" + BillType.ISSUED + "' en vez de '" + bill.getBillType() + "'");
}
if (!bill.getContact().equals(contact)) {
fail("el contacto debe ser '" + contact.getName() + "' en vez de '" + bill.getContact().getName() + "'");
}
if (!bill.getName().equals(offer.getDescription())) {
fail("el nombre de la factura debe ser '" + bill.getName() + "' en vez de '" + offer.getTitle() + "'");
}
}
use of com.autentia.tnt.businessobject.Bill in project TNTConcept by autentia.
the class FromOfferToBillTest method testConversionWithOfferAndRolesCosts.
/**
* Comprobacion de que se haga la conversion guardando con todo tipo de costes
*/
@Test
public void testConversionWithOfferAndRolesCosts() {
final BillManager billManager = (BillManager) SpringUtilsForTesting.getSpringBean("managerBill");
final BillDAO billDAO = (BillDAO) SpringUtilsForTesting.getSpringBean("daoBill");
insertInitialData();
insertOfferCosts();
insertOfferRoles();
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() != 7018) {
fail("el total de la factura deberia ser de '7018', pero ha recuperado '" + bill.getTotal() + "'");
}
}
Aggregations