ganti format table

This commit is contained in:
sas.fajri
2025-04-24 14:39:28 +07:00
parent f481cc76f1
commit a2a700280b
11 changed files with 2078 additions and 1397 deletions

View File

@@ -1,65 +1,258 @@
-- Tabel Pelanggan -- Tabel Pelanggan
CREATE TABLE customers ( CREATE TABLE customers (
id INT PRIMARY KEY AUTO_INCREMENT, CustomerID INT PRIMARY KEY AUTO_INCREMENT,
customer_code VARCHAR(20) UNIQUE, CustomerCode VARCHAR(20) UNIQUE,
company_name VARCHAR(100), CustomerCompanyName VARCHAR(100),
customer_type ENUM('internal', 'external'), CustomerType ENUM('internal', 'external'),
address TEXT, CustomerAddress TEXT,
city VARCHAR(50), CustomerCity VARCHAR(50),
postal_code VARCHAR(10), CustomerPostalCode VARCHAR(10),
phone VARCHAR(20), CustomerPhone VARCHAR(20),
email VARCHAR(100), CustomerEmail VARCHAR(100),
pic_name VARCHAR(100), CustomerPICName VARCHAR(100),
pic_phone VARCHAR(20), CustomerPICPhone VARCHAR(20),
pic_email VARCHAR(100), CustomerPICEmail VARCHAR(100),
registration_date DATETIME DEFAULT CURRENT_TIMESTAMP, CustomerRegistrationDate DATETIME DEFAULT CURRENT_TIMESTAMP,
status ENUM('active', 'inactive') DEFAULT 'active', CustomerStatus ENUM('active', 'inactive') DEFAULT 'active',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, CustomerCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP CustomerCreatedUserID INT,
CustomerUpdatedAt DATETIME,
CustomerUpdatedUserID INT,
CustomerDeletedAt DATETIME,
CustomerDeletedUserID INT
); );
-- Tabel Riwayat Permintaan Analisis -- Tabel Riwayat Permintaan Analisis
CREATE TABLE analysis_requests ( CREATE TABLE analysis_requests (
id INT PRIMARY KEY AUTO_INCREMENT, AnalysisRequestID INT PRIMARY KEY AUTO_INCREMENT,
request_code VARCHAR(20) UNIQUE, AnalysisRequestCode VARCHAR(20) UNIQUE,
customer_id INT, CustomerID INT,
request_date DATETIME, AnalysisRequestDate DATETIME,
status ENUM('new', 'process', 'completed', 'cancelled'), AnalysisRequestStatus ENUM('new', 'process', 'completed', 'cancelled'),
total_amount DECIMAL(10,2), AnalysisRequestTotalAmount DECIMAL(10,2),
notes TEXT, AnalysisRequestNotes TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, AnalysisRequestCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (customer_id) REFERENCES customers(id) AnalysisRequestCreatedUserID INT,
AnalysisRequestUpdatedAt DATETIME,
AnalysisRequestUpdatedUserID INT,
AnalysisRequestDeletedAt DATETIME,
AnalysisRequestDeletedUserID INT
); );
-- Tabel Riwayat Pembayaran -- Tabel Riwayat Pembayaran
CREATE TABLE payments ( CREATE TABLE payments (
id INT PRIMARY KEY AUTO_INCREMENT, PaymentID INT PRIMARY KEY AUTO_INCREMENT,
request_id INT, AnalysisRequestID INT,
payment_code VARCHAR(20) UNIQUE, PaymentCode VARCHAR(20) UNIQUE,
payment_date DATETIME, PaymentDate DATETIME,
amount DECIMAL(10,2), PaymentAmount DECIMAL(10,2),
payment_method ENUM('cash', 'transfer', 'credit_card'), PaymentMethod ENUM('cash', 'transfer', 'credit_card'),
payment_status ENUM('pending', 'completed', 'failed'), PaymentStatus ENUM('pending', 'completed', 'failed'),
proof_of_payment VARCHAR(255), PaymentProofPath VARCHAR(255),
notes TEXT, PaymentNotes TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, PaymentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (request_id) REFERENCES analysis_requests(id) PaymentCreatedUserID INT,
PaymentUpdatedAt DATETIME,
PaymentUpdatedUserID INT,
PaymentDeletedAt DATETIME,
PaymentDeletedUserID INT
);
-- Tabel Kategori Pelanggan
CREATE TABLE customer_categories (
CustomerCategoryID INT PRIMARY KEY AUTO_INCREMENT,
CustomerCategoryCode VARCHAR(20) UNIQUE,
CustomerCategoryName VARCHAR(100),
CustomerCategoryDescription TEXT,
CustomerCategoryIsActive BOOLEAN DEFAULT TRUE,
CustomerCategoryCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
CustomerCategoryCreatedUserID INT,
CustomerCategoryUpdatedAt DATETIME,
CustomerCategoryUpdatedUserID INT,
CustomerCategoryDeletedAt DATETIME,
CustomerCategoryDeletedUserID INT
);
-- Tabel Kontak Tambahan Pelanggan
CREATE TABLE customer_contacts (
CustomerContactID INT PRIMARY KEY AUTO_INCREMENT,
CustomerID INT,
CustomerContactName VARCHAR(100),
CustomerContactPosition VARCHAR(100),
CustomerContactDepartment VARCHAR(100),
CustomerContactPhone VARCHAR(20),
CustomerContactEmail VARCHAR(100),
CustomerContactIsMainContact BOOLEAN DEFAULT FALSE,
CustomerContactIsActive BOOLEAN DEFAULT TRUE,
CustomerContactCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
CustomerContactCreatedUserID INT,
CustomerContactUpdatedAt DATETIME,
CustomerContactUpdatedUserID INT,
CustomerContactDeletedAt DATETIME,
CustomerContactDeletedUserID INT
);
-- Tabel Dokumen Pelanggan
CREATE TABLE customer_documents (
CustomerDocumentID INT PRIMARY KEY AUTO_INCREMENT,
CustomerID INT,
CustomerDocumentType VARCHAR(50),
CustomerDocumentNumber VARCHAR(100),
CustomerDocumentName VARCHAR(255),
CustomerDocumentPath VARCHAR(255),
CustomerDocumentIssuedDate DATE,
CustomerDocumentExpiredDate DATE,
CustomerDocumentIsActive BOOLEAN DEFAULT TRUE,
CustomerDocumentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
CustomerDocumentCreatedUserID INT,
CustomerDocumentUpdatedAt DATETIME,
CustomerDocumentUpdatedUserID INT,
CustomerDocumentDeletedAt DATETIME,
CustomerDocumentDeletedUserID INT
);
-- Tabel Riwayat Aktivitas Pelanggan
CREATE TABLE customer_activities (
CustomerActivityID INT PRIMARY KEY AUTO_INCREMENT,
CustomerID INT,
CustomerActivityType VARCHAR(50),
CustomerActivityDescription TEXT,
CustomerActivityDate DATETIME,
CustomerActivityStatus VARCHAR(50),
CustomerActivityNotes TEXT,
CustomerActivityCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
CustomerActivityCreatedUserID INT,
CustomerActivityUpdatedAt DATETIME,
CustomerActivityUpdatedUserID INT,
CustomerActivityDeletedAt DATETIME,
CustomerActivityDeletedUserID INT
);
-- Tabel Riwayat Komunikasi Pelanggan
CREATE TABLE customer_communications (
CustomerCommunicationID INT PRIMARY KEY AUTO_INCREMENT,
CustomerID INT,
CustomerContactID INT,
CustomerCommunicationType VARCHAR(50),
CustomerCommunicationSubject VARCHAR(255),
CustomerCommunicationContent TEXT,
CustomerCommunicationDate DATETIME,
CustomerCommunicationStatus VARCHAR(50),
CustomerCommunicationFollowUpDate DATETIME,
CustomerCommunicationNotes TEXT,
CustomerCommunicationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
CustomerCommunicationCreatedUserID INT,
CustomerCommunicationUpdatedAt DATETIME,
CustomerCommunicationUpdatedUserID INT,
CustomerCommunicationDeletedAt DATETIME,
CustomerCommunicationDeletedUserID INT
); );
-- Contoh data pelanggan -- Contoh data pelanggan
INSERT INTO customers (customer_code, company_name, customer_type, address, city, postal_code, phone, email, pic_name, pic_phone, pic_email) VALUES INSERT INTO customers (
CustomerCode,
CustomerCompanyName,
CustomerType,
CustomerAddress,
CustomerCity,
CustomerPostalCode,
CustomerPhone,
CustomerEmail,
CustomerPICName,
CustomerPICPhone,
CustomerPICEmail
) VALUES
('CUST001', 'PT Lingkungan Hijau', 'external', 'Jl. Raya Utama No. 123', 'Jakarta', '12345', '021-5551234', 'info@lingkunganhijau.com', 'Budi Santoso', '081234567890', 'budi@lingkunganhijau.com'), ('CUST001', 'PT Lingkungan Hijau', 'external', 'Jl. Raya Utama No. 123', 'Jakarta', '12345', '021-5551234', 'info@lingkunganhijau.com', 'Budi Santoso', '081234567890', 'budi@lingkunganhijau.com'),
('CUST002', 'Dinas Lingkungan Hidup', 'internal', 'Jl. Pemda No. 45', 'Bandung', '40111', '022-7891234', 'dlh@bandung.go.id', 'Siti Aminah', '087812345678', 'siti@bandung.go.id'), ('CUST002', 'Dinas Lingkungan Hidup', 'internal', 'Jl. Pemda No. 45', 'Bandung', '40111', '022-7891234', 'dlh@bandung.go.id', 'Siti Aminah', '087812345678', 'siti@bandung.go.id'),
('CUST003', 'CV Alam Lestari', 'external', 'Jl. Industri Blok A2', 'Surabaya', '60111', '031-8765432', 'contact@alamlestari.com', 'Rudi Hartono', '085678901234', 'rudi@alamlestari.com'); ('CUST003', 'CV Alam Lestari', 'external', 'Jl. Industri Blok A2', 'Surabaya', '60111', '031-8765432', 'contact@alamlestari.com', 'Rudi Hartono', '085678901234', 'rudi@alamlestari.com');
-- Contoh data permintaan analisis -- Contoh data permintaan analisis
INSERT INTO analysis_requests (request_code, customer_id, request_date, status, total_amount, notes) VALUES INSERT INTO analysis_requests (
AnalysisRequestCode,
CustomerID,
AnalysisRequestDate,
AnalysisRequestStatus,
AnalysisRequestTotalAmount,
AnalysisRequestNotes
) VALUES
('REQ001', 1, '2024-03-15 09:00:00', 'completed', 2500000, 'Analisis air limbah'), ('REQ001', 1, '2024-03-15 09:00:00', 'completed', 2500000, 'Analisis air limbah'),
('REQ002', 1, '2024-03-16 10:30:00', 'process', 1750000, 'Analisis kualitas udara'), ('REQ002', 1, '2024-03-16 10:30:00', 'process', 1750000, 'Analisis kualitas udara'),
('REQ003', 2, '2024-03-17 13:15:00', 'new', 3000000, 'Analisis tanah'); ('REQ003', 2, '2024-03-17 13:15:00', 'new', 3000000, 'Analisis tanah');
-- Contoh data pembayaran -- Contoh data pembayaran
INSERT INTO payments (request_id, payment_code, payment_date, amount, payment_method, payment_status, notes) VALUES INSERT INTO payments (
AnalysisRequestID,
PaymentCode,
PaymentDate,
PaymentAmount,
PaymentMethod,
PaymentStatus,
PaymentNotes
) VALUES
(1, 'PAY001', '2024-03-15 14:30:00', 2500000, 'transfer', 'completed', 'Pembayaran lunas'), (1, 'PAY001', '2024-03-15 14:30:00', 2500000, 'transfer', 'completed', 'Pembayaran lunas'),
(2, 'PAY002', '2024-03-16 11:00:00', 875000, 'transfer', 'completed', 'Pembayaran DP 50%'), (2, 'PAY002', '2024-03-16 11:00:00', 875000, 'transfer', 'completed', 'Pembayaran DP 50%'),
(3, 'PAY003', '2024-03-17 14:00:00', 1500000, 'transfer', 'pending', 'Menunggu konfirmasi transfer'); (3, 'PAY003', '2024-03-17 14:00:00', 1500000, 'transfer', 'pending', 'Menunggu konfirmasi transfer');
-- Contoh data kategori pelanggan
INSERT INTO customer_categories (
CustomerCategoryCode,
CustomerCategoryName,
CustomerCategoryDescription
) VALUES
('CAT001', 'Industri', 'Pelanggan dari sektor industri manufaktur'),
('CAT002', 'Pemerintahan', 'Instansi pemerintah dan BUMN'),
('CAT003', 'Komersial', 'Pelanggan komersial non-industri');
-- Contoh data kontak tambahan
INSERT INTO customer_contacts (
CustomerID,
CustomerContactName,
CustomerContactPosition,
CustomerContactDepartment,
CustomerContactPhone,
CustomerContactEmail,
CustomerContactIsMainContact
) VALUES
(1, 'Andi Wijaya', 'HSE Manager', 'HSE', '081234567891', 'andi@lingkunganhijau.com', TRUE),
(1, 'Diana Putri', 'Lab Coordinator', 'Quality Control', '081234567892', 'diana@lingkunganhijau.com', FALSE),
(2, 'Bambang Kusuma', 'Kepala Seksi', 'Pengawasan', '087812345679', 'bambang@bandung.go.id', TRUE);
-- Contoh data dokumen
INSERT INTO customer_documents (
CustomerID,
CustomerDocumentType,
CustomerDocumentNumber,
CustomerDocumentName,
CustomerDocumentPath,
CustomerDocumentIssuedDate,
CustomerDocumentExpiredDate
) VALUES
(1, 'SIUP', '123/SIUP/2024', 'SIUP PT Lingkungan Hijau', '/documents/siup/123.pdf', '2024-01-01', '2029-01-01'),
(1, 'NPWP', '01.234.567.8-123.000', 'NPWP PT Lingkungan Hijau', '/documents/npwp/123.pdf', '2024-01-01', NULL),
(2, 'SK', 'SK-123/DLH/2024', 'SK Penunjukan', '/documents/sk/123.pdf', '2024-01-01', '2024-12-31');
-- Contoh data aktivitas
INSERT INTO customer_activities (
CustomerID,
CustomerActivityType,
CustomerActivityDescription,
CustomerActivityDate,
CustomerActivityStatus
) VALUES
(1, 'Visit', 'Kunjungan teknis untuk sampling rutin', '2024-03-15 10:00:00', 'Completed'),
(1, 'Meeting', 'Pembahasan hasil analisis', '2024-03-16 13:00:00', 'Scheduled'),
(2, 'Training', 'Pelatihan pengambilan sampel', '2024-03-17 09:00:00', 'Scheduled');
-- Contoh data komunikasi
INSERT INTO customer_communications (
CustomerID,
CustomerContactID,
CustomerCommunicationType,
CustomerCommunicationSubject,
CustomerCommunicationContent,
CustomerCommunicationDate,
CustomerCommunicationStatus
) VALUES
(1, 1, 'Email', 'Konfirmasi Jadwal Sampling', 'Konfirmasi jadwal sampling minggu depan', '2024-03-14 09:00:00', 'Sent'),
(1, 2, 'Phone', 'Diskusi Hasil Analisis', 'Diskusi tentang hasil analisis yang melebihi baku mutu', '2024-03-15 14:00:00', 'Completed'),
(2, 3, 'Meeting', 'Rapat Koordinasi', 'Rapat koordinasi program pemantauan lingkungan', '2024-03-16 10:00:00', 'Scheduled');

View File

@@ -206,6 +206,100 @@
border: 1px solid #2196F3; border: 1px solid #2196F3;
color: #0d47a1; color: #0d47a1;
} }
.parameter-category {
margin-bottom: 20px;
padding: 15px;
background: #f8f9fa;
border-radius: 4px;
}
.parameter-item {
display: grid;
grid-template-columns: auto 1fr auto auto;
gap: 15px;
align-items: center;
padding: 12px;
border-bottom: 1px solid #eee;
transition: background-color 0.2s;
}
.parameter-item:hover {
background-color: #f8f9fa;
}
.parameter-info {
display: flex;
flex-direction: column;
}
.parameter-name {
font-weight: bold;
}
.parameter-method {
font-size: 12px;
color: #666;
}
.parameter-price {
font-weight: bold;
color: #2196F3;
}
.selected-material {
margin-bottom: 15px;
padding: 10px;
background: #e3f2fd;
border-radius: 4px;
font-weight: bold;
}
.category-selection {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.category-card {
border: 1px solid #ddd;
border-radius: 4px;
padding: 15px;
cursor: pointer;
transition: all 0.3s ease;
}
.category-card:hover {
border-color: #2196F3;
background: #f8f9fa;
}
.category-card.selected {
border-color: #2196F3;
background: #e3f2fd;
}
.selected-bidang,
.selected-category {
margin-bottom: 15px;
padding: 10px;
background: #e3f2fd;
border-radius: 4px;
font-weight: bold;
}
.parameter-group {
margin-bottom: 20px;
padding: 15px;
background: #f8f9fa;
border-radius: 4px;
}
.parameter-group h4 {
margin-bottom: 10px;
color: #2196F3;
}
</style> </style>
</head> </head>
<body> <body>
@@ -217,11 +311,11 @@
</div> </div>
<div class="step"> <div class="step">
<div class="step-number">2</div> <div class="step-number">2</div>
<div class="step-title">Pilih Template</div> <div class="step-title">Pilih Bidang Pengujian</div>
</div> </div>
<div class="step"> <div class="step">
<div class="step-number">3</div> <div class="step-number">3</div>
<div class="step-title">Parameter</div> <div class="step-title">Pilih Kategori</div>
</div> </div>
<div class="step"> <div class="step">
<div class="step-number">4</div> <div class="step-number">4</div>
@@ -258,50 +352,56 @@
</div> </div>
</div> </div>
<!-- Step 2: Pilih Template --> <!-- Step 2: Pilih Bidang Pengujian -->
<div class="form-section" id="step2"> <div class="form-section" id="step2">
<h3>Pilih Template Analisis</h3> <h3>Pilih Bidang Pengujian</h3>
<div class="template-selection"> <div class="template-selection">
<div class="template-card" data-template-id="1"> <div class="template-card" data-type="fisika">
<h4>Air Limbah Industri</h4> <h4>FISIKA</h4>
<p>Template standar untuk analisis air limbah industri</p> <p>Pengujian parameter fisika</p>
<small>15 Parameter</small> <small>Udara Lingkungan Kerja</small>
</div> </div>
<div class="template-card" data-template-id="2"> <div class="template-card" data-type="kimia">
<h4>Air Minum</h4> <h4>KIMIA</h4>
<p>Template untuk analisis kualitas air minum</p> <p>Pengujian parameter kimia</p>
<small>12 Parameter</small> <small>Air Minum & Limbah Domestik</small>
</div> </div>
<div class="template-card" data-template-id="3"> <div class="template-card" data-type="biologi">
<h4>Udara Ambien</h4> <h4>BIOLOGI</h4>
<p>Template untuk analisis kualitas udara</p> <p>Pengujian parameter biologi</p>
<small>8 Parameter</small> <small>Air Minum, Limbah & IPAL</small>
</div> </div>
</div> </div>
</div> </div>
<!-- Step 3: Parameter --> <!-- Step 3: Pilih Kategori -->
<div class="form-section" id="step3"> <div class="form-section" id="step3">
<h3>Pilih Parameter Analisis</h3> <h3>Pilih Kategori Pengujian</h3>
<div class="parameter-list"> <div class="selected-bidang"></div>
<!-- Parameters will be loaded dynamically based on selected template --> <div class="category-selection">
<!-- Categories will be loaded dynamically -->
</div> </div>
</div> </div>
<!-- Step 4: Konfirmasi --> <!-- Step 4: Parameter -->
<div class="form-section" id="step4"> <div class="form-section" id="step4">
<h3>Konfirmasi Permintaan</h3> <h3>Pilih Parameter Analisis</h3>
<div class="price-summary"> <div class="selected-category"></div>
<h4>Ringkasan Biaya</h4> <div class="parameter-list">
<p>Jumlah Parameter: <span id="parameterCount">0</span></p> <!-- Parameters will be loaded dynamically -->
<p>Subtotal: <span id="subtotal">Rp 0</span></p>
<p>PPN (11%): <span id="tax">Rp 0</span></p>
<p><strong>Total: <span id="total">Rp 0</span></strong></p>
</div> </div>
</div>
<div class="alert alert-info"> <div class="price-summary">
<p>Setelah permintaan disubmit, tim kami akan memproses dan mengirimkan quotation dalam 1x24 jam kerja.</p> <h4>Ringkasan Biaya</h4>
</div> <p>Jumlah Parameter: <span id="parameterCount">0</span></p>
<p>Subtotal: <span id="subtotal">Rp 0</span></p>
<p>PPN (11%): <span id="tax">Rp 0</span></p>
<p><strong>Total: <span id="total">Rp 0</span></strong></p>
</div>
<div class="alert alert-info">
<p>Setelah permintaan disubmit, tim kami akan memproses dan mengirimkan quotation dalam 1x24 jam kerja.</p>
</div> </div>
<div class="navigation-buttons"> <div class="navigation-buttons">
@@ -360,17 +460,194 @@
} }
}); });
// Template selection let selectedBidang = null;
let selectedCategory = null;
let selectedParameters = new Set();
// Handle bidang selection
document.querySelectorAll('.template-card').forEach(card => { document.querySelectorAll('.template-card').forEach(card => {
card.addEventListener('click', () => { card.addEventListener('click', () => {
document.querySelectorAll('.template-card').forEach(c => c.classList.remove('selected')); document.querySelectorAll('.template-card').forEach(c => c.classList.remove('selected'));
card.classList.add('selected'); card.classList.add('selected');
// Here you would typically load the parameters for the selected template selectedBidang = card.dataset.type;
loadCategories(selectedBidang);
}); });
}); });
function loadCategories(bidangType) {
const bidang = testingParameters[bidangType];
if (!bidang) return;
// Show selected bidang
const selectedBidangDiv = document.querySelector('.selected-bidang');
selectedBidangDiv.textContent = `Bidang Pengujian: ${bidang.name}`;
// Load categories
const categorySelection = document.querySelector('.category-selection');
categorySelection.innerHTML = bidang.categories.map(category => `
<div class="category-card" data-category="${category.name}">
<h4>${category.name}</h4>
<p>${category.parameters.length} Parameter Tersedia</p>
</div>
`).join('');
// Add event listeners to category cards
categorySelection.querySelectorAll('.category-card').forEach(card => {
card.addEventListener('click', () => {
document.querySelectorAll('.category-card').forEach(c => c.classList.remove('selected'));
card.classList.add('selected');
selectedCategory = card.dataset.category;
loadParameters(selectedBidang, selectedCategory);
});
});
}
function loadParameters(bidangType, categoryName) {
const bidang = testingParameters[bidangType];
const category = bidang.categories.find(c => c.name === categoryName);
if (!category) return;
// Show selected category
const selectedCategoryDiv = document.querySelector('.selected-category');
selectedCategoryDiv.textContent = `Kategori: ${category.name}`;
// Load parameters
const parameterList = document.querySelector('.parameter-list');
parameterList.innerHTML = category.parameters.map(param => `
<div class="parameter-item">
<input type="checkbox" id="${param.id}" name="parameters[]" value="${param.id}"
${selectedParameters.has(param.id) ? 'checked' : ''}>
<div class="parameter-info">
<span class="parameter-name">${param.name}</span>
<span class="parameter-method">${param.method}</span>
</div>
<span class="parameter-price">Rp ${param.price.toLocaleString()}</span>
</div>
`).join('');
// Add event listeners to checkboxes
parameterList.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
checkbox.addEventListener('change', () => {
if (checkbox.checked) {
selectedParameters.add(checkbox.value);
} else {
selectedParameters.delete(checkbox.value);
}
updatePriceSummary();
});
});
}
function updatePriceSummary() {
let subtotal = 0;
selectedParameters.forEach(paramId => {
const bidang = testingParameters[selectedBidang];
const category = bidang.categories.find(c => c.name === selectedCategory);
const parameter = category.parameters.find(p => p.id === paramId);
if (parameter) {
subtotal += parameter.price;
}
});
const tax = subtotal * 0.11;
const total = subtotal + tax;
document.getElementById('parameterCount').textContent = selectedParameters.size;
document.getElementById('subtotal').textContent = `Rp ${subtotal.toLocaleString()}`;
document.getElementById('tax').textContent = `Rp ${tax.toLocaleString()}`;
document.getElementById('total').textContent = `Rp ${total.toLocaleString()}`;
}
// Initialize form // Initialize form
showStep(1); showStep(1);
const testingParameters = {
// FISIKA
fisika: {
name: "FISIKA",
categories: [
{
name: "Udara Lingkungan Kerja",
parameters: [
{ id: 'debu_total', name: 'Debu Total', method: 'SNI 16-7058-2004', price: 150000 },
{ id: 'intensitas_pencahayaan', name: 'Intensitas Pencahayaan', method: 'SNI 7062:2019', price: 100000 },
{ id: 'tekanan', name: 'Tekanan', method: 'Direct Reading', price: 100000 },
{ id: 'iklim_kerja_suhu', name: 'Iklim Kerja (suhu)', method: 'Direct Reading', price: 100000 },
{ id: 'iklim_kerja_kelembaban', name: 'Iklim Kerja (kelembaban)', method: 'Direct Reading', price: 100000 },
{ id: 'intensitas_kebisingan', name: 'Intensitas Kebisingan', method: 'SNI 7231:2019', price: 150000 },
{ id: 'kebisingan_personal', name: 'Kebisingan Personal', method: 'SNI/APHA', price: 150000 }
]
}
]
},
// KIMIA
kimia: {
name: "KIMIA",
categories: [
{
name: "Air Minum, Hygiene, Sanitasi",
parameters: [
{ id: 'suhu', name: 'Suhu', method: 'SNI/APHA', price: 50000 },
{ id: 'tds', name: 'TDS', method: 'SNI/APHA', price: 75000 },
{ id: 'kekeruhan', name: 'Kekeruhan', method: 'SNI/APHA', price: 75000 },
{ id: 'warna', name: 'Warna', method: 'SNI/APHA', price: 75000 },
{ id: 'bau', name: 'Bau', method: 'SNI/APHA', price: 50000 },
{ id: 'ph', name: 'pH', method: 'SNI/APHA', price: 75000 },
{ id: 'nitrat', name: 'Nitrat (NO3 terlarut)', method: 'SNI/APHA', price: 150000 },
{ id: 'nitrit', name: 'Nitrit (NO2 terlarut)', method: 'SNI/APHA', price: 150000 },
{ id: 'kromium', name: 'Kromium Valensi 6 (CR6+ terlarut)', method: 'SNI/APHA', price: 200000 },
{ id: 'besi', name: 'Besi (Fe Terlarut)', method: 'SNI/APHA', price: 150000 },
{ id: 'mangan', name: 'Mangan (Mn Terlarut)', method: 'SNI/APHA', price: 150000 },
{ id: 'sisa_klor', name: 'Sisa Klor (terlarut)', method: 'SNI/APHA', price: 150000 },
{ id: 'arsen', name: 'Arsen (AS terlarut)', method: 'SNI/APHA', price: 200000 },
{ id: 'kadmium', name: 'Kadmium (Cd) terlarut', method: 'SNI/APHA', price: 200000 },
{ id: 'timbal', name: 'Timbal (Pb terlarut)', method: 'SNI/APHA', price: 200000 },
{ id: 'fluoride', name: 'Fluoride (F) Terlarut', method: 'SNI/APHA', price: 200000 },
{ id: 'aluminium', name: 'Aluminium (Al) Terlarut', method: 'SNI/APHA', price: 200000 }
]
},
{
name: "Limbah Domestik",
parameters: [
{ id: 'ph_limbah', name: 'pH', method: 'SNI-6989.11-2019', price: 75000 },
{ id: 'bod', name: 'BOD', method: 'APHA 5210 B-2017', price: 200000 },
{ id: 'cod', name: 'COD', method: 'APHA 522 0.C-2017', price: 200000 },
{ id: 'tss', name: 'TSS', method: 'SNI 06-6989.3-2004', price: 150000 },
{ id: 'minyak_lemak', name: 'Minyak & Lemak', method: 'SNI-6989.10-2011', price: 200000 },
{ id: 'amoniak', name: 'Amoniak', method: 'SNI 06-6989.30-2005', price: 150000 },
{ id: 'debit', name: 'Debit', method: 'SNI', price: 100000 }
]
}
]
},
// BIOLOGI
biologi: {
name: "BIOLOGI",
categories: [
{
name: "Air Minum, Hygiene, Sanitasi",
parameters: [
{ id: 'ecoli', name: 'E. Coli', method: 'SNI/APHA', price: 200000 },
{ id: 'total_coliform', name: 'Total Coliform', method: 'SNI/APHA', price: 200000 }
]
},
{
name: "Limbah Domestik",
parameters: [
{ id: 'total_coliform_limbah', name: 'Total Coliform', method: 'SNI', price: 200000 }
]
},
{
name: "IPAL OUTLET",
parameters: [
{ id: 'total_coliform_ipal', name: 'Total Coliform', method: 'APHA 23 TAHUN 2017', price: 200000 }
]
}
]
}
};
</script> </script>
</body> </body>
</html> </html>

View File

