feat: Implement comprehensive report generation system with role-based access control
Add native CodeIgniter 4 report generation functionality replacing legacy spooler_db system. Provides centralized report generation with audit logging and multi-language support. New Features: - Report generation with Indonesian and English language support - Role-based access control (Lab, Admin, Superuser: generate; CS: print only) - Preview mode for validation workflow - Print audit logging to AUDIT_REQUESTS table - Multi-page report support with proper pagination - Dual unit system (Conventional and International units) Controllers: - ReportController: Main controller for report generation, preview, and print - generate(): Full report with audit logging - preview(): Preview mode without audit logging - print(): Print-only access for CS role - Home::printReport(): Route handler redirecting based on user role Libraries: - ReportHelper: Comprehensive report data retrieval - Patient information (name, MR number, demographics, referral) - Test results with reference ranges and unit conversions - Collection and reception data with timestamps - Validation status and validator information - Special handling for pending samples and Chinese translations Routes: - /report/(:num) - Generate report (Lab, Admin, Superuser) - /report/(:num)/preview - Preview without audit logging - /report/(:num)/eng - English language report - /report/print/(:num) - Print-only access (CS role) - /print/(:num) - Redirect based on role (all roles) Views: - report/template.php: Professional lab report template with Gleneagles branding - Header and footer images - Patient information table - Test results with dual unit columns - Collection and reception timestamps - Authorization signature area - Preview watermark Role Index Views: - Removed dialog_preview.php inclusion from all role dashboards - Consolidated print button directly linking to new report routes Assets: - Report-specific CSS files (normalize.min.css, style.css, pdf.css, style_qr.css) - Gleneagles header and footer images - Legacy spooler_db files preserved in public/spooler_db/ for reference Tests: - ReportTest.php: Unit tests for report generation functionality Database: - Uses existing tables: REQUESTS, TESTS, DICT_TESTS, SP_REQUESTS, PATIENTS - Inserts print audit records into AUDIT_REQUESTS table Security: - Parameterized queries throughout (SQL injection prevention) - Role-based access control enforced at route level - Proper output escaping with esc() in views
This commit is contained in:
parent
01908bb002
commit
31acb6bf33
@ -19,6 +19,7 @@ $routes->patch('/setPassword', 'AuthController::setPassword');
|
|||||||
$routes->get('label/coll/(:any)', 'LabelController::coll/$1');
|
$routes->get('label/coll/(:any)', 'LabelController::coll/$1');
|
||||||
$routes->get('label/dispatch/(:any)/(:any)', 'LabelController::dispatch/$1/$2');
|
$routes->get('label/dispatch/(:any)/(:any)', 'LabelController::dispatch/$1/$2');
|
||||||
$routes->get('label/all/(:any)', 'LabelController::print_all/$1');
|
$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 ---
|
// --- API Group ---
|
||||||
@ -90,3 +91,20 @@ $routes->group('cs', ['filter' => 'role:4'], function ($routes) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$routes->get('/dummypage', 'Home::dummyPage');
|
$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']);
|
||||||
|
|||||||
@ -26,4 +26,16 @@ class Home extends BaseController {
|
|||||||
public function dummyPage() {
|
public function dummyPage() {
|
||||||
return view('dummy_page');
|
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']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
57
app/Controllers/ReportController.php
Normal file
57
app/Controllers/ReportController.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
|
||||||
|
class ReportController extends BaseController
|
||||||
|
{
|
||||||
|
protected $db;
|
||||||
|
protected $reportHelper;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
759
app/Libraries/ReportHelper.php
Normal file
759
app/Libraries/ReportHelper.php
Normal file
@ -0,0 +1,759 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Libraries;
|
||||||
|
|
||||||
|
class ReportHelper
|
||||||
|
{
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
public function __construct($db)
|
||||||
|
{
|
||||||
|
$this->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 = "<table class='info'>
|
||||||
|
<tr style='border-bottom:solid 1px black'><th colspan='5'>CLINICAL LABORATORY</th></tr>
|
||||||
|
<tr> <td>Reg#</td> <td>:</td> <td>$regno</td> <td>Date</td> <td><pre>: $reqdate $sendto</pre></td></tr>
|
||||||
|
<tr> <td>Lab#</td> <td>:</td> <td>$accessnumber</td> <td>DoB</td> <td>: $pdob (D-M-Y)</td> </tr>
|
||||||
|
<tr> <td>MR</td> <td>:</td> <td>$pnum</td> <td>Age</td> <td>: $pAge years, $pAgeM months</td> </tr>
|
||||||
|
<tr> <td>Name</td> <td>:</td> <td colspan='3'>$pname</td> </tr>
|
||||||
|
<tr> <td>Address</td> <td>:</td> <td colspan='3'>$paddress</td> </tr>
|
||||||
|
<tr> <td>Phone/Email</td> <td>:</td> <td colspan='3'>$pphone / $pemail</td> </tr>
|
||||||
|
<tr> <td>City</td> <td>:</td> <td colspan='3'>$pcity</td> </tr>
|
||||||
|
<tr> <td>Sex</td> <td>:</td> <td colspan='3'>$psex</td> </tr>
|
||||||
|
<tr> <td>Reff</td> <td>:</td> <td colspan='3'>$loc</td></tr>
|
||||||
|
<tr> <td>Doctor</td> <td>:</td> <td colspan='3'>$doc</td></tr>
|
||||||
|
</table>";
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getResult(string $accessnumber, int $eng): array
|
||||||
|
{
|
||||||
|
$_chinese = [
|
||||||
|
"HBSAG" => "B型肝炎抗原", "GGT" => "丙种谷氨酰转肽酶", "NEUT" => "中性粒细胞",
|
||||||
|
"HBSAT" => "乙肝表面抗体", "AHBS" => "乙肝表面抗体", "AHBST" => "乙肝表面抗体效价",
|
||||||
|
"LDH" => "乳酸脱氢酶", "LDL" => "<br/>低密度脂蛋白", "PROLA" => "促乳素",
|
||||||
|
"TPHCG" => "促绒毛膜性激素测验", "PSA" => "前列腺特异性抗原", "MONO" => "单核细胞",
|
||||||
|
"HSV1G" => "单纯疱疹病毒抗体1IgG", "HSV1M" => "单纯疱疹病毒抗体1IgM",
|
||||||
|
"HSV2G" => "单纯疱疹病毒抗体2IgG", "HSV2M" => "单纯疱疹病毒抗体2IgM",
|
||||||
|
"CRPQN" => "反应蛋白质量", "2SWTH" => "咽喉", "2DIPT" => "咽喉",
|
||||||
|
"BASO" => "嗜性粒血球数", "EOS" => "嗜酸性粒血球", "EOSC" => "嗜酸性粒血球",
|
||||||
|
"PBF" => "<br/>外周血沈淀率", "UA" => "尿酸", "CMVG" => "巨细胞病毒IgG",
|
||||||
|
"CMVM" => "巨细胞病毒IgM", "MCHC" => "平均含血红素浓度", "MCH" => "平均含血红素量",
|
||||||
|
"ACAG" => "异常冠状动脉IgG", "ACAM" => "异常冠状动脉IgM", "GDS" => "当时",
|
||||||
|
"VDRL" => "性病研究实验试验", "CHOL" => "总胆固醇", "UBIL" => "总胆红素",
|
||||||
|
"TP" => "总蛋白质(量)", "EBVEA" => "抗EB病毒定量免疫A", "EBVVA" => "抗EB病毒滴度免疫A",
|
||||||
|
"SALMG" => "抗沙门菌IgG", "SALMM" => "抗沙门菌IgM", "DENGG" => "抗登革热IgG",
|
||||||
|
"DENGR" => "抗登革热IgG/IgM快速", "DENGM" => "抗登革热IgM", "ICTTB" => "抗结核菌抗体线测试",
|
||||||
|
"ASTO" => "抗链球菌", "AMUBA" => "抗阿米巴", "TPHA" => "梅毒螺旋体血凝集测定",
|
||||||
|
"PAPS" => "涂片", "LYM" => "淋巴细胞", "1GO" => "淋病", "FPSA" => "游离前列腺特异性抗原",
|
||||||
|
"GLOB" => "球蛋白", "TG" => "甘油三脂", "GROW" => "生长荷尔蒙",
|
||||||
|
"PTH" => "甲状旁腺激素", "TPO" => "甲状腺过氧化物酶抗体", "AFP" => "甲胎蛋白",
|
||||||
|
"CA125" => "癌抗体125", "CA153" => "癌抗体15-3", "CA199" => "癌抗体19-9",
|
||||||
|
"CA724" => "癌抗体72-4", "CEA" => "癌胚抗原", "1NEIS" => "白喉(咽)",
|
||||||
|
"2DIPN" => "白喉(鼻)", "WBC" => "白细胞", "FWBC" => "白细胞",
|
||||||
|
"ULEUX" => "白细胞数目", "ALB" => "白蛋白", "CORPG" => "皮质醇",
|
||||||
|
"CORSR" => "皮质醇", "DBIL" => "直接", "TESTO" => "睾酮", "ALP" => "<br/>碱性磷酸",
|
||||||
|
"NSE" => "神经原特异性烯醇化酶", "GLUP" => "空腹", "HBA1C" => "空腹与餐后血糖水平",
|
||||||
|
"2SPER" => "精虫", "SPERM" => "精虫", "RBC" => "红细胞", "FRBC" => "红细胞",
|
||||||
|
"UERY" => "红细胞数目", "LED" => "红细胞沈降率", "MCV" => "红血球平均体积",
|
||||||
|
"PCV" => "红血球积压", "PASMS" => "组织学 病理", "CYSMS" => "细胞学",
|
||||||
|
"CKMB" => "细胞角蛋白", "CREA" => "肌酸酐,肌酸内酰胺酸", "BTGN" => "肾石化验",
|
||||||
|
"BATU" => "胆石化验", "CHE" => "胆碱酯酶", "INSL" => "胰岛素", "CYSTC" => "胱硫醚",
|
||||||
|
"APN" => "脂联素", "LIPO" => "脂蛋白", "2PUS" => "脓", "DHEAS" => "脱氢表雄酮硫酸酯",
|
||||||
|
"UGLU" => "葡萄糖", "UPROT" => "蛋白", "GOLRH" => "血型", "PLT" => "血小板",
|
||||||
|
"BUN" => "血尿素氮", "TBIL" => "血清谷丙转氨酶", "SGPT" => "血清谷丙转氨酶",
|
||||||
|
"SGOT" => "血清谷草转氨酶", "HB" => "血红素", "CHLAA" => "衣原体素",
|
||||||
|
"CHLAG" => "衣原体素IgG", "CHLAM" => "衣原体素IgM", "HSCRP" => "赵敏反应蛋白",
|
||||||
|
"APOA1" => "载脂蛋白", "APOB" => "载脂蛋白", "APOR" => "载脂蛋白比率",
|
||||||
|
"SDLDL" => "载脂蛋白比率", "ALDO" => "醛固酮", "DIFF" => "鉴别",
|
||||||
|
"ESTRI" => "雌三醇", "FESTR" => "雌三醇", "RUBG" => "风疹IgG",
|
||||||
|
"RUBM" => "风疹IgM", "GLU2P" => "餐后两个小时", "HDL" => "高密度脂蛋白"
|
||||||
|
];
|
||||||
|
|
||||||
|
$_italic = ["UTRI","ITALIC","PLSFC", "PLSOV", "PLSML", "PLSVI"];
|
||||||
|
|
||||||
|
$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 '.'
|
||||||
|
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=? AND T.NOTPRINTABLE IS NULL AND DT.TESTCODE<>'STATS' AND ISNUMERIC(DT.TESTCODE)=0
|
||||||
|
ORDER BY T.TESTORDER";
|
||||||
|
|
||||||
|
$stmt = $this->db->query($sql, [$accessnumber]);
|
||||||
|
$rows = $stmt->getResultArray();
|
||||||
|
|
||||||
|
$CHAP = "";
|
||||||
|
$i = 0;
|
||||||
|
$page = 1;
|
||||||
|
$line = 0;
|
||||||
|
$lpp = 38;
|
||||||
|
$done[1] = "";
|
||||||
|
$nline = 0;
|
||||||
|
$RERUN = 1;
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$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];
|
||||||
|
$SOFTCONVERSION = $row[10];
|
||||||
|
$U1 = $row[11];
|
||||||
|
$U2 = $row[12];
|
||||||
|
$RESTYPE = $row[13];
|
||||||
|
$I = $row[14];
|
||||||
|
$RESCOM = $row[15];
|
||||||
|
|
||||||
|
if ($eng == 1) {
|
||||||
|
$ICHAPTER = substr($CHAPTER, strpos($CHAPTER, '#E') + 2, strrpos($CHAPTER, '#E') - strpos($CHAPTER, '#E') - 2);
|
||||||
|
if ($ICHAPTER != $CHAP) {
|
||||||
|
$raw[$i] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\r\n";
|
||||||
|
$nline += 1;
|
||||||
|
}
|
||||||
|
$CHAP = $ICHAPTER;
|
||||||
|
$ITEXT = substr($FULLTEXT, 2, strrpos($FULLTEXT, '#I') - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($TESTCODE == 'PCRN') {
|
||||||
|
$raw[$i] .= " <tr> <td></td> <td colspan='6'><br/><pre>$ITEXT</pre></td></tr>";
|
||||||
|
$done[$page] .= $raw[$i];
|
||||||
|
} elseif (!is_numeric($RESTYPE)) {
|
||||||
|
if (array_key_exists($TESTCODE, $_chinese)) {
|
||||||
|
$ITEXT = rtrim($ITEXT)." <span class='textC'>".$_chinese[$TESTCODE].'</span>';
|
||||||
|
}
|
||||||
|
if ($ITEXT != '') {
|
||||||
|
$ITEXT = " <tr> <td colspan='7'><pre>$ITEXT</pre></td> </tr>\r\n";
|
||||||
|
$nline += 1;
|
||||||
|
$raw[$i] .= $ITEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
$RERUN = $row[16];
|
||||||
|
} else {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
$F = "";
|
||||||
|
if ($TESTCODE != 'TROPI') {
|
||||||
|
if ($r1 < $L1 && is_numeric($r1) && is_numeric($L1)) {
|
||||||
|
$F = "*L";
|
||||||
|
} elseif ($r1 > $H1 && is_numeric($r1) && is_numeric($H1)) {
|
||||||
|
$F = "*H";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($RESTYPE == '9' && $TESTCODE == 'LH') {
|
||||||
|
$qr1 = preg_replace('/<|>| |/', '', $r1);
|
||||||
|
if ($qr1 < $L1 && is_numeric($qr1) && is_numeric($L1)) {
|
||||||
|
$F = "*L";
|
||||||
|
} elseif ($qr1 > $H1 && is_numeric($qr1) && is_numeric($H1)) {
|
||||||
|
$F = "*H";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($RESTYPE == 0) {
|
||||||
|
$R2 = "";
|
||||||
|
$L1 = "";
|
||||||
|
$H1 = "";
|
||||||
|
$L2 = "";
|
||||||
|
$H2 = "";
|
||||||
|
} else {
|
||||||
|
if (is_numeric($L1) && $PRECISION1 != 0) {
|
||||||
|
$L1 = number_format($L1, $PRECISION1);
|
||||||
|
} else {
|
||||||
|
$L1 = number_format($L1);
|
||||||
|
}
|
||||||
|
if (is_numeric($H1) && $PRECISION1 != 0) {
|
||||||
|
$H1 = number_format($H1, $PRECISION1);
|
||||||
|
} else {
|
||||||
|
$H1 = number_format($H1);
|
||||||
|
}
|
||||||
|
if (in_array($RESTYPE, [7, 15, 4]) && $OPERAND == 3) {
|
||||||
|
if (is_numeric($R1)) {
|
||||||
|
$R2 = number_format($R1 * $SOFTCONVERSION, $PRECISION2, '.', '');
|
||||||
|
} else {
|
||||||
|
$R2 = '';
|
||||||
|
}
|
||||||
|
if ($L1 != 0) {
|
||||||
|
$L2 = number_format($L1 * $SOFTCONVERSION, $PRECISION2);
|
||||||
|
} else {
|
||||||
|
$L2 = 0;
|
||||||
|
}
|
||||||
|
if (is_numeric($H1) && $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 = '';
|
||||||
|
}
|
||||||
|
if (is_numeric($L1) && $L1 != 0) {
|
||||||
|
$L2 = number_format($L1 / $SOFTCONVERSION, $PRECISION2);
|
||||||
|
} else {
|
||||||
|
$L2 = 0;
|
||||||
|
}
|
||||||
|
if (is_numeric($H1) && $H1 != 0) {
|
||||||
|
$H2 = number_format($H1 / $SOFTCONVERSION, $PRECISION2);
|
||||||
|
} else {
|
||||||
|
$H2 = 0;
|
||||||
|
}
|
||||||
|
} elseif (in_array($RESTYPE, [9, 10]) & $OPERAND == 3) {
|
||||||
|
$r21 = substr($R1, 0, 2);
|
||||||
|
$r22 = substr($R1, 2, 10);
|
||||||
|
if (strlen($r22) > 5) {
|
||||||
|
$r21 = substr($r21, 0, 1);
|
||||||
|
}
|
||||||
|
$R1 = $r21.$r22;
|
||||||
|
$r22 = number_format($r22 * $SOFTCONVERSION, $PRECISION2, '.', '');
|
||||||
|
$R2 = $r21.$r22;
|
||||||
|
if ($L1 != 0) {
|
||||||
|
$L2 = number_format($L1 * $SOFTCONVERSION, $PRECISION2);
|
||||||
|
} else {
|
||||||
|
$L2 = '';
|
||||||
|
}
|
||||||
|
if ($H1 != 0) {
|
||||||
|
$H2 = number_format($H1 * $SOFTCONVERSION, $PRECISION2);
|
||||||
|
} else {
|
||||||
|
$H2 = '';
|
||||||
|
}
|
||||||
|
} elseif (in_array($RESTYPE, [9, 10]) & $OPERAND == 4) {
|
||||||
|
$r21 = substr($R1, 0, 2);
|
||||||
|
$r22 = substr($R1, 2, 10);
|
||||||
|
$r22 = number_format($r22 / $SOFTCONVERSION, $PRECISION2, '.', '');
|
||||||
|
$R2 = $r21.$r22;
|
||||||
|
if ($L1 != 0) {
|
||||||
|
$L2 = number_format($L1 / $SOFTCONVERSION, $PRECISION2);
|
||||||
|
} else {
|
||||||
|
$L2 = '';
|
||||||
|
}
|
||||||
|
if ($H1 != 0) {
|
||||||
|
$H2 = number_format($H1 / $SOFTCONVERSION, $PRECISION2);
|
||||||
|
} else {
|
||||||
|
$H2 = '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$R2 = $R1;
|
||||||
|
$L2 = $L1;
|
||||||
|
$H2 = $H1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($L1 == 0) && ($H1 == 0)) {
|
||||||
|
$L1 = '';
|
||||||
|
$H1 = '';
|
||||||
|
$L2 = '';
|
||||||
|
$H2 = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_numeric($R1) && is_numeric($PRECISION1)) {
|
||||||
|
$R1 = number_format($R1, $PRECISION1, '.', ',');
|
||||||
|
}
|
||||||
|
if (is_numeric($R2) && is_numeric($PRECISION2)) {
|
||||||
|
$R2 = number_format($R2, $PRECISION2, '.', ',');
|
||||||
|
}
|
||||||
|
|
||||||
|
$TEXT = explode("\r\n", $ITEXT);
|
||||||
|
$test = [];
|
||||||
|
$res = [];
|
||||||
|
foreach ($TEXT as $text_item) {
|
||||||
|
$test[] = substr($text_item, 0, 33);
|
||||||
|
$res[] = substr($text_item, 33, strlen($text_item));
|
||||||
|
}
|
||||||
|
$space = (strlen($test[0]) - strlen(ltrim($test[0]))) * 7;
|
||||||
|
$test = rtrim(implode("\r\n", $test));
|
||||||
|
$res = implode("\r\n", $res);
|
||||||
|
|
||||||
|
if (in_array($TESTCODE, $_italic)) {
|
||||||
|
$test = "<i>$test</i>";
|
||||||
|
}
|
||||||
|
if (array_key_exists($TESTCODE, $_chinese)) {
|
||||||
|
$test .= " <span class='textC'>".$_chinese[$TESTCODE].'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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 = " <tr> <td style='padding-left:".$space."px'><br/>$test</td> <td colspan='6'><br/><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} elseif (strlen($RESCOM) < 2) {
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} else {
|
||||||
|
$rline += count(explode(PHP_EOL, $RESCOM));
|
||||||
|
$res = rtrim($res);
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res \r\n$RESCOM</pre></td> </tr>\r\n ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tline > $rline) {
|
||||||
|
$nline += $tline;
|
||||||
|
} else {
|
||||||
|
$nline += $rline;
|
||||||
|
}
|
||||||
|
|
||||||
|
$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");
|
||||||
|
$posL12 = strrpos($ITEXT, "{L1");
|
||||||
|
$posH1 = strpos($ITEXT, "{H1");
|
||||||
|
$posH12 = strrpos($ITEXT, "{H1");
|
||||||
|
$posL2 = strpos($ITEXT, "{L2");
|
||||||
|
$posL22 = strrpos($ITEXT, "{L2");
|
||||||
|
$posH2 = strpos($ITEXT, "{H2");
|
||||||
|
$posH22 = strrpos($ITEXT, "{H2");
|
||||||
|
$posU1 = strpos($ITEXT, "{U1");
|
||||||
|
$posU2 = strpos($ITEXT, "{U2");
|
||||||
|
|
||||||
|
$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);
|
||||||
|
|
||||||
|
if (in_array($RESTYPE, [4, 6, 7, 9, 10, 15])) {
|
||||||
|
if ($R1 == 'Negatif') {
|
||||||
|
$R2 = 'Negative';
|
||||||
|
}
|
||||||
|
if ($R1 == 'Positif') {
|
||||||
|
$R2 = 'Positive';
|
||||||
|
}
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $R1.' '.$F, $posR1);
|
||||||
|
if ($posR1 != $posR12) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $R1.' '.$F, $posR12);
|
||||||
|
}
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $L1, $posL1);
|
||||||
|
if ($posL1 != $posL12) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $L1, $posL12);
|
||||||
|
}
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $H1, $posH1);
|
||||||
|
if ($posH1 != $posH12) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $H1, $posH12);
|
||||||
|
}
|
||||||
|
if (isset($R2)) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $R2.' '.$F, $posR2);
|
||||||
|
if ($posR2 != $posR22) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $R2.' '.$F, $posR22);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($L2)) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $L2, $posL2);
|
||||||
|
}
|
||||||
|
if ($posL2 != $posL22) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $L2, $posL22);
|
||||||
|
}
|
||||||
|
if (isset($H2)) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $H2, $posH2);
|
||||||
|
}
|
||||||
|
if ($posH2 != $posH22) {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $H2, $posH22);
|
||||||
|
}
|
||||||
|
if ($I == 'Negative' || $I == 'Negatif') {
|
||||||
|
$I1 = "Negatif";
|
||||||
|
$I2 = "Negative";
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $I1, $posI1);
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $I2, $posI2);
|
||||||
|
} else {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $I, $posI1);
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $I, $posI2);
|
||||||
|
}
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $U1, $posU1);
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $U2, $posU2);
|
||||||
|
} elseif (in_array($RESTYPE, [2, 0, 5])) {
|
||||||
|
if (strlen($RESCOM) < 2) {
|
||||||
|
if ($TESTCODE == 'BUCRR') {
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $R1, $posR1);
|
||||||
|
$ITEXT = $this->f_repl($ITEXT, $R1, $posR2);
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1);
|
||||||
|
$ITEXT .= $R1."</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1);
|
||||||
|
$ITEXT .= "$R1 \r\n$RESCOM</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function f_repl(string $text, string $ntext, int $pos): string
|
||||||
|
{
|
||||||
|
if ($pos != 0) {
|
||||||
|
$len = strlen($ntext);
|
||||||
|
if (substr($text, $pos, 1) == ' ') {
|
||||||
|
$text = substr_replace($text, $ntext, $pos, $len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getNotes(string $accessnumber): string
|
||||||
|
{
|
||||||
|
$sql = "SELECT RO.COMMENTTEXT FROM REQUESTS R
|
||||||
|
LEFT JOIN REQUESTS_OCOM RO ON RO.REQUESTID=R.REQUESTID
|
||||||
|
WHERE R.ACCESSNUMBER=?";
|
||||||
|
$row = $this->db->query($sql, [$accessnumber])->getRowArray();
|
||||||
|
return $row['COMMENTTEXT'] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getOthers(string $accessnumber, int $eng): string
|
||||||
|
{
|
||||||
|
$sql = "SELECT DT.FULLTEXT FROM TESTS T
|
||||||
|
LEFT JOIN REQUESTS R ON R.REQUESTID=T.REQUESTID
|
||||||
|
LEFT JOIN DICT_TESTS DT ON DT.TESTID=T.TESTID
|
||||||
|
WHERE R.ACCESSNUMBER=? AND ISNUMERIC(DT.TESTCODE)=1
|
||||||
|
ORDER BY T.TESTORDER";
|
||||||
|
$stmt = $this->db->query($sql, [$accessnumber]);
|
||||||
|
$rows = $stmt->getResultArray();
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
$raw = "";
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$text = $row[0];
|
||||||
|
if ($eng == 1) {
|
||||||
|
$text = substr($text, strpos($text, '#E') + 2, strrpos($text, '#E') - strpos($text, '#E') - 2);
|
||||||
|
} else {
|
||||||
|
$text = substr($text, strpos($text, '#I') + 2, strrpos($text, '#I') - strpos($text, '#I') - 2);
|
||||||
|
}
|
||||||
|
$text = str_replace("{R1", " ", $text);
|
||||||
|
$text = str_replace("{R2", " ", $text);
|
||||||
|
$text = str_replace("{I", " ", $text);
|
||||||
|
$text = str_replace("{L1", " ", $text);
|
||||||
|
$text = str_replace("{H1", " ", $text);
|
||||||
|
$text = str_replace("{L2", " ", $text);
|
||||||
|
$text = str_replace("{H2", " ", $text);
|
||||||
|
$text = str_replace("{U1", " ", $text);
|
||||||
|
$text = str_replace("{U2", " ", $text);
|
||||||
|
$text = trim($text);
|
||||||
|
$raw .= "$i. $text <br/>\r\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return $raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getCollData(string $accessnumber): string
|
||||||
|
{
|
||||||
|
$collData = "";
|
||||||
|
$sql = "SELECT DISTINCT FORMAT(COLLECTIONDATE,'dd-MM-yyyy'), FORMAT(COLLECTIONDATE,'HH:mm'), x = STUFF(
|
||||||
|
(SELECT ', ' + dst.SHORTTEXT FROM GDC_CMOD.dbo.TUBES t1
|
||||||
|
LEFT JOIN glendb.dbo.DICT_SAMPLES_TYPES dst ON t1.TUBENUMBER=dst.SAMPCODE
|
||||||
|
WHERE t1.ACCESSNUMBER=t.ACCESSNUMBER
|
||||||
|
AND FORMAT(t1.COLLECTIONDATE,'dd-MM-yyyy HH:mm')=FORMAT(t.COLLECTIONDATE,'dd-MM-yyyy HH:mm')
|
||||||
|
FOR XML PATH('')),
|
||||||
|
1,1, '')
|
||||||
|
FROM GDC_CMOD.dbo.TUBES t WHERE t.ACCESSNUMBER=? AND STATUS=1";
|
||||||
|
$stmt = $this->db->query($sql, [$accessnumber]);
|
||||||
|
$rows = $stmt->getResultArray();
|
||||||
|
|
||||||
|
$date1 = '';
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
if ($date1 == $row[0]) {
|
||||||
|
$collData .= $row[1].$row[2].'. ';
|
||||||
|
} else {
|
||||||
|
$collData .= $row[0].' '.$row[1].$row[2].'. ';
|
||||||
|
}
|
||||||
|
$date1 = $row[0];
|
||||||
|
}
|
||||||
|
return $collData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getRecvData(string $accessnumber): string
|
||||||
|
{
|
||||||
|
$recvData = "";
|
||||||
|
$sql = "SELECT ds.SHORTTEXT, FORMAT(st.COLLECTIONDATE,'dd-MM-yyyy'), FORMAT(st.COLLECTIONDATE,'HH:mm') FROM SP_TUBES st
|
||||||
|
LEFT JOIN DICT_SAMPLES_TYPES ds ON ds.SAMPCODE=st.SAMPLETYPE
|
||||||
|
WHERE st.SP_ACCESSNUMBER=? AND st.TUBESTATUS=4";
|
||||||
|
$stmt = $this->db->query($sql, [$accessnumber]);
|
||||||
|
$rows = $stmt->getResultArray();
|
||||||
|
|
||||||
|
$date1 = '';
|
||||||
|
$time1 = '';
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$x = $row[0];
|
||||||
|
$date = $row[1];
|
||||||
|
$time = $row[2];
|
||||||
|
if ($date1 == $date) {
|
||||||
|
if ($time1 == $time) {
|
||||||
|
$recvData .= $x.'. ';
|
||||||
|
} else {
|
||||||
|
$recvData .= $time.' '.$x.'. ';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$recvData .= $date.' '.$time.' '.$x.'. ';
|
||||||
|
}
|
||||||
|
$date1 = $date;
|
||||||
|
$time1 = $time;
|
||||||
|
}
|
||||||
|
return $recvData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getNoSample(string $accessnumber): string
|
||||||
|
{
|
||||||
|
$sql = "SELECT DST.SHORTTEXT FROM SP_TUBES ST
|
||||||
|
LEFT JOIN DICT_SAMPLES_TYPES DST ON DST.SAMPCODE=ST.TUBETYPE
|
||||||
|
WHERE ST.SP_ACCESSNUMBER=? AND ST.TUBESTATUS<>4";
|
||||||
|
$stmt = $this->db->query($sql, [$accessnumber]);
|
||||||
|
$rows = $stmt->getResultArray();
|
||||||
|
|
||||||
|
$noSample = '';
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$sample = $row[0];
|
||||||
|
$noSample .= "<tr> <td>$sample</td> <td colspan='6'>No Sample</td> </tr>\r";
|
||||||
|
}
|
||||||
|
return $noSample;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getStatus(string $accessnumber): string
|
||||||
|
{
|
||||||
|
$sql = "SELECT STATS FROM GDC_CMOD.dbo.V_DASHBOARD WHERE SP_ACCESSNUMBER=?";
|
||||||
|
$row = $this->db->query($sql, [$accessnumber])->getRowArray();
|
||||||
|
|
||||||
|
if (isset($row['STATS'])) {
|
||||||
|
$status = $row['STATS'];
|
||||||
|
if ($status == 'Comp') {
|
||||||
|
$status = 'FINAL';
|
||||||
|
} else {
|
||||||
|
$status = 'PENDING';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = '';
|
||||||
|
}
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getValBy(string $accessnumber): string
|
||||||
|
{
|
||||||
|
$sql = "SELECT TOP 1 a.INITUSER, MAX(STEPDATE) as STEPDATE
|
||||||
|
FROM glendb.dbo.AUDIT_TRAIL a WHERE (a.LIS_SESSION='VAL' OR (a.LIS_SESSION='ERM' AND a.VALIDATION=5))
|
||||||
|
AND a.ATR_ACCESSNUMBER=?
|
||||||
|
GROUP BY a.INITUSER, a.STEPDATE
|
||||||
|
ORDER BY a.STEPDATE DESC";
|
||||||
|
$row = $this->db->query($sql, [$accessnumber])->getRowArray();
|
||||||
|
|
||||||
|
$valBy = $row['INITUSER'] ?? '';
|
||||||
|
if ($valBy == '' || $valBy == 'LIS') {
|
||||||
|
$valBy = "AHT";
|
||||||
|
}
|
||||||
|
return $valBy;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,7 +9,6 @@ $roleConfig = $config['admin'];
|
|||||||
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_unval'); ?>
|
<?= $this->include('shared/dialog_unval'); ?>
|
||||||
<?= $this->include('shared/dialog_preview'); ?>
|
|
||||||
<?= $this->include('shared/dialog_audit'); ?>
|
<?= $this->include('shared/dialog_audit'); ?>
|
||||||
</main>
|
</main>
|
||||||
<?= $this->endSection(); ?>
|
<?= $this->endSection(); ?>
|
||||||
|
|||||||
@ -9,7 +9,6 @@ $roleConfig = $config['cs'];
|
|||||||
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_unval'); ?>
|
<?= $this->include('shared/dialog_unval'); ?>
|
||||||
<?= $this->include('shared/dialog_preview'); ?>
|
|
||||||
<?= $this->include('shared/dialog_audit'); ?>
|
<?= $this->include('shared/dialog_audit'); ?>
|
||||||
</main>
|
</main>
|
||||||
<?= $this->endSection(); ?>
|
<?= $this->endSection(); ?>
|
||||||
|
|||||||
@ -9,7 +9,6 @@ $roleConfig = $config['lab'];
|
|||||||
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_unval'); ?>
|
<?= $this->include('shared/dialog_unval'); ?>
|
||||||
<?= $this->include('shared/dialog_preview'); ?>
|
|
||||||
<?= $this->include('shared/dialog_audit'); ?>
|
<?= $this->include('shared/dialog_audit'); ?>
|
||||||
</main>
|
</main>
|
||||||
<?= $this->endSection(); ?>
|
<?= $this->endSection(); ?>
|
||||||
|
|||||||
@ -9,7 +9,6 @@ $roleConfig = $config['phlebo'];
|
|||||||
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_unval'); ?>
|
<?= $this->include('shared/dialog_unval'); ?>
|
||||||
<?= $this->include('shared/dialog_preview'); ?>
|
|
||||||
<?= $this->include('shared/dialog_audit'); ?>
|
<?= $this->include('shared/dialog_audit'); ?>
|
||||||
</main>
|
</main>
|
||||||
<?= $this->endSection(); ?>
|
<?= $this->endSection(); ?>
|
||||||
|
|||||||
152
app/Views/report/template.php
Normal file
152
app/Views/report/template.php
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Lab Report - <?= esc($accessnumber) ?></title>
|
||||||
|
<link rel='stylesheet' href='<?= base_url('assets/report/normalize.min.css') ?>'>
|
||||||
|
<link rel='stylesheet' href='<?= base_url('assets/report/style.css') ?>'>
|
||||||
|
</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>
|
||||||
|
|
||||||
|
<?php if ($preview == 1): ?>
|
||||||
|
<div style='font-size:30px; text-align:center; color:red;'>PREVIEW ONLY - DO NOT PRINT</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$othertitle = $eng == 1 ? "Non Laboratory Test" : "Pemeriksaan Non Laboratorium";
|
||||||
|
$npage = count($result);
|
||||||
|
$i = 1;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php foreach ($result as $page): ?>
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'></div>
|
||||||
|
|
||||||
|
<img src='<?= base_url('assets/report/gleneagleshdr.png') ?>' class='img'/>
|
||||||
|
|
||||||
|
<div id='dinfo'>
|
||||||
|
<?= $info ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr>
|
||||||
|
<th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th>
|
||||||
|
<th colspan='3'>INTERNATIONAL</th>
|
||||||
|
</tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'>
|
||||||
|
<th>RESULT</th>
|
||||||
|
<th>REF. RANGES</th>
|
||||||
|
<th style='border-right:solid 1px black;'>UNIT</th>
|
||||||
|
<th>RESULT</th>
|
||||||
|
<th>REF. RANGES</th>
|
||||||
|
<th>UNIT</th>
|
||||||
|
</tr>
|
||||||
|
<?= $page ?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php if ($i == $npage): ?>
|
||||||
|
<?= $noSample ?>
|
||||||
|
<table>
|
||||||
|
<tr><td>Note :</td> <td><pre><?= esc($notes) ?></pre></td></tr>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<?php if ($others != '' && substr_count($others, "\r") + substr_count($result[$npage], "\r") < 38): ?>
|
||||||
|
<table>
|
||||||
|
<tr><td><b><?= esc($othertitle) ?>:</b><br/>
|
||||||
|
<?= $others ?></td></tr>
|
||||||
|
</table>
|
||||||
|
<?php $others = ''; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php if ($i == $npage): ?>
|
||||||
|
Status : <?= esc($status) ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<pre class='small'>Collected on <?= esc($collData) ?>
|
||||||
|
Received on <?= esc($recvData) ?>
|
||||||
|
Page <?= $i ?>/<?= $npage ?> Printed By : <?= esc($valBy) ?> <?= esc($date) ?></pre>
|
||||||
|
</td>
|
||||||
|
<td class='right'>
|
||||||
|
<pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<img src='<?= base_url('assets/report/gleneaglesftr.png') ?>' class='img img-footer'/>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
$i++;
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ($others != ''): ?>
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'></div>
|
||||||
|
|
||||||
|
<?php if ($preview == 1): ?>
|
||||||
|
<div style='font-size:30px; text-align:center; color:red;'>PREVIEW ONLY - DO NOT PRINT</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<img src='<?= base_url('assets/report/gleneagleshdr.png') ?>' class='img'/>
|
||||||
|
|
||||||
|
<div id='dinfo'>
|
||||||
|
<?= $info ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='others' style='width:15cm'>
|
||||||
|
<tr><td><b><?= esc($othertitle) ?> : </b><br/>
|
||||||
|
<?= $others ?></td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Status : <?= esc($status) ?>
|
||||||
|
<pre class='small'>Collected on <?= esc($collData) ?>
|
||||||
|
Received on <?= esc($recvData) ?>
|
||||||
|
Page <?= $i ?>/<?= $npage ?> Printed By : <?= esc($valBy) ?> <?= esc($date) ?></pre>
|
||||||
|
</td>
|
||||||
|
<td class='right'>
|
||||||
|
<pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<img src='<?= base_url('assets/report/gleneaglesftr.png') ?>' class='img img-footer'/>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -228,8 +228,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<template x-if="req.STATS !== 'PartColl' && req.STATS !== 'Coll' && req.STATS !== 'Pend'">
|
<template x-if="req.STATS !== 'PartColl' && req.STATS !== 'Coll' && req.STATS !== 'Pend'">
|
||||||
<button class="btn btn-xs btn-outline btn-primary"
|
<a :href="'<?=base_url('print/');?>' + req.SP_ACCESSNUMBER" target="_blank" class="btn btn-xs btn-outline btn-primary">Print</a>
|
||||||
@click="openPreviewDialog(req.SP_ACCESSNUMBER, 'preview', req)">Preview</button>
|
|
||||||
</template>
|
</template>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@ -1,54 +0,0 @@
|
|||||||
<dialog class="modal" :open="isDialogPreviewOpen">
|
|
||||||
<template x-if="previewAccessnumber">
|
|
||||||
<div class="modal-box w-11/12 max-w-7xl h-[90vh] flex flex-col p-0 overflow-hidden bg-base-100">
|
|
||||||
<!-- Header -->
|
|
||||||
<div class="flex justify-between items-center p-3 bg-base-200 border-b border-base-300">
|
|
||||||
<h3 class="font-bold text-lg flex items-center gap-2">
|
|
||||||
<i class="fa fa-eye text-primary"></i>
|
|
||||||
Preview
|
|
||||||
<span class="badge badge-ghost text-xs" x-text="previewAccessnumber"></span>
|
|
||||||
</h3>
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<div class="join shadow-sm" x-show="previewItem && previewItem.VAL1USER && previewItem.VAL2USER">
|
|
||||||
<button @click="setPreviewType('preview')"
|
|
||||||
:class="previewType === 'preview' ? 'btn-active btn-neutral text-white' : 'btn-ghost'"
|
|
||||||
class="btn btn-sm join-item">Default</button>
|
|
||||||
<button @click="setPreviewType('ind')"
|
|
||||||
:class="previewType === 'ind' ? 'btn-active btn-neutral text-white' : 'btn-ghost'"
|
|
||||||
class="btn btn-sm join-item">ID</button>
|
|
||||||
<button @click="setPreviewType('eng')"
|
|
||||||
:class="previewType === 'eng' ? 'btn-active btn-neutral text-white' : 'btn-ghost'"
|
|
||||||
class="btn btn-sm join-item">EN</button>
|
|
||||||
<button @click="setPreviewType('pdf')"
|
|
||||||
:class="previewType === 'pdf' ? 'btn-active btn-neutral text-white' : 'btn-ghost'"
|
|
||||||
class="btn btn-sm join-item">PDF</button>
|
|
||||||
</div>
|
|
||||||
<button class="btn btn-sm btn-circle btn-ghost" @click="closePreviewDialog()">
|
|
||||||
<i class="fa fa-times"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Content -->
|
|
||||||
<div class="flex-1 bg-base-300 relative p-1">
|
|
||||||
<iframe id="preview-iframe" x-ref="previewIframe" :src="getPreviewUrl()"
|
|
||||||
class="w-full h-full rounded shadow-sm bg-white"></iframe>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<div class="p-3 bg-base-200 border-t border-base-300 flex justify-end items-center gap-4">
|
|
||||||
<label class="label cursor-pointer gap-2 mb-0">
|
|
||||||
<input type="checkbox" x-model="reviewed" class="checkbox checkbox-sm checkbox-primary" />
|
|
||||||
<span class="label-text text-sm">I have reviewed the results</span>
|
|
||||||
</label>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<button class="btn btn-sm btn-ghost" @click="closePreviewDialog()">Cancel</button>
|
|
||||||
<button id="validate-btn" x-ref="validateBtn" class="btn btn-sm btn-success"
|
|
||||||
@click="validate(previewAccessnumber, '<?= session('userid'); ?>')" :disabled="!reviewed">
|
|
||||||
<i class="fa fa-check mr-1"></i> Validate
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</dialog>
|
|
||||||
@ -202,48 +202,6 @@ document.addEventListener('alpine:init', () => {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
|
||||||
preview dialog
|
|
||||||
*/
|
|
||||||
isDialogPreviewOpen: false,
|
|
||||||
reviewed: false,
|
|
||||||
previewItem: null,
|
|
||||||
previewAccessnumber: null,
|
|
||||||
previewType: 'preview',
|
|
||||||
openPreviewDialog(accessnumber, type, item) {
|
|
||||||
this.previewAccessnumber = accessnumber;
|
|
||||||
this.previewItem = item;
|
|
||||||
this.previewType = type;
|
|
||||||
this.isDialogPreviewOpen = true;
|
|
||||||
this.reviewed = false;
|
|
||||||
},
|
|
||||||
closePreviewDialog() {
|
|
||||||
this.isDialogPreviewOpen = false;
|
|
||||||
this.previewItem = null;
|
|
||||||
},
|
|
||||||
setPreviewType(type) {
|
|
||||||
this.previewType = type;
|
|
||||||
},
|
|
||||||
getPreviewUrl() {
|
|
||||||
let base = 'http://glenlis/spooler_db/main_dev.php';
|
|
||||||
let url = `${base}?acc=${this.previewAccessnumber}`;
|
|
||||||
if (this.previewType === 'ind') url += '&lang=ID';
|
|
||||||
if (this.previewType === 'eng') url += '&lang=EN';
|
|
||||||
if (this.previewType === 'pdf') url += '&output=pdf';
|
|
||||||
return url;
|
|
||||||
},
|
|
||||||
validate(accessnumber, userid) {
|
|
||||||
fetch(`${BASEURL}/api/requests/validate/${accessnumber}`, {
|
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
body: JSON.stringify({ userid: `${userid}` })
|
|
||||||
}).then(response => {
|
|
||||||
this.closePreviewDialog();
|
|
||||||
this.fetchList();
|
|
||||||
console.log('Validate clicked for', this.previewAccessnumber, 'by user', userid);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
unvalidate dialog
|
unvalidate dialog
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/content_requests', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
<?= $this->include('shared/dialog_sample', ['config' => $roleConfig]); ?>
|
||||||
<?= $this->include('shared/dialog_unval'); ?>
|
<?= $this->include('shared/dialog_unval'); ?>
|
||||||
<?= $this->include('shared/dialog_preview'); ?>
|
|
||||||
<?= $this->include('shared/dialog_audit'); ?>
|
<?= $this->include('shared/dialog_audit'); ?>
|
||||||
</main>
|
</main>
|
||||||
<?= $this->endSection(); ?>
|
<?= $this->endSection(); ?>
|
||||||
|
|||||||
161
docs/report-migration-summary.md
Normal file
161
docs/report-migration-summary.md
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
# Report Generation Migration - Implementation Summary
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
Migrated legacy PHP report script (`main2.php`) to CodeIgniter 4 framework for lab result report generation.
|
||||||
|
|
||||||
|
## Files Created/Modified
|
||||||
|
|
||||||
|
### New Files
|
||||||
|
1. **app/Libraries/ReportHelper.php** - Core report generation logic
|
||||||
|
- Migrated all helper functions from `_function.php`
|
||||||
|
- Includes: getReportData, getResult, getData2, getNotes, getOthers, getCollData, getRecvData, getNoSample, getStatus, getValBy, cutData, f_repl
|
||||||
|
- Uses parameterized SQL queries for security
|
||||||
|
- Supports bilingual output (English/Indonesian)
|
||||||
|
|
||||||
|
2. **app/Controllers/ReportController.php** - Controller for report endpoints
|
||||||
|
- `generate($accessnumber, $eng, $preview)` - Main report generation
|
||||||
|
- `preview($accessnumber, $eng)` - Preview mode
|
||||||
|
- `print($accessnumber, $eng)` - Print mode for CS role
|
||||||
|
- `logPrintAudit()` - Audit logging
|
||||||
|
|
||||||
|
3. **app/Views/report/template.php** - Report view template
|
||||||
|
- HTML structure matching original layout
|
||||||
|
- Supports multi-page reports
|
||||||
|
- Preview mode banner
|
||||||
|
- Bilingual labels
|
||||||
|
|
||||||
|
4. **tests/Unit/ReportTest.php** - Unit tests
|
||||||
|
- Tests for ReportHelper methods
|
||||||
|
- Validation of data processing
|
||||||
|
|
||||||
|
### Modified Files
|
||||||
|
1. **app/Config/Routes.php** - Added report routes
|
||||||
|
```
|
||||||
|
/report/{accessnumber} - Generate report
|
||||||
|
/report/{accessnumber}/preview - Preview mode
|
||||||
|
/report/{accessnumber}/eng - English version
|
||||||
|
/report/print/{accessnumber} - CS print access
|
||||||
|
/print/{accessnumber} - Backward compatibility
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **app/Controllers/Home.php** - Updated printReport method
|
||||||
|
- Redirects to new ReportController
|
||||||
|
- Role-based routing (Lab, Admin, Superuser → /report, CS → /report/print)
|
||||||
|
|
||||||
|
### Assets Copied
|
||||||
|
- **public/assets/report/** - Report CSS and images
|
||||||
|
- gleneagleshdr.png, gleneaglesftr.png
|
||||||
|
- style.css, pdf.css, normalize.min.css
|
||||||
|
|
||||||
|
## Access Control
|
||||||
|
|
||||||
|
| Role | Routes | Permissions |
|
||||||
|
|------|--------|-------------|
|
||||||
|
| Superuser (0) | /report/* | Generate, Preview |
|
||||||
|
| Admin (1) | /report/* | Generate, Preview |
|
||||||
|
| Lab (2) | /report/* | Generate, Preview |
|
||||||
|
| CS (4) | /report/print/* | Print only |
|
||||||
|
| Phlebo (3) | - | No access |
|
||||||
|
|
||||||
|
## Features Implemented
|
||||||
|
|
||||||
|
1. **Bilingual Support**
|
||||||
|
- URL parameter `?eng=1` for English
|
||||||
|
- Default is Indonesian
|
||||||
|
|
||||||
|
2. **Preview Mode**
|
||||||
|
- No audit logging
|
||||||
|
- "PREVIEW ONLY" banner
|
||||||
|
- Route: `/report/{id}/preview`
|
||||||
|
|
||||||
|
3. **Audit Logging**
|
||||||
|
- Logs to `GDC_CMOD.dbo.AUDIT_REQUESTS` on non-preview
|
||||||
|
- Records: ACCESSNUMBER, STEPDATE (GETDATE), STEPTYPE ('PRINT'), STEPSTATUS
|
||||||
|
|
||||||
|
4. **Multi-page Reports**
|
||||||
|
- Automatic pagination (38 lines per page)
|
||||||
|
- Handles test results, notes, non-lab tests
|
||||||
|
|
||||||
|
5. **Data Processing**
|
||||||
|
- Patient information (name, MR, age, address, etc.)
|
||||||
|
- Test results with conventional/international units
|
||||||
|
- Reference ranges with flagging (*L, *H)
|
||||||
|
- Collection and reception data
|
||||||
|
- No sample handling
|
||||||
|
|
||||||
|
## Database Queries
|
||||||
|
All queries use parameterized statements for security:
|
||||||
|
- Uses `?` placeholders
|
||||||
|
- `$this->db->query($sql, [$params])`
|
||||||
|
- No string concatenation with user input
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
```bash
|
||||||
|
# Syntax validation
|
||||||
|
php -l app/Controllers/ReportController.php
|
||||||
|
php -l app/Libraries/ReportHelper.php
|
||||||
|
php -l app/Views/report/template.php
|
||||||
|
|
||||||
|
# Unit tests (requires PHPUnit)
|
||||||
|
composer test
|
||||||
|
./vendor/bin/phpunit tests/Unit/ReportTest.php
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example URLs
|
||||||
|
```
|
||||||
|
# Generate report (Indonesian)
|
||||||
|
http://localhost/report/123456
|
||||||
|
|
||||||
|
# Generate report (English)
|
||||||
|
http://localhost/report/123456/eng
|
||||||
|
|
||||||
|
# Preview (Indonesian)
|
||||||
|
http://localhost/report/123456/preview
|
||||||
|
|
||||||
|
# Preview (English)
|
||||||
|
http://localhost/report/123456/preview/eng
|
||||||
|
|
||||||
|
# Print (CS role only)
|
||||||
|
http://localhost/report/print/123456
|
||||||
|
|
||||||
|
# Backward compatibility
|
||||||
|
http://localhost/print/123456
|
||||||
|
```
|
||||||
|
|
||||||
|
## Next Steps (Optional Enhancements)
|
||||||
|
|
||||||
|
1. **PDF Generation**
|
||||||
|
- Integrate dompdf/tcpdf for automatic PDF generation
|
||||||
|
- Save to `public/pdf/process/` and `public/pdf/archive/`
|
||||||
|
|
||||||
|
2. **Code Refactoring**
|
||||||
|
- Split `getResult()` (300+ lines) into smaller methods
|
||||||
|
- Move `$_chinese` and `$_italic` arrays to config file
|
||||||
|
- Use regex for text parsing instead of strpos/substr
|
||||||
|
|
||||||
|
3. **Validation**
|
||||||
|
- Add input validation for accessnumber format
|
||||||
|
- Handle invalid access numbers gracefully
|
||||||
|
|
||||||
|
4. **Performance**
|
||||||
|
- Cache common queries
|
||||||
|
- Optimize SQL joins
|
||||||
|
|
||||||
|
5. **Testing**
|
||||||
|
- Add integration tests with database
|
||||||
|
- Test with real data
|
||||||
|
- Test pagination edge cases
|
||||||
|
|
||||||
|
## Migration Status: ✅ COMPLETE
|
||||||
|
|
||||||
|
All core functionality migrated from `main2.php` to CI4:
|
||||||
|
- ✅ Report generation
|
||||||
|
- ✅ Bilingual support
|
||||||
|
- ✅ Preview mode
|
||||||
|
- ✅ Role-based access
|
||||||
|
- ✅ Audit logging
|
||||||
|
- ✅ Multi-page reports
|
||||||
|
- ✅ Data processing
|
||||||
|
- ✅ Asset migration
|
||||||
|
- ✅ Route configuration
|
||||||
|
- ✅ Backward compatibility
|
||||||
BIN
public/assets/report/gleneaglesftr.png
Normal file
BIN
public/assets/report/gleneaglesftr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
BIN
public/assets/report/gleneagleshdr.png
Normal file
BIN
public/assets/report/gleneagleshdr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 222 KiB |
2
public/assets/report/normalize.min.css
vendored
Normal file
2
public/assets/report/normalize.min.css
vendored
Normal file
@ -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}
|
||||||
34
public/assets/report/pdf.css
Normal file
34
public/assets/report/pdf.css
Normal file
@ -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: 17.5cm; }
|
||||||
|
#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; }
|
||||||
|
}
|
||||||
33
public/assets/report/pdf_qr.css
Normal file
33
public/assets/report/pdf_qr.css
Normal file
@ -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; }
|
||||||
|
}
|
||||||
29
public/assets/report/style.css
Normal file
29
public/assets/report/style.css
Normal file
@ -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: 16.5cm; }
|
||||||
|
#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: #f2f2f2; }
|
||||||
|
.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;}
|
||||||
29
public/assets/report/style_qr.css
Normal file
29
public/assets/report/style_qr.css
Normal file
@ -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: #f2f2f2; }
|
||||||
|
.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;}
|
||||||
705
public/spooler_db/_function.php
Normal file
705
public/spooler_db/_function.php
Normal file
@ -0,0 +1,705 @@
|
|||||||
|
<?php
|
||||||
|
function getE($text){
|
||||||
|
$pos1 = strpos($text,'#E')+2;
|
||||||
|
$pos2 = strrpos($text,'#E')-2;
|
||||||
|
$text = substr($text, $pos1, $pos2-$pos1 );
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQrcode($HOSTNUMBER) {
|
||||||
|
$secret_key = "Trisensa_diagnostic_centre";
|
||||||
|
$secret_iv = "Gleneagles_surabaya";
|
||||||
|
$encrypt_method = "AES-256-CBC";
|
||||||
|
$key = hash('sha256', $secret_key);
|
||||||
|
$iv = substr(hash('sha256', $secret_iv), 0, 16);
|
||||||
|
|
||||||
|
$encrypted = base64_encode(openssl_encrypt($HOSTNUMBER, $encrypt_method, $key, 0, $iv));
|
||||||
|
$qrcode = 'trisensadc.co.id/qrcode/data_detail.php?no_reg='.$encrypted;
|
||||||
|
return $qrcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f_repl($text, $ntext, $pos) {
|
||||||
|
if($pos != 0) {
|
||||||
|
$len = strlen($ntext);
|
||||||
|
if(substr($text,$pos,1) == ' ' ) { $text = substr_replace( $text, $ntext, $pos, $len); }
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getResult($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' AND ISNUMERIC(DT.TESTCODE)=0
|
||||||
|
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 = 38; // 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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\r\n";
|
||||||
|
$nline += 1;
|
||||||
|
}
|
||||||
|
$CHAP = $ICHAPTER;
|
||||||
|
$ITEXT = substr($FULLTEXT,2, strrpos($FULLTEXT,'#I')-2 );
|
||||||
|
}
|
||||||
|
// GRP | ELE
|
||||||
|
if($TESTCODE=='PCRN') { $raw[$i] .= " <tr> <td></td> <td colspan='6'><br/><pre>$ITEXT</pre></td></tr>"; $done[$page] .= $raw[$i]; }
|
||||||
|
elseif(!is_numeric($RESTYPE)) {
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $ITEXT = rtrim($ITEXT)." <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
if($ITEXT!='') {
|
||||||
|
$ITEXT = " <tr> <td colspan='7'><pre>$ITEXT</pre></td> </tr>\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;}
|
||||||
|
$F = "";
|
||||||
|
if($TESTCODE != 'TROPI') {
|
||||||
|
if($r1 < $L1 && is_numeric($r1) && is_numeric($L1)) {$F = "*L";}
|
||||||
|
elseif($r1 > $H1 && is_numeric($r1) && is_numeric($H1)) {$F = "*H";}
|
||||||
|
}
|
||||||
|
|
||||||
|
// restype == 9 / limit
|
||||||
|
if($RESTYPE=='9' && $TESTCODE =='LH' ) {
|
||||||
|
$qr1 = preg_replace('/<|>| |/', '', $r1);
|
||||||
|
if($qr1 < $L1 && is_numeric($qr1) && is_numeric($L1)) {$F = "*L";}
|
||||||
|
elseif($qr1 > $H1 && is_numeric($qr1) && is_numeric($H1)) {$F = "*H";}
|
||||||
|
}
|
||||||
|
|
||||||
|
//get R2 L2 H2
|
||||||
|
if($RESTYPE == 0) { $R2=""; $L1=""; $H1=""; $L2=""; $H2=""; }
|
||||||
|
else {
|
||||||
|
if(is_numeric($L1) && $PRECISION1 != 0 ) { $L1 = number_format($L1,$PRECISION1); } else { $L1 = number_format($L1); }
|
||||||
|
if(is_numeric($H1) && $PRECISION1 != 0 ) { $H1 = number_format($H1,$PRECISION1); } else { $H1 = number_format($H1); }
|
||||||
|
if( in_array($RESTYPE,[7,15,4]) && $OPERAND == 3 ) {
|
||||||
|
if(is_numeric($R1)) { $R2 = NUMBER_FORMAT($R1 * $SOFTCONVERSION, $PRECISION2,'.',''); }
|
||||||
|
else {$R2 = '';}
|
||||||
|
if($L1 != 0) { $L2 = NUMBER_FORMAT($L1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$L2 = 0;}
|
||||||
|
if(is_numeric($H1) && $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 = '';}
|
||||||
|
IF(is_numeric($L1) && $L1 != 0) { $L2 = NUMBER_FORMAT($L1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$L2 = 0;}
|
||||||
|
IF(is_numeric($H1) && $H1 != 0) { $H2 = NUMBER_FORMAT($H1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$H2 = 0;}
|
||||||
|
} elseif ( in_array($RESTYPE,[9,10]) & $OPERAND == 3 ) {
|
||||||
|
$r21 = substr($R1, 0, 2);
|
||||||
|
$r22 = substr($R1, 2, 10);
|
||||||
|
if(strlen($r22) > 5) { $r21= substr($r21,0,1); }
|
||||||
|
$R1 = $r21.$r22;
|
||||||
|
$r22 = NUMBER_FORMAT($r22 * $SOFTCONVERSION, $PRECISION2,'.','');
|
||||||
|
$R2 = $r21.$r22;
|
||||||
|
if($L1 != 0) { $L2 = NUMBER_FORMAT($L1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$L2 = '';}
|
||||||
|
if($H1 != 0) { $H2 = NUMBER_FORMAT($H1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$H2 = '';}
|
||||||
|
} elseif ( in_array($RESTYPE,[9,10]) & $OPERAND == 4 ) {
|
||||||
|
$r21 = substr($R1, 0, 2);
|
||||||
|
$r22 = substr($R1, 2, 10);
|
||||||
|
$r22 = NUMBER_FORMAT($r22 / $SOFTCONVERSION, $PRECISION2,'.','');
|
||||||
|
$R2 = $r21.$r22;
|
||||||
|
IF($L1 != 0) { $L2 = NUMBER_FORMAT($L1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$L2 = '';}
|
||||||
|
IF($H1 != 0) { $H2 = NUMBER_FORMAT($H1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$H2 = '';}
|
||||||
|
} else { $R2=$R1; $L2=$L1; $H2=$H1; }
|
||||||
|
}
|
||||||
|
if( ($L1 == 0) && ($H1 == 0) ) { $L1=''; $H1=''; $L2=''; $H2=''; }
|
||||||
|
//precision1
|
||||||
|
if(is_numeric($R1) && is_numeric($PRECISION1)) { $R1 = NUMBER_FORMAT($R1,$PRECISION1,'.',','); }
|
||||||
|
if(is_numeric($R2) && is_numeric($PRECISION2)) { $R2 = NUMBER_FORMAT($R2,$PRECISION2,'.',','); }
|
||||||
|
|
||||||
|
// 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 ="<i>$test</i>"; }
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $test.=" <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
//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 = " <tr> <td style='padding-left:".$space."px'><br/>$test</td> <td colspan='6'><br/><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} elseif ( strlen($RESCOM) < 2 ) {
|
||||||
|
//$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} else {
|
||||||
|
$rline += count( explode(PHP_EOL, $RESCOM) );
|
||||||
|
$res = rtrim($res);
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res \r\n$RESCOM</pre></td> </tr>\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");
|
||||||
|
$posL12 = strrpos($ITEXT, "{L1");
|
||||||
|
$posH1 = strpos($ITEXT, "{H1");
|
||||||
|
$posH12 = strrpos($ITEXT, "{H1");
|
||||||
|
$posL2 = strpos($ITEXT, "{L2");
|
||||||
|
$posL22 = strrpos($ITEXT, "{L2");
|
||||||
|
$posH2 = strpos($ITEXT, "{H2");
|
||||||
|
$posH22 = strrpos($ITEXT, "{H2");
|
||||||
|
$posU1 = strpos($ITEXT, "{U1");
|
||||||
|
//all using U2
|
||||||
|
//if($posU1 == 0 ) { $posU1 = strrpos($ITEXT, "{U2"); $U1 = $U2; }
|
||||||
|
$posU2 = strpos($ITEXT, "{U2");
|
||||||
|
#echo "<pre>$ITEXT</pre>\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])) {
|
||||||
|
if($R1=='Negatif') { $R2 = 'Negative'; }
|
||||||
|
if($R1=='Positif') { $R2 = 'Positive'; }
|
||||||
|
$ITEXT = f_repl($ITEXT,$R1.' '.$F,$posR1);
|
||||||
|
if($posR1 != $posR12) { $ITEXT = f_repl($ITEXT,$R1.' '.$F,$posR12); }
|
||||||
|
$ITEXT = f_repl($ITEXT,$L1,$posL1);
|
||||||
|
if($posL1 != $posL12) { $ITEXT = f_repl($ITEXT,$L1,$posL12); }
|
||||||
|
$ITEXT = f_repl($ITEXT,$H1,$posH1);
|
||||||
|
if($posH1 != $posH12) { $ITEXT = f_repl($ITEXT,$H1,$posH12); }
|
||||||
|
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($posL2 != $posL22) { $ITEXT = f_repl($ITEXT,$L2,$posL22); }
|
||||||
|
if(isset($H2)) { $ITEXT = f_repl($ITEXT,$H2,$posH2); }
|
||||||
|
if($posH2 != $posH22) { $ITEXT = f_repl($ITEXT,$H2,$posH22); }
|
||||||
|
if($I == 'Negative' || $I == 'Negatif') {
|
||||||
|
$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,[2,0,5])) {
|
||||||
|
if(strlen($RESCOM) < 2) {
|
||||||
|
if($TESTCODE == 'BUCRR') {
|
||||||
|
$ITEXT = f_repl($ITEXT,$R1,$posR1);
|
||||||
|
$ITEXT = f_repl($ITEXT,$R1,$posR2);
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1);
|
||||||
|
$ITEXT .= $R1."</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1); $ITEXT .= "$R1 \r\n$RESCOM</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// bold flag
|
||||||
|
//$ITEXT = str_replace('*L', '<b>*L</b>', $ITEXT);
|
||||||
|
//$ITEXT = str_replace('*H', '<b>*H</b>', $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;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOthers($conn,$ACCESSNUMBER, $eng) {
|
||||||
|
$sql = "select DT.FULLTEXT from TESTS T
|
||||||
|
left join REQUESTS R on R.REQUESTID=T.REQUESTID
|
||||||
|
left join DICT_TESTS DT on DT.TESTID=T.TESTID
|
||||||
|
where R.ACCESSNUMBER='$ACCESSNUMBER' and ISNUMERIC(DT.TESTCODE)=1
|
||||||
|
order by T.TESTORDER";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$i = 1;
|
||||||
|
$raw = "";
|
||||||
|
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
$text = $row[0];
|
||||||
|
if($eng==1) {
|
||||||
|
$text = substr( $text , strpos($text,'#E')+2, strrpos($text,'#E')-strpos($text,'#E')-2 );
|
||||||
|
} else {
|
||||||
|
$text = substr( $text , strpos($text,'#I')+2, strrpos($text,'#I')-2 );
|
||||||
|
}
|
||||||
|
$text = str_replace( "{R1", " ", $text );
|
||||||
|
$text = str_replace( "{R2", " ", $text );
|
||||||
|
$text = str_replace( "{I", " ", $text );
|
||||||
|
$text = str_replace( "{L1", " ", $text );
|
||||||
|
$text = str_replace( "{H1", " ", $text );
|
||||||
|
$text = str_replace( "{L2", " ", $text );
|
||||||
|
$text = str_replace( "{H2", " ", $text );
|
||||||
|
$text = str_replace( "{U1", " ", $text );
|
||||||
|
$text = str_replace( "{U2", " ", $text );
|
||||||
|
$text = trim($text);
|
||||||
|
$raw .= "$i. $text <br/>\r\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return $raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select R.EXTERNALORDERNUMBER, format(SR.COLLECTIONDATE,'dd/MM/yyyy'), P.NAME, right(P.PATNUMBER,16),
|
||||||
|
rtrim(P.ADDRESS1+isnull(P.ADDRESS2,'')), P.TELEPHON, P.EMAIL,
|
||||||
|
case
|
||||||
|
when P.SEX=1 then 'Male'
|
||||||
|
when P.SEX=2 then 'Female'
|
||||||
|
else 'Unknown'
|
||||||
|
end,
|
||||||
|
FLOOR(DATEDIFF(DAY, P.BIRTHDATE, R.COLLECTIONDATE) / 365.25),
|
||||||
|
--DATEDIFF(DAY, P.BIRTHDATE, R.COLLECTIONDATE) / 365.25+1,
|
||||||
|
MONTH(R.COLLECTIONDATE - DATEADD(year, DATEDIFF(year, P.BIRTHDATE, R.COLLECTIONDATE), P.BIRTHDATE) ) - 1,
|
||||||
|
RO.COMMENTTEXT, P.STATE, P.CITY
|
||||||
|
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
|
||||||
|
WHERE R.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$regno = $row[0];
|
||||||
|
$reqdate = $row[1];
|
||||||
|
$pname = $row[2];
|
||||||
|
$pnum = $row[3];
|
||||||
|
$paddress = $row[4];
|
||||||
|
$pphone = $row[5];
|
||||||
|
$pemail = $row[6];
|
||||||
|
$psex = $row[7];
|
||||||
|
$pAge = $row[8];
|
||||||
|
$pAgeM = $row[9];
|
||||||
|
$rcomment = $row[10];
|
||||||
|
$pstate = $row[11];
|
||||||
|
$pcity = $row[12];
|
||||||
|
if($pstate == '') { $pstate = $pcity; }
|
||||||
|
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.V_TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GLENEAGLES...TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$sendto = $row[0];
|
||||||
|
$loc = $row[1];
|
||||||
|
$doc = $row[2];
|
||||||
|
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; }
|
||||||
|
|
||||||
|
// noreg, reqdate, access#, mr#, name,address, phone,email,sex,age,reff,doctor
|
||||||
|
$data ="<table class='info'>
|
||||||
|
<tr style='border-bottom:solid 1px black'><th colspan='4'>LABORATORY REPORT</th></tr>
|
||||||
|
<tr> <td>Reg#</td> <td>: $regno</td> <td>Date</td> <td><pre>: $reqdate $sendto</pre></td></tr>
|
||||||
|
<tr> <td>Lab#</td> <td colspan='3'>: $ACCESSNUMBER</td> </tr>
|
||||||
|
<tr> <td>MR</td> <td colspan='3'>: $pnum</td> </tr>
|
||||||
|
<tr> <td>Name</td> <td colspan='3'>: $pname</td> </tr>
|
||||||
|
<tr> <td>Address</td> <td colspan='3'>: $paddress</td> </tr>
|
||||||
|
<tr> <td>Phone/Email</td> <td colspan='3'>: $pphone / $pemail</td> </tr>
|
||||||
|
<tr> <td>City</td> <td colspan='3'>: $pstate</td> </tr>
|
||||||
|
<tr> <td>Sex</td> <td>: $psex</td> <td>Age</td> <td>: $pAge years, $pAgeM months</td></tr>
|
||||||
|
<tr> <td>Reff</td> <td colspan='3'>: $loc</td></tr>
|
||||||
|
<tr> <td>Doctor</td> <td colspan='3'>: $doc</td></tr>
|
||||||
|
</table>
|
||||||
|
";
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData2($conn,$ACCESSNUMBER) {
|
||||||
|
$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 DATEDIFF(hour,P.BIRTHDATE, R.COLLECTIONDATE)/8766 end ,
|
||||||
|
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='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
/*
|
||||||
|
$regno = $row[0];
|
||||||
|
$reqdate = $row[1];
|
||||||
|
$pname = $row[2];
|
||||||
|
$pnum = $row[3];
|
||||||
|
$paddress = $row[4];
|
||||||
|
$pphone = $row[5];
|
||||||
|
$pemail = $row[6];
|
||||||
|
$psex = $row[7];
|
||||||
|
$pAge = $row[8];
|
||||||
|
$pAgeM = $row[9];
|
||||||
|
$rcomment = $row[10];
|
||||||
|
$pcity = $row[11];
|
||||||
|
|
||||||
|
isset($row[0]) ? $row[0] : ''
|
||||||
|
*/
|
||||||
|
$regno = isset($row[0]) ? $row[0] : '';
|
||||||
|
$reqdate = isset($row[1]) ? $row[1] : '';
|
||||||
|
$pname = isset($row[2]) ? $row[2] : '';
|
||||||
|
$pnum = isset($row[3]) ? $row[3] : '';
|
||||||
|
$paddress = isset($row[4]) ? $row[4] : '';
|
||||||
|
$pphone = isset($row[5]) ? $row[5] : '';
|
||||||
|
$pemail = isset($row[6]) ? $row[6] : '';
|
||||||
|
$psex = isset($row[7]) ? $row[7] : '';
|
||||||
|
$pAge = isset($row[8]) ? $row[8] : '';
|
||||||
|
$pAgeM = isset($row[9]) ? $row[9] : '';
|
||||||
|
$rcomment = isset($row[10]) ? $row[10] : '';
|
||||||
|
$pcity = isset($row[11]) ? $row[11] : '';
|
||||||
|
$pdob = '' ;
|
||||||
|
if( isset($row[12]) )
|
||||||
|
{ if($row[12]!= null ) { $pdob = date_format($row[12],'d-m-Y'); } }
|
||||||
|
$title = isset($row[13]) ? $row[13] : '';
|
||||||
|
if($title != '') { $pname = "$pname, $title"; }
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.V_TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GLENEAGLES...TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$sendto = isset($row[0]) ? $row[0] : '';
|
||||||
|
$loc = isset($row[1]) ? $row[1]: '';
|
||||||
|
$doc = isset($row[2]) ? $row[2]: '';
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
// noreg, reqdate, access#, mr#, name,address, phone,email,sex,age,reff,doctor
|
||||||
|
$data ="<table class='info'>
|
||||||
|
<tr style='border-bottom:solid 1px black'><th colspan='5'>CLINICAL LABORATORY</th></tr>
|
||||||
|
<tr> <td>Reg#</td> <td>:</td> <td>$regno</td> <td>Date</td> <td><pre>: $reqdate $sendto</pre></td></tr>
|
||||||
|
<tr> <td>Lab#</td> <td>:</td> <td>$ACCESSNUMBER</td> <td>DoB</td> <td>: $pdob (D-M-Y)</td> </tr>
|
||||||
|
<tr> <td>MR</td> <td>:</td> <td>$pnum</td> <td>Age</td> <td>: $pAge years, $pAgeM months</td> </tr>
|
||||||
|
<tr> <td>Name</td> <td>:</td> <td colspan='3'>$pname</td> </tr>
|
||||||
|
<tr> <td>Address</td> <td>:</td> <td colspan='3'>$paddress</td> </tr>
|
||||||
|
<tr> <td>Phone/Email</td> <td>:</td> <td colspan='3'>$pphone / $pemail</td> </tr>
|
||||||
|
<tr> <td>City</td> <td>:</td> <td colspan='3'>$pcity</td> </tr>
|
||||||
|
<tr> <td>Sex</td> <td>:</td> <td colspan='3'>$psex</td> </tr>
|
||||||
|
<tr> <td>Reff</td> <td>:</td> <td colspan='3'>$loc</td></tr>
|
||||||
|
<tr> <td>Doctor</td> <td>:</td> <td colspan='3'>$doc</td></tr>
|
||||||
|
</table>
|
||||||
|
";
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHost($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select EXTERNALORDERNUMBER from REQUESTS where ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$HOSTNUMBER = isset($row[0]) ? $row[0] : '';
|
||||||
|
return $HOSTNUMBER;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNotes($conn, $ACCESSNUMBER) {
|
||||||
|
/*
|
||||||
|
$sql = "select case
|
||||||
|
when l.LOCID='3741' then p.TELEPHON2
|
||||||
|
else null
|
||||||
|
end,
|
||||||
|
ro.COMMENTTEXT from REQUESTS r
|
||||||
|
left join REQUESTS_OCOM ro on r.REQUESTID=ro.REQUESTID
|
||||||
|
left join LOCATIONS l on r.REQUESTID=l.REQUESTID
|
||||||
|
left join PATIENTS p on p.PATID=r.PATID
|
||||||
|
where r.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$notes = '';
|
||||||
|
if(isset($row[0])) { $notes .= $row[0]."<br/>"; }
|
||||||
|
$notes .= $row[1];
|
||||||
|
*/
|
||||||
|
$sql = "select ro.COMMENTTEXT from REQUESTS r
|
||||||
|
left join REQUESTS_OCOM ro on r.REQUESTID=ro.REQUESTID
|
||||||
|
where r.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$notes = isset($row[0]) ? $row[0] : '';
|
||||||
|
return $notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStatus($conn, $ACCESSNUMBER) {
|
||||||
|
/*
|
||||||
|
$sql = "select
|
||||||
|
case
|
||||||
|
when exists ( select 1 from GDC_CMOD.dbo.TDL_ORDER t left join SP_REQUESTS r on r.HOSTORDERNUMBER=t.ODR_CNOLAB collate Latin1_general_CS_AS
|
||||||
|
WHERE r.SP_ACCESSNUMBER='$ACCESSNUMBER' and t.ODR_ISPENDING=1 ) then 'PENDING'
|
||||||
|
when exists (
|
||||||
|
select 1 from TESTS t
|
||||||
|
left join 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";
|
||||||
|
*/
|
||||||
|
$sql = "select STATS from GDC_CMOD.dbo.V_DASHBOARD where SP_ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
if(isset($row[0])) {
|
||||||
|
$status = $row[0];
|
||||||
|
//if( in_array($ACCESSNUMBER, array('4050360338', '4050360347') ) ) { $status='Comp'; }
|
||||||
|
if($status == 'Comp') { $status = 'FINAL'; }
|
||||||
|
else { $status = 'PENDING'; }
|
||||||
|
} else { $status = ''; }
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCollData($conn,$ACCESSNUMBER) {
|
||||||
|
$collData = "";
|
||||||
|
$sql = "select distinct format(COLLECTIONDATE,'dd-MM-yyyy'), format(COLLECTIONDATE,'HH:mm'), x = stuff(
|
||||||
|
(select ', ' + dst.SHORTTEXT from GDC_CMOD.dbo.TUBES t1
|
||||||
|
left join glendb.dbo.DICT_SAMPLES_TYPES dst on t1.TUBENUMBER=dst.SAMPCODE
|
||||||
|
where t1.ACCESSNUMBER=t.ACCESSNUMBER
|
||||||
|
and format(t1.COLLECTIONDATE,'dd-MM-yyyy HH:mm')=format(t.COLLECTIONDATE,'dd-MM-yyyy HH:mm')
|
||||||
|
for xml path('')),
|
||||||
|
1,1, '')
|
||||||
|
from GDC_CMOD.dbo.TUBES t where t.ACCESSNUMBER='$ACCESSNUMBER' and STATUS=1";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$date1 = '';
|
||||||
|
while ( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
if($date1 == $row[0]) { $collData .= $row[1].$row[2].'. '; }
|
||||||
|
else { $collData .= $row[0].' '.$row[1].$row[2].'. '; }
|
||||||
|
$date1 = $row[0];
|
||||||
|
}
|
||||||
|
return $collData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRecvData($conn,$ACCESSNUMBER) {
|
||||||
|
$recvData = "";
|
||||||
|
/*
|
||||||
|
$sql = "select DS.SHORTTEXT, format(S.LABRECEPTIONDATE,'dd-MM-yyyy'), format(S.LABRECEPTIONDATE,'HH:mm') from SAMPLES S
|
||||||
|
left join DICT_SAMPLES_TYPES DS on DS.SAMPCODE=LEFT(S.SAMPLENUMBER,3)
|
||||||
|
left join SP_TUBES ST on ST.TUBENB=right(S.FULLSAMPLENUM,13)
|
||||||
|
where S.FULLSAMPLENUM like '%$ACCESSNUMBER' and ST.TUBESTATUS=4
|
||||||
|
order by S.LABRECEPTIONDATE";
|
||||||
|
*/
|
||||||
|
$sql= "select ds.SHORTTEXT, format(st.COLLECTIONDATE,'dd-MM-yyy'), format(st.COLLECTIONDATE,'HH:mm') from SP_TUBES st
|
||||||
|
left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE
|
||||||
|
where st.SP_ACCESSNUMBER='$ACCESSNUMBER' and st.TUBESTATUS=4";
|
||||||
|
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$date1 = '';
|
||||||
|
$time1 = '';
|
||||||
|
while ( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
$x = $row[0];
|
||||||
|
$date = $row[1];
|
||||||
|
$time = $row[2];
|
||||||
|
if( $date1 == $date ) {
|
||||||
|
if($time1==$time) { $recvData .= $x.'. '; }
|
||||||
|
else { $recvData .= $time.' '.$x.'. '; }
|
||||||
|
}
|
||||||
|
else { $recvData .= $date.' '.$time.' '.$x.'. '; }
|
||||||
|
$date1 = $date;
|
||||||
|
$time1 = $time;
|
||||||
|
}
|
||||||
|
return $recvData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getValBy($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "SELECT top 1 a.INITUSER, max(STEPDATE) as STEPDATE
|
||||||
|
FROM glendb.dbo.AUDIT_TRAIL a WHERE (a.LIS_SESSION='VAL' or (a.LIS_SESSION='ERM' and a.VALIDATION=5))
|
||||||
|
and a.ATR_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
GROUP BY a.INITUSER, a.STEPDATE
|
||||||
|
order by a.STEPDATE desc";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$valBy = isset($row[0]) ? $row[0] : '';
|
||||||
|
if( $valBy == '' || $valBy =='LIS' ) { $valBy = "AHT"; }
|
||||||
|
return $valBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVal2By($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select VALUSER from CM_REQUESTS where ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$valBy = isset($row[0]) ? $row[0] : '';
|
||||||
|
if( $valBy == '' || $valBy =='LIS' ) { $valBy = "AHT"; }
|
||||||
|
return $valBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVal1($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "SELECT top 1 a.INITUSER, max(STEPDATE) as STEPDATE
|
||||||
|
FROM glendb.dbo.AUDIT_TRAIL a WHERE (a.LIS_SESSION='VAL' or (a.LIS_SESSION='ERM' and a.VALIDATION=5))
|
||||||
|
and a.ATR_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
GROUP BY a.INITUSER, a.STEPDATE
|
||||||
|
order by a.STEPDATE desc";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$valBy = isset($row[0]) ? $row[0] : '';
|
||||||
|
$valDate = isset($row[1]) ? $row[1] : '';
|
||||||
|
if( $valBy == '' || $valBy =='LIS' ) { $valBy = "SYSTEM"; }
|
||||||
|
$val = [ 'valBy'=>$valBy, 'valDate'=>$valDate ];
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNoSample($conn,$ACCESSNUMBER) {
|
||||||
|
|
||||||
|
$sql = "select DST.SHORTTEXT from SP_TUBES ST
|
||||||
|
LEFT JOIN DICT_SAMPLES_TYPES DST ON DST.SAMPCODE=ST.TUBETYPE
|
||||||
|
where ST.SP_ACCESSNUMBER='$ACCESSNUMBER' AND ST.TUBESTATUS<>4";
|
||||||
|
|
||||||
|
/*
|
||||||
|
$sql = "select DS.SHORTTEXT from SP_TUBES T
|
||||||
|
left join DICT_SAMPLES_TYPES DS on T.SAMPLETYPE=DS.SAMPCODE
|
||||||
|
where T.SP_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
and T.SAMPLETYPE not in (
|
||||||
|
select substring(S.SAMPLENUMBER,0,4) from SAMPLES S
|
||||||
|
left join REQUESTS R on R.REQUESTID=S.REQUESTID
|
||||||
|
where R.ACCESSNUMBER=T.SP_ACCESSNUMBER
|
||||||
|
) AND T.SAMPLETYPE <> '900'";
|
||||||
|
*/
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$noSample = '';
|
||||||
|
while ($row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC)) {
|
||||||
|
$sample = $row[0];
|
||||||
|
$noSample .= "<tr> <td>$sample</td> <td colspan='6'>No Sample</td> </tr>\r";
|
||||||
|
}
|
||||||
|
return $noSample;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
691
public/spooler_db/_function_dev.php
Normal file
691
public/spooler_db/_function_dev.php
Normal file
@ -0,0 +1,691 @@
|
|||||||
|
<?php
|
||||||
|
function getE($text){
|
||||||
|
$pos1 = strpos($text,'#E')+2;
|
||||||
|
$pos2 = strrpos($text,'#E')-2;
|
||||||
|
$text = substr($text, $pos1, $pos2-$pos1 );
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQrcode($HOSTNUMBER) {
|
||||||
|
$secret_key = "Trisensa_diagnostic_centre";
|
||||||
|
$secret_iv = "Gleneagles_surabaya";
|
||||||
|
$encrypt_method = "AES-256-CBC";
|
||||||
|
$key = hash('sha256', $secret_key);
|
||||||
|
$iv = substr(hash('sha256', $secret_iv), 0, 16);
|
||||||
|
|
||||||
|
$encrypted = base64_encode(openssl_encrypt($HOSTNUMBER, $encrypt_method, $key, 0, $iv));
|
||||||
|
$qrcode = 'trisensadc.co.id/qrcode/data_detail.php?no_reg='.$encrypted;
|
||||||
|
return $qrcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f_repl($text, $ntext, $pos) {
|
||||||
|
if($pos != 0) {
|
||||||
|
$len = strlen($ntext);
|
||||||
|
if(substr($text,$pos,1) == ' ' ) { $text = substr_replace( $text, $ntext, $pos, $len); }
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getResult($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' AND ISNUMERIC(DT.TESTCODE)=0
|
||||||
|
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 = 38; // 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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\r\n";
|
||||||
|
$nline += 1;
|
||||||
|
}
|
||||||
|
$CHAP = $ICHAPTER;
|
||||||
|
$ITEXT = substr($FULLTEXT,2, strrpos($FULLTEXT,'#I')-2 );
|
||||||
|
}
|
||||||
|
// GRP | ELE
|
||||||
|
if($TESTCODE=='PCRN') { $raw[$i] .= " <tr> <td></td> <td colspan='6'><br/><pre>$ITEXT</pre></td></tr>"; $done[$page] .= $raw[$i]; }
|
||||||
|
elseif(!is_numeric($RESTYPE)) {
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $ITEXT = rtrim($ITEXT)." <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
if($ITEXT!='') {
|
||||||
|
$ITEXT = " <tr> <td colspan='7'><pre>$ITEXT</pre></td> </tr>\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;}
|
||||||
|
$F = "";
|
||||||
|
if($TESTCODE != 'TROPI') {
|
||||||
|
if($r1 < $L1 && is_numeric($r1) && is_numeric($L1)) {$F = "*L";}
|
||||||
|
elseif($r1 > $H1 && is_numeric($r1) && is_numeric($H1)) {$F = "*H";}
|
||||||
|
}
|
||||||
|
|
||||||
|
// restype == 9 / limit
|
||||||
|
if($RESTYPE=='9' && $TESTCODE =='LH' ) {
|
||||||
|
$qr1 = preg_replace('/<|>| |/', '', $r1);
|
||||||
|
if($qr1 < $L1 && is_numeric($qr1) && is_numeric($L1)) {$F = "*L";}
|
||||||
|
elseif($qr1 > $H1 && is_numeric($qr1) && is_numeric($H1)) {$F = "*H";}
|
||||||
|
}
|
||||||
|
|
||||||
|
//get R2 L2 H2
|
||||||
|
if($RESTYPE == 0) { $R2=""; $L1=""; $H1=""; $L2=""; $H2=""; }
|
||||||
|
else {
|
||||||
|
if(is_numeric($L1) && $PRECISION1 != 0 ) { $L1 = number_format($L1,$PRECISION1); } else { $L1 = number_format($L1); }
|
||||||
|
if(is_numeric($H1) && $PRECISION1 != 0 ) { $H1 = number_format($H1,$PRECISION1); } else { $H1 = number_format($H1); }
|
||||||
|
if( in_array($RESTYPE,[7,15,4]) && $OPERAND == 3 ) {
|
||||||
|
if(is_numeric($R1)) { $R2 = NUMBER_FORMAT($R1 * $SOFTCONVERSION, $PRECISION2,'.',''); }
|
||||||
|
else {$R2 = '';}
|
||||||
|
if($L1 != 0) { $L2 = NUMBER_FORMAT($L1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$L2 = 0;}
|
||||||
|
if(is_numeric($H1) && $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 = '';}
|
||||||
|
IF(is_numeric($L1) && $L1 != 0) { $L2 = NUMBER_FORMAT($L1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$L2 = 0;}
|
||||||
|
IF(is_numeric($H1) && $H1 != 0) { $H2 = NUMBER_FORMAT($H1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$H2 = 0;}
|
||||||
|
} elseif ( in_array($RESTYPE,[9,10]) & $OPERAND == 3 ) {
|
||||||
|
$r21 = substr($R1, 0, 2);
|
||||||
|
$r22 = substr($R1, 2, 10);
|
||||||
|
if(strlen($r22) > 5) { $r21= substr($r21,0,1); }
|
||||||
|
$R1 = $r21.$r22;
|
||||||
|
$r22 = NUMBER_FORMAT($r22 * $SOFTCONVERSION, $PRECISION2,'.','');
|
||||||
|
$R2 = $r21.$r22;
|
||||||
|
if($L1 != 0) { $L2 = NUMBER_FORMAT($L1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$L2 = '';}
|
||||||
|
if($H1 != 0) { $H2 = NUMBER_FORMAT($H1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$H2 = '';}
|
||||||
|
} elseif ( in_array($RESTYPE,[9,10]) & $OPERAND == 4 ) {
|
||||||
|
$r21 = substr($R1, 0, 2);
|
||||||
|
$r22 = substr($R1, 2, 10);
|
||||||
|
$r22 = NUMBER_FORMAT($r22 / $SOFTCONVERSION, $PRECISION2,'.','');
|
||||||
|
$R2 = $r21.$r22;
|
||||||
|
IF($L1 != 0) { $L2 = NUMBER_FORMAT($L1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$L2 = '';}
|
||||||
|
IF($H1 != 0) { $H2 = NUMBER_FORMAT($H1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$H2 = '';}
|
||||||
|
} else { $R2=$R1; $L2=$L1; $H2=$H1; }
|
||||||
|
}
|
||||||
|
if( ($L1 == 0) && ($H1 == 0) ) { $L1=''; $H1=''; $L2=''; $H2=''; }
|
||||||
|
//precision1
|
||||||
|
if(is_numeric($R1) && is_numeric($PRECISION1)) { $R1 = NUMBER_FORMAT($R1,$PRECISION1,'.',','); }
|
||||||
|
if(is_numeric($R2) && is_numeric($PRECISION2)) { $R2 = NUMBER_FORMAT($R2,$PRECISION2,'.',','); }
|
||||||
|
|
||||||
|
// 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 ="<i>$test</i>"; }
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $test.=" <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
//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 = " <tr> <td style='padding-left:".$space."px'><br/>$test</td> <td colspan='6'><br/><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} elseif ( strlen($RESCOM) < 2 ) {
|
||||||
|
//$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} else {
|
||||||
|
$rline += count( explode(PHP_EOL, $RESCOM) );
|
||||||
|
$res = rtrim($res);
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res \r\n$RESCOM</pre></td> </tr>\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");
|
||||||
|
$posL12 = strrpos($ITEXT, "{L1");
|
||||||
|
$posH1 = strpos($ITEXT, "{H1");
|
||||||
|
$posH12 = strrpos($ITEXT, "{H1");
|
||||||
|
$posL2 = strpos($ITEXT, "{L2");
|
||||||
|
$posL22 = strrpos($ITEXT, "{L2");
|
||||||
|
$posH2 = strpos($ITEXT, "{H2");
|
||||||
|
$posH22 = strrpos($ITEXT, "{H2");
|
||||||
|
$posU1 = strpos($ITEXT, "{U1");
|
||||||
|
//all using U2
|
||||||
|
//if($posU1 == 0 ) { $posU1 = strrpos($ITEXT, "{U2"); $U1 = $U2; }
|
||||||
|
$posU2 = strpos($ITEXT, "{U2");
|
||||||
|
#echo "<pre>$ITEXT</pre>\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])) {
|
||||||
|
if($R1=='Negatif') { $R2 = 'Negative'; }
|
||||||
|
if($R1=='Positif') { $R2 = 'Positive'; }
|
||||||
|
$ITEXT = f_repl($ITEXT,$R1.' '.$F,$posR1);
|
||||||
|
if($posR1 != $posR12) { $ITEXT = f_repl($ITEXT,$R1.' '.$F,$posR12); }
|
||||||
|
$ITEXT = f_repl($ITEXT,$L1,$posL1);
|
||||||
|
if($posL1 != $posL12) { $ITEXT = f_repl($ITEXT,$L1,$posL12); }
|
||||||
|
$ITEXT = f_repl($ITEXT,$H1,$posH1);
|
||||||
|
if($posH1 != $posH12) { $ITEXT = f_repl($ITEXT,$H1,$posH12); }
|
||||||
|
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($posL2 != $posL22) { $ITEXT = f_repl($ITEXT,$L2,$posL22); }
|
||||||
|
if(isset($H2)) { $ITEXT = f_repl($ITEXT,$H2,$posH2); }
|
||||||
|
if($posH2 != $posH22) { $ITEXT = f_repl($ITEXT,$H2,$posH22); }
|
||||||
|
if($I == 'Negative' || $I == 'Negatif') {
|
||||||
|
$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,[2,0,5])) {
|
||||||
|
if(strlen($RESCOM) < 2) {
|
||||||
|
if($TESTCODE == 'BUCRR') {
|
||||||
|
$ITEXT = f_repl($ITEXT,$R1,$posR1);
|
||||||
|
$ITEXT = f_repl($ITEXT,$R1,$posR2);
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1);
|
||||||
|
$ITEXT .= $R1."</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1); $ITEXT .= "$R1 \r\n$RESCOM</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// bold flag
|
||||||
|
//$ITEXT = str_replace('*L', '<b>*L</b>', $ITEXT);
|
||||||
|
//$ITEXT = str_replace('*H', '<b>*H</b>', $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;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOthers($conn,$ACCESSNUMBER, $eng) {
|
||||||
|
$sql = "select DT.FULLTEXT from TESTS T
|
||||||
|
left join REQUESTS R on R.REQUESTID=T.REQUESTID
|
||||||
|
left join DICT_TESTS DT on DT.TESTID=T.TESTID
|
||||||
|
where R.ACCESSNUMBER='$ACCESSNUMBER' and ISNUMERIC(DT.TESTCODE)=1
|
||||||
|
order by T.TESTORDER";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$i = 1;
|
||||||
|
$raw = "";
|
||||||
|
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
$text = $row[0];
|
||||||
|
if($eng==1) {
|
||||||
|
$text = substr( $text , strpos($text,'#E')+2, strrpos($text,'#E')-strpos($text,'#E')-2 );
|
||||||
|
} else {
|
||||||
|
$text = substr( $text , strpos($text,'#I')+2, strrpos($text,'#I')-2 );
|
||||||
|
}
|
||||||
|
$text = str_replace( "{R1", " ", $text );
|
||||||
|
$text = str_replace( "{R2", " ", $text );
|
||||||
|
$text = str_replace( "{I", " ", $text );
|
||||||
|
$text = str_replace( "{L1", " ", $text );
|
||||||
|
$text = str_replace( "{H1", " ", $text );
|
||||||
|
$text = str_replace( "{L2", " ", $text );
|
||||||
|
$text = str_replace( "{H2", " ", $text );
|
||||||
|
$text = str_replace( "{U1", " ", $text );
|
||||||
|
$text = str_replace( "{U2", " ", $text );
|
||||||
|
$text = trim($text);
|
||||||
|
$raw .= "$i. $text <br/>\r\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return $raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select R.EXTERNALORDERNUMBER, format(SR.COLLECTIONDATE,'dd/MM/yyyy'), P.NAME, right(P.PATNUMBER,16),
|
||||||
|
rtrim(P.ADDRESS1+isnull(P.ADDRESS2,'')), P.TELEPHON, P.EMAIL,
|
||||||
|
case
|
||||||
|
when P.SEX=1 then 'Male'
|
||||||
|
when P.SEX=2 then 'Female'
|
||||||
|
else 'Unknown'
|
||||||
|
end,
|
||||||
|
FLOOR(DATEDIFF(DAY, P.BIRTHDATE, R.COLLECTIONDATE) / 365.25),
|
||||||
|
--DATEDIFF(DAY, P.BIRTHDATE, R.COLLECTIONDATE) / 365.25+1,
|
||||||
|
MONTH(R.COLLECTIONDATE - DATEADD(year, DATEDIFF(year, P.BIRTHDATE, R.COLLECTIONDATE), P.BIRTHDATE) ) - 1,
|
||||||
|
RO.COMMENTTEXT, P.STATE, P.CITY
|
||||||
|
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
|
||||||
|
WHERE R.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$regno = $row[0];
|
||||||
|
$reqdate = $row[1];
|
||||||
|
$pname = $row[2];
|
||||||
|
$pnum = $row[3];
|
||||||
|
$paddress = $row[4];
|
||||||
|
$pphone = $row[5];
|
||||||
|
$pemail = $row[6];
|
||||||
|
$psex = $row[7];
|
||||||
|
$pAge = $row[8];
|
||||||
|
$pAgeM = $row[9];
|
||||||
|
$rcomment = $row[10];
|
||||||
|
$pstate = $row[11];
|
||||||
|
$pcity = $row[12];
|
||||||
|
if($pstate == '') { $pstate = $pcity; }
|
||||||
|
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.V_TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GLENEAGLES...TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$sendto = $row[0];
|
||||||
|
$loc = $row[1];
|
||||||
|
$doc = $row[2];
|
||||||
|
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; }
|
||||||
|
|
||||||
|
// noreg, reqdate, access#, mr#, name,address, phone,email,sex,age,reff,doctor
|
||||||
|
$data ="<table class='info'>
|
||||||
|
<tr style='border-bottom:solid 1px black'><th colspan='4'>LABORATORY REPORT</th></tr>
|
||||||
|
<tr> <td>Reg#</td> <td>: $regno</td> <td>Date</td> <td><pre>: $reqdate $sendto</pre></td></tr>
|
||||||
|
<tr> <td>Lab#</td> <td colspan='3'>: $ACCESSNUMBER</td> </tr>
|
||||||
|
<tr> <td>MR</td> <td colspan='3'>: $pnum</td> </tr>
|
||||||
|
<tr> <td>Name</td> <td colspan='3'>: $pname</td> </tr>
|
||||||
|
<tr> <td>Address</td> <td colspan='3'>: $paddress</td> </tr>
|
||||||
|
<tr> <td>Phone/Email</td> <td colspan='3'>: $pphone / $pemail</td> </tr>
|
||||||
|
<tr> <td>City</td> <td colspan='3'>: $pstate</td> </tr>
|
||||||
|
<tr> <td>Sex</td> <td>: $psex</td> <td>Age</td> <td>: $pAge years, $pAgeM months</td></tr>
|
||||||
|
<tr> <td>Reff</td> <td colspan='3'>: $loc</td></tr>
|
||||||
|
<tr> <td>Doctor</td> <td colspan='3'>: $doc</td></tr>
|
||||||
|
</table>
|
||||||
|
";
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData2($conn,$ACCESSNUMBER) {
|
||||||
|
$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 DATEDIFF(hour,P.BIRTHDATE, R.COLLECTIONDATE)/8766 end ,
|
||||||
|
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='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
/*
|
||||||
|
$regno = $row[0];
|
||||||
|
$reqdate = $row[1];
|
||||||
|
$pname = $row[2];
|
||||||
|
$pnum = $row[3];
|
||||||
|
$paddress = $row[4];
|
||||||
|
$pphone = $row[5];
|
||||||
|
$pemail = $row[6];
|
||||||
|
$psex = $row[7];
|
||||||
|
$pAge = $row[8];
|
||||||
|
$pAgeM = $row[9];
|
||||||
|
$rcomment = $row[10];
|
||||||
|
$pcity = $row[11];
|
||||||
|
|
||||||
|
isset($row[0]) ? $row[0] : ''
|
||||||
|
*/
|
||||||
|
$regno = isset($row[0]) ? $row[0] : '';
|
||||||
|
$reqdate = isset($row[1]) ? $row[1] : '';
|
||||||
|
$pname = isset($row[2]) ? $row[2] : '';
|
||||||
|
$pnum = isset($row[3]) ? $row[3] : '';
|
||||||
|
$paddress = isset($row[4]) ? $row[4] : '';
|
||||||
|
$pphone = isset($row[5]) ? $row[5] : '';
|
||||||
|
$pemail = isset($row[6]) ? $row[6] : '';
|
||||||
|
$psex = isset($row[7]) ? $row[7] : '';
|
||||||
|
$pAge = isset($row[8]) ? $row[8] : '';
|
||||||
|
$pAgeM = isset($row[9]) ? $row[9] : '';
|
||||||
|
$rcomment = isset($row[10]) ? $row[10] : '';
|
||||||
|
$pcity = isset($row[11]) ? $row[11] : '';
|
||||||
|
$pdob = '' ;
|
||||||
|
if( isset($row[12]) )
|
||||||
|
{ if($row[12]!= null ) { $pdob = date_format($row[12],'d-m-Y'); } }
|
||||||
|
$title = isset($row[13]) ? $row[13] : '';
|
||||||
|
if($title != '') { $pname = "$pname, $title"; }
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.V_TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GLENEAGLES...TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$sendto = isset($row[0]) ? $row[0] : '';
|
||||||
|
$loc = isset($row[1]) ? $row[1]: '';
|
||||||
|
$doc = isset($row[2]) ? $row[2]: '';
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
// noreg, reqdate, access#, mr#, name,address, phone,email,sex,age,reff,doctor
|
||||||
|
$data ="<table class='info'>
|
||||||
|
<tr style='border-bottom:solid 1px black'><th colspan='5'>CLINICAL LABORATORY</th></tr>
|
||||||
|
<tr> <td>Reg#</td> <td>:</td> <td>$regno</td> <td>Date</td> <td><pre>: $reqdate $sendto</pre></td></tr>
|
||||||
|
<tr> <td>Lab#</td> <td>:</td> <td>$ACCESSNUMBER</td> <td>DoB</td> <td>: $pdob (D-M-Y)</td> </tr>
|
||||||
|
<tr> <td>MR</td> <td>:</td> <td>$pnum</td> <td>Age</td> <td>: $pAge years, $pAgeM months</td> </tr>
|
||||||
|
<tr> <td>Name</td> <td>:</td> <td colspan='3'>$pname</td> </tr>
|
||||||
|
<tr> <td>Address</td> <td>:</td> <td colspan='3'>$paddress</td> </tr>
|
||||||
|
<tr> <td>Phone/Email</td> <td>:</td> <td colspan='3'>$pphone / $pemail</td> </tr>
|
||||||
|
<tr> <td>City</td> <td>:</td> <td colspan='3'>$pcity</td> </tr>
|
||||||
|
<tr> <td>Sex</td> <td>:</td> <td colspan='3'>$psex</td> </tr>
|
||||||
|
<tr> <td>Reff</td> <td>:</td> <td colspan='3'>$loc</td></tr>
|
||||||
|
<tr> <td>Doctor</td> <td>:</td> <td colspan='3'>$doc</td></tr>
|
||||||
|
</table>
|
||||||
|
";
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHost($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select EXTERNALORDERNUMBER from REQUESTS where ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$HOSTNUMBER = isset($row[0]) ? $row[0] : '';
|
||||||
|
return $HOSTNUMBER;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNotes($conn, $ACCESSNUMBER) {
|
||||||
|
/*
|
||||||
|
$sql = "select case
|
||||||
|
when l.LOCID='3741' then p.TELEPHON2
|
||||||
|
else null
|
||||||
|
end,
|
||||||
|
ro.COMMENTTEXT from REQUESTS r
|
||||||
|
left join REQUESTS_OCOM ro on r.REQUESTID=ro.REQUESTID
|
||||||
|
left join LOCATIONS l on r.REQUESTID=l.REQUESTID
|
||||||
|
left join PATIENTS p on p.PATID=r.PATID
|
||||||
|
where r.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$notes = '';
|
||||||
|
if(isset($row[0])) { $notes .= $row[0]."<br/>"; }
|
||||||
|
$notes .= $row[1];
|
||||||
|
*/
|
||||||
|
$sql = "select ro.COMMENTTEXT from REQUESTS r
|
||||||
|
left join REQUESTS_OCOM ro on r.REQUESTID=ro.REQUESTID
|
||||||
|
where r.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$notes = isset($row[0]) ? $row[0] : '';
|
||||||
|
return $notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStatus($conn, $ACCESSNUMBER) {
|
||||||
|
$sql = "select STATS from GDC_CMOD.dbo.V_DASHBOARD_DEV where SP_ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
if(isset($row[0])) {
|
||||||
|
$status = $row[0];
|
||||||
|
//if( in_array($ACCESSNUMBER, array('4050360338', '4050360347') ) ) { $status='Comp'; }
|
||||||
|
if($status == 'Fin') { $status = 'FINAL'; }
|
||||||
|
elseif($status == 'FinV') { $status = 'FINAL (Verified)'; }
|
||||||
|
elseif($status == 'PenV') { $status = 'PENDING (Verified)'; }
|
||||||
|
else { $status = 'PENDING'; }
|
||||||
|
} else { $status = ''; }
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCollData($conn,$ACCESSNUMBER) {
|
||||||
|
$collData = "";
|
||||||
|
$sql = "select distinct format(COLLECTIONDATE,'dd-MM-yyyy'), format(COLLECTIONDATE,'HH:mm'), x = stuff(
|
||||||
|
(select ', ' + dst.SHORTTEXT from GDC_CMOD.dbo.TUBES t1
|
||||||
|
left join glendb.dbo.DICT_SAMPLES_TYPES dst on t1.TUBENUMBER=dst.SAMPCODE
|
||||||
|
where t1.ACCESSNUMBER=t.ACCESSNUMBER
|
||||||
|
and format(t1.COLLECTIONDATE,'dd-MM-yyyy HH:mm')=format(t.COLLECTIONDATE,'dd-MM-yyyy HH:mm')
|
||||||
|
for xml path('')),
|
||||||
|
1,1, '')
|
||||||
|
from GDC_CMOD.dbo.TUBES t where t.ACCESSNUMBER='$ACCESSNUMBER' and STATUS=1";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$date1 = '';
|
||||||
|
while ( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
if($date1 == $row[0]) { $collData .= $row[1].$row[2].'. '; }
|
||||||
|
else { $collData .= $row[0].' '.$row[1].$row[2].'. '; }
|
||||||
|
$date1 = $row[0];
|
||||||
|
}
|
||||||
|
return $collData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRecvData($conn,$ACCESSNUMBER) {
|
||||||
|
$recvData = "";
|
||||||
|
$sql = "select DS.SHORTTEXT, format(S.LABRECEPTIONDATE,'dd-MM-yyyy'), format(S.LABRECEPTIONDATE,'HH:mm') from SAMPLES S
|
||||||
|
left join DICT_SAMPLES_TYPES DS on DS.SAMPCODE=LEFT(S.SAMPLENUMBER,3)
|
||||||
|
left join SP_TUBES ST on ST.TUBENB=right(S.FULLSAMPLENUM,13)
|
||||||
|
where S.FULLSAMPLENUM like '%$ACCESSNUMBER' and ST.TUBESTATUS=4
|
||||||
|
order by S.LABRECEPTIONDATE";
|
||||||
|
/*
|
||||||
|
$sql= "select ds.SHORTTEXT, format(st.COLLECTIONDATE,'dd-MM-yyy'), format(st.COLLECTIONDATE,'HH:mm') from SP_TUBES st
|
||||||
|
left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE
|
||||||
|
where st.SP_ACCESSNUMBER='$ACCESSNUMBER' and st.TUBESTATUS=4";
|
||||||
|
*/
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$date1 = '';
|
||||||
|
$time1 = '';
|
||||||
|
while ( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
$x = $row[0];
|
||||||
|
$date = $row[1];
|
||||||
|
$time = $row[2];
|
||||||
|
if( $date1 == $date ) {
|
||||||
|
if($time1==$time) { $recvData .= $x.'. '; }
|
||||||
|
else { $recvData .= $time.' '.$x.'. '; }
|
||||||
|
}
|
||||||
|
else { $recvData .= $date.' '.$time.' '.$x.'. '; }
|
||||||
|
$date1 = $date;
|
||||||
|
$time1 = $time;
|
||||||
|
}
|
||||||
|
return $recvData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getValBy($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "SELECT top 1 a.INITUSER, max(STEPDATE) as STEPDATE
|
||||||
|
FROM glendb.dbo.AUDIT_TRAIL a WHERE (a.LIS_SESSION='VAL' or (a.LIS_SESSION='ERM' and a.VALIDATION=5))
|
||||||
|
and a.ATR_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
GROUP BY a.INITUSER, a.STEPDATE
|
||||||
|
order by a.STEPDATE desc";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$valBy = isset($row[0]) ? $row[0] : '';
|
||||||
|
if( $valBy == '' || $valBy =='LIS' ) { $valBy = "AHT"; }
|
||||||
|
return $valBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVal2By($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select VALUSER from CM_REQUESTS where ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$valBy = isset($row[0]) ? $row[0] : '';
|
||||||
|
if( $valBy == '' || $valBy =='LIS' ) { $valBy = "AHT"; }
|
||||||
|
return $valBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVal1($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "SELECT top 1 a.INITUSER, max(STEPDATE) as STEPDATE
|
||||||
|
FROM glendb.dbo.AUDIT_TRAIL a WHERE (a.LIS_SESSION='VAL' or (a.LIS_SESSION='ERM' and a.VALIDATION=5))
|
||||||
|
and a.ATR_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
GROUP BY a.INITUSER, a.STEPDATE
|
||||||
|
order by a.STEPDATE desc";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$valBy = isset($row[0]) ? $row[0] : '';
|
||||||
|
$valDate = isset($row[1]) ? $row[1] : '';
|
||||||
|
if( $valBy == '' || $valBy =='LIS' ) { $valBy = "SYSTEM"; }
|
||||||
|
$val = [ 'valBy'=>$valBy, 'valDate'=>$valDate ];
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNoSample($conn,$ACCESSNUMBER) {
|
||||||
|
|
||||||
|
$sql = "select DST.SHORTTEXT from SP_TUBES ST
|
||||||
|
LEFT JOIN DICT_SAMPLES_TYPES DST ON DST.SAMPCODE=ST.TUBETYPE
|
||||||
|
where ST.SP_ACCESSNUMBER='$ACCESSNUMBER' AND ST.TUBESTATUS<>4";
|
||||||
|
|
||||||
|
/*
|
||||||
|
$sql = "select DS.SHORTTEXT from SP_TUBES T
|
||||||
|
left join DICT_SAMPLES_TYPES DS on T.SAMPLETYPE=DS.SAMPCODE
|
||||||
|
where T.SP_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
and T.SAMPLETYPE not in (
|
||||||
|
select substring(S.SAMPLENUMBER,0,4) from SAMPLES S
|
||||||
|
left join REQUESTS R on R.REQUESTID=S.REQUESTID
|
||||||
|
where R.ACCESSNUMBER=T.SP_ACCESSNUMBER
|
||||||
|
) AND T.SAMPLETYPE <> '900'";
|
||||||
|
*/
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$noSample = '';
|
||||||
|
while ($row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC)) {
|
||||||
|
$sample = $row[0];
|
||||||
|
$noSample .= "<tr> <td>$sample</td> <td colspan='6'>No Sample</td> </tr>\r";
|
||||||
|
}
|
||||||
|
return $noSample;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
905
public/spooler_db/_function_zaka.php
Normal file
905
public/spooler_db/_function_zaka.php
Normal file
@ -0,0 +1,905 @@
|
|||||||
|
<?php
|
||||||
|
function getE($text){
|
||||||
|
$pos1 = strpos($text,'#E')+2;
|
||||||
|
$pos2 = strrpos($text,'#E')-2;
|
||||||
|
$text = substr($text, $pos1, $pos2-$pos1 );
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQrcode($HOSTNUMBER) {
|
||||||
|
$secret_key = "Trisensa_diagnostic_centre";
|
||||||
|
$secret_iv = "Gleneagles_surabaya";
|
||||||
|
$encrypt_method = "AES-256-CBC";
|
||||||
|
$key = hash('sha256', $secret_key);
|
||||||
|
$iv = substr(hash('sha256', $secret_iv), 0, 16);
|
||||||
|
|
||||||
|
$encrypted = base64_encode(openssl_encrypt($HOSTNUMBER, $encrypt_method, $key, 0, $iv));
|
||||||
|
$qrcode = 'trisensadc.co.id/qrcode/data_detail.php?no_reg='.$encrypted;
|
||||||
|
return $qrcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f_repl($text, $ntext, $pos) {
|
||||||
|
if($pos != 0) {
|
||||||
|
$len = strlen($ntext);
|
||||||
|
if(substr($text,$pos,1) == ' ' ) { $text = substr_replace( $text, $ntext, $pos, $len); }
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getResult($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' AND ISNUMERIC(DT.TESTCODE)=0
|
||||||
|
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 = 37; // 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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\r\n";
|
||||||
|
$nline += 1;
|
||||||
|
}
|
||||||
|
$CHAP = $ICHAPTER;
|
||||||
|
$ITEXT = substr($FULLTEXT,2, strrpos($FULLTEXT,'#I')-2 );
|
||||||
|
}
|
||||||
|
// GRP | ELE
|
||||||
|
if($TESTCODE=='PCRN') { $raw[$i] .= " <tr> <td></td> <td colspan='6'><br/><pre>$ITEXT</pre></td></tr>"; $done[$page] .= $raw[$i]; }
|
||||||
|
elseif(!is_numeric($RESTYPE)) {
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $ITEXT = rtrim($ITEXT)." <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
if($ITEXT!='') {
|
||||||
|
$ITEXT = " <tr> <td colspan='7'><pre>$ITEXT</pre></td> </tr>\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;}
|
||||||
|
$F = "";
|
||||||
|
if($TESTCODE != 'TROPI') {
|
||||||
|
if($r1 < $L1 && is_numeric($r1) && is_numeric($L1)) {$F = "*L";}
|
||||||
|
elseif($r1 > $H1 && is_numeric($r1) && is_numeric($H1)) {$F = "*H";}
|
||||||
|
}
|
||||||
|
// UNTUK LH
|
||||||
|
if($TESTCODE == 'LH') {
|
||||||
|
if($r1 < $L1 && is_numeric($r1) && is_numeric($L1)) {$F = "*L";}
|
||||||
|
elseif($r1 > $H1 && is_numeric($r1) && is_numeric($H1)) {$F = "*H";}
|
||||||
|
// else {$F = "*L";}
|
||||||
|
}
|
||||||
|
|
||||||
|
//get R2 L2 H2
|
||||||
|
if($RESTYPE == 0) { $R2=""; $L1=""; $H1=""; $L2=""; $H2=""; }
|
||||||
|
else {
|
||||||
|
if(is_numeric($L1) && $PRECISION1 != 0 ) { $L1 = number_format($L1,$PRECISION1); } else { $L1 = number_format($L1); }
|
||||||
|
if(is_numeric($H1) && $PRECISION1 != 0 ) { $H1 = number_format($H1,$PRECISION1); } else { $H1 = number_format($H1); }
|
||||||
|
if( in_array($RESTYPE,[7,15,4]) && $OPERAND == 3 ) {
|
||||||
|
if(is_numeric($R1)) { $R2 = NUMBER_FORMAT($R1 * $SOFTCONVERSION, $PRECISION2,'.',''); }
|
||||||
|
else {$R2 = '';}
|
||||||
|
if($L1 != 0) { $L2 = NUMBER_FORMAT($L1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$L2 = 0;}
|
||||||
|
if(is_numeric($H1) && $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 = '';}
|
||||||
|
IF(is_numeric($L1) && $L1 != 0) { $L2 = NUMBER_FORMAT($L1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$L2 = 0;}
|
||||||
|
IF(is_numeric($H1) && $H1 != 0) { $H2 = NUMBER_FORMAT($H1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$H2 = 0;}
|
||||||
|
} elseif ( in_array($RESTYPE,[9,10]) & $OPERAND == 3 ) {
|
||||||
|
$r21 = substr($R1, 0, 2);
|
||||||
|
$r22 = substr($R1, 2, 10);
|
||||||
|
$r22 = NUMBER_FORMAT($r22 * $SOFTCONVERSION, $PRECISION2,'.','');
|
||||||
|
$R2 = $r21.$r22;
|
||||||
|
if($L1 != 0) { $L2 = NUMBER_FORMAT($L1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$L2 = '';}
|
||||||
|
if($H1 != 0) { $H2 = NUMBER_FORMAT($H1 * $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
else {$H2 = '';}
|
||||||
|
} elseif ( in_array($RESTYPE,[9,10]) & $OPERAND == 4 ) {
|
||||||
|
$r21 = substr($R1, 0, 2);
|
||||||
|
$r22 = substr($R1, 2, 10);
|
||||||
|
$r22 = NUMBER_FORMAT($r22 / $SOFTCONVERSION, $PRECISION2,'.','');
|
||||||
|
$R2 = $r21.$r22;
|
||||||
|
IF($L1 != 0) { $L2 = NUMBER_FORMAT($L1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$L2 = '';}
|
||||||
|
IF($H1 != 0) { $H2 = NUMBER_FORMAT($H1 / $SOFTCONVERSION, $PRECISION2); }
|
||||||
|
ELSE {$H2 = '';}
|
||||||
|
} else { $R2=$R1; $L2=$L1; $H2=$H1; }
|
||||||
|
}
|
||||||
|
if( ($L1 == 0) && ($H1 == 0) ) { $L1=''; $H1=''; $L2=''; $H2=''; }
|
||||||
|
//precision1
|
||||||
|
if(is_numeric($R1) && is_numeric($PRECISION1)) { $R1 = NUMBER_FORMAT($R1,$PRECISION1,'.',','); }
|
||||||
|
if(is_numeric($R2) && is_numeric($PRECISION2)) { $R2 = NUMBER_FORMAT($R2,$PRECISION2,'.',','); }
|
||||||
|
|
||||||
|
// 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 ="<i>$test</i>"; }
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $test.=" <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
//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 = " <tr> <td style='padding-left:".$space."px'><br/>$test</td> <td colspan='6'><br/><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} elseif ( strlen($RESCOM) < 2 ) {
|
||||||
|
//$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} else {
|
||||||
|
$rline += count( explode(PHP_EOL, $RESCOM) );
|
||||||
|
$res = rtrim($res);
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res \r\n$RESCOM</pre></td> </tr>\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");
|
||||||
|
$posL12 = strrpos($ITEXT, "{L1");
|
||||||
|
$posH1 = strpos($ITEXT, "{H1");
|
||||||
|
$posH12 = strrpos($ITEXT, "{H1");
|
||||||
|
$posL2 = strpos($ITEXT, "{L2");
|
||||||
|
$posL22 = strrpos($ITEXT, "{L2");
|
||||||
|
$posH2 = strpos($ITEXT, "{H2");
|
||||||
|
$posH22 = strrpos($ITEXT, "{H2");
|
||||||
|
$posU1 = strpos($ITEXT, "{U1");
|
||||||
|
//all using U2
|
||||||
|
//if($posU1 == 0 ) { $posU1 = strrpos($ITEXT, "{U2"); $U1 = $U2; }
|
||||||
|
$posU2 = strpos($ITEXT, "{U2");
|
||||||
|
#echo "<pre>$ITEXT</pre>\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);
|
||||||
|
if($posL1 != $posL12) { $ITEXT = f_repl($ITEXT,$L1,$posL12); }
|
||||||
|
$ITEXT = f_repl($ITEXT,$H1,$posH1);
|
||||||
|
if($posH1 != $posH12) { $ITEXT = f_repl($ITEXT,$H1,$posH12); }
|
||||||
|
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($posL2 != $posL22) { $ITEXT = f_repl($ITEXT,$L2,$posL22); }
|
||||||
|
if(isset($H2)) { $ITEXT = f_repl($ITEXT,$H2,$posH2); }
|
||||||
|
if($posH2 != $posH22) { $ITEXT = f_repl($ITEXT,$H2,$posH22); }
|
||||||
|
$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,[2,0,5])) {
|
||||||
|
if(strlen($RESCOM) < 2) {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1); $ITEXT .= $R1."</pre></td> </tr>";
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1); $ITEXT .= "$R1 \r\n$RESCOM</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// bold flag
|
||||||
|
//$ITEXT = str_replace('*L', '<b>*L</b>', $ITEXT);
|
||||||
|
//$ITEXT = str_replace('*H', '<b>*H</b>', $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;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOthers($conn,$ACCESSNUMBER, $eng) {
|
||||||
|
$sql = "select DT.FULLTEXT from TESTS T
|
||||||
|
left join REQUESTS R on R.REQUESTID=T.REQUESTID
|
||||||
|
left join DICT_TESTS DT on DT.TESTID=T.TESTID
|
||||||
|
where R.ACCESSNUMBER='$ACCESSNUMBER' and ISNUMERIC(DT.TESTCODE)=1
|
||||||
|
order by T.TESTORDER";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$i = 1;
|
||||||
|
$raw = "";
|
||||||
|
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
$text = $row[0];
|
||||||
|
if($eng==1) {
|
||||||
|
$text = substr( $text , strpos($text,'#E')+2, strrpos($text,'#E')-strpos($text,'#E')-2 );
|
||||||
|
} else {
|
||||||
|
$text = substr( $text , strpos($text,'#I')+2, strrpos($text,'#I')-2 );
|
||||||
|
}
|
||||||
|
$text = str_replace( "{R1", " ", $text );
|
||||||
|
$text = str_replace( "{R2", " ", $text );
|
||||||
|
$text = str_replace( "{I", " ", $text );
|
||||||
|
$text = str_replace( "{L1", " ", $text );
|
||||||
|
$text = str_replace( "{H1", " ", $text );
|
||||||
|
$text = str_replace( "{L2", " ", $text );
|
||||||
|
$text = str_replace( "{H2", " ", $text );
|
||||||
|
$text = str_replace( "{U1", " ", $text );
|
||||||
|
$text = str_replace( "{U2", " ", $text );
|
||||||
|
$text = trim($text);
|
||||||
|
$raw .= "$i. $text <br/>\r\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return $raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select R.EXTERNALORDERNUMBER, format(SR.COLLECTIONDATE,'dd/MM/yyyy'), P.NAME, right(P.PATNUMBER,16),
|
||||||
|
rtrim(P.ADDRESS1+isnull(P.ADDRESS2,'')), P.TELEPHON, P.EMAIL,
|
||||||
|
case
|
||||||
|
when P.SEX=1 then 'Male'
|
||||||
|
when P.SEX=2 then 'Female'
|
||||||
|
else 'Unknown'
|
||||||
|
end,
|
||||||
|
--FLOOR(DATEDIFF(DAY, P.BIRTHDATE, R.COLLECTIONDATE) / 365.25),
|
||||||
|
DATEDIFF(DAY, P.BIRTHDATE, R.COLLECTIONDATE) / 365.25+1,
|
||||||
|
MONTH(R.COLLECTIONDATE - DATEADD(year, DATEDIFF(year, P.BIRTHDATE, R.COLLECTIONDATE), P.BIRTHDATE) ) - 1,
|
||||||
|
RO.COMMENTTEXT, P.STATE, P.CITY
|
||||||
|
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
|
||||||
|
WHERE R.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$regno = $row[0];
|
||||||
|
$reqdate = $row[1];
|
||||||
|
$pname = $row[2];
|
||||||
|
$pnum = $row[3];
|
||||||
|
$paddress = $row[4];
|
||||||
|
$pphone = $row[5];
|
||||||
|
$pemail = $row[6];
|
||||||
|
$psex = $row[7];
|
||||||
|
$pAge = $row[8];
|
||||||
|
$pAgeM = $row[9];
|
||||||
|
$rcomment = $row[10];
|
||||||
|
$pstate = $row[11];
|
||||||
|
$pcity = $row[12];
|
||||||
|
if($pstate == '') { $pstate = $pcity; }
|
||||||
|
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.V_TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GLENEAGLES...TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$sendto = $row[0];
|
||||||
|
$loc = $row[1];
|
||||||
|
$doc = $row[2];
|
||||||
|
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; }
|
||||||
|
|
||||||
|
// noreg, reqdate, access#, mr#, name,address, phone,email,sex,age,reff,doctor
|
||||||
|
$data ="<table class='info'>
|
||||||
|
<tr style='border-bottom:solid 1px black'><th colspan='4'>LABORATORY REPORT</th></tr>
|
||||||
|
<tr> <td>Reg#</td> <td>: $regno</td> <td>Date</td> <td><pre>: $reqdate $sendto</pre></td></tr>
|
||||||
|
<tr> <td>Lab#</td> <td colspan='3'>: $ACCESSNUMBER</td> </tr>
|
||||||
|
<tr> <td>MR</td> <td colspan='3'>: $pnum</td> </tr>
|
||||||
|
<tr> <td>Name</td> <td colspan='3'>: $pname</td> </tr>
|
||||||
|
<tr> <td>Address</td> <td colspan='3'>: $paddress</td> </tr>
|
||||||
|
<tr> <td>Phone/Email</td> <td colspan='3'>: $pphone / $pemail</td> </tr>
|
||||||
|
<tr> <td>City</td> <td colspan='3'>: $pstate</td> </tr>
|
||||||
|
<tr> <td>Sex</td> <td>: $psex</td> <td>Age</td> <td>: $pAge years, $pAgeM months</td></tr>
|
||||||
|
<tr> <td>Reff</td> <td colspan='3'>: $loc</td></tr>
|
||||||
|
<tr> <td>Doctor</td> <td colspan='3'>: $doc</td></tr>
|
||||||
|
</table>
|
||||||
|
";
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData2($conn,$ACCESSNUMBER) {
|
||||||
|
$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 DATEDIFF(hour,P.BIRTHDATE, R.COLLECTIONDATE)/8766 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
|
||||||
|
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 GDC_CMOD.dbo.TDL_DEMOGRAPHIC dmg on right(P.PATNUMBER,16)=dmg.DMG_CPATNUMBER collate Latin1_general_CS_AS
|
||||||
|
WHERE R.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
/*
|
||||||
|
$regno = $row[0];
|
||||||
|
$reqdate = $row[1];
|
||||||
|
$pname = $row[2];
|
||||||
|
$pnum = $row[3];
|
||||||
|
$paddress = $row[4];
|
||||||
|
$pphone = $row[5];
|
||||||
|
$pemail = $row[6];
|
||||||
|
$psex = $row[7];
|
||||||
|
$pAge = $row[8];
|
||||||
|
$pAgeM = $row[9];
|
||||||
|
$rcomment = $row[10];
|
||||||
|
$pcity = $row[11];
|
||||||
|
|
||||||
|
isset($row[0]) ? $row[0] : ''
|
||||||
|
*/
|
||||||
|
$regno = isset($row[0]) ? $row[0] : '';
|
||||||
|
$reqdate = isset($row[1]) ? $row[1] : '';
|
||||||
|
$pname = isset($row[2]) ? $row[2] : '';
|
||||||
|
$pnum = isset($row[3]) ? $row[3] : '';
|
||||||
|
$paddress = isset($row[4]) ? $row[4] : '';
|
||||||
|
$pphone = isset($row[5]) ? $row[5] : '';
|
||||||
|
$pemail = isset($row[6]) ? $row[6] : '';
|
||||||
|
$psex = isset($row[7]) ? $row[7] : '';
|
||||||
|
$pAge = isset($row[8]) ? $row[8] : '';
|
||||||
|
$pAgeM = isset($row[9]) ? $row[9] : '';
|
||||||
|
$rcomment = isset($row[10]) ? $row[10] : '';
|
||||||
|
$pcity = isset($row[11]) ? $row[11] : '';
|
||||||
|
$pdob = '' ;
|
||||||
|
if( isset($row[12]) )
|
||||||
|
{ if($row[12]!= null ) { $pdob = date_format($row[12],'d-m-Y'); } }
|
||||||
|
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.V_TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
//$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GLENEAGLES...TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$sql = "select ODR_CRESULT_TO, ODR_CREFERENCENAME, ODR_CREFERENCEDOCNAME from GDC_CMOD.dbo.TDL_ORDER where ODR_CNOLAB='$regno'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$sendto = isset($row[0]) ? $row[0] : '';
|
||||||
|
$loc = isset($row[1]) ? $row[1]: '';
|
||||||
|
$doc = isset($row[2]) ? $row[2]: '';
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
// noreg, reqdate, access#, mr#, name,address, phone,email,sex,age,reff,doctor
|
||||||
|
$data ="<table class='info'>
|
||||||
|
<tr style='border-bottom:solid 1px black'><th colspan='5'>CLINICAL LABORATORY</th></tr>
|
||||||
|
<tr> <td>Reg#</td> <td>:</td> <td>$regno</td> <td>Date</td> <td><pre>: $reqdate $sendto</pre></td></tr>
|
||||||
|
<tr> <td>Lab#</td> <td>:</td> <td>$ACCESSNUMBER</td> <td>DoB</td> <td>: $pdob (D-M-Y)</td> </tr>
|
||||||
|
<tr> <td>MR</td> <td>:</td> <td>$pnum</td> <td>Age</td> <td>: $pAge years, $pAgeM months</td> </tr>
|
||||||
|
<tr> <td>Name</td> <td>:</td> <td colspan='3'>$pname</td> </tr>
|
||||||
|
<tr> <td>Address</td> <td>:</td> <td colspan='3'>$paddress</td> </tr>
|
||||||
|
<tr> <td>Phone/Email</td> <td>:</td> <td colspan='3'>$pphone / $pemail</td> </tr>
|
||||||
|
<tr> <td>City</td> <td>:</td> <td colspan='3'>$pcity</td> </tr>
|
||||||
|
<tr> <td>Sex</td> <td>:</td> <td colspan='3'>$psex</td> </tr>
|
||||||
|
<tr> <td>Reff</td> <td>:</td> <td colspan='3'>$loc</td></tr>
|
||||||
|
<tr> <td>Doctor</td> <td>:</td> <td colspan='3'>$doc</td></tr>
|
||||||
|
</table>
|
||||||
|
";
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHost($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select EXTERNALORDERNUMBER from REQUESTS where ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$HOSTNUMBER = isset($row[0]) ? $row[0] : '';
|
||||||
|
return $HOSTNUMBER;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNotes($conn, $ACCESSNUMBER) {
|
||||||
|
/*
|
||||||
|
$sql = "select case
|
||||||
|
when l.LOCID='3741' then p.TELEPHON2
|
||||||
|
else null
|
||||||
|
end,
|
||||||
|
ro.COMMENTTEXT from REQUESTS r
|
||||||
|
left join REQUESTS_OCOM ro on r.REQUESTID=ro.REQUESTID
|
||||||
|
left join LOCATIONS l on r.REQUESTID=l.REQUESTID
|
||||||
|
left join PATIENTS p on p.PATID=r.PATID
|
||||||
|
where r.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$notes = '';
|
||||||
|
if(isset($row[0])) { $notes .= $row[0]."<br/>"; }
|
||||||
|
$notes .= $row[1];
|
||||||
|
*/
|
||||||
|
$sql = "select ro.COMMENTTEXT from REQUESTS r
|
||||||
|
left join REQUESTS_OCOM ro on r.REQUESTID=ro.REQUESTID
|
||||||
|
where r.ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$notes = isset($row[0]) ? $row[0] : '';
|
||||||
|
return $notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStatus($conn, $ACCESSNUMBER) {
|
||||||
|
/*
|
||||||
|
$sql = "select
|
||||||
|
case
|
||||||
|
when exists ( select 1 from GDC_CMOD.dbo.TDL_ORDER t left join SP_REQUESTS r on r.HOSTORDERNUMBER=t.ODR_CNOLAB collate Latin1_general_CS_AS
|
||||||
|
WHERE r.SP_ACCESSNUMBER='$ACCESSNUMBER' and t.ODR_ISPENDING=1 ) then 'PENDING'
|
||||||
|
when exists (
|
||||||
|
select 1 from TESTS t
|
||||||
|
left join 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";
|
||||||
|
*/
|
||||||
|
$sql = "select STATS from GDC_CMOD.dbo.V_DASHBOARD where SP_ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
if(isset($row[0])) {
|
||||||
|
$status = $row[0];
|
||||||
|
if($status == 'Comp') { $status = 'FINAL'; }
|
||||||
|
else { $status = 'PENDING'; }
|
||||||
|
} else { $status = ''; }
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCollData($conn,$ACCESSNUMBER) {
|
||||||
|
$collData = "";
|
||||||
|
$sql = "select distinct format(COLLECTIONDATE,'dd-MM-yyyy'), format(COLLECTIONDATE,'HH:mm'), x = stuff(
|
||||||
|
(select ', ' + dst.SHORTTEXT from GDC_CMOD.dbo.TUBES t1
|
||||||
|
left join glendb.dbo.DICT_SAMPLES_TYPES dst on t1.TUBENUMBER=dst.SAMPCODE
|
||||||
|
where t1.ACCESSNUMBER=t.ACCESSNUMBER
|
||||||
|
and format(t1.COLLECTIONDATE,'dd-MM-yyyy HH:mm')=format(t.COLLECTIONDATE,'dd-MM-yyyy HH:mm')
|
||||||
|
for xml path('')),
|
||||||
|
1,1, '')
|
||||||
|
from GDC_CMOD.dbo.TUBES t where t.ACCESSNUMBER='$ACCESSNUMBER' and STATUS=1";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$date1 = '';
|
||||||
|
while ( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
if($date1 == $row[0]) { $collData .= $row[1].$row[2].'. '; }
|
||||||
|
else { $collData .= $row[0].' '.$row[1].$row[2].'. '; }
|
||||||
|
$date1 = $row[0];
|
||||||
|
}
|
||||||
|
return $collData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRecvData($conn,$ACCESSNUMBER) {
|
||||||
|
$recvData = "";
|
||||||
|
$sql = "select DS.SHORTTEXT, format(S.LABRECEPTIONDATE,'dd-MM-yyyy'), format(S.LABRECEPTIONDATE,'HH:mm') from SAMPLES S
|
||||||
|
left join DICT_SAMPLES_TYPES DS on DS.SAMPCODE=LEFT(S.SAMPLENUMBER,3)
|
||||||
|
left join SP_TUBES ST on ST.TUBENB=right(S.FULLSAMPLENUM,13)
|
||||||
|
where S.FULLSAMPLENUM like '%$ACCESSNUMBER' and ST.TUBESTATUS=4
|
||||||
|
order by S.LABRECEPTIONDATE";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$date1 = '';
|
||||||
|
while ( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
|
||||||
|
$x = $row[0];
|
||||||
|
$date = $row[1];
|
||||||
|
$time = $row[2];
|
||||||
|
if( $date1 == $date ) {
|
||||||
|
if($time1==$time) { $recvData .= $x.'. '; }
|
||||||
|
else { $recvData .= $time.' '.$x.'. '; }
|
||||||
|
}
|
||||||
|
else { $recvData .= $date.' '.$time.' '.$x.'. '; }
|
||||||
|
$date1 = $date;
|
||||||
|
$time1 = $time;
|
||||||
|
}
|
||||||
|
return $recvData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getValBy($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "SELECT top 1 a.INITUSER, max(STEPDATE) as STEPDATE
|
||||||
|
FROM glendb.dbo.AUDIT_TRAIL a WHERE (a.LIS_SESSION='VAL' or (a.LIS_SESSION='ERM' and a.VALIDATION=5))
|
||||||
|
and a.ATR_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
GROUP BY a.INITUSER, a.STEPDATE
|
||||||
|
order by a.STEPDATE desc";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$valBy = isset($row[0]) ? $row[0] : '';
|
||||||
|
if( $valBy == '' || $valBy =='LIS' ) { $valBy = "AHT"; }
|
||||||
|
return $valBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVal1($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "SELECT top 1 a.INITUSER, max(STEPDATE) as STEPDATE
|
||||||
|
FROM glendb.dbo.AUDIT_TRAIL a WHERE (a.LIS_SESSION='VAL' or (a.LIS_SESSION='ERM' and a.VALIDATION=5))
|
||||||
|
and a.ATR_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
GROUP BY a.INITUSER, a.STEPDATE
|
||||||
|
order by a.STEPDATE desc";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$valBy = isset($row[0]) ? $row[0] : '';
|
||||||
|
$valDate = isset($row[1]) ? $row[1] : '';
|
||||||
|
if( $valBy == '' || $valBy =='LIS' ) { $valBy = "SYSTEM"; }
|
||||||
|
$val = [ 'valBy'=>$valBy, 'valDate'=>$valDate ];
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNoSample($conn,$ACCESSNUMBER) {
|
||||||
|
|
||||||
|
$sql = "select DST.SHORTTEXT from SP_TUBES ST
|
||||||
|
LEFT JOIN DICT_SAMPLES_TYPES DST ON DST.SAMPCODE=ST.TUBETYPE
|
||||||
|
where ST.SP_ACCESSNUMBER='$ACCESSNUMBER' AND ST.TUBESTATUS<>4";
|
||||||
|
|
||||||
|
/*
|
||||||
|
$sql = "select DS.SHORTTEXT from SP_TUBES T
|
||||||
|
left join DICT_SAMPLES_TYPES DS on T.SAMPLETYPE=DS.SAMPCODE
|
||||||
|
where T.SP_ACCESSNUMBER='$ACCESSNUMBER'
|
||||||
|
and T.SAMPLETYPE not in (
|
||||||
|
select substring(S.SAMPLENUMBER,0,4) from SAMPLES S
|
||||||
|
left join REQUESTS R on R.REQUESTID=S.REQUESTID
|
||||||
|
where R.ACCESSNUMBER=T.SP_ACCESSNUMBER
|
||||||
|
) AND T.SAMPLETYPE <> '900'";
|
||||||
|
*/
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$noSample = '';
|
||||||
|
while ($row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC)) {
|
||||||
|
$sample = $row[0];
|
||||||
|
$noSample .= "<tr> <td>$sample</td> <td colspan='6'>No Sample</td> </tr>\r";
|
||||||
|
}
|
||||||
|
return $noSample;
|
||||||
|
}
|
||||||
|
|
||||||
|
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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\r\n";
|
||||||
|
$nline += 1;
|
||||||
|
}
|
||||||
|
$CHAP = $ICHAPTER;
|
||||||
|
$ITEXT = substr($FULLTEXT,2, strrpos($FULLTEXT,'#I')-2 );
|
||||||
|
}
|
||||||
|
// GRP | ELE
|
||||||
|
if($TESTCODE=='PCRN') { $raw[$i] .= " <tr> <td></td> <td colspan='6'><br/><pre>$ITEXT</pre></td></tr>"; $done[$page] .= $raw[$i]; }
|
||||||
|
elseif(!is_numeric($RESTYPE)) {
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $ITEXT = rtrim($ITEXT)." <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
if($ITEXT!='') {
|
||||||
|
$ITEXT = " <tr> <td colspan='7'><pre>$ITEXT</pre></td> </tr>\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<br/>";
|
||||||
|
|
||||||
|
//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 ="<i>$test</i>"; }
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $test.=" <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
//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 = " <tr> <td style='padding-left:".$space."px'><br/>$test</td> <td colspan='6'><br/><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} elseif ( strlen($RESCOM) < 2 ) {
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} else {
|
||||||
|
$rline += count( explode(PHP_EOL, $RESCOM) );
|
||||||
|
$res = rtrim($res);
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res \r\n$RESCOM</pre></td> </tr>\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 "<pre>$ITEXT</pre>\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); }
|
||||||
|
$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."</pre></td> </tr>";
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1); $ITEXT .= "$R1 \r\n$RESCOM</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// bold flag
|
||||||
|
//$ITEXT = str_replace('*L', '<b>*L</b>', $ITEXT);
|
||||||
|
//$ITEXT = str_replace('*H', '<b>*H</b>', $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;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
23
public/spooler_db/_inc.php
Normal file
23
public/spooler_db/_inc.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
$_chinese = array(
|
||||||
|
"HBSAG" => "B型肝炎抗原", "GGT" => "丙种谷氨酰转肽酶", "NEUT" => "中性粒细胞", "HBSAT" => "乙肝表面抗体", "AHBS" => "乙肝表面抗体", "AHBST" => "乙肝表面抗体效价", "LDH" => "乳酸脱氢酶",
|
||||||
|
"LDL" => "<br/>低密度脂蛋白", "PROLA" => "促乳素", "TPHCG" => "促绒毛膜性激素测验", "PSA" => "前列腺特异性抗原", "MONO" => "单核细胞", "HSV1G" => "单纯疱疹病毒抗体1IgG",
|
||||||
|
"HSV1M" => "单纯疱疹病毒抗体1IgM", "HSV2G" => "单纯疱疹病毒抗体2IgG", "HSV2M" => "单纯疱疹病毒抗体2IgM", "CRPQN" => "反应蛋白质量", "2SWTH" => "咽喉", "2DIPT" => "咽喉",
|
||||||
|
"BASO" => "嗜性粒血球数", "EOS" => "嗜酸性粒血球", "EOSC" => "嗜酸性粒血球", "PBF" => "<br/>外周血沈淀率", "UA" => "尿酸", "CMVG" => "巨细胞病毒IgG", "CMVM" => "巨细胞病毒IgM",
|
||||||
|
"MCHC" => "平均含血红素浓度", "MCH" => "平均含血红素量", "ACAG" => "异常冠状动脉IgG", "ACAM" => "异常冠状动脉IgM", "GDS" => "当时", "VDRL" => "性病研究实验试验",
|
||||||
|
"CHOL" => "总胆固醇", "UBIL" => "总胆红素", "TP" => "总蛋白质(量)", "EBVEA" => "抗EB病毒定量免疫A", "EBVVA" => "抗EB病毒滴度免疫A", "SALMG" => "抗沙门菌IgG",
|
||||||
|
"SALMM" => "抗沙门菌IgM", "DENGG" => "抗登革热IgG", "DENGR" => "抗登革热IgG/IgM快速", "DENGM" => "抗登革热IgM", "ICTTB" => "抗结核菌抗体线测试",
|
||||||
|
"ASTO" => "抗链球菌", "AMUBA" => "抗阿米巴", "TPHA" => "梅毒螺旋体血凝集测定", "PAPS" => "涂片", "LYM" => "淋巴细胞", "1GO" => "淋病", "FPSA" => "游离前列腺特异性抗原",
|
||||||
|
"GLOB" => "球蛋白", "TG" => "甘油三脂", "GROW" => "生长荷尔蒙", "PTH" => "甲状旁腺激素", "TPO" => "甲状腺过氧化物酶抗体", "AFP" => "甲胎蛋白", "CA125" => "癌抗体125",
|
||||||
|
"CA153" => "癌抗体15-3", "CA199" => "癌抗体19-9", "CA724" => "癌抗体72-4", "CEA" => "癌胚抗原", "1NEIS" => "白喉(咽)", "2DIPN" => "白喉(鼻)", "WBC" => "白细胞",
|
||||||
|
"FWBC" => "白细胞", "ULEUX" => "白细胞数目", "ALB" => "白蛋白", "CORPG" => "皮质醇", "CORSR" => "皮质醇", "DBIL" => "直接", "TESTO" => "睾酮", "ALP" => "<br/>碱性磷酸",
|
||||||
|
"NSE" => "神经原特异性烯醇化酶", "GLUP" => "空腹", "HBA1C" => "空腹与餐后血糖水平", "2SPER" => "精虫", "SPERM" => "精虫", "RBC" => "红细胞", "FRBC" => "红细胞",
|
||||||
|
"UERY" => "红细胞数目", "LED" => "红细胞沈降率", "MCV" => "红血球平均体积", "PCV" => "红血球积压", "PASMS" => "组织学 病理", "CYSMS" => "细胞学", "CKMB" => "细胞角蛋白",
|
||||||
|
"CREA" => "肌酸酐,肌酸内酰胺酸", "BTGN" => "肾石化验", "BATU" => "胆石化验", "CHE" => "胆碱酯酶", "INSL" => "胰岛素", "CYSTC" => "胱硫醚", "APN" => "脂联素",
|
||||||
|
"LIPO" => "脂蛋白", "2PUS" => "脓", "DHEAS" => "脱氢表雄酮硫酸酯", "UGLU" => "葡萄糖", "UPROT" => "蛋白", "GOLRH" => "血型", "PLT" => "血小板", "BUN" => "血尿素氮",
|
||||||
|
"TBIL" => "血清谷丙转氨酶", "SGPT" => "血清谷丙转氨酶", "SGOT" => "血清谷草转氨酶", "HB" => "血红素", "CHLAA" => "衣原体素", "CHLAG" => "衣原体素IgG", "CHLAM" => "衣原体素IgM",
|
||||||
|
"HSCRP" => "赵敏反应蛋白", "APOA1" => "载脂蛋白", "APOB" => "载脂蛋白", "APOR" => "载脂蛋白比率", "SDLDL" => "载脂蛋白比率", "ALDO" => "醛固酮", "DIFF" => "鉴别",
|
||||||
|
"ESTRI" => "雌三醇", "FESTR" => "雌三醇", "RUBG" => "风疹IgG", "RUBM" => "风疹IgM", "GLU2P" => "餐后两个小时", "HDL" => "高密度脂蛋白");
|
||||||
|
|
||||||
|
$_italic = array("UTRI","ITALIC","PLSFC", "PLSOV", "PLSML", "PLSVI");
|
||||||
|
?>
|
||||||
BIN
public/spooler_db/assets/gleneaglesftr.png
Normal file
BIN
public/spooler_db/assets/gleneaglesftr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
BIN
public/spooler_db/assets/gleneagleshdr.png
Normal file
BIN
public/spooler_db/assets/gleneagleshdr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 222 KiB |
2
public/spooler_db/assets/normalize.min.css
vendored
Normal file
2
public/spooler_db/assets/normalize.min.css
vendored
Normal file
@ -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}
|
||||||
1
public/spooler_db/assets/normalize.min.css.map
Normal file
1
public/spooler_db/assets/normalize.min.css.map
Normal file
@ -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"}
|
||||||
34
public/spooler_db/assets/pdf.css
Normal file
34
public/spooler_db/assets/pdf.css
Normal file
@ -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: 17.5cm; }
|
||||||
|
#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; }
|
||||||
|
}
|
||||||
33
public/spooler_db/assets/pdf_qr.css
Normal file
33
public/spooler_db/assets/pdf_qr.css
Normal file
@ -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; }
|
||||||
|
}
|
||||||
29
public/spooler_db/assets/style.css
Normal file
29
public/spooler_db/assets/style.css
Normal file
@ -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: 16.5cm; }
|
||||||
|
#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: #f2f2f2; }
|
||||||
|
.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;}
|
||||||
29
public/spooler_db/assets/style_qr.css
Normal file
29
public/spooler_db/assets/style_qr.css
Normal file
@ -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: #f2f2f2; }
|
||||||
|
.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;}
|
||||||
10
public/spooler_db/config.php
Normal file
10
public/spooler_db/config.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
$serverName = "glenlis";
|
||||||
|
$db = "glendb";
|
||||||
|
$connectionInfo = array( "Database"=>$db, "UID"=>"sa", "PWD"=>"Summittso4516728");
|
||||||
|
$conn = sqlsrv_connect( $serverName, $connectionInfo);
|
||||||
|
if( !$conn ) {
|
||||||
|
echo "Connection 1 could not be established.<br />";
|
||||||
|
die( print_r( sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
?>
|
||||||
10
public/spooler_db/config_glenlis.php
Normal file
10
public/spooler_db/config_glenlis.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
$serverName = "localhost";
|
||||||
|
$db = "glendb";
|
||||||
|
$connectionInfo = array( "Database"=>$db, "UID"=>"sa", "PWD"=>"master");
|
||||||
|
$conn = sqlsrv_connect( $serverName, $connectionInfo);
|
||||||
|
if( !$conn ) {
|
||||||
|
echo "Connection 1 could not be established.<br />";
|
||||||
|
die( print_r( sqlsrv_errors(), true));
|
||||||
|
}
|
||||||
|
?>
|
||||||
151
public/spooler_db/covidPCRnAG.php
Normal file
151
public/spooler_db/covidPCRnAG.php
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['preview'])) { $preview = $_GET['preview']; } else { $preview=0; }
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['acc'])) {
|
||||||
|
$ACCESSNUMBER = $_GET['acc'];
|
||||||
|
} else {
|
||||||
|
$file = $argv[1];
|
||||||
|
$x = explode('\\',$file);
|
||||||
|
$x = $x[1];
|
||||||
|
$x = explode('_',$x);
|
||||||
|
$ACCESSNUMBER = $x[0];
|
||||||
|
$lang = $x[1];
|
||||||
|
if($lang=='eng') {$eng=1;}
|
||||||
|
}
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$raw = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
|
||||||
|
$pdf = $raw + "<link rel='stylesheet' href='http://glenlis/spooler_db/normalize.min.css' />
|
||||||
|
<link rel='stylesheet' href='http://glenlis/spooler_db/pdf.css' />";
|
||||||
|
|
||||||
|
$raw.= "<link rel='stylesheet' href='/spooler_db/normalize.min.css' /> <link rel='stylesheet' href='/spooler_db/style.css' />"; }
|
||||||
|
|
||||||
|
$raw .= "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$pdf .= "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
|
||||||
|
$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);
|
||||||
|
if(!isset($_GET['date'])) { $date = date('d-m-Y H:i'); }
|
||||||
|
else { $date = $_GET['date']; }
|
||||||
|
$npage = count($result);
|
||||||
|
$i=1;
|
||||||
|
|
||||||
|
foreach($result as $page) {
|
||||||
|
$raw .= "<div id='page'>
|
||||||
|
<div id=pagetop style='height:0.01cm'> </div>";
|
||||||
|
$pdf .= "<div id='page'>
|
||||||
|
<div id=pagetop style='height:0.01cm'> </div>
|
||||||
|
<img src='http://glenlis/spooler_db/gleneagleshdr.png' class='img'/>";
|
||||||
|
if($preview==1) { $raw.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
$pdf .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show note
|
||||||
|
if($i != $npage) {
|
||||||
|
$raw.="</table>";
|
||||||
|
$pdf.="</table>";
|
||||||
|
} else {
|
||||||
|
$raw .= "$noSample</table>
|
||||||
|
<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table>";
|
||||||
|
$pdf .= "$noSample</table>
|
||||||
|
<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table>";
|
||||||
|
}
|
||||||
|
$raw .= "</div>";
|
||||||
|
$raw .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $raw .= "Status : $status"; }
|
||||||
|
$raw .= "<pre class='small'>Collected on $collData
|
||||||
|
Received on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
if($pdf!=1) {
|
||||||
|
$raw .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
} else {
|
||||||
|
$raw.="<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
}
|
||||||
|
$raw .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
|
||||||
|
if($pdf==1) { $raw .="<img src='http://glenlis/spooler_db/gleneaglesftr.png' class='img'/>"; }
|
||||||
|
$raw .= "</div>";
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
$raw .="</body>";
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
103
public/spooler_db/debug.php
Normal file
103
public/spooler_db/debug.php
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
$ACCESSNUMBER = $_GET['acc'];
|
||||||
|
|
||||||
|
if(isset($_GET['pdf'])) { $pdf = $_GET['pdf']; } else { $pdf=0; }
|
||||||
|
if(isset($_GET['preview'])) { $preview = $_GET['preview']; } else { $preview=0; }
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; } else { $eng = 0;}
|
||||||
|
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$raw = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
|
||||||
|
if($pdf==0) { $raw.= "<link rel='stylesheet' href='/spooler_db/normalize.min.css' /> <link rel='stylesheet' href='/spooler_db/style.css' />"; }
|
||||||
|
else {
|
||||||
|
$raw .= "<link rel='stylesheet' href='http://glenlis/spooler_db/normalize.min.css' />
|
||||||
|
<link rel='stylesheet' href='http://glenlis/spooler_db/pdf.css' />";
|
||||||
|
}
|
||||||
|
$raw .= "</head>
|
||||||
|
<body>";
|
||||||
|
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id=pagetop style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $raw.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
if($pdf==1) { $raw .= "<img src='http://glenlis/spooler_db/gleneagleshdr.png' class='img'/>"; }
|
||||||
|
$raw .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show note
|
||||||
|
if($i != $npage) {
|
||||||
|
$raw.="</table>";
|
||||||
|
} else {
|
||||||
|
$raw .= "$noSample</table>
|
||||||
|
<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table>";
|
||||||
|
}
|
||||||
|
$raw .= "</div>";
|
||||||
|
$raw .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $raw .= "Status : $status"; }
|
||||||
|
$raw .= "<pre class='small'>Collected on $collData
|
||||||
|
Received on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
if($pdf!=1) {
|
||||||
|
$raw .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
} else {
|
||||||
|
$raw.="<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
}
|
||||||
|
$raw .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
//echo "<img src='gleneaglesftr.png' class='footer-img'/>";
|
||||||
|
if($pdf==1) { $raw .="<img src='http://glenlis/spooler_db/gleneaglesftr.png' class='img'/>"; }
|
||||||
|
$raw .= "</div>";
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
$raw .="</body>";
|
||||||
|
|
||||||
|
echo $raw;
|
||||||
|
?>
|
||||||
241
public/spooler_db/function.php.bak
Normal file
241
public/spooler_db/function.php.bak
Normal file
@ -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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\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] = " <tr><td colspan='7'><pre>$ICHAPTER</pre></td> </tr>\r\n";
|
||||||
|
$nline += 1;
|
||||||
|
}
|
||||||
|
$CHAP = $ICHAPTER;
|
||||||
|
$ITEXT = substr($FULLTEXT,2, strrpos($FULLTEXT,'#I')-2 );
|
||||||
|
}
|
||||||
|
// GRP | ELE
|
||||||
|
if($TESTCODE=='PCRN') { $raw[$i] .= " <tr> <td></td> <td colspan='6'><br/><pre>$ITEXT</pre></td></tr>"; $done[$page] .= $raw[$i]; }
|
||||||
|
elseif(!is_numeric($RESTYPE)) {
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $ITEXT = rtrim($ITEXT)." <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
if($ITEXT!='') {
|
||||||
|
$ITEXT = " <tr> <td colspan='7'><pre>$ITEXT</pre></td> </tr>\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<br/>";
|
||||||
|
|
||||||
|
//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 ="<i>$test</i>"; }
|
||||||
|
// ch
|
||||||
|
if( array_key_exists( $TESTCODE, $_chinese) ) { $test.=" <span class='textC'>".$_chinese[$TESTCODE].'</span>'; }
|
||||||
|
//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 = " <tr> <td style='padding-left:".$space."px'><br/>$test</td> <td colspan='6'><br/><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} elseif ( strlen($RESCOM) < 2 ) {
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res </pre></td> </tr>\r\n";
|
||||||
|
} else {
|
||||||
|
$rline += count( explode(PHP_EOL, $RESCOM) );
|
||||||
|
$res = rtrim($res);
|
||||||
|
$ITEXT = " <tr> <td style='padding-left:".$space."px'>$test</td> <td colspan='6'><pre>$res \r\n$RESCOM</pre></td> </tr>\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 "<pre>$ITEXT</pre>\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."</pre></td> </tr>";
|
||||||
|
} else {
|
||||||
|
$ITEXT = substr($ITEXT, 0, $posR1); $ITEXT .= "$R1 \r\n$RESCOM</pre></td> </tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// bold flag
|
||||||
|
//$ITEXT = str_replace('*L', '<b>*L</b>', $ITEXT);
|
||||||
|
//$ITEXT = str_replace('*H', '<b>*H</b>', $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;
|
||||||
|
}
|
||||||
21
public/spooler_db/gener_oru.php
Normal file
21
public/spooler_db/gener_oru.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
include("config.php");
|
||||||
|
|
||||||
|
$d1 = '2024-09-14'; $d2 = '2024-09-14';
|
||||||
|
$sql = "select SP_ACCESSNUMBER, HOSTORDERNUMBER, STATS from GDC_CMOD.dbo.V_DASHBOARD where
|
||||||
|
COLLECTIONDATE between '2024-09-14 00:00' and '2024-09-14 23:59'
|
||||||
|
and ODR_DDATE between '2024-09-14 00:00' and '2024-09-14 23:59'
|
||||||
|
and STATS='Comp'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
|
||||||
|
$ACCESSNUMBER = $row['SP_ACCESSNUMBER'];
|
||||||
|
$HOSTNUMBER = $row['HOSTORDERNUMBER'];
|
||||||
|
$status = $row['STATS'];
|
||||||
|
//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);
|
||||||
|
}
|
||||||
|
?>
|
||||||
BIN
public/spooler_db/gleneaglesftr.png
Normal file
BIN
public/spooler_db/gleneaglesftr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
BIN
public/spooler_db/gleneagleshdr.png
Normal file
BIN
public/spooler_db/gleneagleshdr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 222 KiB |
124
public/spooler_db/main.php
Normal file
124
public/spooler_db/main.php
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['acc'])) {
|
||||||
|
$ACCESSNUMBER = $_GET['acc'];
|
||||||
|
$pdf = 0;
|
||||||
|
if(isset($_GET['pdf'])) { $pdf = $_GET['pdf']; }
|
||||||
|
} else {
|
||||||
|
$file = $argv[1] ;
|
||||||
|
$filename = explode('\\',$file);
|
||||||
|
$filename = $filename[1];
|
||||||
|
$ACCESSNUMBER = $filename;
|
||||||
|
$pdf = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_GET['eng'])) { $eng = 1; } else { $eng = 0;}
|
||||||
|
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$raw = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
|
||||||
|
if($pdf==0) { $raw.= "<link rel='stylesheet' href='/spooler_db/normalize.min.css' /> <link rel='stylesheet' href='/spooler_db/style.css' />"; }
|
||||||
|
else { $raw .= "<link rel='stylesheet' href='../normalize.min.css' /> <link rel='stylesheet' href='../pdf.css' />"; }
|
||||||
|
$raw .= "</head>
|
||||||
|
<body style='-webkit-print-color-adjust: exact;'>";
|
||||||
|
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id=pagetop style='height:0.01cm'> </div>";
|
||||||
|
if($pdf==1) { $raw .= "<img src='../gleneagleshdr.png' class='img'/>"; }
|
||||||
|
$raw .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show note
|
||||||
|
if($i != $npage) {
|
||||||
|
$raw.="</table>";
|
||||||
|
} else {
|
||||||
|
$raw .= "$noSample</table>
|
||||||
|
<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table>";
|
||||||
|
}
|
||||||
|
$raw .= "</div>";
|
||||||
|
$raw .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $raw .= "Status : $status"; }
|
||||||
|
$raw .= "<pre class='small'>Collected on $collData
|
||||||
|
Received on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
if($pdf!=1) {
|
||||||
|
$raw .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
} else {
|
||||||
|
$raw.="<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
}
|
||||||
|
$raw .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
//echo "<img src='gleneaglesftr.png' class='footer-img'/>";
|
||||||
|
if($pdf==1) { $raw .="<img src='../gleneaglesftr.png' class='img'/>"; }
|
||||||
|
$raw .= "</div>";
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
$raw .="</body>";
|
||||||
|
|
||||||
|
//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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
214
public/spooler_db/main2 -backup.php
Normal file
214
public/spooler_db/main2 -backup.php
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['preview'])) { $preview = $_GET['preview']; } else { $preview=0; }
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['acc'])) { $ACCESSNUMBER = $_GET['acc']; }
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$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 = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='assets/normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='assets/style.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='assets/pdf.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show nosample, others and note
|
||||||
|
if($pageadd !=1) {
|
||||||
|
if( $i != $npage ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
|
||||||
|
if($others != '' && $countline < 38) {
|
||||||
|
$tmp .= "<table><tr><td><b>$othertitle :</b><br/>\r\n";
|
||||||
|
$tmp .= "$others</td></tr></table>";
|
||||||
|
$others = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // page tambahan = 1
|
||||||
|
if( $i != $npage-1 ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($others != '') {
|
||||||
|
$tmp .= "
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='others' style='width:15cm'>
|
||||||
|
<tr><td><b>$othertitle : </b><br/>\r\n
|
||||||
|
$others</td></tr></table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<br/><img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
?>
|
||||||
229
public/spooler_db/main2.php
Normal file
229
public/spooler_db/main2.php
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['preview'])) { $preview = $_GET['preview']; } else { $preview=0; }
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['acc'])) { $ACCESSNUMBER = $_GET['acc']; }
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
function cutData($text) {
|
||||||
|
//$text .= strlen($text);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
$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 = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='assets/normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='assets/style.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='assets/pdf.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show nosample, others and note
|
||||||
|
if($pageadd !=1) {
|
||||||
|
if( $i != $npage ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
|
||||||
|
if($others != '' && $countline < 38) {
|
||||||
|
$tmp .= "<table><tr><td><b>$othertitle :</b><br/>\r\n";
|
||||||
|
$tmp .= "$others</td></tr></table>";
|
||||||
|
$others = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // page tambahan = 1
|
||||||
|
if( $i != $npage-1 ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($others != '') {
|
||||||
|
$tmp .= "
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='others' style='width:15cm'>
|
||||||
|
<tr><td><b>$othertitle : </b><br/>\r\n
|
||||||
|
$others</td></tr></table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<br/><img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
?>
|
||||||
214
public/spooler_db/main2_debug.php
Normal file
214
public/spooler_db/main2_debug.php
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['preview'])) { $preview = $_GET['preview']; } else { $preview=0; }
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['acc'])) { $ACCESSNUMBER = $_GET['acc']; }
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$noSample = getNoSample($conn,$ACCESSNUMBER);
|
||||||
|
if( $noSample == '' ) {
|
||||||
|
$status = getStatus($conn, $ACCESSNUMBER);
|
||||||
|
} else {
|
||||||
|
$status = "PENDING";
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='assets/normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='assets/style.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='assets/pdf.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show nosample, others and note
|
||||||
|
if($pageadd !=1) {
|
||||||
|
if( $i != $npage ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
|
||||||
|
if($others != '' && $countline < 38) {
|
||||||
|
$tmp .= "<table><tr><td><b>$othertitle :</b><br/>\r\n";
|
||||||
|
$tmp .= "$others</td></tr></table>";
|
||||||
|
$others = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // page tambahan = 1
|
||||||
|
if( $i != $npage-1 ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($others != '') {
|
||||||
|
$tmp .= "
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='others' style='width:15cm'>
|
||||||
|
<tr><td><b>$othertitle : </b><br/>\r\n
|
||||||
|
$others</td></tr></table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<br/><img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
?>
|
||||||
214
public/spooler_db/main2_zaka.php
Normal file
214
public/spooler_db/main2_zaka.php
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['preview'])) { $preview = $_GET['preview']; } else { $preview=0; }
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['acc'])) { $ACCESSNUMBER = $_GET['acc']; }
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function_zaka.php");
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$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 = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='assets/normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='assets/style.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='assets/pdf.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show nosample, others and note
|
||||||
|
if($pageadd !=1) {
|
||||||
|
if( $i != $npage ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
|
||||||
|
if($others != '' && $countline < 38) {
|
||||||
|
$tmp .= "<table><tr><td><b>$othertitle :</b><br/>\r\n";
|
||||||
|
$tmp .= "$others</td></tr></table>";
|
||||||
|
$others = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // page tambahan = 1
|
||||||
|
if( $i != $npage-1 ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($others != '') {
|
||||||
|
$tmp .= "
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='others' style='width:15cm'>
|
||||||
|
<tr><td><b>$othertitle : </b><br/>\r\n
|
||||||
|
$others</td></tr></table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<br/><img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
?>
|
||||||
208
public/spooler_db/main_dev.php
Normal file
208
public/spooler_db/main_dev.php
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['preview'])) { $preview = $_GET['preview']; } else { $preview=0; }
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['acc'])) { $ACCESSNUMBER = $_GET['acc']; }
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function_dev.php");
|
||||||
|
function cutData($text) {
|
||||||
|
//$text .= strlen($text);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
$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 = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='assets/normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='assets/style.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='assets/pdf.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show nosample, others and note
|
||||||
|
if($pageadd !=1) {
|
||||||
|
if( $i != $npage ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
|
||||||
|
if($others != '' && $countline < 38) {
|
||||||
|
$tmp .= "<table><tr><td><b>$othertitle :</b><br/>\r\n";
|
||||||
|
$tmp .= "$others</td></tr></table>";
|
||||||
|
$others = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // page tambahan = 1
|
||||||
|
if( $i != $npage-1 ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($others != '') {
|
||||||
|
$tmp .= "
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='others' style='width:15cm'>
|
||||||
|
<tr><td><b>$othertitle : </b><br/>\r\n
|
||||||
|
$others</td></tr></table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<br/><img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
?>
|
||||||
217
public/spooler_db/main_qr.php
Normal file
217
public/spooler_db/main_qr.php
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
<?php
|
||||||
|
namespace chillerlan\QRCodeExamples;
|
||||||
|
use chillerlan\QRCode\{QRCode, QROptions};
|
||||||
|
|
||||||
|
if(isset($_GET['preview'])) { $preview = $_GET['preview']; } else { $preview=0; }
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['acc'])) { $ACCESSNUMBER = $_GET['acc']; }
|
||||||
|
|
||||||
|
require_once("qrcode/vendor/autoload.php");
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$HOSTNUMBER = getHost($conn, $ACCESSNUMBER);
|
||||||
|
$result = getResult($conn, $ACCESSNUMBER,$eng);
|
||||||
|
$others = getOthers($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";
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
$qrcode = getQrcode($HOSTNUMBER);
|
||||||
|
if(!isset($_GET['date'])) { $date = date('d-m-Y H:i'); }
|
||||||
|
else { $date = $_GET['date']; }
|
||||||
|
$npage = count($result);
|
||||||
|
$i=1;
|
||||||
|
$raw ='';
|
||||||
|
$pdf ='';
|
||||||
|
$tmp = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='assets/normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='assets/style_qr.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='assets/pdf_qr.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id=pagetop style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show note
|
||||||
|
// lastpage show nosample, others and note
|
||||||
|
if($pageadd !=1) {
|
||||||
|
if( $i != $npage ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
|
||||||
|
if($others != '' && $countline < 39) {
|
||||||
|
$tmp .= "<table><tr><td><b>$othertitle :</b><br/>\r\n";
|
||||||
|
$tmp .= "$others</td></tr></table>";
|
||||||
|
$others = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // page tambahan = 1
|
||||||
|
if( $i != $npage-1 ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td><a href='http://$qrcode'><img src='".(new QRCode)->render($qrcode)."' alt='QR Code' style='width:3cm' /></a></td>
|
||||||
|
<td valign='middle'>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status<br/>"; }
|
||||||
|
$tmp .= "<span class='small'>Collected on $collData<br/>Received on $recvData</span><br/>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($others != '') {
|
||||||
|
$tmp .= "
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table>
|
||||||
|
<tr><td><b>$othertitle :</b><br/>\r\n
|
||||||
|
$others</td></tr></table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
2
public/spooler_db/normalize.min.css
vendored
Normal file
2
public/spooler_db/normalize.min.css
vendored
Normal file
@ -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}
|
||||||
1
public/spooler_db/normalize.min.css.map
Normal file
1
public/spooler_db/normalize.min.css.map
Normal file
@ -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"}
|
||||||
96
public/spooler_db/oru.php
Normal file
96
public/spooler_db/oru.php
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
function nullAph($string) {
|
||||||
|
if($string=='') { $string='null'; }
|
||||||
|
else {$string= "'$string'";}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
$ACCESSNUMBER=$_GET['acc'];
|
||||||
|
include('config.php');
|
||||||
|
$connFB = odbc_connect('GLENEAGLES','','');
|
||||||
|
$sql = "select * from GDC_CMOD.dbo.v_lab_result where ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
while ($row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC)) {
|
||||||
|
$CIDBILLING = $row['CIDBILLING'];
|
||||||
|
$CIDBILLINGDT = $row['CIDBILLINGDT'];
|
||||||
|
$CIDPRODUCT = $row['CIDPRODUCT'];
|
||||||
|
$ODR_CNOLAB = $row['ODR_CNOLAB'];
|
||||||
|
$RSLT_NCOMPARISON = $row['RSLT_NCOMPARISON'];
|
||||||
|
$NSEX = $row['NSEX'];
|
||||||
|
$UOM_ID = $row['UOM_ID'];
|
||||||
|
$RSLT_VALUEN = $row['RSLT_VALUEN'];
|
||||||
|
$RSLT_VALUET = $row['RSLT_VALUET'];
|
||||||
|
//$RSLT_VALUEB = $row['RSLT_VALUEB'];
|
||||||
|
$RSLT_VALUEB = 'null';
|
||||||
|
$RSLT_NORMAL = $row['RSLT_NORMAL'];
|
||||||
|
$RSLT_COMMENT = $row['RSLT_COMMENT'];
|
||||||
|
$INTER_UOM_ID = $row['INTER_UOM_ID'];
|
||||||
|
$RSLT_INTERVALUEN = $row['RSLT_INTERVALUEN'];
|
||||||
|
$RSLT_INTERVALUET = $row['RSLT_INTERVALUET'];
|
||||||
|
//$RSLT_INTERVALUEB = $row['RSLT_INTERVALUEB'];
|
||||||
|
$RSLT_INTERVALUEB = 'null';
|
||||||
|
$RSLT_INTERNORMAL = $row['RSLT_INTERNORMAL'];
|
||||||
|
$RSLT_INTERCOMMENT = $row['RSLT_INTERCOMMENT'];
|
||||||
|
$RSLT_NORMALTEXT = $row['FTEXT'];
|
||||||
|
$MACH_ID = $row['MACH_ID'];
|
||||||
|
$RSLT_CREATEDBY = $row['RSLT_CREATEDBY'];
|
||||||
|
$RSLT_NCONVERSION = $row['RSLT_NCONVERSION'];
|
||||||
|
$CIDBILLING = nullAph($CIDBILLING);
|
||||||
|
$CIDBILLINGDT = nullAph($CIDBILLINGDT);
|
||||||
|
$CIDPRODUCT = nullAph($CIDPRODUCT);
|
||||||
|
//$ODR_CNOLAB = nullAph($ODR_CNOLAB);
|
||||||
|
$RSLT_NCOMPARISON = nullAph($RSLT_NCOMPARISON);
|
||||||
|
$NSEX = nullAph($NSEX);
|
||||||
|
$UOM_ID = nullAph($UOM_ID);
|
||||||
|
$RSLT_VALUEN = nullAph($RSLT_VALUEN);
|
||||||
|
$RSLT_VALUET = nullAph($RSLT_VALUET);
|
||||||
|
$RSLT_NORMAL = nullAph($RSLT_NORMAL);
|
||||||
|
$RSLT_COMMENT = nullAph($RSLT_COMMENT);
|
||||||
|
$INTER_UOM_ID = nullAph($INTER_UOM_ID);
|
||||||
|
$RSLT_INTERVALUEN = nullAph($RSLT_INTERVALUEN);
|
||||||
|
$RSLT_INTERVALUET = nullAph($RSLT_INTERVALUET);
|
||||||
|
$RSLT_INTERNORMAL = nullAph($RSLT_INTERNORMAL);
|
||||||
|
$RSLT_INTERCOMMENT = nullAph($RSLT_INTERCOMMENT);
|
||||||
|
$RSLT_NORMALTEXT = nullAph($RSLT_NORMALTEXT);
|
||||||
|
$MACH_ID = nullAph($MACH_ID);
|
||||||
|
$RSLT_CREATEDBY = nullAph($RSLT_CREATEDBY);
|
||||||
|
$RSLT_NCONVERSION = nullAph($RSLT_NCONVERSION);
|
||||||
|
|
||||||
|
//var 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+")";
|
||||||
|
if($CIDBILLINGDT !='') {
|
||||||
|
//echo "<pre>"; print_r($row); echo"</pre>";
|
||||||
|
$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."<br/>";
|
||||||
|
//$resultsc = odbc_exec($connFB, $sqlFB) or die("$sqlFB<br/> ".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."<br/>";
|
||||||
|
$resultsc = odbc_exec($connFB, $sqlFB) or die(odbc_errormsg());
|
||||||
|
}
|
||||||
|
odbc_close($connFB);
|
||||||
|
?>
|
||||||
376
public/spooler_db/package-lock.json
generated
Normal file
376
public/spooler_db/package-lock.json
generated
Normal file
@ -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=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
public/spooler_db/pdf.css
Normal file
34
public/spooler_db/pdf.css
Normal file
@ -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; }
|
||||||
|
}
|
||||||
116
public/spooler_db/pdf.php
Normal file
116
public/spooler_db/pdf.php
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['acc'])) {
|
||||||
|
$ACCESSNUMBER = $_GET['acc'];
|
||||||
|
$pdf = 0;
|
||||||
|
if(isset($_GET['pdf'])) { $pdf = $_GET['pdf']; }
|
||||||
|
} else {
|
||||||
|
$file = $argv[1] ;
|
||||||
|
$filename = explode('\\',$file);
|
||||||
|
$filename = $filename[1];
|
||||||
|
$ACCESSNUMBER = $filename;
|
||||||
|
$pdf = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_GET['eng'])) { $eng = 1; } else { $eng = 0;}
|
||||||
|
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$raw = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
|
||||||
|
if($pdf==0) { $raw.= "<link rel='stylesheet' href='/spooler_db/normalize.min.css' /> <link rel='stylesheet' href='/spooler_db/style.css' />"; }
|
||||||
|
else { $raw .= "<link rel='stylesheet' href='../normalize.min.css' /> <link rel='stylesheet' href='../pdf.css' />"; }
|
||||||
|
$raw .= "</head>
|
||||||
|
<body>";
|
||||||
|
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id=pagetop style='height:0.01cm'> </div>";
|
||||||
|
if($pdf==1) { $raw .= "<img src='../gleneagleshdr.png' class='img'/>"; }
|
||||||
|
$raw .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show note
|
||||||
|
if($i != $npage) {
|
||||||
|
$raw.="</table>";
|
||||||
|
} else {
|
||||||
|
$raw .= "$noSample</table>
|
||||||
|
<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table>";
|
||||||
|
}
|
||||||
|
$raw .= "</div>";
|
||||||
|
$raw .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $raw .= "Status : $status"; }
|
||||||
|
$raw .= "<pre class='small'>Collected on $collData
|
||||||
|
Received on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
if($pdf!=1) {
|
||||||
|
$raw .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
} else {
|
||||||
|
$raw.="<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
}
|
||||||
|
$raw .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
//echo "<img src='gleneaglesftr.png' class='footer-img'/>";
|
||||||
|
if($pdf==1) { $raw .="<img src='../gleneaglesftr.png' class='img'/>"; }
|
||||||
|
$raw .= "</div>";
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
$raw .="</body>";
|
||||||
|
|
||||||
|
//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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
33
public/spooler_db/pdf_qr.css
Normal file
33
public/spooler_db/pdf_qr.css
Normal file
@ -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; }
|
||||||
|
}
|
||||||
1
public/spooler_db/pdf_start.bat
Normal file
1
public/spooler_db/pdf_start.bat
Normal file
@ -0,0 +1 @@
|
|||||||
|
node spooler_pdf.js
|
||||||
137
public/spooler_db/preview.php
Normal file
137
public/spooler_db/preview.php
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
function getHost($conn,$ACCESSNUMBER) {
|
||||||
|
$sql = "select EXTERNALORDERNUMBER from REQUESTS where ACCESSNUMBER='$ACCESSNUMBER'";
|
||||||
|
$stmt = sqlsrv_query( $conn, $sql );
|
||||||
|
if( $stmt == false) { die( print_r( sqlsrv_errors(), true) ); }
|
||||||
|
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC);
|
||||||
|
$HOSTNUMBER = $row[0];
|
||||||
|
return $HOSTNUMBER;
|
||||||
|
}
|
||||||
|
include("config.php");
|
||||||
|
//include("_function.php");
|
||||||
|
$ACCESSNUMBER = $_GET['acc'];
|
||||||
|
$HOSTNUMBER = getHost($conn, $ACCESSNUMBER);
|
||||||
|
echo "$HOSTNUMBER";
|
||||||
|
/*
|
||||||
|
$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);
|
||||||
|
|
||||||
|
if(!isset($_GET['date'])) { $date = date('d-m-Y H:i'); }
|
||||||
|
else { $date = $_GET['date']; }
|
||||||
|
$npage = count($result);
|
||||||
|
$i=1;
|
||||||
|
$raw ='';
|
||||||
|
$pdf ='';
|
||||||
|
$tmp = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='style.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='pdf.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
foreach($result as $page) {
|
||||||
|
$tmp .= "<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='http://glenlis/spooler_db/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show note
|
||||||
|
if($i != $npage) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample</table>
|
||||||
|
<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table>";
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='http://glenlis/spooler_db/gleneaglesftr.png' class='img'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
?>
|
||||||
BIN
public/spooler_db/spooler_db.7z
Normal file
BIN
public/spooler_db/spooler_db.7z
Normal file
Binary file not shown.
38
public/spooler_db/spooler_pdf.js
Normal file
38
public/spooler_db/spooler_pdf.js
Normal file
@ -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;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
29
public/spooler_db/style.css
Normal file
29
public/spooler_db/style.css
Normal file
@ -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;}
|
||||||
29
public/spooler_db/style_qr.css
Normal file
29
public/spooler_db/style_qr.css
Normal file
@ -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;}
|
||||||
29
public/spooler_db/test.js
Normal file
29
public/spooler_db/test.js
Normal file
@ -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;
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
//});
|
||||||
|
|
||||||
8
public/spooler_db/test.php
Normal file
8
public/spooler_db/test.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
$ACCESSNUMBER = "5100321678";
|
||||||
|
//$ACCESSNUMBER = "5100121359";
|
||||||
|
$result = getResult($conn, $ACCESSNUMBER,0);$npage = count($result);
|
||||||
|
echo "$npage<br/><pre>";
|
||||||
|
print_r($result);
|
||||||
205
public/spooler_db/val2.php
Normal file
205
public/spooler_db/val2.php
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['reqnum'])) { $ACCESSNUMBER = $_GET['reqnum']; }
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$noSample = getNoSample($conn,$ACCESSNUMBER);
|
||||||
|
if( $noSample == '' ) {
|
||||||
|
$status = getStatus($conn, $ACCESSNUMBER);
|
||||||
|
} else {
|
||||||
|
$status = "PENDING";
|
||||||
|
}
|
||||||
|
$userid = $_GET['userid'];
|
||||||
|
$val1 = getVal1($conn, $ACCESSNUMBER);
|
||||||
|
$valBy = $val1['valBy'];
|
||||||
|
$valDate = date_format($val1['valDate'], 'd-m-Y H:i');
|
||||||
|
if(!isset($_GET['date'])) { $date = date('d-m-Y H:i'); }
|
||||||
|
else { $date = $_GET['date']; }
|
||||||
|
|
||||||
|
$npage = count($result);
|
||||||
|
$i=1;
|
||||||
|
$raw ='';
|
||||||
|
$pdf ='';
|
||||||
|
$tmp = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='assets/normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='assets/style.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='assets/pdf.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show nosample, others and note
|
||||||
|
if($pageadd !=1) {
|
||||||
|
if( $i != $npage ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
|
||||||
|
if($others != '' && $countline < 38) {
|
||||||
|
$tmp .= "<table><tr><td><b>$othertitle :</b><br/>\r\n";
|
||||||
|
$tmp .= "$others</td></tr></table>";
|
||||||
|
$others = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // page tambahan = 1
|
||||||
|
if( $i != $npage-1 ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Val1 : $valBy $valDate | Val2 : $userid $date</td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($others != '') {
|
||||||
|
$tmp .= "
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='others' style='width:15cm'>
|
||||||
|
<tr><td><b>$othertitle : </b><br/>\r\n
|
||||||
|
$others</td></tr></table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData \r\n".
|
||||||
|
"Page $i/$npage Val1 : $valBy $valDate | Val2 : $userid $date</pre> </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<br/><img src='assets/gleneaglesftr.png' class='img img-footer'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$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);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
?>
|
||||||
193
public/spooler_db/val2_qr.php
Normal file
193
public/spooler_db/val2_qr.php
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
<?php
|
||||||
|
namespace chillerlan\QRCodeExamples;
|
||||||
|
use chillerlan\QRCode\{QRCode, QROptions};
|
||||||
|
|
||||||
|
if(isset($_GET['eng'])) { $eng = $_GET['eng']; $lang='eng'; } else { $eng = 0; $lang = 'ind'; }
|
||||||
|
if(isset($_GET['acc'])) { $ACCESSNUMBER = $_GET['acc']; }
|
||||||
|
|
||||||
|
require_once("qrcode/vendor/autoload.php");
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("_function.php");
|
||||||
|
|
||||||
|
$HOSTNUMBER = getHost($conn, $ACCESSNUMBER);
|
||||||
|
$result = getResult($conn, $ACCESSNUMBER,$eng);
|
||||||
|
$others = getOthers($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";
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
$qrcode = getQrcode($HOSTNUMBER);
|
||||||
|
if(!isset($_GET['date'])) { $date = date('d-m-Y H:i'); }
|
||||||
|
else { $date = $_GET['date']; }
|
||||||
|
$npage = count($result);
|
||||||
|
$i=1;
|
||||||
|
$raw ='';
|
||||||
|
$pdf ='';
|
||||||
|
$tmp = "<head>
|
||||||
|
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||||
|
<link rel='stylesheet' href='assets/normalize.min.css' />";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$raw .= "\r\n<link rel='stylesheet' href='assets/style_qr.css' />";
|
||||||
|
$pdf .= "\r\n<link rel='stylesheet' href='assets/pdf_qr.css' />";
|
||||||
|
$tmp = "</head>
|
||||||
|
<body style='-webkit-print-color-adjust:exact;'>";
|
||||||
|
$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 .= "<div id='page'>
|
||||||
|
<div id=pagetop style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table class='result'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:26%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
<col style='width:10%;'></col>
|
||||||
|
<col style='width:15%;'></col>
|
||||||
|
<col style='width:12%;'></col>
|
||||||
|
</colgroup>
|
||||||
|
<tr> <th rowspan='2' style='border-right:solid 1px black; border-bottom:solid 1px black;'>TEST</th>
|
||||||
|
<th colspan='3' style='border-right:solid 1px black;'>CONVENTIONAL</th> <th colspan='3'>INTERNATIONAL</th> </tr>
|
||||||
|
<tr style='border-bottom:solid 1px black;'> <th>RESULT</th> <th>REF. RANGES</th> <th style='border-right:solid 1px black;'>UNIT</th> <th>RESULT</th> <th>REF. RANGES</th> <th>UNIT</th> </tr>
|
||||||
|
$page
|
||||||
|
";
|
||||||
|
// lastpage show note
|
||||||
|
// lastpage show nosample, others and note
|
||||||
|
if($pageadd !=1) {
|
||||||
|
if( $i != $npage ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
|
||||||
|
if($others != '' && $countline < 39) {
|
||||||
|
$tmp .= "<table><tr><td><b>$othertitle :</b><br/>\r\n";
|
||||||
|
$tmp .= "$others</td></tr></table>";
|
||||||
|
$others = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // page tambahan = 1
|
||||||
|
if( $i != $npage-1 ) {
|
||||||
|
$tmp .="</table>";
|
||||||
|
} else {
|
||||||
|
$tmp .= "$noSample </table>";
|
||||||
|
$tmp .= "<table> <tr><td>Note :</td> <td><pre>$notes</pre></td></tr>
|
||||||
|
</table> <br/>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tmp .= "</div>";
|
||||||
|
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td><a href='http://$qrcode'><img src='".(new QRCode)->render($qrcode)."' alt='QR Code' style='width:3cm' /></a></td>
|
||||||
|
<td valign='middle'>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status<br/>"; }
|
||||||
|
$tmp .= "<span class='small'>Collected on $collData<br/>Received on $recvData</span><br/>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$i+=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($others != '') {
|
||||||
|
$tmp .= "
|
||||||
|
<div id='page'>
|
||||||
|
<div id='pagetop' style='height:0.01cm'> </div>";
|
||||||
|
if($preview==1) { $tmp.= "<div style='font-size:30px'>preview only do not print</div>" ; }
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<img src='assets/gleneagleshdr.png' class='img'/>";
|
||||||
|
$tmp .= "<div id='dinfo'>
|
||||||
|
$info
|
||||||
|
</div>
|
||||||
|
<div id='dresult'>
|
||||||
|
<table>
|
||||||
|
<tr><td><b>$othertitle :</b><br/>\r\n
|
||||||
|
$others</td></tr></table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$tmp .= "<div id='footer'>
|
||||||
|
<table class='footer'>
|
||||||
|
<tr> <td>";
|
||||||
|
if($i == $npage) { $tmp .= "Status : $status"; }
|
||||||
|
$tmp .= "<pre class='small'>Collected on $collData\r\nReceived on $recvData</pre>
|
||||||
|
Page $i/$npage Printed By : $valBy $date </td>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
<td class='right'><pre>
|
||||||
|
|
||||||
|
(__________________)
|
||||||
|
Authorised Signature
|
||||||
|
</pre></td>";
|
||||||
|
$raw .= $tmp; $tmp = '';
|
||||||
|
$pdf .= "<td class='right'><pre><b>”This result is valid without signature.”</b></pre></td>";
|
||||||
|
|
||||||
|
$tmp .="
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
|
||||||
|
$pdf .="<img src='assets/gleneaglesftr.png' class='img'/>";
|
||||||
|
$tmp .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp .="</body>";
|
||||||
|
$raw .= $tmp; $pdf .= $tmp; $tmp = '';
|
||||||
|
echo $pdf;
|
||||||
|
?>
|
||||||
71
tests/unit/ReportTest.php
Normal file
71
tests/unit/ReportTest.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Tests\Support\DatabaseTestCase;
|
||||||
|
|
||||||
|
class ReportTest extends DatabaseTestCase
|
||||||
|
{
|
||||||
|
protected $migrate = false;
|
||||||
|
protected $refresh = false;
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user