Search in sources :

Example 16 with Project

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

the class BillManagerTest method getAllBitacoreBreakDownsHaveCorrectIvaForLastDayOf18IvaTest.

@Test
public void getAllBitacoreBreakDownsHaveCorrectIvaForLastDayOf18IvaTest() {
    final Project project = insertProjectIntoContext(lastDateFor18Iva);
    ProjectCost projectCost = createProjectCost(project);
    final GregorianCalendar calendarEnd = new GregorianCalendar(2012, 11, 1);
    final List<BillBreakDown> billBreakDownList = billManager.getAllBitacoreBreakDowns(lastDateFor18Iva, calendarEnd.getTime(), project);
    assertEquals(IVA18, billBreakDownList.get(0).getIva());
    assertEquals(IVA18, billBreakDownList.get(1).getIva());
    deleteProjectCostFromContext(projectCost);
    deleteProjectFromContext(project);
}
Also used : Project(com.autentia.tnt.businessobject.Project) GregorianCalendar(java.util.GregorianCalendar) ProjectCost(com.autentia.tnt.businessobject.ProjectCost) BillBreakDown(com.autentia.tnt.businessobject.BillBreakDown) Test(org.junit.Test)

Example 17 with Project

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

the class InteractionBean method getProjects.

// Getters to list possible values of related entities
/**
 * Get the list of all projects
 * @return the list of all projects
 */
public List<SelectItem> getProjects() {
    List<Project> refs = ProjectManager.getDefault().getAllEntities(null, new SortCriteria("name"));
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    for (Project ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) Project(com.autentia.tnt.businessobject.Project) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 18 with Project

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

the class InteractionBean method getProjectsBySelectedOrganization.

public List<SelectItem> getProjectsBySelectedOrganization() {
    List<Project> refs = ProjectManager.getDefault().getProjectsByOrganization(getSelectedOrganization());
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    for (Object ref : refs) {
        Project proy = (Project) ref;
        String asterisco = proy.isFinished() ? "(*)" : "";
        ret.add(new SelectItem(proy, proy.getName() + asterisco));
    }
    return ret;
}
Also used : Project(com.autentia.tnt.businessobject.Project) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 19 with Project

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

the class ActivityBean method onSelectedOrganizationChanged.

/**
 * Set the selectedOrganization value when the combo value changes
 *
 * @param event
 */
public void onSelectedOrganizationChanged(ValueChangeEvent event) {
    setSelectedOrganization((Organization) event.getNewValue());
    // Project
    List<Project> projectsByOrganization = ProjectManager.getDefault().getOpenProjectsByOrganization(selectedOrganization);
    if (projectsByOrganization != null && projectsByOrganization.size() != 0) {
        this.selectedProject = (Project) projectsByOrganization.get(0);
        FacesContext.getCurrentInstance().getViewRoot().getAttributes();
    } else {
        this.selectedProject = null;
    }
    HtmlSelectOneListbox projects = (HtmlSelectOneListbox) FacesUtils.getComponent("activity").findComponent("tabActivity").findComponent("projects");
    projects.setValue(selectedProject);
    if (selectedProject != null) {
        HtmlSelectBooleanCheckbox billHtml = (HtmlSelectBooleanCheckbox) FacesUtils.getComponent("activity").findComponent("tabActivity").findComponent("billable");
        billHtml.setValue(selectedProject.getBillable());
        setBillable(selectedProject.getBillable());
        HtmlInputHidden hiddenHtml = (HtmlInputHidden) FacesUtils.getComponent("activity").findComponent("tabActivity").findComponent("defaultBillable");
        hiddenHtml.setValue(selectedProject.getBillable());
        setDefaultBillable(selectedProject.getBillable());
    }
    FacesUtils.renderResponse();
}
Also used : Project(com.autentia.tnt.businessobject.Project) HtmlSelectBooleanCheckbox(javax.faces.component.html.HtmlSelectBooleanCheckbox) HtmlSelectOneListbox(javax.faces.component.html.HtmlSelectOneListbox) HtmlInputHidden(javax.faces.component.html.HtmlInputHidden)

Example 20 with Project

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

the class OccupationBean method getProjectsBySelectedOrganization.

public List<SelectItem> getProjectsBySelectedOrganization() {
    List<Project> refs = ProjectManager.getDefault().getProjectsByOrganization(getSelectedOrganization());
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    for (Object ref : refs) {
        Project proy = (Project) ref;
        String asterisco = proy.isFinished() ? "(*)" : "";
        ret.add(new SelectItem(proy, proy.getName() + asterisco));
    }
    return ret;
}
Also used : Project(com.autentia.tnt.businessobject.Project) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Aggregations

Project (com.autentia.tnt.businessobject.Project)22 ArrayList (java.util.ArrayList)12 SelectItem (javax.faces.model.SelectItem)10 SortCriteria (com.autentia.tnt.dao.SortCriteria)9 GregorianCalendar (java.util.GregorianCalendar)5 Activity (com.autentia.tnt.businessobject.Activity)4 BillBreakDown (com.autentia.tnt.businessobject.BillBreakDown)4 ProjectCost (com.autentia.tnt.businessobject.ProjectCost)4 Test (org.junit.Test)4 ProjectRole (com.autentia.tnt.businessobject.ProjectRole)3 ActivitySearch (com.autentia.tnt.dao.search.ActivitySearch)3 Organization (com.autentia.tnt.businessobject.Organization)2 LocalDate (java.time.LocalDate)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 SettingBean (com.autentia.tnt.bean.admin.SettingBean)1 Bill (com.autentia.tnt.businessobject.Bill)1 DocumentCategory (com.autentia.tnt.businessobject.DocumentCategory)1 ExternalActivity (com.autentia.tnt.businessobject.ExternalActivity)1 GlobalHourReport (com.autentia.tnt.businessobject.GlobalHourReport)1