Added new column to WBS with the data from the task criteria
FEA: ItEr77S17AutomaticBudgeting
This commit is contained in:
parent
25e45b65e8
commit
a3a237b9aa
4 changed files with 60 additions and 9 deletions
|
|
@ -53,4 +53,6 @@ public interface IOrderElementModel {
|
|||
|
||||
boolean isCodeAutogenerated();
|
||||
|
||||
String getTotalBudget();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,14 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.libreplan.business.common.daos.IConfigurationDAO;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.costcategories.entities.TypeOfWorkHours;
|
||||
import org.libreplan.business.orders.daos.IOrderDAO;
|
||||
import org.libreplan.business.orders.daos.IOrderElementDAO;
|
||||
import org.libreplan.business.orders.entities.HoursGroup;
|
||||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
import org.libreplan.business.requirements.entities.CriterionRequirement;
|
||||
import org.libreplan.business.resources.daos.ICriterionTypeDAO;
|
||||
import org.libreplan.business.resources.entities.Criterion;
|
||||
import org.libreplan.business.resources.entities.CriterionType;
|
||||
|
|
@ -48,6 +52,9 @@ public class OrderElementModel implements IOrderElementModel {
|
|||
|
||||
private OrderModel order;
|
||||
|
||||
@Autowired
|
||||
private IConfigurationDAO configurationDAO;
|
||||
|
||||
@Autowired
|
||||
private IOrderElementDAO orderElementDAO;
|
||||
|
||||
|
|
@ -156,4 +163,26 @@ public class OrderElementModel implements IOrderElementModel {
|
|||
return order.isCodeAutogenerated();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public String getTotalBudget() {
|
||||
String autobudget = "";
|
||||
|
||||
TypeOfWorkHours typeofWorkHours = configurationDAO.getConfiguration()
|
||||
.getBudgetDefaultTypeOfWorkHours();
|
||||
for (CriterionRequirement criterionRequirement : getOrderElement()
|
||||
.getCriterionRequirements()) {
|
||||
try {
|
||||
autobudget += criterionRequirement.getCriterion()
|
||||
.getCostCategory().getName();
|
||||
autobudget += typeofWorkHours.getName();
|
||||
// getHourCostByCode(defaultCode)
|
||||
// .getPriceCost().toBigInteger();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return autobudget;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,17 +37,22 @@ import java.util.logging.Filter;
|
|||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.aspectj.weaver.ICrossReferenceHandler;
|
||||
import org.libreplan.business.common.daos.IConfigurationDAO;
|
||||
import org.libreplan.business.common.daos.IConnectorDAO;
|
||||
import org.libreplan.business.common.entities.Connector;
|
||||
import org.libreplan.business.common.entities.EntitySequence;
|
||||
import org.libreplan.business.common.entities.PredefinedConnectorProperties;
|
||||
import org.libreplan.business.common.entities.PredefinedConnectors;
|
||||
import org.libreplan.business.orders.entities.HoursGroup;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
import org.libreplan.business.orders.entities.OrderLine;
|
||||
import org.libreplan.business.orders.entities.OrderLineGroup;
|
||||
import org.libreplan.business.orders.entities.SchedulingState;
|
||||
import org.libreplan.business.requirements.entities.CriterionRequirement;
|
||||
import org.libreplan.business.resources.daos.ICriterionDAO;
|
||||
import org.libreplan.business.templates.entities.OrderElementTemplate;
|
||||
import org.libreplan.business.users.entities.UserRole;
|
||||
import org.libreplan.web.common.FilterUtils;
|
||||
|
|
@ -59,12 +64,14 @@ import org.libreplan.web.common.components.bandboxsearch.BandboxSearch;
|
|||
import org.libreplan.web.common.components.finders.FilterPair;
|
||||
import org.libreplan.web.common.components.finders.OrderElementFilterEnum;
|
||||
import org.libreplan.web.common.components.finders.TaskElementFilterEnum;
|
||||
import org.libreplan.web.materials.UnitTypeModel;
|
||||
import org.libreplan.web.orders.assigntemplates.TemplateFinderPopup;
|
||||
import org.libreplan.web.orders.assigntemplates.TemplateFinderPopup.IOnResult;
|
||||
import org.libreplan.web.security.SecurityUtils;
|
||||
import org.libreplan.web.templates.IOrderTemplatesControllerEntryPoints;
|
||||
import org.libreplan.web.tree.TreeController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.zkoss.ganttz.IPredicate;
|
||||
import org.zkoss.ganttz.util.ComponentsFinder;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
|
@ -130,6 +137,12 @@ public class OrderElementTreeController extends TreeController<OrderElement> {
|
|||
@Autowired
|
||||
private IConnectorDAO connectorDAO;
|
||||
|
||||
@Autowired
|
||||
private ICriterionDAO criterionDAO;
|
||||
|
||||
private static final org.apache.commons.logging.Log LOG = LogFactory
|
||||
.getLog(OrderElementTreeController.class);
|
||||
|
||||
public List<org.libreplan.business.labels.entities.Label> getLabels() {
|
||||
return orderModel.getLabels();
|
||||
}
|
||||
|
|
@ -609,14 +622,9 @@ public class OrderElementTreeController extends TreeController<OrderElement> {
|
|||
}
|
||||
|
||||
public void addAutoBudgetCell(OrderElement currentElement) {
|
||||
String autobudget = " autobudget";
|
||||
for (CriterionRequirement criterionRequirement : currentElement
|
||||
.getCriterionRequirements()) {
|
||||
autobudget += criterionRequirement.getCriterion()
|
||||
.getCostCategory();
|
||||
autobudget += currentElement.getHoursGroups().toString();
|
||||
}
|
||||
addCell(new Textbox(autobudget));
|
||||
IOrderElementModel model = orderModel
|
||||
.getOrderElementModel(currentElement);
|
||||
addCell(new Textbox(model.getTotalBudget()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,17 @@ import static org.libreplan.web.I18nHelper._;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.daos.IConfigurationDAO;
|
||||
import org.libreplan.business.common.entities.Configuration;
|
||||
import org.libreplan.business.orders.entities.OrderElement;
|
||||
import org.libreplan.business.trees.ITreeNode;
|
||||
import org.libreplan.web.orders.OrderElementTreeController.OrderElementTreeitemRenderer;
|
||||
import org.libreplan.web.tree.TreeComponent;
|
||||
import org.libreplan.web.tree.TreeController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.zkoss.zul.Treeitem;
|
||||
|
||||
/**
|
||||
|
|
@ -38,6 +44,9 @@ import org.zkoss.zul.Treeitem;
|
|||
*/
|
||||
public class OrdersTreeComponent extends TreeComponent {
|
||||
|
||||
@Autowired
|
||||
private IConfigurationDAO configurationDAO;
|
||||
|
||||
abstract class OrdersTreeColumn extends Column {
|
||||
OrdersTreeColumn(String label, String cssClass, String tooltip) {
|
||||
super(label, cssClass, tooltip);
|
||||
|
|
@ -87,6 +96,8 @@ public class OrdersTreeComponent extends TreeComponent {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
// Pending to add condition with configuration.isEnabledAutomaticBudget
|
||||
columns.add(new OrdersTreeColumn(_("autobudget"), "autobudget",
|
||||
_("autobudget")) {
|
||||
|
||||
|
|
@ -97,6 +108,7 @@ public class OrdersTreeComponent extends TreeComponent {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
columns.add(new OrdersTreeColumn(_("Must start after"),
|
||||
"estimated_init",
|
||||
_("Estimated start date for the task (press enter in textbox to open calendar popup or type in date directly)")) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue