update
This commit is contained in:
parent
7835b685cf
commit
a31540ce02
4 changed files with 73 additions and 24 deletions
|
|
@ -114,21 +114,23 @@ public class OPListController implements Serializable {
|
||||||
} catch (QueryException e) {
|
} catch (QueryException e) {
|
||||||
logger.severe("Failed to get op liste:" + e.getMessage());
|
logger.severe("Failed to get op liste:" + e.getMessage());
|
||||||
}
|
}
|
||||||
// wir selektieren hier alle fälligen Rechnungen vor, falls der Mahnlauf gerade erstellt
|
// wir selektieren hier alle fälligen Rechnungen vor, falls der Mahnlauf gerade
|
||||||
|
// erstellt
|
||||||
// wird.
|
// wird.
|
||||||
if (workflowController.getWorkitem().getItemValueInteger("$version") == 0
|
if (workflowController.getWorkitem().getModelVersion().startsWith("mahnlauf")) {
|
||||||
|| (workflowController.getWorkitem().getItemValueInteger("$version") == 1
|
if (workflowController.getWorkitem().getItemValueInteger("$version") == 0
|
||||||
&& workflowController.getWorkitem().getItemValueInteger("$lastevent") == 100)) {
|
|| (workflowController.getWorkitem().getItemValueInteger("$version") == 1
|
||||||
List<String> intialSelection = new ArrayList<String>();
|
&& workflowController.getWorkitem().getItemValueInteger("$lastevent") == 100)) {
|
||||||
for (ItemCollection invoice : invoiceList) {
|
List<String> intialSelection = new ArrayList<String>();
|
||||||
|
for (ItemCollection invoice : invoiceList) {
|
||||||
|
|
||||||
if ("workitem".equals(invoice.getType()) && invoice.getTaskID()>=5100) {
|
if ("workitem".equals(invoice.getType()) && invoice.getTaskID() >= 5100) {
|
||||||
intialSelection.add(invoice.getUniqueID());
|
intialSelection.add(invoice.getUniqueID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
workflowController.getWorkitem().setItemValue("$workitemref", intialSelection);
|
||||||
}
|
}
|
||||||
workflowController.getWorkitem().setItemValue("$workitemref", intialSelection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// We are no longer in TASK_ERSTELLUNG, so
|
// We are no longer in TASK_ERSTELLUNG, so
|
||||||
// fetch only selected invoices
|
// fetch only selected invoices
|
||||||
|
|
@ -286,14 +288,32 @@ public class OPListController implements Serializable {
|
||||||
*/
|
*/
|
||||||
public double calculateInvoiceSaldo() {
|
public double calculateInvoiceSaldo() {
|
||||||
double result = 0;
|
double result = 0;
|
||||||
for (ItemCollection invoice : invoiceList) {
|
if (invoiceList != null) {
|
||||||
result = result + invoice.getItemValueDouble("invoice.saldo");
|
for (ItemCollection invoice : invoiceList) {
|
||||||
|
result = result + invoice.getItemValueDouble("invoice.saldo");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// rond with 2 digits
|
// rond with 2 digits
|
||||||
return Math.round(result * 100.0) / 100.0;
|
return Math.round(result * 100.0) / 100.0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Berechnet den noch offenen Differenz vom Zahlbetrag
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public double calculatePaymentDifference() {
|
||||||
|
double paymentAmount = workflowController.getWorkitem().getItemValueDouble("payment.amount");
|
||||||
|
double paymentTotal = workflowController.getWorkitem().getItemValueDouble("payment.total");
|
||||||
|
// paymentAmount - calculateInvoiceSaldo();
|
||||||
|
double result = paymentAmount -paymentTotal;
|
||||||
|
|
||||||
|
logger.info("...new PaymentDifference=" + result);
|
||||||
|
// rond with 2 digits
|
||||||
|
return Math.round(result * 100.0) / 100.0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the reminder date is today or in the past
|
* Returns true if the reminder date is today or in the past
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,17 @@
|
||||||
<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>
|
||||||
|
<dt>Restbetrag:</dt>
|
||||||
|
<dd style="color:red;" data-item='payment.difference'>
|
||||||
|
<h:outputText value="#{opListController.calculatePaymentDifference()}">
|
||||||
|
<f:convertNumber minFractionDigits="2" locale="de" />
|
||||||
|
</h:outputText>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
<table style="width: 100%; margin: 5px;">
|
<table style="width: 100%; margin: 5px;">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: left;">#{message['form.invoicenumber']}</th>
|
<th style="text-align: left;">#{message['form.invoicenumber']}</th>
|
||||||
|
|
@ -88,7 +99,7 @@
|
||||||
value="#{invoice.item['payment.amount']}"
|
value="#{invoice.item['payment.amount']}"
|
||||||
style="width:100px;text-align: right;">
|
style="width:100px;text-align: right;">
|
||||||
<f:convertNumber minFractionDigits="2" locale="de" />
|
<f:convertNumber minFractionDigits="2" locale="de" />
|
||||||
<f:ajax event="change" execute="#{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>
|
||||||
|
|
@ -105,7 +116,7 @@
|
||||||
<td><h:selectBooleanCheckbox class="invoice_selector" rendered="#{!readonly}"
|
<td><h:selectBooleanCheckbox class="invoice_selector" rendered="#{!readonly}"
|
||||||
value="#{invoice.item['selected']}"
|
value="#{invoice.item['selected']}"
|
||||||
onclick="initInvoicePayment(this)">
|
onclick="initInvoicePayment(this)">
|
||||||
<f:ajax event="change" execute="#{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>
|
||||||
|
|
@ -154,12 +165,18 @@
|
||||||
/*<![CDATA[*/
|
/*<![CDATA[*/
|
||||||
$(document).ready(
|
$(document).ready(
|
||||||
function() {
|
function() {
|
||||||
// update the checkboxes of the stored invoice uniqueIDs
|
// default payment date
|
||||||
// updateInvoiceSelection();
|
var inputPaymentDate=$("input[data-item='payment.date']");
|
||||||
|
if (inputPaymentDate && inputPaymentDate.val()==='') {
|
||||||
|
const d = new Date();
|
||||||
|
const text = d.getDate()+'.'+(d.getMonth()+1) + '.'+d.getFullYear();// d.toString();
|
||||||
|
inputPaymentDate.val(text);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// set the payment amount to the invoice total if the field is still empty
|
// set the payment amount to the invoice total if the field is still empty
|
||||||
|
// if the paymetn dif is lower than the invoice saldo we take the dif amount
|
||||||
function initInvoicePayment(element) {
|
function initInvoicePayment(element) {
|
||||||
console.log('...initInovicePayment...'+element.checked);
|
console.log('...initInovicePayment...'+element.checked);
|
||||||
|
|
||||||
|
|
@ -168,9 +185,21 @@
|
||||||
var amountValue=$(prevTD).text();
|
var amountValue=$(prevTD).text();
|
||||||
var amountTD=$(currentTD).prev();
|
var amountTD=$(currentTD).prev();
|
||||||
var amountInput=$("input",amountTD);
|
var amountInput=$("input",amountTD);
|
||||||
// wenn wir noch keinen wert dann betrag übernehmen
|
var maxAmount=$("dd[data-item='payment.difference']").text();
|
||||||
|
maxAmount = maxAmount.replace(/\t/g, '');
|
||||||
|
maxAmount = maxAmount.replace('\n', '');
|
||||||
|
|
||||||
|
v1=amountValue.replace(".","");
|
||||||
|
v1=Number(v1.replace(",","."));
|
||||||
|
|
||||||
|
v2=maxAmount.replace(".","");
|
||||||
|
v2=Number(v2.replace(",","."));
|
||||||
|
|
||||||
|
if (v1>v2) {
|
||||||
|
amountValue=maxAmount;
|
||||||
|
}
|
||||||
if (element.checked) {
|
if (element.checked) {
|
||||||
|
// wenn wir noch keinen wert haben, dann betrag übernehmen
|
||||||
if ($(amountInput).val()=='' || $(amountInput).val()=='0,00') {
|
if ($(amountInput).val()=='' || $(amountInput).val()=='0,00') {
|
||||||
$(amountInput).val(amountValue);
|
$(amountInput).val(amountValue);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
</ui:repeat>
|
</ui:repeat>
|
||||||
|
|
||||||
<tr style="border-top: 1px solid #ccc;">
|
<tr style="border-top: 1px solid #ccc;">
|
||||||
<td />
|
<td /><td />
|
||||||
<td /><td />
|
<td /><td />
|
||||||
<td><strong>Summary</strong></td>
|
<td><strong>Summary</strong></td>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ result.isValid=true;
|
||||||
<item name="payment.date" type="date" required="true" label="Datum:" />
|
<item name="payment.date" type="date" required="true" label="Datum:" />
|
||||||
</imixs-form-section>
|
</imixs-form-section>
|
||||||
<imixs-form-section>
|
<imixs-form-section>
|
||||||
<item name="name" type="text" required="true" label="Referenz:" />
|
<item name="name" type="text" required="false" label="Referenz:" />
|
||||||
|
|
||||||
</imixs-form-section>
|
</imixs-form-section>
|
||||||
<imixs-form-section columns="2" >
|
<imixs-form-section columns="2" >
|
||||||
|
|
@ -480,7 +480,7 @@ result.isValid=true;
|
||||||
<bpmn2:documentation id="Documentation_16"><![CDATA[<?xml version="1.0"?>
|
<bpmn2:documentation id="Documentation_16"><![CDATA[<?xml version="1.0"?>
|
||||||
<imixs-form>
|
<imixs-form>
|
||||||
<imixs-form-section columns="2" label="Zahlungsdaten">
|
<imixs-form-section columns="2" label="Zahlungsdaten">
|
||||||
<item name="name" type="text" required="true" label="Referenz:" />
|
<item name="name" type="text" required="false" label="Referenz:" />
|
||||||
<item name="dbtr.number" type="text" required="true" label="Debitor:" />
|
<item name="dbtr.number" type="text" required="true" label="Debitor:" />
|
||||||
<item name="payment.amount" type="currency" required="true" label="Zahlbetrag:" />
|
<item name="payment.amount" type="currency" required="true" label="Zahlbetrag:" />
|
||||||
<item name="payment.currency" type="selectOneMenu" required="true" options="EUR;CHF;SEK;RUB;NOK;GBP;USD;CAD" label="Währung:" />
|
<item name="payment.currency" type="selectOneMenu" required="true" options="EUR;CHF;SEK;RUB;NOK;GBP;USD;CAD" label="Währung:" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue