Skip to Content
0
Nov 18, 2020 at 01:32 AM

park receipt - quick select mode.

32 Views

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