Polish IPD bill labels and wording

This commit is contained in:
DevSoftTech Server 2026-08-01 16:05:16 +05:30
parent 151ea7a53f
commit 53bc924c06
5 changed files with 18 additions and 4 deletions

View File

@ -101,7 +101,8 @@ function number_to_word($number): string
$no = floor($no / $divider);
$i += ($divider == 10) ? 1 : 2;
if ($number) {
$plural = (($counter = count($str)) && $number > 9) ? 's' : null;
$counter = count($str);
$plural = null;
$hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
$str[] = ($number < 21)
? $words[$number] . ' ' . $digits[$counter] . $plural . ' ' . $hundred

View File

@ -228,7 +228,7 @@ class IpdBillingModel extends Model
{
$builder = $this->db->table('ipd_invoice_item i')
->select('t.group_desc, i.*, sum(i.item_amount) as xAmount')
->select("trim(concat_ws(' ', 'Dr.', d.p_fname, d.p_mname, d.p_lname)) as doctor_display_name", false)
->select("case when trim(concat_ws('', d.p_fname, d.p_mname, d.p_lname)) = '' then '' else trim(concat_ws(' ', 'Dr.', d.p_fname, d.p_mname, d.p_lname)) end as doctor_display_name", false)
->select('ds.spec_names as doctor_specialization', false)
->join('ipd_item_type t', 'i.item_type = t.itype_id', 'left')
->join('doctor_master d', 'd.id = i.doc_id', 'left')
@ -415,7 +415,7 @@ class IpdBillingModel extends Model
$builder = $this->db->table('ipd_invoice_item i')
->select('t.group_desc,i.*')
->select("trim(concat_ws(' ', 'Dr.', d.p_fname, d.p_mname, d.p_lname)) as doctor_display_name", false)
->select("case when trim(concat_ws('', d.p_fname, d.p_mname, d.p_lname)) = '' then '' else trim(concat_ws(' ', 'Dr.', d.p_fname, d.p_mname, d.p_lname)) end as doctor_display_name", false)
->select('ds.spec_names as doctor_specialization', false)
->join('ipd_item_type t', 'i.item_type = t.itype_id', 'left')
->join('doctor_master d', 'd.id = i.doc_id', 'left')

View File

@ -120,6 +120,10 @@ foreach ([1, 2] as $slot) {
$patientAddress = trim((string) (($person->add1 ?? '') . ' ' . ($person->add2 ?? '') . ' ' . ($person->city ?? '') . ' ' . ($person->state ?? '')));
$patientAddress = preg_replace('/\s+/', ' ', $patientAddress ?? '');
$relativeLabel = trim((string) ($person->p_relative ?? ''));
if ($relativeLabel === '') {
$relativeLabel = 'SON OF';
}
$mode3ShowAmountAfterDiscount = $printMode === 3;
$isDischargeFinal = (int) ($ipd->discarge_patient_status ?? 0) > 0;
@ -202,7 +206,7 @@ $cleanNursingMarker = static function (string $text): string {
<tr>
<td>
<div><span class="label">Patient Name :</span> <?= esc((string) ($person->p_fname ?? '')) ?></div>
<div><span class="label">SON OF :</span> <?= esc((string) ($person->p_rname ?? '')) ?></div>
<div><span class="label"><?= esc($relativeLabel) ?> :</span> <?= esc((string) ($person->p_rname ?? '')) ?></div>
<div><span class="label">Patient-ID/UHID :</span> <?= esc((string) ($person->p_code ?? '')) ?></div>
<div><span class="label">Gender :</span> <?= esc((string) ($person->xgender ?? '')) ?></div>
<div><span class="label">Age :</span> <?= esc((string) $age) ?></div>
@ -279,6 +283,9 @@ $cleanNursingMarker = static function (string $text): string {
if ($docLine === '') {
$docLine = trim((string) ($row->doc_name ?? ''));
}
if (strcasecmp($docLine, 'Dr.') === 0) {
$docLine = '';
}
$docSpec = trim((string) ($row->doctor_specialization ?? ''));
if ($docSpec !== '' && $docLine !== '') {
$docLine .= ' [' . $docSpec . ']';

View File

@ -170,6 +170,9 @@ $cleanNursingMarker = static function (string $text): string {
if ($docLine === '') {
$docLine = trim((string) ($row->doc_name ?? ''));
}
if (strcasecmp($docLine, 'Dr.') === 0) {
$docLine = '';
}
$docSpec = trim((string) ($row->doctor_specialization ?? ''));
if ($docSpec !== '' && $docLine !== '') {
$docLine .= ' [' . $docSpec . ']';

View File

@ -112,6 +112,9 @@ $cleanNursingMarker = static function (string $text): string {
if ($docName === '') {
$docName = trim((string) ($row->doc_name ?? ''));
}
if (strcasecmp($docName, 'Dr.') === 0) {
$docName = '';
}
$docSpec = trim((string) ($row->doctor_specialization ?? ''));
$comment = $cleanNursingMarker((string) ($row->comment ?? ''));
$packageChecked = (int) ($row->package_id ?? 0) > 0 ? 'checked' : '';