FHM08062601IBL - alihkan lab result ke fpdf

This commit is contained in:
sas.fajri
2026-06-09 11:27:26 +07:00
parent e3f51591a6
commit de1fb927de

View File

@@ -188,6 +188,16 @@ class Birt_proxy extends MY_Controller
$username = $prm['PUsername'] ?? ($this->sys_user['userName'] ?? 'system');
$tm = round(microtime(true) * 1000);
$internal_url = $this->_build_internal_report_url_by_code($report_code, $order_id);
if ($internal_url !== false) {
if ($order_id > 0) {
$this->_populate_cache($order_id);
}
$this->sys_ok(['url' => $internal_url]);
return;
}
$row = $this->db_onedev->query(
"SELECT Print_TransactionUrl FROM print_transaction WHERE Print_TransactionCode = ? LIMIT 1",
[$report_code]
@@ -400,6 +410,11 @@ class Birt_proxy extends MY_Controller
private function _build_birt_url_by_code($report_code, $order_id, $payment_id, $patient_name)
{
$internal_url = $this->_build_internal_report_url_by_code($report_code, $order_id);
if ($internal_url !== false) {
return $internal_url;
}
$row = $this->db_onedev->query(
"SELECT Print_TransactionUrl
FROM print_transaction
@@ -438,6 +453,28 @@ class Birt_proxy extends MY_Controller
return $url;
}
private function _build_internal_report_url_by_code($report_code, $order_id)
{
$report_routes = [
'LAB-RESULT-P-01' => '/tools/rpt_lab_result/pdf',
];
if (!isset($report_routes[$report_code]) || $order_id <= 0) {
return false;
}
$params = [
'PT_OrderHeaderID' => $order_id,
'username' => $this->_resolve_report_username(),
];
if (!empty($this->sys_input['token'])) {
$params['token'] = $this->sys_input['token'];
}
return $report_routes[$report_code] . '?' . http_build_query($params);
}
private function _apply_report_template_hotfix($report_code, $url_template)
{
$print_report_hotfix = [