Commit aaf2521b authored by slogic-sa's avatar slogic-sa Committed by Marco Descher

[17396] Filter Rechnungsliste (beta) - Ausgabedatum (#383)

parent 17d7822e
Pipeline #12494 passed with stages
in 5 minutes and 5 seconds
......@@ -340,6 +340,8 @@ public class Messages extends NLS {
public static String RnFilterDialog_fromDate;
public static String RnFilterDialog_stateDate;
public static String RnFilterDialog_untilDate;
public static String RnFilterDialog_outputDate;
public static String RnFilterDialog_outputDateInfo;
public static String RnOutputDialog_markAsCopy;
public static String RnOutputDialog_outputBillCaption;
public static String RnOutputDialog_outputBillMessage;
......
......@@ -4593,6 +4593,10 @@ RnFilterDialog_stateDate = Statusdatum
RnFilterDialog_untilDate = bis
RnFilterDialog_outputDate = output date
RnFilterDialog_outputDateInfo = heuristic search (slow), use it only in combination with other filters
RnOutputDialog_markAsCopy = Als Kopie markieren
RnOutputDialog_outputBillCaption = Rechnung ausgeben
......
......@@ -4599,6 +4599,10 @@ RnFilterDialog_stateDate = Statusdatum
RnFilterDialog_untilDate = bis
RnFilterDialog_outputDate = Ausgabedatum
RnFilterDialog_outputDateInfo = Heuristische Suche (langsam), bitte nur in Kombination mit weiteren Filtern verwenden
RnOutputDialog_markAsCopy = Als Kopie markieren
RnOutputDialog_outputBillCaption = Rechnung ausgeben
......
......@@ -4525,6 +4525,10 @@ RnFilterDialog_stateDate = status date
RnFilterDialog_untilDate = to
RnFilterDialog_outputDate = output date
RnFilterDialog_outputDateInfo = heuristic search (slow), use it only in combination with other filters
RnOutputDialog_markAsCopy = Mark as a copy
RnOutputDialog_outputBillCaption = Spend the bill
......
......@@ -265,6 +265,8 @@ public class Messages {
public static String RnFilterDialog_fromDate = ch.elexis.core.l10n.Messages.RnFilterDialog_fromDate;
public static String RnFilterDialog_stateDate = ch.elexis.core.l10n.Messages.RnFilterDialog_stateDate;
public static String RnFilterDialog_untilDate = ch.elexis.core.l10n.Messages.RnFilterDialog_untilDate;
public static String RnFilterDialog_outputDate = ch.elexis.core.l10n.Messages.RnFilterDialog_outputDate;
public static String RnFilterDialog_outputDateInfo = ch.elexis.core.l10n.Messages.RnFilterDialog_outputDateInfo;
public static String RnOutputDialog_markAsCopy = ch.elexis.core.l10n.Messages.RnOutputDialog_markAsCopy;
public static String RnOutputDialog_outputBillCaption = ch.elexis.core.l10n.Messages.RnOutputDialog_outputBillCaption;
public static String RnOutputDialog_outputBillMessage = ch.elexis.core.l10n.Messages.RnOutputDialog_outputBillMessage;
......
......@@ -22,6 +22,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import ch.elexis.core.ui.icons.Images;
import ch.elexis.core.ui.util.DateInput;
import ch.elexis.core.ui.util.MoneyInput;
import ch.elexis.core.ui.util.SWTHelper;
......@@ -34,12 +35,14 @@ public class RnFilterDialog extends TitleAreaDialog {
static final String UNTIL = Messages.RnFilterDialog_untilDate; //$NON-NLS-1$
String[] ret;
MoneyInput miVon, miBis;
DateInput diRnVon, diRnBis, diStatVon, diStatBis;
DateInput diRnVon, diRnBis, diStatVon, diStatBis, diOutVon, diOutBis;
private TimeTool invoiceDateFrom;
private TimeTool invoiceDateTo;
private TimeTool invoiceStateDateFrom;
private TimeTool invoiceStateDateTo;
private TimeTool invoiceOutputDateFrom;
private TimeTool invoiceOutputDateTo;
private boolean includeMoneySelector;
......@@ -63,18 +66,31 @@ public class RnFilterDialog extends TitleAreaDialog {
protected Control createDialogArea(final Composite parent){
Composite ret = new Composite(parent, SWT.NONE);
ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
ret.setLayout(new GridLayout(3, false));
ret.setLayout(new GridLayout(4, false));
if (includeMoneySelector) {
new Label(ret, SWT.NONE).setText(Messages.RnFilterDialog_amount); //$NON-NLS-1$
miVon = new MoneyInput(ret, FROM);
miBis = new MoneyInput(ret, UNTIL);
}
new Label(ret, SWT.NONE).setText(Messages.RnFilterDialog_billDate); //$NON-NLS-1$
Label lblBillDate = new Label(ret, SWT.NONE);
lblBillDate.setText(Messages.RnFilterDialog_billDate); //$NON-NLS-1$
lblBillDate.setLayoutData(SWTHelper.getFillGridData(2, false, 1, true));
diRnVon = new DateInput(ret, FROM);
diRnBis = new DateInput(ret, UNTIL);
new Label(ret, SWT.NONE).setText(Messages.RnFilterDialog_stateDate); //$NON-NLS-1$
Label lblStateDate = new Label(ret, SWT.NONE);
lblStateDate.setText(Messages.RnFilterDialog_stateDate); //$NON-NLS-1$
lblStateDate.setLayoutData(SWTHelper.getFillGridData(2, false, 1, true));
diStatVon = new DateInput(ret, FROM);
diStatBis = new DateInput(ret, UNTIL);
Label lblOutputDate = new Label(ret, SWT.NONE);
lblOutputDate.setText(Messages.RnFilterDialog_outputDate); //$NON-NLS-1$
Label lblOutputDateInfo = new Label(ret, SWT.NONE);
lblOutputDateInfo.setImage(Images.IMG_ACHTUNG.getImage());
lblOutputDateInfo.setToolTipText(Messages.RnFilterDialog_outputDateInfo);
diOutVon = new DateInput(ret, FROM);
diOutBis = new DateInput(ret, UNTIL);
return ret;
}
......@@ -102,6 +118,14 @@ public class RnFilterDialog extends TitleAreaDialog {
return invoiceStateDateTo;
}
public TimeTool getInvoiceOutputDateFrom(){
return invoiceOutputDateFrom;
}
public TimeTool getInvoiceOutputDateTo(){
return invoiceOutputDateTo;
}
@Override
protected void okPressed(){
ArrayList<String> al = new ArrayList<String>();
......@@ -142,6 +166,9 @@ public class RnFilterDialog extends TitleAreaDialog {
al.add("StatusDatum <=" + PersistentObject.getConnection() //$NON-NLS-1$
.wrapFlavored(invoiceStateDateTo.toString(TimeTool.DATE_COMPACT)));
}
invoiceOutputDateFrom = diOutVon.getDate();
invoiceOutputDateTo = diOutBis.getDate();
if (al.size() > 0) {
ret = al.toArray(new String[0]);
} else {
......
......@@ -15,6 +15,7 @@ import java.util.concurrent.Executors;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
......@@ -57,6 +58,8 @@ public class InvoiceListContentProvider implements IStructuredContentProvider {
private TimeTool invoiceDateTo;
private TimeTool invoiceStateDateFrom;
private TimeTool invoiceStateDateTo;
private TimeTool invoiceOutputDateFrom;
private TimeTool invoiceOutputDateTo;
public InvoiceListContentProvider(TableViewer tableViewerInvoiceList,
InvoiceListHeaderComposite invoiceListHeaderComposite,
......@@ -112,12 +115,16 @@ public class InvoiceListContentProvider implements IStructuredContentProvider {
invoiceDateTo = rfd.getInvoiceDateTo();
invoiceStateDateFrom = rfd.getInvoiceStateDateFrom();
invoiceStateDateTo = rfd.getInvoiceStateDateTo();
invoiceOutputDateFrom = rfd.getInvoiceOutputDateFrom();
invoiceOutputDateTo = rfd.getInvoiceOutputDateTo();
}
} else {
invoiceDateFrom = null;
invoiceDateTo = null;
invoiceStateDateFrom = null;
invoiceDateTo = null;
invoiceOutputDateFrom = null;
invoiceOutputDateTo = null;
}
reload();
};
......@@ -223,8 +230,43 @@ public class InvoiceListContentProvider implements IStructuredContentProvider {
new Money(owingAmounts).getAmountAsString());
}
applyPostFilter();
structuredViewer.setInput(currentContent);
}
private void applyPostFilter(){
// apply filter for ExtInfo - can be slow 500 invoices processed in 5 minutes
if (invoiceOutputDateFrom != null) {
int dateFrom =
NumberUtils.toInt(invoiceOutputDateFrom.toString(TimeTool.DATE_COMPACT));
int dateTo = invoiceOutputDateTo != null
? NumberUtils.toInt(invoiceOutputDateTo.toString(TimeTool.DATE_COMPACT))
: 0;
if (dateFrom > 0) {
currentContent = currentContent.parallelStream().filter(i -> {
Rechnung r = Rechnung.getFromNr(i.getInvoiceNumber());
if (r != null) {
List<String> outputs = r.getTrace(Rechnung.OUTPUT);
// check for the first occurrence of date which matches with invoiceOutputDateFrom_To
for (String output : outputs) {
if (output != null) {
// convert GER to ISO date
String[] datePart = output.split(",|\\.", 4);
if (datePart.length > 2) {
int date = NumberUtils
.toInt(datePart[2] + datePart[1] + datePart[0]);
if (date >= dateFrom && (dateTo == 0 || date <= dateTo)) {
return true;
}
}
}
}
}
return false;
}).collect(Collectors.toList());
}
}
}
};
public void reload(){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment