Do sestav žádosti o služební cestu a vyúčtování vstupuje podpis
uživatele a podpis schvalovatele. closes #132multitenant
parent
d108f4a070
commit
74586f9820
@ -1,44 +0,0 @@
|
||||
package info.bukova.isspst.reporting;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class DefinitionFiller {
|
||||
|
||||
@Autowired
|
||||
ReportDefinition definition;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void setData(Object data) {
|
||||
if (data instanceof List) {
|
||||
definition.setDataSet((List<Object>)data);
|
||||
} else {
|
||||
definition.setSingleObject(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void fillDefinition(Report report, Object data) {
|
||||
definition.clear();
|
||||
definition.setReport(report);
|
||||
setData(data);
|
||||
}
|
||||
|
||||
public void fillDefinition(Report report, Object data, Map<String, Object> params) {
|
||||
fillDefinition(report, data);
|
||||
definition.setParams(params);
|
||||
}
|
||||
|
||||
public void fillDefinition(Report report, Object data, String[] columns) {
|
||||
fillDefinition(report, data);
|
||||
definition.setFieldsToPrint(Arrays.asList(columns));
|
||||
}
|
||||
|
||||
public void fillDefinition(Report report, Object data, String[] columns, Map<String, Object> params) {
|
||||
fillDefinition(report, data, params);
|
||||
definition.setFieldsToPrint(Arrays.asList(columns));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package info.bukova.isspst.reporting;
|
||||
|
||||
import info.bukova.isspst.data.AuthItem;
|
||||
import info.bukova.isspst.data.TripBill;
|
||||
import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.data.UserSettingsData;
|
||||
import info.bukova.isspst.services.requirement.TripRequirementService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.storage.FileStorage;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class ParamFiller {
|
||||
|
||||
@Autowired
|
||||
private ReportDefinition definition;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private FileStorage storage;
|
||||
@Autowired
|
||||
private TripRequirementService tripReqService;
|
||||
|
||||
public void fill() {
|
||||
if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((definition.getDataSet().get(0) instanceof TripBill)
|
||||
&& definition.getReport().isSingleRecord()) {
|
||||
if (userService.getUserSettings().getSignatureFile() != null
|
||||
&& !userService.getUserSettings().getSignatureFile().isEmpty()) {
|
||||
definition.setParam("P_USER_SIGNATURE", storage.serverPath(userService.getUserSettings().getSignatureFile()));
|
||||
}
|
||||
|
||||
TripBill tb = (TripBill)definition.getDataSet().get(0);
|
||||
tripReqService.loadAuthItems(tb.getRequirement());
|
||||
AuthItem lastAuth = tb.getRequirement().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
|
||||
|
||||
definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate());
|
||||
|
||||
User u = lastAuth.getApprover();
|
||||
|
||||
UserSettingsData approverSettings = userService.getUserSettings(u);
|
||||
|
||||
if (approverSettings != null
|
||||
&& approverSettings.getSignatureFile() != null
|
||||
&& !approverSettings.getSignatureFile().isEmpty()) {
|
||||
definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue