|
|
|
@ -1,8 +1,11 @@
|
|
|
|
|
package info.bukova.isspst.ui.main.orders.requirements;
|
|
|
|
|
|
|
|
|
|
import info.bukova.isspst.data.Limit;
|
|
|
|
|
import info.bukova.isspst.data.Requirement;
|
|
|
|
|
import info.bukova.isspst.data.Workgroup;
|
|
|
|
|
import info.bukova.isspst.filters.RequirementFilter;
|
|
|
|
|
import info.bukova.isspst.services.invoicing.InvoicingService;
|
|
|
|
|
import info.bukova.isspst.services.limits.LimitService;
|
|
|
|
|
import info.bukova.isspst.services.requirement.RequirementService;
|
|
|
|
|
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
|
|
|
|
import info.bukova.isspst.ui.requirement.RequirementSubpage;
|
|
|
|
@ -25,6 +28,12 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
|
|
|
|
|
@WireVariable
|
|
|
|
|
protected WorkgroupService workgroupService;
|
|
|
|
|
|
|
|
|
|
@WireVariable
|
|
|
|
|
protected LimitService limitService;
|
|
|
|
|
|
|
|
|
|
@WireVariable
|
|
|
|
|
protected InvoicingService invoicingService;
|
|
|
|
|
|
|
|
|
|
public List<Workgroup> getCentres()
|
|
|
|
|
{
|
|
|
|
|
return workgroupService.getCentres();
|
|
|
|
@ -73,10 +82,38 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" })
|
|
|
|
|
@NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount", "workgroupLimit", "workgroupInvoiced" })
|
|
|
|
|
public void setDataBean(Requirement data) {
|
|
|
|
|
super.setDataBean(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BigDecimal getWorkgroupLimit() {
|
|
|
|
|
if (getDataBean() != null && getDataBean().getWorkgroup() != null) {
|
|
|
|
|
Limit limit = limitService.getForWorkgroup(getDataBean().getWorkgroup());
|
|
|
|
|
|
|
|
|
|
if (limit == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return limit.getLimit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BigDecimal getWorkgroupInvoiced() {
|
|
|
|
|
if (getDataBean() != null && getDataBean().getWorkgroup() != null) {
|
|
|
|
|
BigDecimal invoiced = invoicingService.totalInvoicedForWorkgroup(getDataBean().getWorkgroup());
|
|
|
|
|
|
|
|
|
|
if (invoiced == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return invoiced;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|