Zprovozněna sestava objednávky. Umožněn upload souboru s razítkem, které

se zobrazuje na sestavě objednávky (Globalní nastavení - Požadavky -
Razítko).
closes #136
multitenant
Josef Rokos 10 years ago
parent 5421486189
commit 3f51a323bd

@ -21,6 +21,7 @@ public class SettingsData {
private String bankCode; private String bankCode;
private List<Vehicle> vehicles; private List<Vehicle> vehicles;
private Map<Integer, BigDecimal[]> refunds; private Map<Integer, BigDecimal[]> refunds;
private String stampFile;
public SettingsData() { public SettingsData() {
newReqTemplate = new MailMessage(); newReqTemplate = new MailMessage();
@ -131,4 +132,12 @@ public class SettingsData {
this.refunds = refunds; this.refunds = refunds;
} }
public String getStampFile() {
return stampFile;
}
public void setStampFile(String stampFile) {
this.stampFile = stampFile;
}
} }

@ -1,10 +1,12 @@
package info.bukova.isspst.reporting; package info.bukova.isspst.reporting;
import info.bukova.isspst.data.AuthItem; import info.bukova.isspst.data.AuthItem;
import info.bukova.isspst.data.Order;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.UserSettingsData; import info.bukova.isspst.data.UserSettingsData;
import info.bukova.isspst.services.requirement.TripRequirementService; import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.storage.FileStorage; import info.bukova.isspst.storage.FileStorage;
@ -20,12 +22,16 @@ public class ParamFiller {
private FileStorage storage; private FileStorage storage;
@Autowired @Autowired
private TripRequirementService tripReqService; private TripRequirementService tripReqService;
@Autowired
private GlobalSettingsService settingService;
public void fill() { public void fill() {
if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) { if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) {
return; return;
} }
definition.getParams().clear();
if ((definition.getDataSet().get(0) instanceof TripBill) if ((definition.getDataSet().get(0) instanceof TripBill)
&& definition.getReport().isSingleRecord()) { && definition.getReport().isSingleRecord()) {
if (userService.getUserSettings().getSignatureFile() != null if (userService.getUserSettings().getSignatureFile() != null
@ -49,6 +55,14 @@ public class ParamFiller {
definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile())); definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile()));
} }
} }
if ((definition.getDataSet().get(0) instanceof Order)
&& definition.getReport().isSingleRecord()) {
if (settingService.getSettings().getStampFile() != null
&& !settingService.getSettings().getStampFile().isEmpty()) {
definition.setParam("P_STAMP", storage.serverPath(settingService.getSettings().getStampFile()));
}
}
} }
} }

@ -8,18 +8,26 @@ import info.bukova.isspst.data.Vehicle;
import info.bukova.isspst.mail.MailMessage; import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.sort.ReflectionTools; import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.storage.FileStorage;
import info.bukova.isspst.ui.LocaleConverter; import info.bukova.isspst.ui.LocaleConverter;
import info.bukova.isspst.ui.SecurityHelper; import info.bukova.isspst.ui.SecurityHelper;
import java.awt.image.RenderedImage;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.imageio.ImageIO;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
@ -31,7 +39,9 @@ public class GlobalSettingsVM {
private LocaleConverter locConverter; private LocaleConverter locConverter;
private Address selAddress; private Address selAddress;
private List<Integer> refundsHours; private List<Integer> refundsHours;
@WireVariable
private FileStorage storage;
@Init @Init
public void init() { public void init() {
settings = settingsService.getSettings(); settings = settingsService.getSettings();
@ -49,6 +59,23 @@ public class GlobalSettingsVM {
window.detach(); window.detach();
} }
@Command
@NotifyChange({"settings", "stampImg"})
public void uploadStamp(@ContextParam(ContextType.TRIGGER_EVENT) UploadEvent upEvent) {
int i = upEvent.getMedia().getName().lastIndexOf(".");
String fileName = "StampImageFile" + upEvent.getMedia().getName().substring(i);
storage.saveFile(upEvent.getMedia().getByteData(), fileName);
settings.setStampFile(fileName);
}
@Command
@NotifyChange("stampImg")
public void removeStamp() {
storage.removeFile(settings.getStampFile());
settings.setStampFile(null);
}
public List<String> getRequirementFields() { public List<String> getRequirementFields() {
return ReflectionTools.getEntityFields(Requirement.class); return ReflectionTools.getEntityFields(Requirement.class);
} }
@ -107,5 +134,17 @@ public class GlobalSettingsVM {
this.refundsHours = new ArrayList<Integer>(settings.getRefunds().keySet()); this.refundsHours = new ArrayList<Integer>(settings.getRefunds().keySet());
Collections.sort(this.refundsHours); Collections.sort(this.refundsHours);
} }
public RenderedImage getStampImg() {
if (settings.getStampFile() == null || settings.getStampFile().isEmpty()) {
return null;
}
try {
return ImageIO.read(storage.file(settings.getStampFile()));
} catch (IOException e) {
return null;
}
}
} }

@ -169,6 +169,9 @@ GlobalSettingsVehicles=Dopravní prostředky
GlobalSettingsRefunds=Náhrady GlobalSettingsRefunds=Náhrady
GlobalSettingsFreeMealsCount=Počet jídel zdarma GlobalSettingsFreeMealsCount=Počet jídel zdarma
GlobalSettingsHours=Hodin GlobalSettingsHours=Hodin
GlobalSettingsUploadStamp=Nahrát obrázek razítka
GlobalSettingsStamp=Razítko
GlobalSettingsReqEnable=Povolení požadavků
UserSettings=Uživatelské nastavení UserSettings=Uživatelské nastavení
@ -221,6 +224,7 @@ LogedInUser=Přihlášený uživatel:
ButtonStorno=Storno ButtonStorno=Storno
ButtonSave=Uložit ButtonSave=Uložit
ButtonDelete=Smazat
HeaderText=Hlavička HeaderText=Hlavička

