fix ATC Number
This commit is contained in:
parent
d7619a7c21
commit
3ebd619df4
1 changed files with 27 additions and 3 deletions
|
|
@ -135,14 +135,17 @@ public class SteuerbescheidPlugin extends AbstractPlugin {
|
||||||
|
|
||||||
// Beträge subtrahieren....
|
// Beträge subtrahieren....
|
||||||
double saldo = amount;
|
double saldo = amount;
|
||||||
logger.info("Found " + invoices.size() + " matching invoices...");
|
logger.info("Found " + invoices.size() + " matching invoices for ATC-No: " + atcNummer);
|
||||||
for (ItemCollection invoice : invoices) {
|
for (ItemCollection invoice : invoices) {
|
||||||
workitem.setItemValueUnique("$workitemRef", invoice.getUniqueID());
|
workitem.setItemValueUnique("$workitemRef", invoice.getUniqueID());
|
||||||
|
|
||||||
// suche die Zeile in der die ATC Nummer vorkommt.
|
// suche die Zeile in der die ATC Nummer vorkommt.
|
||||||
List<ItemCollection> positionen = InvoiceUtil.explodeChildList(invoice);
|
List<ItemCollection> positionen = InvoiceUtil.explodeChildList(invoice);
|
||||||
for (ItemCollection pos : positionen) {
|
for (ItemCollection pos : positionen) {
|
||||||
if (atcNummer.equals(pos.getItemValueString("atc.number"))) {
|
// if (atcNummer.equals(pos.getItemValueString("atc.number"))) {
|
||||||
|
// Support both variants....
|
||||||
|
String posAtcNummer = pos.getItemValueString("atc.number");
|
||||||
|
if (!posAtcNummer.isEmpty() && atcNummer.startsWith(posAtcNummer)) {
|
||||||
double umsatz = pos.getItemValueDouble("datev.umsatz");
|
double umsatz = pos.getItemValueDouble("datev.umsatz");
|
||||||
logger.info("...Umsatz=" + umsatz);
|
logger.info("...Umsatz=" + umsatz);
|
||||||
saldo = InvoiceUtil.round(saldo - umsatz);
|
saldo = InvoiceUtil.round(saldo - umsatz);
|
||||||
|
|
@ -160,8 +163,29 @@ public class SteuerbescheidPlugin extends AbstractPlugin {
|
||||||
*/
|
*/
|
||||||
protected List<ItemCollection> findInvoices(String atcNumber) {
|
protected List<ItemCollection> findInvoices(String atcNumber) {
|
||||||
List<ItemCollection> result = new ArrayList<ItemCollection>();
|
List<ItemCollection> result = new ArrayList<ItemCollection>();
|
||||||
|
// String query = "(type:workitem OR type:workitemarchive) AND ($taskid:[5000 TO
|
||||||
|
// 5990])"
|
||||||
|
// + " AND invoice.atc.number:\"" + atcNumber + "\" " + " AND
|
||||||
|
// $workflowgroup:\"Rechnungsausgang\" ";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Änderung 2.4.2026 - die ATC Nummer ist nun häufig eine Kombination
|
||||||
|
* z.B: 26DE2452CCA004P4R3/ATC400057440320262452
|
||||||
|
* Relevant ist nur der vordere Teil weil nur der vordere in die Invoice
|
||||||
|
* geschrieben wurde.
|
||||||
|
* Deswegen schneiden wir den vorderen Teil ab und suchen mit OR nach beiden
|
||||||
|
* Schreibweisen
|
||||||
|
*/
|
||||||
|
|
||||||
String query = "(type:workitem OR type:workitemarchive) AND ($taskid:[5000 TO 5990])"
|
String query = "(type:workitem OR type:workitemarchive) AND ($taskid:[5000 TO 5990])"
|
||||||
+ " AND invoice.atc.number:\"" + atcNumber + "\" " + " AND $workflowgroup:\"Rechnungsausgang\" ";
|
+ " AND ($workflowgroup:\"Rechnungsausgang\") ";
|
||||||
|
if (atcNumber.contains("/")) {
|
||||||
|
String atcNumberShort = atcNumber.substring(0, atcNumber.indexOf("/"));
|
||||||
|
query = query + " AND (invoice.atc.number:\"" + atcNumber + "\" OR invoice.atc.number:\"" + atcNumberShort
|
||||||
|
+ "\") ";
|
||||||
|
} else {
|
||||||
|
query = query + " AND (invoice.atc.number:\"" + atcNumber + "\") ";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
result = documentService.find(query, 999, 0, "$created", false);
|
result = documentService.find(query, 999, 0, "$created", false);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue