templ
This commit is contained in:
@@ -158,6 +158,73 @@ CREATE TABLE request_equipment (
|
|||||||
RequestEquipmentDeletedUserID INT
|
RequestEquipmentDeletedUserID INT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- Tabel Master Komponen Harga
|
||||||
|
CREATE TABLE price_components (
|
||||||
|
PriceComponentID INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
PriceComponentCode VARCHAR(20),
|
||||||
|
PriceComponentName VARCHAR(100),
|
||||||
|
PriceComponentDescription TEXT,
|
||||||
|
PriceComponentIsActive BOOLEAN DEFAULT TRUE,
|
||||||
|
PriceComponentCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PriceComponentCreatedUserID INT,
|
||||||
|
PriceComponentUpdatedAt DATETIME,
|
||||||
|
PriceComponentUpdatedUserID INT,
|
||||||
|
PriceComponentDeletedAt DATETIME,
|
||||||
|
PriceComponentDeletedUserID INT
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Tabel Master Template Quotation
|
||||||
|
CREATE TABLE quotation_templates (
|
||||||
|
QuotationTemplateID INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
QuotationTemplateName VARCHAR(100),
|
||||||
|
QuotationTemplateDescription TEXT,
|
||||||
|
QuotationTemplateHeader TEXT,
|
||||||
|
QuotationTemplateFooter TEXT,
|
||||||
|
QuotationTemplateTerms TEXT,
|
||||||
|
QuotationTemplateIsActive BOOLEAN DEFAULT TRUE,
|
||||||
|
QuotationTemplateCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
QuotationTemplateCreatedUserID INT,
|
||||||
|
QuotationTemplateUpdatedAt DATETIME,
|
||||||
|
QuotationTemplateUpdatedUserID INT,
|
||||||
|
QuotationTemplateDeletedAt DATETIME,
|
||||||
|
QuotationTemplateDeletedUserID INT
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Tabel Master Harga Default
|
||||||
|
CREATE TABLE default_prices (
|
||||||
|
DefaultPriceID INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
PriceComponentID INT,
|
||||||
|
DefaultPriceValue DECIMAL(10,2),
|
||||||
|
DefaultPriceStartDate DATE,
|
||||||
|
DefaultPriceEndDate DATE,
|
||||||
|
DefaultPriceIsActive BOOLEAN DEFAULT TRUE,
|
||||||
|
DefaultPriceCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
DefaultPriceCreatedUserID INT,
|
||||||
|
DefaultPriceUpdatedAt DATETIME,
|
||||||
|
DefaultPriceUpdatedUserID INT,
|
||||||
|
DefaultPriceDeletedAt DATETIME,
|
||||||
|
DefaultPriceDeletedUserID INT
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Tabel Master Diskon
|
||||||
|
CREATE TABLE discount_rules (
|
||||||
|
DiscountRuleID INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
DiscountRuleName VARCHAR(100),
|
||||||
|
DiscountRuleType ENUM('percentage', 'fixed_amount'),
|
||||||
|
DiscountRuleValue DECIMAL(10,2),
|
||||||
|
DiscountRuleMinAmount DECIMAL(10,2),
|
||||||
|
DiscountRuleMaxAmount DECIMAL(10,2),
|
||||||
|
DiscountRuleStartDate DATE,
|
||||||
|
DiscountRuleEndDate DATE,
|
||||||
|
DiscountRuleIsActive BOOLEAN DEFAULT TRUE,
|
||||||
|
DiscountRuleCreatedAt DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
DiscountRuleCreatedUserID INT,
|
||||||
|
DiscountRuleUpdatedAt DATETIME,
|
||||||
|
DiscountRuleUpdatedUserID INT,
|
||||||
|
DiscountRuleDeletedAt DATETIME,
|
||||||
|
DiscountRuleDeletedUserID INT
|
||||||
|
);
|
||||||
|
|
||||||
-- Contoh data template sampling
|
-- Contoh data template sampling
|
||||||
INSERT INTO sampling_templates (SamplingTemplateName, SamplingTemplateDescription) 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'),
|
||||||
@@ -193,3 +260,68 @@ INSERT INTO quotations (QuotationCode, ServiceRequestID, QuotationIssueDate, Quo
|
|||||||
('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);
|
||||||
|
|
||||||
|
-- Insert data untuk Price Components
|
||||||
|
INSERT INTO price_components (
|
||||||
|
PriceComponentID, PriceComponentCode, PriceComponentName,
|
||||||
|
PriceComponentDescription, PriceComponentIsActive,
|
||||||
|
PriceComponentCreatedUserID
|
||||||
|
) VALUES
|
||||||
|
(1, 'SAMP', 'Biaya Sampling',
|
||||||
|
'Biaya pengambilan sampel termasuk transportasi', TRUE, 1),
|
||||||
|
(2, 'TRANS', 'Biaya Transportasi Tambahan',
|
||||||
|
'Biaya transportasi untuk lokasi di luar kota', TRUE, 1),
|
||||||
|
(3, 'EQUIP', 'Biaya Sewa Peralatan',
|
||||||
|
'Biaya penggunaan peralatan khusus', TRUE, 1),
|
||||||
|
(4, 'RUSH', 'Biaya Rush Analysis',
|
||||||
|
'Biaya tambahan untuk analisis cepat', TRUE, 1),
|
||||||
|
(5, 'ADMIN', 'Biaya Administrasi',
|
||||||
|
'Biaya pembuatan laporan dan dokumentasi', TRUE, 1);
|
||||||
|
|
||||||
|
-- Insert data untuk Quotation Templates
|
||||||
|
INSERT INTO quotation_templates (
|
||||||
|
QuotationTemplateID, QuotationTemplateName,
|
||||||
|
QuotationTemplateDescription, QuotationTemplateHeader,
|
||||||
|
QuotationTemplateTerms, QuotationTemplateIsActive,
|
||||||
|
QuotationTemplateCreatedUserID
|
||||||
|
) VALUES
|
||||||
|
(1, 'Template Standar',
|
||||||
|
'Template quotation untuk pelanggan umum',
|
||||||
|
'Dengan hormat,\nBerdasarkan permintaan pengujian yang diajukan, berikut kami sampaikan penawaran harga:',
|
||||||
|
'1. Harga belum termasuk PPN 11%\n2. Pembayaran 50% di muka\n3. Hasil pengujian akan diserahkan dalam 7 hari kerja\n4. Penawaran berlaku 30 hari',
|
||||||
|
TRUE, 1),
|
||||||
|
(2, 'Template Pelanggan Tetap',
|
||||||
|
'Template quotation untuk pelanggan kontrak',
|
||||||
|
'Dengan hormat,\nSesuai dengan kontrak kerjasama, berikut penawaran harga pengujian:',
|
||||||
|
'1. Harga sudah termasuk PPN 11%\n2. Pembayaran 30 hari setelah invoice\n3. Hasil pengujian akan diserahkan dalam 5 hari kerja',
|
||||||
|
TRUE, 1);
|
||||||
|
|
||||||
|
-- Insert data untuk Default Prices
|
||||||
|
INSERT INTO default_prices (
|
||||||
|
DefaultPriceID, PriceComponentID, DefaultPriceValue,
|
||||||
|
DefaultPriceStartDate, DefaultPriceEndDate,
|
||||||
|
DefaultPriceIsActive, DefaultPriceCreatedUserID
|
||||||
|
) VALUES
|
||||||
|
(1, 1, 500000.00, '2024-01-01', '2024-12-31', TRUE, 1), -- Biaya Sampling
|
||||||
|
(2, 2, 1000000.00, '2024-01-01', '2024-12-31', TRUE, 1), -- Transport Luar Kota
|
||||||
|
(3, 3, 250000.00, '2024-01-01', '2024-12-31', TRUE, 1), -- Sewa Peralatan
|
||||||
|
(4, 4, 750000.00, '2024-01-01', '2024-12-31', TRUE, 1), -- Rush Analysis
|
||||||
|
(5, 5, 100000.00, '2024-01-01', '2024-12-31', TRUE, 1); -- Biaya Admin
|
||||||
|
|
||||||
|
-- Insert data untuk Discount Rules
|
||||||
|
INSERT INTO discount_rules (
|
||||||
|
DiscountRuleID, DiscountRuleName, DiscountRuleType,
|
||||||
|
DiscountRuleValue, DiscountRuleMinAmount,
|
||||||
|
DiscountRuleMaxAmount, DiscountRuleStartDate,
|
||||||
|
DiscountRuleEndDate, DiscountRuleIsActive,
|
||||||
|
DiscountRuleCreatedUserID
|
||||||
|
) VALUES
|
||||||
|
(1, 'Diskon Bulk Order', 'percentage',
|
||||||
|
10.00, 5000000.00, NULL,
|
||||||
|
'2024-01-01', '2024-12-31', TRUE, 1),
|
||||||
|
(2, 'Diskon Pelanggan Tetap', 'percentage',
|
||||||
|
15.00, 0.00, 10000000.00,
|
||||||
|
'2024-01-01', '2024-12-31', TRUE, 1),
|
||||||
|
(3, 'Diskon Akhir Tahun', 'fixed_amount',
|
||||||
|
500000.00, 2000000.00, NULL,
|
||||||
|
'2024-12-01', '2024-12-31', TRUE, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user