@ -2,10 +2,11 @@
<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="order" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="001cec2c-ccd4-45df-b6f6-2d28cf67ed6a"> <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="order" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="001cec2c-ccd4-45df-b6f6-2d28cf67ed6a">
<property name="ireport.zoom" value="1.5"/> <property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/> <property name="ireport.x" value="0"/>
<property name="ireport.y" value="32"/> <property name="ireport.y" value="0"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["/home/pepa/Dokumenty/dev/java/isspst/"]]></defaultValueExpression> <defaultValueExpression><![CDATA["/home/pepa/Dokumenty/dev/java/isspst/"]]></defaultValueExpression>
</parameter> </parameter>
<parameter name="P_STAMP" class="java.lang.String"/>
<queryString> <queryString>
<![CDATA[]]> <![CDATA[]]>
</queryString> </queryString>
@ -63,7 +64,7 @@
<field name="suplier.web" class="java.lang.String"/> <field name="suplier.web" class="java.lang.String"/>
<field name="suplier.zipCode" class="java.lang.String"/> <field name="suplier.zipCode" class="java.lang.String"/>
<field name="items" class="java.util.List"/> <field name="items" class="java.util.List"/>
<field name="ownedBy" class="java.lang.String"/> <field name="ownedBy" class="info.bukova.isspst.data.User"/>
<background> <background>
<band splitType="Stretch"/> <band splitType="Stretch"/>
</background> </background>
@ -311,11 +312,15 @@
<line> <line>
<reportElement uuid="28c4da74-c350-4bac-a918-7da9c4703f35" x="0" y="100" width="572" height="1"/> <reportElement uuid="28c4da74-c350-4bac-a918-7da9c4703f35" x="0" y="100" width="572" height="1"/>
</line> </line>
<textField isBlankWhenNull="true"> <textField>
<reportElement uuid="ae10698c-46ba-4297-9cce-e31f7fb46c37" x="78" y="36" width="147" height="20"/> <reportElement uuid="fd079061-3ca5-4430-b7cf-91843fd1dc74" x="78" y="36" width="184" height="20"/>
<textElement verticalAlignment="Middle"/> <textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{ownedBy}]]></textFieldExpression> <textFieldExpression><![CDATA[""+($F{ownedBy} != null ? $F{ownedBy} : "")]]></textFieldExpression>
</textField> </textField>
<image>
<reportElement uuid="8a225478-b6f1-4589-95f9-bf63a23d984a" x="403" y="20" width="158" height="56"/>
<imageExpression><![CDATA[$P{P_STAMP}]]></imageExpression>
</image>
</band> </band>
</summary> </summary>
</jasperReport> </jasperReport>

@ -123,7 +123,7 @@
<textField isBlankWhenNull="true"> <textField isBlankWhenNull="true">
<reportElement uuid="ec5c1b7b-7f1e-49b8-9522-960b23fc797d" x="210" y="0" width="26" height="25"/> <reportElement uuid="ec5c1b7b-7f1e-49b8-9522-960b23fc797d" x="210" y="0" width="26" height="25"/>
<textElement textAlignment="Center"/> <textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[""+$F{munit}]]></textFieldExpression> <textFieldExpression><![CDATA[""+($F{munit} != null ? $F{munit} : "")]]></textFieldExpression>
</textField> </textField>
<textField isBlankWhenNull="true"> <textField isBlankWhenNull="true">
<reportElement uuid="3bf9bab0-042a-4a62-a9a9-950c7f98fde8" x="236" y="0" width="244" height="25"/> <reportElement uuid="3bf9bab0-042a-4a62-a9a9-950c7f98fde8" x="236" y="0" width="244" height="25"/>

@ -0,0 +1,28 @@
<?page title="requirements" contentType="text/html;charset=UTF-8"?>
<zk>
<groupbox mold="3d">
<caption label="${labels.GlobalSettingsReqEnable}"/>
<div>
<checkbox
label="${labels.EnableRequirements}"
checked="@bind(vm.settings.enableRequirements)" disabled="@load(not vm.canSave)" />
</div>
</groupbox>
<groupbox mold="3d">
<caption label="${labels.GlobalSettingsStamp}"/>
<hbox>
<button label="${labels.GlobalSettingsUploadStamp}"
upload="true,maxsize=600,accept=image/*"
onUpload="@command('uploadStamp')"
sclass="nicebutton"
disabled="@load(not vm.canSave)"/>
<div width="400px" height="110px" style="border: 1px solid black;">
<image height="100px" content="@load(vm.stampImg)"/>
</div>
</hbox>
<button label="${labels.ButtonDelete}"
onClick="@command('removeStamp')"
sclass="nicebutton"
disabled="@load(not vm.canSave)"/>
</groupbox>
</zk>

@ -6,7 +6,7 @@
closable="true" closable="true"
apply="org.zkoss.bind.BindComposer" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM')" viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM')"
width="700px" width="750px"
height="600px" height="600px"
binder="@init(queueName='email')"> binder="@init(queueName='email')">
<caption <caption
@ -25,11 +25,7 @@
</tabs> </tabs>
<tabpanels> <tabpanels>
<tabpanel> <tabpanel>
<div> <include src="/settings/global/requirements.zul" />
<checkbox
label="${labels.EnableRequirements}"
checked="@bind(vm.settings.enableRequirements)" disabled="@load(not vm.canSave)" />
</div>
</tabpanel> </tabpanel>
<tabpanel> <tabpanel>
<include src="/settings/global/email.zul" /> <include src="/settings/global/email.zul" />

Loading…
Cancel
Save