Excel Export Ausgangsrechnungen
This commit is contained in:
parent
b9084965e0
commit
3b7742ee07
3 changed files with 302 additions and 1 deletions
|
|
@ -0,0 +1,151 @@
|
||||||
|
package com.alexanderlogistics.mahnlauf;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.imixs.workflow.ItemCollection;
|
||||||
|
import org.imixs.workflow.engine.DocumentService;
|
||||||
|
import org.imixs.workflow.exceptions.PluginException;
|
||||||
|
import org.imixs.workflow.faces.data.DocumentController;
|
||||||
|
import org.imixs.workflow.faces.data.WorkflowController;
|
||||||
|
import org.imixs.workflow.office.forms.CustomFormItem;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import jakarta.enterprise.context.ConversationScoped;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.inject.Named;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Der ExcelExportController exportiert rechnungen anhand von Filterangaben
|
||||||
|
* (excel_export_rechnungsausgang.xhmlt) nach Excel.
|
||||||
|
*
|
||||||
|
* Die Ausgabe ist auf maximal 3000 Zeilen eingeschränkt
|
||||||
|
*
|
||||||
|
* @author rsoika
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named
|
||||||
|
@ConversationScoped
|
||||||
|
public class ExcelExportController implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static Logger logger = Logger.getLogger(ExcelExportController.class.getName());
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected DocumentService documentService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
WorkflowController workflowController;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DocumentController documentController;
|
||||||
|
|
||||||
|
private ItemCollection filter;
|
||||||
|
private CustomFormItem dbtrItem;
|
||||||
|
|
||||||
|
public ExcelExportController() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemCollection getFilter() {
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilter(ItemCollection filter) {
|
||||||
|
this.filter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fuert verschiedene Queries aus um eine Analyse der Sachprufung durchzuführen.
|
||||||
|
*
|
||||||
|
* @throws PluginException
|
||||||
|
*/
|
||||||
|
public void export() throws PluginException {
|
||||||
|
|
||||||
|
logger.info("start export....");
|
||||||
|
|
||||||
|
Date start = filter.getItemValueDate("start");
|
||||||
|
Date stop = filter.getItemValueDate("stop");
|
||||||
|
|
||||||
|
logger.info("...daterange=" + start + " - " + stop);
|
||||||
|
|
||||||
|
// serach date range?
|
||||||
|
String sDateFrom = "191401070000"; // because * did not work here
|
||||||
|
String sDateTo = "211401070000";
|
||||||
|
SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmm");
|
||||||
|
|
||||||
|
if (start != null) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(start);
|
||||||
|
sDateFrom = dateformat.format(cal.getTime());
|
||||||
|
}
|
||||||
|
if (stop != null) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(stop);
|
||||||
|
cal.add(Calendar.DATE, 1);
|
||||||
|
sDateTo = dateformat.format(cal.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
// query zeit
|
||||||
|
String query = "(type:workitem OR type:workitemarchive) ";
|
||||||
|
if (start != null && stop != null) {
|
||||||
|
query += "AND (invoice.date:[" + sDateFrom + " TO " + sDateTo + "]) ";
|
||||||
|
} else {
|
||||||
|
throw new PluginException("ERROR", "Bitte geben Sie einen Zeitraum an", null);
|
||||||
|
}
|
||||||
|
logger.info(query);
|
||||||
|
|
||||||
|
// query Sachprüfung
|
||||||
|
|
||||||
|
if (!filter.getItemValueString("space.name").isEmpty()) {
|
||||||
|
query += " AND (space.name:" + filter.getItemValueString("space.name") + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (workflowController.getWorkitem() != null
|
||||||
|
&& !workflowController.getWorkitem().getItemValueString("dbtr.number").isEmpty()) {
|
||||||
|
query += " AND (dbtr.number:" + workflowController.getWorkitem().getItemValueString("dbtr.number") + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("Query=" + query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method reset the search and input state.
|
||||||
|
*/
|
||||||
|
public void reset() {
|
||||||
|
filter = new ItemCollection();
|
||||||
|
|
||||||
|
// compute start stop based on current month
|
||||||
|
YearMonth startYearMonth = YearMonth.now();
|
||||||
|
java.time.LocalDate startOfMonthDate = startYearMonth.atDay(1);
|
||||||
|
java.time.LocalDate endOfMonthDate = startYearMonth.atEndOfMonth();
|
||||||
|
filter.setItemValue("start",
|
||||||
|
java.util.Date.from(startOfMonthDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
|
||||||
|
filter.setItemValue("stop",
|
||||||
|
java.util.Date.from(endOfMonthDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
|
||||||
|
workflowController.setWorkitem(new ItemCollection());
|
||||||
|
|
||||||
|
// debtr item
|
||||||
|
dbtrItem = new CustomFormItem("dbtr.number", "text", "", false, false, false, "", null, false, 0);
|
||||||
|
|
||||||
|
// public CustomFormItem(String name, String type, String label, boolean
|
||||||
|
// required, boolean readonly, boolean disabled,
|
||||||
|
// String options,
|
||||||
|
// String path, boolean hide, int span) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomFormItem getItem() {
|
||||||
|
// dbtrItem.setName("dbtr.number");
|
||||||
|
return dbtrItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -14,13 +14,16 @@
|
||||||
<li>
|
<li>
|
||||||
<h:link outcome="/pages/admin/analyse_invoicing">Analyse Rechnungseingang</h:link>
|
<h:link outcome="/pages/admin/analyse_invoicing">Analyse Rechnungseingang</h:link>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<h:link outcome="/pages/admin/excel_export_rechnungsausgang">Excel Export Rechnungsausgang</h:link>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h:link outcome="/pages/admin/kreditor">Creditor/Debitor Management</h:link>
|
<h:link outcome="/pages/admin/kreditor">Creditor/Debitor Management</h:link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h:link outcome="/pages/admin/oplist_export">OP List Export</h:link>
|
<h:link outcome="/pages/admin/oplist_export">OP List Export</h:link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h:link outcome="/pages/admin/agl_params">Parameter</h:link>
|
<h:link outcome="/pages/admin/agl_params">Parameter</h:link>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,147 @@
|
||||||
|
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
|
||||||
|
xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||||
|
xmlns:i="http://java.sun.com/jsf/composite/imixs" xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||||
|
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions"
|
||||||
|
xmlns:marty="http://java.sun.com/jsf/composite/marty" template="/layout/template.xhtml">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Diese Form exportiert Ausgangsrechnungen nach Excel
|
||||||
|
-->
|
||||||
|
|
||||||
|
<ui:define name="scripts">
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*<![CDATA[*/
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/*]]>*/
|
||||||
|
</script>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
<ui:define name="content">
|
||||||
|
<f:view>
|
||||||
|
|
||||||
|
<h:form id="import_form_id">
|
||||||
|
<!-- ########## Error ########## -->
|
||||||
|
<ui:include src="/error_message.xhtml" />
|
||||||
|
|
||||||
|
<div class="imixs-form">
|
||||||
|
<div class="imixs-header">
|
||||||
|
<h1>Excle Export Ausgangsrechnungen</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<h:panelGroup layout="block" styleClass="imixs-body" id="analyse_panel">
|
||||||
|
|
||||||
|
<div class="imixs-form-panel">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="ui-state-highlight ui-corner-all" style="margin-bottom: 10px; padding: .5em;">
|
||||||
|
<p>Der folgende Report exportiert <i>Ausgangsrechnungen</i>, in eine Excel Datei. Der Export ist auf maximal 3000 Einträge pro Tabelle beschränkt
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="imixs-form-section-2">
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
Von:<span class="imixs-required">*</span>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<h:inputText styleClass="imixs-date"
|
||||||
|
value="#{excelExportController.filter.item['start']}">
|
||||||
|
<f:convertDateTime pattern="#{message.datePatternShort}"
|
||||||
|
timeZone="#{message.timeZone}" />
|
||||||
|
</h:inputText>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
Bis:<span class="imixs-required">*</span>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<h:inputText styleClass="imixs-date"
|
||||||
|
value="#{excelExportController.filter.item['stop']}">
|
||||||
|
<f:convertDateTime pattern="#{message.datePatternShort}"
|
||||||
|
timeZone="#{message.timeZone}" />
|
||||||
|
</h:inputText>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
Abteilung:
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<h:inputText
|
||||||
|
value="#{excelExportController.filter.item['space.name']}">
|
||||||
|
|
||||||
|
</h:inputText>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
Debitor:
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<ui:include src="/pages/workitems/parts/alexander/debitor_search.xhtml" >
|
||||||
|
<ui:param name="workitem" value="#{workflowController.workitem}" />
|
||||||
|
<ui:param name="item" value="#{excelExportController.item}" />
|
||||||
|
</ui:include>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
Positionsnummer:
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<h:inputText
|
||||||
|
value="#{excelExportController.filter.item['invoice.text']}">
|
||||||
|
|
||||||
|
</h:inputText>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h:commandButton actionListener="#{excelExportController.export()}"
|
||||||
|
action="/pages/" value="Excel Export starten">
|
||||||
|
<f:ajax render="result_panel" execute="@form" onevent="updatePanel" />
|
||||||
|
</h:commandButton>
|
||||||
|
<h:commandButton value="#{message.close}" action="notes" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</h:panelGroup>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="imixs-footer"></div>
|
||||||
|
</h:form>
|
||||||
|
</f:view>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
Loading…
Reference in a new issue