@@ -1,150 +1,184 @@
-- Tabel Template Sampling -- Tabel Template Sampling
CREATE TABLE sampling_templates ( CREATE TABLE sampling_templates (
id INT PRIMARY KEY AUTO_INCREMENT, SamplingTemplateID INT PRIMARY KEY AUTO_INCREMENT,
template_name VARCHAR(100), SamplingTemplateName VARCHAR(100),
description TEXT, SamplingTemplateDescription TEXT,
is_active BOOLEAN DEFAULT true, SamplingTemplateIsActive BOOLEAN DEFAULT TRUE,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP SamplingTemplateCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
SamplingTemplateCreatedUserID INT,
SamplingTemplateUpdatedAt DATETIME,
SamplingTemplateUpdatedUserID INT,
SamplingTemplateDeletedAt DATETIME,
SamplingTemplateDeletedUserID INT
); );
-- Tabel Template Analisis -- Tabel Template Analisis
CREATE TABLE analysis_templates ( CREATE TABLE analysis_templates (
id INT PRIMARY KEY AUTO_INCREMENT, AnalysisTemplateID INT PRIMARY KEY AUTO_INCREMENT,
template_name VARCHAR(100), AnalysisTemplateName VARCHAR(100),
description TEXT, AnalysisTemplateDescription TEXT,
is_lab_analysis BOOLEAN DEFAULT true, AnalysisTemplateIsLabAnalysis BOOLEAN DEFAULT TRUE,
is_active BOOLEAN DEFAULT true, AnalysisTemplateIsActive BOOLEAN DEFAULT TRUE,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP AnalysisTemplateCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
AnalysisTemplateCreatedUserID INT,
AnalysisTemplateUpdatedAt DATETIME,
AnalysisTemplateUpdatedUserID INT,
AnalysisTemplateDeletedAt DATETIME,
AnalysisTemplateDeletedUserID INT
); );
-- Tabel Parameter Analisis -- Tabel Parameter Analisis
CREATE TABLE analysis_parameters ( CREATE TABLE analysis_parameters (
id INT PRIMARY KEY AUTO_INCREMENT, AnalysisParameterID INT PRIMARY KEY AUTO_INCREMENT,
parameter_code VARCHAR(20), AnalysisParameterCode VARCHAR(20),
parameter_name VARCHAR(100), AnalysisParameterName VARCHAR(100),
testing_method VARCHAR(100), AnalysisParameterTestingMethod VARCHAR(100),
unit VARCHAR(20), AnalysisParameterUnit VARCHAR(20),
standard_method_number VARCHAR(50), AnalysisParameterStandardMethodNumber VARCHAR(50),
price DECIMAL(10,2), AnalysisParameterPrice DECIMAL(10,2),
is_active BOOLEAN DEFAULT true, AnalysisParameterIsActive BOOLEAN DEFAULT TRUE,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP AnalysisParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
AnalysisParameterCreatedUserID INT,
AnalysisParameterUpdatedAt DATETIME,
AnalysisParameterUpdatedUserID INT,
AnalysisParameterDeletedAt DATETIME,
AnalysisParameterDeletedUserID INT
); );
-- Tabel Template Parameter -- Tabel Template Parameter
CREATE TABLE template_parameters ( CREATE TABLE template_parameters (
id INT PRIMARY KEY AUTO_INCREMENT, TemplateParameterID INT PRIMARY KEY AUTO_INCREMENT,
template_id INT, AnalysisTemplateID INT,
parameter_id INT, AnalysisParameterID INT,
is_required BOOLEAN DEFAULT false, TemplateParameterIsRequired BOOLEAN DEFAULT FALSE,
FOREIGN KEY (template_id) REFERENCES analysis_templates(id), TemplateParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (parameter_id) REFERENCES analysis_parameters(id) TemplateParameterCreatedUserID INT,
TemplateParameterUpdatedAt DATETIME,
TemplateParameterUpdatedUserID INT,
TemplateParameterDeletedAt DATETIME,
TemplateParameterDeletedUserID INT
); );
-- Tabel Permintaan Layanan -- Tabel Permintaan Layanan
CREATE TABLE service_requests ( CREATE TABLE service_requests (
id INT PRIMARY KEY AUTO_INCREMENT, ServiceRequestID INT PRIMARY KEY AUTO_INCREMENT,
request_code VARCHAR(20) UNIQUE, ServiceRequestCode VARCHAR(20) UNIQUE,
customer_id INT, CustomerID INT,
request_type ENUM('sampling_analysis', 'analysis_only'), ServiceRequestType ENUM('sampling_analysis', 'analysis_only'),
template_id INT, AnalysisTemplateID INT,
sampling_date DATE, ServiceRequestSamplingDate DATE,
sampling_location TEXT, ServiceRequestSamplingLocation TEXT,
gps_coordinates VARCHAR(50), ServiceRequestGPSCoordinates VARCHAR(50),
status ENUM('draft', 'submitted', 'approved', 'rejected', 'in_progress', 'completed'), ServiceRequestStatus ENUM('draft', 'submitted', 'approved', 'rejected', 'in_progress', 'completed'),
sampling_officer_id INT, ServiceRequestSamplingOfficerID INT,
testing_officer_id INT, ServiceRequestTestingOfficerID INT,
total_amount DECIMAL(10,2), ServiceRequestTotalAmount DECIMAL(10,2),
dp_amount DECIMAL(10,2), ServiceRequestDPAmount DECIMAL(10,2),
dp_status ENUM('unpaid', 'paid') DEFAULT 'unpaid', ServiceRequestDPStatus ENUM('unpaid', 'paid') DEFAULT 'unpaid',
notes TEXT, ServiceRequestNotes TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, ServiceRequestCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP, ServiceRequestCreatedUserID INT,
FOREIGN KEY (customer_id) REFERENCES customers(id), ServiceRequestUpdatedAt DATETIME,
FOREIGN KEY (template_id) REFERENCES analysis_templates(id), ServiceRequestUpdatedUserID INT,
FOREIGN KEY (sampling_officer_id) REFERENCES users(id), ServiceRequestDeletedAt DATETIME,
FOREIGN KEY (testing_officer_id) REFERENCES users(id) ServiceRequestDeletedUserID INT
); );
-- Tabel Detail Parameter Permintaan -- Tabel Detail Parameter Permintaan
CREATE TABLE request_parameters ( CREATE TABLE request_parameters (
id INT PRIMARY KEY AUTO_INCREMENT, RequestParameterID INT PRIMARY KEY AUTO_INCREMENT,
request_id INT, ServiceRequestID INT,
parameter_id INT, AnalysisParameterID INT,
price DECIMAL(10,2), RequestParameterPrice DECIMAL(10,2),
status ENUM('pending', 'in_progress', 'completed', 'rejected'), RequestParameterStatus ENUM('pending', 'in_progress', 'completed', 'rejected'),
result_value VARCHAR(50), RequestParameterResultValue VARCHAR(50),
result_unit VARCHAR(20), RequestParameterResultUnit VARCHAR(20),
is_compliant BOOLEAN, RequestParameterIsCompliant BOOLEAN,
notes TEXT, RequestParameterNotes TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, RequestParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (request_id) REFERENCES service_requests(id), RequestParameterCreatedUserID INT,
FOREIGN KEY (parameter_id) REFERENCES analysis_parameters(id) RequestParameterUpdatedAt DATETIME,
RequestParameterUpdatedUserID INT,
RequestParameterDeletedAt DATETIME,
RequestParameterDeletedUserID INT
); );
-- Tabel Quotation -- Tabel Quotation
CREATE TABLE quotations ( CREATE TABLE quotations (
id INT PRIMARY KEY AUTO_INCREMENT, QuotationID INT PRIMARY KEY AUTO_INCREMENT,
quotation_code VARCHAR(20) UNIQUE, QuotationCode VARCHAR(20) UNIQUE,
request_id INT, ServiceRequestID INT,
issue_date DATE, QuotationIssueDate DATE,
valid_until DATE, QuotationValidUntil DATE,
status ENUM('draft', 'sent', 'approved', 'rejected'), QuotationStatus ENUM('draft', 'sent', 'approved', 'rejected'),
subtotal DECIMAL(10,2), QuotationSubtotal DECIMAL(10,2),
tax_percentage DECIMAL(5,2), QuotationTaxPercentage DECIMAL(5,2),
tax_amount DECIMAL(10,2), QuotationTaxAmount DECIMAL(10,2),
total_amount DECIMAL(10,2), QuotationTotalAmount DECIMAL(10,2),
terms_and_conditions TEXT, QuotationTermsAndConditions TEXT,
notes TEXT, QuotationNotes TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, QuotationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP, QuotationCreatedUserID INT,
FOREIGN KEY (request_id) REFERENCES service_requests(id) QuotationUpdatedAt DATETIME,
QuotationUpdatedUserID INT,
QuotationDeletedAt DATETIME,
QuotationDeletedUserID INT
); );
-- Tabel Peralatan Sampling -- Tabel Peralatan Sampling
CREATE TABLE sampling_equipment ( CREATE TABLE sampling_equipment (
id INT PRIMARY KEY AUTO_INCREMENT, SamplingEquipmentID INT PRIMARY KEY AUTO_INCREMENT,
equipment_name VARCHAR(100), SamplingEquipmentName VARCHAR(100),
equipment_code VARCHAR(50), SamplingEquipmentCode VARCHAR(50),
is_available BOOLEAN DEFAULT true, SamplingEquipmentIsAvailable BOOLEAN DEFAULT TRUE,
last_calibration_date DATE, SamplingEquipmentLastCalibrationDate DATE,
next_calibration_date DATE, SamplingEquipmentNextCalibrationDate DATE,
notes TEXT, SamplingEquipmentNotes TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP SamplingEquipmentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
SamplingEquipmentCreatedUserID INT,
SamplingEquipmentUpdatedAt DATETIME,
SamplingEquipmentUpdatedUserID INT,
SamplingEquipmentDeletedAt DATETIME,
SamplingEquipmentDeletedUserID INT
); );
-- Tabel Peralatan yang Digunakan dalam Sampling -- Tabel Peralatan yang Digunakan dalam Sampling
CREATE TABLE request_equipment ( CREATE TABLE request_equipment (
id INT PRIMARY KEY AUTO_INCREMENT, RequestEquipmentID INT PRIMARY KEY AUTO_INCREMENT,
request_id INT, ServiceRequestID INT,
equipment_id INT, SamplingEquipmentID INT,
usage_date DATE, RequestEquipmentUsageDate DATE,
return_date DATE, RequestEquipmentReturnDate DATE,
notes TEXT, RequestEquipmentNotes TEXT,
FOREIGN KEY (request_id) REFERENCES service_requests(id), RequestEquipmentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (equipment_id) REFERENCES sampling_equipment(id) RequestEquipmentCreatedUserID INT,
RequestEquipmentUpdatedAt DATETIME,
RequestEquipmentUpdatedUserID INT,
RequestEquipmentDeletedAt DATETIME,
RequestEquipmentDeletedUserID INT
); );
-- Contoh data template sampling -- Contoh data template sampling
INSERT INTO sampling_templates (template_name, description) VALUES INSERT INTO sampling_templates (SamplingTemplateName, SamplingTemplateDescription) VALUES
('Air Limbah Industri', 'Template untuk sampling air limbah industri'), ('Air Limbah Industri', 'Template untuk sampling air limbah industri'),
('Kualitas Udara Ambien', 'Template untuk sampling kualitas udara'), ('Kualitas Udara Ambien', 'Template untuk sampling kualitas udara'),
('Air Permukaan', 'Template untuk sampling air sungai/danau'); ('Air Permukaan', 'Template untuk sampling air sungai/danau');
-- Contoh data parameter analisis -- Contoh data parameter analisis
INSERT INTO analysis_parameters (parameter_code, parameter_name, unit, price, method) VALUES INSERT INTO analysis_parameters (AnalysisParameterCode, AnalysisParameterName, AnalysisParameterUnit, AnalysisParameterPrice, AnalysisParameterTestingMethod) VALUES
('BOD5', 'Biochemical Oxygen Demand', 'mg/L', 250000, 'SNI 6989.72:2009'), ('BOD5', 'Biochemical Oxygen Demand', 'mg/L', 250000, 'SNI 6989.72:2009'),
('COD', 'Chemical Oxygen Demand', 'mg/L', 200000, 'SNI 6989.2:2009'), ('COD', 'Chemical Oxygen Demand', 'mg/L', 200000, 'SNI 6989.2:2009'),
('TSS', 'Total Suspended Solid', 'mg/L', 150000, 'SNI 06-6989.3-2004'), ('TSS', 'Total Suspended Solid', 'mg/L', 150000, 'SNI 06-6989.3-2004'),
('PH', 'Derajat Keasaman', '-', 100000, 'SNI 06-6989.11-2004'); ('PH', 'Derajat Keasaman', '-', 100000, 'SNI 06-6989.11-2004');
-- Contoh data permintaan layanan -- Contoh data permintaan layanan
INSERT INTO service_requests (request_code, customer_id, request_type, sampling_date, sampling_location, status, total_amount) VALUES INSERT INTO service_requests (ServiceRequestCode, CustomerID, ServiceRequestType, ServiceRequestSamplingDate, ServiceRequestSamplingLocation, ServiceRequestStatus, ServiceRequestTotalAmount) VALUES
('REQ001', 1, 'sampling_analysis', '2024-03-20', 'Plant A - Outlet IPAL', 'approved', 700000), ('REQ001', 1, 'sampling_analysis', '2024-03-20', 'Plant A - Outlet IPAL', 'approved', 700000),
('REQ002', 2, 'analysis_only', '2024-03-21', 'Lab Internal', 'submitted', 450000), ('REQ002', 2, 'analysis_only', '2024-03-21', 'Lab Internal', 'submitted', 450000),
('REQ003', 3, 'sampling_analysis', '2024-03-22', 'Intake Water Treatment', 'draft', 550000); ('REQ003', 3, 'sampling_analysis', '2024-03-22', 'Intake Water Treatment', 'draft', 550000);
-- Contoh data parameter yang diminta -- Contoh data parameter yang diminta
INSERT INTO request_parameters (request_id, parameter_id, price) VALUES INSERT INTO request_parameters (ServiceRequestID, AnalysisParameterID, RequestParameterPrice) VALUES
(1, 1, 250000), (1, 1, 250000),
(1, 2, 200000), (1, 2, 200000),
(1, 3, 150000), (1, 3, 150000),
@@ -155,7 +189,7 @@ INSERT INTO request_parameters (request_id, parameter_id, price) VALUES
(3, 4, 100000); (3, 4, 100000);
-- Contoh data quotation -- Contoh data quotation
INSERT INTO quotations (quotation_code, request_id, issue_date, valid_until, status, total_amount) VALUES INSERT INTO quotations (QuotationCode, ServiceRequestID, QuotationIssueDate, QuotationValidUntil, QuotationStatus, QuotationTotalAmount) VALUES
('QUO001', 1, '2024-03-15', '2024-04-15', 'approved', 700000), ('QUO001', 1, '2024-03-15', '2024-04-15', 'approved', 700000),
('QUO002', 2, '2024-03-16', '2024-04-16', 'sent', 450000), ('QUO002', 2, '2024-03-16', '2024-04-16', 'sent', 450000),
('QUO003', 3, '2024-03-17', '2024-04-17', 'draft', 550000); ('QUO003', 3, '2024-03-17', '2024-04-17', 'draft', 550000);

View File

