Opliste als maske ergänzt und controller bereitgestellt

This commit is contained in:
Ralph Soika 2022-08-23 11:58:53 +02:00
parent c4cfcfb7f8
commit 88b962b459
5 changed files with 37 additions and 152 deletions

View file

@ -89,24 +89,36 @@ public class OPListController implements Serializable {
* @param item - name of the item to summarize
* @return sum rounded to 2 digits
*/
public double calculateSum(List<String> refids, String item) {
public double calculateSum() {
double result = 0;
List<String> refids=workflowController.getWorkitem().getItemValueList("$workitemref",String.class);
for (String id : refids) {
ItemCollection doc = documentService.load(id);
if (doc != null) {
if ("credit".equals(doc.getItemValueString("payment.type"))) {
result = result + doc.getItemValueDouble(item);
} else {
result = result - doc.getItemValueDouble(item);
}
} else {
logger.warning("invalid read access to calculate sum");
if (doc!=null) {
result = result + doc.getItemValueDouble("invoice.total");
}
}
// rond with 2 digits
return Math.round(result * 100.0) / 100.0;
}
/**
* Berechnet den gesammten OP Saldo
* @return
*/
public double calculateSaldo(List<ItemCollection> invoices ) {
double result = 0;
for (ItemCollection invoice : invoices) {
result = result + invoice.getItemValueDouble("invoice.total");
}
// rond with 2 digits
return Math.round(result * 100.0) / 100.0;
}
/**
* This method removes an uniqueid form the item $workitemref

View file

@ -1,130 +0,0 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:i="http://java.sun.com/jsf/composite/imixs"
xmlns:marty="http://java.sun.com/jsf/composite/marty">
<!-- zeigt alle rechnungen an die von einem Abteilungsleiter verteilt werden können -->
<ui:param name="user" value="#{loginController.userPrincipal}"></ui:param>
<ui:param name="query"
value="(type:workitem) AND ($modelversion:rechnungseingang-de*) AND ($taskid:5100) AND ($owner:#{user})"></ui:param>
<ui:param name="invoiceList"
value="#{workflowController.documentService.find(query,30,0)}"></ui:param>
<ui:fragment rendered="#{empty invoiceList}">
<div class="ui-state-highlight ui-corner-all"
style="margin-bottom: 10px; padding: .5em;">
<p>Es liegen derzeit keine Rechnungen zur Prüfung für Sie vor.</p>
</div>
</ui:fragment>
<ui:fragment rendered="#{!empty invoiceList}">
<div class="imixs-form-section">
<table class="">
<tr>
<th></th>
<th style="">Bereich</th>
<th style="">#{message['form.company']}</th>
<th style="">#{message['form.invoicenumber']}</th>
<th style="">#{message['form.date']}</th>
<th style="">Fälligkeit</th>
<th style="">#{message['form.amount']}</th>
<th style=""></th>
</tr>
<c:forEach items="#{invoiceList}" var="invoice">
<tr>
<td><input type="checkbox" class="selection_checkbox"
id="#{invoice.uniqueID}" /></td>
<td>#{invoice.item['space.name']}</td>
<td><h:link outcome="/pages/workitems/workitem">
#{invoice.item['cdtr.name']}
<f:param name="id" value="#{invoice.item['$uniqueid']}" />
</h:link></td>
<td>#{invoice.item['invoice.number']}</td>
<td><h:outputText value="#{invoice.item['invoice.date']}">
<f:convertDateTime pattern="#{message.datePatternShort}"
timeZone="#{message.timeZone}" />
</h:outputText></td>
<td><h:outputText value="#{invoice.item['invoice.duedate']}">
<f:convertDateTime pattern="#{message.datePatternShort}"
timeZone="#{message.timeZone}" />
</h:outputText></td>
<td style="text-align: right;"><h:outputText
value="#{invoice.item['invoice.total']}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText></td>
<td>#{invoice.item['invoice.currency']}</td>
</tr>
</c:forEach>
<h:inputText style="display:none;" class="invoice_selection_list"
value="#{workitem.item['invoice.selection']}" />
</table>
</div>
</ui:fragment>
<script type="text/javascript">
/*<![CDATA[*/
// collect all selected ids form the checkboxes in the first column
$(document).ready(
function() {
// clear last selection...
selection = $('.invoice_selection_list').val('');
// on change handler....
$('input[type="checkbox"].selection_checkbox').change(
function() {
var id = $(this).attr('id');
var check = $(this).prop('checked');
//console.log("Change: " + id + " to " + check);
// get selection
var selection = $('.invoice_selection_list')
.val();
const selectionArr = selection.split(",");
// selected
if (check) {
selectionArr.push(id);
}
// unselected
if (!check) {
var i = selectionArr.indexOf(id);
selectionArr.splice(i, i);
}
//console.log("new selection=" + selectionArr.join(','));
selection = $('.invoice_selection_list').val(
selectionArr.join(','));
});
});
/*]]>*/
</script>
</ui:composition>

View file

@ -9,11 +9,9 @@
<!-- Shows the op liste fo rthe current dbtr.number -->
<h:panelGroup styleClass="imixs-form-section" id="oplist-table" binding="#{opListContainer}">
<h:panelGroup layout="block" styleClass="imixs-form-section" id="oplist-table" binding="#{opListContainer}">
<h3>Offene Posten</h3>
<table class="" style="width:100%">
<table style="width:100%;margin:5px;">
<tr>
<th style="text-align: left;">#{message['form.invoicenumber']}</th>
<th style="text-align: left;">#{message['form.date']}</th>
@ -64,10 +62,18 @@
<td />
<td><strong>Summary</strong></td>
<td style="text-align: right;"><strong><h:outputText
value="#{zahlungsavisController.calculateSum(workitem.itemList['$workitemref'], 'invoice.total')}">
value="#{opListController.calculateSaldo(invoices)}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText></strong></td>
<td><strong>#{invoice.item['invoice.currency']}</strong></td>
<td style="text-align: right;"><strong><h:outputText
value="#{opListController.calculateSum()}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText></strong></td>
<td />
</tr>
@ -75,12 +81,9 @@
<!-- dieses feld speichert die selection der rechnungen -->
<h:inputTextarea converter="org.imixs.VectorConverter" class="invoice_selection_list"
style="display:none;"
value="#{workitem.itemList['$workitemref']}">
</h:inputTextarea>
style="display:none;" value="#{workitem.itemList['$workitemref']}"/>
</h:panelGroup>
<script type="text/javascript">
/*<![CDATA[*/

View file

@ -29,8 +29,6 @@
<imixs:value><![CDATA[org.imixs.marty.plugins.SequenceNumberPlugin]]></imixs:value>
<imixs:value><![CDATA[org.imixs.marty.team.TeamPlugin]]></imixs:value>
<imixs:value><![CDATA[org.imixs.marty.profile.DeputyPlugin]]></imixs:value>
<imixs:value><![CDATA[com.alexanderlogistics.InvoicePlugin]]></imixs:value>
<imixs:value><![CDATA[org.imixs.workflow.sepa.plugins.IBANBICPlugin]]></imixs:value>
<imixs:value><![CDATA[org.imixs.workflow.engine.plugins.OwnerPlugin]]></imixs:value>
<imixs:value><![CDATA[org.imixs.workflow.engine.plugins.HistoryPlugin]]></imixs:value>
<imixs:value><![CDATA[org.imixs.workflow.engine.plugins.LogPlugin]]></imixs:value>
@ -294,7 +292,7 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com
<imixs:value><![CDATA[Rechnung erhalten]]></imixs:value>
</imixs:item>
<imixs:item name="txtimageurl" type="xs:string">
<imixs:value><![CDATA[typcn-download]]></imixs:value>
<imixs:value><![CDATA[typcn-upload-outline]]></imixs:value>
</imixs:item>
<imixs:item name="txtworkflowsummary" type="xs:string">
<imixs:value><![CDATA[<itemvalue>invoice.number</itemvalue> <itemvalue>dbtr.number</itemvalue> <itemvalue>dbtr.name</itemvalue> (<itemvalue>invoice.currency</itemvalue> <itemvalue>invoice.total</itemvalue>) ]]></imixs:value>

View file

@ -188,7 +188,7 @@ result.isValid=true;
<imixs:value><![CDATA[<itemvalue format="dd. MM.yyyy">$created</itemvalue> - <itemvalue>payment.total</itemvalue> <itemvalue>payment.currency</itemvalue> (<itemvalue>dbtr.number</itemvalue> - <itemvalue>dbtr.name</itemvalue>)]]></imixs:value>
</imixs:item>
<imixs:item name="txteditorid" type="xs:string">
<imixs:value><![CDATA[alexander/form_basic#alexander/sub_opliste]]></imixs:value>
<imixs:value><![CDATA[alexander/form_basic]]></imixs:value>
</imixs:item>
<imixs:item name="txtimageurl" type="xs:string">
<imixs:value><![CDATA[typcn-database||||typcn-arrow-forward]]></imixs:value>
@ -489,6 +489,8 @@ result.isValid=true;
<item name="payment.currency" type="selectOneMenu" required="true" options="EUR;CHF;SEK;RUB;NOK;GBP;USD;CAD" label="Währung:" />
</imixs-form-section>
<imixs-form-section label="Offene Posten" path="alexander/section_opliste" />
</imixs-form>]]></bpmn2:documentation>
<bpmn2:dataState id="DataState_1"/>
</bpmn2:dataObject>