From 93a6fdf89e5e9dee0d329c151feed883bc571a4b Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 22 Sep 2026 19:35:44 +0530 Subject: [PATCH] Standardize Relation to Food (When) in IPD discharge to match OPD consult format --- app/Views/billing/ipd/discharge_create.php | 150 ++++++++++++++++----- 1 file changed, 113 insertions(+), 37 deletions(-) diff --git a/app/Views/billing/ipd/discharge_create.php b/app/Views/billing/ipd/discharge_create.php index 726ca55..13e7232 100644 --- a/app/Views/billing/ipd/discharge_create.php +++ b/app/Views/billing/ipd/discharge_create.php @@ -1468,7 +1468,7 @@ $historyFields = [ Type Medicine Dose - When + Relation to Food (When) Freq Days Remark @@ -5733,17 +5733,22 @@ $historyFields = [ }; var dischargeWhenDescMap = { - 'BF': 'BF -> Before Food', - 'AF': 'AF -> After Food', - 'WF': 'WF -> With Food', - 'ES': 'ES -> Empty Stomach', - 'BBF': 'BBF -> Before Breakfast', - 'ABF': 'ABF -> After Breakfast', - 'BL': 'BL -> Before Lunch', - 'AL': 'AL -> After Lunch', - 'BD': 'BD -> Before Dinner', - 'AD': 'AD -> After Dinner', - 'BT': 'BT -> Bed Time' + 'BF': 'BF - Before Food', + 'AF': 'AF - After Food', + 'WF': 'WF - With Food', + 'ES': 'EMPTY STOMACH - MORNING EMPTY STOMACH', + 'BB': 'BB - Before Breakfast', + 'AB': 'AB - After Breakfast', + 'BBF': 'BBF - Before Breakfast', + 'ABF': 'ABF - After Breakfast', + 'BL': 'BL - Before Lunch', + 'AL': 'AL - After Lunch', + 'BD': 'BD - Before Dinner', + 'AD': 'AD - After Dinner', + 'BT': 'BT - Bed Time', + 'WT': 'WT - With Tea', + 'BBATH': 'BBATH - Before Bath', + 'EMPTY STOMACH': 'EMPTY STOMACH - MORNING EMPTY STOMACH' }; function renderSelectOptions($select, rows, placeholder, descMap) { @@ -5751,18 +5756,86 @@ $historyFields = [ (rows || []).forEach(function(row) { var id = (row && row.id !== undefined) ? String(row.id) : ''; var label = (row && row.label !== undefined) ? String(row.label) : ''; - if (!id || !label) { + var secLabel = (row && row.secondary_label !== undefined) ? String(row.secondary_label) : ''; + var localLabel = (row && row.local_label !== undefined) ? String(row.local_label) : ''; + if (!label && !id) { return; } + if (!label && id) { + label = id; + } + var val = label; var displayText = label; - if (descMap && descMap[label.toUpperCase()]) { + if (secLabel && secLabel.toLowerCase() !== label.toLowerCase()) { + displayText = label + ' - ' + secLabel; + } else if (descMap && descMap[label.toUpperCase()]) { displayText = descMap[label.toUpperCase()]; } - html += '