rechnungsworkflow
This commit is contained in:
parent
b5bb9ac635
commit
f8a258a1f7
1 changed files with 46 additions and 3 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
package com.imixs.intern;
|
package ai.dynamixs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.imixs.archive.core.SnapshotService;
|
import org.imixs.archive.core.SnapshotService;
|
||||||
import org.imixs.workflow.ItemCollection;
|
import org.imixs.workflow.ItemCollection;
|
||||||
|
|
@ -10,6 +12,7 @@ import org.imixs.workflow.engine.DocumentService;
|
||||||
import org.imixs.workflow.engine.WorkflowService;
|
import org.imixs.workflow.engine.WorkflowService;
|
||||||
import org.imixs.workflow.exceptions.PluginException;
|
import org.imixs.workflow.exceptions.PluginException;
|
||||||
import org.imixs.workflow.poi.POIFindReplaceAdapter;
|
import org.imixs.workflow.poi.POIFindReplaceAdapter;
|
||||||
|
import org.imixs.workflow.poi.XSSFUtil;
|
||||||
|
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
|
|
@ -34,9 +37,49 @@ public class InvoicePOIAdapter extends POIFindReplaceAdapter {
|
||||||
SnapshotService snapshotService;
|
SnapshotService snapshotService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateXSSFWorkbook(XSSFWorkbook workbook, ItemCollection document, List<String> replaceDevList,
|
public void updateXSSFWorkbook(XSSFWorkbook workbook, ItemCollection workitem, List<String> replaceDevList,
|
||||||
String eval) throws PluginException {
|
String eval) throws PluginException {
|
||||||
super.updateXSSFWorkbook(workbook, document, replaceDevList, eval);
|
XSSFSheet sheet = workbook.getSheetAt(0);
|
||||||
|
// Steuer?
|
||||||
|
int steuer = workitem.getItemValueInteger("invoice.tax.rate");
|
||||||
|
if (steuer > 0) {
|
||||||
|
XSSFUtil.replaceXSSFSheetItemValue(workbook, sheet, "TAX_INFO", "Umsatzsteuer: ");
|
||||||
|
}
|
||||||
|
Double steuerD = (double) steuer / 100;
|
||||||
|
XSSFUtil.replaceXSSFSheetItemValue(workbook, sheet, "TAX_RATE", steuerD);
|
||||||
|
|
||||||
|
// insert invoice pos...
|
||||||
|
|
||||||
|
ItemCollection auftrag = documentService.load(workitem.getItemValueString("$workitemref"));
|
||||||
|
List<ItemCollection> requirements = new ArrayList<ItemCollection>();
|
||||||
|
List<String> refs = workitem.getItemValueList("_requirements", String.class);
|
||||||
|
for (String _id : refs) {
|
||||||
|
requirements.add(documentService.load(_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
int pos = 1;
|
||||||
|
for (ItemCollection _requirement : requirements) {
|
||||||
|
|
||||||
|
int line = pos + 23;
|
||||||
|
|
||||||
|
XSSFUtil.replaceXSSFSheetItemValue(workbook, sheet, "A" + line, pos);
|
||||||
|
XSSFUtil.replaceXSSFSheetItemValue(workbook, sheet, "B" + line,
|
||||||
|
_requirement.getItemValueString("_subject"));
|
||||||
|
|
||||||
|
double rate = auftrag.getItemValueDouble("_rate");
|
||||||
|
double capacity = _requirement.getItemValueDouble("_capacity");
|
||||||
|
|
||||||
|
XSSFUtil.replaceXSSFSheetItemValue(workbook, sheet, "E" + line, rate);
|
||||||
|
XSSFUtil.replaceXSSFSheetItemValue(workbook, sheet, "F" + line, capacity);
|
||||||
|
|
||||||
|
XSSFUtil.evalXSSFSheet(workbook, sheet, "G" + line);
|
||||||
|
|
||||||
|
pos++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
super.updateXSSFWorkbook(workbook, workitem, replaceDevList, eval);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue