Add comprehensive printer configuration support: - New Printers.php config with role-based printer defaults (lab, phlebo, reception) - Update LabelController for configurable printer routing with error handling - Add ResponseTrait for proper JSON responses (success/error status) - Update routes to accept optional printer parameter for label printing - Add default printer configuration per role in shared config Enhance report generation workflow: - Support REPORT_LANG from CM_REQUESTS table for language preference - Prioritize URL parameter, then database value, then default - Add language info to PDF generation response (Indonesian/English) - Update all report methods (view, eng, preview, generate) with unified logic Improve UI and user experience: - Add dialog_results_generate to all role dashboards (superuser, admin, lab, phlebo, cs) - Update skeleton loading states widths in content requests - Add printer selection capability in sample collection flow Add comprehensive UAT documentation: - New UAT_GDC_CMOD_Checklist.md with 150+ test cases - Cover all roles: superuser, admin, lab, phlebo, cs, and cross-role scenarios - Include acceptance criteria (functional, security, performance, usability, data integrity) - Test categories: authentication, user management, validation, sample management, audit trail, reporting - Detailed sign-off structure for stakeholders Add barcode printing documentation: - docs/barcode_print_all.php - all labels printing implementation - docs/barcode_print_coll.php - collection label implementation - docs/barcode_print_disp.php - dispatch label implementation Update TODO tracking: - Mark Reprint Label and PDF Generation as completed - Update pending tasks for testing and audit trails
135 lines
3.7 KiB
PHP
135 lines
3.7 KiB
PHP
<?php
|
|
$reqnum = $_GET['req'];
|
|
$reqnum = str_pad($reqnum, 10, 0, STR_PAD_LEFT);
|
|
$samid = $_GET['sam'];
|
|
$sql = "select p.PATNUMBER,
|
|
[Name] = case
|
|
when p.TITLEID is not null then ISNULL(p.FIRSTNAME,'') + ' ' + ISNULL(p.NAME,'') + ', ' + tx.SHORTTEXT
|
|
else ISNULL(p.FIRSTNAME,'') + ' ' + ISNULL(p.NAME,'')
|
|
end,
|
|
format(p.BIRTHDATE,'dd/MMM/yyyy') as dob,
|
|
age = case
|
|
when year(spr.COLLECTIONDATE) - year(p.BIRTHDATE) > 0 then (
|
|
case
|
|
when format(p.BIRTHDATE,'MMdd')=format(spr.COLLECTIONDATE,'MMdd') then cast(DATEDIFF(YEAR,p.BIRTHDATE, spr.COLLECTIONDATE) as varchar) + 'Y'
|
|
else cast( DATEDIFF(hour,p.BIRTHDATE, spr.COLLECTIONDATE)/8766 as varchar) + 'Y' end
|
|
)
|
|
when month(spr.COLLECTIONDATE) - month(p.BIRTHDATE) > 0 then cast( DATEDIFF(MM,p.BIRTHDATE,spr.COLLECTIONDATE) as varchar) + 'M'
|
|
else cast ( floor ( ( day(spr.COLLECTIONDATE) - day(p.BIRTHDATE) ) / 7) as varchar ) + 'W'
|
|
end,
|
|
[Gender] = case
|
|
when p.SEX = 1 then 'M'
|
|
when p.SEX = 2 then 'F'
|
|
else ''
|
|
end,
|
|
spr.HOSTORDERNUMBER
|
|
from SP_REQUESTS spr
|
|
left join PATIENTS p on spr.PATID=p.PATID
|
|
left join DICT_TEXTS tx on tx.TEXTID=p.TITLEID
|
|
where spr.SP_ACCESSNUMBER='$reqnum'";
|
|
/*
|
|
select p.PATNUMBER, ISNULL(p.FIRSTNAME,'') + ' ' + ISNULL(p.NAME,'') as [Name],
|
|
age = case
|
|
when year(spr.REQDATE) - year(p.BIRTHDATE) > 0 then cast(floor(DATEDIFF(MM,p.BIRTHDATE,spr.REQDATE)/12) as varchar) + 'Y'
|
|
when month(spr.REQDATE) - month(p.BIRTHDATE) > 0 then cast( DATEDIFF(MM,p.BIRTHDATE,spr.REQDATE) as varchar) + 'M'
|
|
else cast ( floor ( ( day(spr.REQDATE) - day(p.BIRTHDATE) ) / 7) as varchar ) + 'W'
|
|
end,
|
|
[Gender] = case
|
|
when p.SEX = 1 then 'M'
|
|
when p.SEX = 2 then 'F'
|
|
else ''
|
|
end,
|
|
spr.HOSTORDERNUMBER
|
|
from SP_REQUESTS spr, PATIENTS p
|
|
where spr.PATID=p.PATID and spr.SP_ACCESSNUMBER='$reqnum'";
|
|
*/
|
|
$stmt = sqlsrv_query( $conn1, $sql );
|
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ;
|
|
$patnum = $row[0];
|
|
$patnum = substr($patnum,14);
|
|
//$patnum = substr($row[0],9);
|
|
$patname = $row[1];
|
|
$age = $row[2];
|
|
$sex = $row[3];
|
|
$hospnum = $row[4];
|
|
|
|
$sql = "select SAMPCODE, SHORTTEXT, TESTS, TESTS1 from v_sp_reqtube where SP_ACCESSNUMBER='$reqnum' and SAMPTYPEID='$samid'";
|
|
$stmt = sqlsrv_query( $conn2, $sql );
|
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
|
$sampcode = $row[0];
|
|
$samptext = $row[1];
|
|
$tests = $row[2];
|
|
$tests1 = $row[3];
|
|
if($tests == '') {$tests = $tests1;}
|
|
$tubeid = $sampcode.substr("$reqnum",5,5);
|
|
$date = date("d/M/Y H:i");
|
|
/*
|
|
$bar = "[
|
|
N
|
|
OD
|
|
q400
|
|
Q224,24+0
|
|
I8,A,001
|
|
D10
|
|
A10,3,0,3,1,1,N,\"$patname \"
|
|
A10,27,0,2,1,1,N,\"$sex $age\"
|
|
B20,50,0,1,2,8,90,N,\"$tubeid\"
|
|
A380,27,5,3,1,1,N,\"$tubeid\"
|
|
A350,27,5,3,1,1,R,\"$samptext\"
|
|
A10,150,0,2,1,1,N,\"$tests\"
|
|
A10,180,0,1,1,1,N,\"LIS : $reqnum\"
|
|
A10,195,0,1,1,1,N,\"HIS : $hospnum\"
|
|
A190,190,0,2,1,1,N,\"$date\"
|
|
P1
|
|
]";
|
|
*/
|
|
|
|
$bar = "[
|
|
N
|
|
OD
|
|
q400
|
|
Q224,24+0
|
|
I8,A,001
|
|
D10
|
|
A10,3,0,3,1,1,N,\"$patname \"
|
|
A10,27,0,2,1,1,N,\"$sex $age\"
|
|
B130,50,0,1,2,8,90,N,\"$tubeid\"
|
|
A380,27,5,3,1,1,N,\"$tubeid\"
|
|
A10,80,0,2,1,2,R,\"$samptext\"
|
|
A10,150,0,2,1,1,N,\"$tests\"
|
|
A10,180,0,1,1,1,N,\"LIS : $reqnum\"
|
|
A10,195,0,1,1,1,N,\"HIS : $hospnum\"
|
|
A190,190,0,2,1,1,N,\"$date\"
|
|
P1
|
|
]";
|
|
|
|
/*
|
|
$bar = "[
|
|
N
|
|
OD
|
|
q400
|
|
Q224,24+0
|
|
I8,A,001
|
|
D10
|
|
A10,3,0,3,1,1,N,\"$patname \"
|
|
A10,27,0,2,1,1,N,\"$sex $age\"
|
|
B100,50,0,1,3,9,90,N,\"$tubeid\"
|
|
A10,150,0,2,1,1,N,\"$tests\"
|
|
A10,180,0,1,1,1,N,\"LIS : $reqnum\"
|
|
A10,195,0,1,1,1,N,\"HIS : $hospnum\"
|
|
A190,190,0,2,1,1,N,\"$date\"
|
|
P1
|
|
]";
|
|
*/
|
|
$handle = fopen("./file.txt","w+");
|
|
fwrite($handle,$bar);
|
|
fclose($handle);
|
|
exec($command);
|
|
?>
|
|
Barcode Printed
|
|
<script>
|
|
window.close();
|
|
</script>
|