diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index cc8cbfb..ea41e2b 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -19,6 +19,7 @@ $routes->patch('/setPassword', 'AuthController::setPassword');
$routes->get('label/coll/(:any)', 'LabelController::coll/$1');
$routes->get('label/dispatch/(:any)/(:any)', 'LabelController::dispatch/$1/$2');
$routes->get('label/all/(:any)', 'LabelController::print_all/$1');
+$routes->get('print/(:num)', 'Home::printReport/$1', ['filter' => 'role:0,1,2,3,4']);
// --- API Group ---
@@ -90,3 +91,20 @@ $routes->group('cs', ['filter' => 'role:4'], function ($routes) {
});
$routes->get('/dummypage', 'Home::dummyPage');
+
+// Report generation - Lab, Admin, Superuser
+$routes->group('report', ['filter' => 'role:0,1,2'], function ($routes) {
+ $routes->get('(:num)', 'ReportController::generate/$1');
+ $routes->get('(:num)/preview', 'ReportController::preview/$1');
+ $routes->get('(:num)/eng', 'ReportController::generate/$1/1');
+ $routes->get('(:num)/preview/eng', 'ReportController::preview/$1/1');
+});
+
+// Print access for CS role only
+$routes->group('report/print', ['filter' => 'role:4'], function ($routes) {
+ $routes->get('(:num)', 'ReportController::print/$1');
+ $routes->get('(:num)/eng', 'ReportController::print/$1/1');
+});
+
+// Keep backward compatibility - updated filter
+$routes->get('print/(:num)', 'ReportController::generate/$1', ['filter' => 'role:0,1,2,3,4']);
diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php
index 6e249ef..404f89f 100644
--- a/app/Controllers/Home.php
+++ b/app/Controllers/Home.php
@@ -26,4 +26,16 @@ class Home extends BaseController {
public function dummyPage() {
return view('dummy_page');
}
+
+ public function printReport($accessnumber) {
+ $userroleid = session()->get('userroleid');
+
+ if (in_array($userroleid, [0, 1, 2])) {
+ return redirect()->to("/report/{$accessnumber}");
+ } elseif ($userroleid == 4) {
+ return redirect()->to("/report/print/{$accessnumber}");
+ }
+
+ return $this->response->setStatusCode(403)->setJSON(['message' => 'Unauthorized']);
+ }
}
diff --git a/app/Controllers/ReportController.php b/app/Controllers/ReportController.php
new file mode 100644
index 0000000..8800077
--- /dev/null
+++ b/app/Controllers/ReportController.php
@@ -0,0 +1,57 @@
+db = \Config\Database::connect();
+ $this->reportHelper = new \App\Libraries\ReportHelper($this->db);
+ helper(['url', 'text']);
+ }
+
+ public function generate($accessnumber, $eng = 0, $preview = 0)
+ {
+ $userroleid = session()->get('userroleid');
+ if (!in_array($userroleid, [0, 1, 2, 4])) {
+ return $this->response->setStatusCode(403)->setJSON(['message' => 'Unauthorized']);
+ }
+
+ $data = $this->reportHelper->getReportData($accessnumber, $eng);
+ $data['preview'] = $preview;
+ $data['eng'] = $eng;
+ $data['accessnumber'] = $accessnumber;
+
+ if ($preview == 0) {
+ $this->logPrintAudit($accessnumber, $data['status']);
+ }
+
+ return view('report/template', $data);
+ }
+
+ public function preview($accessnumber, $eng = 0)
+ {
+ return $this->generate($accessnumber, $eng, 1);
+ }
+
+ public function print($accessnumber, $eng = 0)
+ {
+ $userroleid = session()->get('userroleid');
+ if ($userroleid != 4) {
+ return $this->response->setStatusCode(403)->setJSON(['message' => 'Unauthorized']);
+ }
+ return $this->generate($accessnumber, $eng, 0);
+ }
+
+ private function logPrintAudit($accessnumber, $status)
+ {
+ $sql = "INSERT INTO GDC_CMOD.dbo.AUDIT_REQUESTS(ACCESSNUMBER, STEPDATE, STEPTYPE, STEPSTATUS)
+ VALUES(?, GETDATE(), 'PRINT', ?)";
+ $this->db->query($sql, [$accessnumber, $status]);
+ }
+}
diff --git a/app/Libraries/ReportHelper.php b/app/Libraries/ReportHelper.php
new file mode 100644
index 0000000..d548d37
--- /dev/null
+++ b/app/Libraries/ReportHelper.php
@@ -0,0 +1,759 @@
+db = $db;
+ }
+
+ public function getReportData(string $accessnumber, int $eng): array
+ {
+ $hostnumber = $this->getHost($accessnumber);
+ $result = $this->getResult($accessnumber, $eng);
+ $info = $this->getData2($accessnumber);
+ $notes = $this->getNotes($accessnumber);
+ $others = $this->getOthers($accessnumber, $eng);
+ $collData = $this->getCollData($accessnumber);
+ $recvData = $this->getRecvData($accessnumber);
+ $noSample = $this->getNoSample($accessnumber);
+
+ $collData = $this->cutData($collData);
+ $recvData = $this->cutData($recvData);
+
+ if ($noSample == '') {
+ $status = $this->getStatus($accessnumber);
+ } else {
+ $status = "PENDING";
+ }
+
+ $valBy = $this->getValBy($accessnumber);
+
+ return [
+ 'hostnumber' => $hostnumber,
+ 'result' => $result,
+ 'info' => $info,
+ 'notes' => $notes,
+ 'others' => $others,
+ 'collData' => $collData,
+ 'recvData' => $recvData,
+ 'noSample' => $noSample,
+ 'status' => $status,
+ 'valBy' => $valBy,
+ 'date' => date('d-m-Y H:i')
+ ];
+ }
+
+ private function cutData(string $text): string
+ {
+ if (strlen($text) > 95) {
+ $split_text = explode(" ", $text);
+ $cut_length = 11;
+ $split_text_cut1 = array_slice($split_text, 0, $cut_length);
+ $split_text_cut2 = array_slice($split_text, $cut_length, count($split_text));
+ $text1 = implode(" ", $split_text_cut1);
+ $text2 = implode(" ", $split_text_cut2);
+ $text = $text1 . "\r\n" . $text2;
+ }
+ return $text;
+ }
+
+ private function getHost(string $accessnumber): string
+ {
+ $sql = "SELECT EXTERNALORDERNUMBER FROM REQUESTS WHERE ACCESSNUMBER=?";
+ $row = $this->db->query($sql, [$accessnumber])->getRowArray();
+ return $row['EXTERNALORDERNUMBER'] ?? '';
+ }
+
+ private function getData2(string $accessnumber): string
+ {
+ $sql = "SELECT R.EXTERNALORDERNUMBER, FORMAT(SR.COLLECTIONDATE,'dd-MM-yyyy'), P.NAME, RIGHT(P.PATNUMBER,16),
+ dmg.DMG_CADDRESS, P.TELEPHON, P.EMAIL,
+ CASE
+ WHEN P.SEX=1 THEN 'Male'
+ WHEN P.SEX=2 THEN 'Female'
+ ELSE 'Unknown'
+ END,
+ CASE WHEN FORMAT(P.BIRTHDATE,'MMdd')=FORMAT(R.COLLECTIONDATE,'MMdd')
+ THEN DATEDIFF(YEAR,P.BIRTHDATE, R.COLLECTIONDATE)
+ ELSE FLOOR(DATEDIFF(DAY, P.BIRTHDATE, R.COLLECTIONDATE) / 365.25)
+ END,
+ CASE WHEN DATEPART(day,R.COLLECTIONDATE) >= DATEPART(day,P.BIRTHDATE)
+ THEN DATEDIFF(MONTH,P.BIRTHDATE, R.COLLECTIONDATE)%12
+ ELSE DATEDIFF(MONTH, P.BIRTHDATE, DATEADD(MONTH,-1,R.COLLECTIONDATE))%12
+ END,
+ RO.COMMENTTEXT, dmg.DMG_CCITY, P.BIRTHDATE, T.SHORTTEXT
+ FROM REQUESTS R
+ LEFT JOIN SP_REQUESTS SR ON SR.SP_ACCESSNUMBER=R.ACCESSNUMBER
+ LEFT JOIN PATIENTS P ON P.PATID=R.PATID
+ LEFT JOIN REQUESTS_OCOM RO ON RO.REQUESTID=R.REQUESTID
+ LEFT JOIN DICT_TEXTS T ON P.TITLEID=T.TEXTID
+ LEFT JOIN GDC_CMOD.dbo.TDL_DEMOGRAPHIC dmg ON RIGHT(P.PATNUMBER,16)=dmg.DMG_CPATNUMBER COLLATE Latin1_general_CS_AS
+ WHERE R.ACCESSNUMBER=?";
+
+ $row = $this->db->query($sql, [$accessnumber])->getRowArray();
+
+ $regno = $row['EXTERNALORDERNUMBER'] ?? '';
+ $reqdate = isset($row[1]) ? $row[1] : '';
+ $pname = $row['NAME'] ?? '';
+ $pnum = $row[2] ?? '';
+ $paddress = $row['DMG_CADDRESS'] ?? '';
+ $pphone = $row['TELEPHON'] ?? '';
+ $pemail = $row['EMAIL'] ?? '';
+ $psex = $row[3] ?? '';
+ $pAge = $row[4] ?? '';
+ $pAgeM = $row[5] ?? '';
+ $rcomment = $row['COMMENTTEXT'] ?? '';
+ $pcity = $row['DMG_CCITY'] ?? '';
+ $pdob = '';
+ if (isset($row['BIRTHDATE']) && $row['BIRTHDATE'] != null) {
+ $pdob = date_format($row['BIRTHDATE'], 'd-m-Y');
+ }
+ $title = $row['SHORTTEXT'] ?? '';
+ if ($title != '') {
+ $pname = "$pname, $title";
+ }
+
+ $sql = "SELECT ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME FROM GDC_CMOD.dbo.TDL_ORDER WHERE ODR_CNOLAB=?";
+ $row2 = $this->db->query($sql, [$regno])->getRowArray();
+
+ $sendto = $row2['ODR_CRESULT_TO'] ?? '';
+ $loc = $row2['ODR_CREFERENCENAME'] ?? '';
+ $doc = $row2['ODR_CREFERENCEDOCNAME'] ?? '';
+
+ if ($loc == 'PT. BANGUN GUNUNG SARI (BGS)') {
+ $loc = "PT. BANGUN GUNUNG SARI (BGS";
+ } elseif ($loc == 'PT. PUTRA DUTA PEMBANGUNAN') {
+ $loc = "PT. PUTRA DUTA PEMBANGUNAN";
+ } elseif ($loc == 'PT. BENSA ADHI CIPTA') {
+ $loc = "-";
+ } elseif ($loc == 'PT. LIM SIANG HUAT BALINDO') {
+ $loc = "-";
+ } elseif ($loc == '') {
+ $loc = 'WALK IN';
+ }
+ if ($doc == '') {
+ $doc = $loc;
+ }
+
+ $data = "
+
";
+$pdf .= "
+
+

";
+if($preview==1) { $raw.= "
preview only do not print
" ; }
+$raw .= "
+$info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+";
+$pdf .= "
+$info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+";
+// lastpage show note
+if($i != $npage) {
+ $raw.="
";
+ $pdf.="
";
+} else {
+ $raw .= "$noSample
+
";
+ $pdf .= "$noSample
+
";
+}
+$raw .= "
";
+$raw .= "
+";
+
+if($pdf==1) { $raw .="

"; }
+$raw .= "
";
+$i+=1;
+}
+$raw .="";
+
+echo $raw;
+
+if($pdf == 1) {
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w");
+ fwrite($file, $raw);
+ fclose($file);
+}
+
+if(isset($_GET['print'])) {
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status\r\n$lang");
+ fclose($file);
+}
+
+?>
\ No newline at end of file
diff --git a/public/spooler_db/debug.php b/public/spooler_db/debug.php
new file mode 100644
index 0000000..4762811
--- /dev/null
+++ b/public/spooler_db/debug.php
@@ -0,0 +1,103 @@
+
+
";
+if($pdf==0) { $raw.= "
"; }
+else {
+ $raw .= "
+
";
+}
+$raw .= "
+";
+
+$HOSTNUMBER = getHost($conn, $ACCESSNUMBER);
+$result = getResultDebug($conn, $ACCESSNUMBER,$eng);
+$info = getData2($conn,$ACCESSNUMBER);
+$notes = getNotes($conn, $ACCESSNUMBER);
+$collData = getCollData($conn, $ACCESSNUMBER);
+$recvData = getRecvData($conn, $ACCESSNUMBER);
+$noSample = getNoSample($conn,$ACCESSNUMBER);
+if( $noSample == '' ) {
+ $status = getStatus($conn, $ACCESSNUMBER);
+} else {
+ $status = "PENDING";
+}
+$valBy = getValBy($conn, $ACCESSNUMBER);
+$date = date('d-m-Y H:i');
+
+$npage = count($result);
+$i=1;
+
+foreach($result as $page) {
+$raw .= "
+
";
+if($preview==1) { $raw.= "
preview only do not print
" ; }
+if($pdf==1) { $raw .= "

"; }
+$raw .= "
+$info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+";
+// lastpage show note
+if($i != $npage) {
+ $raw.="
";
+} else {
+ $raw .= "$noSample
+
";
+}
+$raw .= "
";
+$raw .= "
+";
+//echo "";
+if($pdf==1) { $raw .="

"; }
+$raw .= "
";
+$i+=1;
+}
+$raw .="";
+
+echo $raw;
+?>
diff --git a/public/spooler_db/function.php.bak b/public/spooler_db/function.php.bak
new file mode 100644
index 0000000..3483195
--- /dev/null
+++ b/public/spooler_db/function.php.bak
@@ -0,0 +1,241 @@
+
+function getResultDebug($conn, $ACCESSNUMBER, $eng) {
+include("_inc.php");
+$sql = "SELECT DC.FULLTEXT, DT.TESTCODE, T.VALIDATIONSTATUS,
+RESULT = CASE
+ WHEN T.RESTYPE=0 THEN 'Pending'
+ WHEN T.RESTYPE=4 AND T.RESVALUE='' AND T.RESSTATUS=1 THEN '.' -- null -> .
+ WHEN T.RESTYPE IN (7,15,4) THEN T.RESVALUE
+ WHEN T.RESTYPE=9 THEN +'< '+T.RESVALUE
+ WHEN T.RESTYPE=10 THEN +'> '+T.RESVALUE
+ WHEN T.RESVALUE IS NULL THEN
+ CASE
+ WHEN T.CODEDRESULTID IS NULL AND DT.TESTTYPE IN (4,5) THEN null
+ WHEN T.CODEDRESULTID IS NULL THEN TC.COMMENTTEXT
+ WHEN T.CODEDRESULTID IS NOT NULL AND T.RESTYPE=6 AND SUBSTRING(DX.FULLTEXT,1,3) NOT LIKE '%#%' THEN DX.FULLTEXT
+ END
+ ELSE T.RESVALUE
+END,
+T.MINIMUM, T.MAXIMUM,
+DT.FULLTEXT,
+DT.RESPRECISION,DT.RESPRECISION2, DT.OPERAND, DT.SOFTCONVERSION, DT.UNITS, DT.UNITS2, T.RESTYPE, VI.FULLTEXT,
+case
+ when TC.COMMENTTEXT is null then DX2.FULLTEXT
+ else TC.COMMENTTEXT
+end, T.RERUN
+FROM TESTS T
+JOIN DICT_TESTS DT ON DT.TESTID=T.TESTID
+LEFT JOIN DICT_TEXTS DX ON DX.TEXTID=T.CODEDRESULTID
+LEFT JOIN TESTS_COMMENTS TC ON TC.REQTESTID=T.REQTESTID
+LEFT JOIN DICT_TEXTS DX2 ON DX2.TEXTID=TC.COMMENTCODEDID
+LEFT JOIN REQUESTS R ON R.REQUESTID=T.REQUESTID
+LEFT JOIN DICT_CHAPTERS DC ON DC.CHAPID=T.CHAPID
+LEFT JOIN GDC_CMOD.dbo.V_INTER2 VI ON VI.ATR_ACCESSNUMBER=R.ACCESSNUMBER AND DT.TESTCODE=VI.ATR_TESTCODE
+WHERE R.ACCESSNUMBER='$ACCESSNUMBER' AND T.NOTPRINTABLE IS NULL AND DT.TESTCODE<>'STATS'
+ORDER BY T.TESTORDER";
+$stmt = sqlsrv_query( $conn, $sql );
+if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
+$CHAP = "";
+$i = 0;
+$page = 1;
+$line = 0;
+$lpp = 34; // line per page
+$done[1]= "";
+$nline = 0;
+$RERUN=1;
+while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC)) {
+ $CHAPTER = $row[0];
+ $TESTCODE = $row[1];
+ $VALIDATIONSTATUS = $row[2];
+ $R1 = $row[3];
+ if($R1=='****') {$R1='-';}
+ $L1 = $row[4];
+ $H1 = $row[5];
+ $FULLTEXT = $row[6];
+ $PRECISION1 = $row[7];
+ $PRECISION2 = $row[8];
+ $OPERAND = $row[9];// 3* 4/
+ $SOFTCONVERSION =$row[10];
+ $U1 = $row[11];
+ $U2 = $row[12];
+ $RESTYPE = $row[13];
+ $I = $row[14];
+ $RESCOM = $row[15];
+
+ // Get ITEXT or ETEXT
+ if($eng==1) {
+ $ICHAPTER = substr($CHAPTER, strpos($CHAPTER,'#E')+2, strrpos($CHAPTER,'#E')-strpos($CHAPTER,'#E')-2 );
+ if($ICHAPTER != $CHAP) {
+ $raw[$i] = "
$ICHAPTER |
\r\n";
+ $nline += 1;
+ }
+ $CHAP = $ICHAPTER;
+ $ITEXT = substr($FULLTEXT, strpos($FULLTEXT,'#E')+2, strrpos($FULLTEXT,'#E')-strpos($FULLTEXT,'#E')-2 );
+ } else {
+ $ICHAPTER = substr($CHAPTER,2, strrpos($CHAPTER,'#I')-2 );
+ if($ICHAPTER != $CHAP) {
+ $raw[$i] = "
$ICHAPTER |
\r\n";
+ $nline += 1;
+ }
+ $CHAP = $ICHAPTER;
+ $ITEXT = substr($FULLTEXT,2, strrpos($FULLTEXT,'#I')-2 );
+ }
+ // GRP | ELE
+ if($TESTCODE=='PCRN') { $raw[$i] .= "
|
$ITEXT |
"; $done[$page] .= $raw[$i]; }
+ elseif(!is_numeric($RESTYPE)) {
+ // ch
+ if( array_key_exists( $TESTCODE, $_chinese) ) { $ITEXT = rtrim($ITEXT)."
".$_chinese[$TESTCODE].''; }
+ if($ITEXT!='') {
+ $ITEXT = "
$ITEXT |
\r\n";
+ $nline += 1;
+ $raw[$i] .= $ITEXT;
+ }
+
+ $RERUN = $row[16];
+ } else {
+ //flagging
+ if( substr($R1,0,2)=='< ' && is_numeric(substr($R1,2,strlen($R1))) ) { $r1 = substr($R1,2,strlen($R1)); $r1-=1;}
+ elseif( substr($R1,0,2)=='> ' && is_numeric(substr($R1,2,strlen($R1))) ) { $r1 = substr($R1,2,strlen($R1)); $r1+=1;}
+ else {$r1 = $R1;}
+ if($r1 < $L1 && is_numeric($r1) && is_numeric($L1)) {$F = "*L";}
+ elseif($r1 > $H1 && is_numeric($r1) && is_numeric($H1)) {$F = "*H";}
+ else {$F="";}
+ //echo "$R1
";
+
+ //get R2 L2 H2
+ if($RESTYPE == 0) { $R2=""; $L1=""; $H1=""; $L2=""; $H2=""; }
+ else {
+ if( in_array($RESTYPE,[7,15,4]) && $OPERAND == 3 ) {
+ if(is_numeric($R1)) { $R2 = NUMBER_FORMAT($R1 * $SOFTCONVERSION, $PRECISION2,'.',''); }
+ else {$R2 = 0;}
+ if($L1 != 0) { $L2 = NUMBER_FORMAT($L1 * $SOFTCONVERSION, $PRECISION2); }
+ else {$L2 = 0;}
+ if($H1 != 0) { $H2 = NUMBER_FORMAT($H1 * $SOFTCONVERSION, $PRECISION2); }
+ else {$H2 = 0;}
+ } elseif( in_array($RESTYPE,[7,15,4]) && $OPERAND == 4 ) {
+ IF(is_numeric($R1)) { $R2 = NUMBER_FORMAT($R1 / $SOFTCONVERSION, $PRECISION2); }
+ ELSE {$R2 = 0;}
+ IF($L1 != 0) { $L2 = NUMBER_FORMAT($L1 / $SOFTCONVERSION, $PRECISION2); }
+ ELSE {$L2 = 0;}
+ IF($H1 != 0) { $H2 = NUMBER_FORMAT($H1 / $SOFTCONVERSION, $PRECISION2); }
+ ELSE {$H2 = 0;}
+ } else { $R2=$R1; $L2=$L1; $H2=$H1; }
+ }
+ //precision1
+ if(is_numeric($R1) && is_numeric($PRECISION1)) { $R1 = NUMBER_FORMAT($R1,$PRECISION1,'.',''); }
+
+ // split in half - multi line
+ // text | result
+ $TEXT = explode("\r\n",$ITEXT);
+ $test = array();
+ $res = array();
+ foreach($TEXT as $text) {
+ $test[]= substr($text,0,33);
+ $res[]= substr($text,33,strlen($text));
+ }
+ $space = ( strlen($test[0])-strlen(ltrim($test[0])) ) * 7;
+ $test = rtrim(implode("\r\n",$test));
+ $res = implode("\r\n",$res);
+ // italic
+ if( in_array( $TESTCODE, $_italic) ) { $test ="
$test"; }
+ // ch
+ if( array_key_exists( $TESTCODE, $_chinese) ) { $test.="
".$_chinese[$TESTCODE].''; }
+ //line count
+ $tline = count( explode(PHP_EOL, $test) );
+ $rline = count( explode(PHP_EOL, $res) );
+ $r1line = count( explode(PHP_EOL, $R1) );
+ if($rline < $r1line) { $rline = $r1line; }
+
+ if ($test == ' Note') {
+ $ITEXT = "
$test |
$res |
\r\n";
+ } elseif ( strlen($RESCOM) < 2 ) {
+ $ITEXT = "
| $test | $res |
\r\n";
+ } else {
+ $rline += count( explode(PHP_EOL, $RESCOM) );
+ $res = rtrim($res);
+ $ITEXT = "
| $test | $res \r\n$RESCOM |
\r\n ";
+ }
+ if($tline > $rline) { $nline += $tline; } else { $nline += $rline; }
+
+ /*
+ ## replace {R1 {L1 {H1 {R2 {L2 {H2 {I ##
+ GET STRING POS
+ DELETE ALL STRING
+ {R1,{R2,{I,{L1,{H1,{L2,{H2 // ORDER
+ GET NEW STRING LENGTH
+ */
+ // Get all string pos
+ $posR1 = strpos($ITEXT, "{R1");
+ $posR12 = strrpos($ITEXT, "{R1");
+ $posR2 = strpos($ITEXT, "{R2");
+ $posR22 = strrpos($ITEXT, "{R2");
+ $posI1 = strpos($ITEXT, "{I");
+ $posI2 = strrpos($ITEXT, "{I");
+ $posL1 = strpos($ITEXT, "{L1");
+ $posH1 = strpos($ITEXT, "{H1");
+ $posL2 = strpos($ITEXT, "{L2");
+ $posH2 = strpos($ITEXT, "{H2");
+ $posU1 = strpos($ITEXT, "{U1");
+ $posU2 = strpos($ITEXT, "{U2");
+ #echo "
$ITEXT
\r\n";
+ // Delete all string
+ $ITEXT = str_replace( "{R1", " ", $ITEXT );
+ $ITEXT = str_replace( "{R2", " ", $ITEXT );
+ $ITEXT = str_replace( "{I", " ", $ITEXT );
+ $ITEXT = str_replace( "{L1", " ", $ITEXT );
+ $ITEXT = str_replace( "{H1", " ", $ITEXT );
+ $ITEXT = str_replace( "{L2", " ", $ITEXT );
+ $ITEXT = str_replace( "{H2", " ", $ITEXT );
+ $ITEXT = str_replace( "{U1", " ", $ITEXT );
+ $ITEXT = str_replace( "{U2", " ", $ITEXT );
+ // REPLACE
+ if(in_array($RESTYPE, [4,6,7,9,10,15])) {
+ $ITEXT = f_repl($ITEXT,$R1.' '.$F,$posR1);
+ if($posR1 != $posR12) { $ITEXT = f_repl($ITEXT,$R1.' '.$F,$posR12); }
+ $ITEXT = f_repl($ITEXT,$L1,$posL1);
+ $ITEXT = f_repl($ITEXT,$H1,$posH1);
+ if(isset($R2)) {
+ $ITEXT = f_repl($ITEXT,$R2.' '.$F,$posR2);
+ if($posR2 != $posR22) { $ITEXT = f_repl($ITEXT,$R2.' '.$F,$posR22); }
+ }
+ if(isset($L2)) { $ITEXT = f_repl($ITEXT,$L2,$posL2); }
+ if(isset($H2)) { $ITEXT = f_repl($ITEXT,$H2,$posH2); }
+ if($I == 'Negative') {
+ $I1 = "Negatif";
+ $I2 = "Negative";
+ $ITEXT = f_repl($ITEXT,$I1,$posI1);
+ $ITEXT = f_repl($ITEXT,$I2,$posI2);
+ } else {
+ $ITEXT = f_repl($ITEXT,$I,$posI1);
+ $ITEXT = f_repl($ITEXT,$I,$posI2);
+ }
+ $ITEXT = f_repl($ITEXT,$U1,$posU1);
+ $ITEXT = f_repl($ITEXT,$U2,$posU2);
+ } elseif(in_array($RESTYPE,[0,5])) {
+ if(strlen($RESCOM) < 2) {
+ $ITEXT = substr($ITEXT, 0, $posR1); $ITEXT .= $R1." ";
+ } else {
+ $ITEXT = substr($ITEXT, 0, $posR1); $ITEXT .= "$R1 \r\n$RESCOM ";
+ }
+ }
+ // bold flag
+ //$ITEXT = str_replace('*L', '
*L', $ITEXT);
+ //$ITEXT = str_replace('*H', '
*H', $ITEXT);
+ $raw[$i] .= $ITEXT;
+ $line += $nline;
+
+ if($TESTCODE != 'COVGG') {
+ if($line > $lpp) {$page++; $done[$page] = ""; $line = $nline; }
+ } else {
+ if($line > $lpp-14) {$page++; $done[$page] = ""; $line = $nline; }
+ }
+
+ if($line > $lpp) {$page++; $done[$page] = ""; $line = $nline; }
+ $done[$page] .= $raw[$i];
+ $i++;
+ $raw[$i] = "";
+ $nline = 0;
+ }
+}
+return $done;
+}
diff --git a/public/spooler_db/gener_oru.php b/public/spooler_db/gener_oru.php
new file mode 100644
index 0000000..e737464
--- /dev/null
+++ b/public/spooler_db/gener_oru.php
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/public/spooler_db/gleneaglesftr.png b/public/spooler_db/gleneaglesftr.png
new file mode 100644
index 0000000..b5bda1d
Binary files /dev/null and b/public/spooler_db/gleneaglesftr.png differ
diff --git a/public/spooler_db/gleneagleshdr.png b/public/spooler_db/gleneagleshdr.png
new file mode 100644
index 0000000..84eafb7
Binary files /dev/null and b/public/spooler_db/gleneagleshdr.png differ
diff --git a/public/spooler_db/main.php b/public/spooler_db/main.php
new file mode 100644
index 0000000..b48522e
--- /dev/null
+++ b/public/spooler_db/main.php
@@ -0,0 +1,124 @@
+
+
";
+if($pdf==0) { $raw.= "
"; }
+else { $raw .= "
"; }
+$raw .= "
+";
+
+$HOSTNUMBER = getHost($conn, $ACCESSNUMBER);
+$result = getResult($conn, $ACCESSNUMBER,$eng);
+$info = getData2($conn,$ACCESSNUMBER);
+$notes = getNotes($conn, $ACCESSNUMBER);
+$collData = getCollData($conn, $ACCESSNUMBER);
+$recvData = getRecvData($conn, $ACCESSNUMBER);
+$noSample = getNoSample($conn,$ACCESSNUMBER);
+if( $noSample == '' ) {
+ $status = getStatus($conn, $ACCESSNUMBER);
+} else {
+ $status = "PENDING";
+}
+$valBy = getValBy($conn, $ACCESSNUMBER);
+$date = date('d-m-Y H:i');
+$npage = count($result);
+$i=1;
+
+foreach($result as $page) {
+$raw .= "
+
";
+if($pdf==1) { $raw .= "

"; }
+$raw .= "
+$info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+";
+// lastpage show note
+if($i != $npage) {
+ $raw.="
";
+} else {
+ $raw .= "$noSample
+
";
+}
+$raw .= "
";
+$raw .= "
+";
+//echo "";
+if($pdf==1) { $raw .="

"; }
+$raw .= "
";
+$i+=1;
+}
+$raw .="";
+
+//echo $raw;
+
+if($pdf == 0) { echo $raw; }
+else {
+ if(!isset($_GET['dl'])) {
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w");
+ fwrite($file, $raw);
+ fclose($file);
+ $Ym = date('Ym');
+ $now = date("YmdHms");
+ $dirname = "archive/".$Ym."/";
+// $dirname = dirname($dirname);
+ if (!is_dir($dirname)) { mkdir($dirname, 0755, true); }
+ $file = fopen($dirname.$HOSTNUMBER."_".$now.".html","w+");
+ fwrite($file, $raw);
+ fclose($file);
+ } else { echo $raw; }
+}
+
+?>
diff --git a/public/spooler_db/main2 -backup.php b/public/spooler_db/main2 -backup.php
new file mode 100644
index 0000000..bef75de
--- /dev/null
+++ b/public/spooler_db/main2 -backup.php
@@ -0,0 +1,214 @@
+
+
+
";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n
";
+$pdf .= "\r\n
";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+
+if($eng==1) { $othertitle = "Non Laboratory Test"; }
+else { $othertitle = "Pemeriksaan Non Laboratorium"; }
+$countpage = substr_count($result[$npage],"\r");
+$countothers = substr_count("$others","\r");
+$countline = $countpage + $countothers;
+$pageadd = 0;
+if($countline > 37) {
+ $npage += 1;
+ $pageadd = 1;
+}
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show nosample, others and note
+ if($pageadd !=1) {
+ if( $i != $npage ) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+
+ if($others != '' && $countline < 38) {
+ $tmp .= "
$othertitle : \r\n";
+ $tmp .= "$others |
";
+ $others = '';
+ }
+ }
+ } else { // page tambahan = 1
+ if( $i != $npage-1 ) {
+ $tmp .="";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+ }
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+if($others != '') {
+ $tmp .= "
+
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+ $othertitle : \r\n
+ $others |
+
+ ";
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="
";
+ $tmp .= "
";
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $raw;
+
+if($preview != 1) {
+ //pdf
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //archive
+ /*
+ $date = date('YmdHi');
+
+ */
+ $folder = date('Ym');
+ $date = date('YmdHi');
+ //$file = fopen("archive/$date"."_$HOSTNUMBER.html","w+");
+ $filename = "archive/$folder/$date"."_$HOSTNUMBER.html";
+ $dirname = dirname($filename);
+ if (!is_dir($dirname)) { mkdir($dirname, 0777, true); }
+ $file = fopen("archive/$folder/$date"."_$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //oru
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status");
+ fclose($file);
+}
+?>
\ No newline at end of file
diff --git a/public/spooler_db/main2.php b/public/spooler_db/main2.php
new file mode 100644
index 0000000..a27e4bb
--- /dev/null
+++ b/public/spooler_db/main2.php
@@ -0,0 +1,229 @@
+ 95 ) {
+ $split_text = explode(" ", $text);
+ $cut_length = 11;
+ $split_text_cut1 = array_slice($split_text, 0, $cut_length);
+ $split_text_cut2 = array_slice($split_text, $cut_length, count($split_text));
+ $text1 = implode(" ", $split_text_cut1);
+ $text2 = implode(" ", $split_text_cut2);
+ $text = $text1."\r\n".$text2;
+ }
+ return($text);
+}
+$HOSTNUMBER = getHost($conn, $ACCESSNUMBER);
+$result = getResult($conn, $ACCESSNUMBER,$eng);
+$info = getData2($conn,$ACCESSNUMBER);
+$notes = getNotes($conn, $ACCESSNUMBER);
+$others = getOthers($conn,$ACCESSNUMBER, $eng);
+$collData = getCollData($conn, $ACCESSNUMBER);
+$recvData = getRecvData($conn, $ACCESSNUMBER);
+$collData = cutData($collData);
+$recvData = cutData($recvData);
+$noSample = getNoSample($conn,$ACCESSNUMBER);
+if( $noSample == '' ) {
+ $status = getStatus($conn, $ACCESSNUMBER);
+} else {
+ $status = "PENDING";
+}
+//if($ACCESSNUMBER != '3121849766') {$status = "FINAL";}
+if($preview == 0) {
+ $sql = "INSERT INTO GDC_CMOD.dbo.AUDIT_REQUESTS(ACCESSNUMBER, STEPDATE, STEPTYPE, STEPSTATUS)
+ VALUES('$ACCESSNUMBER', GETDATE(), 'PRINT', '$status')";
+ $stmt = sqlsrv_query($conn,$sql);
+ if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
+}
+
+$valBy = getValBy($conn, $ACCESSNUMBER);
+if(!isset($_GET['date'])) { $date = date('d-m-Y H:i'); }
+else { $date = $_GET['date']; }
+$npage = count($result);
+$i=1;
+$raw ='';
+$pdf ='';
+$tmp = "
+
+
";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n
";
+$pdf .= "\r\n
";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+
+if($eng==1) { $othertitle = "Non Laboratory Test"; }
+else { $othertitle = "Pemeriksaan Non Laboratorium"; }
+$countpage = substr_count($result[$npage],"\r");
+$countothers = substr_count("$others","\r");
+$countline = $countpage + $countothers;
+$pageadd = 0;
+if($countline > 39) {
+ $npage += 1;
+ $pageadd = 1;
+}
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show nosample, others and note
+ if($pageadd !=1) {
+ if( $i != $npage ) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+
+ if($others != '' && $countline < 38) {
+ $tmp .= "
$othertitle : \r\n";
+ $tmp .= "$others |
";
+ $others = '';
+ }
+ }
+ } else { // page tambahan = 1
+ if( $i != $npage-1 ) {
+ $tmp .="";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+ }
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+if($others != '') {
+ $tmp .= "
+
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+ $othertitle : \r\n
+ $others |
+
+ ";
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="
";
+ $tmp .= "
";
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $raw;
+
+if($preview != 1) {
+ //pdf
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //archive
+ /*
+ $date = date('YmdHi');
+
+ */
+ $folder = date('Ym');
+ $date = date('YmdHi');
+ //$file = fopen("archive/$date"."_$HOSTNUMBER.html","w+");
+ $filename = "archive/$folder/$date"."_$HOSTNUMBER.html";
+ $dirname = dirname($filename);
+ if (!is_dir($dirname)) { mkdir($dirname, 0777, true); }
+ $file = fopen("archive/$folder/$date"."_$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //oru
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status\r\n-");
+ fclose($file);
+}
+?>
\ No newline at end of file
diff --git a/public/spooler_db/main2_debug.php b/public/spooler_db/main2_debug.php
new file mode 100644
index 0000000..11ae9ae
--- /dev/null
+++ b/public/spooler_db/main2_debug.php
@@ -0,0 +1,214 @@
+
+
+
";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n
";
+$pdf .= "\r\n
";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+
+if($eng==1) { $othertitle = "Non Laboratory Test"; }
+else { $othertitle = "Pemeriksaan Non Laboratorium"; }
+$countpage = substr_count($result[$npage],"\r");
+$countothers = substr_count("$others","\r");
+$countline = $countpage + $countothers;
+$pageadd = 0;
+if($countline > 36) {
+ $npage += 1;
+ $pageadd = 1;
+}
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show nosample, others and note
+ if($pageadd !=1) {
+ if( $i != $npage ) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+
+ if($others != '' && $countline < 38) {
+ $tmp .= "
$othertitle : \r\n";
+ $tmp .= "$others |
";
+ $others = '';
+ }
+ }
+ } else { // page tambahan = 1
+ if( $i != $npage-1 ) {
+ $tmp .="";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+ }
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+if($others != '') {
+ $tmp .= "
+
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+ $othertitle : \r\n
+ $others |
+
+ ";
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="
";
+ $tmp .= "
";
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $raw;
+
+if($preview != 1) {
+ //pdf
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //archive
+ /*
+ $date = date('YmdHi');
+
+ */
+ $folder = date('Ym');
+ $date = date('YmdHi');
+ //$file = fopen("archive/$date"."_$HOSTNUMBER.html","w+");
+ $filename = "archive/$folder/$date"."_$HOSTNUMBER.html";
+ $dirname = dirname($filename);
+ if (!is_dir($dirname)) { mkdir($dirname, 0777, true); }
+ $file = fopen("archive/$folder/$date"."_$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //oru
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status");
+ fclose($file);
+}
+?>
\ No newline at end of file
diff --git a/public/spooler_db/main2_zaka.php b/public/spooler_db/main2_zaka.php
new file mode 100644
index 0000000..3eda382
--- /dev/null
+++ b/public/spooler_db/main2_zaka.php
@@ -0,0 +1,214 @@
+
+
+
";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n
";
+$pdf .= "\r\n
";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+
+if($eng==1) { $othertitle = "Non Laboratory Test"; }
+else { $othertitle = "Pemeriksaan Non Laboratorium"; }
+$countpage = substr_count($result[$npage],"\r");
+$countothers = substr_count("$others","\r");
+$countline = $countpage + $countothers;
+$pageadd = 0;
+if($countline > 37) {
+ $npage += 1;
+ $pageadd = 1;
+}
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show nosample, others and note
+ if($pageadd !=1) {
+ if( $i != $npage ) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+
+ if($others != '' && $countline < 38) {
+ $tmp .= "
$othertitle : \r\n";
+ $tmp .= "$others |
";
+ $others = '';
+ }
+ }
+ } else { // page tambahan = 1
+ if( $i != $npage-1 ) {
+ $tmp .="";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+ }
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+if($others != '') {
+ $tmp .= "
+
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+ $othertitle : \r\n
+ $others |
+
+ ";
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="
";
+ $tmp .= "
";
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $raw;
+
+if($preview != 1) {
+ //pdf
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //archive
+ /*
+ $date = date('YmdHi');
+
+ */
+ $folder = date('Ym');
+ $date = date('YmdHi');
+ //$file = fopen("archive/$date"."_$HOSTNUMBER.html","w+");
+ $filename = "archive/$folder/$date"."_$HOSTNUMBER.html";
+ $dirname = dirname($filename);
+ if (!is_dir($dirname)) { mkdir($dirname, 0777, true); }
+ $file = fopen("archive/$folder/$date"."_$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //oru
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status");
+ fclose($file);
+}
+?>
\ No newline at end of file
diff --git a/public/spooler_db/main_dev.php b/public/spooler_db/main_dev.php
new file mode 100644
index 0000000..4268ad9
--- /dev/null
+++ b/public/spooler_db/main_dev.php
@@ -0,0 +1,208 @@
+ 95 ) {
+ $split_text = explode(" ", $text);
+ $cut_length = 11;
+ $split_text_cut1 = array_slice($split_text, 0, $cut_length);
+ $split_text_cut2 = array_slice($split_text, $cut_length, count($split_text));
+ $text1 = implode(" ", $split_text_cut1);
+ $text2 = implode(" ", $split_text_cut2);
+ $text = $text1."\r\n".$text2;
+ }
+ return($text);
+}
+$HOSTNUMBER = getHost($conn, $ACCESSNUMBER);
+$result = getResult($conn, $ACCESSNUMBER,$eng);
+$info = getData2($conn,$ACCESSNUMBER);
+$notes = getNotes($conn, $ACCESSNUMBER);
+$others = getOthers($conn,$ACCESSNUMBER, $eng);
+$collData = getCollData($conn, $ACCESSNUMBER);
+$recvData = getRecvData($conn, $ACCESSNUMBER);
+$collData = cutData($collData);
+$recvData = cutData($recvData);
+$noSample = getNoSample($conn,$ACCESSNUMBER);
+if( $noSample == '' ) {
+ $status = getStatus($conn, $ACCESSNUMBER);
+} else {
+ $status = "PENDING";
+}
+
+$valBy = getValBy($conn, $ACCESSNUMBER);
+if(!isset($_GET['date'])) { $date = date('d-m-Y H:i'); }
+else { $date = $_GET['date']; }
+$npage = count($result);
+$i=1;
+$raw ='';
+$pdf ='';
+$tmp = "
+
+
";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n
";
+$pdf .= "\r\n
";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+
+if($eng==1) { $othertitle = "Non Laboratory Test"; }
+else { $othertitle = "Pemeriksaan Non Laboratorium"; }
+$countpage = substr_count($result[$npage],"\r");
+$countothers = substr_count("$others","\r");
+$countline = $countpage + $countothers;
+$pageadd = 0;
+if($countline > 36) {
+ $npage += 1;
+ $pageadd = 1;
+}
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show nosample, others and note
+ if($pageadd !=1) {
+ if( $i != $npage ) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+
+ if($others != '' && $countline < 38) {
+ $tmp .= "
$othertitle : \r\n";
+ $tmp .= "$others |
";
+ $others = '';
+ }
+ }
+ } else { // page tambahan = 1
+ if( $i != $npage-1 ) {
+ $tmp .="";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+ }
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+if($others != '') {
+ $tmp .= "
+
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+ $othertitle : \r\n
+ $others |
+
+ ";
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="
";
+ $tmp .= "
";
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $raw;
+/*
+if($preview != 1) {
+ $sql = "INSERT INTO GDC_CMOD.dbo.AUDIT_REQUESTS(ACCESSNUMBER, STEPDATE, STEPTYPE, STEPSTATUS)
+ VALUES('$ACCESSNUMBER', GETDATE(), 'PRINT', '$status')";
+ $stmt = sqlsrv_query($conn,$sql);
+ if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
+ //pdf
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //archive
+ $folder = date('Ym');
+ $date = date('YmdHi');
+ //$file = fopen("archive/$date"."_$HOSTNUMBER.html","w+");
+ $filename = "archive/$folder/$date"."_$HOSTNUMBER.html";
+ $dirname = dirname($filename);
+ if (!is_dir($dirname)) { mkdir($dirname, 0777, true); }
+ $file = fopen("archive/$folder/$date"."_$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //oru
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status\r\n-");
+ fclose($file);
+}
+*/
+?>
\ No newline at end of file
diff --git a/public/spooler_db/main_qr.php b/public/spooler_db/main_qr.php
new file mode 100644
index 0000000..c0bff6c
--- /dev/null
+++ b/public/spooler_db/main_qr.php
@@ -0,0 +1,217 @@
+
+
+
";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n
";
+$pdf .= "\r\n
";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+if($eng==1) { $othertitle = "Non Laboratory Test"; }
+else { $othertitle = "Pemeriksaan Non Laboratorium"; }
+$countpage = substr_count($result[$npage],"\r");
+$countothers = substr_count("$others","\r");
+$countline = $countpage + $countothers;
+$pageadd = 0;
+if($countline > 39) {
+ $npage = $npage+1;
+ $pageadd = 1;
+}
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show note
+ // lastpage show nosample, others and note
+ if($pageadd !=1) {
+ if( $i != $npage ) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+
+ if($others != '' && $countline < 39) {
+ $tmp .= "
$othertitle : \r\n";
+ $tmp .= "$others |
";
+ $others = '';
+ }
+ }
+ } else { // page tambahan = 1
+ if( $i != $npage-1 ) {
+ $tmp .="";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+ }
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="

";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+if($others != '') {
+ $tmp .= "
+
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+ $othertitle : \r\n
+ $others |
+
+ ";
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="

";
+ $tmp .= "
";
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $raw;
+
+if($preview != 1) {
+ //pdf
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //archive
+ $folder = date('Ym');
+ $date = date('YmdHi');
+ //$file = fopen("archive/$date"."_$HOSTNUMBER.html","w+");
+ $filename = "archive/$folder/$date"."_$HOSTNUMBER.html";
+ $dirname = dirname($filename);
+ if (!is_dir($dirname)) { mkdir($dirname, 0777, true); }
+ $file = fopen("archive/$folder/$date"."_$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //oru
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status\r\ncovid");
+ fclose($file);
+}
+
+?>
\ No newline at end of file
diff --git a/public/spooler_db/normalize.min.css b/public/spooler_db/normalize.min.css
new file mode 100644
index 0000000..8a32812
--- /dev/null
+++ b/public/spooler_db/normalize.min.css
@@ -0,0 +1,2 @@
+/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
+html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}
\ No newline at end of file
diff --git a/public/spooler_db/normalize.min.css.map b/public/spooler_db/normalize.min.css.map
new file mode 100644
index 0000000..dc2dc7f
--- /dev/null
+++ b/public/spooler_db/normalize.min.css.map
@@ -0,0 +1 @@
+{"version":3,"sources":["normalize.css"],"names":[],"mappings":"AAqEA,SA6GA,IACA,IAIE,eAAgB,SA8FlB,OAnCA,GAoCA,MACE,SAAqB,QAhRvB,KACE,YAAa,WACb,qBAAiC,KACjC,yBAA6C,KAO/C,KACE,OAAQ,EAcD,YAKH,MAPN,QACA,MACA,QAEA,OACA,OACA,OACA,KAEA,IACA,QACA,QACE,QAAoC,MAOtC,MACA,OACA,SACA,MACE,QAAS,aAOX,sBACE,QAAS,KACT,OAAQ,EAgBA,UAAV,SAEE,QAAS,KAWX,EACE,iBAAkB,YAClB,6BAAyC,QAQ3C,SACA,QACE,cAAe,EAWjB,YACE,cAAe,KACf,gBAA4B,UAC5B,gBAAoC,UAAU,OAOhD,EACA,OAUE,YAAa,OAOf,IACE,WAAY,OAQd,GACE,UAAW,IACX,OAAQ,MAAO,EAOjB,KACE,iBAAkB,KAClB,MAAO,KAOT,MACE,UAAW,IAQb,IACA,IACE,UAAW,IACX,YAAa,EACb,SAAU,SAIZ,IACE,OAAQ,OAGV,IACE,IAAK,MAUP,IACE,aAAc,KAOhB,eACE,SAAU,OAWZ,KACA,IACA,IACA,KACE,YAAa,UAAW,UACxB,UAAsB,IAOxB,OACE,OAAQ,IAAI,KAQd,GACE,WAAY,YACZ,OAAmB,EAYrB,OACA,MACA,OACA,SACE,KAAM,QACN,OAAmB,EAOrB,SACE,YAAa,IAQf,OACA,OASA,OACA,OACE,eAA2B,KAY7B,cAFsB,cADtB,OACA,mBAGE,mBAAoB,OAQtB,gCACA,+BACA,gCAHA,yBAIE,aAAc,KACd,QAAS,EAQX,6BACA,4BACA,6BAHA,sBAIE,QAAoB,WAAP,OAAJ,IAOX,SACE,OAAQ,IAAI,MAAM,OAClB,OAAQ,EAAE,IACV,QAAS,MAAO,OAAQ,MAU1B,OACE,WAAY,WACZ,MAAkB,QAClB,QAA4B,MAC5B,UAAsC,KACtC,QAA4C,EAC5C,YAAwD,OAO1D,SACE,SAAU,KAQZ,gBACA,aACE,WAAY,WACZ,QAAoB,EAOtB,yCACA,yCACE,OAAQ,KAQV,cACE,mBAAoB,UACpB,eAA2B,KAO7B,4CACA,yCACE,mBAAoB,KAOtB,4BACE,MAAO,QACP,QAAS,IAQX,6BACE,mBAAoB,OACpB,KAAiB"}
\ No newline at end of file
diff --git a/public/spooler_db/oru.php b/public/spooler_db/oru.php
new file mode 100644
index 0000000..e4d9fb8
--- /dev/null
+++ b/public/spooler_db/oru.php
@@ -0,0 +1,96 @@
+"; print_r($row); echo"";
+ $sqlFB = "EXECUTE procedure TDL_FILL_LABRESULT ( $CIDBILLING, $CIDBILLINGDT, $CIDPRODUCT, $RSLT_NCOMPARISON, $NSEX, $UOM_ID,
+ $RSLT_VALUEN, $RSLT_VALUET, $RSLT_VALUEB, $RSLT_NORMAL, $RSLT_COMMENT, $INTER_UOM_ID, $RSLT_INTERVALUEN,
+ $RSLT_INTERVALUET, $RSLT_INTERVALUEB, $RSLT_INTERNORMAL, $RSLT_INTERCOMMENT,$RSLT_NORMALTEXT, $MACH_ID, $RSLT_CREATEDBY,
+ $RSLT_NCONVERSION)";
+
+ //echo $sqlFB."
";
+ //$resultsc = odbc_exec($connFB, $sqlFB) or die("$sqlFB
".odbc_errormsg());
+ }
+}
+// update tdl_order status
+$resdt = date('Y-m-d H:i');
+$sql = "select status = case
+ when exists (
+ select 1 from glendb.dbo.TESTS t
+ left join glendb.dbo.REQUESTS r on r.REQUESTID=t.REQUESTID
+ where r.ACCESSNUMBER='$ACCESSNUMBER' and
+ ( t.RESTYPE=0 OR t.RESSTATUS=0 OR Left(t.RESVALUE,7)='Pending' )
+ and t.NOTPRINTABLE is null
+ ) then 'PENDING'
+ else 'FINAL'
+ end";
+$stmt = sqlsrv_query( $conn, $sql );
+if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
+$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
+if($row[0]!='PENDING') {
+ $status=1;
+ $sqlFB = "UPDATE TDL_ORDER SET ODR_NRESULT='$status', ODR_DTRESULT='$resdt' WHERE ODR_CNOLAB='$ODR_CNOLAB'";
+ //echo $sqlFB."
";
+ $resultsc = odbc_exec($connFB, $sqlFB) or die(odbc_errormsg());
+}
+odbc_close($connFB);
+?>
\ No newline at end of file
diff --git a/public/spooler_db/package-lock.json b/public/spooler_db/package-lock.json
new file mode 100644
index 0000000..d385609
--- /dev/null
+++ b/public/spooler_db/package-lock.json
@@ -0,0 +1,376 @@
+{
+ "requires": true,
+ "lockfileVersion": 1,
+ "dependencies": {
+ "@types/node": {
+ "version": "14.14.21",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.21.tgz",
+ "integrity": "sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A=="
+ },
+ "anymatch": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
+ "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
+ "requires": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
+ },
+ "binary-extensions": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz",
+ "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow=="
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "chokidar": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz",
+ "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==",
+ "requires": {
+ "anymatch": "~3.1.1",
+ "braces": "~3.0.2",
+ "fsevents": "~2.1.1",
+ "glob-parent": "~5.1.0",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.2.0"
+ }
+ },
+ "chrome-launcher": {
+ "version": "0.13.2",
+ "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.13.2.tgz",
+ "integrity": "sha512-zWD9RVVKd8Nx2xKGY4G08lb3nCD+2hmICxovvRE9QjBKQzHFvCYqGlsw15b4zUxLKq3wXEwVbR/yLtMbfk7JbQ==",
+ "requires": {
+ "@types/node": "*",
+ "escape-string-regexp": "^1.0.5",
+ "is-wsl": "^2.2.0",
+ "lighthouse-logger": "^1.0.0",
+ "mkdirp": "^0.5.3",
+ "rimraf": "^3.0.2"
+ },
+ "dependencies": {
+ "glob": {
+ "version": "7.1.6",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
+ "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
+ },
+ "mkdirp": {
+ "version": "0.5.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
+ "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ }
+ }
+ },
+ "chrome-remote-interface": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.28.2.tgz",
+ "integrity": "sha512-F7mjof7rWvRNsJqhVXuiFU/HWySCxTA9tzpLxUJxVfdLkljwFJ1aMp08AnwXRmmP7r12/doTDOMwaNhFCJsacw==",
+ "requires": {
+ "commander": "2.11.x",
+ "ws": "^7.2.0"
+ }
+ },
+ "commander": {
+ "version": "2.11.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
+ "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ=="
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
+ },
+ "fsevents": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
+ "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
+ "optional": true
+ },
+ "glob": {
+ "version": "6.0.4",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
+ "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
+ "requires": {
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "2 || 3",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "glob-parent": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
+ "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "html-pdf-chrome": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/html-pdf-chrome/-/html-pdf-chrome-0.6.1.tgz",
+ "integrity": "sha512-WAdk9K1ZJpvZ0D1JfCML+rjPD5RhjsqXaLafoRtyboqxfv7z7NKy06VMEgGDsM7lbO1k2E3aUimUd+jPbLzGGw==",
+ "requires": {
+ "chrome-launcher": "0.13.2",
+ "chrome-remote-interface": "^0.28.0"
+ }
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+ },
+ "is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "requires": {
+ "binary-extensions": "^2.0.0"
+ }
+ },
+ "is-docker": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz",
+ "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw=="
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI="
+ },
+ "is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
+ },
+ "is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "requires": {
+ "is-docker": "^2.0.0"
+ }
+ },
+ "lighthouse-logger": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.2.0.tgz",
+ "integrity": "sha512-wzUvdIeJZhRsG6gpZfmSCfysaxNEr43i+QT+Hie94wvHDKFLi4n7C2GqZ4sTC+PH5b5iktmXJvU87rWvhP3lHw==",
+ "requires": {
+ "debug": "^2.6.8",
+ "marky": "^1.2.0"
+ }
+ },
+ "marky": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.1.tgz",
+ "integrity": "sha512-md9k+Gxa3qLH6sUKpeC2CNkJK/Ld+bEz5X96nYwloqphQE0CKCVEKco/6jxEZixinqNdz5RFi/KaCyfbMDMAXQ=="
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
+ },
+ "mkdirp": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
+ "requires": {
+ "minimist": "0.0.8"
+ }
+ },
+ "moment": {
+ "version": "2.29.1",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
+ "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
+ },
+ "mv": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz",
+ "integrity": "sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI=",
+ "requires": {
+ "mkdirp": "~0.5.1",
+ "ncp": "~2.0.0",
+ "rimraf": "~2.4.0"
+ }
+ },
+ "ncp": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz",
+ "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M="
+ },
+ "node-cmd": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/node-cmd/-/node-cmd-3.0.0.tgz",
+ "integrity": "sha1-OP/3CkqqT2WdID61eGJzcBjiT28="
+ },
+ "node-run-cmd": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/node-run-cmd/-/node-run-cmd-1.0.1.tgz",
+ "integrity": "sha1-F1XBJiS9/5INj0UkLWZC4hSj1AA="
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
+ },
+ "pdf-to-printer": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/pdf-to-printer/-/pdf-to-printer-1.1.0.tgz",
+ "integrity": "sha512-+4v71/7HI1eL8I7orib8YiAiTC45qEL5WAQSKwL2YhmIXvNv+jiOkROtuO6MhFq9mfoUCCQd+ZrjC6bKUFGmxg=="
+ },
+ "picomatch": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.1.tgz",
+ "integrity": "sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA=="
+ },
+ "readdirp": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz",
+ "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==",
+ "requires": {
+ "picomatch": "^2.0.4"
+ }
+ },
+ "rimraf": {
+ "version": "2.4.5",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz",
+ "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=",
+ "requires": {
+ "glob": "^6.0.1"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
+ },
+ "ws": {
+ "version": "7.4.2",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.2.tgz",
+ "integrity": "sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA=="
+ }
+ }
+}
diff --git a/public/spooler_db/pdf.css b/public/spooler_db/pdf.css
new file mode 100644
index 0000000..45cb242
--- /dev/null
+++ b/public/spooler_db/pdf.css
@@ -0,0 +1,34 @@
+/*html,pre,th,table { font-family:'Courier New', Courier, monospace; font-size:7.8pt; margin:0;}*/
+html,pre,th,table { font-family:'Lucida Console', Monaco, monospace; font-size:7.7pt; margin:0;}
+#page { background: white; display: block; margin: 0 auto; page-break-after:always; width: 210mm; height: 295mm; }
+
+#dinfo { float:left; width:200mm;
+ background-size: 100% auto; background-repeat: no-repeat;
+ margin-left:0.5cm;
+}
+
+#dresult { float:left; margin: 0.2cm 0.8cm 0 1.5cm; height: 18cm; }
+#footer { float:left; margin:0cm 2cm 0 1cm; height:1.5cm; }
+
+table {border-collapse:collapse;}
+td {vertical-align:top;}
+th,td { line-height:1.3;}
+
+.result tr:nth-child(even), th { background: #DDD !important; }
+.info { border:solid 1px black; margin:-1cm 0 0 8.5cm; width:11cm;}
+.flag { float:right; top:0; font-weight:bold; }
+.result { table-layout:fixed; border:solid 1px black; width:100%; }
+.textC { font-size:7pt; }
+.footer {width : 17cm; }
+.footer td {vertical-align:bottom;}
+td.right { text-align: right; }
+
+#notes { margin: 5mm 0 0 10mm; }
+
+.img { width:200mm; margin-left:0.5cm }
+.img-footer { margin-bottom:7.5mm }
+pre.small {font-size:6pt;}
+
+@media print {
+ @page { margin:0; size:210mm 297mm; }
+}
\ No newline at end of file
diff --git a/public/spooler_db/pdf.php b/public/spooler_db/pdf.php
new file mode 100644
index 0000000..23de74b
--- /dev/null
+++ b/public/spooler_db/pdf.php
@@ -0,0 +1,116 @@
+
+
";
+if($pdf==0) { $raw.= "
"; }
+else { $raw .= "
"; }
+$raw .= "
+";
+
+$HOSTNUMBER = getHost($conn, $ACCESSNUMBER);
+$result = getResult($conn, $ACCESSNUMBER,$eng);
+$info = getData2($conn,$ACCESSNUMBER);
+$notes = getNotes($conn, $ACCESSNUMBER);
+$collData = getCollData($conn, $ACCESSNUMBER);
+$recvData = getRecvData($conn, $ACCESSNUMBER);
+$noSample = getNoSample($conn,$ACCESSNUMBER);
+if( $noSample == '' ) {
+ $status = getStatus($conn, $ACCESSNUMBER);
+} else {
+ $status = "PENDING";
+}
+$valBy = getValBy($conn, $ACCESSNUMBER);
+$date = date('d-m-Y H:i');
+$npage = count($result);
+$i=1;
+
+foreach($result as $page) {
+$raw .= "
+
";
+if($pdf==1) { $raw .= "

"; }
+$raw .= "
+$info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+";
+// lastpage show note
+if($i != $npage) {
+ $raw.="
";
+} else {
+ $raw .= "$noSample
+
";
+}
+$raw .= "
";
+$raw .= "
+";
+//echo "";
+if($pdf==1) { $raw .="

"; }
+$raw .= "
";
+$i+=1;
+}
+$raw .="";
+
+//echo $raw;
+
+if($pdf == 0) { echo $raw; }
+else {
+ if(!isset($_GET['dl'])) {
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w");
+ fwrite($file, $raw);
+ fclose($file);
+ } else { echo $raw; }
+}
+
+?>
diff --git a/public/spooler_db/pdf_qr.css b/public/spooler_db/pdf_qr.css
new file mode 100644
index 0000000..36e8435
--- /dev/null
+++ b/public/spooler_db/pdf_qr.css
@@ -0,0 +1,33 @@
+/*html,pre,th,table { font-family:'Courier New', Courier, monospace; font-size:7.8pt; margin:0;}*/
+html,pre,th,table { font-family:'Lucida Console', Monaco, monospace; font-size:7.7pt; margin:0;}
+#page { background: white; display: block; margin: 0 auto; page-break-after:always; width: 210mm; height: 295mm; }
+
+#dinfo { float:left; width:200mm;
+ background-size: 100% auto; background-repeat: no-repeat;
+ margin-left:0.5cm;
+}
+
+#dresult { float:left; margin: 0.2cm 0.8cm 0 1.5cm; height: 16cm; }
+#footer { float:left; margin:0cm 0cm 0.5cm 1cm; }
+
+table {border-collapse:collapse;}
+td {vertical-align:top;}
+th,td { line-height:1.3;}
+
+.result tr:nth-child(even), th { background: #DDD !important; }
+.info { border:solid 1px black; margin:-1cm 0 0 8.5cm; width:11cm;}
+.flag { float:right; top:0; font-weight:bold; }
+.result { table-layout:fixed; border:solid 1px black; width:100%; }
+.textC { font-size:7pt; }
+.footer {width : 18.5cm; }
+.footer td {vertical-align:bottom;}
+td.right { text-align: right; }
+
+#notes { margin: 5mm 0 0 10mm; }
+
+.img { width:210mm; }
+pre.small {font-size:6pt;}
+
+@media print {
+ @page { margin:0; size:210mm 297mm; }
+}
\ No newline at end of file
diff --git a/public/spooler_db/pdf_start.bat b/public/spooler_db/pdf_start.bat
new file mode 100644
index 0000000..9642e28
--- /dev/null
+++ b/public/spooler_db/pdf_start.bat
@@ -0,0 +1 @@
+node spooler_pdf.js
\ No newline at end of file
diff --git a/public/spooler_db/preview.php b/public/spooler_db/preview.php
new file mode 100644
index 0000000..ba86a2a
--- /dev/null
+++ b/public/spooler_db/preview.php
@@ -0,0 +1,137 @@
+
+
+
";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n
";
+$pdf .= "\r\n
";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show note
+ if($i != $npage) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample
+
";
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="

";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $raw;
+
+if($preview != 1) {
+ //pdf
+ $file = fopen("process_pdf/$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //archive
+
+ $folder = date('Ym');
+ $date = date('YmdHi');
+ //$file = fopen("archive/$date"."_$HOSTNUMBER.html","w+");
+ $filename = "archive/$folder/$date"."_$HOSTNUMBER.html";
+ $dirname = dirname($filename);
+ if (!is_dir($dirname)) { mkdir($dirname, 0777, true); }
+ $file = fopen("archive/$folder/$date"."_$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //oru
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status");
+ fclose($file);
+}
+*/
+?>
\ No newline at end of file
diff --git a/public/spooler_db/spooler_db.7z b/public/spooler_db/spooler_db.7z
new file mode 100644
index 0000000..4d1c4b7
Binary files /dev/null and b/public/spooler_db/spooler_db.7z differ
diff --git a/public/spooler_db/spooler_pdf.js b/public/spooler_db/spooler_pdf.js
new file mode 100644
index 0000000..da2e83f
--- /dev/null
+++ b/public/spooler_db/spooler_pdf.js
@@ -0,0 +1,38 @@
+const chokidar = require('chokidar');
+const paths = require('path');
+const mv = require('mv');
+const fs = require('fs');
+const moment = require('moment');
+const nrc = require('node-run-cmd');
+const htmlPdf = require('html-pdf-chrome');
+const options = {
+ port: 42020,
+ printOptions:{
+ marginBottom: 0,
+ marginLeft: 0,
+ marginTop: 0,
+ marginRight: 0
+ }
+};
+var now = moment().format('YYYYMMDDHHmmss');
+
+chokidar.watch('process_pdf/' , { ignoreInitial: false, awaitWriteFinish: true, depth:0 }).on('add', (path) => {
+ if(paths.extname(path)=='') {
+ console.log('raw file processed '+path);
+ nrc.run('php main2.php '+path).then( function(){
+ mv(path, "done_pdf/"+paths.basename(path) , function (err) {
+ if (err) throw err;
+ });
+ });
+ }
+ else if(paths.extname(path)=='.html') {
+ url = "file://C:/inetpub/wwwroot/spooler_db/process_pdf/"+paths.basename(path);
+ console.log('generating pdf '+url);
+ htmlPdf.create(url, options).then((pdf) => pdf.toFile("C:\\inetpub\\wwwroot\\spooler_db\\process_pdf\\"+paths.basename(path,'.html')+".pdf")).then( function(err) {
+ mv(path, "done_pdf/"+paths.basename(path) , function (err) {
+ if (err) throw err;
+ })
+ });
+
+ }
+});
\ No newline at end of file
diff --git a/public/spooler_db/style.css b/public/spooler_db/style.css
new file mode 100644
index 0000000..ceebd46
--- /dev/null
+++ b/public/spooler_db/style.css
@@ -0,0 +1,29 @@
+/*html,pre,th,table { font-family:'Courier New', Courier, monospace; font-size:7.8pt; margin:0;}*/
+html,pre,th,table { font-family:'Lucida Console', Monaco, monospace; font-size:7.5pt; margin:0;}
+body { -webkit-print-color-adjust:exact; }
+#page { z-index:1; background: white; display: block; margin: 0; page-break-after:always;
+ /*width: 210mm; height: 297mm;*/
+ width: 210mm; height: 297mm;
+}
+#dinfo { float:right; margin:4cm 0.8cm 0 0; }
+#dresult { float:left; margin: 0.2cm 0.8cm 0 1.5cm; height: 17cm; }
+#footer { float:left; margin:0cm 2cm 0 1cm; height:3cm; }
+
+table {border-collapse:collapse;}
+td {vertical-align:top;}
+th,td { line-height:1.3;}
+
+.result tr:nth-child(even), th { background: #DDD; }
+.info { border:solid 1px black; width:11cm; }
+.flag { float:right; top:0; font-weight:bold; }
+.result { table-layout:fixed; border:solid 1px black; width:100%; }
+.textC { font-size:7pt; }
+.footer {width : 17cm; }
+.footer td {vertical-align:bottom;}
+td.right { text-align: right; }
+
+#notes { margin: 5mm 0 0 10mm; }
+
+.footer-img { visibility:hidden; }
+
+pre.small {font-size:6pt;}
\ No newline at end of file
diff --git a/public/spooler_db/style_qr.css b/public/spooler_db/style_qr.css
new file mode 100644
index 0000000..6531ceb
--- /dev/null
+++ b/public/spooler_db/style_qr.css
@@ -0,0 +1,29 @@
+/*html,pre,th,table { font-family:'Courier New', Courier, monospace; font-size:7.8pt; margin:0;}*/
+html,pre,th,table { font-family:'Lucida Console', Monaco, monospace; font-size:7.5pt; margin:0;}
+body { -webkit-print-color-adjust:exact; }
+#page { z-index:1; background: white; display: block; margin: 0; page-break-after:always;
+ /*width: 210mm; height: 297mm;*/
+ width: 210mm; height: 297mm;
+}
+#dinfo { float:right; margin:4cm 0.8cm 0 0; }
+#dresult { float:left; margin: 0.2cm 0.8cm 0 1.5cm; height: 14cm; }
+#footer { float:left; margin:0cm 2cm 0 1cm; }
+
+table {border-collapse:collapse;}
+td {vertical-align:top;}
+th,td { line-height:1.3;}
+
+.result tr:nth-child(even), th { background: #DDD; }
+.info { border:solid 1px black; width:11cm; }
+.flag { float:right; top:0; font-weight:bold; }
+.result { table-layout:fixed; border:solid 1px black; width:100%; }
+.textC { font-size:7pt; }
+.footer {width : 17cm; height:4cm; }
+.footer td {vertical-align:bottom;}
+td.right { text-align: right; }
+
+#notes { margin: 5mm 0 0 10mm; }
+
+.footer-img { visibility:hidden; }
+
+pre.small {font-size:6pt;}
\ No newline at end of file
diff --git a/public/spooler_db/test.js b/public/spooler_db/test.js
new file mode 100644
index 0000000..cb3e903
--- /dev/null
+++ b/public/spooler_db/test.js
@@ -0,0 +1,29 @@
+const paths = require('path');
+const mv = require('mv');
+const fs = require('fs');
+const htmlPdf = require('html-pdf-chrome');
+const options = {
+ port: 42020,
+ printOptions:{
+ marginBottom: 0,
+ marginLeft: 0,
+ marginTop: 0,
+ marginRight: 0
+ }
+};
+
+file = process.argv[2];
+filename = file.substring(42,file.length-4);
+ //C:/node/node.exe C:/inetpub/wwwroot/spooler_db/test.js C:/inetpub/wwwroot/spooler_db/process_pdf/01221200963.html
+//url = "file://C:/inetpub/wwwroot/spooler_db/process_pdf/"+paths.basename(path);
+//url = "file://C:/inetpub/wwwroot/spooler_db/"+file;
+url = "file://"+file;
+htmlPdf.create(url, options).then((pdf) => pdf.toFile("C:\\inetpub\\wwwroot\\spooler_db\\process_pdf\\"+filename+"pdf"));
+//htmlPdf.create(url, options).then((pdf) => pdf.toFile("C:\\inetpub\\wwwroot\\spooler_db\\test_done\\"+filename+".pdf")).then( function(err) {
+/*
+ mv(file, "test_done/"+filename , function (err) {
+ if (err) throw err;
+ })
+*/
+//});
+
diff --git a/public/spooler_db/test.php b/public/spooler_db/test.php
new file mode 100644
index 0000000..db04fda
--- /dev/null
+++ b/public/spooler_db/test.php
@@ -0,0 +1,8 @@
+
";
+print_r($result);
\ No newline at end of file
diff --git a/public/spooler_db/val2.php b/public/spooler_db/val2.php
new file mode 100644
index 0000000..c245bc9
--- /dev/null
+++ b/public/spooler_db/val2.php
@@ -0,0 +1,205 @@
+
+
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n";
+$pdf .= "\r\n";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+
+if($eng==1) { $othertitle = "Non Laboratory Test"; }
+else { $othertitle = "Pemeriksaan Non Laboratorium"; }
+$countpage = substr_count($result[$npage],"\r");
+$countothers = substr_count("$others","\r");
+$countline = $countpage + $countothers;
+$pageadd = 0;
+if($countline > 37) {
+ $npage += 1;
+ $pageadd = 1;
+}
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show nosample, others and note
+ if($pageadd !=1) {
+ if( $i != $npage ) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+
+ if($others != '' && $countline < 38) {
+ $tmp .= "
$othertitle : \r\n";
+ $tmp .= "$others |
";
+ $others = '';
+ }
+ }
+ } else { // page tambahan = 1
+ if( $i != $npage-1 ) {
+ $tmp .="";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+ }
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+if($others != '') {
+ $tmp .= "
+
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+ $othertitle : \r\n
+ $others |
+
+ ";
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="
";
+ $tmp .= "
";
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $pdf;
+
+if(isset($_POST['print'])) {
+ //pdf
+ $file = fopen("C:/inetpub/wwwroot/spooler_db/val2/$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ /*
+ $folder = date('Ym');
+ $date = date('YmdHi');
+ //$file = fopen("archive/$date"."_$HOSTNUMBER.html","w+");
+ $filename = "archive/$folder/$date"."_$HOSTNUMBER.html";
+ $dirname = dirname($filename);
+ if (!is_dir($dirname)) { mkdir($dirname, 0777, true); }
+ $file = fopen("archive/$folder/$date"."_$HOSTNUMBER.html","w+");
+ fwrite($file, $pdf);
+ fclose($file);
+ //oru
+ $file = fopen("process_oru/$ACCESSNUMBER.oru","w+");
+ $date = date('Y-m-d H:i');
+ fwrite($file, "$ACCESSNUMBER\r\n$HOSTNUMBER\r\n$date\r\n$status");
+ fclose($file);
+ */
+}
+?>
\ No newline at end of file
diff --git a/public/spooler_db/val2_qr.php b/public/spooler_db/val2_qr.php
new file mode 100644
index 0000000..e7146ce
--- /dev/null
+++ b/public/spooler_db/val2_qr.php
@@ -0,0 +1,193 @@
+
+
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+$raw .= "\r\n";
+$pdf .= "\r\n";
+$tmp = "
+";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+if($eng==1) { $othertitle = "Non Laboratory Test"; }
+else { $othertitle = "Pemeriksaan Non Laboratorium"; }
+$countpage = substr_count($result[$npage],"\r");
+$countothers = substr_count("$others","\r");
+$countline = $countpage + $countothers;
+$pageadd = 0;
+if($countline > 39) {
+ $npage = $npage+1;
+ $pageadd = 1;
+}
+
+foreach($result as $page) {
+ $tmp .= "
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+
+
+
+
+
+
+
+
+
+ | TEST |
+ CONVENTIONAL | INTERNATIONAL |
+ | RESULT | REF. RANGES | UNIT | RESULT | REF. RANGES | UNIT |
+ $page
+ ";
+ // lastpage show note
+ // lastpage show nosample, others and note
+ if($pageadd !=1) {
+ if( $i != $npage ) {
+ $tmp .="
";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+
+ if($others != '' && $countline < 39) {
+ $tmp .= "
$othertitle : \r\n";
+ $tmp .= "$others |
";
+ $others = '';
+ }
+ }
+ } else { // page tambahan = 1
+ if( $i != $npage-1 ) {
+ $tmp .="";
+ } else {
+ $tmp .= "$noSample ";
+ $tmp .= "
\r\n";
+ }
+ }
+ $tmp .= "
";
+
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="

";
+ $tmp .= "
";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $i+=1;
+}
+
+if($others != '') {
+ $tmp .= "
+
+
";
+ if($preview==1) { $tmp.= "
preview only do not print
" ; }
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+ $pdf .= "

";
+ $tmp .= "
+ $info
+
+
+
+ $othertitle : \r\n
+ $others |
+
+ ";
+ $tmp .= "
+ ";
+ $raw .= $tmp; $pdf .= $tmp; $tmp = '';
+
+ $pdf .="

";
+ $tmp .= "
";
+}
+
+$tmp .="";
+$raw .= $tmp; $pdf .= $tmp; $tmp = '';
+echo $pdf;
+?>
\ No newline at end of file
diff --git a/tests/unit/ReportTest.php b/tests/unit/ReportTest.php
new file mode 100644
index 0000000..8267053
--- /dev/null
+++ b/tests/unit/ReportTest.php
@@ -0,0 +1,71 @@
+db = \Config\Database::connect();
+ }
+
+ public function testReportHelperInitialization()
+ {
+ $helper = new \App\Libraries\ReportHelper($this->db);
+ $this->assertInstanceOf(\App\Libraries\ReportHelper::class, $helper);
+ }
+
+ public function testCutDataFunction()
+ {
+ $helper = new \App\Libraries\ReportHelper($this->db);
+
+ $shortText = "This is short";
+ $result = $this->invokeMethod($helper, 'cutData', [$shortText]);
+ $this->assertEquals($shortText, $result);
+
+ $longText = "This is a very long text that should be cut into two parts because it exceeds ninety five characters in total length";
+ $result = $this->invokeMethod($helper, 'cutData', [$longText]);
+ $this->assertStringContainsString("\r\n", $result);
+ }
+
+ public function testGetHost()
+ {
+ $helper = new \App\Libraries\ReportHelper($this->db);
+ $result = $this->invokeMethod($helper, 'getHost', ['INVALID123']);
+ $this->assertIsString($result);
+ }
+
+ public function testGetNotes()
+ {
+ $helper = new \App\Libraries\ReportHelper($this->db);
+ $result = $this->invokeMethod($helper, 'getNotes', ['INVALID123']);
+ $this->assertIsString($result);
+ }
+
+ public function testGetStatus()
+ {
+ $helper = new \App\Libraries\ReportHelper($this->db);
+ $result = $this->invokeMethod($helper, 'getStatus', ['INVALID123']);
+ $this->assertIsString($result);
+ }
+
+ public function testGetValBy()
+ {
+ $helper = new \App\Libraries\ReportHelper($this->db);
+ $result = $this->invokeMethod($helper, 'getValBy', ['INVALID123']);
+ $this->assertIsString($result);
+ }
+
+ protected function invokeMethod(&$object, $methodName, array $parameters = [])
+ {
+ $reflection = new \ReflectionClass(get_class($object));
+ $method = $reflection->getMethod($methodName);
+ $method->setAccessible(true);
+ return $method->invokeArgs($object, $parameters);
+ }
+}