diff --git a/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/Messages.java b/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/Messages.java index 408d211950..5d3dd00531 100644 --- a/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/Messages.java +++ b/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/Messages.java @@ -1831,6 +1831,7 @@ public class Messages extends NLS { public static String FallDetailBlatt2_BillingMethod; public static String FallDetailBlatt2_CantChangeBillingSystemBody; public static String FallDetailBlatt2_ChangeBillingSystemNotAllowedBody; + public static String FallDetailBlatt2_Change_Invoice_System; public static String FallDetailBlatt2_CopyToPatient; public static String FallDetailBlatt2_DaysOrAfter; public static String FallDetailBlatt2_DaysOrAfterNeg; diff --git a/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/messages.properties b/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/messages.properties index 105298c249..03615e0062 100644 --- a/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/messages.properties +++ b/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/messages.properties @@ -3671,6 +3671,8 @@ FallDetailBlatt2_CantChangeBillingSystemBody = you don't have sufficient rights FallDetailBlatt2_ChangeBillingSystemNotAllowedBody = This billing system must not be used +FallDetailBlatt2_Change_Invoice_System = Do you really want to transfer coverage billing system from {0} to {1}? + FallDetailBlatt2_CopyToPatient = copy to patient FallDetailBlatt2_DaysOrAfter = \ days or after diff --git a/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/messages_de.properties b/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/messages_de.properties index 2c18effb5d..5d6b27075b 100644 --- a/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/messages_de.properties +++ b/bundles/ch.elexis.core.l10n/src/ch/elexis/core/l10n/messages_de.properties @@ -3655,6 +3655,8 @@ FallDetailBlatt2_CantChangeBillingSystemBody = Sie haben keine ausreichenden Rec FallDetailBlatt2_ChangeBillingSystemNotAllowedBody = Dieses Abrechnungssystem darf nicht verwendet werden +FallDetailBlatt2_Change_Invoice_System = Wollen Sie den Fall inkl. Konsultationen wirklich von Abrechnungssystem {0} zu {1} transferieren? + FallDetailBlatt2_CopyToPatient = Kopie an Patienten FallDetailBlatt2_DaysOrAfter = \ Tagen bzw. ab dem diff --git a/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/FallDetailBlatt2.java b/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/FallDetailBlatt2.java index 450f50a9ab..577114b0eb 100644 --- a/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/FallDetailBlatt2.java +++ b/bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/views/FallDetailBlatt2.java @@ -64,23 +64,29 @@ import ch.elexis.core.ac.EvACE; import ch.elexis.core.ac.Right; +import ch.elexis.core.common.ElexisEventTopics; import ch.elexis.core.constants.Preferences; import ch.elexis.core.constants.StringConstants; import ch.elexis.core.data.events.ElexisEventDispatcher; import ch.elexis.core.data.interfaces.IFall; import ch.elexis.core.data.service.LocalLockServiceHolder; +import ch.elexis.core.data.util.NoPoUtil; import ch.elexis.core.l10n.Messages; import ch.elexis.core.model.FallConstants; import ch.elexis.core.model.ICoverage; +import ch.elexis.core.model.IEncounter; import ch.elexis.core.model.OrganizationConstants; import ch.elexis.core.model.ch.BillingLaw; import ch.elexis.core.services.holder.AccessControlServiceHolder; import ch.elexis.core.services.holder.BillingSystemServiceHolder; import ch.elexis.core.services.holder.ConfigServiceHolder; +import ch.elexis.core.services.holder.ContextServiceHolder; +import ch.elexis.core.services.holder.CoreModelServiceHolder; import ch.elexis.core.ui.UiDesk; import ch.elexis.core.ui.dialogs.KontaktSelektor; import ch.elexis.core.ui.locks.IUnlockable; import ch.elexis.core.ui.preferences.UserCasePreferences; +import ch.elexis.core.ui.services.EncounterServiceHolder; import ch.elexis.core.ui.text.ITextPlugin.ICallback; import ch.elexis.core.ui.text.TextContainer; import ch.elexis.core.ui.util.DayDateCombo; @@ -88,11 +94,13 @@ import ch.elexis.data.BillingSystem; import ch.elexis.data.Fall; import ch.elexis.data.Fall.Tiers; +import ch.elexis.data.Konsultation; import ch.elexis.data.Kontakt; import ch.elexis.data.PersistentObject; import ch.elexis.data.Query; import ch.elexis.data.Rechnung; import ch.elexis.data.dto.FallDTO; +import ch.rgw.tools.Result; import ch.rgw.tools.StringTool; import ch.rgw.tools.TimeTool; @@ -259,9 +267,23 @@ public void widgetSelected(final SelectionEvent e) { if (fall != null) { if (fall.getBehandlungen(false).length > 0) { if (AccessControlServiceHolder.get().evaluate(EvACE.of(ICoverage.class, Right.UPDATE))) { - if (SWTHelper.askYesNo(Messages.FallDetailBlatt2_DontChangeBillingSystemCaption, // $NON-NLS-1$ - Messages.FallDetailBlatt2_DontChangeBillingSystemBody)) { // $NON-NLS-1$ + if (SWTHelper.askYesNo(Messages.Invoice_System, // $NON-NLS-1$ + MessageFormat.format(Messages.FallDetailBlatt2_Change_Invoice_System, + new Object[] { fall.getAbrechnungsSystem(), + cAbrechnung.getItem(i) }))) { // $NON-NLS-1$ fall.setAbrechnungsSystem(cAbrechnung.getItem(i)); + for (Konsultation behandlung : fall.getBehandlungen(false)) { + IEncounter encounter = NoPoUtil.loadAsIdentifiable(behandlung, IEncounter.class) + .get(); + // make sure to work with updated data + CoreModelServiceHolder.get().refresh(encounter.getCoverage(), true); + Result result = EncounterServiceHolder.get().reBillEncounter( + NoPoUtil.loadAsIdentifiable(behandlung, IEncounter.class).get()); + if (!result.isOK()) { + SWTHelper.alert(behandlung.getLabel(), result.toString()); + } + ContextServiceHolder.get().postEvent(ElexisEventTopics.EVENT_UPDATE, encounter); + } setFall(fall); return; }