4 Commits

Author SHA1 Message Date
pepa d2aa1cbd9a Opraveno vyhodnocení sestavy pro podpis, pokud je v agendě více sestav s podpisem. 2016-01-06 11:55:28 +01:00
pepa 52cf63414b Oprevena sestava Žádost o SC- tisk z agend Cestovní příkazy a Požadavky na SC odkazuje na stejnou sestavu.
Byla přidána možnost použít property hlavní entity jako zdroje dat pro sestavu- rozšířen constructor třídy Report o parametr property.
2015-11-27 15:11:23 +01:00
pepa f904e89946 Opraveno filtrování podle čísla požadavku v agendě Cestovní příkazy. 2015-11-27 14:22:05 +01:00
pepa 5cae516cb6 Na sestavě Vyúčtování SC bylo odstraněno pole pro podpis "S provedením pracovní cesty souhlasí".
closes #259
2015-11-27 13:57:25 +01:00
8 changed files with 72 additions and 29 deletions
@@ -143,7 +143,7 @@ public class Constants {
public final static ReportMapping REPORTS[] = {
new ReportMapping(MOD_ADDRESSBOOK, new Report(1, false, "Adresní karty", "address")),
new ReportMapping(MOD_ADDRESSBOOK, new Report(2, false, "Adresa", "address", false, true)),
new ReportMapping(MOD_TRIPBILL, new Report(3, false, "Žádost", "tripRequirement", false, true)),
new ReportMapping(MOD_TRIPBILL, new Report(7, true, "Žádost o SC", "tripRequirementApp", false, true, "requirement")),
new ReportMapping(MOD_TRIPBILL, new Report(4, true, "Vyúčtování", "tripBill", false, true, true)),
new ReportMapping(MOD_ORDER, new Report(5, false, "Objednávka", "order", true, true)),
new ReportMapping(MOD_REQUIREMENTS, new Report(6, false, "Požadavky", "requirements")),
@@ -151,6 +151,11 @@ public class Constants {
new ReportMapping(MOD_REQUIREMENTS, new Report(8, true, "Protokol o kontrole", "orderRequirement", false, true))
};
public final static Map<Class<?>, Integer> SIGN_REPORT_MAP = Collections.unmodifiableMap(new HashMap<Class<?>, Integer>() {{
put(TripBillApproval.class, 4);
put(TripRequirement.class, 7);
}});
public final static String REQTYPE_ORDER = "ORDER";
public final static String REQTYPE_BUSINESSTRIP = "BUSINESSTRIP";
public final static RequirementType REQTYPES[] = {
@@ -11,6 +11,7 @@ public class Report {
private boolean hasSettings;
private boolean singleRecord;
private boolean hasCondition;
private String property;
public Report() {
this.reportId = 0;
@@ -60,6 +61,11 @@ public class Report {
this.singleRecord = singleRecord;
}
public Report(long reportId, boolean signable, String name, String jasperFile, boolean hasSettings, boolean singleRecord, String property) {
this(reportId, signable, name, jasperFile, hasSettings, singleRecord);
this.property = property;
}
/**
*
* @param reportId
@@ -138,4 +144,12 @@ public class Report {
public void setSignable(boolean signable) {
this.signable = signable;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
}
@@ -542,11 +542,17 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
private Report getSignReport(T entity) {
Module module = ModuleUtils.getModule(entityForSignReport(entity), servletContext);
Report report = null;
int reportId = Constants.SIGN_REPORT_MAP.get(entity.getClass()) == null ? 0 : Constants.SIGN_REPORT_MAP.get(entity.getClass());
for (Report r : module.getReports()) {
if (r.isSignable()) {
report = r;
break;
if (reportId == 0) {
report = r;
break;
} else if (reportId == r.getReportId()) {
report = r;
break;
}
}
}
@@ -1,9 +1,13 @@
package info.bukova.isspst.ui.reporting;
import info.bukova.isspst.Module;
import info.bukova.isspst.ModuleUtils;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.reporting.ReportType;
import info.bukova.isspst.services.Service;
import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.ui.DocumentViewModel;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
@@ -11,9 +15,12 @@ import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;
import javax.servlet.ServletContext;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class ReportDialogVM extends DocumentViewModel
@@ -25,6 +32,7 @@ public class ReportDialogVM extends DocumentViewModel
private ReportDefinition reportDefinition;
private List<Object> dataList;
private Object singleObject;
private ServletContext ctx;
@Init(superclass = true)
public void init(@ExecutionArgParam("reports") List<Report> reports,
@@ -40,6 +48,8 @@ public class ReportDialogVM extends DocumentViewModel
dataList = data;
this.singleObject = singleObject;
reportDefinition.setService(service);
ctx = Sessions.getCurrent().getWebApp().getServletContext();
}
public List<Report> getReports() {
@@ -59,12 +69,37 @@ public class ReportDialogVM extends DocumentViewModel
this.selected = selected;
reportDefinition.setReport(selected);
if (selected.isSingleRecord()) {
reportDefinition.setSingleObject(singleObject);
setObject(selected);
} else {
reportDefinition.setDataSet(dataList);
}
}
private void setObject(Report report) {
if (report.getProperty() == null) {
reportDefinition.setSingleObject(singleObject);
} else {
try {
Object o = ReflectionTools.getGetterMethod(singleObject, report.getProperty()).invoke(singleObject);
reportDefinition.setSingleObject(o);
if (!(o instanceof DataModel)) {
return;
}
Module m = ModuleUtils.getModule((DataModel)o, ctx);
if (m != null) {
reportDefinition.setService((Service<Object>) ModuleUtils.getServiceInstance(m, ctx));
}
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
@Command
public void print(@BindingParam("window") Window window) {
if (window != null) {
Binary file not shown.
+5 -22
View File
@@ -2,7 +2,7 @@
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBill" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="20" uuid="f59e8277-a431-4cdc-abaa-c82c1cf193af">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.y" value="3"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter>
@@ -57,7 +57,7 @@
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="275" splitType="Stretch">
<band height="237" splitType="Stretch">
<staticText>
<reportElement uuid="6e60bd03-48b9-4555-91ab-757532d93e6a" x="10" y="61" width="143" height="20"/>
<textElement>
@@ -176,25 +176,8 @@ tuzemské pracovní cesty]]></text>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[$F{resultMessageDate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="b2b60eec-df87-4385-a6d9-8d3f80cc319a" x="1" y="229" width="295" height="20"/>
<textElement>
<font isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Se způsobem provedení souhlasí:]]></text>
</staticText>
<line>
<reportElement uuid="0cf99b2a-b025-4a50-bcb5-8e371536bb77" x="296" y="249" width="276" height="1"/>
</line>
<staticText>
<reportElement uuid="17876cb8-7666-48f4-9275-f7a70cd08ff9" x="296" y="253" width="276" height="20"/>
<textElement textAlignment="Center">
<font isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Datum a podpis oprávněné osoby]]></text>
</staticText>
<line>
<reportElement uuid="c67f7840-5e38-4eed-ab3f-e4907ac33b5c" x="0" y="272" width="572" height="1"/>
<reportElement uuid="c67f7840-5e38-4eed-ab3f-e4907ac33b5c" x="0" y="236" width="572" height="1"/>
</line>
<line>
<reportElement uuid="e3530085-daa8-4675-bf3a-d98c775be07e" x="0" y="55" width="571" height="1"/>
@@ -203,10 +186,10 @@ tuzemské pracovní cesty]]></text>
<reportElement uuid="47e4e70d-fb5f-4266-889a-4149c71efa42" x="-1" y="0" width="572" height="1"/>
</line>
<line>
<reportElement uuid="d4738137-17c1-4721-b222-7187988c1b06" x="-1" y="1" width="1" height="272"/>
<reportElement uuid="d4738137-17c1-4721-b222-7187988c1b06" x="-1" y="1" width="1" height="236"/>
</line>
<line>
<reportElement uuid="bf83547c-60d9-4f95-a5f1-db0763ba17cb" x="571" y="1" width="1" height="272"/>
<reportElement uuid="bf83547c-60d9-4f95-a5f1-db0763ba17cb" x="571" y="1" width="1" height="236"/>
</line>
<textField isBlankWhenNull="true">
<reportElement uuid="8af60406-55bf-46f0-82e9-865dc9edbdb4" x="196" y="82" width="375" height="20">
@@ -60,7 +60,7 @@
width="300px" />
<listbox id="users" model="@bind(vm.users)" height="380px" width="300px" multiple="true"
droppable="true" onDrop="@command('addMember', event=event)" selectedItems="@bind(vm.selectedUsers)"
itemRenderer="@load(vm.userItemRenderer)">
>
<listhead>
<listheader label="Uživatelé" sort="czech(fullName)"/>
</listhead>
@@ -53,7 +53,7 @@
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.numser)"
value="@bind(vm.filterTemplate.bill.requirement.numser)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthText)"