on 11-18-2020 1:32 AM
Hello,
how I can get the receipt information, when looking for a park receipt, the receipt variable appears null (ReceiptEntity receipt = receiptPosService.findOrCreate (UserRegistry.INSTANCE.getCurrentUser (), null, true);).
I use the quick select mode.
the code used is:
try (CDBSession cdbSession = CDBSessionFactory.instance.createSession()) {
ReceiptPosService receiptPosService = ServiceFactory.INSTANCE.getOrCreateServiceInstance(ReceiptPosService.class, cdbSession);
ReceiptEntity receipt = receiptPosService.findOrCreate(UserRegistry.INSTANCE.getCurrentUser(), null, true); CalculationPosService calculationPosService = ServiceFactory.INSTANCE.getOrCreateServiceInstance(CalculationPosService.class, cdbSession); receipt.getSalesItems() .stream() .forEach(salesItem ->
{ salesItem.setUnitGrossAmount(BigDecimal.ONE); salesItem.setUnitPriceChanged(true);
salesItem.setMarkChanged(true); }); calculationPosService.recalculateReceipt(receipt); receiptPosService.updateReceipt(receipt, true); BroadcasterHolder.INSTANCE.getBroadcaster().broadcastPluginEventForPath("RECEIPT_REFRESH", null);
} catch (InconsistentReceiptStateException e)
{ log.severe(e.getLocalizedMessage()); log.fine(ExceptionUtils.getFullStackTrace(e)); }
I would appreciate the help
User | Count |
---|---|
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.