use of de.clearit.kindergarten.domain.PurchaseBean in project kindergarten by clear-group-ausbildung.
the class PurchaseAppliance method newPurchase.
// Public API *************************************************************
public void newPurchase(String title, final CommitCallback<PurchaseBean> outerCallback) {
final PurchaseBean newPurchase = new PurchaseBean();
final CommitCallback<CommandValue> callback = result -> outerCallback.committed(result == CommandValue.OK ? newPurchase : null);
PurchaseEditorModel model = new PurchaseEditorModel(newPurchase, callback);
openPurchaseEditor(title, model);
}
use of de.clearit.kindergarten.domain.PurchaseBean in project kindergarten by clear-group-ausbildung.
the class PurchaseHomeModel method deleteItem.
@Action(enabled = false)
public void deleteItem(final ActionEvent e) {
final PurchaseBean purchase = getSelection();
final String mainInstruction = RESOURCES.getString("deleteItem.mainInstruction", "Artikel-Nr: " + purchase.getItemNumber());
final TaskPane pane = new TaskPane(MessageType.QUESTION, mainInstruction, CommandValue.YES, CommandValue.NO);
pane.setPreferredWidth(PreferredWidth.MEDIUM);
pane.showDialog(e, RESOURCES.getString("deleteItem.title"));
if (pane.getCommitValue() == CommandValue.YES) {
SERVICE.delete(purchase);
filterPurchases();
}
}
use of de.clearit.kindergarten.domain.PurchaseBean 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