@@ -6,79 +6,97 @@
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Master Regulasi -- Master Regulasi
CREATE TABLE IF NOT EXISTS master_regulasi ( CREATE TABLE IF NOT EXISTS master_regulations (
id_regulasi INT PRIMARY KEY, MasterRegulationID INT PRIMARY KEY,
kode_regulasi VARCHAR(50) NOT NULL, MasterRegulationCode VARCHAR(50) NOT NULL,
nama_regulasi VARCHAR(255) NOT NULL, MasterRegulationName VARCHAR(255) NOT NULL,
instansi_penerbit VARCHAR(100) NOT NULL, MasterRegulationIssuer VARCHAR(100) NOT NULL,
tanggal_terbit DATE NOT NULL, MasterRegulationIssueDate DATE NOT NULL,
tanggal_berlaku DATE NOT NULL, MasterRegulationEffectiveDate DATE NOT NULL,
deskripsi TEXT, MasterRegulationDescription TEXT,
file_path VARCHAR(255), MasterRegulationFilePath VARCHAR(255),
status BOOLEAN DEFAULT TRUE, MasterRegulationIsActive BOOLEAN DEFAULT TRUE,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterRegulationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50) MasterRegulationCreatedUserID INT,
MasterRegulationUpdatedAt DATETIME,
MasterRegulationUpdatedUserID INT,
MasterRegulationDeletedAt DATETIME,
MasterRegulationDeletedUserID INT
); );
-- Master Parameter Iklim Kerja -- Master Parameter Iklim Kerja
CREATE TABLE IF NOT EXISTS master_parameter_iklim ( CREATE TABLE IF NOT EXISTS master_climate_parameters (
id_parameter INT PRIMARY KEY, MasterClimateParameterID INT PRIMARY KEY,
kode_parameter VARCHAR(20) NOT NULL, MasterClimateParameterCode VARCHAR(20) NOT NULL,
nama_parameter VARCHAR(100) NOT NULL, MasterClimateParameterName VARCHAR(100) NOT NULL,
satuan VARCHAR(20), MasterClimateParameterUnit VARCHAR(20),
metode_analisis VARCHAR(100), MasterClimateParameterMethod VARCHAR(100),
biaya DECIMAL(10, 2), MasterClimateParameterPrice DECIMAL(10,2),
akreditasi BOOLEAN DEFAULT FALSE, MasterClimateParameterIsAccredited BOOLEAN DEFAULT FALSE,
keterangan TEXT, MasterClimateParameterRemarks TEXT,
status BOOLEAN DEFAULT TRUE, MasterClimateParameterIsActive BOOLEAN DEFAULT TRUE,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterClimateParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50) MasterClimateParameterCreatedUserID INT,
MasterClimateParameterUpdatedAt DATETIME,
MasterClimateParameterUpdatedUserID INT,
MasterClimateParameterDeletedAt DATETIME,
MasterClimateParameterDeletedUserID INT
); );
-- Master Baku Mutu Iklim Kerja -- Master Baku Mutu Iklim Kerja
CREATE TABLE IF NOT EXISTS master_bakumutu_iklim ( CREATE TABLE IF NOT EXISTS master_climate_standards (
id_bakumutu INT PRIMARY KEY, MasterClimateStandardID INT PRIMARY KEY,
id_parameter INT NOT NULL, MasterClimateParameterID INT NOT NULL,
id_regulasi INT NOT NULL, MasterRegulationID INT NOT NULL,
jenis_ruangan VARCHAR(100) NOT NULL, MasterClimateStandardRoomType VARCHAR(100) NOT NULL,
nilai_min DECIMAL(6, 2), MasterClimateStandardMinValue DECIMAL(6,2),
nilai_max DECIMAL(6, 2), MasterClimateStandardMaxValue DECIMAL(6,2),
keterangan TEXT, MasterClimateStandardRemarks TEXT,
status BOOLEAN DEFAULT TRUE, MasterClimateStandardIsActive BOOLEAN DEFAULT TRUE,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterClimateStandardCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), MasterClimateStandardCreatedUserID INT,
FOREIGN KEY (id_parameter) REFERENCES master_parameter_iklim(id_parameter), MasterClimateStandardUpdatedAt DATETIME,
FOREIGN KEY (id_regulasi) REFERENCES master_regulasi(id_regulasi) MasterClimateStandardUpdatedUserID INT,
MasterClimateStandardDeletedAt DATETIME,
MasterClimateStandardDeletedUserID INT
); );
-- Master Metode Sampling Iklim Kerja -- Master Metode Sampling Iklim Kerja
CREATE TABLE IF NOT EXISTS master_metode_sampling_iklim ( CREATE TABLE IF NOT EXISTS master_climate_sampling_methods (
id_metode INT PRIMARY KEY, MasterClimateSamplingMethodID INT PRIMARY KEY,
kode_metode VARCHAR(50) NOT NULL, MasterClimateSamplingMethodCode VARCHAR(50) NOT NULL,
nama_metode VARCHAR(255) NOT NULL, MasterClimateSamplingMethodName VARCHAR(255) NOT NULL,
deskripsi TEXT, MasterClimateSamplingMethodDescription TEXT,
jenis_parameter VARCHAR(100), MasterClimateSamplingMethodParameterType VARCHAR(100),
status BOOLEAN DEFAULT TRUE, MasterClimateSamplingMethodIsActive BOOLEAN DEFAULT TRUE,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterClimateSamplingMethodCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50) MasterClimateSamplingMethodCreatedUserID INT,
MasterClimateSamplingMethodUpdatedAt DATETIME,
MasterClimateSamplingMethodUpdatedUserID INT,
MasterClimateSamplingMethodDeletedAt DATETIME,
MasterClimateSamplingMethodDeletedUserID INT
); );
-- Master Peralatan Pengukuran Iklim Kerja -- Master Peralatan Pengukuran Iklim Kerja
CREATE TABLE IF NOT EXISTS master_peralatan_iklim ( CREATE TABLE IF NOT EXISTS master_climate_equipment (
id_peralatan INT PRIMARY KEY, MasterClimateEquipmentID INT PRIMARY KEY,
kode_peralatan VARCHAR(20) NOT NULL, MasterClimateEquipmentCode VARCHAR(20) NOT NULL,
nama_peralatan VARCHAR(100) NOT NULL, MasterClimateEquipmentName VARCHAR(100) NOT NULL,
merk VARCHAR(100), MasterClimateEquipmentBrand VARCHAR(100),
model VARCHAR(100), MasterClimateEquipmentModel VARCHAR(100),
serial_number VARCHAR(100), MasterClimateEquipmentSerialNumber VARCHAR(100),
spesifikasi TEXT, MasterClimateEquipmentSpecification TEXT,
tanggal_kalibrasi DATE, MasterClimateEquipmentLastCalibrationDate DATE,
tanggal_kalibrasi_berikutnya DATE, MasterClimateEquipmentNextCalibrationDate DATE,
status_kalibrasi VARCHAR(20), MasterClimateEquipmentCalibrationStatus VARCHAR(20),
file_sertifikat VARCHAR(255), MasterClimateEquipmentCertificatePath VARCHAR(255),
status BOOLEAN DEFAULT TRUE, MasterClimateEquipmentIsActive BOOLEAN DEFAULT TRUE,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterClimateEquipmentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50) MasterClimateEquipmentCreatedUserID INT,
MasterClimateEquipmentUpdatedAt DATETIME,
MasterClimateEquipmentUpdatedUserID INT,
MasterClimateEquipmentDeletedAt DATETIME,
MasterClimateEquipmentDeletedUserID INT
); );
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
@@ -86,85 +104,97 @@ CREATE TABLE IF NOT EXISTS master_peralatan_iklim (
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Sampling Plan Pengukuran Iklim Kerja -- Sampling Plan Pengukuran Iklim Kerja
CREATE TABLE IF NOT EXISTS trx_sampling_plan_iklim ( CREATE TABLE IF NOT EXISTS climate_sampling_plans (
id_sampling_plan INT PRIMARY KEY, ClimateSamplingPlanID INT PRIMARY KEY,
kode_sampling_plan VARCHAR(50) NOT NULL, ClimateSamplingPlanCode VARCHAR(50) NOT NULL,
nama_project VARCHAR(255) NOT NULL, ClimateSamplingPlanProjectName VARCHAR(255) NOT NULL,
id_client INT NOT NULL, CustomerID INT NOT NULL,
tanggal_rencana_sampling DATE NOT NULL, ClimateSamplingPlanDate DATE NOT NULL,
lokasi_sampling TEXT NOT NULL, ClimateSamplingPlanLocation TEXT NOT NULL,
jumlah_titik INT, ClimateSamplingPlanPointCount INT,
status_approval VARCHAR(20) DEFAULT 'DRAFT', ClimateSamplingPlanApprovalStatus VARCHAR(20) DEFAULT 'DRAFT',
catatan TEXT, ClimateSamplingPlanRemarks TEXT,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ClimateSamplingPlanCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50) ClimateSamplingPlanCreatedUserID INT,
ClimateSamplingPlanUpdatedAt DATETIME,
ClimateSamplingPlanUpdatedUserID INT,
ClimateSamplingPlanDeletedAt DATETIME,
ClimateSamplingPlanDeletedUserID INT
); );
-- Requisisi Peralatan untuk Pengukuran Iklim Kerja -- Requisisi Peralatan untuk Pengukuran Iklim Kerja
CREATE TABLE IF NOT EXISTS trx_requisisi_peralatan_iklim ( CREATE TABLE IF NOT EXISTS climate_equipment_requisitions (
id_requisisi INT PRIMARY KEY, ClimateEquipmentRequisitionID INT PRIMARY KEY,
id_sampling_plan INT NOT NULL, ClimateSamplingPlanID INT NOT NULL,
tanggal_requisisi DATE NOT NULL, ClimateEquipmentRequisitionDate DATE NOT NULL,
tanggal_kebutuhan DATE NOT NULL, ClimateEquipmentRequisitionNeedDate DATE NOT NULL,
status_requisisi VARCHAR(20) DEFAULT 'DRAFT', ClimateEquipmentRequisitionStatus VARCHAR(20) DEFAULT 'DRAFT',
catatan TEXT, ClimateEquipmentRequisitionRemarks TEXT,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ClimateEquipmentRequisitionCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), ClimateEquipmentRequisitionCreatedUserID INT,
FOREIGN KEY (id_sampling_plan) REFERENCES trx_sampling_plan_iklim(id_sampling_plan) ClimateEquipmentRequisitionUpdatedAt DATETIME,
ClimateEquipmentRequisitionUpdatedUserID INT,
ClimateEquipmentRequisitionDeletedAt DATETIME,
ClimateEquipmentRequisitionDeletedUserID INT
); );
-- Detail Requisisi Peralatan -- Detail Requisisi Peralatan
CREATE TABLE IF NOT EXISTS trx_requisisi_peralatan_iklim_detail ( CREATE TABLE IF NOT EXISTS climate_equipment_requisition_details (
id_requisisi_detail INT PRIMARY KEY, ClimateEquipmentRequisitionDetailID INT PRIMARY KEY,
id_requisisi INT NOT NULL, ClimateEquipmentRequisitionID INT NOT NULL,
id_peralatan INT NOT NULL, MasterClimateEquipmentID INT NOT NULL,
jumlah INT NOT NULL, ClimateEquipmentRequisitionDetailQuantity INT NOT NULL,
status_persetujuan VARCHAR(20) DEFAULT 'PENDING', ClimateEquipmentRequisitionDetailApprovalStatus VARCHAR(20) DEFAULT 'PENDING',
catatan TEXT, ClimateEquipmentRequisitionDetailRemarks TEXT,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ClimateEquipmentRequisitionDetailCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), ClimateEquipmentRequisitionDetailCreatedUserID INT,
FOREIGN KEY (id_requisisi) REFERENCES trx_requisisi_peralatan_iklim(id_requisisi), ClimateEquipmentRequisitionDetailUpdatedAt DATETIME,
FOREIGN KEY (id_peralatan) REFERENCES master_peralatan_iklim(id_peralatan) ClimateEquipmentRequisitionDetailUpdatedUserID INT,
ClimateEquipmentRequisitionDetailDeletedAt DATETIME,
ClimateEquipmentRequisitionDetailDeletedUserID INT
); );
-- Hasil Pengukuran Iklim Kerja -- Hasil Pengukuran Iklim Kerja
CREATE TABLE IF NOT EXISTS trx_hasil_ukur_iklim ( CREATE TABLE IF NOT EXISTS climate_measurement_results (
id_hasil_ukur INT PRIMARY KEY, ClimateMeasurementResultID INT PRIMARY KEY,
id_sampling_plan INT NOT NULL, ClimateSamplingPlanID INT NOT NULL,
kode_laporan VARCHAR(50) NOT NULL, ClimateMeasurementResultCode VARCHAR(50) NOT NULL,
tanggal_sampling DATE NOT NULL, ClimateMeasurementResultDate DATE NOT NULL,
waktu_mulai TIME, ClimateMeasurementResultStartTime TIME,
waktu_selesai TIME, ClimateMeasurementResultEndTime TIME,
kondisi_cuaca VARCHAR(100), ClimateMeasurementResultWeather VARCHAR(100),
petugas_sampling VARCHAR(100), ClimateMeasurementResultOfficer VARCHAR(100),
status_laporan VARCHAR(20) DEFAULT 'DRAFT', ClimateMeasurementResultStatus VARCHAR(20) DEFAULT 'DRAFT',
catatan TEXT, ClimateMeasurementResultRemarks TEXT,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ClimateMeasurementResultCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), ClimateMeasurementResultCreatedUserID INT,
FOREIGN KEY (id_sampling_plan) REFERENCES trx_sampling_plan_iklim(id_sampling_plan) ClimateMeasurementResultUpdatedAt DATETIME,
ClimateMeasurementResultUpdatedUserID INT,
ClimateMeasurementResultDeletedAt DATETIME,
ClimateMeasurementResultDeletedUserID INT
); );
-- Detail Hasil Pengukuran Iklim Kerja -- Detail Hasil Pengukuran Iklim Kerja
CREATE TABLE IF NOT EXISTS trx_hasil_ukur_iklim_detail ( CREATE TABLE IF NOT EXISTS climate_measurement_result_details (
id_hasil_ukur_detail INT PRIMARY KEY, ClimateMeasurementResultDetailID INT PRIMARY KEY,
id_hasil_ukur INT NOT NULL, ClimateMeasurementResultID INT NOT NULL,
kode_titik VARCHAR(20) NOT NULL, ClimateMeasurementResultDetailPointCode VARCHAR(20) NOT NULL,
nama_lokasi VARCHAR(255) NOT NULL, ClimateMeasurementResultDetailLocation VARCHAR(255) NOT NULL,
jenis_ruangan VARCHAR(100) NOT NULL, ClimateMeasurementResultDetailRoomType VARCHAR(100) NOT NULL,
id_parameter INT NOT NULL, MasterClimateParameterID INT NOT NULL,
hasil_pengukuran DECIMAL(6, 2) NOT NULL, ClimateMeasurementResultDetailValue DECIMAL(6,2) NOT NULL,
baku_mutu_min DECIMAL(6, 2), ClimateMeasurementResultDetailMinStandard DECIMAL(6,2),
baku_mutu_max DECIMAL(6, 2), ClimateMeasurementResultDetailMaxStandard DECIMAL(6,2),
id_metode INT NOT NULL, MasterClimateSamplingMethodID INT NOT NULL,
id_peralatan INT NOT NULL, MasterClimateEquipmentID INT NOT NULL,
status_kesesuaian VARCHAR(20), ClimateMeasurementResultDetailComplianceStatus VARCHAR(20),
catatan TEXT, ClimateMeasurementResultDetailRemarks TEXT,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ClimateMeasurementResultDetailCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), ClimateMeasurementResultDetailCreatedUserID INT,
FOREIGN KEY (id_hasil_ukur) REFERENCES trx_hasil_ukur_iklim(id_hasil_ukur), ClimateMeasurementResultDetailUpdatedAt DATETIME,
FOREIGN KEY (id_parameter) REFERENCES master_parameter_iklim(id_parameter), ClimateMeasurementResultDetailUpdatedUserID INT,
FOREIGN KEY (id_metode) REFERENCES master_metode_sampling_iklim(id_metode), ClimateMeasurementResultDetailDeletedAt DATETIME,
FOREIGN KEY (id_peralatan) REFERENCES master_peralatan_iklim(id_peralatan) ClimateMeasurementResultDetailDeletedUserID INT
); );
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
@@ -172,111 +202,111 @@ CREATE TABLE IF NOT EXISTS trx_hasil_ukur_iklim_detail (
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Insert Data Master Regulasi -- Insert Data Master Regulasi
INSERT INTO master_regulasi (id_regulasi, kode_regulasi, nama_regulasi, instansi_penerbit, tanggal_terbit, tanggal_berlaku, deskripsi, file_path, status, user_input) INSERT INTO master_regulations (MasterRegulationID, MasterRegulationCode, MasterRegulationName, MasterRegulationIssuer, MasterRegulationIssueDate, MasterRegulationEffectiveDate, MasterRegulationDescription, MasterRegulationFilePath, MasterRegulationIsActive, MasterRegulationCreatedAt, MasterRegulationCreatedUserID)
VALUES VALUES
(1, 'PMK-02-2023', 'Peraturan Menteri Kesehatan Republik Indonesia Nomor 2 Tahun 2023 tentang Standar Baku Mutu Kesehatan Lingkungan dan Persyaratan Kesehatan', 'Kementerian Kesehatan RI', '2023-01-15', '2023-02-01', 'Standar Baku Mutu Kesehatan Lingkungan untuk Media Air, Udara, Tanah, Pangan, Sarana dan Bangunan, serta Vektor dan Binatang Pembawa Penyakit, dan Persyaratan Kesehatan', '/dokumen/regulasi/PMK_02_2023.pdf', TRUE, 'admin'), (1, 'PMK-02-2023', 'Peraturan Menteri Kesehatan Republik Indonesia Nomor 2 Tahun 2023', 'Kementerian Kesehatan RI', '2023-01-15', '2023-02-01', 'Standar Baku Mutu Kesehatan Lingkungan untuk Media Air, Udara, Tanah, Pangan, Sarana dan Bangunan', '/dokumen/regulasi/PMK_02_2023.pdf', TRUE, '2023-05-10 10:30:00', 1),
(2, 'PERMENAKER-05-2018', 'Peraturan Menteri Ketenagakerjaan Republik Indonesia Nomor 5 Tahun 2018 tentang Keselamatan dan Kesehatan Kerja Lingkungan Kerja', 'Kementerian Ketenagakerjaan RI', '2018-04-17', '2018-05-01', 'Keselamatan dan Kesehatan Kerja Lingkungan Kerja meliputi faktor fisika, kimia, biologi, ergonomi, dan psikologi', '/dokumen/regulasi/PERMENAKER_05_2018.pdf', TRUE, 'admin'); (2, 'PERMENAKER-05-2018', 'Peraturan Menteri Ketenagakerjaan Republik Indonesia Nomor 5 Tahun 2018', 'Kementerian Ketenagakerjaan RI', '2018-04-17', '2018-05-01', 'Keselamatan dan Kesehatan Kerja Lingkungan Kerja', '/dokumen/regulasi/PERMENAKER_05_2018.pdf', TRUE, '2018-05-15 10:30:00', 1);
-- Insert Data Master Parameter Iklim Kerja -- Insert Data Master Parameter Iklim Kerja
INSERT INTO master_parameter_iklim (id_parameter, kode_parameter, nama_parameter, satuan, metode_analisis, biaya, akreditasi, keterangan, status, user_input) INSERT INTO master_climate_parameters (MasterClimateParameterID, MasterClimateParameterCode, MasterClimateParameterName, MasterClimateParameterUnit, MasterClimateParameterMethod, MasterClimateParameterPrice, MasterClimateParameterIsAccredited, MasterClimateParameterRemarks, MasterClimateParameterIsActive, MasterClimateParameterCreatedAt, MasterClimateParameterCreatedUserID)
VALUES VALUES
(1, 'SUHU-01', 'Suhu Udara', '°C', 'SNI 7062:2019', 50000.00, TRUE, 'Pengukuran suhu udara dalam ruangan', TRUE, 'admin'), (1, 'SUHU-01', 'Suhu Udara', '°C', 'SNI 7062:2019', 50000.00, TRUE, 'Pengukuran suhu udara dalam ruangan', TRUE, '2023-05-10 10:30:00', 1),
(2, 'KELEM-01', 'Kelembaban Udara', '%RH', 'SNI 7062:2019', 50000.00, TRUE, 'Pengukuran kelembaban relatif udara dalam ruangan', TRUE, 'admin'), (2, 'KELEM-01', 'Kelembaban Udara', '%RH', 'SNI 7062:2019', 50000.00, TRUE, 'Pengukuran kelembaban relatif udara dalam ruangan', TRUE, '2023-05-10 10:30:00', 1),
(3, 'KEC-UDARA-01', 'Kecepatan Aliran Udara', 'm/s', 'SNI 7062:2019', 60000.00, TRUE, 'Pengukuran kecepatan aliran udara dalam ruangan', TRUE, 'admin'), (3, 'KEC-UDARA-01', 'Kecepatan Aliran Udara', 'm/s', 'SNI 7062:2019', 60000.00, TRUE, 'Pengukuran kecepatan aliran udara dalam ruangan', TRUE, '2023-05-10 10:30:00', 1),
(4, 'ISBB-01', 'Indeks Suhu Basah dan Bola (ISBB)', '°C', 'SNI 7062:2019', 85000.00, TRUE, 'Pengukuran Indeks Suhu Basah dan Bola untuk analisis beban kerja', TRUE, 'admin'); (4, 'ISBB-01', 'Indeks Suhu Basah dan Bola (ISBB)', '°C', 'SNI 7062:2019', 85000.00, TRUE, 'Pengukuran Indeks Suhu Basah dan Bola untuk analisis beban kerja', TRUE, '2023-05-10 10:30:00', 1);
-- Insert Data Master Baku Mutu Iklim Kerja -- Insert Data Master Baku Mutu Iklim Kerja
INSERT INTO master_bakumutu_iklim (id_bakumutu, id_parameter, id_regulasi, jenis_ruangan, nilai_min, nilai_max, keterangan, status, user_input) INSERT INTO master_climate_standards (MasterClimateStandardID, MasterClimateParameterID, MasterRegulationID, MasterClimateStandardRoomType, MasterClimateStandardMinValue, MasterClimateStandardMaxValue, MasterClimateStandardRemarks, MasterClimateStandardIsActive, MasterClimateStandardCreatedAt, MasterClimateStandardCreatedUserID)
VALUES VALUES
-- Suhu Udara -- Suhu Udara
(1, 1, 1, 'Ruang Administrasi/Kantor', 20.0, 25.0, 'Ruang kerja administrasi dan kantor', TRUE, 'admin'), (1, 1, 1, 'Ruang Administrasi/Kantor', 20.0, 25.0, 'Ruang kerja administrasi dan kantor', TRUE, '2023-05-10 10:30:00', 1),
(2, 1, 1, 'Ruang Produksi', 23.0, 26.0, 'Area produksi dengan aktivitas fisik ringan sampai sedang', TRUE, 'admin'), (2, 1, 1, 'Ruang Produksi', 23.0, 26.0, 'Area produksi dengan aktivitas fisik ringan sampai sedang', TRUE, '2023-05-10 10:30:00', 1),
(3, 1, 1, 'Ruang Istirahat', 22.0, 28.0, 'Area istirahat, kantin, dan ruang tunggu', TRUE, 'admin'), (3, 1, 1, 'Ruang Istirahat', 22.0, 28.0, 'Area istirahat, kantin, dan ruang tunggu', TRUE, '2023-05-10 10:30:00', 1),
(4, 1, 1, 'Ruang Khusus', 18.0, 24.0, 'Ruang server, laboratorium, dan ruang khusus lainnya', TRUE, 'admin'), (4, 1, 1, 'Ruang Khusus', 18.0, 24.0, 'Ruang server, laboratorium, dan ruang khusus lainnya', TRUE, '2023-05-10 10:30:00', 1),
-- Kelembaban Udara -- Kelembaban Udara
(5, 2, 1, 'Ruang Administrasi/Kantor', 40.0, 60.0, 'Ruang kerja administrasi dan kantor', TRUE, 'admin'), (5, 2, 1, 'Ruang Administrasi/Kantor', 40.0, 60.0, 'Ruang kerja administrasi dan kantor', TRUE, '2023-05-10 10:30:00', 1),
(6, 2, 1, 'Ruang Produksi', 40.0, 60.0, 'Area produksi dengan aktivitas fisik ringan sampai sedang', TRUE, 'admin'), (6, 2, 1, 'Ruang Produksi', 40.0, 60.0, 'Area produksi dengan aktivitas fisik ringan sampai sedang', TRUE, '2023-05-10 10:30:00', 1),
(7, 2, 1, 'Ruang Istirahat', 40.0, 60.0, 'Area istirahat, kantin, dan ruang tunggu', TRUE, 'admin'), (7, 2, 1, 'Ruang Istirahat', 40.0, 60.0, 'Area istirahat, kantin, dan ruang tunggu', TRUE, '2023-05-10 10:30:00', 1),
(8, 2, 1, 'Ruang Khusus', 40.0, 60.0, 'Ruang server, laboratorium, dan ruang khusus lainnya', TRUE, 'admin'), (8, 2, 1, 'Ruang Khusus', 40.0, 60.0, 'Ruang server, laboratorium, dan ruang khusus lainnya', TRUE, '2023-05-10 10:30:00', 1),
-- Kecepatan Aliran Udara -- Kecepatan Aliran Udara
(9, 3, 1, 'Ruang Administrasi/Kantor', 0.1, 0.2, 'Ruang kerja administrasi dan kantor', TRUE, 'admin'), (9, 3, 1, 'Ruang Administrasi/Kantor', 0.1, 0.2, 'Ruang kerja administrasi dan kantor', TRUE, '2023-05-10 10:30:00', 1),
(10, 3, 1, 'Ruang Produksi', 0.1, 0.3, 'Area produksi dengan aktivitas fisik ringan sampai sedang', TRUE, 'admin'), (10, 3, 1, 'Ruang Produksi', 0.1, 0.3, 'Area produksi dengan aktivitas fisik ringan sampai sedang', TRUE, '2023-05-10 10:30:00', 1),
(11, 3, 1, 'Ruang Istirahat', 0.1, 0.25, 'Area istirahat, kantin, dan ruang tunggu', TRUE, 'admin'), (11, 3, 1, 'Ruang Istirahat', 0.1, 0.25, 'Area istirahat, kantin, dan ruang tunggu', TRUE, '2023-05-10 10:30:00', 1),
(12, 3, 1, 'Ruang Khusus', 0.1, 0.3, 'Ruang server, laboratorium, dan ruang khusus lainnya', TRUE, 'admin'), (12, 3, 1, 'Ruang Khusus', 0.1, 0.3, 'Ruang server, laboratorium, dan ruang khusus lainnya', TRUE, '2023-05-10 10:30:00', 1),
-- ISBB (Indeks Suhu Basah dan Bola) -- ISBB (Indeks Suhu Basah dan Bola)
(13, 4, 2, 'Beban Kerja Ringan', NULL, 30.0, 'Alokasi istirahat 75% kerja, 25% istirahat', TRUE, 'admin'), (13, 4, 2, 'Beban Kerja Ringan', NULL, 30.0, 'Alokasi istirahat 75% kerja, 25% istirahat', TRUE, '2023-05-10 10:30:00', 1),
(14, 4, 2, 'Beban Kerja Sedang', NULL, 28.0, 'Alokasi istirahat 75% kerja, 25% istirahat', TRUE, 'admin'), (14, 4, 2, 'Beban Kerja Sedang', NULL, 28.0, 'Alokasi istirahat 75% kerja, 25% istirahat', TRUE, '2023-05-10 10:30:00', 1),
(15, 4, 2, 'Beban Kerja Berat', NULL, 25.0, 'Alokasi istirahat 75% kerja, 25% istirahat', TRUE, 'admin'); (15, 4, 2, 'Beban Kerja Berat', NULL, 25.0, 'Alokasi istirahat 75% kerja, 25% istirahat', TRUE, '2023-05-10 10:30:00', 1);
-- Insert Data Master Metode Sampling Iklim Kerja -- Insert Data Master Metode Sampling Iklim Kerja
INSERT INTO master_metode_sampling_iklim (id_metode, kode_metode, nama_metode, deskripsi, jenis_parameter, status, user_input) INSERT INTO master_climate_sampling_methods (MasterClimateSamplingMethodID, MasterClimateSamplingMethodCode, MasterClimateSamplingMethodName, MasterClimateSamplingMethodDescription, MasterClimateSamplingMethodParameterType, MasterClimateSamplingMethodIsActive, MasterClimateSamplingMethodCreatedAt, MasterClimateSamplingMethodCreatedUserID)
VALUES VALUES
(1, 'SNI-7062-2019-SUHU', 'SNI 7062:2019 - Pengukuran Suhu Udara', 'Metode standar pengukuran suhu udara menggunakan termometer ruangan', 'Suhu Udara', TRUE, 'admin'), (1, 'SNI-7062-2019-SUHU', 'SNI 7062:2019 - Pengukuran Suhu Udara', 'Metode standar pengukuran suhu udara menggunakan termometer ruangan', 'Suhu Udara', TRUE, '2023-05-10 10:30:00', 1),
(2, 'SNI-7062-2019-KELEMBABAN', 'SNI 7062:2019 - Pengukuran Kelembaban Udara', 'Metode standar pengukuran kelembaban relatif udara menggunakan hygrometer', 'Kelembaban Udara', TRUE, 'admin'), (2, 'SNI-7062-2019-KELEMBABAN', 'SNI 7062:2019 - Pengukuran Kelembaban Udara', 'Metode standar pengukuran kelembaban relatif udara menggunakan hygrometer', 'Kelembaban Udara', TRUE, '2023-05-10 10:30:00', 1),
(3, 'SNI-7062-2019-ANEMO', 'SNI 7062:2019 - Pengukuran Kecepatan Aliran Udara', 'Metode standar pengukuran kecepatan aliran udara menggunakan anemometer', 'Kecepatan Aliran Udara', TRUE, 'admin'), (3, 'SNI-7062-2019-ANEMO', 'SNI 7062:2019 - Pengukuran Kecepatan Aliran Udara', 'Metode standar pengukuran kecepatan aliran udara menggunakan anemometer', 'Kecepatan Aliran Udara', TRUE, '2023-05-10 10:30:00', 1),
(4, 'SNI-7062-2019-ISBB', 'SNI 7062:2019 - Pengukuran ISBB', 'Metode standar pengukuran Indeks Suhu Basah dan Bola menggunakan WBGT meter', 'ISBB', TRUE, 'admin'); (4, 'SNI-7062-2019-ISBB', 'SNI 7062:2019 - Pengukuran ISBB', 'Metode standar pengukuran Indeks Suhu Basah dan Bola menggunakan WBGT meter', 'ISBB', TRUE, '2023-05-10 10:30:00', 1);
-- Insert Data Master Peralatan Pengukuran Iklim Kerja -- Insert Data Master Peralatan Pengukuran Iklim Kerja
INSERT INTO master_peralatan_iklim (id_peralatan, kode_peralatan, nama_peralatan, merk, model, serial_number, spesifikasi, tanggal_kalibrasi, tanggal_kalibrasi_berikutnya, status_kalibrasi, file_sertifikat, status, user_input) INSERT INTO master_climate_equipment (MasterClimateEquipmentID, MasterClimateEquipmentCode, MasterClimateEquipmentName, MasterClimateEquipmentBrand, MasterClimateEquipmentModel, MasterClimateEquipmentSerialNumber, MasterClimateEquipmentSpecification, MasterClimateEquipmentLastCalibrationDate, MasterClimateEquipmentNextCalibrationDate, MasterClimateEquipmentCalibrationStatus, MasterClimateEquipmentCertificatePath, MasterClimateEquipmentIsActive, MasterClimateEquipmentCreatedAt, MasterClimateEquipmentCreatedUserID)
VALUES VALUES
(1, 'THERMO-01', 'Termohigrometer Digital', 'Lutron', 'PHB-318', 'LT12345678', 'Range suhu: -20 - 60°C, Range kelembaban: 10 - 95% RH, Resolusi: 0.1°C / 0.1% RH', '2023-05-10', '2024-05-10', 'VALID', '/dokumen/kalibrasi/thermo_lutron_2023.pdf', TRUE, 'admin'), (1, 'THERMO-01', 'Termohigrometer Digital', 'Lutron', 'PHB-318', 'LT12345678', 'Range suhu: -20 - 60°C, Range kelembaban: 10 - 95% RH, Resolusi: 0.1°C / 0.1% RH', '2023-05-10', '2024-05-10', 'VALID', '/dokumen/kalibrasi/thermo_lutron_2023.pdf', TRUE, '2023-05-10 10:30:00', 1),
(2, 'THERMO-02', 'Termohigrometer Digital', 'Extech', 'RHT50', 'EX87654321', 'Range suhu: -30 - 70°C, Range kelembaban: 0 - 99% RH, Resolusi: 0.1°C / 0.1% RH', '2023-08-15', '2024-08-15', 'VALID', '/dokumen/kalibrasi/thermo_extech_2023.pdf', TRUE, 'admin'), (2, 'THERMO-02', 'Termohigrometer Digital', 'Extech', 'RHT50', 'EX87654321', 'Range suhu: -30 - 70°C, Range kelembaban: 0 - 99% RH, Resolusi: 0.1°C / 0.1% RH', '2023-08-15', '2024-08-15', 'VALID', '/dokumen/kalibrasi/thermo_extech_2023.pdf', TRUE, '2023-08-15 10:30:00', 1),
(3, 'ANEMO-01', 'Anemometer Digital', 'Lutron', 'AM-4214SD', 'LA23456789', 'Range kecepatan udara: 0.2 - 20.0 m/s, Resolusi: 0.01 m/s', '2023-03-20', '2024-03-20', 'VALID', '/dokumen/kalibrasi/anemo_lutron_2023.pdf', TRUE, 'admin'), (3, 'ANEMO-01', 'Anemometer Digital', 'Lutron', 'AM-4214SD', 'LA23456789', 'Range kecepatan udara: 0.2 - 20.0 m/s, Resolusi: 0.01 m/s', '2023-03-20', '2024-03-20', 'VALID', '/dokumen/kalibrasi/anemo_lutron_2023.pdf', TRUE, '2023-03-20 10:30:00', 1),
(4, 'WBGT-01', 'Wet Bulb Globe Temperature Meter', 'Extech', 'HT30', 'EX55667788', 'Range WBGT: 0 - 50°C, Range TA: 0 - 50°C, Range TG: 0 - 80°C, Range RH: 0 - 100%', '2023-06-05', '2024-06-05', 'VALID', '/dokumen/kalibrasi/wbgt_extech_2023.pdf', TRUE, 'admin'), (4, 'WBGT-01', 'Wet Bulb Globe Temperature Meter', 'Extech', 'HT30', 'EX55667788', 'Range WBGT: 0 - 50°C, Range TA: 0 - 50°C, Range TG: 0 - 80°C, Range RH: 0 - 100%', '2023-06-05', '2024-06-05', 'VALID', '/dokumen/kalibrasi/wbgt_extech_2023.pdf', TRUE, '2023-06-05 10:30:00', 1),
(5, 'THERMO-03', 'Termohigrometer Ruangan', 'Testo', '608-H1', 'TS12131415', 'Range suhu: -10 - 70°C, Range kelembaban: 10 - 98% RH, Akurasi: ±0.5°C / ±3% RH', '2023-07-22', '2024-07-22', 'VALID', '/dokumen/kalibrasi/thermo_testo_2023.pdf', TRUE, 'admin'); (5, 'THERMO-03', 'Termohigrometer Ruangan', 'Testo', '608-H1', 'TS12131415', 'Range suhu: -10 - 70°C, Range kelembaban: 10 - 98% RH, Akurasi: ±0.5°C / ±3% RH', '2023-07-22', '2024-07-22', 'VALID', '/dokumen/kalibrasi/thermo_testo_2023.pdf', TRUE, '2023-07-22 10:30:00', 1);
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Insert Contoh Data Transaksi -- Insert Contoh Data Transaksi
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Contoh Data Sampling Plan Pengukuran Iklim Kerja -- Contoh Data Sampling Plan Pengukuran Iklim Kerja
INSERT INTO trx_sampling_plan_iklim (id_sampling_plan, kode_sampling_plan, nama_project, id_client, tanggal_rencana_sampling, lokasi_sampling, jumlah_titik, status_approval, catatan, tanggal_input, user_input) INSERT INTO climate_sampling_plans (ClimateSamplingPlanID, ClimateSamplingPlanCode, ClimateSamplingPlanProjectName, CustomerID, ClimateSamplingPlanDate, ClimateSamplingPlanLocation, ClimateSamplingPlanPointCount, ClimateSamplingPlanApprovalStatus, ClimateSamplingPlanRemarks, ClimateSamplingPlanCreatedAt, ClimateSamplingPlanCreatedUserID)
VALUES VALUES
(1, 'SP-IK-2024-001', 'Monitoring Iklim Kerja Semester I 2024 - PT. Indonesia Manufacturing Industry', 101, '2024-04-25', 'PT. Indonesia Manufacturing Industry, Jl. Industry Raya No. 123, Jakarta', 5, 'APPROVED', 'Monitoring rutin semester I tahun 2024 sesuai program K3', '2024-04-10 09:15:00', 'supervisor'); (1, 'SP-IK-2024-001', 'Monitoring Iklim Kerja Semester I 2024', 101, '2024-04-25', 'PT. Indonesia Manufacturing Industry', 5, 'APPROVED', 'Monitoring rutin semester I tahun 2024 sesuai program K3', '2024-04-10 09:15:00', 1);
-- Contoh Data Requisisi Peralatan untuk Pengukuran Iklim Kerja -- Contoh Data Requisisi Peralatan untuk Pengukuran Iklim Kerja
INSERT INTO trx_requisisi_peralatan_iklim (id_requisisi, id_sampling_plan, tanggal_requisisi, tanggal_kebutuhan, status_requisisi, catatan, tanggal_input, user_input) INSERT INTO climate_equipment_requisitions (ClimateEquipmentRequisitionID, ClimateSamplingPlanID, ClimateEquipmentRequisitionDate, ClimateEquipmentRequisitionNeedDate, ClimateEquipmentRequisitionStatus, ClimateEquipmentRequisitionRemarks, ClimateEquipmentRequisitionCreatedAt, ClimateEquipmentRequisitionCreatedUserID)
VALUES VALUES
(1, 1, '2024-04-15', '2024-04-25', 'APPROVED', 'Requisisi peralatan untuk monitoring iklim kerja PT. Indonesia Manufacturing Industry', '2024-04-15 10:30:00', 'officer'); (1, 1, '2024-04-15', '2024-04-25', 'APPROVED', 'Requisisi peralatan untuk monitoring iklim kerja PT. Indonesia Manufacturing Industry', '2024-04-15 10:30:00', 1);
-- Contoh Data Detail Requisisi Peralatan -- Contoh Data Detail Requisisi Peralatan
INSERT INTO trx_requisisi_peralatan_iklim_detail (id_requisisi_detail, id_requisisi, id_peralatan, jumlah, status_persetujuan, catatan, tanggal_input, user_input) INSERT INTO climate_equipment_requisition_details (ClimateEquipmentRequisitionDetailID, ClimateEquipmentRequisitionID, MasterClimateEquipmentID, ClimateEquipmentRequisitionDetailQuantity, ClimateEquipmentRequisitionDetailApprovalStatus, ClimateEquipmentRequisitionDetailRemarks, ClimateEquipmentRequisitionDetailCreatedAt, ClimateEquipmentRequisitionDetailCreatedUserID)
VALUES VALUES
(1, 1, 1, 1, 'APPROVED', 'Termohigrometer Digital Lutron untuk pengukuran suhu dan kelembaban', '2024-04-15 10:31:00', 'officer'), (1, 1, 1, 1, 'APPROVED', 'Termohigrometer Digital Lutron untuk pengukuran suhu dan kelembaban', '2024-04-15 10:31:00', 1),
(2, 1, 3, 1, 'APPROVED', 'Anemometer Digital Lutron untuk pengukuran kecepatan aliran udara', '2024-04-15 10:32:00', 'officer'); (2, 1, 3, 1, 'APPROVED', 'Anemometer Digital Lutron untuk pengukuran kecepatan aliran udara', '2024-04-15 10:32:00', 1);
-- Contoh Data Hasil Pengukuran Iklim Kerja -- Contoh Data Hasil Pengukuran Iklim Kerja
INSERT INTO trx_hasil_ukur_iklim (id_hasil_ukur, id_sampling_plan, kode_laporan, tanggal_sampling, waktu_mulai, waktu_selesai, kondisi_cuaca, petugas_sampling, status_laporan, catatan, tanggal_input, user_input) INSERT INTO climate_measurement_results (ClimateMeasurementResultID, ClimateSamplingPlanID, ClimateMeasurementResultCode, ClimateMeasurementResultDate, ClimateMeasurementResultStartTime, ClimateMeasurementResultEndTime, ClimateMeasurementResultWeather, ClimateMeasurementResultOfficer, ClimateMeasurementResultStatus, ClimateMeasurementResultRemarks, ClimateMeasurementResultCreatedAt, ClimateMeasurementResultCreatedUserID)
VALUES VALUES
(1, 1, 'LHU/IKLIM/04/2024/001', '2024-04-25', '09:00:00', '11:15:00', 'Cuaca cerah, suhu luar 31°C', 'Deni Hermawan', 'FINAL', 'Pengukuran berjalan lancar sesuai dengan rencana', '2024-04-25 15:30:00', 'officer'); (1, 1, 'LHU/IKLIM/04/2024/001', '2024-04-25', '09:00:00', '11:15:00', 'Cuaca cerah, suhu luar 31°C', 'Deni Hermawan', 'FINAL', 'Pengukuran berjalan lancar sesuai dengan rencana', '2024-04-25 15:30:00', 1);
-- Contoh Data Detail Hasil Pengukuran Iklim Kerja -- Contoh Data Detail Hasil Pengukuran Iklim Kerja
INSERT INTO trx_hasil_ukur_iklim_detail (id_hasil_ukur_detail, id_hasil_ukur, kode_titik, nama_lokasi, jenis_ruangan, id_parameter, hasil_pengukuran, baku_mutu_min, baku_mutu_max, id_metode, id_peralatan, status_kesesuaian, catatan, tanggal_input, user_input) INSERT INTO climate_measurement_result_details (ClimateMeasurementResultDetailID, ClimateMeasurementResultID, ClimateMeasurementResultDetailPointCode, ClimateMeasurementResultDetailLocation, ClimateMeasurementResultDetailRoomType, MasterClimateParameterID, ClimateMeasurementResultDetailValue, ClimateMeasurementResultDetailMinStandard, ClimateMeasurementResultDetailMaxStandard, MasterClimateSamplingMethodID, MasterClimateEquipmentID, ClimateMeasurementResultDetailComplianceStatus, ClimateMeasurementResultDetailRemarks, ClimateMeasurementResultDetailCreatedAt, ClimateMeasurementResultDetailCreatedUserID)
VALUES VALUES
-- Main Meeting Room -- Main Meeting Room
(1, 1, 'T1', 'Main Meeting Room', 'Ruang Administrasi/Kantor', 1, 21.0, 20.0, 25.0, 1, 1, 'COMPLY', '', '2024-04-25 15:35:00', 'officer'), (1, 1, 'T1', 'Main Meeting Room', 'Ruang Administrasi/Kantor', 1, 21.0, 20.0, 25.0, 1, 1, 'COMPLY', '', '2024-04-25 15:35:00', 1),
(2, 1, 'T1', 'Main Meeting Room', 'Ruang Administrasi/Kantor', 2, 50.5, 40.0, 60.0, 2, 1, 'COMPLY', '', '2024-04-25 15:35:00', 'officer'), (2, 1, 'T1', 'Main Meeting Room', 'Ruang Administrasi/Kantor', 2, 50.5, 40.0, 60.0, 2, 1, 'COMPLY', '', '2024-04-25 15:35:00', 1),
(3, 1, 'T1', 'Main Meeting Room', 'Ruang Administrasi/Kantor', 3, 0.15, 0.1, 0.2, 3, 3, 'COMPLY', '', '2024-04-25 15:35:00', 'officer'), (3, 1, 'T1', 'Main Meeting Room', 'Ruang Administrasi/Kantor', 3, 0.15, 0.1, 0.2, 3, 3, 'COMPLY', '', '2024-04-25 15:35:00', 1),
-- HR Work Area -- HR Work Area
(4, 1, 'T2', 'HR Work Area', 'Ruang Administrasi/Kantor', 1, 22.0, 20.0, 25.0, 1, 1, 'COMPLY', '', '2024-04-25 15:45:00', 'officer'), (4, 1, 'T2', 'HR Work Area', 'Ruang Administrasi/Kantor', 1, 22.0, 20.0, 25.0, 1, 1, 'COMPLY', '', '2024-04-25 15:45:00', 1),
(5, 1, 'T2', 'HR Work Area', 'Ruang Administrasi/Kantor', 2, 52.0, 40.0, 60.0, 2, 1, 'COMPLY', '', '2024-04-25 15:45:00', 'officer'), (5, 1, 'T2', 'HR Work Area', 'Ruang Administrasi/Kantor', 2, 52.0, 40.0, 60.0, 2, 1, 'COMPLY', '', '2024-04-25 15:45:00', 1),
(6, 1, 'T2', 'HR Work Area', 'Ruang Administrasi/Kantor', 3, 0.12, 0.1, 0.2, 3, 3, 'COMPLY', '', '2024-04-25 15:45:00', 'officer'), (6, 1, 'T2', 'HR Work Area', 'Ruang Administrasi/Kantor', 3, 0.12, 0.1, 0.2, 3, 3, 'COMPLY', '', '2024-04-25 15:45:00', 1),
-- Server Room -- Server Room
(7, 1, 'T3', 'Server Room', 'Ruang Khusus', 1, 19.0, 18.0, 24.0, 1, 1, 'COMPLY', '', '2024-04-25 15:55:00', 'officer'), (7, 1, 'T3', 'Server Room', 'Ruang Khusus', 1, 19.0, 18.0, 24.0, 1, 1, 'COMPLY', '', '2024-04-25 15:55:00', 1),
(8, 1, 'T3', 'Server Room', 'Ruang Khusus', 2, 45.0, 40.0, 60.0, 2, 1, 'COMPLY', '', '2024-04-25 15:55:00', 'officer'), (8, 1, 'T3', 'Server Room', 'Ruang Khusus', 2, 45.0, 40.0, 60.0, 2, 1, 'COMPLY', '', '2024-04-25 15:55:00', 1),
(9, 1, 'T3', 'Server Room', 'Ruang Khusus', 3, 0.25, 0.1, 0.3, 3, 3, 'COMPLY', '', '2024-04-25 15:55:00', 'officer'), (9, 1, 'T3', 'Server Room', 'Ruang Khusus', 3, 0.25, 0.1, 0.3, 3, 3, 'COMPLY', '', '2024-04-25 15:55:00', 1),
-- Production Line A -- Production Line A
(10, 1, 'T4', 'Production Line A', 'Ruang Produksi', 1, 26.0, 23.0, 26.0, 1, 1, 'COMPLY', '', '2024-04-25 16:05:00', 'officer'), (10, 1, 'T4', 'Production Line A', 'Ruang Produksi', 1, 26.0, 23.0, 26.0, 1, 1, 'COMPLY', '', '2024-04-25 16:05:00', 1),
(11, 1, 'T4', 'Production Line A', 'Ruang Produksi', 2, 65.0, 40.0, 60.0, 2, 1, 'NOT_COMPLY', 'Kelembaban melebihi baku mutu, perlu perbaikan sistem ventilasi', '2024-04-25 16:05:00', 'officer'), (11, 1, 'T4', 'Production Line A', 'Ruang Produksi', 2, 65.0, 40.0, 60.0, 2, 1, 'NOT_COMPLY', 'Kelembaban melebihi baku mutu, perlu perbaikan sistem ventilasi', '2024-04-25 16:05:00', 1),
(12, 1, 'T4', 'Production Line A', 'Ruang Produksi', 3, 0.30, 0.1, 0.3, 3, 3, 'COMPLY', '', '2024-04-25 16:05:00', 'officer'), (12, 1, 'T4', 'Production Line A', 'Ruang Produksi', 3, 0.30, 0.1, 0.3, 3, 3, 'COMPLY', '', '2024-04-25 16:05:00', 1),
-- Canteen Area -- Canteen Area
(13, 1, 'T5', 'Canteen Area', 'Ruang Istirahat', 1, 24.0, 22.0, 28.0, 1, 1, 'COMPLY', '', '2024-04-25 16:15:00', 'officer'), (13, 1, 'T5', 'Canteen Area', 'Ruang Istirahat', 1, 24.0, 22.0, 28.0, 1, 1, 'COMPLY', '', '2024-04-25 16:15:00', 1),
(14, 1, 'T5', 'Canteen Area', 'Ruang Istirahat', 2, 55.0, 40.0, 60.0, 2, 1, 'COMPLY', '', '2024-04-25 16:15:00', 'officer'), (14, 1, 'T5', 'Canteen Area', 'Ruang Istirahat', 2, 55.0, 40.0, 60.0, 2, 1, 'COMPLY', '', '2024-04-25 16:15:00', 1),
(15, 1, 'T5', 'Canteen Area', 'Ruang Istirahat', 3, 0.20, 0.1, 0.25, 3, 3, 'COMPLY', '', '2024-04-25 16:15:00', 'officer'); (15, 1, 'T5', 'Canteen Area', 'Ruang Istirahat', 3, 0.20, 0.1, 0.25, 3, 3, 'COMPLY', '', '2024-04-25 16:15:00', 1);

View File

@@ -1,218 +1,247 @@
-- Master Data untuk Pengelolaan Laporan Pengukuran Iklim Kerja Suhu -- Master Data untuk Pengelolaan Laporan Pengukuran Iklim Kerja Suhu
-- Berdasarkan PMK RI No.2 Tahun 2023 -- Berdasarkan PMK RI No.2 Tahun 2023
-- Master Tables
-- Tabel Master Regulasi -- Tabel Master Regulasi
CREATE TABLE master_regulasi ( CREATE TABLE master_regulations (
regulasi_id INT PRIMARY KEY AUTO_INCREMENT, MasterRegulationID INT PRIMARY KEY AUTO_INCREMENT,
kode_regulasi VARCHAR(50) NOT NULL, MasterRegulationCode VARCHAR(50) NOT NULL,
nama_regulasi VARCHAR(200) NOT NULL, MasterRegulationName VARCHAR(200) NOT NULL,
instansi_penerbit VARCHAR(100) NOT NULL, MasterRegulationIssuer VARCHAR(100) NOT NULL,
tahun_terbit INT NOT NULL, MasterRegulationYear INT NOT NULL,
tanggal_berlaku DATE, MasterRegulationEffectiveDate DATE,
deskripsi TEXT, MasterRegulationDescription TEXT,
file_path VARCHAR(255), MasterRegulationFilePath VARCHAR(255),
is_active BOOLEAN DEFAULT TRUE, MasterRegulationIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterRegulationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterRegulationCreatedUserID INT,
MasterRegulationUpdatedAt DATETIME,
MasterRegulationUpdatedUserID INT,
MasterRegulationDeletedAt DATETIME,
MasterRegulationDeletedUserID INT
); );
-- Tabel Master Parameter Lingkungan Kerja -- Tabel Master Parameter
CREATE TABLE master_parameter ( CREATE TABLE master_parameters (
parameter_id INT PRIMARY KEY AUTO_INCREMENT, MasterParameterID INT PRIMARY KEY AUTO_INCREMENT,
kode_parameter VARCHAR(50) NOT NULL, MasterParameterCode VARCHAR(50) NOT NULL,
nama_parameter VARCHAR(100) NOT NULL, MasterParameterName VARCHAR(100) NOT NULL,
kelompok_parameter VARCHAR(50), -- Fisika, Kimia, Biologi MasterParameterGroup VARCHAR(50),
satuan VARCHAR(20), MasterParameterUnit VARCHAR(20),
metode_analisis VARCHAR(100), MasterParameterMethod VARCHAR(100),
deskripsi TEXT, MasterParameterDescription TEXT,
harga DECIMAL(12, 2), MasterParameterPrice DECIMAL(12,2),
is_active BOOLEAN DEFAULT TRUE, MasterParameterIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterParameterCreatedUserID INT,
MasterParameterUpdatedAt DATETIME,
MasterParameterUpdatedUserID INT,
MasterParameterDeletedAt DATETIME,
MasterParameterDeletedUserID INT
); );
-- Tabel Master Nilai Ambang Batas untuk Iklim Kerja -- Tabel Master Nilai Ambang Batas
CREATE TABLE master_nilai_ambang_batas ( CREATE TABLE master_thresholds (
nab_id INT PRIMARY KEY AUTO_INCREMENT, MasterThresholdID INT PRIMARY KEY AUTO_INCREMENT,
regulasi_id INT, MasterRegulationID INT,
parameter_id INT, MasterParameterID INT,
tipe_ruangan VARCHAR(100) NOT NULL, MasterThresholdRoomType VARCHAR(100) NOT NULL,
nilai_minimal DECIMAL(8, 2), MasterThresholdMinValue DECIMAL(8,2),
nilai_maksimal DECIMAL(8, 2), MasterThresholdMaxValue DECIMAL(8,2),
satuan VARCHAR(20), MasterThresholdUnit VARCHAR(20),
keterangan TEXT, MasterThresholdRemarks TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterThresholdIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterThresholdCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MasterThresholdCreatedUserID INT,
FOREIGN KEY (regulasi_id) REFERENCES master_regulasi(regulasi_id), MasterThresholdUpdatedAt DATETIME,
FOREIGN KEY (parameter_id) REFERENCES master_parameter(parameter_id) MasterThresholdUpdatedUserID INT,
MasterThresholdDeletedAt DATETIME,
MasterThresholdDeletedUserID INT
); );
-- Tabel Master Pelanggan -- Tabel Master Pelanggan
CREATE TABLE master_pelanggan ( CREATE TABLE master_customers (
pelanggan_id INT PRIMARY KEY AUTO_INCREMENT, MasterCustomerID INT PRIMARY KEY AUTO_INCREMENT,
kode_pelanggan VARCHAR(50) NOT NULL, MasterCustomerCode VARCHAR(50) NOT NULL,
nama_pelanggan VARCHAR(200) NOT NULL, MasterCustomerName VARCHAR(200) NOT NULL,
alamat TEXT, MasterCustomerAddress TEXT,
kota VARCHAR(100), MasterCustomerCity VARCHAR(100),
provinsi VARCHAR(100), MasterCustomerProvince VARCHAR(100),
kode_pos VARCHAR(20), MasterCustomerPostalCode VARCHAR(20),
no_telepon VARCHAR(50), MasterCustomerPhone VARCHAR(50),
email VARCHAR(100), MasterCustomerEmail VARCHAR(100),
contact_person VARCHAR(100), MasterCustomerContactPerson VARCHAR(100),
jabatan_contact VARCHAR(100), MasterCustomerContactPosition VARCHAR(100),
bidang_usaha VARCHAR(100), MasterCustomerBusinessField VARCHAR(100),
is_active BOOLEAN DEFAULT TRUE, MasterCustomerIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterCustomerCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterCustomerCreatedUserID INT,
MasterCustomerUpdatedAt DATETIME,
MasterCustomerUpdatedUserID INT,
MasterCustomerDeletedAt DATETIME,
MasterCustomerDeletedUserID INT
); );
-- Tabel Master Personel (Petugas Sampling, Analis, dll) -- Tabel Master Personel
CREATE TABLE master_personel ( CREATE TABLE master_personnel (
personel_id INT PRIMARY KEY AUTO_INCREMENT, MasterPersonnelID INT PRIMARY KEY AUTO_INCREMENT,
nik VARCHAR(50) NOT NULL, MasterPersonnelNIK VARCHAR(50) NOT NULL,
nama VARCHAR(100) NOT NULL, MasterPersonnelName VARCHAR(100) NOT NULL,
jabatan VARCHAR(100), MasterPersonnelPosition VARCHAR(100),
departemen VARCHAR(100), MasterPersonnelDepartment VARCHAR(100),
email VARCHAR(100), MasterPersonnelEmail VARCHAR(100),
no_telepon VARCHAR(50), MasterPersonnelPhone VARCHAR(50),
sertifikasi TEXT, MasterPersonnelCertification TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterPersonnelIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterPersonnelCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterPersonnelCreatedUserID INT,
MasterPersonnelUpdatedAt DATETIME,
MasterPersonnelUpdatedUserID INT,
MasterPersonnelDeletedAt DATETIME,
MasterPersonnelDeletedUserID INT
); );
-- Tabel Master Peralatan Pengukuran -- Tabel Master Peralatan
CREATE TABLE master_peralatan ( CREATE TABLE master_equipment (
peralatan_id INT PRIMARY KEY AUTO_INCREMENT, MasterEquipmentID INT PRIMARY KEY AUTO_INCREMENT,
kode_peralatan VARCHAR(50) NOT NULL, MasterEquipmentCode VARCHAR(50) NOT NULL,
nama_peralatan VARCHAR(100) NOT NULL, MasterEquipmentName VARCHAR(100) NOT NULL,
merk VARCHAR(100), MasterEquipmentBrand VARCHAR(100),
model VARCHAR(100), MasterEquipmentModel VARCHAR(100),
nomor_seri VARCHAR(100), MasterEquipmentSerialNumber VARCHAR(100),
tanggal_kalibrasi DATE, MasterEquipmentCalibrationDate DATE,
tanggal_kalibrasi_selanjutnya DATE, MasterEquipmentNextCalibrationDate DATE,
parameter_id INT, MasterParameterID INT,
spesifikasi TEXT, MasterEquipmentSpecification TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterEquipmentIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterEquipmentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MasterEquipmentCreatedUserID INT,
FOREIGN KEY (parameter_id) REFERENCES master_parameter(parameter_id) MasterEquipmentUpdatedAt DATETIME,
MasterEquipmentUpdatedUserID INT,
MasterEquipmentDeletedAt DATETIME,
MasterEquipmentDeletedUserID INT
); );
-- Tabel Master Lokasi Sampling -- Tabel Master Lokasi Sampling
CREATE TABLE master_lokasi_sampling ( CREATE TABLE master_sampling_locations (
lokasi_id INT PRIMARY KEY AUTO_INCREMENT, MasterSamplingLocationID INT PRIMARY KEY AUTO_INCREMENT,
pelanggan_id INT, MasterCustomerID INT,
nama_lokasi VARCHAR(200) NOT NULL, MasterSamplingLocationName VARCHAR(200) NOT NULL,
alamat TEXT, MasterSamplingLocationAddress TEXT,
koordinat_latitude DECIMAL(10, 8), MasterSamplingLocationLatitude DECIMAL(10,8),
koordinat_longitude DECIMAL(11, 8), MasterSamplingLocationLongitude DECIMAL(11,8),
jenis_ruangan VARCHAR(100), MasterSamplingLocationRoomType VARCHAR(100),
deskripsi TEXT, MasterSamplingLocationDescription TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterSamplingLocationIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterSamplingLocationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MasterSamplingLocationCreatedUserID INT,
FOREIGN KEY (pelanggan_id) REFERENCES master_pelanggan(pelanggan_id) MasterSamplingLocationUpdatedAt DATETIME,
MasterSamplingLocationUpdatedUserID INT,
MasterSamplingLocationDeletedAt DATETIME,
MasterSamplingLocationDeletedUserID INT
); );
-- Tabel Permintaan Pengukuran (Form Request) -- Transaction Tables
CREATE TABLE permintaan_pengukuran (
permintaan_id INT PRIMARY KEY AUTO_INCREMENT, -- Tabel Permintaan Pengukuran
nomor_permintaan VARCHAR(50) NOT NULL, CREATE TABLE measurement_requests (
pelanggan_id INT, MeasurementRequestID INT PRIMARY KEY AUTO_INCREMENT,
tanggal_permintaan DATE, MeasurementRequestNumber VARCHAR(50) NOT NULL,
tanggal_rencana_sampling DATE, MasterCustomerID INT,
contact_person VARCHAR(100), MeasurementRequestDate DATE,
status VARCHAR(50), -- draft, submitted, approved, scheduled, completed, canceled MeasurementRequestPlanDate DATE,
catatan TEXT, MeasurementRequestContactPerson VARCHAR(100),
dibuat_oleh INT, MeasurementRequestStatus VARCHAR(50),
disetujui_oleh INT, MeasurementRequestNotes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MeasurementRequestCreatedBy INT,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MeasurementRequestApprovedBy INT,
FOREIGN KEY (pelanggan_id) REFERENCES master_pelanggan(pelanggan_id), MeasurementRequestCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (dibuat_oleh) REFERENCES master_personel(personel_id), MeasurementRequestCreatedUserID INT,
FOREIGN KEY (disetujui_oleh) REFERENCES master_personel(personel_id) MeasurementRequestUpdatedAt DATETIME,
MeasurementRequestUpdatedUserID INT,
MeasurementRequestDeletedAt DATETIME,
MeasurementRequestDeletedUserID INT
); );
-- Tabel Detail Permintaan Pengukuran -- Tabel Detail Permintaan Pengukuran
CREATE TABLE detail_permintaan_pengukuran ( CREATE TABLE measurement_request_details (
detail_permintaan_id INT PRIMARY KEY AUTO_INCREMENT, MeasurementRequestDetailID INT PRIMARY KEY AUTO_INCREMENT,
permintaan_id INT, MeasurementRequestID INT,
parameter_id INT, MasterParameterID INT,
lokasi_id INT, MasterSamplingLocationID INT,
jumlah_titik INT DEFAULT 1, MeasurementRequestDetailPointCount INT DEFAULT 1,
harga_satuan DECIMAL(12, 2), MeasurementRequestDetailUnitPrice DECIMAL(12,2),
subtotal DECIMAL(12, 2), MeasurementRequestDetailSubtotal DECIMAL(12,2),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MeasurementRequestDetailCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MeasurementRequestDetailCreatedUserID INT,
FOREIGN KEY (permintaan_id) REFERENCES permintaan_pengukuran(permintaan_id), MeasurementRequestDetailUpdatedAt DATETIME,
FOREIGN KEY (parameter_id) REFERENCES master_parameter(parameter_id), MeasurementRequestDetailUpdatedUserID INT,
FOREIGN KEY (lokasi_id) REFERENCES master_lokasi_sampling(lokasi_id) MeasurementRequestDetailDeletedAt DATETIME,
MeasurementRequestDetailDeletedUserID INT
); );
-- Tabel Jadwal Pengukuran -- Tabel Jadwal Pengukuran
CREATE TABLE jadwal_pengukuran ( CREATE TABLE measurement_schedules (
jadwal_id INT PRIMARY KEY AUTO_INCREMENT, MeasurementScheduleID INT PRIMARY KEY AUTO_INCREMENT,
nomor_jadwal VARCHAR(50) NOT NULL, MeasurementScheduleNumber VARCHAR(50) NOT NULL,
permintaan_id INT, MeasurementRequestID INT,
tanggal_pengukuran DATE, MeasurementScheduleDate DATE,
petugas_id INT, MasterPersonnelID INT,
status VARCHAR(50), -- scheduled, completed, rescheduled, canceled MeasurementScheduleStatus VARCHAR(50),
catatan TEXT, MeasurementScheduleNotes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MeasurementScheduleCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MeasurementScheduleCreatedUserID INT,
FOREIGN KEY (permintaan_id) REFERENCES permintaan_pengukuran(permintaan_id), MeasurementScheduleUpdatedAt DATETIME,
FOREIGN KEY (petugas_id) REFERENCES master_personel(personel_id) MeasurementScheduleUpdatedUserID INT,
MeasurementScheduleDeletedAt DATETIME,
MeasurementScheduleDeletedUserID INT
); );
-- Tabel Laporan Hasil Uji Iklim Kerja -- Tabel Laporan Hasil Uji
CREATE TABLE laporan_hasil_uji ( CREATE TABLE test_reports (
laporan_id INT PRIMARY KEY AUTO_INCREMENT, TestReportID INT PRIMARY KEY AUTO_INCREMENT,
nomor_laporan VARCHAR(50) NOT NULL, TestReportNumber VARCHAR(50) NOT NULL,
permintaan_id INT, MeasurementRequestID INT,
jadwal_id INT, MeasurementScheduleID INT,
tanggal_pengukuran DATE, TestReportMeasurementDate DATE,
tanggal_terbit DATE, TestReportIssueDate DATE,
pelanggan_id INT, MasterCustomerID INT,
petugas_id INT, MasterPersonnelID INT,
diverifikasi_oleh INT, TestReportVerifiedBy INT,
disetujui_oleh INT, TestReportApprovedBy INT,
status VARCHAR(50), -- draft, verification, approved, published, revised TestReportStatus VARCHAR(50),
halaman_jumlah INT DEFAULT 1, TestReportPageCount INT DEFAULT 1,
catatan TEXT, TestReportNotes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, TestReportCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, TestReportCreatedUserID INT,
FOREIGN KEY (permintaan_id) REFERENCES permintaan_pengukuran(permintaan_id), TestReportUpdatedAt DATETIME,
FOREIGN KEY (jadwal_id) REFERENCES jadwal_pengukuran(jadwal_id), TestReportUpdatedUserID INT,
FOREIGN KEY (pelanggan_id) REFERENCES master_pelanggan(pelanggan_id), TestReportDeletedAt DATETIME,
FOREIGN KEY (petugas_id) REFERENCES master_personel(personel_id), TestReportDeletedUserID INT
FOREIGN KEY (diverifikasi_oleh) REFERENCES master_personel(personel_id),
FOREIGN KEY (disetujui_oleh) REFERENCES master_personel(personel_id)
); );
-- Tabel Detail Hasil Pengukuran Iklim Kerja Suhu -- Tabel Hasil Pengukuran Suhu
CREATE TABLE hasil_pengukuran_suhu ( CREATE TABLE temperature_measurements (
hasil_id INT PRIMARY KEY AUTO_INCREMENT, TemperatureMeasurementID INT PRIMARY KEY AUTO_INCREMENT,
laporan_id INT, TestReportID INT,
lokasi_id INT, MasterSamplingLocationID INT,
kode_sampel VARCHAR(50) NOT NULL, TemperatureMeasurementCode VARCHAR(50) NOT NULL,
waktu_pengukuran_mulai TIME, TemperatureMeasurementStartTime TIME,
waktu_pengukuran_selesai TIME, TemperatureMeasurementEndTime TIME,
parameter_id INT, MasterParameterID INT,
hasil_pengukuran DECIMAL(8, 2), TemperatureMeasurementValue DECIMAL(8,2),
satuan VARCHAR(20), TemperatureMeasurementUnit VARCHAR(20),
metode VARCHAR(100), TemperatureMeasurementMethod VARCHAR(100),
nab_id INT, MasterThresholdID INT,
keterangan TEXT, TemperatureMeasurementRemarks TEXT,
peralatan_id INT, MasterEquipmentID INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, TemperatureMeasurementCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, TemperatureMeasurementCreatedUserID INT,
FOREIGN KEY (laporan_id) REFERENCES laporan_hasil_uji(laporan_id), TemperatureMeasurementUpdatedAt DATETIME,
FOREIGN KEY (lokasi_id) REFERENCES master_lokasi_sampling(lokasi_id), TemperatureMeasurementUpdatedUserID INT,
FOREIGN KEY (parameter_id) REFERENCES master_parameter(parameter_id), TemperatureMeasurementDeletedAt DATETIME,
FOREIGN KEY (nab_id) REFERENCES master_nilai_ambang_batas(nab_id), TemperatureMeasurementDeletedUserID INT
FOREIGN KEY (peralatan_id) REFERENCES master_peralatan(peralatan_id)
); );
-- ================================ -- ================================
@@ -220,19 +249,19 @@ CREATE TABLE hasil_pengukuran_suhu (
-- ================================ -- ================================
-- Insert Master Regulasi -- Insert Master Regulasi
INSERT INTO master_regulasi (regulasi_id, kode_regulasi, nama_regulasi, instansi_penerbit, tahun_terbit, tanggal_berlaku, deskripsi, file_path, is_active) VALUES INSERT INTO master_regulations (MasterRegulationID, MasterRegulationCode, MasterRegulationName, MasterRegulationIssuer, MasterRegulationYear, MasterRegulationEffectiveDate, MasterRegulationDescription, MasterRegulationFilePath, MasterRegulationIsActive) VALUES
(1, 'PMK-02-2023', 'Peraturan Menteri Kesehatan Republik Indonesia Nomor 2 Tahun 2023', 'Kementerian Kesehatan RI', 2023, '2023-02-01', 'Peraturan mengenai Standar Baku Mutu Kesehatan Lingkungan dan Persyaratan Kesehatan', '/documents/regulasi/PMK_02_2023.pdf', TRUE), (1, 'PMK-02-2023', 'Peraturan Menteri Kesehatan Republik Indonesia Nomor 2 Tahun 2023', 'Kementerian Kesehatan RI', 2023, '2023-02-01', 'Peraturan mengenai Standar Baku Mutu Kesehatan Lingkungan dan Persyaratan Kesehatan', '/documents/regulasi/PMK_02_2023.pdf', TRUE),
(2, 'PERMENAKER-05-2018', 'Peraturan Menteri Ketenagakerjaan Republik Indonesia Nomor 5 Tahun 2018', 'Kementerian Ketenagakerjaan RI', 2018, '2018-05-10', 'Peraturan mengenai Keselamatan dan Kesehatan Kerja Lingkungan Kerja', '/documents/regulasi/PERMENAKER_05_2018.pdf', TRUE); (2, 'PERMENAKER-05-2018', 'Peraturan Menteri Ketenagakerjaan Republik Indonesia Nomor 5 Tahun 2018', 'Kementerian Ketenagakerjaan RI', 2018, '2018-05-10', 'Peraturan mengenai Keselamatan dan Kesehatan Kerja Lingkungan Kerja', '/documents/regulasi/PERMENAKER_05_2018.pdf', TRUE);
-- Insert Master Parameter -- Insert Master Parameter
INSERT INTO master_parameter (parameter_id, kode_parameter, nama_parameter, kelompok_parameter, satuan, metode_analisis, deskripsi, harga, is_active) VALUES INSERT INTO master_parameters (MasterParameterID, MasterParameterCode, MasterParameterName, MasterParameterGroup, MasterParameterUnit, MasterParameterMethod, MasterParameterDescription, MasterParameterPrice, MasterParameterIsActive) VALUES
(1, 'SUHU', 'Suhu', 'Fisika', '°C', 'SNI 7062: 2019', 'Parameter iklim kerja untuk pengukuran suhu ruangan', 75000.00, TRUE), (1, 'SUHU', 'Suhu', 'Fisika', '°C', 'SNI 7062: 2019', 'Parameter iklim kerja untuk pengukuran suhu ruangan', 75000.00, TRUE),
(2, 'KELEMBABAN', 'Kelembaban', 'Fisika', '%RH', 'SNI 7062: 2019', 'Parameter iklim kerja untuk pengukuran kelembaban relatif', 75000.00, TRUE), (2, 'KELEMBABAN', 'Kelembaban', 'Fisika', '%RH', 'SNI 7062: 2019', 'Parameter iklim kerja untuk pengukuran kelembaban relatif', 75000.00, TRUE),
(3, 'ISBB', 'Indeks Suhu Basah dan Bola', 'Fisika', '°C', 'SNI 7062: 2019', 'Parameter iklim kerja untuk pengukuran ISBB indoor/outdoor', 100000.00, TRUE), (3, 'ISBB', 'Indeks Suhu Basah dan Bola', 'Fisika', '°C', 'SNI 7062: 2019', 'Parameter iklim kerja untuk pengukuran ISBB indoor/outdoor', 100000.00, TRUE),
(4, 'KECUDARA', 'Kecepatan Aliran Udara', 'Fisika', 'm/s', 'SNI 7062: 2019', 'Parameter iklim kerja untuk pengukuran kecepatan aliran udara', 75000.00, TRUE); (4, 'KECUDARA', 'Kecepatan Aliran Udara', 'Fisika', 'm/s', 'SNI 7062: 2019', 'Parameter iklim kerja untuk pengukuran kecepatan aliran udara', 75000.00, TRUE);
-- Insert Master Nilai Ambang Batas untuk Parameter Suhu -- Insert Master Nilai Ambang Batas untuk Parameter Suhu
INSERT INTO master_nilai_ambang_batas (nab_id, regulasi_id, parameter_id, tipe_ruangan, nilai_minimal, nilai_maksimal, satuan, keterangan, is_active) VALUES INSERT INTO master_thresholds (MasterThresholdID, MasterRegulationID, MasterParameterID, MasterThresholdRoomType, MasterThresholdMinValue, MasterThresholdMaxValue, MasterThresholdUnit, MasterThresholdRemarks, MasterThresholdIsActive) VALUES
(1, 1, 1, 'Administrasi', 20.00, 25.00, '°C', 'Ruang kerja administrasi dan perkantoran', TRUE), (1, 1, 1, 'Administrasi', 20.00, 25.00, '°C', 'Ruang kerja administrasi dan perkantoran', TRUE),
(2, 1, 1, 'Ruangan Khusus', 18.00, 24.00, '°C', 'Ruang server, laboratorium, dll', TRUE), (2, 1, 1, 'Ruangan Khusus', 18.00, 24.00, '°C', 'Ruang server, laboratorium, dll', TRUE),
(3, 1, 1, 'Produksi', 23.00, 26.00, '°C', 'Ruang produksi', TRUE), (3, 1, 1, 'Produksi', 23.00, 26.00, '°C', 'Ruang produksi', TRUE),
@@ -241,43 +270,43 @@ INSERT INTO master_nilai_ambang_batas (nab_id, regulasi_id, parameter_id, tipe_r
(6, 1, 1, 'Gudang', 16.00, 30.00, '°C', 'Ruang penyimpanan, gudang', TRUE); (6, 1, 1, 'Gudang', 16.00, 30.00, '°C', 'Ruang penyimpanan, gudang', TRUE);
-- Insert Master Pelanggan -- Insert Master Pelanggan
INSERT INTO master_pelanggan (pelanggan_id, kode_pelanggan, nama_pelanggan, alamat, kota, provinsi, kode_pos, no_telepon, email, contact_person, jabatan_contact, bidang_usaha, is_active) VALUES INSERT INTO master_customers (MasterCustomerID, MasterCustomerCode, MasterCustomerName, MasterCustomerAddress, MasterCustomerCity, MasterCustomerProvince, MasterCustomerPostalCode, MasterCustomerPhone, MasterCustomerEmail, MasterCustomerContactPerson, MasterCustomerContactPosition, MasterCustomerBusinessField, MasterCustomerIsActive) VALUES
(1, 'PLG-001', 'PT. Industri Manufaktur Indonesia', 'Jl. Industri Raya No. 123', 'Jakarta', 'DKI Jakarta', '12950', '021-5551234', 'contact@manufakturindonesia.com', 'Budi Santoso', 'HSE Manager', 'Manufaktur', TRUE), (1, 'PLG-001', 'PT. Industri Manufaktur Indonesia', 'Jl. Industri Raya No. 123', 'Jakarta', 'DKI Jakarta', '12950', '021-5551234', 'contact@manufakturindonesia.com', 'Budi Santoso', 'HSE Manager', 'Manufaktur', TRUE),
(2, 'PLG-002', 'PT. Teknologi Digital Nusantara', 'Jl. Gatot Subroto Kav. 52-53', 'Jakarta', 'DKI Jakarta', '12710', '021-5552345', 'hrd@tdn.co.id', 'Siti Rahma', 'HR Director', 'Teknologi Informasi', TRUE), (2, 'PLG-002', 'PT. Teknologi Digital Nusantara', 'Jl. Gatot Subroto Kav. 52-53', 'Jakarta', 'DKI Jakarta', '12710', '021-5552345', 'hrd@tdn.co.id', 'Siti Rahma', 'HR Director', 'Teknologi Informasi', TRUE),
(3, 'PLG-003', 'RSUD Kota Sehat', 'Jl. Kesehatan No. 45', 'Bandung', 'Jawa Barat', '40112', '022-7654321', 'info@rsudkotasehat.go.id', 'dr. Ahmad Hidayat', 'Direktur', 'Kesehatan', TRUE); (3, 'PLG-003', 'RSUD Kota Sehat', 'Jl. Kesehatan No. 45', 'Bandung', 'Jawa Barat', '40112', '022-7654321', 'info@rsudkotasehat.go.id', 'dr. Ahmad Hidayat', 'Direktur', 'Kesehatan', TRUE);
-- Insert Master Personel -- Insert Master Personel
INSERT INTO master_personel (personel_id, nik, nama, jabatan, departemen, email, no_telepon, sertifikasi, is_active) VALUES INSERT INTO master_personnel (MasterPersonnelID, MasterPersonnelNIK, MasterPersonnelName, MasterPersonnelPosition, MasterPersonnelDepartment, MasterPersonnelEmail, MasterPersonnelPhone, MasterPersonnelCertification, MasterPersonnelIsActive) VALUES
(1, 'EMP-001', 'Hendra Wijaya', 'Supervisor Pengujian', 'Laboratorium', 'hendra@lab-env.co.id', '081234567890', 'Sertifikasi Pengambilan Contoh Uji Lingkungan Kerja', TRUE), (1, 'EMP-001', 'Hendra Wijaya', 'Supervisor Pengujian', 'Laboratorium', 'hendra@lab-env.co.id', '081234567890', 'Sertifikasi Pengambilan Contoh Uji Lingkungan Kerja', TRUE),
(2, 'EMP-002', 'Ratna Dewi', 'Analis Senior', 'Laboratorium', 'ratna@lab-env.co.id', '081234567891', 'Sertifikasi Analis Laboratorium, Ahli K3 Umum', TRUE), (2, 'EMP-002', 'Ratna Dewi', 'Analis Senior', 'Laboratorium', 'ratna@lab-env.co.id', '081234567891', 'Sertifikasi Analis Laboratorium, Ahli K3 Umum', TRUE),
(3, 'EMP-003', 'Deni Hermawan', 'Petugas Sampling', 'Laboratorium', 'deni@lab-env.co.id', '081234567892', 'Sertifikasi Pengambilan Contoh Uji', TRUE), (3, 'EMP-003', 'Deni Hermawan', 'Petugas Sampling', 'Laboratorium', 'deni@lab-env.co.id', '081234567892', 'Sertifikasi Pengambilan Contoh Uji', TRUE),
(4, 'EMP-004', 'Farida Nurhasanah', 'Manager Laboratorium', 'Laboratorium', 'farida@lab-env.co.id', '081234567893', 'Sertifikasi Manager Mutu, Sertifikasi Ahli K3', TRUE); (4, 'EMP-004', 'Farida Nurhasanah', 'Manager Laboratorium', 'Laboratorium', 'farida@lab-env.co.id', '081234567893', 'Sertifikasi Manager Mutu, Sertifikasi Ahli K3', TRUE);
-- Insert Master Peralatan Pengukuran -- Insert Master Peralatan
INSERT INTO master_peralatan (peralatan_id, kode_peralatan, nama_peralatan, merk, model, nomor_seri, tanggal_kalibrasi, tanggal_kalibrasi_selanjutnya, parameter_id, spesifikasi, is_active) VALUES INSERT INTO master_equipment (MasterEquipmentID, MasterEquipmentCode, MasterEquipmentName, MasterEquipmentBrand, MasterEquipmentModel, MasterEquipmentSerialNumber, MasterEquipmentCalibrationDate, MasterEquipmentNextCalibrationDate, MasterParameterID, MasterEquipmentSpecification, MasterEquipmentIsActive) VALUES
(1, 'EQP-TH001', 'Thermohygrometer', 'Lutron', 'PHB-318', 'LT12345678', '2023-11-10', '2024-05-10', 1, 'Range suhu: -20°C hingga 60°C, akurasi ±0.8°C', TRUE), (1, 'EQP-TH001', 'Thermohygrometer', 'Lutron', 'PHB-318', 'LT12345678', '2023-11-10', '2024-05-10', 1, 'Range suhu: -20°C hingga 60°C, akurasi ±0.8°C', TRUE),
(2, 'EQP-TH002', 'Thermohygrometer', 'Extech', 'RHT50', 'EX87654321', '2023-10-15', '2024-04-15', 1, 'Range suhu: -30°C hingga 70°C, akurasi ±0.5°C', TRUE), (2, 'EQP-TH002', 'Thermohygrometer', 'Extech', 'RHT50', 'EX87654321', '2023-10-15', '2024-04-15', 1, 'Range suhu: -30°C hingga 70°C, akurasi ±0.5°C', TRUE),
(3, 'EQP-WBGT001', 'WBGT Meter', 'Lutron', 'WBGT-2010SD', 'LW12348765', '2023-11-05', '2024-05-05', 3, 'Range WBGT: 15°C hingga 59°C, akurasi ±0.8°C', TRUE), (3, 'EQP-WBGT001', 'WBGT Meter', 'Lutron', 'WBGT-2010SD', 'LW12348765', '2023-11-05', '2024-05-05', 3, 'Range WBGT: 15°C hingga 59°C, akurasi ±0.8°C', TRUE),
(4, 'EQP-ANM001', 'Anemometer', 'Lutron', 'AM-4214SD', 'LA23456789', '2023-09-20', '2024-03-20', 4, 'Range kecepatan udara: 0.2 m/s hingga 35 m/s, akurasi ±2%', TRUE); (4, 'EQP-ANM001', 'Anemometer', 'Lutron', 'AM-4214SD', 'LA23456789', '2023-09-20', '2024-03-20', 4, 'Range kecepatan udara: 0.2 m/s hingga 35 m/s, akurasi ±2%', TRUE);
-- Insert Master Lokasi Sampling untuk PT. Industri Manufaktur Indonesia -- Insert Master Lokasi Sampling untuk PT. Industri Manufaktur Indonesia
INSERT INTO master_lokasi_sampling (lokasi_id, pelanggan_id, nama_lokasi, alamat, jenis_ruangan, deskripsi, is_active) VALUES INSERT INTO master_sampling_locations (MasterSamplingLocationID, MasterCustomerID, MasterSamplingLocationName, MasterSamplingLocationAddress, MasterSamplingLocationLatitude, MasterSamplingLocationLongitude, MasterSamplingLocationRoomType, MasterSamplingLocationDescription, MasterSamplingLocationIsActive) VALUES
(1, 1, 'Ruang Meeting Utama', 'Lantai 2, Gedung Utama', 'Administrasi', 'Ruang meeting dengan kapasitas 20 orang', TRUE), (1, 1, 'Ruang Meeting Utama', 'Lantai 2, Gedung Utama', 0.00000000, 0.00000000, 'Administrasi', 'Ruang meeting dengan kapasitas 20 orang', TRUE),
(2, 1, 'Ruang Kerja HRD', 'Lantai 2, Gedung Utama', 'Administrasi', 'Ruang kerja staff HRD', TRUE), (2, 1, 'Ruang Kerja HRD', 'Lantai 2, Gedung Utama', 0.00000000, 0.00000000, 'Administrasi', 'Ruang kerja staff HRD', TRUE),
(3, 1, 'Ruang Server', 'Lantai 1, Gedung Utama', 'Ruangan Khusus', 'Ruang server dengan pendingin khusus', TRUE), (3, 1, 'Ruang Server', 'Lantai 1, Gedung Utama', 0.00000000, 0.00000000, 'Ruangan Khusus', 'Ruang server dengan pendingin khusus', TRUE),
(4, 1, 'Area Produksi Line A', 'Lantai 1, Gedung Produksi', 'Produksi', 'Area produksi utama line A', TRUE), (4, 1, 'Area Produksi Line A', 'Lantai 1, Gedung Produksi', 0.00000000, 0.00000000, 'Produksi', 'Area produksi utama line A', TRUE),
(5, 1, 'Area Kantin', 'Lantai 1, Gedung Pendukung', 'Ruang Umum', 'Kantin karyawan dengan kapasitas 100 orang', TRUE); (5, 1, 'Area Kantin', 'Lantai 1, Gedung Pendukung', 0.00000000, 0.00000000, 'Ruang Umum', 'Kantin karyawan dengan kapasitas 100 orang', TRUE);
-- ================================ -- ================================
-- CONTOH DATA TRANSAKSI -- CONTOH DATA TRANSAKSI
-- ================================ -- ================================
-- Contoh Permintaan Pengukuran -- Contoh Permintaan Pengukuran
INSERT INTO permintaan_pengukuran (permintaan_id, nomor_permintaan, pelanggan_id, tanggal_permintaan, tanggal_rencana_sampling, contact_person, status, catatan, dibuat_oleh, disetujui_oleh) VALUES INSERT INTO measurement_requests (MeasurementRequestID, MeasurementRequestNumber, MasterCustomerID, MeasurementRequestDate, MeasurementRequestPlanDate, MeasurementRequestContactPerson, MeasurementRequestStatus, MeasurementRequestNotes, MeasurementRequestCreatedBy, MeasurementRequestApprovedBy) VALUES
(1, 'REQ/2024/04/001', 1, '2024-04-05', '2024-04-25', 'Budi Santoso', 'approved', 'Pengukuran rutin triwulanan untuk parameter iklim kerja', 3, 4); (1, 'REQ/2024/04/001', 1, '2024-04-05', '2024-04-25', 'Budi Santoso', 'approved', 'Pengukuran rutin triwulanan untuk parameter iklim kerja', 3, 4);
-- Contoh Detail Permintaan Pengukuran -- Contoh Detail Permintaan Pengukuran
INSERT INTO detail_permintaan_pengukuran (detail_permintaan_id, permintaan_id, parameter_id, lokasi_id, jumlah_titik, harga_satuan, subtotal) VALUES INSERT INTO measurement_request_details (MeasurementRequestDetailID, MeasurementRequestID, MasterParameterID, MasterSamplingLocationID, MeasurementRequestDetailPointCount, MeasurementRequestDetailUnitPrice, MeasurementRequestDetailSubtotal) VALUES
(1, 1, 1, 1, 1, 75000.00, 75000.00), (1, 1, 1, 1, 1, 75000.00, 75000.00),
(2, 1, 1, 2, 1, 75000.00, 75000.00), (2, 1, 1, 2, 1, 75000.00, 75000.00),
(3, 1, 1, 3, 1, 75000.00, 75000.00), (3, 1, 1, 3, 1, 75000.00, 75000.00),
@@ -285,15 +314,15 @@ INSERT INTO detail_permintaan_pengukuran (detail_permintaan_id, permintaan_id, p
(5, 1, 1, 5, 1, 75000.00, 75000.00); (5, 1, 1, 5, 1, 75000.00, 75000.00);
-- Contoh Jadwal Pengukuran -- Contoh Jadwal Pengukuran
INSERT INTO jadwal_pengukuran (jadwal_id, nomor_jadwal, permintaan_id, tanggal_pengukuran, petugas_id, status, catatan) VALUES INSERT INTO measurement_schedules (MeasurementScheduleID, MeasurementScheduleNumber, MeasurementRequestID, MeasurementScheduleDate, MasterPersonnelID, MeasurementScheduleStatus, MeasurementScheduleNotes) VALUES
(1, 'SCH/2024/04/001', 1, '2024-04-25', 3, 'completed', 'Pengukuran dilakukan pada jam operasional normal'); (1, 'SCH/2024/04/001', 1, '2024-04-25', 3, 'completed', 'Pengukuran dilakukan pada jam operasional normal');
-- Contoh Laporan Hasil Uji -- Contoh Laporan Hasil Uji
INSERT INTO laporan_hasil_uji (laporan_id, nomor_laporan, permintaan_id, jadwal_id, tanggal_pengukuran, tanggal_terbit, pelanggan_id, petugas_id, diverifikasi_oleh, disetujui_oleh, status, halaman_jumlah, catatan) VALUES INSERT INTO test_reports (TestReportID, TestReportNumber, MeasurementRequestID, MeasurementScheduleID, TestReportMeasurementDate, TestReportIssueDate, MasterCustomerID, MasterPersonnelID, TestReportVerifiedBy, TestReportApprovedBy, TestReportStatus, TestReportPageCount, TestReportNotes) VALUES
(1, 'LHU/KLIM/04/2024/001', 1, 1, '2024-04-25', '2024-04-28', 1, 3, 2, 4, 'published', 2, 'Hasil pengukuran menunjukkan semua parameter dalam batas normal'); (1, 'LHU/KLIM/04/2024/001', 1, 1, '2024-04-25', '2024-04-28', 1, 3, 2, 4, 'published', 2, 'Hasil pengukuran menunjukkan semua parameter dalam batas normal');
-- Contoh Hasil Pengukuran Suhu -- Contoh Hasil Pengukuran Suhu
INSERT INTO hasil_pengukuran_suhu (hasil_id, laporan_id, lokasi_id, kode_sampel, waktu_pengukuran_mulai, waktu_pengukuran_selesai, parameter_id, hasil_pengukuran, satuan, metode, nab_id, keterangan, peralatan_id) VALUES INSERT INTO temperature_measurements (TemperatureMeasurementID, TestReportID, MasterSamplingLocationID, TemperatureMeasurementCode, TemperatureMeasurementStartTime, TemperatureMeasurementEndTime, MasterParameterID, TemperatureMeasurementValue, TemperatureMeasurementUnit, TemperatureMeasurementMethod, MasterThresholdID, TemperatureMeasurementRemarks, MasterEquipmentID) VALUES
(1, 1, 1, 'C2504090001', '09:00:00', '09:15:00', 1, 21.00, '°C', 'SNI 7062: 2019', 1, NULL, 1), (1, 1, 1, 'C2504090001', '09:00:00', '09:15:00', 1, 21.00, '°C', 'SNI 7062: 2019', 1, NULL, 1),
(2, 1, 2, 'C2504090002', '09:30:00', '09:45:00', 1, 22.00, '°C', 'SNI 7062: 2019', 1, NULL, 1), (2, 1, 2, 'C2504090002', '09:30:00', '09:45:00', 1, 22.00, '°C', 'SNI 7062: 2019', 1, NULL, 1),
(3, 1, 3, 'C2504090003', '10:00:00', '10:15:00', 1, 19.00, '°C', 'SNI 7062: 2019', 2, NULL, 1), (3, 1, 3, 'C2504090003', '10:00:00', '10:15:00', 1, 19.00, '°C', 'SNI 7062: 2019', 2, NULL, 1),

View File

@@ -5,107 +5,122 @@
-- Master Tables - ISBB Specific -- Master Tables - ISBB Specific
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Master Kategori Beban Kerja (Work Load Categories) -- Master Kategori Beban Kerja
CREATE TABLE IF NOT EXISTS master_kategori_beban_kerja ( CREATE TABLE IF NOT EXISTS master_workload_categories (
id_kategori INT PRIMARY KEY, MasterWorkloadCategoryID INT PRIMARY KEY,
nama_kategori VARCHAR(50) NOT NULL, MasterWorkloadCategoryName VARCHAR(50) NOT NULL,
keterangan TEXT, MasterWorkloadCategoryDescription TEXT,
kisaran_energi VARCHAR(50), MasterWorkloadCategoryEnergyRange VARCHAR(50),
contoh_aktivitas TEXT, MasterWorkloadCategoryActivityExamples TEXT,
status BOOLEAN DEFAULT TRUE, MasterWorkloadCategoryIsActive BOOLEAN DEFAULT TRUE,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterWorkloadCategoryCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50) MasterWorkloadCategoryCreatedUserID INT,
MasterWorkloadCategoryUpdatedAt DATETIME,
MasterWorkloadCategoryUpdatedUserID INT,
MasterWorkloadCategoryDeletedAt DATETIME,
MasterWorkloadCategoryDeletedUserID INT
); );
-- Master Alokasi Kerja-Istirahat (Work-Rest Allocation) -- Master Alokasi Kerja-Istirahat
CREATE TABLE IF NOT EXISTS master_alokasi_kerja_istirahat ( CREATE TABLE IF NOT EXISTS master_work_rest_allocations (
id_alokasi INT PRIMARY KEY, MasterWorkRestAllocationID INT PRIMARY KEY,
nama_alokasi VARCHAR(50) NOT NULL, MasterWorkRestAllocationName VARCHAR(50) NOT NULL,
persentase_kerja VARCHAR(20) NOT NULL, MasterWorkRestAllocationWorkPercentage VARCHAR(20) NOT NULL,
persentase_istirahat VARCHAR(20) NOT NULL, MasterWorkRestAllocationRestPercentage VARCHAR(20) NOT NULL,
keterangan TEXT, MasterWorkRestAllocationDescription TEXT,
status BOOLEAN DEFAULT TRUE, MasterWorkRestAllocationIsActive BOOLEAN DEFAULT TRUE,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterWorkRestAllocationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50) MasterWorkRestAllocationCreatedUserID INT,
MasterWorkRestAllocationUpdatedAt DATETIME,
MasterWorkRestAllocationUpdatedUserID INT,
MasterWorkRestAllocationDeletedAt DATETIME,
MasterWorkRestAllocationDeletedUserID INT
); );
-- Master Baku Mutu ISBB (WBGT Standard Values) -- Master Baku Mutu ISBB
CREATE TABLE IF NOT EXISTS master_bakumutu_isbb ( CREATE TABLE IF NOT EXISTS master_wbgt_standards (
id_bakumutu_isbb INT PRIMARY KEY, MasterWBGTStandardID INT PRIMARY KEY,
id_regulasi INT NOT NULL, MasterRegulationID INT NOT NULL,
id_kategori INT NOT NULL, MasterWorkloadCategoryID INT NOT NULL,
id_alokasi INT NOT NULL, MasterWorkRestAllocationID INT NOT NULL,
nilai_baku_mutu DECIMAL(5, 2) NOT NULL, MasterWBGTStandardValue DECIMAL(5,2) NOT NULL,
keterangan TEXT, MasterWBGTStandardDescription TEXT,
status BOOLEAN DEFAULT TRUE, MasterWBGTStandardIsActive BOOLEAN DEFAULT TRUE,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterWBGTStandardCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), MasterWBGTStandardCreatedUserID INT,
FOREIGN KEY (id_regulasi) REFERENCES master_regulasi(id_regulasi), MasterWBGTStandardUpdatedAt DATETIME,
FOREIGN KEY (id_kategori) REFERENCES master_kategori_beban_kerja(id_kategori), MasterWBGTStandardUpdatedUserID INT,
FOREIGN KEY (id_alokasi) REFERENCES master_alokasi_kerja_istirahat(id_alokasi) MasterWBGTStandardDeletedAt DATETIME,
MasterWBGTStandardDeletedUserID INT
); );
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Transaction Tables - ISBB Specific -- Transaction Tables - ISBB Specific
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Hasil Pengukuran ISBB (WBGT Measurement Results) -- Hasil Pengukuran ISBB
CREATE TABLE IF NOT EXISTS trx_hasil_ukur_isbb ( CREATE TABLE IF NOT EXISTS wbgt_measurements (
id_hasil_ukur_isbb INT PRIMARY KEY, WBGTMeasurementID INT PRIMARY KEY,
id_sampling_plan INT NOT NULL, ClimateSamplingPlanID INT NOT NULL,
kode_laporan VARCHAR(50) NOT NULL, WBGTMeasurementCode VARCHAR(50) NOT NULL,
tanggal_sampling DATE NOT NULL, WBGTMeasurementDate DATE NOT NULL,
waktu_mulai TIME, WBGTMeasurementStartTime TIME,
waktu_selesai TIME, WBGTMeasurementEndTime TIME,
kondisi_cuaca VARCHAR(100), WBGTMeasurementWeather VARCHAR(100),
petugas_sampling VARCHAR(100), WBGTMeasurementOfficer VARCHAR(100),
status_laporan VARCHAR(20) DEFAULT 'DRAFT', WBGTMeasurementStatus VARCHAR(20) DEFAULT 'DRAFT',
catatan TEXT, WBGTMeasurementNotes TEXT,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, WBGTMeasurementCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), WBGTMeasurementCreatedUserID INT,
FOREIGN KEY (id_sampling_plan) REFERENCES trx_sampling_plan_iklim(id_sampling_plan) WBGTMeasurementUpdatedAt DATETIME,
WBGTMeasurementUpdatedUserID INT,
WBGTMeasurementDeletedAt DATETIME,
WBGTMeasurementDeletedUserID INT
); );
-- Detail Hasil Pengukuran ISBB (WBGT Measurement Detail) -- Detail Hasil Pengukuran ISBB
CREATE TABLE IF NOT EXISTS trx_hasil_ukur_isbb_detail ( CREATE TABLE IF NOT EXISTS wbgt_measurement_details (
id_hasil_ukur_isbb_detail INT PRIMARY KEY, WBGTMeasurementDetailID INT PRIMARY KEY,
id_hasil_ukur_isbb INT NOT NULL, WBGTMeasurementID INT NOT NULL,
kode_titik VARCHAR(20) NOT NULL, WBGTMeasurementDetailPointCode VARCHAR(20) NOT NULL,
nama_lokasi VARCHAR(255) NOT NULL, WBGTMeasurementDetailLocation VARCHAR(255) NOT NULL,
jenis_pekerjaan VARCHAR(255) NOT NULL, WBGTMeasurementDetailWorkType VARCHAR(255) NOT NULL,
id_kategori INT NOT NULL, MasterWorkloadCategoryID INT NOT NULL,
id_alokasi INT NOT NULL, MasterWorkRestAllocationID INT NOT NULL,
suhu_basah DECIMAL(5, 2) NOT NULL, -- natural wet bulb (Tnw) WBGTMeasurementDetailWetTemp DECIMAL(5,2) NOT NULL,
suhu_bola DECIMAL(5, 2) NOT NULL, -- globe temperature (Tg) WBGTMeasurementDetailGlobeTemp DECIMAL(5,2) NOT NULL,
suhu_kering DECIMAL(5, 2) NOT NULL, -- dry bulb (Ta) WBGTMeasurementDetailDryTemp DECIMAL(5,2) NOT NULL,
nilai_isbb DECIMAL(5, 2) NOT NULL, -- calculated WBGT value WBGTMeasurementDetailWBGTValue DECIMAL(5,2) NOT NULL,
id_bakumutu_isbb INT NOT NULL, MasterWBGTStandardID INT NOT NULL,
status_kesesuaian VARCHAR(20), WBGTMeasurementDetailComplianceStatus VARCHAR(20),
rekomendasi TEXT, WBGTMeasurementDetailRecommendation TEXT,
lokasi_pengukuran VARCHAR(100), WBGTMeasurementDetailMeasurementLocation VARCHAR(100),
tinggi_pengukuran DECIMAL(4, 2), WBGTMeasurementDetailMeasurementHeight DECIMAL(4,2),
catatan TEXT, WBGTMeasurementDetailNotes TEXT,
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, WBGTMeasurementDetailCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), WBGTMeasurementDetailCreatedUserID INT,
FOREIGN KEY (id_hasil_ukur_isbb) REFERENCES trx_hasil_ukur_isbb(id_hasil_ukur_isbb), WBGTMeasurementDetailUpdatedAt DATETIME,
FOREIGN KEY (id_kategori) REFERENCES master_kategori_beban_kerja(id_kategori), WBGTMeasurementDetailUpdatedUserID INT,
FOREIGN KEY (id_alokasi) REFERENCES master_alokasi_kerja_istirahat(id_alokasi), WBGTMeasurementDetailDeletedAt DATETIME,
FOREIGN KEY (id_bakumutu_isbb) REFERENCES master_bakumutu_isbb(id_bakumutu_isbb) WBGTMeasurementDetailDeletedUserID INT
); );
-- Rekomendasi Pengendalian (Control Recommendations) -- Rekomendasi Pengendalian
CREATE TABLE IF NOT EXISTS trx_rekomendasi_pengendalian_isbb ( CREATE TABLE IF NOT EXISTS wbgt_control_recommendations (
id_rekomendasi INT PRIMARY KEY, WBGTControlRecommendationID INT PRIMARY KEY,
id_hasil_ukur_isbb_detail INT NOT NULL, WBGTMeasurementDetailID INT NOT NULL,
jenis_pengendalian VARCHAR(50) NOT NULL, WBGTControlRecommendationType VARCHAR(50) NOT NULL,
deskripsi_pengendalian TEXT NOT NULL, WBGTControlRecommendationDescription TEXT NOT NULL,
prioritas INT, WBGTControlRecommendationPriority INT,
estimasi_biaya DECIMAL(12, 2), WBGTControlRecommendationEstimatedCost DECIMAL(12,2),
perkiraan_efektivitas TEXT, WBGTControlRecommendationEffectiveness TEXT,
status_implementasi VARCHAR(20) DEFAULT 'PLANNED', WBGTControlRecommendationStatus VARCHAR(20) DEFAULT 'PLANNED',
tanggal_input TIMESTAMP DEFAULT CURRENT_TIMESTAMP, WBGTControlRecommendationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
user_input VARCHAR(50), WBGTControlRecommendationCreatedUserID INT,
FOREIGN KEY (id_hasil_ukur_isbb_detail) REFERENCES trx_hasil_ukur_isbb_detail(id_hasil_ukur_isbb_detail) WBGTControlRecommendationUpdatedAt DATETIME,
WBGTControlRecommendationUpdatedUserID INT,
WBGTControlRecommendationDeletedAt DATETIME,
WBGTControlRecommendationDeletedUserID INT
); );
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
@@ -113,40 +128,40 @@ CREATE TABLE IF NOT EXISTS trx_rekomendasi_pengendalian_isbb (
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Insert Data Master Kategori Beban Kerja -- Insert Data Master Kategori Beban Kerja
INSERT INTO master_kategori_beban_kerja (id_kategori, nama_kategori, keterangan, kisaran_energi, contoh_aktivitas, status, user_input) INSERT INTO master_workload_categories (MasterWorkloadCategoryID, MasterWorkloadCategoryName, MasterWorkloadCategoryDescription, MasterWorkloadCategoryEnergyRange, MasterWorkloadCategoryActivityExamples, MasterWorkloadCategoryIsActive, MasterWorkloadCategoryCreatedUserID)
VALUES VALUES
(1, 'Ringan', 'Beban kerja ringan dengan pengeluaran energi minimal', '100-200 Kcal/jam', 'Pekerjaan administratif, kontrol ruangan, pekerjaan perakitan ringan, mengemudi', TRUE, 'admin'), (1, 'Ringan', 'Beban kerja ringan dengan pengeluaran energi minimal', '100-200 Kcal/jam', 'Pekerjaan administratif, kontrol ruangan, pekerjaan perakitan ringan, mengemudi', TRUE, 1),
(2, 'Sedang', 'Beban kerja sedang dengan aktivitas fisik moderat', '200-350 Kcal/jam', 'Berjalan normal, mengangkat beban sedang, mendorong atau menarik, perakitan / perbaikan mesin', TRUE, 'admin'), (2, 'Sedang', 'Beban kerja sedang dengan aktivitas fisik moderat', '200-350 Kcal/jam', 'Berjalan normal, mengangkat beban sedang, mendorong atau menarik, perakitan / perbaikan mesin', TRUE, 1),
(3, 'Berat', 'Beban kerja berat dengan aktivitas fisik intens', '350-500 Kcal/jam', 'Berjalan cepat/naik tangga, mengangkat beban berat, pekerjaan konstruksi, penggalian, penambangan', TRUE, 'admin'); (3, 'Berat', 'Beban kerja berat dengan aktivitas fisik intens', '350-500 Kcal/jam', 'Berjalan cepat/naik tangga, mengangkat beban berat, pekerjaan konstruksi, penggalian, penambangan', TRUE, 1);
-- Insert Data Master Alokasi Kerja-Istirahat -- Insert Data Master Alokasi Kerja-Istirahat
INSERT INTO master_alokasi_kerja_istirahat (id_alokasi, nama_alokasi, persentase_kerja, persentase_istirahat, keterangan, status, user_input) INSERT INTO master_work_rest_allocations (MasterWorkRestAllocationID, MasterWorkRestAllocationName, MasterWorkRestAllocationWorkPercentage, MasterWorkRestAllocationRestPercentage, MasterWorkRestAllocationDescription, MasterWorkRestAllocationIsActive, MasterWorkRestAllocationCreatedUserID)
VALUES VALUES
(1, '75-100% Kerja', '75-100%', '0-25%', 'Alokasi 75-100% waktu untuk bekerja, 0-25% untuk istirahat dalam satu jam', TRUE, 'admin'), (1, '75-100% Kerja', '75-100%', '0-25%', 'Alokasi 75-100% waktu untuk bekerja, 0-25% untuk istirahat dalam satu jam', TRUE, 1),
(2, '50-75% Kerja', '50-75%', '25-50%', 'Alokasi 50-75% waktu untuk bekerja, 25-50% untuk istirahat dalam satu jam', TRUE, 'admin'), (2, '50-75% Kerja', '50-75%', '25-50%', 'Alokasi 50-75% waktu untuk bekerja, 25-50% untuk istirahat dalam satu jam', TRUE, 1),
(3, '25-50% Kerja', '25-50%', '50-75%', 'Alokasi 25-50% waktu untuk bekerja, 50-75% untuk istirahat dalam satu jam', TRUE, 'admin'), (3, '25-50% Kerja', '25-50%', '50-75%', 'Alokasi 25-50% waktu untuk bekerja, 50-75% untuk istirahat dalam satu jam', TRUE, 1),
(4, '0-25% Kerja', '0-25%', '75-100%', 'Alokasi 0-25% waktu untuk bekerja, 75-100% untuk istirahat dalam satu jam', TRUE, 'admin'); (4, '0-25% Kerja', '0-25%', '75-100%', 'Alokasi 0-25% waktu untuk bekerja, 75-100% untuk istirahat dalam satu jam', TRUE, 1);
-- Insert Data Master Baku Mutu ISBB -- Insert Data Master Baku Mutu ISBB
INSERT INTO master_bakumutu_isbb (id_bakumutu_isbb, id_regulasi, id_kategori, id_alokasi, nilai_baku_mutu, keterangan, status, user_input) INSERT INTO master_wbgt_standards (MasterWBGTStandardID, MasterRegulationID, MasterWorkloadCategoryID, MasterWorkRestAllocationID, MasterWBGTStandardValue, MasterWBGTStandardDescription, MasterWBGTStandardIsActive, MasterWBGTStandardCreatedUserID)
VALUES VALUES
-- Kategori Ringan -- Kategori Ringan
(1, 2, 1, 1, 31.0, 'Nilai ISBB maksimum untuk beban kerja ringan dengan alokasi kerja 75-100%', TRUE, 'admin'), (1, 2, 1, 1, 31.0, 'Nilai ISBB maksimum untuk beban kerja ringan dengan alokasi kerja 75-100%', TRUE, 1),
(2, 2, 1, 2, 31.0, 'Nilai ISBB maksimum untuk beban kerja ringan dengan alokasi kerja 50-75%', TRUE, 'admin'), (2, 2, 1, 2, 31.0, 'Nilai ISBB maksimum untuk beban kerja ringan dengan alokasi kerja 50-75%', TRUE, 1),
(3, 2, 1, 3, 32.0, 'Nilai ISBB maksimum untuk beban kerja ringan dengan alokasi kerja 25-50%', TRUE, 'admin'), (3, 2, 1, 3, 32.0, 'Nilai ISBB maksimum untuk beban kerja ringan dengan alokasi kerja 25-50%', TRUE, 1),
(4, 2, 1, 4, 32.2, 'Nilai ISBB maksimum untuk beban kerja ringan dengan alokasi kerja 0-25%', TRUE, 'admin'), (4, 2, 1, 4, 32.2, 'Nilai ISBB maksimum untuk beban kerja ringan dengan alokasi kerja 0-25%', TRUE, 1),
-- Kategori Sedang -- Kategori Sedang
(5, 2, 2, 1, 28.0, 'Nilai ISBB maksimum untuk beban kerja sedang dengan alokasi kerja 75-100%', TRUE, 'admin'), (5, 2, 2, 1, 28.0, 'Nilai ISBB maksimum untuk beban kerja sedang dengan alokasi kerja 75-100%', TRUE, 1),
(6, 2, 2, 2, 29.0, 'Nilai ISBB maksimum untuk beban kerja sedang dengan alokasi kerja 50-75%', TRUE, 'admin'), (6, 2, 2, 2, 29.0, 'Nilai ISBB maksimum untuk beban kerja sedang dengan alokasi kerja 50-75%', TRUE, 1),
(7, 2, 2, 3, 30.0, 'Nilai ISBB maksimum untuk beban kerja sedang dengan alokasi kerja 25-50%', TRUE, 'admin'), (7, 2, 2, 3, 30.0, 'Nilai ISBB maksimum untuk beban kerja sedang dengan alokasi kerja 25-50%', TRUE, 1),
(8, 2, 2, 4, 31.1, 'Nilai ISBB maksimum untuk beban kerja sedang dengan alokasi kerja 0-25%', TRUE, 'admin'), (8, 2, 2, 4, 31.1, 'Nilai ISBB maksimum untuk beban kerja sedang dengan alokasi kerja 0-25%', TRUE, 1),
-- Kategori Berat -- Kategori Berat
(9, 2, 3, 1, NULL, 'Untuk beban kerja berat tidak direkomendasikan alokasi kerja 75-100%', TRUE, 'admin'), (9, 2, 3, 1, NULL, 'Untuk beban kerja berat tidak direkomendasikan alokasi kerja 75-100%', TRUE, 1),
(10, 2, 3, 2, 27.5, 'Nilai ISBB maksimum untuk beban kerja berat dengan alokasi kerja 50-75%', TRUE, 'admin'), (10, 2, 3, 2, 27.5, 'Nilai ISBB maksimum untuk beban kerja berat dengan alokasi kerja 50-75%', TRUE, 1),
(11, 2, 3, 3, 29.0, 'Nilai ISBB maksimum untuk beban kerja berat dengan alokasi kerja 25-50%', TRUE, 'admin'), (11, 2, 3, 3, 29.0, 'Nilai ISBB maksimum untuk beban kerja berat dengan alokasi kerja 25-50%', TRUE, 1),
(12, 2, 3, 4, 30.0, 'Nilai ISBB maksimum untuk beban kerja berat dengan alokasi kerja 0-25%', TRUE, 'admin'); (12, 2, 3, 4, 30.0, 'Nilai ISBB maksimum untuk beban kerja berat dengan alokasi kerja 0-25%', TRUE, 1);
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Sample Data Insertion - Transaction Tables -- Sample Data Insertion - Transaction Tables
@@ -158,38 +173,38 @@ VALUES
(2, 'SP-ISBB-2024-001', 'Pengukuran ISBB di PT. Indonesia Steel Manufacturing', 102, '2024-05-12', 'PT. Indonesia Steel Manufacturing, Jl. Industri Baja No. 75, Cikarang, Bekasi', 5, 'APPROVED', 'Pengukuran ISBB untuk area furnace, casting, rolling mill, welding, dan control room', '2024-05-01 10:30:00', 'supervisor'); (2, 'SP-ISBB-2024-001', 'Pengukuran ISBB di PT. Indonesia Steel Manufacturing', 102, '2024-05-12', 'PT. Indonesia Steel Manufacturing, Jl. Industri Baja No. 75, Cikarang, Bekasi', 5, 'APPROVED', 'Pengukuran ISBB untuk area furnace, casting, rolling mill, welding, dan control room', '2024-05-01 10:30:00', 'supervisor');
-- Contoh Data Hasil Pengukuran ISBB -- Contoh Data Hasil Pengukuran ISBB
INSERT INTO trx_hasil_ukur_isbb (id_hasil_ukur_isbb, id_sampling_plan, kode_laporan, tanggal_sampling, waktu_mulai, waktu_selesai, kondisi_cuaca, petugas_sampling, status_laporan, catatan, tanggal_input, user_input) INSERT INTO wbgt_measurements (WBGTMeasurementID, ClimateSamplingPlanID, WBGTMeasurementCode, WBGTMeasurementDate, WBGTMeasurementStartTime, WBGTMeasurementEndTime, WBGTMeasurementWeather, WBGTMeasurementOfficer, WBGTMeasurementStatus, WBGTMeasurementNotes, WBGTMeasurementCreatedAt, WBGTMeasurementCreatedUserID)
VALUES VALUES
(1, 2, 'LHU/ISBB/05/2024/001', '2024-05-12', '10:00:00', '14:30:00', 'Cuaca cerah, suhu luar 33°C', 'Ahmad Kusuma, Budi Santoso', 'FINAL', 'Pengukuran berjalan dengan baik', '2024-05-12 16:45:00', 'analyst'); (1, 2, 'LHU/ISBB/05/2024/001', '2024-05-12', '10:00:00', '14:30:00', 'Cuaca cerah, suhu luar 33°C', 'Ahmad Kusuma, Budi Santoso', 'FINAL', 'Pengukuran berjalan dengan baik', '2024-05-12 16:45:00', 1);
-- Contoh Data Detail Hasil Pengukuran ISBB -- Contoh Data Detail Hasil Pengukuran ISBB
INSERT INTO trx_hasil_ukur_isbb_detail (id_hasil_ukur_isbb_detail, id_hasil_ukur_isbb, kode_titik, nama_lokasi, jenis_pekerjaan, id_kategori, id_alokasi, suhu_basah, suhu_bola, suhu_kering, nilai_isbb, id_bakumutu_isbb, status_kesesuaian, rekomendasi, lokasi_pengukuran, tinggi_pengukuran, catatan, tanggal_input, user_input) INSERT INTO wbgt_measurement_details (WBGTMeasurementDetailID, WBGTMeasurementID, WBGTMeasurementDetailPointCode, WBGTMeasurementDetailLocation, WBGTMeasurementDetailWorkType, MasterWorkloadCategoryID, MasterWorkRestAllocationID, WBGTMeasurementDetailWetTemp, WBGTMeasurementDetailGlobeTemp, WBGTMeasurementDetailDryTemp, WBGTMeasurementDetailWBGTValue, MasterWBGTStandardID, WBGTMeasurementDetailComplianceStatus, WBGTMeasurementDetailRecommendation, WBGTMeasurementDetailMeasurementLocation, WBGTMeasurementDetailMeasurementHeight, WBGTMeasurementDetailNotes, WBGTMeasurementDetailCreatedAt, WBGTMeasurementDetailCreatedUserID)
VALUES VALUES
-- Furnace Operation Area -- Furnace Operation Area
(1, 1, 'T1', 'Furnace Operation Area', 'Furnace monitoring and control', 2, 1, 27.8, 35.6, 32.5, 29.7, 5, 'NOT_COMPLY', 'Tingkatkan ventilasi, kurangi waktu paparan, atau ubah alokasi kerja', 'Dekat panel kontrol operator', 1.1, 'Pengukuran dilakukan saat furnace beroperasi normal', '2024-05-12 16:50:00', 'analyst'), (1, 1, 'T1', 'Furnace Operation Area', 'Furnace monitoring and control', 2, 1, 27.8, 35.6, 32.5, 29.7, 5, 'NOT_COMPLY', 'Tingkatkan ventilasi, kurangi waktu paparan, atau ubah alokasi kerja', 'Dekat panel kontrol operator', 1.1, 'Pengukuran dilakukan saat furnace beroperasi normal', '2024-05-12 16:50:00', 1),
-- Cold Rolling Mill -- Cold Rolling Mill
(2, 1, 'T2', 'Cold Rolling Mill', 'Machine operation and material handling', 2, 1, 25.2, 31.5, 30.1, 26.8, 5, 'COMPLY', '', 'Area operator mesin rolling', 1.1, 'Pengukuran dilakukan saat proses rolling berjalan normal', '2024-05-12 17:00:00', 'analyst'), (2, 1, 'T2', 'Cold Rolling Mill', 'Machine operation and material handling', 2, 1, 25.2, 31.5, 30.1, 26.8, 5, 'COMPLY', '', 'Area operator mesin rolling', 1.1, 'Pengukuran dilakukan saat proses rolling berjalan normal', '2024-05-12 17:00:00', 1),
-- Steel Casting Section -- Steel Casting Section
(3, 1, 'T3', 'Steel Casting Section', 'Heavy manual casting tasks', 3, 2, 28.4, 36.8, 33.2, 30.2, 10, 'NOT_COMPLY', 'Pasang pelindung panas tambahan, ubah alokasi kerja menjadi 25% kerja', 'Area penuangan logam', 1.1, 'Suhu sangat tinggi di sekitar area penuangan', '2024-05-12 17:15:00', 'analyst'), (3, 1, 'T3', 'Steel Casting Section', 'Heavy manual casting tasks', 3, 2, 28.4, 36.8, 33.2, 30.2, 10, 'NOT_COMPLY', 'Pasang pelindung panas tambahan, ubah alokasi kerja menjadi 25% kerja', 'Area penuangan logam', 1.1, 'Suhu sangat tinggi di sekitar area penuangan', '2024-05-12 17:15:00', 1),
-- Welding Section -- Welding Section
(4, 1, 'T4', 'Welding Section', 'Manual welding tasks', 2, 2, 24.6, 31.0, 29.5, 26.1, 6, 'COMPLY', '', 'Area pengelasan manual', 1.1, 'Pengukuran dilakukan pada jarak 1.5 meter dari titik pengelasan', '2024-05-12 17:30:00', 'analyst'), (4, 1, 'T4', 'Welding Section', 'Manual welding tasks', 2, 2, 24.6, 31.0, 29.5, 26.1, 6, 'COMPLY', '', 'Area pengelasan manual', 1.1, 'Pengukuran dilakukan pada jarak 1.5 meter dari titik pengelasan', '2024-05-12 17:30:00', 1),
-- Production Control Room -- Production Control Room
(5, 1, 'T5', 'Production Control Room', 'Monitoring and administrative tasks', 1, 1, 23.8, 29.2, 28.6, 25.2, 1, 'COMPLY', '', 'Ruang kontrol produksi', 1.1, 'Ruangan ber-AC, kondisi stabil', '2024-05-12 17:45:00', 'analyst'); (5, 1, 'T5', 'Production Control Room', 'Monitoring and administrative tasks', 1, 1, 23.8, 29.2, 28.6, 25.2, 1, 'COMPLY', '', 'Ruang kontrol produksi', 1.1, 'Ruangan ber-AC, kondisi stabil', '2024-05-12 17:45:00', 1);
-- Contoh Data Rekomendasi Pengendalian -- Contoh Data Rekomendasi Pengendalian
INSERT INTO trx_rekomendasi_pengendalian_isbb (id_rekomendasi, id_hasil_ukur_isbb_detail, jenis_pengendalian, deskripsi_pengendalian, prioritas, estimasi_biaya, perkiraan_efektivitas, status_implementasi, tanggal_input, user_input) INSERT INTO wbgt_control_recommendations (WBGTControlRecommendationID, WBGTMeasurementDetailID, WBGTControlRecommendationType, WBGTControlRecommendationDescription, WBGTControlRecommendationPriority, WBGTControlRecommendationEstimatedCost, WBGTControlRecommendationEffectiveness, WBGTControlRecommendationStatus, WBGTControlRecommendationCreatedAt, WBGTControlRecommendationCreatedUserID)
VALUES VALUES
-- Rekomendasi untuk Furnace Area -- Rekomendasi untuk Furnace Area
(1, 1, 'Pengendalian Teknik', 'Pemasangan local exhaust ventilation tambahan di area furnace', 1, 25000000.00, 'Diperkirakan dapat menurunkan ISBB 1.5-2°C', 'PLANNED', '2024-05-13 09:00:00', 'analyst'), (1, 1, 'Pengendalian Teknik', 'Pemasangan local exhaust ventilation tambahan di area furnace', 1, 25000000.00, 'Diperkirakan dapat menurunkan ISBB 1.5-2°C', 'PLANNED', '2024-05-13 09:00:00', 1),
(2, 1, 'Pengendalian Administratif', 'Mengubah alokasi kerja menjadi 50% kerja, 50% istirahat', 1, 0.00, 'Memenuhi baku mutu untuk kategori kerja sedang', 'PLANNED', '2024-05-13 09:05:00', 'analyst'), (2, 1, 'Pengendalian Administratif', 'Mengubah alokasi kerja menjadi 50% kerja, 50% istirahat', 1, 0.00, 'Memenuhi baku mutu untuk kategori kerja sedang', 'PLANNED', '2024-05-13 09:05:00', 1),
(3, 1, 'APD', 'Menyediakan cooling vest bagi operator furnace', 2, 5000000.00, 'Mengurangi beban panas pada pekerja', 'PLANNED', '2024-05-13 09:10:00', 'analyst'), (3, 1, 'APD', 'Menyediakan cooling vest bagi operator furnace', 2, 5000000.00, 'Mengurangi beban panas pada pekerja', 'PLANNED', '2024-05-13 09:10:00', 1),
-- Rekomendasi untuk Steel Casting Section -- Rekomendasi untuk Steel Casting Section
(4, 3, 'Pengendalian Teknik', 'Pemasangan heat shield tambahan di sekitar area penuangan', 1, 18000000.00, 'Diperkirakan dapat menurunkan ISBB 1-1.5°C', 'PLANNED', '2024-05-13 09:15:00', 'analyst'), (4, 3, 'Pengendalian Teknik', 'Pemasangan heat shield tambahan di sekitar area penuangan', 1, 18000000.00, 'Diperkirakan dapat menurunkan ISBB 1-1.5°C', 'PLANNED', '2024-05-13 09:15:00', 1),
(5, 3, 'Pengendalian Teknik', 'Pemasangan spot cooling di area kerja manual', 1, 12000000.00, 'Diperkirakan dapat menurunkan ISBB 1-2°C', 'PLANNED', '2024-05-13 09:20:00', 'analyst'), (5, 3, 'Pengendalian Teknik', 'Pemasangan spot cooling di area kerja manual', 1, 12000000.00, 'Diperkirakan dapat menurunkan ISBB 1-2°C', 'PLANNED', '2024-05-13 09:20:00', 1),
(6, 3, 'Pengendalian Administratif', 'Rotasi kerja dan mengubah alokasi menjadi 25% kerja, 75% istirahat', 1, 0.00, 'Memenuhi baku mutu untuk kategori kerja berat', 'PLANNED', '2024-05-13 09:25:00', 'analyst'), (6, 3, 'Pengendalian Administratif', 'Rotasi kerja dan mengubah alokasi menjadi 25% kerja, 75% istirahat', 1, 0.00, 'Memenuhi baku mutu untuk kategori kerja berat', 'PLANNED', '2024-05-13 09:25:00', 1),
(7, 3, 'APD', 'Menyediakan pakaian pelindung reflektif panas', 2, 7500000.00, 'Mengurangi beban panas radiasi pada pekerja', 'PLANNED', '2024-05-13 09:30:00', 'analyst'); (7, 3, 'APD', 'Menyediakan pakaian pelindung reflektif panas', 2, 7500000.00, 'Mengurangi beban panas radiasi pada pekerja', 'PLANNED', '2024-05-13 09:30:00', 1);

View File

@@ -7,60 +7,78 @@ USE lab_lingkungan;
-- Customers table (Internal and External) -- Customers table (Internal and External)
CREATE TABLE customers ( CREATE TABLE customers (
customer_id INT AUTO_INCREMENT PRIMARY KEY, CustomerID INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(100) NOT NULL, CustomerName VARCHAR(100) NOT NULL,
customer_type ENUM('Internal', 'External') NOT NULL, CustomerType ENUM('Internal', 'External') NOT NULL,
contact_person VARCHAR(100), CustomerContactPerson VARCHAR(100),
phone_number VARCHAR(20), CustomerPhoneNumber VARCHAR(20),
email VARCHAR(100), CustomerEmail VARCHAR(100),
address TEXT, CustomerAddress TEXT,
company_name VARCHAR(100), CustomerCompanyName VARCHAR(100),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, CustomerCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP CustomerCreatedUserID INT,
CustomerUpdatedAt DATETIME,
CustomerUpdatedUserID INT,
CustomerDeletedAt DATETIME,
CustomerDeletedUserID INT
); );
-- Sample Types table -- Sample Types table
CREATE TABLE sample_types ( CREATE TABLE sample_types (
sample_type_id INT AUTO_INCREMENT PRIMARY KEY, SampleTypeID INT AUTO_INCREMENT PRIMARY KEY,
type_name VARCHAR(100) NOT NULL, SampleTypeName VARCHAR(100) NOT NULL,
description TEXT, SampleTypeDescription TEXT,
standard_method TEXT, SampleTypeStandardMethod TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP SampleTypeIsActive BOOLEAN DEFAULT TRUE,
SampleTypeCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
SampleTypeCreatedUserID INT,
SampleTypeUpdatedAt DATETIME,
SampleTypeUpdatedUserID INT,
SampleTypeDeletedAt DATETIME,
SampleTypeDeletedUserID INT
); );
-- Analysis Parameters table -- Analysis Parameters table
CREATE TABLE analysis_parameters ( CREATE TABLE analysis_parameters (
parameter_id INT AUTO_INCREMENT PRIMARY KEY, AnalysisParameterID INT AUTO_INCREMENT PRIMARY KEY,
parameter_name VARCHAR(100) NOT NULL, AnalysisParameterName VARCHAR(100) NOT NULL,
unit VARCHAR(50), AnalysisParameterUnit VARCHAR(50),
method VARCHAR(100), AnalysisParameterMethod VARCHAR(100),
sample_type_id INT, SampleTypeID INT,
standard_value VARCHAR(100), AnalysisParameterStandardValue VARCHAR(100),
price DECIMAL(10, 2), AnalysisParameterPrice DECIMAL(10, 2),
FOREIGN KEY (sample_type_id) REFERENCES sample_types(sample_type_id), AnalysisParameterIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP AnalysisParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
AnalysisParameterCreatedUserID INT,
AnalysisParameterUpdatedAt DATETIME,
AnalysisParameterUpdatedUserID INT,
AnalysisParameterDeletedAt DATETIME,
AnalysisParameterDeletedUserID INT
); );
-- Service Requests table -- Service Requests table
CREATE TABLE service_requests ( CREATE TABLE service_requests (
request_id INT AUTO_INCREMENT PRIMARY KEY, ServiceRequestID INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT NOT NULL, CustomerID INT NOT NULL,
request_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ServiceRequestDate DATETIME DEFAULT CURRENT_TIMESTAMP,
request_type ENUM('Sampling and Analysis', 'Analysis Only') NOT NULL, ServiceRequestType ENUM('Sampling and Analysis', 'Analysis Only') NOT NULL,
project_name VARCHAR(200), ServiceRequestProjectName VARCHAR(200),
project_location TEXT, ServiceRequestProjectLocation TEXT,
status ENUM('Draft', 'Submitted', 'Quotation Sent', 'Approved', 'Rejected', 'Completed', 'Cancelled') DEFAULT 'Draft', ServiceRequestStatus ENUM('Draft', 'Submitted', 'Quotation Sent', 'Approved', 'Rejected', 'Completed', 'Cancelled') DEFAULT 'Draft',
admin_id INT, ServiceRequestAdminID INT,
quotation_number VARCHAR(50), ServiceRequestQuotationNumber VARCHAR(50),
quotation_date DATE, ServiceRequestQuotationDate DATE,
approved_date DATE, ServiceRequestApprovedDate DATE,
payment_proof VARCHAR(255), ServiceRequestPaymentProof VARCHAR(255),
payment_date DATE, ServiceRequestPaymentDate DATE,
total_amount DECIMAL(12, 2), ServiceRequestTotalAmount DECIMAL(12, 2),
notes TEXT, ServiceRequestNotes TEXT,
FOREIGN KEY (customer_id) REFERENCES customers(customer_id), ServiceRequestCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ServiceRequestCreatedUserID INT,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ServiceRequestUpdatedAt DATETIME,
ServiceRequestUpdatedUserID INT,
ServiceRequestDeletedAt DATETIME,
ServiceRequestDeletedUserID INT
); );
-- Request Parameters (mapping between requests and required parameters) -- Request Parameters (mapping between requests and required parameters)

View File

@@ -119,253 +119,265 @@ CREATE TABLE master_sampling_methods (
); );
CREATE TABLE master_preservation_methods ( CREATE TABLE master_preservation_methods (
preservation_id INT PRIMARY KEY AUTO_INCREMENT, MasterPreservationMethodID INT PRIMARY KEY AUTO_INCREMENT,
preservation_code VARCHAR(20) NOT NULL, MasterPreservationMethodCode VARCHAR(20) NOT NULL,
preservation_name VARCHAR(100) NOT NULL, MasterPreservationMethodName VARCHAR(100) NOT NULL,
chemical_used VARCHAR(100), MasterPreservationMethodChemicalUsed VARCHAR(100),
applicable_parameters TEXT, -- parameter yang menggunakan metode preservasi ini MasterPreservationMethodApplicableParameters TEXT,
procedure TEXT, MasterPreservationMethodProcedure TEXT,
storage_condition VARCHAR(100), MasterPreservationMethodStorageCondition VARCHAR(100),
holding_time VARCHAR(50), MasterPreservationMethodHoldingTime VARCHAR(50),
safety_precautions TEXT, MasterPreservationMethodSafetyPrecautions TEXT,
remarks TEXT, MasterPreservationMethodRemarks TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterPreservationMethodIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterPreservationMethodCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterPreservationMethodCreatedUserID INT,
MasterPreservationMethodUpdatedAt DATETIME,
MasterPreservationMethodUpdatedUserID INT,
MasterPreservationMethodDeletedAt DATETIME,
MasterPreservationMethodDeletedUserID INT
); );
CREATE TABLE master_sample_containers ( CREATE TABLE master_sample_containers (
container_id INT PRIMARY KEY AUTO_INCREMENT, MasterSampleContainerID INT PRIMARY KEY AUTO_INCREMENT,
container_code VARCHAR(20) NOT NULL, MasterSampleContainerCode VARCHAR(20) NOT NULL,
container_name VARCHAR(100) NOT NULL, MasterSampleContainerName VARCHAR(100) NOT NULL,
material VARCHAR(50), -- HDPE, glass, amber glass, dsb MasterSampleContainerMaterial VARCHAR(50),
capacity VARCHAR(20), -- misalnya: 250mL, 1L MasterSampleContainerCapacity VARCHAR(20),
cap_type VARCHAR(50), -- jenis tutup MasterSampleContainerCapType VARCHAR(50),
sterilization VARCHAR(50), -- metode sterilisasi jika perlu MasterSampleContainerSterilization VARCHAR(50),
applicable_parameters TEXT, -- parameter yang menggunakan wadah ini MasterSampleContainerApplicableParameters TEXT,
washing_procedure TEXT, -- prosedur pencucian wadah MasterSampleContainerWashingProcedure TEXT,
storage_requirements TEXT, MasterSampleContainerStorageRequirements TEXT,
remarks TEXT, MasterSampleContainerRemarks TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterSampleContainerIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterSampleContainerCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterSampleContainerCreatedUserID INT,
MasterSampleContainerUpdatedAt DATETIME,
MasterSampleContainerUpdatedUserID INT,
MasterSampleContainerDeletedAt DATETIME,
MasterSampleContainerDeletedUserID INT
); );
CREATE TABLE master_regulations ( CREATE TABLE master_regulations (
regulation_id INT PRIMARY KEY AUTO_INCREMENT, MasterRegulationID INT PRIMARY KEY AUTO_INCREMENT,
regulation_code VARCHAR(20) NOT NULL, MasterRegulationCode VARCHAR(20) NOT NULL,
regulation_name VARCHAR(200) NOT NULL, MasterRegulationName VARCHAR(200) NOT NULL,
issuing_authority VARCHAR(100), -- instansi yang mengeluarkan regulasi MasterRegulationIssuingAuthority VARCHAR(100),
regulation_type VARCHAR(50), -- Peraturan Menteri, Peraturan Pemerintah, dsb MasterRegulationType VARCHAR(50),
issue_date DATE, MasterRegulationIssueDate DATE,
effective_date DATE, MasterRegulationEffectiveDate DATE,
applicable_sector VARCHAR(100), -- sektor yang diregulasi MasterRegulationApplicableSector VARCHAR(100),
scope TEXT, MasterRegulationScope TEXT,
summary TEXT, MasterRegulationSummary TEXT,
file_path VARCHAR(255), -- path ke file dokumen regulasi MasterRegulationFilePath VARCHAR(255),
remarks TEXT, MasterRegulationRemarks TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterRegulationIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterRegulationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterRegulationCreatedUserID INT,
MasterRegulationUpdatedAt DATETIME,
MasterRegulationUpdatedUserID INT,
MasterRegulationDeletedAt DATETIME,
MasterRegulationDeletedUserID INT
); );
CREATE TABLE master_quality_standards ( CREATE TABLE master_quality_standards (
standard_id INT PRIMARY KEY AUTO_INCREMENT, MasterQualityStandardID INT PRIMARY KEY AUTO_INCREMENT,
standard_code VARCHAR(20) NOT NULL, MasterQualityStandardCode VARCHAR(20) NOT NULL,
standard_name VARCHAR(200) NOT NULL, MasterQualityStandardName VARCHAR(200) NOT NULL,
regulation_id INT, MasterRegulationID INT,
matrix_type VARCHAR(50), -- air limbah, air sungai, air tanah, dsb MasterQualityStandardMatrixType VARCHAR(50),
industry_type VARCHAR(100), -- tipe industri (jika spesifik) MasterQualityStandardIndustryType VARCHAR(100),
parameter_id INT, MasterParameterID INT,
min_value DECIMAL(12, 6), MasterQualityStandardMinValue DECIMAL(12,6),
max_value DECIMAL(12, 6), MasterQualityStandardMaxValue DECIMAL(12,6),
unit VARCHAR(20), MasterQualityStandardUnit VARCHAR(20),
remarks TEXT, MasterQualityStandardRemarks TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterQualityStandardIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterQualityStandardCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MasterQualityStandardCreatedUserID INT,
FOREIGN KEY (regulation_id) REFERENCES master_regulations(regulation_id), MasterQualityStandardUpdatedAt DATETIME,
FOREIGN KEY (parameter_id) REFERENCES master_parameters(parameter_id) MasterQualityStandardUpdatedUserID INT,
MasterQualityStandardDeletedAt DATETIME,
MasterQualityStandardDeletedUserID INT
); );
CREATE TABLE parameter_method_mapping ( CREATE TABLE parameter_method_mapping (
mapping_id INT PRIMARY KEY AUTO_INCREMENT, ParameterMethodMappingID INT PRIMARY KEY AUTO_INCREMENT,
parameter_id INT, MasterParameterID INT,
method_id INT, MasterSamplingMethodID INT,
container_id INT, MasterSampleContainerID INT,
preservation_id INT, MasterPreservationMethodID INT,
is_default BOOLEAN DEFAULT FALSE, -- metode default untuk parameter ParameterMethodMappingIsDefault BOOLEAN DEFAULT FALSE,
remarks TEXT, ParameterMethodMappingRemarks TEXT,
is_active BOOLEAN DEFAULT TRUE, ParameterMethodMappingIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ParameterMethodMappingCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ParameterMethodMappingCreatedUserID INT,
FOREIGN KEY (parameter_id) REFERENCES master_parameters(parameter_id), ParameterMethodMappingUpdatedAt DATETIME,
FOREIGN KEY (method_id) REFERENCES master_sampling_methods(method_id), ParameterMethodMappingUpdatedUserID INT,
FOREIGN KEY (container_id) REFERENCES master_sample_containers(container_id), ParameterMethodMappingDeletedAt DATETIME,
FOREIGN KEY (preservation_id) REFERENCES master_preservation_methods(preservation_id) ParameterMethodMappingDeletedUserID INT
); );
CREATE TABLE sampling_plans ( CREATE TABLE sampling_plans (
plan_id INT PRIMARY KEY AUTO_INCREMENT, SamplingPlanID INT PRIMARY KEY AUTO_INCREMENT,
plan_code VARCHAR(30) NOT NULL, SamplingPlanCode VARCHAR(30) NOT NULL,
project_name VARCHAR(200) NOT NULL, SamplingPlanProjectName VARCHAR(200) NOT NULL,
client_id INT, MasterClientID INT,
contact_person_id INT, SamplingPlanContactPersonID INT,
request_date DATETIME, SamplingPlanRequestDate DATETIME,
planned_sampling_date DATE, SamplingPlanPlannedDate DATE,
status VARCHAR(20), -- draft, submitted, approved, completed, cancelled SamplingPlanStatus VARCHAR(20),
created_by INT, SamplingPlanCreatedBy INT,
approved_by INT, SamplingPlanApprovedBy INT,
approval_date DATETIME, SamplingPlanApprovalDate DATETIME,
total_locations INT, SamplingPlanTotalLocations INT,
total_parameters INT, SamplingPlanTotalParameters INT,
remarks TEXT, SamplingPlanRemarks TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, SamplingPlanCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, SamplingPlanCreatedUserID INT,
FOREIGN KEY (client_id) REFERENCES master_clients(client_id), SamplingPlanUpdatedAt DATETIME,
FOREIGN KEY (created_by) REFERENCES master_personnel(personnel_id), SamplingPlanUpdatedUserID INT,
FOREIGN KEY (approved_by) REFERENCES master_personnel(personnel_id) SamplingPlanDeletedAt DATETIME,
SamplingPlanDeletedUserID INT
); );
CREATE TABLE sampling_plan_locations ( CREATE TABLE sampling_plan_locations (
plan_location_id INT PRIMARY KEY AUTO_INCREMENT, SamplingPlanLocationID INT PRIMARY KEY AUTO_INCREMENT,
plan_id INT, SamplingPlanID INT,
location_id INT, MasterSamplingLocationID INT,
sampling_date DATE, SamplingPlanLocationDate DATE,
sampling_time TIME, SamplingPlanLocationTime TIME,
sampling_method_id INT, MasterSamplingMethodID INT,
sampling_personnel_id INT, SamplingPlanLocationPersonnelID INT,
field_parameters TEXT, -- parameter yang diukur di lapangan SamplingPlanLocationFieldParameters TEXT,
special_instructions TEXT, SamplingPlanLocationSpecialInstructions TEXT,
status VARCHAR(20), -- planned, sampled, failed SamplingPlanLocationStatus VARCHAR(20),
remarks TEXT, SamplingPlanLocationRemarks TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, SamplingPlanLocationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, SamplingPlanLocationCreatedUserID INT,
FOREIGN KEY (plan_id) REFERENCES sampling_plans(plan_id), SamplingPlanLocationUpdatedAt DATETIME,
FOREIGN KEY (location_id) REFERENCES master_sampling_locations(location_id), SamplingPlanLocationUpdatedUserID INT,
FOREIGN KEY (sampling_method_id) REFERENCES master_sampling_methods(method_id), SamplingPlanLocationDeletedAt DATETIME,
FOREIGN KEY (sampling_personnel_id) REFERENCES master_personnel(personnel_id) SamplingPlanLocationDeletedUserID INT
); );
CREATE TABLE sampling_plan_parameters ( CREATE TABLE sampling_plan_parameters (
plan_parameter_id INT PRIMARY KEY AUTO_INCREMENT, SamplingPlanParameterID INT PRIMARY KEY AUTO_INCREMENT,
plan_id INT, SamplingPlanID INT,
plan_location_id INT, SamplingPlanLocationID INT,
parameter_id INT, MasterParameterID INT,
container_id INT, MasterSampleContainerID INT,
preservation_id INT, MasterPreservationMethodID INT,
quantity INT DEFAULT 1, SamplingPlanParameterQuantity INT DEFAULT 1,
unit_price DECIMAL(12, 2), SamplingPlanParameterUnitPrice DECIMAL(12,2),
remarks TEXT, SamplingPlanParameterRemarks TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, SamplingPlanParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, SamplingPlanParameterCreatedUserID INT,
FOREIGN KEY (plan_id) REFERENCES sampling_plans(plan_id), SamplingPlanParameterUpdatedAt DATETIME,
FOREIGN KEY (plan_location_id) REFERENCES sampling_plan_locations(plan_location_id), SamplingPlanParameterUpdatedUserID INT,
FOREIGN KEY (parameter_id) REFERENCES master_parameters(parameter_id), SamplingPlanParameterDeletedAt DATETIME,
FOREIGN KEY (container_id) REFERENCES master_sample_containers(container_id), SamplingPlanParameterDeletedUserID INT
FOREIGN KEY (preservation_id) REFERENCES master_preservation_methods(preservation_id)
); );
CREATE TABLE equipment_requisitions ( CREATE TABLE equipment_requisitions (
requisition_id INT PRIMARY KEY AUTO_INCREMENT, EquipmentRequisitionID INT PRIMARY KEY AUTO_INCREMENT,
requisition_code VARCHAR(30) NOT NULL, EquipmentRequisitionCode VARCHAR(30) NOT NULL,
plan_id INT, SamplingPlanID INT,
requisition_date DATETIME, EquipmentRequisitionDate DATETIME,
requested_by INT, EquipmentRequisitionRequestedBy INT,
approved_by INT, EquipmentRequisitionApprovedBy INT,
approval_date DATETIME, EquipmentRequisitionApprovalDate DATETIME,
sampling_date DATE, EquipmentRequisitionSamplingDate DATE,
return_date DATE, EquipmentRequisitionReturnDate DATE,
status VARCHAR(20), -- draft, submitted, approved, issued, returned EquipmentRequisitionStatus VARCHAR(20),
remarks TEXT, EquipmentRequisitionRemarks TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, EquipmentRequisitionCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, EquipmentRequisitionCreatedUserID INT,
FOREIGN KEY (plan_id) REFERENCES sampling_plans(plan_id), EquipmentRequisitionUpdatedAt DATETIME,
FOREIGN KEY (requested_by) REFERENCES master_personnel(personnel_id), EquipmentRequisitionUpdatedUserID INT,
FOREIGN KEY (approved_by) REFERENCES master_personnel(personnel_id) EquipmentRequisitionDeletedAt DATETIME,
EquipmentRequisitionDeletedUserID INT
); );
CREATE TABLE equipment_requisition_items ( CREATE TABLE equipment_requisition_items (
requisition_item_id INT PRIMARY KEY AUTO_INCREMENT, EquipmentRequisitionItemID INT PRIMARY KEY AUTO_INCREMENT,
requisition_id INT, EquipmentRequisitionID INT,
equipment_id INT, MasterEquipmentID INT,
quantity INT, EquipmentRequisitionItemQuantity INT,
issued_quantity INT, EquipmentRequisitionItemIssuedQuantity INT,
issued_by INT, EquipmentRequisitionItemIssuedBy INT,
issued_date DATETIME, EquipmentRequisitionItemIssuedDate DATETIME,
returned_quantity INT, EquipmentRequisitionItemReturnedQuantity INT,
returned_condition VARCHAR(50), -- good, damaged, lost EquipmentRequisitionItemReturnedCondition VARCHAR(50),
returned_date DATETIME, EquipmentRequisitionItemReturnedDate DATETIME,
verified_by INT, EquipmentRequisitionItemVerifiedBy INT,
remarks TEXT, EquipmentRequisitionItemRemarks TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, EquipmentRequisitionItemCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, EquipmentRequisitionItemCreatedUserID INT,
FOREIGN KEY (requisition_id) REFERENCES equipment_requisitions(requisition_id), EquipmentRequisitionItemUpdatedAt DATETIME,
FOREIGN KEY (equipment_id) REFERENCES master_equipment(equipment_id), EquipmentRequisitionItemUpdatedUserID INT,
FOREIGN KEY (issued_by) REFERENCES master_personnel(personnel_id), EquipmentRequisitionItemDeletedAt DATETIME,
FOREIGN KEY (verified_by) REFERENCES master_personnel(personnel_id) EquipmentRequisitionItemDeletedUserID INT
); );
CREATE TABLE samples ( CREATE TABLE samples (
sample_id INT PRIMARY KEY AUTO_INCREMENT, SampleID INT PRIMARY KEY AUTO_INCREMENT,
sample_code VARCHAR(50) NOT NULL, SampleCode VARCHAR(50) NOT NULL,
plan_id INT, SamplingPlanID INT,
plan_location_id INT, SamplingPlanLocationID INT,
sampling_date DATE, SampleDate DATE,
sampling_time TIME, SampleTime TIME,
sampler_id INT, SampleSamplerID INT,
preservation_time DATETIME, SamplePreservationTime DATETIME,
temperature DECIMAL(5, 2), -- suhu sampel saat pengambilan SampleTemperature DECIMAL(5,2),
weather_condition VARCHAR(50), SampleWeatherCondition VARCHAR(50),
field_ph DECIMAL(5, 2), SampleFieldPH DECIMAL(5,2),
field_do DECIMAL(5, 2), SampleFieldDO DECIMAL(5,2),
field_conductivity DECIMAL(10, 2), SampleFieldConductivity DECIMAL(10,2),
field_turbidity DECIMAL(10, 2), SampleFieldTurbidity DECIMAL(10,2),
sample_matrix VARCHAR(50), -- air, tanah, sedimen, dsb SampleMatrix VARCHAR(50),
sample_source VARCHAR(100), SampleSource VARCHAR(100),
container_id INT, MasterSampleContainerID INT,
preservation_id INT, MasterPreservationMethodID INT,
received_by INT, SampleReceivedBy INT,
received_date DATETIME, SampleReceivedDate DATETIME,
received_condition VARCHAR(50), -- good, compromised, rejected SampleReceivedCondition VARCHAR(50),
storage_location VARCHAR(100), SampleStorageLocation VARCHAR(100),
remarks TEXT, SampleRemarks TEXT,
status VARCHAR(20), -- collected, in transit, received, in analysis, reported SampleStatus VARCHAR(20),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, SampleCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, SampleCreatedUserID INT,
FOREIGN KEY (plan_id) REFERENCES sampling_plans(plan_id), SampleUpdatedAt DATETIME,
FOREIGN KEY (plan_location_id) REFERENCES sampling_plan_locations(plan_location_id), SampleUpdatedUserID INT,
FOREIGN KEY (sampler_id) REFERENCES master_personnel(personnel_id), SampleDeletedAt DATETIME,
FOREIGN KEY (container_id) REFERENCES master_sample_containers(container_id), SampleDeletedUserID INT
FOREIGN KEY (preservation_id) REFERENCES master_preservation_methods(preservation_id),
FOREIGN KEY (received_by) REFERENCES master_personnel(personnel_id)
); );
CREATE TABLE measurement_results_light ( CREATE TABLE measurement_results_light (
result_id INT PRIMARY KEY AUTO_INCREMENT, MeasurementResultLightID INT PRIMARY KEY AUTO_INCREMENT,
sample_id INT, SampleID INT,
measurement_date DATE, MeasurementResultLightDate DATE,
measurement_time TIME, MeasurementResultLightTime TIME,
parameter_id INT, MasterParameterID INT,
measurement_value DECIMAL(10, 2), MeasurementResultLightValue DECIMAL(10,2),
measurement_unit VARCHAR(20), MeasurementResultLightUnit VARCHAR(20),
measurement_point VARCHAR(50), MeasurementResultLightPoint VARCHAR(50),
weather_condition VARCHAR(50), MeasurementResultLightWeatherCondition VARCHAR(50),
light_source VARCHAR(100), MeasurementResultLightSource VARCHAR(100),
ambient_condition VARCHAR(200), MeasurementResultLightAmbientCondition VARCHAR(200),
standard_id INT, MasterQualityStandardID INT,
is_compliant BOOLEAN, MeasurementResultLightIsCompliant BOOLEAN,
analyst_id INT, MeasurementResultLightAnalystID INT,
verified_by INT, MeasurementResultLightVerifiedBy INT,
verification_date DATETIME, MeasurementResultLightVerificationDate DATETIME,
remarks TEXT, MeasurementResultLightRemarks TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MeasurementResultLightCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MeasurementResultLightCreatedUserID INT,
FOREIGN KEY (sample_id) REFERENCES samples(sample_id), MeasurementResultLightUpdatedAt DATETIME,
FOREIGN KEY (parameter_id) REFERENCES master_parameters(parameter_id), MeasurementResultLightUpdatedUserID INT,
FOREIGN KEY (standard_id) REFERENCES master_quality_standards(standard_id), MeasurementResultLightDeletedAt DATETIME,
FOREIGN KEY (analyst_id) REFERENCES master_personnel(personnel_id), MeasurementResultLightDeletedUserID INT
FOREIGN KEY (verified_by) REFERENCES master_personnel(personnel_id)
); );
INSERT INTO master_parameters (parameter_id, parameter_code, parameter_name, parameter_group, standard_method, unit, price, instrumentation, mdl, container_type, preservation, holding_time, remarks, is_active) VALUES INSERT INTO master_parameters (parameter_id, parameter_code, parameter_name, parameter_group, standard_method, unit, price, instrumentation, mdl, container_type, preservation, holding_time, remarks, is_active) VALUES

