fix saldo bei gutschriften

This commit is contained in:
Ralph Soika 2024-07-04 11:35:44 +02:00
parent 841fbeb71e
commit b7199e22da

View file

@ -90,7 +90,7 @@ public class CargosoftMigrationRestService implements Serializable {
int errors = 0; int errors = 0;
int count = 0; int count = 0;
public static String _QUERY = "($modelversion:rechnungsausgang-de-1.0)\n" + public static String _QUERY = "($modelversion:rechnungsausgang-de-1.0)\n" +
"AND $created:[20240604 TO 20240619]"; "AND $created:[20240604 TO 20240701]";
// public static String _QUERY = "($modelversion:rechnungsausgang-dwc-1.0)\n" + // public static String _QUERY = "($modelversion:rechnungsausgang-dwc-1.0)\n" +
// // // //
// "AND $created:[20240604 TO 20240619]"; // "AND $created:[20240604 TO 20240619]";
@ -120,7 +120,7 @@ public class CargosoftMigrationRestService implements Serializable {
@Path("/test") @Path("/test")
@Produces({ MediaType.TEXT_PLAIN }) @Produces({ MediaType.TEXT_PLAIN })
public String testeFehlerhafteCargosoftDaten() throws QueryException { public String testeFehlerhafteCargosoftDaten() throws QueryException {
int falsch = 0;
logger.info("query=" + _QUERY); logger.info("query=" + _QUERY);
log = "Query\n" + _QUERY; log = "Query\n" + _QUERY;
List<ItemCollection> result = documentService.find(_QUERY, 9999, 0); List<ItemCollection> result = documentService.find(_QUERY, 9999, 0);
@ -131,6 +131,24 @@ public class CargosoftMigrationRestService implements Serializable {
log = log + "\n\nACHTUNG ES GIBT MEHR ALS 10000 RECHNUNGEN !"; log = log + "\n\nACHTUNG ES GIBT MEHR ALS 10000 RECHNUNGEN !";
} }
for (ItemCollection workitem : result) {
String type = workitem.getItemValueString("invoice.type");
if ("G".equals(type) || "SR".equals(type)) {
double total = workitem.getItemValueDouble("invoice.saldo");
if (total >= 0) {
logger.info("---Falsch: " + workitem.getUniqueID());
falsch++;
workitem.setItemValue("invoice.saldo", -total);
documentService.save(workitem);
}
}
}
log = log + "\n\n";
log = log + "" + result.size() + " rechnungen geprüft";
log = log + "" + falsch + " davon falsch";
log = log + "\n\n";
return log; return log;
} }