use of de.clearit.kindergarten.domain.export.entity.PayoffDataInternalVendor in project kindergarten by clear-group-ausbildung.
the class ExportInternalPayoff method createVendorList.
private void createVendorList(PayoffDataInternal pPayoffDataInternal, Cell pStartCell) {
int rowCountGlobal = pStartCell.getRowIndex();
int labelColumnIndex = pStartCell.getColumnIndex();
int valueColumnIndex = labelColumnIndex + 1;
for (PayoffDataInternalVendor payoffDataInternalVendor : pPayoffDataInternal.getPayoffDataInternalVendor()) {
rowCountGlobal = createPlaceholderRow(rowCountGlobal, labelColumnIndex, "");
XSSFRow nameRow = sheet.createRow(rowCountGlobal);
XSSFCell nameLabelCell = nameRow.createCell(labelColumnIndex);
nameLabelCell.setCellValue("Name");
nameLabelCell.setCellStyle(labelStyle);
XSSFCell nameValueCell = nameRow.createCell(valueColumnIndex);
nameValueCell.setCellValue(payoffDataInternalVendor.getVendor().getLastName());
nameValueCell.setCellStyle(textStyle);
rowCountGlobal++;
XSSFRow firstnameRow = sheet.createRow(rowCountGlobal);
XSSFCell firstnameLabelCell = firstnameRow.createCell(labelColumnIndex);
firstnameLabelCell.setCellValue("Vorname");
firstnameLabelCell.setCellStyle(labelStyle);
XSSFCell firstnameValueCell = firstnameRow.createCell(valueColumnIndex);
firstnameValueCell.setCellValue(payoffDataInternalVendor.getVendor().getFirstName());
firstnameValueCell.setCellStyle(textStyle);
rowCountGlobal++;
XSSFRow vendorNumberRow = sheet.createRow(rowCountGlobal);
XSSFCell vendorNumberLabelCell = vendorNumberRow.createCell(labelColumnIndex);
vendorNumberLabelCell.setCellValue("Nummer(n)");
vendorNumberLabelCell.setCellStyle(labelStyle);
XSSFCell vendorNumberValueCell = vendorNumberRow.createCell(valueColumnIndex);
vendorNumberValueCell.setCellValue(payoffDataInternalVendor.getVendor().getVendorNumbers().stream().map(vendorNumber -> String.valueOf(vendorNumber.getVendorNumber())).collect(Collectors.joining(", ")));
vendorNumberValueCell.setCellStyle(textStyle);
rowCountGlobal++;
XSSFRow paymentRow = sheet.createRow(rowCountGlobal);
XSSFCell paymentLabelCell = paymentRow.createCell(labelColumnIndex);
paymentLabelCell.setCellValue("Auszahlungsbetrag");
paymentLabelCell.setCellStyle(labelStyle);
XSSFCell paymentValueCell = paymentRow.createCell(valueColumnIndex);
paymentValueCell.setCellValue(payoffDataInternalVendor.getVendorPayment());
paymentValueCell.setCellStyle(priceStyle);
rowCountGlobal++;
}
}
use of de.clearit.kindergarten.domain.export.entity.PayoffDataInternalVendor in project kindergarten by clear-group-ausbildung.
the class ExportDataService method getPayoffDataInternal.
/**
* Returns a {@link PayoffDataInternal} for the Internal Payoff.
*
* @return {@link PayoffDataInternal} to create the internal payoff.
*/
public static PayoffDataInternal getPayoffDataInternal() {
PurchaseService purchaseService = PurchaseService.getInstance();
List<PurchaseBean> purchaseAllList = purchaseService.getAll();
Double totalSum = purchaseService.getItemSumByPurchases(purchaseAllList).doubleValue();
Double totalProfit = purchaseService.getKindergartenProfitByPurchases(purchaseAllList).doubleValue();
Double totalPayout = purchaseService.getVendorPayoutByPurchases(purchaseAllList).doubleValue();
Integer totalItemCount = purchaseService.getItemCountByPurchases(purchaseAllList);
ArrayList<PayoffDataInternalVendor> payoffDataInternalVendorList = new ArrayList<>();
List<VendorBean> vendorList = VendorService.getInstance().getAll();
for (VendorBean vendor : vendorList) {
List<PurchaseBean> vendorPurchaseList = new ArrayList<>();
for (VendorNumberBean vendorNumberBean : vendor.getVendorNumbers()) {
int vendorNumber = vendorNumberBean.getVendorNumber();
List<PurchaseBean> purchaseList = purchaseAllList.stream().filter(purchase -> purchase.getVendorNumber().equals(vendorNumber)).collect(Collectors.toList());
vendorPurchaseList.addAll(purchaseList);
}
payoffDataInternalVendorList.add(new PayoffDataInternalVendor(vendor, purchaseService.getVendorPayoutByPurchases(vendorPurchaseList).doubleValue()));
}
return new PayoffDataInternal(totalSum, totalProfit, totalPayout, totalItemCount, payoffDataInternalVendorList);
}
Aggregations