This commit is contained in:
Ralph Soika 2024-10-31 12:30:11 +01:00
parent f9bee7a6a8
commit e8219ca579
5 changed files with 5525 additions and 203 deletions

View file

@ -11,6 +11,8 @@
- Lucene Index: item 'cdtr.name' und 'document.company' wurde in den index aufgenommen wegen AI Examples Adapter - Lucene Index: item 'cdtr.name' und 'document.company' wurde in den index aufgenommen wegen AI Examples Adapter
- Fix Fälligkeit in maske - Fix Fälligkeit in maske
- Fix XML Schnittstelle Cargosoft Sammelgutschrift - Fix XML Schnittstelle Cargosoft Sammelgutschrift
- Zahlungseingang kann nun korrigiert werden. => modell update 'zahlungseingang-de-1.0.5' und 'rechnungsausgang-de-1.0.13'
- fix Zahlungseingangs Formular
**Migration** **Migration**

View file

@ -35,7 +35,7 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
ZahlungseingangService zahlungseingangService; ZahlungseingangService zahlungseingangService;
/** /**
* This method finds the outgoing invoicdes and updates the saldo * This method finds the outgoing invoices and updates the saldo
* (payment.total). * (payment.total).
* *
* @throws PluginException * @throws PluginException
@ -50,20 +50,20 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
} }
/** /**
* Diese method hängt eine referenz der aktuellen Rechnung an den Zahlungsavis * Diese methode aktuallisiert alle referenzen der aktuellen Rechnungen
* *
* @param document * @param workitem
* @throws PluginException * @throws PluginException
*/ */
private void updateSaldo(ItemCollection document) throws PluginException { private void updateSaldo(ItemCollection workitem) throws PluginException {
// payment currency // payment currency
String paymentCurrency = document.getItemValueString("payment.currency"); String paymentCurrency = workitem.getItemValueString("payment.currency");
double masterPaymentAmount = document.getItemValueDouble("payment.amount"); double masterPaymentAmount = workitem.getItemValueDouble("payment.amount");
double masterPaymentDifference = document.getItemValueDouble("payment.difference"); double masterPaymentDifference = workitem.getItemValueDouble("payment.difference");
String paymentWarning = document.getItemValueString("payment.warning"); String paymentWarning = workitem.getItemValueString("payment.warning");
List<ItemCollection> paymentDetails = zahlungseingangService.loadPaymentDetails(document); List<ItemCollection> paymentDetails = zahlungseingangService.loadPaymentDetails(workitem);
if (paymentDetails.size() == 0) { if (paymentDetails.size() == 0) {
throw new PluginException(PluginException.class.getName(), throw new PluginException(PluginException.class.getName(),
@ -84,7 +84,7 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
// falls mehr einzelsummen eingeben wurden als der oben angegeben Total Pamyment // falls mehr einzelsummen eingeben wurden als der oben angegeben Total Pamyment
// dann soll eine Warnung ausgegen werden. // dann soll eine Warnung ausgegen werden.
if (InvoiceUtil.round(masterPaymentAmount + masterPaymentDifference) != InvoiceUtil.round(einzelPayments)) { if (InvoiceUtil.round(masterPaymentAmount + masterPaymentDifference) != InvoiceUtil.round(einzelPayments)) {
document.setItemValue("payment.warning", "invalid saldo"); workitem.setItemValue("payment.warning", "invalid saldo");
throw new PluginException(PluginException.class.getName(), throw new PluginException(PluginException.class.getName(),
ZahlungseingangService.ERROR_PAYMENT_BOOKING_FAILED, ZahlungseingangService.ERROR_PAYMENT_BOOKING_FAILED,
"Der Zahlungseingang ist nicht identisch mit den ausgebuchten Rechnungssalden. Sollte die Eingabe korrekt sein, wiederholen Sie die Aktion."); "Der Zahlungseingang ist nicht identisch mit den ausgebuchten Rechnungssalden. Sollte die Eingabe korrekt sein, wiederholen Sie die Aktion.");
@ -123,7 +123,8 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
} }
// vergeiche Restsaldo mit payment für diese Rechnung // vergeiche Restsaldo mit payment für diese Rechnung
if (Math.abs(InvoiceUtil.round(invoicePaymentAmount)) > Math.abs(InvoiceUtil.round(invoiceSaldo))) { if (!isPaymentBooked(workitem) && Math.abs(InvoiceUtil.round(invoicePaymentAmount)) > Math
.abs(InvoiceUtil.round(invoiceSaldo))) {
throw new PluginException(PluginException.class.getName(), throw new PluginException(PluginException.class.getName(),
ZahlungseingangService.ERROR_PAYMENT_BOOKING_FAILED, ZahlungseingangService.ERROR_PAYMENT_BOOKING_FAILED,
"Der Zahlungseingang kann nicht verbucht werden, da der Restsaldo der Rechnung " "Der Zahlungseingang kann nicht verbucht werden, da der Restsaldo der Rechnung "
@ -131,8 +132,14 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
} }
// jetzt den Rechnungsbetrag verkleinern // jetzt den Rechnungsbetrag verkleinern
// Falls die Rechnung bereits 5900 (Bezahlt) ist wird der Saldo korrigiert und
// wieder aufgerechnet
if (isPaymentBooked(workitem)) {
// STORNO
invoiceSaldo = invoiceSaldo + invoicePaymentAmount;
} else {
invoiceSaldo = invoiceSaldo - invoicePaymentAmount; invoiceSaldo = invoiceSaldo - invoicePaymentAmount;
}
invoiceSaldo = (float) InvoiceUtil.round(invoiceSaldo); invoiceSaldo = (float) InvoiceUtil.round(invoiceSaldo);
invoice.setItemValue("invoice.saldo", invoiceSaldo); invoice.setItemValue("invoice.saldo", invoiceSaldo);
invoice.event(ZahlungseingangService.EVENT_UPDATE_INVOICE); invoice.event(ZahlungseingangService.EVENT_UPDATE_INVOICE);
@ -147,4 +154,14 @@ public class ZahlungseingangSaldoAdapter implements SignalAdapter {
} }
/**
* Returns true wenn der Zahlungseingang bereits gebucht ist
*
* @param workitem
* @return
*/
public boolean isPaymentBooked(ItemCollection workitem) {
return (workitem.getTaskID() == 1900);
}
} }

View file

@ -1,19 +1,14 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml" <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:i="http://java.sun.com/jsf/composite/imixs"
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"> xmlns:marty="http://java.sun.com/jsf/composite/marty">
<!-- Shows the op liste fo rthe current dbtr.number --> <!-- Shows the op liste fo rthe current dbtr.number -->
<h:commandScript name="calculateOpSummary" <h:commandScript name="calculateOpSummary" execute="invoiceRefHolder_ID" render="opcalculater_id" />
execute="invoiceRefHolder_ID" render="opcalculater_id" />
<h:panelGroup layout="block" styleClass="imixs-form-section" <h:panelGroup layout="block" styleClass="imixs-form-section" id="oplist-table" binding="#{opListContainer}">
id="oplist-table" binding="#{opListContainer}">
<dl> <dl>
@ -37,19 +32,21 @@
<th style="width: 40px;"></th> <th style="width: 40px;"></th>
<th style="width: 70px; text-align: right;">Kurs</th> <th style="width: 70px; text-align: right;">Kurs</th>
<th style="width: 100px; text-align: right;">Basisumsatz</th><th /> <th style="width: 100px; text-align: right;">Basisumsatz</th>
<th />
<th style="width: 100px;">Saldo</th><th /> <th style="width: 100px;">Saldo</th>
<th />
<th style="width: 100px;">Saldo in EUR</th> <th style="width: 100px;">Saldo in EUR</th>
<th style=""></th> <th style=""></th>
<th style="width: 150px;">Zahlbetrag</th> <th style="width: 150px;">Zahlbetrag</th>
<th style=""></th> <th style=""></th>
</tr> </tr>
<ui:param name="invoices" <ui:param name="invoices" value="#{opListController.getInvoices(workitem.item['dbtr.number'])}"></ui:param>
value="#{opListController.getInvoices(workitem.item['dbtr.number'])}"></ui:param>
<ui:repeat value="#{invoices}" var="invoice"> <ui:repeat value="#{invoices}" var="invoice">
<tr> <tr>
<td><h:link outcome="/pages/workitems/workitem"> <td>
<h:link outcome="/pages/workitems/workitem">
#{invoice.item['invoice.number']} #{invoice.item['invoice.number']}
<f:param name="id" value="#{invoice.item['$uniqueid']}" /> <f:param name="id" value="#{invoice.item['$uniqueid']}" />
</h:link> </h:link>
@ -57,33 +54,42 @@
</td> </td>
<td><h:outputText value="#{invoice.item['invoice.date']}"> <td>
<f:convertDateTime pattern="#{message.datePatternShort}" <h:outputText value="#{invoice.item['invoice.date']}">
timeZone="#{message.timeZone}" /> <f:convertDateTime pattern="#{message.datePatternShort}" timeZone="#{message.timeZone}" />
</h:outputText></td> </h:outputText>
<td><h:outputText value="#{invoice.item['invoice.duedate']}"> </td>
<f:convertDateTime pattern="#{message.datePatternShort}" <td>
timeZone="#{message.timeZone}" /> <h:outputText value="#{invoice.item['invoice.duedate']}">
</h:outputText></td> <f:convertDateTime pattern="#{message.datePatternShort}" timeZone="#{message.timeZone}" />
</h:outputText>
</td>
<td><h:outputText value="#{invoice.item['$workflowstatus']}" /></td> <td>
<h:outputText value="#{invoice.item['$workflowstatus']}" />
</td>
<!-- Rechnngsbetrag --> <!-- Rechnngsbetrag -->
<td style="text-align: right;"><h:outputText <td style="text-align: right;">
value="#{invoice.item['invoice.total']}"> <h:outputText value="#{invoice.item['invoice.total']}">
<f:convertNumber minFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText></td> </h:outputText>
</td>
<td><h:outputText value="#{invoice.item['invoice.currency']}" /></td> <td>
<h:outputText value="#{invoice.item['invoice.currency']}" />
</td>
<td style="text-align:right;"><h:outputText value="#{invoice.item['invoice.rate']}" /></td> <td style="text-align:right;">
<h:outputText value="#{invoice.item['invoice.rate']}" />
</td>
<td style="text-align: right;"><h:outputText <td style="text-align: right;">
value="#{invoice.item['invoice.base.amount']}" > <h:outputText value="#{invoice.item['invoice.base.amount']}">
<f:convertNumber minFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText> </h:outputText>
</td> </td>
@ -95,33 +101,38 @@
<!-- Saldo / offene Betrag --> <!-- Saldo / offene Betrag -->
<td style="text-align: right; color: red;"><h:outputText <td style="text-align: right; color: red;">
value="#{invoice.item['invoice.saldo']}"> <h:outputText value="#{invoice.item['invoice.saldo']}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" maxFractionDigits="2" locale="de" />
</h:outputText></td> </h:outputText>
</td>
<td style="color: red;"><h:outputText value="#{invoice.item['invoice.currency']}" /></td> <td style="color: red;">
<h:outputText value="#{invoice.item['invoice.currency']}" />
</td>
<!-- Saldo by rate / offene Betrag in Hauswährung --> <!-- Saldo by rate / offene Betrag in Hauswährung -->
<td style="text-align: right; color: red;"><h:outputText <td style="text-align: right; color: red;">
value="#{invoice.item['invoice.saldo.byrate']}"> <h:outputText value="#{invoice.item['invoice.saldo.byrate']}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" maxFractionDigits="2" locale="de" />
</h:outputText></td> </h:outputText>
</td>
<td style="color: red;"><h:outputText rendered="#{!empty invoice.item['invoice.saldo.byrate']}" value="EUR" /></td> <td style="color: red;">
<h:outputText rendered="#{!empty invoice.item['invoice.saldo.byrate']}" value="EUR" />
</td>
<!-- Teilbetrag --> <!-- Teilbetrag -->
<td style="text-align: right;"><h:inputText id="payment_per_invoice" rendered="#{!readonly}" <td style="text-align: right;">
value="#{invoice.item['payment.amount']}" <h:inputText id="payment_per_invoice" rendered="#{!readonly}"
style="width:100px;text-align: right;"> value="#{invoice.item['payment.amount']}" style="width:100px;text-align: right;">
<f:convertNumber minFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" locale="de" />
<f:ajax event="change" execute="#{formComponents.clientId} #{opListContainer.clientId}" <f:ajax event="change" execute="#{formComponents.clientId} #{opListContainer.clientId}"
listener="#{opListController.updateChildList(workitem)}" listener="#{opListController.updateChildList(workitem)}"
render="#{opListContainer.clientId}"></f:ajax> render="#{opListContainer.clientId}"></f:ajax>
</h:inputText> </h:inputText>
<h:outputText rendered="#{readonly}" <h:outputText rendered="#{readonly}" value="#{invoice.item['payment.amount']}"
value="#{invoice.item['payment.amount']}"
style="width:100px; "> style="width:100px; ">
<f:convertNumber minFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText> </h:outputText>
@ -130,13 +141,14 @@
<!-- CheckBox --> <!-- CheckBox -->
<td><h:selectBooleanCheckbox class="invoice_selector" rendered="#{!readonly}" <td>
value="#{invoice.item['selected']}" <h:selectBooleanCheckbox class="invoice_selector" rendered="#{!readonly}"
onclick="initInvoicePayment(this)"> value="#{invoice.item['selected']}" onclick="initInvoicePayment(this)">
<f:ajax event="change" execute="#{formComponents.clientId} #{opListContainer.clientId}" <f:ajax event="change" execute="#{formComponents.clientId} #{opListContainer.clientId}"
listener="#{opListController.updateChildList(workitem)}" listener="#{opListController.updateChildList(workitem)}"
render="#{opListContainer.clientId}"></f:ajax> render="#{opListContainer.clientId}"></f:ajax>
</h:selectBooleanCheckbox></td> </h:selectBooleanCheckbox>
</td>
</tr> </tr>
@ -144,12 +156,13 @@
<tr style="border-top: 1px solid #ccc;"> <tr style="border-top: 1px solid #ccc;">
<td /> <td />
<td /><td /> <td />
<td />
<td style="text-align: left;"><strong>Summary</strong></td> <td style="text-align: left;"><strong>Summary</strong></td>
<!-- Invoice total --> <!-- Invoice total -->
<td style="text-align: right;"><strong> <h:panelGroup <td style="text-align: right;"><strong>
id="invoice_total"> <h:panelGroup id="invoice_total">
<h:outputText value="#{opListController.calculateInvoiceTotal('EUR')}"> <h:outputText value="#{opListController.calculateInvoiceTotal('EUR')}">
<f:convertNumber minFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText> </h:outputText>
@ -166,13 +179,17 @@
<td><strong>EUR<br />USD</strong></td> <td><strong>EUR<br />USD</strong></td>
<td /><td /><td /> <td />
<td /> <td />
<td /><td /> <td />
<td />
<td />
<td />
<td />
<td />
<!-- Payment total --> <!-- Payment total -->
<td style="text-align: right;"><strong> <h:panelGroup <td style="text-align: right;"><strong>
id="payment_saldo"> <h:panelGroup id="payment_saldo">
<h:outputText value="#{workitem.item['payment.currency']} " /> <h:outputText value="#{workitem.item['payment.currency']} " />
<h:outputText value="#{workitem.item['payment.total']}"> <h:outputText value="#{workitem.item['payment.total']}">
<f:convertNumber minFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" locale="de" />
@ -195,8 +212,7 @@
</table> </table>
<!-- dieses feld speichert die selection der rechnungen --> <!-- dieses feld speichert die selection der rechnungen -->
<h:inputTextarea id="invoiceRefHolder_ID" <h:inputTextarea id="invoiceRefHolder_ID" converter="org.imixs.VectorConverter" class="invoice_selection_list"
converter="org.imixs.VectorConverter" class="invoice_selection_list"
style="display:none;" value="#{workitem.itemList['$workitemref']}" /> style="display:none;" value="#{workitem.itemList['$workitemref']}" />
@ -204,14 +220,23 @@
<script type="text/javascript"> <script type="text/javascript">
/*<![CDATA[*/ /*<![CDATA[*/
$(document).ready( $(document).ready(
function() { function () {
// default payment date // default payment date
var inputPaymentDate=$("input[data-item='payment.date']"); var inputPaymentDate = $("input[data-item='payment.date']");
if (inputPaymentDate && inputPaymentDate.val()==='') { if (inputPaymentDate && inputPaymentDate.val() === '') {
const d = new Date(); const d = new Date();
const text = d.getDate()+'.'+(d.getMonth()+1) + '.'+d.getFullYear();// d.toString(); const text = d.getDate() + '.' + (d.getMonth() + 1) + '.' + d.getFullYear();// d.toString();
inputPaymentDate.val(text); inputPaymentDate.val(text);
} }
//add a onChange handler for data-item payment.amount to update default
var inputPaymentAmount = $("input[data-item='payment.amount']");
$(inputPaymentAmount).change(
function () {
var maxAmount = $("dd[data-item='payment.difference']");
maxAmount.text($(this).val());
}
);
}); });
@ -219,39 +244,39 @@
// if the paymetn dif is lower than the invoice saldo we take the dif amount // if the paymetn dif is lower than the invoice saldo we take the dif amount
// if the currecny is not EUR and not equal go home! // if the currecny is not EUR and not equal go home!
function initInvoicePayment(element) { function initInvoicePayment(element) {
console.log('...initInovicePayment...'+element.checked); // console.log('...initInvoicePayment...' + element.checked);
var currentTD=$(element).closest('td'); var currentTD = $(element).closest('td');
var prevTD=$(currentTD).prev().prev().prev().prev().prev(); var prevTD = $(currentTD).prev().prev().prev().prev().prev();
var amountValue=$(prevTD).text(); var amountValue = $(prevTD).text();
var invoiceCurrency=$(currentTD).prev().prev().prev().prev().text(); var invoiceCurrency = $(currentTD).prev().prev().prev().prev().text();
var amountTD=$(currentTD).prev(); var amountTD = $(currentTD).prev();
var amountInput=$("input",amountTD); var amountInput = $("input", amountTD);
var paymentCurrencyFeld=$("select[data-item='payment.currency']"); var paymentCurrencyFeld = $("select[data-item='payment.currency']");
var paymentCurrency=$(paymentCurrencyFeld).children("option:selected").val(); var paymentCurrency = $(paymentCurrencyFeld).children("option:selected").val();
var saldoMaxByRate=$(amountTD).prev().prev().text(); var saldoMaxByRate = $(amountTD).prev().prev().text();
var maxAmount=$("dd[data-item='payment.difference']").text(); var maxAmount = $("dd[data-item='payment.difference']").text();
maxAmount = maxAmount.replace(/\t/g, ''); maxAmount = maxAmount.replace(/\t/g, '');
maxAmount = maxAmount.replace('\n', ''); maxAmount = maxAmount.replace('\n', '');
v1=amountValue.replace(".",""); v1 = amountValue.replace(".", "");
v1=Number(v1.replace(",",".")); v1 = Number(v1.replace(",", "."));
v2=maxAmount.replace(".",""); v2 = maxAmount.replace(".", "");
v2=Number(v2.replace(",",".")); v2 = Number(v2.replace(",", "."));
if (v1>v2) { if (v1 > v2) {
amountValue=maxAmount; amountValue = maxAmount;
} }
if (element.checked) { if (element.checked) {
// wenn wir noch keinen wert haben, dann betrag übernehmen // wenn wir noch keinen wert haben, dann betrag übernehmen
if ($(amountInput).val()=='' || $(amountInput).val()=='0,00') { if ($(amountInput).val() == '' || $(amountInput).val() == '0,00') {
// wenn wir einen saldo.max.byrate haben // wenn wir einen saldo.max.byrate haben
if (paymentCurrency==='EUR' && saldoMaxByRate>'') { if (paymentCurrency === 'EUR' && saldoMaxByRate > '') {
amountValue=saldoMaxByRate; amountValue = saldoMaxByRate;
} else { } else {
amountValue=amountValue; amountValue = amountValue;
} }
$(amountInput).val(amountValue); $(amountInput).val(amountValue);
} }
@ -266,14 +291,14 @@
selection = $('.invoice_selection_list').val(); selection = $('.invoice_selection_list').val();
const selectionArr = selection.split("\n"); const selectionArr = selection.split("\n");
for (const invoiceID of selectionArr) { for (const invoiceID of selectionArr) {
if (invoiceID && invoiceID!="") { if (invoiceID && invoiceID != "") {
$("#"+invoiceID).prop('checked', true);//=true; $("#" + invoiceID).prop('checked', true);//=true;
} }
} }
// on change handler.... // on change handler....
$('input[type="checkbox"].selection_checkbox').change( $('input[type="checkbox"].selection_checkbox').change(
function() { function () {
var id = $(this).attr('id'); var id = $(this).attr('id');
var check = $(this).prop('checked'); var check = $(this).prop('checked');
//console.log("Change: " + id + " to " + check); //console.log("Change: " + id + " to " + check);
@ -318,4 +343,3 @@
</ui:composition> </ui:composition>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff