Search in sources :

Example 6 with Bill

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;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) SelectItem(javax.faces.model.SelectItem) Bill(com.autentia.tnt.businessobject.Bill) ArrayList(java.util.ArrayList)

Example 7 with Bill

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);
        }
    }
}
Also used : Bill(com.autentia.tnt.businessobject.Bill)

Example 8 with 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);
}
Also used : Project(com.autentia.tnt.businessobject.Project) BillDAO(com.autentia.tnt.dao.hibernate.BillDAO) Bill(com.autentia.tnt.businessobject.Bill) Date(java.util.Date) ProjectDAO(com.autentia.tnt.dao.hibernate.ProjectDAO)

Example 9 with 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() + "'");
    }
}
Also used : BillManager(com.autentia.tnt.manager.billing.BillManager) Bill(com.autentia.tnt.businessobject.Bill) Test(org.junit.Test)

Example 10 with Bill

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() + "'");
    }
}
Also used : BillManager(com.autentia.tnt.manager.billing.BillManager) BillDAO(com.autentia.tnt.dao.hibernate.BillDAO) Bill(com.autentia.tnt.businessobject.Bill) Test(org.junit.Test)

Aggregations

Bill (com.autentia.tnt.businessobject.Bill)19 ArrayList (java.util.ArrayList)6 BillDAO (com.autentia.tnt.dao.hibernate.BillDAO)5 BillManager (com.autentia.tnt.manager.billing.BillManager)5 Test (org.junit.Test)5 SortCriteria (com.autentia.tnt.dao.SortCriteria)4 Date (java.util.Date)4 BigDecimal (java.math.BigDecimal)3 BillType (com.autentia.tnt.businessobject.BillType)2 GregorianCalendar (java.util.GregorianCalendar)2 HashSet (java.util.HashSet)2 BillBean (com.autentia.tnt.bean.billing.BillBean)1 BillBreakDown (com.autentia.tnt.businessobject.BillBreakDown)1 BillPayment (com.autentia.tnt.businessobject.BillPayment)1 CreditTitle (com.autentia.tnt.businessobject.CreditTitle)1 Project (com.autentia.tnt.businessobject.Project)1 ProjectDAO (com.autentia.tnt.dao.hibernate.ProjectDAO)1 Calendar (java.util.Calendar)1 LinkedHashSet (java.util.LinkedHashSet)1 SelectItem (javax.faces.model.SelectItem)1