Search in sources :

Example 11 with Bill

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

the class BillManager method convertFromOfferToBill.

public Bill convertFromOfferToBill(final Offer offer) {
    final Bill bill = new Bill();
    // simple values
    bill.setContact(offer.getContact());
    bill.setName(offer.getDescription());
    bill.setState(BillState.EMITTED);
    bill.setBillType(BillType.ISSUED);
    // concepts
    final Set<BillBreakDown> billBreakDowns = new LinkedHashSet<BillBreakDown>();
    billBreakDowns.addAll(convertFromOfferCostsToBillBreakDowns(bill, offer.getCosts()));
    billBreakDowns.addAll(convertFromOfferRolesToBillBreakDowns(bill, offer.getRoles()));
    bill.setBreakDown(billBreakDowns);
    return bill;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Bill(com.autentia.tnt.businessobject.Bill) BillBreakDown(com.autentia.tnt.businessobject.BillBreakDown)

Example 12 with Bill

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

the class BillBeanTest method initTest.

@Before
public void initTest() throws Exception {
    billBean = new BillBean();
    billBean.create();
    Bill bill = new Bill();
    billBean.setBill(bill);
    billBean.setSelectedOrganization(org);
    reset(projectManager);
}
Also used : Bill(com.autentia.tnt.businessobject.Bill) Before(org.junit.Before)

Example 13 with Bill

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

the class OfferBean method convertFromOfferToBill.

public String convertFromOfferToBill() {
    final Bill bill = billManager.convertFromOfferToBill(offer);
    final BillBean billBean = (BillBean) FacesUtils.getBean("billBean");
    billBean.setBill(bill);
    return "editBill";
}
Also used : Bill(com.autentia.tnt.businessobject.Bill) BillBean(com.autentia.tnt.bean.billing.BillBean)

Example 14 with Bill

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

the class FromOfferToBillTest method testConversionWithOfferCosts.

/**
 * Comprobacion de que se haga la conversion guardando con costes materiales
 */
@Test
public void testConversionWithOfferCosts() {
    final BillManager billManager = (BillManager) SpringUtilsForTesting.getSpringBean("managerBill");
    final BillDAO billDAO = (BillDAO) SpringUtilsForTesting.getSpringBean("daoBill");
    insertInitialData();
    insertOfferCosts();
    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() != 5800) {
        fail("el total de la factura deberia ser de '5800', 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)

Example 15 with Bill

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

the class FromOfferToBillTest method testConversionWithRolesCosts.

/**
 * Comprobacion de que se haga la conversion guardando con costes derivados del uso de personal
 */
@Test
public void testConversionWithRolesCosts() {
    final BillManager billManager = (BillManager) SpringUtilsForTesting.getSpringBean("managerBill");
    final BillDAO billDAO = (BillDAO) SpringUtilsForTesting.getSpringBean("daoBill");
    insertInitialData();
    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() != 1218) {
        fail("el total de la factura deberia ser de '1218', 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