From a0dee0f35145c3a7572382d76004e2044a30d49a Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Fri, 14 Nov 2025 08:30:35 +0700 Subject: [PATCH 1/6] remove seq --- app/Models/PatVisit/PatVisitADTModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/PatVisit/PatVisitADTModel.php b/app/Models/PatVisit/PatVisitADTModel.php index 1683fea..33c9037 100644 --- a/app/Models/PatVisit/PatVisitADTModel.php +++ b/app/Models/PatVisit/PatVisitADTModel.php @@ -6,7 +6,7 @@ use App\Models\BaseModel; class PatVisitADTModel extends BaseModel { protected $table = 'patvisitadt'; protected $primaryKey = 'PVADTID'; - protected $allowedFields = ['InternalPVID', 'Sequence', 'ADTCode', 'LocationID', 'AttDoc', 'RefDoc', 'AdmDoc', 'CnsDoc', + protected $allowedFields = ['InternalPVID', 'ADTCode', 'LocationID', 'AttDoc', 'RefDoc', 'AdmDoc', 'CnsDoc', 'CreateDate', 'EndDate', 'ArchivedDate', 'DelDate']; protected $visnum_prefix; From 6772bbed3f596ef2006c43f0f8840d46604891b3 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Fri, 14 Nov 2025 16:50:49 +0700 Subject: [PATCH 2/6] prework --- .../Migrations/2025-09-09-155526_Pat_Visit.php | 1 - app/Database/Seeds/DummySeeder.php | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/Database/Migrations/2025-09-09-155526_Pat_Visit.php b/app/Database/Migrations/2025-09-09-155526_Pat_Visit.php index 6ca3072..fd4f1b3 100644 --- a/app/Database/Migrations/2025-09-09-155526_Pat_Visit.php +++ b/app/Database/Migrations/2025-09-09-155526_Pat_Visit.php @@ -41,7 +41,6 @@ class CreatePVTables extends Migration { $this->forge->addField([ 'PVADTID' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true], 'InternalPVID'=> ['type' => 'INT', 'null' => true], - 'Sequence' => ['type' => 'INT', 'null' => true], 'ADTCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'LocationID' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'AttDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true], diff --git a/app/Database/Seeds/DummySeeder.php b/app/Database/Seeds/DummySeeder.php index 5ab8d3f..6f132d8 100644 --- a/app/Database/Seeds/DummySeeder.php +++ b/app/Database/Seeds/DummySeeder.php @@ -83,14 +83,14 @@ class DummySeeder extends Seeder { $this->db->table('patvisit')->insertBatch($data); $data = [ - ['InternalPVID'=>1, "Sequence"=>1, "ADTCode"=>"X01", "LocationID"=>1, "AttDoc"=>null, "CreateDate"=>"$now"], - ['InternalPVID'=>1, "Sequence"=>2, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>1, "CreateDate"=>"$now"], - ['InternalPVID'=>1, "Sequence"=>3, "ADTCode"=>"X01", "LocationID"=>2, "AttDoc"=>null, "CreateDate"=>"$now"], - ['InternalPVID'=>1, "Sequence"=>4, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>2, "CreateDate"=>"$now"], - ['InternalPVID'=>2, "Sequence"=>1, "ADTCode"=>"X01", "LocationID"=>1, "AttDoc"=>null, "CreateDate"=>"$now"], - ['InternalPVID'=>2, "Sequence"=>2, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>1, "CreateDate"=>"$now"], - ['InternalPVID'=>2, "Sequence"=>3, "ADTCode"=>"X01", "LocationID"=>2, "AttDoc"=>null, "CreateDate"=>"$now"], - ['InternalPVID'=>2, "Sequence"=>4, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>2, "CreateDate"=>"$now"], + ['InternalPVID'=>1, "ADTCode"=>"X01", "LocationID"=>1, "AttDoc"=>null, "CreateDate"=>"$now"], + ['InternalPVID'=>1, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>1, "CreateDate"=>"$now"], + ['InternalPVID'=>1, "ADTCode"=>"X01", "LocationID"=>2, "AttDoc"=>null, "CreateDate"=>"$now"], + ['InternalPVID'=>1, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>2, "CreateDate"=>"$now"], + ['InternalPVID'=>2, "ADTCode"=>"X01", "LocationID"=>1, "AttDoc"=>null, "CreateDate"=>"$now"], + ['InternalPVID'=>2, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>1, "CreateDate"=>"$now"], + ['InternalPVID'=>2, "ADTCode"=>"X01", "LocationID"=>2, "AttDoc"=>null, "CreateDate"=>"$now"], + ['InternalPVID'=>2, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>2, "CreateDate"=>"$now"], ]; $this->db->table('patvisitadt')->insertBatch($data); From 6a4cc3a0d6ea9e46ed4d9eb563ec739257995f0f Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Mon, 17 Nov 2025 16:53:57 +0700 Subject: [PATCH 3/6] add dummy test --- app/Database/Seeds/DummySeeder.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/Database/Seeds/DummySeeder.php b/app/Database/Seeds/DummySeeder.php index 6f132d8..231e162 100644 --- a/app/Database/Seeds/DummySeeder.php +++ b/app/Database/Seeds/DummySeeder.php @@ -3,6 +3,7 @@ namespace App\Database\Seeds; use CodeIgniter\Database\Seeder; +use App\Models\ValueSet\ValueSetModel; class DummySeeder extends Seeder { @@ -10,6 +11,12 @@ class DummySeeder extends Seeder { public function run() { $now = date('Y-m-d H:i:s'); + $vsModel = new ValueSetModel(); + $rows = $vsModel->select("VID, VSetID, VValue")->findAll(); + $vs = []; + foreach ($rows as $row) { + $vs[$row['VSetID']][$row['VValue']] = $row['VID']; + } // location $data = [ @@ -114,8 +121,22 @@ class DummySeeder extends Seeder { $this->db->table('department')->insertBatch($data); $data = [ - [ 'WorkstationID' => 1, 'DepartmentID' => 1, 'WorkstationCode' => 'QWST', 'WorkstationName'=>'Dummy Workstation', 'Type'=>null, 'LinkTo'=> null, 'Enable'=>1,'CreateDate' => "$now" ], + [ 'WorkstationID' => 1, 'DepartmentID' => 1, 'WorkstationCode' => 'QWST', 'WorkstationName'=>'Dummy Workstation', 'Type'=>null, 'LinkTo'=> null, 'Enable'=>$vs[2][1],'CreateDate' => "$now" ], ]; $this->db->table('workstation')->insertBatch($data); + + // Test + $data = [ + [ "TestSiteCode" => "QTNUM", "TestSiteName" => "Dummy Test Numeric", "Type" => $vs[27]['TNum'], "Description" => "Dum Dum Numeric", "SeqScr" => "1", "SeqRpt" => "1", "IndentLeft" => "0", + "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ], + [ "TestSiteCode" => "QTHRS", "TestSiteName" => "Dummy Test Threshold", "Type" => $vs[27]['TThrs'], "Description" => "Dum Dum Threshold", "SeqScr" => "2", "SeqRpt" => "2", "IndentLeft" => "0", + "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ], + [ "TestSiteCode" => "QPNUM1", "TestSiteName" => "Dummy Test Param1", "Type" => $vs[27]['PNum'], "Description" => "Dum Dum Param1", "SeqScr" => "3", "SeqRpt" => "3", "IndentLeft" => "0", + "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ], + [ "TestSiteCode" => "QPNUM2", "TestSiteName" => "Dummy Test Param2", "Type" => $vs[27]['PNum'], "Description" => "Dum Dum Param2", "SeqScr" => "4", "SeqRpt" => "4", "IndentLeft" => "0", + "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ], + ]; + $this->db->table('testdefsite')->insertBatch($data); + } } \ No newline at end of file From 04b8c7991139779afc0c0d172dcaaba953ca5312 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Tue, 18 Nov 2025 09:14:02 +0700 Subject: [PATCH 4/6] add dummy test --- app/Database/Seeds/DummySeeder.php | 42 ++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/app/Database/Seeds/DummySeeder.php b/app/Database/Seeds/DummySeeder.php index 231e162..1de2ef5 100644 --- a/app/Database/Seeds/DummySeeder.php +++ b/app/Database/Seeds/DummySeeder.php @@ -126,17 +126,37 @@ class DummySeeder extends Seeder { $this->db->table('workstation')->insertBatch($data); // Test - $data = [ - [ "TestSiteCode" => "QTNUM", "TestSiteName" => "Dummy Test Numeric", "Type" => $vs[27]['TNum'], "Description" => "Dum Dum Numeric", "SeqScr" => "1", "SeqRpt" => "1", "IndentLeft" => "0", - "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ], - [ "TestSiteCode" => "QTHRS", "TestSiteName" => "Dummy Test Threshold", "Type" => $vs[27]['TThrs'], "Description" => "Dum Dum Threshold", "SeqScr" => "2", "SeqRpt" => "2", "IndentLeft" => "0", - "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ], - [ "TestSiteCode" => "QPNUM1", "TestSiteName" => "Dummy Test Param1", "Type" => $vs[27]['PNum'], "Description" => "Dum Dum Param1", "SeqScr" => "3", "SeqRpt" => "3", "IndentLeft" => "0", - "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ], - [ "TestSiteCode" => "QPNUM2", "TestSiteName" => "Dummy Test Param2", "Type" => $vs[27]['PNum'], "Description" => "Dum Dum Param2", "SeqScr" => "4", "SeqRpt" => "4", "IndentLeft" => "0", - "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ], - ]; - $this->db->table('testdefsite')->insertBatch($data); + // TNUM + $data = [ "TestSiteCode" => "QTNUM1", "TestSiteName" => "Dummy Test Numeric", "Type" => $vs[27]['TNum'], "Description" => "Dum Dum Numeric", "SeqScr" => "10", "SeqRpt" => "10", "IndentLeft" => "0", + "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ]; + $id = $this->db->table('testdefsite')->insert($data); + $data = [ "DisciplineID" => 1, "DepartmentID" => 1, "VSet"=>'', "SpcType" => $vs[15]["BLD"], "ReqQty"=>"5", "ReqQtyUnit"=>$vs[16]['mL'], "Unit1"=>$vs[28]["mg/L"], + "Decimal"=>2, "Method"=>"DIY", "ExpectedTAT"=>"200Y", "CreateDate"=> "$now" ]; + $data['TestSiteID']= $id; + $id = $this->db->table('testdeftech')->insert($data); + $data = [ "TestSiteCode" => "QTNUM2", "TestSiteName" => "Dummy Test Numeric", "Type" => $vs[27]['TNum'], "Description" => "Dum Dum Numeric", "SeqScr" => "20", "SeqRpt" => "20", "IndentLeft" => "0", + "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ]; + $id = $this->db->table('testdefsite')->insert($data); + $data = [ "DisciplineID" => 1, "DepartmentID" => 1, "VSet"=>'', "SpcType" => $vs[15]["BLD"], "ReqQty"=>"50", "ReqQtyUnit"=>$vs[16]['mL'], "Unit1"=>$vs[28]["g/L"], + "Decimal"=>1, "Method"=>"YOLO", "ExpectedTAT"=>"1000Y", "CreateDate"=> "$now" ]; + $data['TestSiteID']= $id; + $id = $this->db->table('testdeftech')->insert($data); + + // PNum + $data = [ "TestSiteCode" => "QPNUM1", "TestSiteName" => "Dummy Test Param", "Type" => $vs[27]['PNum'], "Description" => "Dum Dum Param", "SeqScr" => "40", "SeqRpt" => "40", "IndentLeft" => "0", + "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ]; + $id = $this->db->table('testdefsite')->insert($data); + $data = [ "DisciplineID" => 1, "DepartmentID" => 1, "Decimal"=>2, "CreateDate"=> "$now" ]; + $data['TestSiteID']= $id; + $id = $this->db->table('testdeftech')->insert($data); + + $data = [ "TestSiteCode" => "QPNUM2", "TestSiteName" => "Dummy Test Param", "Type" => $vs[27]['PNum'], "Description" => "Dum Dum Param", "SeqScr" => "50", "SeqRpt" => "50", "IndentLeft" => "0", + "VisibleScr" => $vs[2][1], "VisibleRpt" => $vs[2][1], "CountStat" => $vs[2][1], "CreateDate" => "$now" ]; + $id = $this->db->table('testdefsite')->insert($data); + $data = [ "DisciplineID" => 1, "DepartmentID" => 1, "Decimal"=>3, "CreateDate"=> "$now" ]; + $data['TestSiteID']= $id; + $id = $this->db->table('testdeftech')->insert($data); + } } \ No newline at end of file From 39c9b39edf9c017b6879b8b0cc98e0919bec9634 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Wed, 19 Nov 2025 13:38:46 +0700 Subject: [PATCH 5/6] fix testdefsite post --- app/Controllers/Test/TestDefSite.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Controllers/Test/TestDefSite.php b/app/Controllers/Test/TestDefSite.php index 7ed6a3a..01d8a82 100644 --- a/app/Controllers/Test/TestDefSite.php +++ b/app/Controllers/Test/TestDefSite.php @@ -15,6 +15,9 @@ class TestDefSite extends BaseController { public function __construct() { $this->db = \Config\Database::connect(); $this->model = new TestDefSiteModel; + $this->rules = [ + "TestSiteCode" => "required" + ]; } public function index() { From fc990ffa8164ca8ba651dd34351e6f4979420a9a Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Wed, 19 Nov 2025 14:26:32 +0700 Subject: [PATCH 6/6] add testdefsite rule --- app/Controllers/Test/TestDefSite.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Test/TestDefSite.php b/app/Controllers/Test/TestDefSite.php index 01d8a82..f797e94 100644 --- a/app/Controllers/Test/TestDefSite.php +++ b/app/Controllers/Test/TestDefSite.php @@ -16,7 +16,9 @@ class TestDefSite extends BaseController { $this->db = \Config\Database::connect(); $this->model = new TestDefSiteModel; $this->rules = [ - "TestSiteCode" => "required" + "TestSiteCode" => "required", + "TestSiteName" => "required", + "Type" => "required", ]; }