diff --git a/bundles/ch.elexis.core.data/src/ch/elexis/core/data/util/BillingUtil.java b/bundles/ch.elexis.core.data/src/ch/elexis/core/data/util/BillingUtil.java index f95b1c3df3..820a59d9a5 100644 --- a/bundles/ch.elexis.core.data/src/ch/elexis/core/data/util/BillingUtil.java +++ b/bundles/ch.elexis.core.data/src/ch/elexis/core/data/util/BillingUtil.java @@ -712,7 +712,6 @@ private void changePriceLeistung(Object item) { acquireLock(locks, verrechnet, false); int tp = leistungDTO.getTp(); int tpOld = verrechnet.getPoints(); - verrechnet.setSecondaryScale((int) (leistungDTO.getScale2() * 100)); if (tpOld != tp) { verrechnet.setPoints(tp); log.debug("invoice correction: price changed to [{}] for leistung id [{}]", @@ -733,7 +732,6 @@ private void changeCountLeistung(Object item) { IStatus ret = BillingServiceHolder.get().changeAmountValidated(verrechnet, leistungDTO.getCount()); log.debug("invoice correction: changed count from leistung id [{}]", leistungDTO.getId()); if (ret.isOK()) { - verrechnet.setSecondaryScale((int) (leistungDTO.getScale2() * 100)); CoreModelServiceHolder.get().save(verrechnet); } else { addToOutput(output, ret.getMessage()); @@ -831,7 +829,6 @@ private void transferLeistungen(Object base, Object item, Object additional) { log.debug("invoice correction: count changed from [{}] to {[]} - for leistung id [{}]", itemLeistung.getId()); if (ret.isOK()) { - verrechnet.setSecondaryScale((int) (itemLeistung.getScale2() * 100)); CoreModelServiceHolder.get().save(verrechnet); } else { verrechnet = null; diff --git a/bundles/ch.elexis.core.data/src/ch/elexis/data/dto/LeistungDTO.java b/bundles/ch.elexis.core.data/src/ch/elexis/data/dto/LeistungDTO.java index f3ff41e0a0..db76df5497 100644 --- a/bundles/ch.elexis.core.data/src/ch/elexis/data/dto/LeistungDTO.java +++ b/bundles/ch.elexis.core.data/src/ch/elexis/data/dto/LeistungDTO.java @@ -20,7 +20,7 @@ public class LeistungDTO { private final String id; private String code; private final String text; - private int count; + private double count; private IBillable iVerrechenbar; private long lastUpdate; private IBilled verrechnet; @@ -28,7 +28,6 @@ public class LeistungDTO { private int tp = 0; private double tpw = 1.0; private double scale1 = 1.0; - private double scale2 = 1.0; public LeistungDTO(Verrechnet verrechnet) throws ElexisException { @@ -54,7 +53,7 @@ public LeistungDTO(Verrechnet verrechnet) throws ElexisException { this.text = verrechnet.getText(); this.tp = this.verrechnet.getPoints(); this.tpw = this.verrechnet.getFactor(); - this.count = verrechnet.getZahl(); + this.count = this.verrechnet.getAmount(); this.iVerrechenbar = this.verrechnet.getBillable(); } @@ -66,7 +65,6 @@ public LeistungDTO(IBillable iVerrechenbar, IFall fall) { this.tp = -1; this.tpw = 1.0; this.scale1 = 1.0; - this.scale2 = 1.0; this.count = 1; this.iVerrechenbar = iVerrechenbar; } @@ -80,7 +78,6 @@ public boolean calcPrice(KonsultationDTO konsultationDTO, FallDTO fallDTO, Consu tp = result.get().getPoints(); tpw = result.get().getFactor(); scale1 = result.get().getPrimaryScaleFactor(); - scale2 = result.get().getSecondaryScaleFactor(); } else { LoggerFactory.getLogger(getClass()).warn("Adding billable failed [" + result.getMessages() + "]"); showResult.accept(result); @@ -89,7 +86,6 @@ public boolean calcPrice(KonsultationDTO konsultationDTO, FallDTO fallDTO, Consu } else { tpw = getFactor(); scale1 = verrechnet.getPrimaryScaleFactor(); - scale2 = verrechnet.getSecondaryScaleFactor(); } return true; } @@ -109,14 +105,6 @@ public void setTp(int tp) { this.tp = tp; } - public void setScale2(double scale2) { - this.scale2 = scale2; - } - - public double getScale2() { - return scale2; - } - public IBilled getVerrechnet() { return verrechnet; } @@ -142,14 +130,14 @@ public String getId() { } public Money getPrice() { - return new Money((int) (Math.round(tp * tpw) * scale1 * scale2 * count)); + return new Money((int) (Math.round(tp * tpw) * scale1 * count)); } - public void setCount(int count) { + public void setCount(double count) { this.count = count; } - public int getCount() { + public double getCount() { return count; } diff --git a/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/rechnung/InvoiceCorrectionView.java b/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/rechnung/InvoiceCorrectionView.java index 53a3235b95..4b1a8801d7 100644 --- a/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/rechnung/InvoiceCorrectionView.java +++ b/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/rechnung/InvoiceCorrectionView.java @@ -1414,11 +1414,9 @@ private boolean changePriceDialog(LeistungDTO leistungDTO) { val = val.substring(0, val.length() - 1); double percent = Double.parseDouble(val); double scaleFactor = 1.0 + (percent / 100.0); - leistungDTO.setScale2(scaleFactor); - customPrice = leistungDTO.getPrice(); + customPrice = leistungDTO.getPrice().multiply(scaleFactor); } else { customPrice = new Money(val); - leistungDTO.setScale2(Double.valueOf(1)); } if (customPrice != null) { leistungDTO.setTp(customPrice.getCents()); @@ -1434,7 +1432,7 @@ private boolean changePriceDialog(LeistungDTO leistungDTO) { } private boolean changeQuantityDialog(LeistungDTO leistungDTO) { - String p = Integer.toString(leistungDTO.getCount()); + String p = Double.toString(leistungDTO.getCount()); InputDialog dlg = new InputDialog(UiDesk.getTopShell(), Messages.VerrechnungsDisplay_changeNumberCaption, // $NON-NLS-1$ Messages.VerrechnungsDisplay_changeNumberBody, // $NON-NLS-1$ p, null); @@ -1442,27 +1440,23 @@ private boolean changeQuantityDialog(LeistungDTO leistungDTO) { try { String val = dlg.getValue(); if (!StringTool.isNothing(val)) { - int changeAnzahl; - double secondaryScaleFactor = 1.0; + double changeAnzahl = 1.0; String text = leistungDTO.getIVerrechenbar().getText(); if (val.indexOf(StringConstants.SLASH) > 0) { - changeAnzahl = 1; String[] frac = val.split(StringConstants.SLASH); - secondaryScaleFactor = Double.parseDouble(frac[0]) / Double.parseDouble(frac[1]); + changeAnzahl = Double.parseDouble(frac[0]) / Double.parseDouble(frac[1]); text = leistungDTO.getIVerrechenbar().getText() + " (" + val //$NON-NLS-1$ + Messages.VerrechnungsDisplay_Orininalpackungen; } else if (val.indexOf('.') > 0) { - changeAnzahl = 1; - secondaryScaleFactor = Double.parseDouble(val); - text = leistungDTO.getIVerrechenbar().getText() + " (" + Double.toString(secondaryScaleFactor) //$NON-NLS-1$ + changeAnzahl = Double.parseDouble(val); + text = leistungDTO.getIVerrechenbar().getText() + " (" + Double.toString(changeAnzahl) //$NON-NLS-1$ + ")"; //$NON-NLS-1$ } else { - changeAnzahl = Integer.parseInt(dlg.getValue()); + changeAnzahl = Double.parseDouble(val); } leistungDTO.setCount(changeAnzahl); - leistungDTO.setScale2(secondaryScaleFactor); return true; } } catch (NumberFormatException ne) { @@ -1479,7 +1473,7 @@ private void releaseAndRefreshLock(IPersistentObject object, String commandId) { if (object != null && LocalLockServiceHolder.get().isLocked(object)) { LocalLockServiceHolder.get().releaseLock(object); } - ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); + ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(commandId, null); }