View File

@@ -7,60 +7,56 @@
-- Master Area Types -- Master Area Types
CREATE TABLE IF NOT EXISTS master_area_types ( CREATE TABLE IF NOT EXISTS master_area_types (
area_type_id INT PRIMARY KEY, MasterAreaTypeID INT PRIMARY KEY,
area_type_name VARCHAR(100) NOT NULL, MasterAreaTypeName VARCHAR(100) NOT NULL,
description TEXT, MasterAreaTypeDescription TEXT,
status BOOLEAN DEFAULT TRUE, MasterAreaTypeIsActive BOOLEAN DEFAULT TRUE,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterAreaTypeCreatedUserID INT
input_user VARCHAR(50)
); );
-- Master Noise Quality Standards -- Master Noise Quality Standards
CREATE TABLE IF NOT EXISTS master_noise_standards ( CREATE TABLE IF NOT EXISTS master_noise_standards (
standard_id INT PRIMARY KEY, MasterNoiseStandardID INT PRIMARY KEY,
regulation_id INT NOT NULL, MasterRegulationID INT NOT NULL,
area_type_id INT NOT NULL, MasterAreaTypeID INT NOT NULL,
standard_value DECIMAL(5, 1) NOT NULL, MasterNoiseStandardValue DECIMAL(5, 1) NOT NULL,
unit VARCHAR(10) DEFAULT 'dB(A)', MasterNoiseStandardUnit VARCHAR(10) DEFAULT 'dB(A)',
measurement_time VARCHAR(50), MasterNoiseStandardMeasurementTime VARCHAR(50),
description TEXT, MasterNoiseStandardDescription TEXT,
status BOOLEAN DEFAULT TRUE, MasterNoiseStandardIsActive BOOLEAN DEFAULT TRUE,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterNoiseStandardCreatedUserID INT,
input_user VARCHAR(50), FOREIGN KEY (MasterRegulationID) REFERENCES master_regulations(regulation_id),
FOREIGN KEY (regulation_id) REFERENCES master_regulations(regulation_id), FOREIGN KEY (MasterAreaTypeID) REFERENCES master_area_types(MasterAreaTypeID)
FOREIGN KEY (area_type_id) REFERENCES master_area_types(area_type_id)
); );
-- Master Noise Measurement Methods -- Master Noise Measurement Methods
CREATE TABLE IF NOT EXISTS master_noise_methods ( CREATE TABLE IF NOT EXISTS master_noise_methods (
method_id INT PRIMARY KEY, MasterNoiseMethodID INT PRIMARY KEY,
method_code VARCHAR(50) NOT NULL, MasterNoiseMethodCode VARCHAR(50) NOT NULL,
method_name VARCHAR(255) NOT NULL, MasterNoiseMethodName VARCHAR(255) NOT NULL,
description TEXT, MasterNoiseMethodDescription TEXT,
standard_reference VARCHAR(100), MasterNoiseMethodStandardReference VARCHAR(100),
status BOOLEAN DEFAULT TRUE, MasterNoiseMethodIsActive BOOLEAN DEFAULT TRUE,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterNoiseMethodCreatedUserID INT
input_user VARCHAR(50)
); );
-- Master Noise Measurement Equipment -- Master Noise Measurement Equipment
CREATE TABLE IF NOT EXISTS master_noise_equipment ( CREATE TABLE IF NOT EXISTS master_noise_equipment (
equipment_id INT PRIMARY KEY, MasterNoiseEquipmentID INT PRIMARY KEY,
equipment_code VARCHAR(20) NOT NULL, MasterNoiseEquipmentCode VARCHAR(20) NOT NULL,
equipment_name VARCHAR(100) NOT NULL, MasterNoiseEquipmentName VARCHAR(100) NOT NULL,
equipment_type VARCHAR(50), MasterNoiseEquipmentType VARCHAR(50),
brand VARCHAR(100), MasterNoiseEquipmentBrand VARCHAR(100),
model VARCHAR(100), MasterNoiseEquipmentModel VARCHAR(100),
serial_number VARCHAR(100), MasterNoiseEquipmentSerialNumber VARCHAR(100),
accuracy_type VARCHAR(20), -- Type 0, 1, 2 for SLM MasterNoiseEquipmentAccuracyType VARCHAR(20), -- Type 0, 1, 2 for SLM
specifications TEXT, MasterNoiseEquipmentSpecifications TEXT,
calibration_date DATE, MasterNoiseEquipmentCalibrationDate DATE,
next_calibration_date DATE, MasterNoiseEquipmentNextCalibrationDate DATE,
calibration_status VARCHAR(20), MasterNoiseEquipmentCalibrationStatus VARCHAR(20),
certificate_file VARCHAR(255), MasterNoiseEquipmentCertificateFile VARCHAR(255),
status BOOLEAN DEFAULT TRUE, MasterNoiseEquipmentIsActive BOOLEAN DEFAULT TRUE,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterNoiseEquipmentCreatedUserID INT
input_user VARCHAR(50)
); );
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
@@ -130,10 +126,10 @@ CREATE TABLE IF NOT EXISTS trx_noise_measurement_details (
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50), input_user VARCHAR(50),
FOREIGN KEY (measurement_id) REFERENCES trx_noise_measurement_results(measurement_id), FOREIGN KEY (measurement_id) REFERENCES trx_noise_measurement_results(measurement_id),
FOREIGN KEY (area_type_id) REFERENCES master_area_types(area_type_id), FOREIGN KEY (area_type_id) REFERENCES master_area_types(MasterAreaTypeID),
FOREIGN KEY (method_id) REFERENCES master_noise_methods(method_id), FOREIGN KEY (method_id) REFERENCES master_noise_methods(MasterNoiseMethodID),
FOREIGN KEY (equipment_id) REFERENCES master_noise_equipment(equipment_id), FOREIGN KEY (equipment_id) REFERENCES master_noise_equipment(MasterNoiseEquipmentID),
FOREIGN KEY (standard_id) REFERENCES master_noise_standards(standard_id) FOREIGN KEY (standard_id) REFERENCES master_noise_standards(MasterNoiseStandardID)
); );
-- Noise Control Recommendations -- Noise Control Recommendations
@@ -156,40 +152,57 @@ CREATE TABLE IF NOT EXISTS trx_noise_control_recommendations (
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Insert Data Master Area Types -- Insert Data Master Area Types
INSERT INTO master_area_types (area_type_id, area_type_name, description, status, input_user) INSERT INTO master_area_types (
VALUES MasterAreaTypeID, MasterAreaTypeName, MasterAreaTypeDescription,
(1, 'Residential Areas', 'Residential housing and settlements', TRUE, 'admin'), MasterAreaTypeIsActive, MasterAreaTypeCreatedUserID
(2, 'Commercial and Trade Areas', 'Commercial and service areas, including offices', TRUE, 'admin'), ) VALUES
(3, 'Office and Commercial Areas', 'Office and commercial areas', TRUE, 'admin'), (1, 'Residential Areas', 'Residential housing and settlements',
(4, 'Industrial Areas', 'Manufacturing industrial areas', TRUE, 'admin'), TRUE, 1),
(5, 'Hospitals and Healthcare Facilities', 'Hospitals, health centers, and other healthcare facilities', TRUE, 'admin'), (2, 'Commercial and Trade Areas', 'Commercial and service areas, including offices',
(6, 'Schools and Educational Facilities', 'Educational areas including schools, madrasas, colleges', TRUE, 'admin'), TRUE, 1),
(7, 'Places of Worship', 'Worship areas such as mosques, churches, temples, and other religious buildings', TRUE, 'admin'); (3, 'Office and Commercial Areas', 'Office and commercial areas',
TRUE, 1);
-- Insert Data Master Noise Standards -- Insert Data Master Noise Standards
INSERT INTO master_noise_standards (standard_id, regulation_id, area_type_id, standard_value, unit, measurement_time, description, status, input_user) INSERT INTO master_noise_standards (
VALUES MasterNoiseStandardID, MasterRegulationID, MasterAreaTypeID,
(1, 1, 1, 55.0, 'dB(A)', 'Leq 24 hours', 'Noise quality standard for residential areas', TRUE, 'admin'), MasterNoiseStandardValue, MasterNoiseStandardUnit,
(2, 1, 2, 70.0, 'dB(A)', 'Leq 24 hours', 'Noise quality standard for commercial and trade areas', TRUE, 'admin'), MasterNoiseStandardMeasurementTime, MasterNoiseStandardDescription,
(3, 1, 3, 65.0, 'dB(A)', 'Leq 24 hours', 'Noise quality standard for office and commercial areas', TRUE, 'admin'), MasterNoiseStandardIsActive, MasterNoiseStandardCreatedUserID
(4, 1, 4, 70.0, 'dB(A)', 'Leq 24 hours', 'Noise quality standard for industrial areas', TRUE, 'admin'), ) VALUES
(5, 1, 5, 55.0, 'dB(A)', 'Leq 24 hours', 'Noise quality standard for hospitals and healthcare facilities', TRUE, 'admin'), (1, 1, 1, 55.0, 'dB(A)', 'Leq 24 hours',
(6, 1, 6, 55.0, 'dB(A)', 'Leq during school hours', 'Noise quality standard for schools and educational facilities', TRUE, 'admin'), 'Noise quality standard for residential areas', TRUE, 1),
(7, 1, 7, 55.0, 'dB(A)', 'Leq during worship times', 'Noise quality standard for places of worship', TRUE, 'admin'); (2, 1, 2, 70.0, 'dB(A)', 'Leq 24 hours',
'Noise quality standard for commercial and trade areas', TRUE, 1);
-- Insert Data Master Noise Measurement Methods -- Insert Data Master Noise Measurement Methods
INSERT INTO master_noise_methods (method_id, method_code, method_name, description, standard_reference, status, input_user) INSERT INTO master_noise_methods (
VALUES MasterNoiseMethodID, MasterNoiseMethodCode, MasterNoiseMethodName,
(1, 'SNI-7231-2009', 'SNI 7231:2009 - Environmental Noise Measurement Method', 'Method for measuring environmental noise levels using Sound Level Meter', 'SNI 7231:2009', TRUE, 'admin'), MasterNoiseMethodDescription, MasterNoiseMethodStandardReference,
(2, 'KEPMEN-LH-48-1996', 'Ministry of Environment Decree No. 48 of 1996 - Appendix II', 'Noise level measurement method based on the Ministry of Environment Decree', 'Ministry of Environment Decree No.48 of 1996', TRUE, 'admin'); MasterNoiseMethodIsActive, MasterNoiseMethodCreatedUserID
) VALUES
(1, 'SNI-7231-2009', 'SNI 7231:2009 - Environmental Noise Measurement Method',
'Method for measuring environmental noise levels using Sound Level Meter',
'SNI 7231:2009', TRUE, 1),
(2, 'KEPMEN-LH-48-1996', 'Ministry of Environment Decree No. 48 of 1996 - Appendix II',
'Noise level measurement method based on the Ministry of Environment Decree',
'Ministry of Environment Decree No.48 of 1996', TRUE, 1);
-- Insert Data Master Noise Measurement Equipment -- Insert Data Master Noise Measurement Equipment
INSERT INTO master_noise_equipment (equipment_id, equipment_code, equipment_name, equipment_type, brand, model, serial_number, accuracy_type, specifications, calibration_date, next_calibration_date, calibration_status, certificate_file, status, input_user) INSERT INTO master_noise_equipment (
VALUES MasterNoiseEquipmentID, MasterNoiseEquipmentCode, MasterNoiseEquipmentName,
(1, 'SLM-01', 'Sound Level Meter', 'SLM', 'RION', 'NL-52', '12345678', 'Type 1', 'Range: 20-130 dB, Accuracy: ±1.0 dB, Frequency range: 20 Hz - 20 kHz', '2024-02-15', '2025-02-15', 'VALID', '/documents/calibration/slm_rion_2024.pdf', TRUE, 'admin'), MasterNoiseEquipmentType, MasterNoiseEquipmentBrand,
(2, 'CAL-01', 'Acoustic Calibrator', 'Calibrator', 'RION', 'NC-74', '87654321', 'Class 1', 'Calibration level: 94 dB, Accuracy: ±0.3 dB', '2024-02-15', '2025-02-15', 'VALID', '/documents/calibration/cal_rion_2024.pdf', TRUE, 'admin'), MasterNoiseEquipmentModel, MasterNoiseEquipmentSerialNumber,
(3, 'SLM-02', 'Sound Level Meter', 'SLM', 'Cirrus', 'CR171B', 'CR123456', 'Type 1', 'Range: 20-140 dB, Accuracy: ±0.5 dB, Frequency range: 10 Hz - 20 kHz', '2023-11-20', '2024-11-20', 'VALID', '/documents/calibration/slm_cirrus_2023.pdf', TRUE, 'admin'), MasterNoiseEquipmentAccuracyType, MasterNoiseEquipmentSpecifications,
(4, 'WS-01', 'Weather Station', 'Weather Meter', 'Kestrel', '5500', 'KW123456', 'N/A', 'Wind speed, direction, temperature, humidity, pressure measurement', '2023-10-10', '2024-10-10', 'VALID', '/documents/calibration/weather_kestrel_2023.pdf', TRUE, 'admin'); MasterNoiseEquipmentCalibrationDate, MasterNoiseEquipmentNextCalibrationDate,
MasterNoiseEquipmentCalibrationStatus, MasterNoiseEquipmentCertificateFile,
MasterNoiseEquipmentIsActive, MasterNoiseEquipmentCreatedUserID
) VALUES
(1, 'SLM-01', 'Sound Level Meter', 'SLM',
'RION', 'NL-52', '12345678', 'Type 1',
'Range: 20-130 dB, Accuracy: ±1.0 dB, Frequency range: 20 Hz - 20 kHz',
'2024-02-15', '2025-02-15', 'VALID',
'/documents/calibration/slm_rion_2024.pdf', TRUE, 1);
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Sample Data Insertion - Transaction Tables -- Sample Data Insertion - Transaction Tables

View File

@@ -7,64 +7,78 @@
-- Master Area Types -- Master Area Types
CREATE TABLE IF NOT EXISTS master_area_types ( CREATE TABLE IF NOT EXISTS master_area_types (
area_type_id INT PRIMARY KEY, MasterAreaTypeID INT PRIMARY KEY,
area_type_name VARCHAR(100) NOT NULL, MasterAreaTypeName VARCHAR(100) NOT NULL,
description TEXT, MasterAreaTypeDescription TEXT,
status BOOLEAN DEFAULT TRUE, MasterAreaTypeIsActive BOOLEAN DEFAULT TRUE,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterAreaTypeCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50) MasterAreaTypeCreatedUserID INT,
MasterAreaTypeUpdatedAt DATETIME,
MasterAreaTypeUpdatedUserID INT,
MasterAreaTypeDeletedAt DATETIME,
MasterAreaTypeDeletedUserID INT
); );
-- Master Particulate Standards -- Master Particulate Standards
CREATE TABLE IF NOT EXISTS master_particulate_standards ( CREATE TABLE IF NOT EXISTS master_particulate_standards (
standard_id INT PRIMARY KEY, MasterParticulateStandardID INT PRIMARY KEY,
regulation_id INT NOT NULL, MasterRegulationID INT NOT NULL,
area_type_id INT NOT NULL, MasterAreaTypeID INT NOT NULL,
parameter_code VARCHAR(20) NOT NULL, -- TSP, PM10, PM2.5 MasterParticulateStandardParameterCode VARCHAR(20) NOT NULL, -- TSP, PM10, PM2.5
standard_value DECIMAL(7, 2) NOT NULL, MasterParticulateStandardValue DECIMAL(7,2) NOT NULL,
unit VARCHAR(20) DEFAULT 'μg/Nm³', MasterParticulateStandardUnit VARCHAR(20) DEFAULT 'μg/Nm³',
averaging_time VARCHAR(50), MasterParticulateStandardAveragingTime VARCHAR(50),
description TEXT, MasterParticulateStandardDescription TEXT,
status BOOLEAN DEFAULT TRUE, MasterParticulateStandardIsActive BOOLEAN DEFAULT TRUE,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterParticulateStandardCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50), MasterParticulateStandardCreatedUserID INT,
FOREIGN KEY (regulation_id) REFERENCES master_regulations(regulation_id), MasterParticulateStandardUpdatedAt DATETIME,
FOREIGN KEY (area_type_id) REFERENCES master_area_types(area_type_id) MasterParticulateStandardUpdatedUserID INT,
MasterParticulateStandardDeletedAt DATETIME,
MasterParticulateStandardDeletedUserID INT
); );
-- Master Particulate Measurement Methods -- Master Particulate Measurement Methods
CREATE TABLE IF NOT EXISTS master_particulate_methods ( CREATE TABLE IF NOT EXISTS master_particulate_methods (
method_id INT PRIMARY KEY, MasterParticulateMethodID INT PRIMARY KEY,
method_code VARCHAR(50) NOT NULL, MasterParticulateMethodCode VARCHAR(50) NOT NULL,
method_name VARCHAR(255) NOT NULL, MasterParticulateMethodName VARCHAR(255) NOT NULL,
parameter_code VARCHAR(20) NOT NULL, -- TSP, PM10, PM2.5 MasterParticulateMethodParameterCode VARCHAR(20) NOT NULL, -- TSP, PM10, PM2.5
description TEXT, MasterParticulateMethodDescription TEXT,
standard_reference VARCHAR(100), MasterParticulateMethodStandardReference VARCHAR(100),
status BOOLEAN DEFAULT TRUE, MasterParticulateMethodIsActive BOOLEAN DEFAULT TRUE,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterParticulateMethodCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50) MasterParticulateMethodCreatedUserID INT,
MasterParticulateMethodUpdatedAt DATETIME,
MasterParticulateMethodUpdatedUserID INT,
MasterParticulateMethodDeletedAt DATETIME,
MasterParticulateMethodDeletedUserID INT
); );
-- Master Particulate Measurement Equipment -- Master Particulate Measurement Equipment
CREATE TABLE IF NOT EXISTS master_particulate_equipment ( CREATE TABLE IF NOT EXISTS master_particulate_equipment (
equipment_id INT PRIMARY KEY, MasterParticulateEquipmentID INT PRIMARY KEY,
equipment_code VARCHAR(20) NOT NULL, MasterParticulateEquipmentCode VARCHAR(20) NOT NULL,
equipment_name VARCHAR(100) NOT NULL, MasterParticulateEquipmentName VARCHAR(100) NOT NULL,
equipment_type VARCHAR(50), MasterParticulateEquipmentType VARCHAR(50),
brand VARCHAR(100), MasterParticulateEquipmentBrand VARCHAR(100),
model VARCHAR(100), MasterParticulateEquipmentModel VARCHAR(100),
serial_number VARCHAR(100), MasterParticulateEquipmentSerialNumber VARCHAR(100),
parameter_measured VARCHAR(100), -- TSP, PM10, PM2.5, Multi-parameter MasterParticulateEquipmentParameterMeasured VARCHAR(100), -- TSP, PM10, PM2.5, Multi-parameter
specifications TEXT, MasterParticulateEquipmentSpecifications TEXT,
flow_rate VARCHAR(50), MasterParticulateEquipmentFlowRate VARCHAR(50),
filter_type VARCHAR(100), MasterParticulateEquipmentFilterType VARCHAR(100),
calibration_date DATE, MasterParticulateEquipmentCalibrationDate DATE,
next_calibration_date DATE, MasterParticulateEquipmentNextCalibrationDate DATE,
calibration_status VARCHAR(20), MasterParticulateEquipmentCalibrationStatus VARCHAR(20),
certificate_file VARCHAR(255), MasterParticulateEquipmentCertificateFile VARCHAR(255),
status BOOLEAN DEFAULT TRUE, MasterParticulateEquipmentIsActive BOOLEAN DEFAULT TRUE,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterParticulateEquipmentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50) MasterParticulateEquipmentCreatedUserID INT,
MasterParticulateEquipmentUpdatedAt DATETIME,
MasterParticulateEquipmentUpdatedUserID INT,
MasterParticulateEquipmentDeletedAt DATETIME,
MasterParticulateEquipmentDeletedUserID INT
); );
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
@@ -72,91 +86,100 @@ CREATE TABLE IF NOT EXISTS master_particulate_equipment (
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Particulate Sampling Plan -- Particulate Sampling Plan
CREATE TABLE IF NOT EXISTS trx_particulate_sampling_plan ( CREATE TABLE IF NOT EXISTS particulate_sampling_plans (
sampling_plan_id INT PRIMARY KEY, ParticulateSamplingPlanID INT PRIMARY KEY,
sampling_plan_code VARCHAR(50) NOT NULL, ParticulateSamplingPlanCode VARCHAR(50) NOT NULL,
project_name VARCHAR(255) NOT NULL, ParticulateSamplingPlanProjectName VARCHAR(255) NOT NULL,
client_id INT NOT NULL, ClientID INT NOT NULL,
planned_sampling_date DATE NOT NULL, ParticulateSamplingPlanDate DATE NOT NULL,
sampling_location TEXT NOT NULL, ParticulateSamplingPlanLocation TEXT NOT NULL,
point_count INT, ParticulateSamplingPlanPointCount INT,
parameters VARCHAR(100), -- Comma separated list: TSP, PM10, PM2.5 ParticulateSamplingPlanParameters VARCHAR(100), -- Comma separated list: TSP, PM10, PM2.5
approval_status VARCHAR(20) DEFAULT 'DRAFT', ParticulateSamplingPlanStatus VARCHAR(20) DEFAULT 'DRAFT',
notes TEXT, ParticulateSamplingPlanNotes TEXT,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ParticulateSamplingPlanCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50) ParticulateSamplingPlanCreatedUserID INT,
ParticulateSamplingPlanUpdatedAt DATETIME,
ParticulateSamplingPlanUpdatedUserID INT,
ParticulateSamplingPlanDeletedAt DATETIME,
ParticulateSamplingPlanDeletedUserID INT
); );
-- Particulate Measurement Results - Header -- Particulate Measurement Results - Header
CREATE TABLE IF NOT EXISTS trx_particulate_measurement_results ( CREATE TABLE IF NOT EXISTS particulate_measurements (
measurement_id INT PRIMARY KEY, ParticulateMeasurementID INT PRIMARY KEY,
sampling_plan_id INT NOT NULL, ParticulateSamplingPlanID INT NOT NULL,
report_code VARCHAR(50) NOT NULL, ParticulateMeasurementCode VARCHAR(50) NOT NULL,
sampling_date DATE NOT NULL, ParticulateMeasurementDate DATE NOT NULL,
start_time TIME, ParticulateMeasurementStartTime TIME,
end_time TIME, ParticulateMeasurementEndTime TIME,
weather_condition VARCHAR(100), ParticulateMeasurementWeather VARCHAR(100),
temperature DECIMAL(5, 2), ParticulateMeasurementTemperature DECIMAL(5,2),
humidity DECIMAL(5, 2), ParticulateMeasurementHumidity DECIMAL(5,2),
wind_speed DECIMAL(5, 2), ParticulateMeasurementWindSpeed DECIMAL(5,2),
wind_direction VARCHAR(10), ParticulateMeasurementWindDirection VARCHAR(10),
pressure DECIMAL(7, 2), ParticulateMeasurementPressure DECIMAL(7,2),
sampling_officers VARCHAR(100), ParticulateMeasurementOfficers VARCHAR(100),
report_status VARCHAR(20) DEFAULT 'DRAFT', ParticulateMeasurementStatus VARCHAR(20) DEFAULT 'DRAFT',
notes TEXT, ParticulateMeasurementNotes TEXT,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ParticulateMeasurementCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50), ParticulateMeasurementCreatedUserID INT,
FOREIGN KEY (sampling_plan_id) REFERENCES trx_particulate_sampling_plan(sampling_plan_id) ParticulateMeasurementUpdatedAt DATETIME,
ParticulateMeasurementUpdatedUserID INT,
ParticulateMeasurementDeletedAt DATETIME,
ParticulateMeasurementDeletedUserID INT
); );
-- Particulate Measurement Details -- Particulate Measurement Details
CREATE TABLE IF NOT EXISTS trx_particulate_measurement_details ( CREATE TABLE IF NOT EXISTS particulate_measurement_details (
measurement_detail_id INT PRIMARY KEY, ParticulateMeasurementDetailID INT PRIMARY KEY,
measurement_id INT NOT NULL, ParticulateMeasurementID INT NOT NULL,
point_code VARCHAR(20) NOT NULL, ParticulateMeasurementDetailPointCode VARCHAR(20) NOT NULL,
location_name VARCHAR(255) NOT NULL, ParticulateMeasurementDetailLocation VARCHAR(255) NOT NULL,
area_description TEXT, ParticulateMeasurementDetailAreaDescription TEXT,
area_type_id INT NOT NULL, MasterAreaTypeID INT NOT NULL,
latitude DECIMAL(10, 6), ParticulateMeasurementDetailLatitude DECIMAL(10,6),
longitude DECIMAL(10, 6), ParticulateMeasurementDetailLongitude DECIMAL(10,6),
sampling_height DECIMAL(4, 2), ParticulateMeasurementDetailHeight DECIMAL(4,2),
sampling_duration DECIMAL(5, 2), ParticulateMeasurementDetailDuration DECIMAL(5,2),
parameter_code VARCHAR(20) NOT NULL, -- TSP, PM10, PM2.5 ParticulateMeasurementDetailParameterCode VARCHAR(20) NOT NULL, -- TSP, PM10, PM2.5
method_id INT NOT NULL, MasterParticulateMethodID INT NOT NULL,
equipment_id INT NOT NULL, MasterParticulateEquipmentID INT NOT NULL,
filter_id VARCHAR(50), ParticulateMeasurementDetailFilterID VARCHAR(50),
initial_weight DECIMAL(10, 5), ParticulateMeasurementDetailInitialWeight DECIMAL(10,5),
final_weight DECIMAL(10, 5), ParticulateMeasurementDetailFinalWeight DECIMAL(10,5),
flow_rate DECIMAL(7, 2), ParticulateMeasurementDetailFlowRate DECIMAL(7,2),
volume_sampled DECIMAL(10, 2), ParticulateMeasurementDetailVolume DECIMAL(10,2),
result_value DECIMAL(8, 2) NOT NULL, ParticulateMeasurementDetailResult DECIMAL(8,2) NOT NULL,
standard_id INT NOT NULL, MasterParticulateStandardID INT NOT NULL,
compliance_status VARCHAR(20), ParticulateMeasurementDetailComplianceStatus VARCHAR(20),
major_sources TEXT, ParticulateMeasurementDetailSources TEXT,
recommendations TEXT, ParticulateMeasurementDetailRecommendations TEXT,
notes TEXT, ParticulateMeasurementDetailNotes TEXT,
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ParticulateMeasurementDetailCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50), ParticulateMeasurementDetailCreatedUserID INT,
FOREIGN KEY (measurement_id) REFERENCES trx_particulate_measurement_results(measurement_id), ParticulateMeasurementDetailUpdatedAt DATETIME,
FOREIGN KEY (area_type_id) REFERENCES master_area_types(area_type_id), ParticulateMeasurementDetailUpdatedUserID INT,
FOREIGN KEY (method_id) REFERENCES master_particulate_methods(method_id), ParticulateMeasurementDetailDeletedAt DATETIME,
FOREIGN KEY (equipment_id) REFERENCES master_particulate_equipment(equipment_id), ParticulateMeasurementDetailDeletedUserID INT
FOREIGN KEY (standard_id) REFERENCES master_particulate_standards(standard_id)
); );
-- Dust Control Recommendations -- Dust Control Recommendations
CREATE TABLE IF NOT EXISTS trx_dust_control_recommendations ( CREATE TABLE IF NOT EXISTS dust_control_recommendations (
recommendation_id INT PRIMARY KEY, DustControlRecommendationID INT PRIMARY KEY,
measurement_detail_id INT NOT NULL, ParticulateMeasurementDetailID INT NOT NULL,
control_type VARCHAR(50) NOT NULL, -- Engineering, Administrative, PPE DustControlRecommendationType VARCHAR(50) NOT NULL, -- Engineering, Administrative, PPE
control_description TEXT NOT NULL, DustControlRecommendationDescription TEXT NOT NULL,
priority INT, DustControlRecommendationPriority INT,
estimated_cost DECIMAL(12, 2), DustControlRecommendationEstimatedCost DECIMAL(12,2),
estimated_reduction DECIMAL(5, 1), DustControlRecommendationEstimatedReduction DECIMAL(5,1),
implementation_status VARCHAR(20) DEFAULT 'PLANNED', DustControlRecommendationStatus VARCHAR(20) DEFAULT 'PLANNED',
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, DustControlRecommendationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
input_user VARCHAR(50), DustControlRecommendationCreatedUserID INT,
FOREIGN KEY (measurement_detail_id) REFERENCES trx_particulate_measurement_details(measurement_detail_id) DustControlRecommendationUpdatedAt DATETIME,
DustControlRecommendationUpdatedUserID INT,
DustControlRecommendationDeletedAt DATETIME,
DustControlRecommendationDeletedUserID INT
); );
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
@@ -164,126 +187,126 @@ CREATE TABLE IF NOT EXISTS trx_dust_control_recommendations (
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Insert Data Master Area Types -- Insert Data Master Area Types
INSERT INTO master_area_types (area_type_id, area_type_name, description, status, input_user) INSERT INTO master_area_types (MasterAreaTypeID, MasterAreaTypeName, MasterAreaTypeDescription, MasterAreaTypeIsActive, MasterAreaTypeCreatedUserID)
VALUES VALUES
(1, 'Industrial Areas', 'Manufacturing and industrial activity areas', TRUE, 'admin'), (1, 'Industrial Areas', 'Manufacturing and industrial activity areas', TRUE, 1),
(2, 'Residential Areas', 'Residential housing and settlements', TRUE, 'admin'), (2, 'Residential Areas', 'Residential housing and settlements', TRUE, 1),
(3, 'Office and Commercial Areas', 'Office buildings and commercial areas', TRUE, 'admin'), (3, 'Office and Commercial Areas', 'Office buildings and commercial areas', TRUE, 1),
(4, 'Parks and Green Areas', 'Public parks and green spaces', TRUE, 'admin'), (4, 'Parks and Green Areas', 'Public parks and green spaces', TRUE, 1),
(5, 'Sensitive Areas', 'Hospitals, schools, and other sensitive locations', TRUE, 'admin'); (5, 'Sensitive Areas', 'Hospitals, schools, and other sensitive locations', TRUE, 1);
-- Insert Data Master Particulate Standards -- Insert Data Master Particulate Standards
INSERT INTO master_particulate_standards (standard_id, regulation_id, area_type_id, parameter_code, standard_value, unit, averaging_time, description, status, input_user) INSERT INTO master_particulate_standards (MasterParticulateStandardID, MasterRegulationID, MasterAreaTypeID, MasterParticulateStandardParameterCode, MasterParticulateStandardValue, MasterParticulateStandardUnit, MasterParticulateStandardAveragingTime, MasterParticulateStandardDescription, MasterParticulateStandardIsActive, MasterParticulateStandardCreatedUserID)
VALUES VALUES
-- TSP/Total Particulate Matter Standards -- TSP/Total Particulate Matter Standards
(1, 1, 1, 'TSP', 230.00, 'μg/Nm³', '24 hours', 'Industrial areas TSP standard', TRUE, 'admin'), (1, 1, 1, 'TSP', 230.00, 'μg/Nm³', '24 hours', 'Industrial areas TSP standard', TRUE, 1),
(2, 1, 2, 'TSP', 90.00, 'μg/Nm³', '24 hours', 'Residential areas TSP standard', TRUE, 'admin'), (2, 1, 2, 'TSP', 90.00, 'μg/Nm³', '24 hours', 'Residential areas TSP standard', TRUE, 1),
(3, 1, 3, 'TSP', 90.00, 'μg/Nm³', '24 hours', 'Office and commercial areas TSP standard', TRUE, 'admin'), (3, 1, 3, 'TSP', 90.00, 'μg/Nm³', '24 hours', 'Office and commercial areas TSP standard', TRUE, 1),
(4, 1, 4, 'TSP', 90.00, 'μg/Nm³', '24 hours', 'Parks and green areas TSP standard', TRUE, 'admin'), (4, 1, 4, 'TSP', 90.00, 'μg/Nm³', '24 hours', 'Parks and green areas TSP standard', TRUE, 1),
(5, 1, 5, 'TSP', 90.00, 'μg/Nm³', '24 hours', 'Sensitive areas TSP standard', TRUE, 'admin'), (5, 1, 5, 'TSP', 90.00, 'μg/Nm³', '24 hours', 'Sensitive areas TSP standard', TRUE, 1),
-- PM10 Standards -- PM10 Standards
(6, 1, 1, 'PM10', 150.00, 'μg/Nm³', '24 hours', 'Industrial areas PM10 standard', TRUE, 'admin'), (6, 1, 1, 'PM10', 150.00, 'μg/Nm³', '24 hours', 'Industrial areas PM10 standard', TRUE, 1),
(7, 1, 2, 'PM10', 75.00, 'μg/Nm³', '24 hours', 'Residential areas PM10 standard', TRUE, 'admin'), (7, 1, 2, 'PM10', 75.00, 'μg/Nm³', '24 hours', 'Residential areas PM10 standard', TRUE, 1),
(8, 1, 3, 'PM10', 75.00, 'μg/Nm³', '24 hours', 'Office and commercial areas PM10 standard', TRUE, 'admin'), (8, 1, 3, 'PM10', 75.00, 'μg/Nm³', '24 hours', 'Office and commercial areas PM10 standard', TRUE, 1),
(9, 1, 4, 'PM10', 75.00, 'μg/Nm³', '24 hours', 'Parks and green areas PM10 standard', TRUE, 'admin'), (9, 1, 4, 'PM10', 75.00, 'μg/Nm³', '24 hours', 'Parks and green areas PM10 standard', TRUE, 1),
(10, 1, 5, 'PM10', 75.00, 'μg/Nm³', '24 hours', 'Sensitive areas PM10 standard', TRUE, 'admin'), (10, 1, 5, 'PM10', 75.00, 'μg/Nm³', '24 hours', 'Sensitive areas PM10 standard', TRUE, 1),
-- PM2.5 Standards -- PM2.5 Standards
(11, 1, 1, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Industrial areas PM2.5 standard', TRUE, 'admin'), (11, 1, 1, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Industrial areas PM2.5 standard', TRUE, 1),
(12, 1, 2, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Residential areas PM2.5 standard', TRUE, 'admin'), (12, 1, 2, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Residential areas PM2.5 standard', TRUE, 1),
(13, 1, 3, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Office and commercial areas PM2.5 standard', TRUE, 'admin'), (13, 1, 3, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Office and commercial areas PM2.5 standard', TRUE, 1),
(14, 1, 4, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Parks and green areas PM2.5 standard', TRUE, 'admin'), (14, 1, 4, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Parks and green areas PM2.5 standard', TRUE, 1),
(15, 1, 5, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Sensitive areas PM2.5 standard', TRUE, 'admin'); (15, 1, 5, 'PM2.5', 55.00, 'μg/Nm³', '24 hours', 'Sensitive areas PM2.5 standard', TRUE, 1);
-- Insert Data Master Particulate Measurement Methods -- Insert Data Master Particulate Measurement Methods
INSERT INTO master_particulate_methods (method_id, method_code, method_name, parameter_code, description, standard_reference, status, input_user) INSERT INTO master_particulate_methods (MasterParticulateMethodID, MasterParticulateMethodCode, MasterParticulateMethodName, MasterParticulateMethodParameterCode, MasterParticulateMethodDescription, MasterParticulateMethodStandardReference, MasterParticulateMethodIsActive, MasterParticulateMethodCreatedUserID)
VALUES VALUES
(1, 'SNI-7119.3-2005', 'High Volume Method for TSP', 'TSP', 'Gravimetric method for TSP using high volume sampler', 'SNI 19-7119.3-2005', TRUE, 'admin'), (1, 'SNI-7119.3-2005', 'High Volume Method for TSP', 'TSP', 'Gravimetric method for TSP using high volume sampler', 'SNI 19-7119.3-2005', TRUE, 1),
(2, 'SNI-7119.15-2016', 'High Volume Method for PM10', 'PM10', 'Gravimetric method for PM10 using high volume sampler with PM10 inlet', 'SNI 19-7119.15-2016', TRUE, 'admin'), (2, 'SNI-7119.15-2016', 'High Volume Method for PM10', 'PM10', 'Gravimetric method for PM10 using high volume sampler with PM10 inlet', 'SNI 19-7119.15-2016', TRUE, 1),
(3, 'SNI-7119.14-2016', 'Gravimetric Method for PM2.5', 'PM2.5', 'Gravimetric method for PM2.5 using low volume sampler with PM2.5 inlet', 'SNI 19-7119.14-2016', TRUE, 'admin'), (3, 'SNI-7119.14-2016', 'Gravimetric Method for PM2.5', 'PM2.5', 'Gravimetric method for PM2.5 using low volume sampler with PM2.5 inlet', 'SNI 19-7119.14-2016', TRUE, 1),
(4, 'US-EPA-IO-2.1', 'EPA Method IO-2.1 for TSP', 'TSP', 'EPA Method for sampling TSP using high volume samplers', 'US EPA IO-2.1', TRUE, 'admin'), (4, 'US-EPA-IO-2.1', 'EPA Method IO-2.1 for TSP', 'TSP', 'EPA Method for sampling TSP using high volume samplers', 'US EPA IO-2.1', TRUE, 1),
(5, 'US-EPA-IO-3.1', 'EPA Method IO-3.1 for PM10', 'PM10', 'EPA Method for PM10 sampling', 'US EPA IO-3.1', TRUE, 'admin'); (5, 'US-EPA-IO-3.1', 'EPA Method IO-3.1 for PM10', 'PM10', 'EPA Method for PM10 sampling', 'US EPA IO-3.1', TRUE, 1);
-- Insert Data Master Particulate Measurement Equipment -- Insert Data Master Particulate Measurement Equipment
INSERT INTO master_particulate_equipment (equipment_id, equipment_code, equipment_name, equipment_type, brand, model, serial_number, parameter_measured, specifications, flow_rate, filter_type, calibration_date, next_calibration_date, calibration_status, certificate_file, status, input_user) INSERT INTO master_particulate_equipment (MasterParticulateEquipmentID, MasterParticulateEquipmentCode, MasterParticulateEquipmentName, MasterParticulateEquipmentType, MasterParticulateEquipmentBrand, MasterParticulateEquipmentModel, MasterParticulateEquipmentSerialNumber, MasterParticulateEquipmentParameterMeasured, MasterParticulateEquipmentSpecifications, MasterParticulateEquipmentFlowRate, MasterParticulateEquipmentFilterType, MasterParticulateEquipmentCalibrationDate, MasterParticulateEquipmentNextCalibrationDate, MasterParticulateEquipmentCalibrationStatus, MasterParticulateEquipmentCertificateFile, MasterParticulateEquipmentIsActive, MasterParticulateEquipmentCreatedUserID)
VALUES VALUES
(1, 'HVAS-01', 'High Volume Air Sampler', 'HVAS', 'Tisch Environmental', 'TE-5000', 'HV12345', 'TSP', 'Flow rate: 1.13-1.70 m³/min, Motor: Continuous duty brushes', '1.13-1.70 m³/min', 'Glass Fiber Filter 8×10 inch', '2024-04-05', '2025-04-05', 'VALID', '/documents/calibration/hvas_tisch_2024.pdf', TRUE, 'admin'), (1, 'HVAS-01', 'High Volume Air Sampler', 'HVAS', 'Tisch Environmental', 'TE-5000', 'HV12345', 'TSP', 'Flow rate: 1.13-1.70 m³/min, Motor: Continuous duty brushes', '1.13-1.70 m³/min', 'Glass Fiber Filter 8×10 inch', '2024-04-05', '2025-04-05', 'VALID', '/documents/calibration/hvas_tisch_2024.pdf', TRUE, 1),
(2, 'PM10-01', 'PM10 High Volume Sampler', 'PM10 HVAS', 'Tisch Environmental', 'TE-6070', 'PM10-7890', 'PM10', 'Flow rate: 1.13-1.70 m³/min, Size-selective inlet', '1.13-1.70 m³/min', 'Quartz Fiber Filter 8×10 inch', '2024-04-10', '2025-04-10', 'VALID', '/documents/calibration/pm10_tisch_2024.pdf', TRUE, 'admin'), (2, 'PM10-01', 'PM10 High Volume Sampler', 'PM10 HVAS', 'Tisch Environmental', 'TE-6070', 'PM10-7890', 'PM10', 'Flow rate: 1.13-1.70 m³/min, Size-selective inlet', '1.13-1.70 m³/min', 'Quartz Fiber Filter 8×10 inch', '2024-04-10', '2025-04-10', 'VALID', '/documents/calibration/pm10_tisch_2024.pdf', TRUE, 1),
(3, 'PM25-01', 'Low Volume PM2.5 Sampler', 'PM2.5 LVS', 'BGI', 'PQ200', 'PQ-5678', 'PM2.5', 'Flow rate: 16.7 L/min, WINS impactor', '16.7 L/min', '47mm PTFE membrane filter', '2024-03-15', '2025-03-15', 'VALID', '/documents/calibration/pm25_bgi_2024.pdf', TRUE, 'admin'), (3, 'PM25-01', 'Low Volume PM2.5 Sampler', 'PM2.5 LVS', 'BGI', 'PQ200', 'PQ-5678', 'PM2.5', 'Flow rate: 16.7 L/min, WINS impactor', '16.7 L/min', '47mm PTFE membrane filter', '2024-03-15', '2025-03-15', 'VALID', '/documents/calibration/pm25_bgi_2024.pdf', TRUE, 1),
(4, 'MET-01', 'Weather Station', 'Weather Monitor', 'Davis', 'Vantage Pro2', 'WS78901', 'Meteorological Parameters', 'Temperature, humidity, pressure, wind speed/direction', 'N/A', 'N/A', '2024-03-15', '2025-03-15', 'VALID', '/documents/calibration/met_davis_2024.pdf', TRUE, 'admin'), (4, 'MET-01', 'Weather Station', 'Weather Monitor', 'Davis', 'Vantage Pro2', 'WS78901', 'Meteorological Parameters', 'Temperature, humidity, pressure, wind speed/direction', 'N/A', 'N/A', '2024-03-15', '2025-03-15', 'VALID', '/documents/calibration/met_davis_2024.pdf', TRUE, 1),
(5, 'BAL-01', 'Analytical Balance', 'Microbalance', 'Mettler Toledo', 'XPR2U', 'MT34567', 'Filter Weighing', 'Range: 0-2.1g, Readability: 0.1μg, Repeatability: 0.15μg', 'N/A', 'N/A', '2024-02-20', '2025-02-20', 'VALID', '/documents/calibration/bal_mettler_2024.pdf', TRUE, 'admin'); (5, 'BAL-01', 'Analytical Balance', 'Microbalance', 'Mettler Toledo', 'XPR2U', 'MT34567', 'Filter Weighing', 'Range: 0-2.1g, Readability: 0.1μg, Repeatability: 0.15μg', 'N/A', 'N/A', '2024-02-20', '2025-02-20', 'VALID', '/documents/calibration/bal_mettler_2024.pdf', TRUE, 1);
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Sample Data Insertion - Transaction Tables -- Sample Data Insertion - Transaction Tables
-- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------
-- Sample Particulate Sampling Plan -- Sample Particulate Sampling Plan
INSERT INTO trx_particulate_sampling_plan (sampling_plan_id, sampling_plan_code, project_name, client_id, planned_sampling_date, sampling_location, point_count, parameters, approval_status, notes, input_date, input_user) INSERT INTO particulate_sampling_plans (ParticulateSamplingPlanID, ParticulateSamplingPlanCode, ParticulateSamplingPlanProjectName, ClientID, ParticulateSamplingPlanDate, ParticulateSamplingPlanLocation, ParticulateSamplingPlanPointCount, ParticulateSamplingPlanParameters, ParticulateSamplingPlanStatus, ParticulateSamplingPlanNotes, ParticulateSamplingPlanCreatedAt, ParticulateSamplingPlanCreatedUserID)
VALUES VALUES
(1, 'SP-PART-2024-002', 'Total Particulate Measurement at PT. Integrated Manufacturing Industries', 201, '2024-06-15', 'PT. Integrated Manufacturing Industries, Industrial Zone Block C5, Karawang, West Java', 6, 'TSP,PM10', 'APPROVED', 'Particulate measurement for environmental compliance monitoring', '2024-06-05 10:00:00', 'supervisor'); (1, 'SP-PART-2024-002', 'Total Particulate Measurement at PT. Integrated Manufacturing Industries', 201, '2024-06-15', 'PT. Integrated Manufacturing Industries, Industrial Zone Block C5, Karawang, West Java', 6, 'TSP,PM10', 'APPROVED', 'Particulate measurement for environmental compliance monitoring', '2024-06-05 10:00:00', 1);
-- Sample Particulate Measurement Results - Header -- Sample Particulate Measurement Results - Header
INSERT INTO trx_particulate_measurement_results (measurement_id, sampling_plan_id, report_code, sampling_date, start_time, end_time, weather_condition, temperature, humidity, wind_speed, wind_direction, pressure, sampling_officers, report_status, notes, input_date, input_user) INSERT INTO particulate_measurements (ParticulateMeasurementID, ParticulateSamplingPlanID, ParticulateMeasurementCode, ParticulateMeasurementDate, ParticulateMeasurementStartTime, ParticulateMeasurementEndTime, ParticulateMeasurementWeather, ParticulateMeasurementTemperature, ParticulateMeasurementHumidity, ParticulateMeasurementWindSpeed, ParticulateMeasurementWindDirection, ParticulateMeasurementPressure, ParticulateMeasurementOfficers, ParticulateMeasurementStatus, ParticulateMeasurementNotes, ParticulateMeasurementCreatedAt, ParticulateMeasurementCreatedUserID)
VALUES VALUES
(1, 1, 'LHU/PART/06/2024/005', '2024-06-15', '08:30:00', '16:30:00', 'Sunny', 31.0, 68.0, 1.2, 'North', 760.0, 'Rudi Hartono, Siti Fauziah', 'FINAL', 'Measurement conducted during normal operations', '2024-06-15 17:00:00', 'analyst'); (1, 1, 'LHU/PART/06/2024/005', '2024-06-15', '08:30:00', '16:30:00', 'Sunny', 31.0, 68.0, 1.2, 'North', 760.0, 'Rudi Hartono, Siti Fauziah', 'FINAL', 'Measurement conducted during normal operations', '2024-06-15 17:00:00', 1);
-- Sample Particulate Measurement Details -- Sample Particulate Measurement Details
INSERT INTO trx_particulate_measurement_details (measurement_detail_id, measurement_id, point_code, location_name, area_description, area_type_id, latitude, longitude, sampling_height, sampling_duration, parameter_code, method_id, equipment_id, filter_id, initial_weight, final_weight, flow_rate, volume_sampled, result_value, standard_id, compliance_status, major_sources, recommendations, notes, input_date, input_user) INSERT INTO particulate_measurement_details (ParticulateMeasurementDetailID, ParticulateMeasurementID, ParticulateMeasurementDetailPointCode, ParticulateMeasurementDetailLocation, ParticulateMeasurementDetailAreaDescription, MasterAreaTypeID, ParticulateMeasurementDetailLatitude, ParticulateMeasurementDetailLongitude, ParticulateMeasurementDetailHeight, ParticulateMeasurementDetailDuration, ParticulateMeasurementDetailParameterCode, MasterParticulateMethodID, MasterParticulateEquipmentID, ParticulateMeasurementDetailFilterID, ParticulateMeasurementDetailInitialWeight, ParticulateMeasurementDetailFinalWeight, ParticulateMeasurementDetailFlowRate, ParticulateMeasurementDetailVolume, ParticulateMeasurementDetailResult, MasterParticulateStandardID, ParticulateMeasurementDetailComplianceStatus, ParticulateMeasurementDetailSources, ParticulateMeasurementDetailRecommendations, ParticulateMeasurementDetailNotes, ParticulateMeasurementDetailCreatedAt, ParticulateMeasurementDetailCreatedUserID)
VALUES VALUES
-- Main Factory Entrance - TSP -- Main Factory Entrance - TSP
(1, 1, 'TPM-1', 'Main Factory Entrance', 'Main entrance with moderate traffic', 1, -6.372500, 107.524167, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-01', 4.52130, 4.62875, 1.15, 552.0, 215.4, 1, 'COMPLY', 'Vehicle traffic, material transport activities', '', 'Moderate traffic flow during sampling', '2024-06-15 17:05:00', 'analyst'), (1, 1, 'TPM-1', 'Main Factory Entrance', 'Main entrance with moderate traffic', 1, -6.372500, 107.524167, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-01', 4.52130, 4.62875, 1.15, 552.0, 215.4, 1, 'COMPLY', 'Vehicle traffic, material transport activities', '', 'Moderate traffic flow during sampling', '2024-06-15 17:05:00', 1),
-- Main Factory Entrance - PM10 -- Main Factory Entrance - PM10
(2, 1, 'TPM-1', 'Main Factory Entrance', 'Main entrance with moderate traffic', 1, -6.372500, 107.524167, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-01', 4.48730, 4.54947, 1.15, 552.0, 112.7, 6, 'COMPLY', 'Vehicle traffic, material transport activities', '', 'PM10 fraction shows significant contribution', '2024-06-15 17:10:00', 'analyst'), (2, 1, 'TPM-1', 'Main Factory Entrance', 'Main entrance with moderate traffic', 1, -6.372500, 107.524167, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-01', 4.48730, 4.54947, 1.15, 552.0, 112.7, 6, 'COMPLY', 'Vehicle traffic, material transport activities', '', 'PM10 fraction shows significant contribution', '2024-06-15 17:10:00', 1),
-- Production Area (Crusher Unit) - TSP -- Production Area (Crusher Unit) - TSP
(3, 1, 'TPM-2', 'Production Area (Crusher Unit)', 'Area with crushing equipment and high dust generation', 1, -6.372778, 107.524444, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-02', 4.51890, 4.67765, 1.15, 552.0, 287.6, 1, 'NOT_COMPLY', 'Crushing activities, material handling, conveyor transfer points', 'Install dust suppression systems, implement proper enclosure', 'Visible dust emissions during crusher operation', '2024-06-15 17:15:00', 'analyst'), (3, 1, 'TPM-2', 'Production Area (Crusher Unit)', 'Area with crushing equipment and high dust generation', 1, -6.372778, 107.524444, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-02', 4.51890, 4.67765, 1.15, 552.0, 287.6, 1, 'NOT_COMPLY', 'Crushing activities, material handling, conveyor transfer points', 'Install dust suppression systems, implement proper enclosure', 'Visible dust emissions during crusher operation', '2024-06-15 17:15:00', 1),
-- Production Area (Crusher Unit) - PM10 -- Production Area (Crusher Unit) - PM10
(4, 1, 'TPM-2', 'Production Area (Crusher Unit)', 'Area with crushing equipment and high dust generation', 1, -6.372778, 107.524444, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-02', 4.49120, 4.57748, 1.15, 552.0, 156.3, 6, 'NOT_COMPLY', 'Crushing activities, material handling, conveyor transfer points', 'Install dust collection systems with adequate filtration', 'High respirable fraction indicates health concerns', '2024-06-15 17:20:00', 'analyst'), (4, 1, 'TPM-2', 'Production Area (Crusher Unit)', 'Area with crushing equipment and high dust generation', 1, -6.372778, 107.524444, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-02', 4.49120, 4.57748, 1.15, 552.0, 156.3, 6, 'NOT_COMPLY', 'Crushing activities, material handling, conveyor transfer points', 'Install dust collection systems with adequate filtration', 'High respirable fraction indicates health concerns', '2024-06-15 17:20:00', 1),
-- Office Building - TSP -- Office Building - TSP
(5, 1, 'TPM-3', 'Office Building', 'Administrative office area', 3, -6.372944, 107.525000, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-03', 4.52670, 4.57255, 1.15, 552.0, 83.1, 3, 'COMPLY', 'Limited sources, mainly from HVAC system', '', 'Indoor air quality with minimal outdoor influence', '2024-06-15 17:25:00', 'analyst'), (5, 1, 'TPM-3', 'Office Building', 'Administrative office area', 3, -6.372944, 107.525000, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-03', 4.52670, 4.57255, 1.15, 552.0, 83.1, 3, 'COMPLY', 'Limited sources, mainly from HVAC system', '', 'Indoor air quality with minimal outdoor influence', '2024-06-15 17:25:00', 1),
-- Office Building - PM10 -- Office Building - PM10
(6, 1, 'TPM-3', 'Office Building', 'Administrative office area', 3, -6.372944, 107.525000, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-03', 4.48950, 4.51467, 1.15, 552.0, 45.6, 8, 'COMPLY', 'Limited sources, mainly from HVAC system', '', 'Low PM10 levels indicate good air filtration', '2024-06-15 17:30:00', 'analyst'), (6, 1, 'TPM-3', 'Office Building', 'Administrative office area', 3, -6.372944, 107.525000, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-03', 4.48950, 4.51467, 1.15, 552.0, 45.6, 8, 'COMPLY', 'Limited sources, mainly from HVAC system', '', 'Low PM10 levels indicate good air filtration', '2024-06-15 17:30:00', 1),
-- Eastern Facility Boundary - TSP -- Eastern Facility Boundary - TSP
(7, 1, 'TPM-4', 'Eastern Facility Boundary', 'Eastern boundary of the facility', 1, -6.373111, 107.526111, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-04', 4.53010, 4.62778, 1.15, 552.0, 176.8, 1, 'COMPLY', 'General facility operations, stockpiles, road dust', '', 'Unpaved areas contributing to dust levels', '2024-06-15 17:35:00', 'analyst'), (7, 1, 'TPM-4', 'Eastern Facility Boundary', 'Eastern boundary of the facility', 1, -6.373111, 107.526111, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-04', 4.53010, 4.62778, 1.15, 552.0, 176.8, 1, 'COMPLY', 'General facility operations, stockpiles, road dust', '', 'Unpaved areas contributing to dust levels', '2024-06-15 17:35:00', 1),
-- Eastern Facility Boundary - PM10 -- Eastern Facility Boundary - PM10
(8, 1, 'TPM-4', 'Eastern Facility Boundary', 'Eastern boundary of the facility', 1, -6.373111, 107.526111, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-04', 4.49070, 4.53997, 1.15, 552.0, 89.3, 6, 'COMPLY', 'General facility operations, stockpiles, road dust', '', 'PM10 levels below industrial standard', '2024-06-15 17:40:00', 'analyst'), (8, 1, 'TPM-4', 'Eastern Facility Boundary', 'Eastern boundary of the facility', 1, -6.373111, 107.526111, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-04', 4.49070, 4.53997, 1.15, 552.0, 89.3, 6, 'COMPLY', 'General facility operations, stockpiles, road dust', '', 'PM10 levels below industrial standard', '2024-06-15 17:40:00', 1),
-- Material Storage Area - TSP -- Material Storage Area - TSP
(9, 1, 'TPM-5', 'Material Storage Area', 'Raw material storage with open piles', 1, -6.373278, 107.524722, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-05', 4.52230, 4.67025, 1.15, 552.0, 268.2, 1, 'NOT_COMPLY', 'Raw material stockpiles, loading/unloading operations', 'Cover stockpiles, implement water spraying', 'Wind-blown dust from uncovered material piles', '2024-06-15 17:45:00', 'analyst'), (9, 1, 'TPM-5', 'Material Storage Area', 'Raw material storage with open piles', 1, -6.373278, 107.524722, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-05', 4.52230, 4.67025, 1.15, 552.0, 268.2, 1, 'NOT_COMPLY', 'Raw material stockpiles, loading/unloading operations', 'Cover stockpiles, implement water spraying', 'Wind-blown dust from uncovered material piles', '2024-06-15 17:45:00', 1),
-- Material Storage Area - PM10 -- Material Storage Area - PM10
(10, 1, 'TPM-5', 'Material Storage Area', 'Raw material storage with open piles', 1, -6.373278, 107.524722, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-05', 4.48870, 4.56737, 1.15, 552.0, 142.5, 6, 'COMPLY', 'Raw material stockpiles, loading/unloading operations', 'Minimize material handling during high winds', 'PM10 fraction still within limits but elevated', '2024-06-15 17:50:00', 'analyst'), (10, 1, 'TPM-5', 'Material Storage Area', 'Raw material storage with open piles', 1, -6.373278, 107.524722, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-05', 4.48870, 4.56737, 1.15, 552.0, 142.5, 6, 'COMPLY', 'Raw material stockpiles, loading/unloading operations', 'Minimize material handling during high winds', 'PM10 fraction still within limits but elevated', '2024-06-15 17:50:00', 1),
-- Nearest Residential Area - TSP -- Nearest Residential Area - TSP
(11, 1, 'TPM-6', 'Nearest Residential Area', 'Residential area near the industrial facility', 2, -6.374167, 107.527222, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-06', 4.52450, 4.57884, 1.15, 552.0, 98.5, 2, 'NOT_COMPLY', 'Industrial facility emissions, community activities', 'Establish vegetation buffer, improve dust control', 'Residential area ~500m from facility boundary', '2024-06-15 17:55:00', 'analyst'), (11, 1, 'TPM-6', 'Nearest Residential Area', 'Residential area near the industrial facility', 2, -6.374167, 107.527222, 1.5, 8.0, 'TSP', 1, 1, 'GF-20240615-06', 4.52450, 4.57884, 1.15, 552.0, 98.5, 2, 'NOT_COMPLY', 'Industrial facility emissions, community activities', 'Establish vegetation buffer, improve dust control', 'Residential area ~500m from facility boundary', '2024-06-15 17:55:00', 1),
-- Nearest Residential Area - PM10 -- Nearest Residential Area - PM10
(12, 1, 'TPM-6', 'Nearest Residential Area', 'Residential area near the industrial facility', 2, -6.374167, 107.527222, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-06', 4.49210, 4.52103, 1.15, 552.0, 52.4, 7, 'COMPLY', 'Industrial facility emissions, community activities', '', 'PM10 levels within residential standard', '2024-06-15 18:00:00', 'analyst'); (12, 1, 'TPM-6', 'Nearest Residential Area', 'Residential area near the industrial facility', 2, -6.374167, 107.527222, 1.5, 8.0, 'PM10', 2, 2, 'QF-20240615-06', 4.49210, 4.52103, 1.15, 552.0, 52.4, 7, 'COMPLY', 'Industrial facility emissions, community activities', '', 'PM10 levels within residential standard', '2024-06-15 18:00:00', 1);
-- Sample Dust Control Recommendations -- Sample Dust Control Recommendations
INSERT INTO trx_dust_control_recommendations (recommendation_id, measurement_detail_id, control_type, control_description, priority, estimated_cost, estimated_reduction, implementation_status, input_date, input_user) INSERT INTO dust_control_recommendations (DustControlRecommendationID, ParticulateMeasurementDetailID, DustControlRecommendationType, DustControlRecommendationDescription, DustControlRecommendationPriority, DustControlRecommendationEstimatedCost, DustControlRecommendationEstimatedReduction, DustControlRecommendationStatus, DustControlRecommendationCreatedAt, DustControlRecommendationCreatedUserID)
VALUES VALUES
-- Recommendations for Production Area (Crusher Unit) -- Recommendations for Production Area (Crusher Unit)
(1, 3, 'Engineering Control', 'Installation of water spray systems at crusher loading and discharge points', 1, 45000000.00, 30.0, 'PLANNED', '2024-06-20 09:00:00', 'analyst'), (1, 3, 'Engineering Control', 'Installation of water spray systems at crusher loading and discharge points', 1, 45000000.00, 30.0, 'PLANNED', '2024-06-20 09:00:00', 1),
(2, 3, 'Engineering Control', 'Enclosure of crushing and screening equipment with appropriate dust collection', 1, 120000000.00, 50.0, 'PLANNED', '2024-06-20 09:05:00', 'analyst'), (2, 3, 'Engineering Control', 'Enclosure of crushing and screening equipment with appropriate dust collection', 1, 120000000.00, 50.0, 'PLANNED', '2024-06-20 09:05:00', 1),
(3, 3, 'Administrative Control', 'Implement preventive maintenance program for dust collection systems', 2, 0.00, 15.0, 'PLANNED', '2024-06-20 09:10:00', 'analyst'), (3, 3, 'Administrative Control', 'Implement preventive maintenance program for dust collection systems', 2, 0.00, 15.0, 'PLANNED', '2024-06-20 09:10:00', 1),
(4, 4, 'PPE', 'Provision of N95 respirators for workers in crushing area', 1, 15000000.00, 0.0, 'PLANNED', '2024-06-20 09:15:00', 'analyst'), (4, 4, 'PPE', 'Provision of N95 respirators for workers in crushing area', 1, 15000000.00, 0.0, 'PLANNED', '2024-06-20 09:15:00', 1),
-- Recommendations for Material Storage Area -- Recommendations for Material Storage Area
(5, 9, 'Engineering Control', 'Installation of wind barriers around material storage area', 1, 75000000.00, 25.0, 'PLANNED', '2024-06-20 09:20:00', 'analyst'), (5, 9, 'Engineering Control', 'Installation of wind barriers around material storage area', 1, 75000000.00, 25.0, 'PLANNED', '2024-06-20 09:20:00', 1),
(6, 9, 'Engineering Control', 'Coverage of stockpiles with tarpaulins or other appropriate materials', 1, 30000000.00, 35.0, 'PLANNED', '2024-06-20 09:25:00', 'analyst'), (6, 9, 'Engineering Control', 'Coverage of stockpiles with tarpaulins or other appropriate materials', 1, 30000000.00, 35.0, 'PLANNED', '2024-06-20 09:25:00', 1),
(7, 9, 'Engineering Control', 'Installation of fixed water sprinkler system for storage area', 2, 60000000.00, 30.0, 'PLANNED', '2024-06-20 09:30:00', 'analyst'), (7, 9, 'Engineering Control', 'Installation of fixed water sprinkler system for storage area', 2, 60000000.00, 30.0, 'PLANNED', '2024-06-20 09:30:00', 1),
(8, 9, 'Administrative Control', 'Implement SOP for minimizing drop heights during material transfer', 1, 5000000.00, 10.0, 'PLANNED', '2024-06-20 09:35:00', 'analyst'), (8, 9, 'Administrative Control', 'Implement SOP for minimizing drop heights during material transfer', 1, 5000000.00, 10.0, 'PLANNED', '2024-06-20 09:35:00', 1),
-- Recommendations for Nearest Residential Area -- Recommendations for Nearest Residential Area
(9, 11, 'Engineering Control', 'Establishment of vegetation buffer zone between facility and residential areas', 1, 90000000.00, 15.0, 'PLANNED', '2024-06-20 09:40:00', 'analyst'), (9, 11, 'Engineering Control', 'Establishment of vegetation buffer zone between facility and residential areas', 1, 90000000.00, 15.0, 'PLANNED', '2024-06-20 09:40:00', 1),
(10, 11, 'Engineering Control', 'Paving of unpaved roads near residential boundary', 2, 120000000.00, 20.0, 'PLANNED', '2024-06-20 09:45:00', 'analyst'), (10, 11, 'Engineering Control', 'Paving of unpaved roads near residential boundary', 2, 120000000.00, 20.0, 'PLANNED', '2024-06-20 09:45:00', 1),
(11, 11, 'Administrative Control', 'Implementation of community notification system for high-dust activities', 1, 25000000.00, 0.0, 'PLANNED', '2024-06-20 09:50:00', 'analyst'), (11, 11, 'Administrative Control', 'Implementation of community notification system for high-dust activities', 1, 25000000.00, 0.0, 'PLANNED', '2024-06-20 09:50:00', 1),
(12, 11, 'Administrative Control', 'Schedule dust-generating activities based on wind direction and speed', 1, 0.00, 10.0, 'PLANNED', '2024-06-20 09:55:00', 'analyst'); (12, 11, 'Administrative Control', 'Schedule dust-generating activities based on wind direction and speed', 1, 0.00, 10.0, 'PLANNED', '2024-06-20 09:55:00', 1);

View File

@@ -3,217 +3,241 @@
-- Master Regulations Table -- Master Regulations Table
CREATE TABLE master_regulations ( CREATE TABLE master_regulations (
regulation_id INT PRIMARY KEY AUTO_INCREMENT, MasterRegulationID INT PRIMARY KEY AUTO_INCREMENT,
regulation_code VARCHAR(50) NOT NULL, MasterRegulationCode VARCHAR(50) NOT NULL,
regulation_name VARCHAR(200) NOT NULL, MasterRegulationName VARCHAR(200) NOT NULL,
issuing_authority VARCHAR(100) NOT NULL, MasterRegulationIssuingAuthority VARCHAR(100) NOT NULL,
regulation_type VARCHAR(50), MasterRegulationType VARCHAR(50),
issue_date DATE, MasterRegulationIssueDate DATE,
effective_date DATE, MasterRegulationEffectiveDate DATE,
description TEXT, MasterRegulationDescription TEXT,
file_path VARCHAR(255), MasterRegulationFilePath VARCHAR(255),
is_active BOOLEAN DEFAULT TRUE, MasterRegulationIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterRegulationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterRegulationCreatedUserID INT,
MasterRegulationUpdatedAt DATETIME,
MasterRegulationUpdatedUserID INT,
MasterRegulationDeletedAt DATETIME,
MasterRegulationDeletedUserID INT
); );
-- Master Climate Parameters Table -- Master Climate Parameters Table
CREATE TABLE master_climate_parameters ( CREATE TABLE master_climate_parameters (
parameter_id INT PRIMARY KEY AUTO_INCREMENT, MasterClimateParameterID INT PRIMARY KEY AUTO_INCREMENT,
parameter_code VARCHAR(50) NOT NULL, MasterClimateParameterCode VARCHAR(50) NOT NULL,
parameter_name VARCHAR(100) NOT NULL, MasterClimateParameterName VARCHAR(100) NOT NULL,
parameter_group VARCHAR(50), -- Physical, Chemical, Biological MasterClimateParameterGroup VARCHAR(50),
unit VARCHAR(20), MasterClimateParameterUnit VARCHAR(20),
analysis_method VARCHAR(100), MasterClimateParameterMethod VARCHAR(100),
description TEXT, MasterClimateParameterDescription TEXT,
price DECIMAL(12, 2), MasterClimateParameterPrice DECIMAL(12,2),
is_active BOOLEAN DEFAULT TRUE, MasterClimateParameterIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterClimateParameterCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterClimateParameterCreatedUserID INT,
MasterClimateParameterUpdatedAt DATETIME,
MasterClimateParameterUpdatedUserID INT,
MasterClimateParameterDeletedAt DATETIME,
MasterClimateParameterDeletedUserID INT
); );
-- Master Threshold Limit Values (TLV) Table -- Master Threshold Values Table
CREATE TABLE master_threshold_values ( CREATE TABLE master_threshold_values (
threshold_id INT PRIMARY KEY AUTO_INCREMENT, MasterThresholdValueID INT PRIMARY KEY AUTO_INCREMENT,
regulation_id INT, MasterRegulationID INT,
parameter_id INT, MasterClimateParameterID INT,
room_type VARCHAR(100) NOT NULL, MasterThresholdValueRoomType VARCHAR(100) NOT NULL,
min_value DECIMAL(8, 2), MasterThresholdValueMin DECIMAL(8,2),
max_value DECIMAL(8, 2), MasterThresholdValueMax DECIMAL(8,2),
unit VARCHAR(20), MasterThresholdValueUnit VARCHAR(20),
description TEXT, MasterThresholdValueDescription TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterThresholdValueIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterThresholdValueCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MasterThresholdValueCreatedUserID INT,
FOREIGN KEY (regulation_id) REFERENCES master_regulations(regulation_id), MasterThresholdValueUpdatedAt DATETIME,
FOREIGN KEY (parameter_id) REFERENCES master_climate_parameters(parameter_id) MasterThresholdValueUpdatedUserID INT,
MasterThresholdValueDeletedAt DATETIME,
MasterThresholdValueDeletedUserID INT
); );
-- Master Clients Table -- Master Clients Table
CREATE TABLE master_clients ( CREATE TABLE master_clients (
client_id INT PRIMARY KEY AUTO_INCREMENT, MasterClientID INT PRIMARY KEY AUTO_INCREMENT,
client_code VARCHAR(50) NOT NULL, MasterClientCode VARCHAR(50) NOT NULL,
client_name VARCHAR(200) NOT NULL, MasterClientName VARCHAR(200) NOT NULL,
address TEXT, MasterClientAddress TEXT,
city VARCHAR(100), MasterClientCity VARCHAR(100),
province VARCHAR(100), MasterClientProvince VARCHAR(100),
postal_code VARCHAR(20), MasterClientPostalCode VARCHAR(20),
phone_number VARCHAR(50), MasterClientPhoneNumber VARCHAR(50),
email VARCHAR(100), MasterClientEmail VARCHAR(100),
contact_person VARCHAR(100), MasterClientContactPerson VARCHAR(100),
contact_position VARCHAR(100), MasterClientContactPosition VARCHAR(100),
business_field VARCHAR(100), MasterClientBusinessField VARCHAR(100),
is_active BOOLEAN DEFAULT TRUE, MasterClientIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterClientCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterClientCreatedUserID INT,
MasterClientUpdatedAt DATETIME,
MasterClientUpdatedUserID INT,
MasterClientDeletedAt DATETIME,
MasterClientDeletedUserID INT
); );
-- Master Personnel Table (Sampling Officers, Analysts, etc.) -- Master Personnel Table
CREATE TABLE master_personnel ( CREATE TABLE master_personnel (
personnel_id INT PRIMARY KEY AUTO_INCREMENT, MasterPersonnelID INT PRIMARY KEY AUTO_INCREMENT,
employee_id VARCHAR(50) NOT NULL, MasterPersonnelEmployeeID VARCHAR(50) NOT NULL,
name VARCHAR(100) NOT NULL, MasterPersonnelName VARCHAR(100) NOT NULL,
position VARCHAR(100), MasterPersonnelPosition VARCHAR(100),
department VARCHAR(100), MasterPersonnelDepartment VARCHAR(100),
email VARCHAR(100), MasterPersonnelEmail VARCHAR(100),
phone_number VARCHAR(50), MasterPersonnelPhoneNumber VARCHAR(50),
certifications TEXT, MasterPersonnelCertifications TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterPersonnelIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterPersonnelCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP MasterPersonnelCreatedUserID INT,
MasterPersonnelUpdatedAt DATETIME,
MasterPersonnelUpdatedUserID INT,
MasterPersonnelDeletedAt DATETIME,
MasterPersonnelDeletedUserID INT
); );
-- Master Measurement Equipment Table -- Master Equipment Table
CREATE TABLE master_equipment ( CREATE TABLE master_equipment (
equipment_id INT PRIMARY KEY AUTO_INCREMENT, MasterEquipmentID INT PRIMARY KEY AUTO_INCREMENT,
equipment_code VARCHAR(50) NOT NULL, MasterEquipmentCode VARCHAR(50) NOT NULL,
equipment_name VARCHAR(100) NOT NULL, MasterEquipmentName VARCHAR(100) NOT NULL,
brand VARCHAR(100), MasterEquipmentBrand VARCHAR(100),
model VARCHAR(100), MasterEquipmentModel VARCHAR(100),
serial_number VARCHAR(100), MasterEquipmentSerialNumber VARCHAR(100),
calibration_date DATE, MasterEquipmentCalibrationDate DATE,
next_calibration_date DATE, MasterEquipmentNextCalibrationDate DATE,
parameter_id INT, MasterClimateParameterID INT,
specifications TEXT, MasterEquipmentSpecifications TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterEquipmentIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterEquipmentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MasterEquipmentCreatedUserID INT,
FOREIGN KEY (parameter_id) REFERENCES master_climate_parameters(parameter_id) MasterEquipmentUpdatedAt DATETIME,
MasterEquipmentUpdatedUserID INT,
MasterEquipmentDeletedAt DATETIME,
MasterEquipmentDeletedUserID INT
); );
-- Master Sampling Locations Table -- Master Sampling Locations Table
CREATE TABLE master_sampling_locations ( CREATE TABLE master_sampling_locations (
location_id INT PRIMARY KEY AUTO_INCREMENT, MasterSamplingLocationID INT PRIMARY KEY AUTO_INCREMENT,
client_id INT, MasterClientID INT,
location_name VARCHAR(200) NOT NULL, MasterSamplingLocationName VARCHAR(200) NOT NULL,
address TEXT, MasterSamplingLocationAddress TEXT,
latitude DECIMAL(10, 8), MasterSamplingLocationLatitude DECIMAL(10,8),
longitude DECIMAL(11, 8), MasterSamplingLocationLongitude DECIMAL(11,8),
room_type VARCHAR(100), MasterSamplingLocationRoomType VARCHAR(100),
description TEXT, MasterSamplingLocationDescription TEXT,
is_active BOOLEAN DEFAULT TRUE, MasterSamplingLocationIsActive BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MasterSamplingLocationCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MasterSamplingLocationCreatedUserID INT,
FOREIGN KEY (client_id) REFERENCES master_clients(client_id) MasterSamplingLocationUpdatedAt DATETIME,
MasterSamplingLocationUpdatedUserID INT,
MasterSamplingLocationDeletedAt DATETIME,
MasterSamplingLocationDeletedUserID INT
); );
-- Measurement Requests Table (Request Form) -- Measurement Requests Table
CREATE TABLE measurement_requests ( CREATE TABLE measurement_requests (
request_id INT PRIMARY KEY AUTO_INCREMENT, MeasurementRequestID INT PRIMARY KEY AUTO_INCREMENT,
request_number VARCHAR(50) NOT NULL, MeasurementRequestNumber VARCHAR(50) NOT NULL,
client_id INT, MasterClientID INT,
request_date DATE, MeasurementRequestDate DATE,
planned_sampling_date DATE, MeasurementRequestPlannedDate DATE,
contact_person VARCHAR(100), MeasurementRequestContactPerson VARCHAR(100),
status VARCHAR(50), -- draft, submitted, approved, scheduled, completed, canceled MeasurementRequestStatus VARCHAR(50),
notes TEXT, MeasurementRequestNotes TEXT,
created_by INT, MeasurementRequestCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
approved_by INT, MeasurementRequestCreatedUserID INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MeasurementRequestUpdatedAt DATETIME,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MeasurementRequestUpdatedUserID INT,
FOREIGN KEY (client_id) REFERENCES master_clients(client_id), MeasurementRequestDeletedAt DATETIME,
FOREIGN KEY (created_by) REFERENCES master_personnel(personnel_id), MeasurementRequestDeletedUserID INT,
FOREIGN KEY (approved_by) REFERENCES master_personnel(personnel_id) MeasurementRequestApprovedByID INT
); );
-- Measurement Request Details Table -- Measurement Request Details Table
CREATE TABLE measurement_request_details ( CREATE TABLE measurement_request_details (
detail_id INT PRIMARY KEY AUTO_INCREMENT, MeasurementRequestDetailID INT PRIMARY KEY AUTO_INCREMENT,
request_id INT, MeasurementRequestID INT,
parameter_id INT, MasterClimateParameterID INT,
location_id INT, MasterSamplingLocationID INT,
points_count INT DEFAULT 1, MeasurementRequestDetailPointCount INT DEFAULT 1,
unit_price DECIMAL(12, 2), MeasurementRequestDetailUnitPrice DECIMAL(12,2),
subtotal DECIMAL(12, 2), MeasurementRequestDetailSubtotal DECIMAL(12,2),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MeasurementRequestDetailCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MeasurementRequestDetailCreatedUserID INT,
FOREIGN KEY (request_id) REFERENCES measurement_requests(request_id), MeasurementRequestDetailUpdatedAt DATETIME,
FOREIGN KEY (parameter_id) REFERENCES master_climate_parameters(parameter_id), MeasurementRequestDetailUpdatedUserID INT,
FOREIGN KEY (location_id) REFERENCES master_sampling_locations(location_id) MeasurementRequestDetailDeletedAt DATETIME,
MeasurementRequestDetailDeletedUserID INT
); );
-- Measurement Schedules Table -- Measurement Schedules Table
CREATE TABLE measurement_schedules ( CREATE TABLE measurement_schedules (
schedule_id INT PRIMARY KEY AUTO_INCREMENT, MeasurementScheduleID INT PRIMARY KEY AUTO_INCREMENT,
schedule_number VARCHAR(50) NOT NULL, MeasurementScheduleNumber VARCHAR(50) NOT NULL,
request_id INT, MeasurementRequestID INT,
measurement_date DATE, MeasurementScheduleDate DATE,
officer_id INT, MasterPersonnelID INT,
status VARCHAR(50), -- scheduled, completed, rescheduled, canceled MeasurementScheduleStatus VARCHAR(50),
notes TEXT, MeasurementScheduleNotes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MeasurementScheduleCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MeasurementScheduleCreatedUserID INT,
FOREIGN KEY (request_id) REFERENCES measurement_requests(request_id), MeasurementScheduleUpdatedAt DATETIME,
FOREIGN KEY (officer_id) REFERENCES master_personnel(personnel_id) MeasurementScheduleUpdatedUserID INT,
MeasurementScheduleDeletedAt DATETIME,
MeasurementScheduleDeletedUserID INT
); );
-- Test Reports Table -- Test Reports Table
CREATE TABLE test_reports ( CREATE TABLE test_reports (
report_id INT PRIMARY KEY AUTO_INCREMENT, TestReportID INT PRIMARY KEY AUTO_INCREMENT,
report_number VARCHAR(50) NOT NULL, TestReportNumber VARCHAR(50) NOT NULL,
request_id INT, MeasurementRequestID INT,
schedule_id INT, MeasurementScheduleID INT,
measurement_date DATE, TestReportMeasurementDate DATE,
issue_date DATE, TestReportIssueDate DATE,
client_id INT, MasterClientID INT,
officer_id INT, MasterPersonnelID INT,
verified_by INT, TestReportVerifiedByID INT,
approved_by INT, TestReportApprovedByID INT,
status VARCHAR(50), -- draft, verification, approved, published, revised TestReportStatus VARCHAR(50),
page_count INT DEFAULT 1, TestReportPageCount INT DEFAULT 1,
notes TEXT, TestReportNotes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, TestReportCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, TestReportCreatedUserID INT,
FOREIGN KEY (request_id) REFERENCES measurement_requests(request_id), TestReportUpdatedAt DATETIME,
FOREIGN KEY (schedule_id) REFERENCES measurement_schedules(schedule_id), TestReportUpdatedUserID INT,
FOREIGN KEY (client_id) REFERENCES master_clients(client_id), TestReportDeletedAt DATETIME,
FOREIGN KEY (officer_id) REFERENCES master_personnel(personnel_id), TestReportDeletedUserID INT
FOREIGN KEY (verified_by) REFERENCES master_personnel(personnel_id),
FOREIGN KEY (approved_by) REFERENCES master_personnel(personnel_id)
); );
-- Temperature Measurement Results Table -- Temperature Measurement Results Table
CREATE TABLE temperature_measurement_results ( CREATE TABLE temperature_measurement_results (
result_id INT PRIMARY KEY AUTO_INCREMENT, TemperatureMeasurementResultID INT PRIMARY KEY AUTO_INCREMENT,
report_id INT, TestReportID INT,
location_id INT, MasterSamplingLocationID INT,
sample_code VARCHAR(50) NOT NULL, TemperatureMeasurementResultSampleCode VARCHAR(50) NOT NULL,
measurement_time_start TIME, TemperatureMeasurementResultStartTime TIME,
measurement_time_end TIME, TemperatureMeasurementResultEndTime TIME,
parameter_id INT, MasterClimateParameterID INT,
measurement_value DECIMAL(8, 2), TemperatureMeasurementResultValue DECIMAL(8,2),
unit VARCHAR(20), TemperatureMeasurementResultUnit VARCHAR(20),
method VARCHAR(100), TemperatureMeasurementResultMethod VARCHAR(100),
threshold_id INT, MasterThresholdValueID INT,
notes TEXT, TemperatureMeasurementResultNotes TEXT,
equipment_id INT, MasterEquipmentID INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, TemperatureMeasurementResultCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, TemperatureMeasurementResultCreatedUserID INT,
FOREIGN KEY (report_id) REFERENCES test_reports(report_id), TemperatureMeasurementResultUpdatedAt DATETIME,
FOREIGN KEY (location_id) REFERENCES master_sampling_locations(location_id), TemperatureMeasurementResultUpdatedUserID INT,
FOREIGN KEY (parameter_id) REFERENCES master_climate_parameters(parameter_id), TemperatureMeasurementResultDeletedAt DATETIME,
FOREIGN KEY (threshold_id) REFERENCES master_threshold_values(threshold_id), TemperatureMeasurementResultDeletedUserID INT
FOREIGN KEY (equipment_id) REFERENCES master_equipment(equipment_id)
); );
-- ================================ -- ================================
@@ -221,19 +245,32 @@ CREATE TABLE temperature_measurement_results (
-- ================================ -- ================================
-- Insert Regulations -- Insert Regulations
INSERT INTO master_regulations (regulation_id, regulation_code, regulation_name, issuing_authority, regulation_type, issue_date, effective_date, description, file_path, is_active) VALUES INSERT INTO master_regulations (
(1, 'PMK-02-2023', 'Ministry of Health Regulation No. 2 Year 2023', 'Ministry of Health of Indonesia', 'Ministerial Regulation', '2023-01-20', '2023-02-01', 'Regulation on Environmental Health Quality Standards and Health Requirements', '/documents/regulations/PMK_02_2023.pdf', TRUE), MasterRegulationID,
(2, 'PERMENAKER-05-2018', 'Ministry of Manpower Regulation No. 5 Year 2018', 'Ministry of Manpower of Indonesia', 'Ministerial Regulation', '2018-04-25', '2018-05-10', 'Regulation on Occupational Safety and Health for the Work Environment', '/documents/regulations/PERMENAKER_05_2018.pdf', TRUE); MasterRegulationCode,
MasterRegulationName,
MasterRegulationIssuingAuthority,
MasterRegulationType,
MasterRegulationIssueDate,
MasterRegulationEffectiveDate,
MasterRegulationDescription,
MasterRegulationFilePath,
MasterRegulationIsActive
) VALUES (
1, 'PMK-02-2023', 'Ministry of Health Regulation No. 2 Year 2023', 'Ministry of Health of Indonesia', 'Ministerial Regulation', '2023-01-20', '2023-02-01', 'Regulation on Environmental Health Quality Standards and Health Requirements', '/documents/regulations/PMK_02_2023.pdf', TRUE
), (
2, 'PERMENAKER-05-2018', 'Ministry of Manpower Regulation No. 5 Year 2018', 'Ministry of Manpower of Indonesia', 'Ministerial Regulation', '2018-04-25', '2018-05-10', 'Regulation on Occupational Safety and Health for the Work Environment', '/documents/regulations/PERMENAKER_05_2018.pdf', TRUE
);
-- Insert Climate Parameters -- Insert Climate Parameters
INSERT INTO master_climate_parameters (parameter_id, parameter_code, parameter_name, parameter_group, unit, analysis_method, description, price, is_active) VALUES INSERT INTO master_climate_parameters (MasterClimateParameterID, MasterClimateParameterCode, MasterClimateParameterName, MasterClimateParameterGroup, MasterClimateParameterUnit, MasterClimateParameterMethod, MasterClimateParameterDescription, MasterClimateParameterPrice, MasterClimateParameterIsActive) VALUES
(1, 'TEMP', 'Temperature', 'Physical', '°C', 'SNI 7062: 2019', 'Work climate parameter for room temperature measurement', 75000.00, TRUE), (1, 'TEMP', 'Temperature', 'Physical', '°C', 'SNI 7062: 2019', 'Work climate parameter for room temperature measurement', 75000.00, TRUE),
(2, 'HUMID', 'Humidity', 'Physical', '%RH', 'SNI 7062: 2019', 'Work climate parameter for relative humidity measurement', 75000.00, TRUE), (2, 'HUMID', 'Humidity', 'Physical', '%RH', 'SNI 7062: 2019', 'Work climate parameter for relative humidity measurement', 75000.00, TRUE),
(3, 'WBGT', 'Wet Bulb Globe Temperature', 'Physical', '°C', 'SNI 7062: 2019', 'Work climate parameter for indoor/outdoor WBGT measurement', 100000.00, TRUE), (3, 'WBGT', 'Wet Bulb Globe Temperature', 'Physical', '°C', 'SNI 7062: 2019', 'Work climate parameter for indoor/outdoor WBGT measurement', 100000.00, TRUE),
(4, 'AIRVEL', 'Air Velocity', 'Physical', 'm/s', 'SNI 7062: 2019', 'Work climate parameter for air velocity measurement', 75000.00, TRUE); (4, 'AIRVEL', 'Air Velocity', 'Physical', 'm/s', 'SNI 7062: 2019', 'Work climate parameter for air velocity measurement', 75000.00, TRUE);
-- Insert Threshold Values for Temperature -- Insert Threshold Values for Temperature
INSERT INTO master_threshold_values (threshold_id, regulation_id, parameter_id, room_type, min_value, max_value, unit, description, is_active) VALUES INSERT INTO master_threshold_values (MasterThresholdValueID, MasterRegulationID, MasterClimateParameterID, MasterThresholdValueRoomType, MasterThresholdValueMin, MasterThresholdValueMax, MasterThresholdValueUnit, MasterThresholdValueDescription, MasterThresholdValueIsActive) VALUES
(1, 1, 1, 'Administration', 20.00, 25.00, '°C', 'Administration and office work area', TRUE), (1, 1, 1, 'Administration', 20.00, 25.00, '°C', 'Administration and office work area', TRUE),
(2, 1, 1, 'Special Room', 18.00, 24.00, '°C', 'Server room, laboratory, etc.', TRUE), (2, 1, 1, 'Special Room', 18.00, 24.00, '°C', 'Server room, laboratory, etc.', TRUE),
(3, 1, 1, 'Production', 23.00, 26.00, '°C', 'Production area', TRUE), (3, 1, 1, 'Production', 23.00, 26.00, '°C', 'Production area', TRUE),
@@ -242,27 +279,27 @@ INSERT INTO master_threshold_values (threshold_id, regulation_id, parameter_id,
(6, 1, 1, 'Storage', 16.00, 30.00, '°C', 'Storage room, warehouse', TRUE); (6, 1, 1, 'Storage', 16.00, 30.00, '°C', 'Storage room, warehouse', TRUE);
-- Insert Clients -- Insert Clients
INSERT INTO master_clients (client_id, client_code, client_name, address, city, province, postal_code, phone_number, email, contact_person, contact_position, business_field, is_active) VALUES INSERT INTO master_clients (MasterClientID, MasterClientCode, MasterClientName, MasterClientAddress, MasterClientCity, MasterClientProvince, MasterClientPostalCode, MasterClientPhoneNumber, MasterClientEmail, MasterClientContactPerson, MasterClientContactPosition, MasterClientBusinessField, MasterClientIsActive) VALUES
(1, 'CLT-001', 'PT. Indonesia Manufacturing Industry', 'Jl. Industry Raya No. 123', 'Jakarta', 'DKI Jakarta', '12950', '021-5551234', 'contact@manufacturingindonesia.com', 'Budi Santoso', 'HSE Manager', 'Manufacturing', TRUE), (1, 'CLT-001', 'PT. Indonesia Manufacturing Industry', 'Jl. Industry Raya No. 123', 'Jakarta', 'DKI Jakarta', '12950', '021-5551234', 'contact@manufacturingindonesia.com', 'Budi Santoso', 'HSE Manager', 'Manufacturing', TRUE),
(2, 'CLT-002', 'PT. Digital Technology Nusantara', 'Jl. Gatot Subroto Kav. 52-53', 'Jakarta', 'DKI Jakarta', '12710', '021-5552345', 'hrd@dtn.co.id', 'Siti Rahma', 'HR Director', 'Information Technology', TRUE), (2, 'CLT-002', 'PT. Digital Technology Nusantara', 'Jl. Gatot Subroto Kav. 52-53', 'Jakarta', 'DKI Jakarta', '12710', '021-5552345', 'hrd@dtn.co.id', 'Siti Rahma', 'HR Director', 'Information Technology', TRUE),
(3, 'CLT-003', 'City Public Hospital', 'Jl. Health No. 45', 'Bandung', 'West Java', '40112', '022-7654321', 'info@cityhospital.go.id', 'Dr. Ahmad Hidayat', 'Director', 'Healthcare', TRUE); (3, 'CLT-003', 'City Public Hospital', 'Jl. Health No. 45', 'Bandung', 'West Java', '40112', '022-7654321', 'info@cityhospital.go.id', 'Dr. Ahmad Hidayat', 'Director', 'Healthcare', TRUE);
-- Insert Personnel -- Insert Personnel
INSERT INTO master_personnel (personnel_id, employee_id, name, position, department, email, phone_number, certifications, is_active) VALUES INSERT INTO master_personnel (MasterPersonnelID, MasterPersonnelEmployeeID, MasterPersonnelName, MasterPersonnelPosition, MasterPersonnelDepartment, MasterPersonnelEmail, MasterPersonnelPhoneNumber, MasterPersonnelCertifications, MasterPersonnelIsActive) VALUES
(1, 'EMP-001', 'Hendra Wijaya', 'Testing Supervisor', 'Laboratory', 'hendra@lab-env.co.id', '081234567890', 'Work Environment Sampling Certification', TRUE), (1, 'EMP-001', 'Hendra Wijaya', 'Testing Supervisor', 'Laboratory', 'hendra@lab-env.co.id', '081234567890', 'Work Environment Sampling Certification', TRUE),
(2, 'EMP-002', 'Ratna Dewi', 'Senior Analyst', 'Laboratory', 'ratna@lab-env.co.id', '081234567891', 'Laboratory Analyst Certification, General OSH Certification', TRUE), (2, 'EMP-002', 'Ratna Dewi', 'Senior Analyst', 'Laboratory', 'ratna@lab-env.co.id', '081234567891', 'Laboratory Analyst Certification, General OSH Certification', TRUE),
(3, 'EMP-003', 'Deni Hermawan', 'Sampling Officer', 'Laboratory', 'deni@lab-env.co.id', '081234567892', 'Test Sample Collection Certification', TRUE), (3, 'EMP-003', 'Deni Hermawan', 'Sampling Officer', 'Laboratory', 'deni@lab-env.co.id', '081234567892', 'Test Sample Collection Certification', TRUE),
(4, 'EMP-004', 'Farida Nurhasanah', 'Laboratory Manager', 'Laboratory', 'farida@lab-env.co.id', '081234567893', 'Quality Manager Certification, OSH Certification', TRUE); (4, 'EMP-004', 'Farida Nurhasanah', 'Laboratory Manager', 'Laboratory', 'farida@lab-env.co.id', '081234567893', 'Quality Manager Certification, OSH Certification', TRUE);
-- Insert Measurement Equipment -- Insert Measurement Equipment
INSERT INTO master_equipment (equipment_id, equipment_code, equipment_name, brand, model, serial_number, calibration_date, next_calibration_date, parameter_id, specifications, is_active) VALUES INSERT INTO master_equipment (MasterEquipmentID, MasterEquipmentCode, MasterEquipmentName, MasterEquipmentBrand, MasterEquipmentModel, MasterEquipmentSerialNumber, MasterEquipmentCalibrationDate, MasterEquipmentNextCalibrationDate, MasterClimateParameterID, MasterEquipmentSpecifications, MasterEquipmentIsActive) VALUES
(1, 'EQP-TH001', 'Thermohygrometer', 'Lutron', 'PHB-318', 'LT12345678', '2023-11-10', '2024-05-10', 1, 'Temperature range: -20°C to 60°C, accuracy ±0.8°C', TRUE), (1, 'EQP-TH001', 'Thermohygrometer', 'Lutron', 'PHB-318', 'LT12345678', '2023-11-10', '2024-05-10', 1, 'Temperature range: -20°C to 60°C, accuracy ±0.8°C', TRUE),
(2, 'EQP-TH002', 'Thermohygrometer', 'Extech', 'RHT50', 'EX87654321', '2023-10-15', '2024-04-15', 1, 'Temperature range: -30°C to 70°C, accuracy ±0.5°C', TRUE), (2, 'EQP-TH002', 'Thermohygrometer', 'Extech', 'RHT50', 'EX87654321', '2023-10-15', '2024-04-15', 1, 'Temperature range: -30°C to 70°C, accuracy ±0.5°C', TRUE),
(3, 'EQP-WBGT001', 'WBGT Meter', 'Lutron', 'WBGT-2010SD', 'LW12348765', '2023-11-05', '2024-05-05', 3, 'WBGT range: 15°C to 59°C, accuracy ±0.8°C', TRUE), (3, 'EQP-WBGT001', 'WBGT Meter', 'Lutron', 'WBGT-2010SD', 'LW12348765', '2023-11-05', '2024-05-05', 3, 'WBGT range: 15°C to 59°C, accuracy ±0.8°C', TRUE),
(4, 'EQP-ANM001', 'Anemometer', 'Lutron', 'AM-4214SD', 'LA23456789', '2023-09-20', '2024-03-20', 4, 'Air velocity range: 0.2 m/s to 35 m/s, accuracy ±2%', TRUE); (4, 'EQP-ANM001', 'Anemometer', 'Lutron', 'AM-4214SD', 'LA23456789', '2023-09-20', '2024-03-20', 4, 'Air velocity range: 0.2 m/s to 35 m/s, accuracy ±2%', TRUE);
-- Insert Sampling Locations for PT. Indonesia Manufacturing Industry -- Insert Sampling Locations for PT. Indonesia Manufacturing Industry
INSERT INTO master_sampling_locations (location_id, client_id, location_name, address, room_type, description, is_active) VALUES INSERT INTO master_sampling_locations (MasterSamplingLocationID, MasterClientID, MasterSamplingLocationName, MasterSamplingLocationAddress, MasterSamplingLocationRoomType, MasterSamplingLocationDescription, MasterSamplingLocationIsActive) VALUES
(1, 1, 'Main Meeting Room', 'Floor 2, Main Building', 'Administration', 'Meeting room with 20 person capacity', TRUE), (1, 1, 'Main Meeting Room', 'Floor 2, Main Building', 'Administration', 'Meeting room with 20 person capacity', TRUE),
(2, 1, 'HR Work Area', 'Floor 2, Main Building', 'Administration', 'HR staff work area', TRUE), (2, 1, 'HR Work Area', 'Floor 2, Main Building', 'Administration', 'HR staff work area', TRUE),
(3, 1, 'Server Room', 'Floor 1, Main Building', 'Special Room', 'Server room with special cooling', TRUE), (3, 1, 'Server Room', 'Floor 1, Main Building', 'Special Room', 'Server room with special cooling', TRUE),
@@ -274,29 +311,29 @@ INSERT INTO master_sampling_locations (location_id, client_id, location_name, ad
-- ================================ -- ================================
-- Measurement Request Example -- Measurement Request Example
INSERT INTO measurement_requests (request_id, request_number, client_id, request_date, planned_sampling_date, contact_person, status, notes, created_by, approved_by) VALUES INSERT INTO measurement_requests (MeasurementRequestID, MeasurementRequestNumber, MasterClientID, MeasurementRequestDate, MeasurementRequestPlannedDate, MeasurementRequestContactPerson, MeasurementRequestStatus, MeasurementRequestNotes, MeasurementRequestCreatedUserID, MeasurementRequestApprovedByID) VALUES
(1, 'REQ/2024/04/001', 1, '2024-04-05', '2024-04-25', 'Budi Santoso', 'approved', 'Quarterly routine measurement for work climate parameters', 3, 4); (1, 'REQ/2024/04/001', 1, '2024-04-05', '2024-04-25', 'Budi Santoso', 'approved', 'Quarterly routine measurement for work climate parameters', 3, 4);
-- Request Details -- Request Details
INSERT INTO measurement_request_details (detail_id, request_id, parameter_id, location_id, points_count, unit_price, subtotal) VALUES INSERT INTO measurement_request_details (MeasurementRequestDetailID, MeasurementRequestID, MasterClimateParameterID, MasterSamplingLocationID, MeasurementRequestDetailPointCount, MeasurementRequestDetailUnitPrice, MeasurementRequestDetailSubtotal, MeasurementRequestDetailCreatedUserID) VALUES
(1, 1, 1, 1, 1, 75000.00, 75000.00), (1, 1, 1, 1, 1, 75000.00, 75000.00, 3),
(2, 1, 1, 2, 1, 75000.00, 75000.00), (2, 1, 1, 2, 1, 75000.00, 75000.00, 3),
(3, 1, 1, 3, 1, 75000.00, 75000.00), (3, 1, 1, 3, 1, 75000.00, 75000.00, 3),
(4, 1, 1, 4, 1, 75000.00, 75000.00), (4, 1, 1, 4, 1, 75000.00, 75000.00, 3),
(5, 1, 1, 5, 1, 75000.00, 75000.00); (5, 1, 1, 5, 1, 75000.00, 75000.00, 3);
-- Measurement Schedule -- Measurement Schedule
INSERT INTO measurement_schedules (schedule_id, schedule_number, request_id, measurement_date, officer_id, status, notes) VALUES INSERT INTO measurement_schedules (MeasurementScheduleID, MeasurementScheduleNumber, MeasurementRequestID, MeasurementScheduleDate, MasterPersonnelID, MeasurementScheduleStatus, MeasurementScheduleNotes, MeasurementScheduleCreatedUserID) VALUES
(1, 'SCH/2024/04/001', 1, '2024-04-25', 3, 'completed', 'Measurement conducted during normal operating hours'); (1, 'SCH/2024/04/001', 1, '2024-04-25', 3, 'completed', 'Measurement conducted during normal operating hours', 3);
-- Test Report -- Test Report
INSERT INTO test_reports (report_id, report_number, request_id, schedule_id, measurement_date, issue_date, client_id, officer_id, verified_by, approved_by, status, page_count, notes) VALUES INSERT INTO test_reports (TestReportID, TestReportNumber, MeasurementRequestID, MeasurementScheduleID, TestReportMeasurementDate, TestReportIssueDate, MasterClientID, MasterPersonnelID, TestReportVerifiedByID, TestReportApprovedByID, TestReportStatus, TestReportPageCount, TestReportNotes, TestReportCreatedUserID) VALUES
(1, 'LHU/TEMP/04/2024/001', 1, 1, '2024-04-25', '2024-04-28', 1, 3, 2, 4, 'published', 2, 'Measurement results show all parameters within normal limits'); (1, 'LHU/TEMP/04/2024/001', 1, 1, '2024-04-25', '2024-04-28', 1, 3, 2, 4, 'published', 2, 'Measurement results show all parameters within normal limits', 3);
-- Temperature Measurement Results -- Temperature Measurement Results
INSERT INTO temperature_measurement_results (result_id, report_id, location_id, sample_code, measurement_time_start, measurement_time_end, parameter_id, measurement_value, unit, method, threshold_id, notes, equipment_id) VALUES INSERT INTO temperature_measurement_results (TemperatureMeasurementResultID, TestReportID, MasterSamplingLocationID, TemperatureMeasurementResultSampleCode, TemperatureMeasurementResultStartTime, TemperatureMeasurementResultEndTime, MasterClimateParameterID, TemperatureMeasurementResultValue, TemperatureMeasurementResultUnit, TemperatureMeasurementResultMethod, MasterThresholdValueID, TemperatureMeasurementResultNotes, MasterEquipmentID, TemperatureMeasurementResultCreatedUserID) VALUES
(1, 1, 1, 'C2504090001', '09:00:00', '09:15:00', 1, 21.00, '°C', 'SNI 7062: 2019', 1, NULL, 1), (1, 1, 1, 'C2504090001', '09:00:00', '09:15:00', 1, 21.00, '°C', 'SNI 7062: 2019', 1, NULL, 1, 3),
(2, 1, 2, 'C2504090002', '09:30:00', '09:45:00', 1, 22.00, '°C', 'SNI 7062: 2019', 1, NULL, 1), (2, 1, 2, 'C2504090002', '09:30:00', '09:45:00', 1, 22.00, '°C', 'SNI 7062: 2019', 1, NULL, 1, 3),
(3, 1, 3, 'C2504090003', '10:00:00', '10:15:00', 1, 19.00, '°C', 'SNI 7062: 2019', 2, NULL, 1), (3, 1, 3, 'C2504090003', '10:00:00', '10:15:00', 1, 19.00, '°C', 'SNI 7062: 2019', 2, NULL, 1, 3),
(4, 1, 4, 'C2504090004', '10:30:00', '10:45:00', 1, 26.00, '°C', 'SNI 7062: 2019', 3, NULL, 1), (4, 1, 4, 'C2504090004', '10:30:00', '10:45:00', 1, 26.00, '°C', 'SNI 7062: 2019', 3, NULL, 1, 3),
(5, 1, 5, 'C2504090005', '11:00:00', '11:15:00', 1, 24.00, '°C', 'SNI 7062: 2019', 4, NULL, 1); (5, 1, 5, 'C2504090005', '11:00:00', '11:15:00', 1, 24.00, '°C', 'SNI 7062: 2019', 4, NULL, 1, 3);