Fix org-case invoice scoping

This commit is contained in:
DevSoftTech Server 2026-06-05 13:49:58 +05:30
parent 6e3a355e03
commit e80e18600d
2 changed files with 6 additions and 0 deletions

View File

@ -562,6 +562,7 @@ class CaseMaster extends BaseController
and (
o.insurance_case_id = cast(c.id as char)
or o.insurance_case_id = c.case_id_code
or o.p_id = c.p_id
)
union all
@ -585,6 +586,7 @@ class CaseMaster extends BaseController
and (
i.insurance_case_id = c.id
or i.insurance_case_id = c.case_id_code
or i.attach_id = c.p_id
)
) v
order by v.Charge_type, v.Adate
@ -626,6 +628,7 @@ class CaseMaster extends BaseController
->groupStart()
->where('insurance_case_id', (string) $caseId)
->orWhere('insurance_case_id', (string) ($caseRow->case_id_code ?? ''))
->orWhere('p_id', (int) ($caseRow->p_id ?? 0))
->groupEnd()
->get()
->getRow();
@ -644,6 +647,7 @@ class CaseMaster extends BaseController
->groupStart()
->where('insurance_case_id', $caseId)
->orWhere('insurance_case_id', (string) ($caseRow->case_id_code ?? ''))
->orWhere('attach_id', (int) ($caseRow->p_id ?? 0))
->groupEnd()
->get()
->getRow();

View File

@ -52,6 +52,7 @@ class OrganizationCaseModel extends Model
and (
o.insurance_case_id = cast(c.id as char)
or o.insurance_case_id = c.case_id_code
or o.p_id = c.p_id
)
union all
@ -75,6 +76,7 @@ class OrganizationCaseModel extends Model
and (
i.insurance_case_id = c.id
or i.insurance_case_id = c.case_id_code
or i.attach_id = c.p_id
)
) v
order by v.Charge_type, v.Adate