Table of Contents

BMP - Data Model & Table Specifications (v1.5)

Status: Final / Mengikat
Dasar: BMP Architecture Docs + Gap Analysis + Keputusan Final
Tujuan: Blueprint tunggal untuk implementasi database dan resource Ash Framework

๐Ÿ“š Daftar Isi

  1. Master Data
  2. Inventory & Stock
  3. Purchase
  4. Manufacturing
  5. Sales
  6. Accounting
  7. Quality
  8. Asset
  9. HR (Minimalis)
  10. System & Framework
  11. Relasi Antar Tabel (Tree Structure)
  12. Catatan Implementasi

1. Master Data

1.1 companies

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Nama perusahaan Standar
default_currency string IDR Standar
country string Indonesia Standar
enable_perpetual_inventory boolean Always TRUE (BMP policy) Standar (diadaptasi)
default_bank_account_id UUID Relasi ke accounts Standar
default_receivable_account_id UUID Relasi ke accounts Standar
default_payable_account_id UUID Relasi ke accounts Standar
default_inventory_account_id UUID Relasi ke accounts Standar
default_cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
tax_id string NPWP (dienkripsi - Cloak) Standar
bpom_license string Nomor Izin Edar BPOM (dienkripsi - Cloak) Standar
created_at timestamp Standar
updated_at timestamp Standar

1.2 accounts (Chart of Accounts)

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
account_number string Kode akun (misal, "1-1000") Standar
account_name string Nama akun Standar
account_type string Bank, Cash, Receivable, Payable, Stock, Tax, Round Off, dll Standar
root_type string Asset, Liability, Equity, Income, Expense Standar
parent_id UUID Relasi ke accounts (tree) Standar
is_group boolean True = parent/folder Standar
is_frozen boolean True = tidak bisa diposting Standar
company_id UUID Relasi ke companies Standar
currency string IDR Standar
created_at timestamp Standar
updated_at timestamp Standar

Akun Beban Wajib untuk Komponen Fee:

Kode Nama Akun Root Type Account Type
5-1000 Beban Marketplace Fee Expense Expense
5-2000 Beban Komisi Reseller Expense Expense
5-3000 Beban Diskon Penjualan Expense Expense
5-4000 Beban Promosi Expense Expense

1.3 cost_centers

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
name string Nama cost center (misal, "Perusahaan", "Produksi", "Marketing") โž• Ditambahkan
parent_id UUID Relasi ke cost_centers (tree) โž• Ditambahkan
is_group boolean True = parent/folder โž• Ditambahkan
company_id UUID Relasi ke companies โž• Ditambahkan
is_active boolean โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

Catatan: Cost Center hide dari UI untuk user operasional. Hanya Owner/Finance yang melihatnya.

1.4 fiscal_years

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
name string "2026" โž• Ditambahkan
year_start_date date Tanggal mulai (1 Januari) โž• Ditambahkan
year_end_date date Tanggal akhir (31 Desember) โž• Ditambahkan
is_active boolean True = tahun berjalan โž• Ditambahkan
company_id UUID Relasi ke companies โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

1.5 accounting_periods

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
name string "Januari 2026" โž• Ditambahkan
period_start_date date Tanggal mulai โž• Ditambahkan
period_end_date date Tanggal akhir โž• Ditambahkan
is_closed boolean True = sudah ditutup โž• Ditambahkan
fiscal_year_id UUID Relasi ke fiscal_years โž• Ditambahkan
company_id UUID Relasi ke companies โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

Catatan: Accounting Period hide dari UI sampai ada kebutuhan tutup buku formal.

1.6 items (Master Produk)

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
item_code string Kode unik (misal, "BLUEGRAY-01") Standar
item_name string Nama produk Standar
item_group_id UUID Relasi ke item_groups Standar
uom_id UUID Satuan dasar Standar
is_stock_item boolean True = barang fisik Standar
has_batch_no boolean BMP: True untuk semua produk Standar (diadaptasi)
has_serial_no boolean BMP: False (pakai batch) โŒ Dihapus
has_shelf_life boolean BMP: False untuk parfum (expiry compliance only) Standar (diadaptasi)
valuation_method string BMP: Moving Average default Standar (diadaptasi)
default_warehouse_id UUID Relasi ke warehouses Standar
supplier_id UUID Default supplier Standar
lead_time_days integer Lead time pembelian/produksi Standar
reorder_level decimal Level stok minimum Standar
safety_stock decimal Stok pengaman Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.7 item_groups

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string FG, Bulk, RM, Packaging Standar
parent_id UUID Relasi ke item_groups (tree) Standar
is_group boolean Standar
default_income_account_id UUID Relasi ke accounts Standar
default_expense_account_id UUID Relasi ke accounts Standar
default_cogs_account_id UUID Relasi ke accounts Standar
default_inventory_account_id UUID Relasi ke accounts Standar
created_at timestamp Standar
updated_at timestamp Standar

1.8 customers

Catatan: Customer di BMP = Channel Marketplace (Shopee, Tokopedia, TikTok Shop). Setiap Customer/channel memiliki 1 Sales Person penanggung jawab (lihat 1.17 sales_persons).

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
customer_code string Kode channel (CUST-SHOPEE) Standar (diadaptasi)
customer_name string Nama channel Standar (diadaptasi)
customer_group_id UUID Relasi ke customer_groups Standar
sales_person_id UUID Relasi ke sales_persons - PIC channel ini โž• Ditambahkan
default_price_list_id UUID Relasi ke price_lists (1 price list) Standar
default_sales_taxes_template_id UUID Relasi ke taxes_templates Standar
default_receivable_account_id UUID Relasi ke accounts Standar
default_cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.9 customer_groups

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Marketplace, Retail Fisik, Distributor B2B Standar
parent_id UUID Relasi ke customer_groups (tree) Standar
is_group boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.10 suppliers

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
supplier_code string Kode supplier Standar
supplier_name string Nama supplier Standar
supplier_group_id UUID Relasi ke supplier_groups Standar
default_currency string IDR Standar (diadaptasi)
default_payable_account_id UUID Relasi ke accounts Standar
default_purchase_taxes_template_id UUID Relasi ke taxes_templates Standar
tax_withholding_category_id UUID Relasi ke tax_withholding_categories Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.11 supplier_groups

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Importir Oil, Supplier Alkohol, Supplier Kemasan, Jasa Ekspedisi Standar
parent_id UUID Relasi ke supplier_groups (tree) Standar
is_group boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.12 warehouses

Warehouse Zoning BMP:

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Nama gudang Standar
warehouse_type string Storage, Work In Progress, Rejected, Scrap, Transit Standar
parent_id UUID Relasi ke warehouses (tree) Standar
is_group boolean Standar
company_id UUID Relasi ke companies Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.13 uoms (Unit of Measure)

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
uom_code string ml, L, kg, pcs Standar
uom_name string Milliliter, Liter, Kilogram, Pieces Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.14 uom_conversions

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
from_uom_id UUID Relasi ke uoms Standar
to_uom_id UUID Relasi ke uoms Standar
conversion_factor decimal Presisi 9 desimal Standar
created_at timestamp Standar
updated_at timestamp Standar

1.15 price_lists

Catatan Penting: BMP hanya menggunakan 1 Price List ("Harga Dasar - IDR"). Semua variasi harga (diskon, markup) ditangani oleh Fee Components (lihat bagian 5.2).

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Hanya 1: "Harga Dasar - IDR" Standar
currency string IDR Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.16 item_prices

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
item_id UUID Relasi ke items Standar
price_list_id UUID Relasi ke price_lists Standar
price decimal Harga per unit Standar
effective_date date Tanggal berlaku Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

1.17 sales_persons

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
employee_id UUID Relasi ke employees, wajib & unik - nama/departemen di-resolve via join โž• Revisi v1.5
is_active boolean Standar
created_at / updated_at timestamp Standar

Catatan: sales_persons = pandangan "fungsi Sales" atas karyawan; identitas tunggal tetap di employees. 1 Customer/channel โ†’ 1 sales_person_id; sales_orders.sales_person_id menyimpan snapshot PIC saat transaksi (histori kontribusi tahan rotasi).

2. Inventory & Stock

2.1 batches

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
batch_id string Nomor batch (misal, "BLG-2026-001") Standar
item_id UUID Relasi ke items Standar
warehouse_id UUID Relasi ke warehouses Standar
qty decimal Jumlah stok batch Standar
manufacturing_date date Tanggal produksi Standar
expiry_date date Tanggal kedaluwarsa (compliance) Standar
supplier_id UUID Relasi ke suppliers Standar
supplier_reference string Referensi lot dari supplier Standar
supplier_drum_code string BMP Custom: Kode rahasia drum โž• Ditambahkan
maturity_start_date date BMP Custom: Tanggal mulai maturing โž• Ditambahkan
maturing_days integer BMP Custom: Lama maturing aktual โž• Ditambahkan
parent_batch_id UUID BMP Custom: Batch induk (FG โ† Bulk) โž• Ditambahkan
quality_status string BMP Custom: QC Pending / Maturing / Accepted / Rejected /

Consumed / Exhausted
โž• Ditambahkan
created_at timestamp Standar
updated_at timestamp Standar

2.2 stock_entries

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
stock_entry_code string Nomor dokumen Standar
stock_entry_type string Material Receipt, Material Issue, Material Transfer, Manufacture, Repack Standar
work_order_id UUID Relasi ke work_orders Standar
purchase_receipt_id UUID Relasi ke purchase_receipts Standar
delivery_note_id UUID Relasi ke delivery_notes Standar
posting_date date Tanggal transaksi Standar
posting_time time Waktu transaksi Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
is_active boolean Standar
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

2.3 stock_entry_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
stock_entry_id UUID Relasi ke stock_entries Standar
item_id UUID Relasi ke items Standar
batch_id UUID Relasi ke batches Standar
qty decimal Jumlah Standar
rate decimal Harga per unit Standar
source_warehouse_id UUID Relasi ke warehouses Standar
target_warehouse_id UUID Relasi ke warehouses Standar
additional_costs JSONB BMP Custom: Biaya tambahan (overhead) โž• Ditambahkan
is_scrap boolean BMP Custom: True = by-product โž• Ditambahkan
created_at timestamp Standar
updated_at timestamp Standar

2.4 stock_ledger_entries (SLE) - Immutable

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
item_id UUID Relasi ke items Standar
warehouse_id UUID Relasi ke warehouses Standar
batch_id UUID Relasi ke batches Standar
voucher_type string Stock Entry, Purchase Receipt, Delivery Note, Sales Invoice Standar
voucher_no string Nomor dokumen sumber Standar
qty_change decimal Perubahan kuantitas Standar
qty_after_transaction decimal Saldo setelah transaksi Standar
valuation_rate decimal Harga per unit Standar
posting_date date Tanggal transaksi Standar
posting_time time Waktu transaksi Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_at timestamp Standar

2.5 bins (Agregasi Stok)

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
item_id UUID Relasi ke items Standar
warehouse_id UUID Relasi ke warehouses Standar
actual_qty decimal Stok aktual Standar
projected_qty decimal Stok + incoming - outgoing Standar
reserved_qty decimal Stok yang direservasi Standar
valuation_rate decimal Harga rata-rata Standar
created_at timestamp Standar
updated_at timestamp Standar

MATERIALIZED VIEW (v1.5): bins adalah derived state - diisi ulang dari stock_ledger_entries + order terbuka; bukan source of truth dan tidak menerima write langsung. actual_qty = SUM(qty_change) per item+warehouse; valuation_rate = rate SLE terakhir; projected_qty = actual + incoming terbuka โˆ’ outgoing terbuka; reserved_qty = reservasi aktif. Rebuildable kapan pun via aksi Repost / job Oban (konsisten Architecture Invariant #8: derived state selalu rebuildable dari ledger).

3. Purchase

3.1 purchase_orders

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
po_code string Nomor PO Standar
supplier_id UUID Relasi ke suppliers Standar
material_request_id UUID Relasi ke material_requests Standar
transaction_date date Tanggal PO Standar
reference_usd_rate decimal BMP Custom: Kurs USD-IDR saat PO** โž• Ditambahkan
total_qty decimal Standar
total_amount decimal Standar
currency string IDR Standar
status string Draft, Submitted, Partially Received, Completed, Cancelled Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

3.2 purchase_order_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
purchase_order_id UUID Relasi ke purchase_orders Standar
item_id UUID Relasi ke items Standar
qty decimal Jumlah pesan Standar
rate decimal Harga per unit (dalam IDR) Standar
reference_usd_price decimal BMP Custom: Harga dalam USD (dari katalog)** โž• Ditambahkan
uom_id UUID Relasi ke uoms Standar
discount decimal Standar
total decimal Standar
received_qty decimal Jumlah yang sudah diterima Standar
created_at timestamp Standar
updated_at timestamp Standar

3.3 purchase_receipts

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
pr_code string Nomor PR Standar
purchase_order_id UUID Relasi ke purchase_orders Standar
supplier_id UUID Relasi ke suppliers Standar
posting_date date Tanggal terima Standar
posting_time time Waktu terima Standar
total_qty decimal Standar
total_amount decimal Standar
status string Draft, Submitted, Partially Accepted, Completed, Cancelled Standar
is_return boolean True = retur ke supplier Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

3.4 purchase_receipt_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
purchase_receipt_id UUID Relasi ke purchase_receipts Standar
item_id UUID Relasi ke items Standar
batch_id UUID Relasi ke batches Standar
qty_received decimal Jumlah diterima Standar
qty_accepted decimal Jumlah lulus QC Standar
qty_rejected decimal Jumlah ditolak QC Standar
rate decimal Harga per unit (dalam IDR) Standar
reference_usd_price decimal BMP Custom: Harga dalam USD (dari katalog)** โž• Ditambahkan
uom_id UUID Relasi ke uoms Standar
supplier_drum_code string BMP Custom: Kode rahasia drum โž• Ditambahkan
created_at timestamp Standar
updated_at timestamp Standar

3.5 purchase_invoices - TABEL BARU

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
pi_code string Nomor PI โž• Ditambahkan
purchase_order_id UUID Relasi ke purchase_orders โž• Ditambahkan
purchase_receipt_id UUID Relasi ke purchase_receipts โž• Ditambahkan
supplier_id UUID Relasi ke suppliers โž• Ditambahkan
posting_date date Tanggal invoice โž• Ditambahkan
total_gross decimal Total sebelum PPN โž• Ditambahkan
tax_amount decimal PPN Masukan โž• Ditambahkan
tax_withholding_amount decimal PPh 23 (jika ada) โž• Ditambahkan
total_net decimal Total + PPN - PPh โž• Ditambahkan
purchase_price_variance decimal Selisih antara PO rate dan PI rate โž• Ditambahkan
status string Draft, Submitted, Paid, Cancelled โž• Ditambahkan
company_id UUID Relasi ke companies โž• Ditambahkan
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

3.6 purchase_invoice_items - TABEL BARU

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
purchase_invoice_id UUID Relasi ke purchase_invoices โž• Ditambahkan
item_id UUID Relasi ke items โž• Ditambahkan
batch_id UUID Relasi ke batches โž• Ditambahkan
qty decimal Jumlah โž• Ditambahkan
rate decimal Harga per unit (IDR) โž• Ditambahkan
reference_usd_price decimal BMP Custom: Harga dalam USD (dari katalog)** โž• Ditambahkan
uom_id UUID Relasi ke uoms โž• Ditambahkan
discount decimal โž• Ditambahkan
total decimal โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

3.7 material_requests

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
mr_code string Nomor MR Standar
material_request_type string Purchase, Material Transfer, Material Issue, Manufacture Standar
item_id UUID Relasi ke items Standar
qty decimal Jumlah diminta Standar
required_date date Tanggal dibutuhkan Standar
warehouse_id UUID Relasi ke warehouses Standar
status string Pending, Ordered, Transferred, Issued, Received Standar
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

3.8 landed_cost_vouchers

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
lcv_code string Nomor LCV Standar
purchase_receipt_id UUID Relasi ke purchase_receipts Standar
distribution_method string Qty, Amount, Weight Standar
total_cost decimal Total biaya tambahan Standar
status string Draft, Submitted, Cancelled Standar
company_id UUID Relasi ke companies Standar
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

3.9 landed_cost_voucher_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
landed_cost_voucher_id UUID Relasi ke landed_cost_vouchers Standar
expense_account_id UUID Relasi ke accounts Standar
amount decimal Biaya tambahan Standar
description string Standar
created_at timestamp Standar
updated_at timestamp Standar

4. Manufacturing

4.1 boms (Bill of Materials)

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
bom_code string Kode BOM Standar
item_id UUID Relasi ke items Standar
qty_output decimal Jumlah output standar Standar
is_active boolean Standar
is_default boolean True = default BOM Standar
rm_cost_as_per string Valuation / Price List Standar
with_operations boolean True = ada biaya overhead Standar
maturing_days integer BMP Custom: SOP maturing โž• Ditambahkan
formulation_code string BMP Custom: Kode internal formulasi โž• Ditambahkan
twist_notes text BMP Custom: Catatan "twist" rahasia (dienkripsi - โž• Cloak) Ditambahkan
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

4.2 bom_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
bom_id UUID Relasi ke boms Standar
item_id UUID Relasi ke items Standar
qty decimal Jumlah komponen Standar
rate decimal Harga per unit (snapshot) Standar
uom_id UUID Relasi ke uoms Standar
source_warehouse_id UUID Relasi ke warehouses Standar
operation_id UUID Relasi ke operations Standar
is_scrap boolean BMP Custom: True = by-product โž• Ditambahkan
created_at timestamp Standar
updated_at timestamp Standar

4.3 operations

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
operation_name string Mixing, Filling, Capping, Labeling, Packaging Standar
workstation string Mixer 200L, Filling Line 1 Standar
time_in_mins decimal Durasi standar Standar
hour_rate decimal Biaya overhead per jam Standar
company_id UUID Relasi ke companies Standar
created_at timestamp Standar
updated_at timestamp` | | Standar |

4.4 work_orders

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
wo_code string Nomor WO Standar
production_item_id UUID Relasi ke items Standar
bom_id UUID Relasi ke boms Standar
qty_to_produce decimal Jumlah target Standar
qty_produced decimal Jumlah realisasi Standar
fg_warehouse_id UUID Relasi ke warehouses Standar
wip_warehouse_id UUID Relasi ke warehouses Standar
source_warehouse_id UUID Relasi ke warehouses Standar
planned_start_date date Tanggal mulai rencana Standar
planned_end_date date Tanggal selesai rencana Standar
actual_start_date date Tanggal mulai aktual Standar
actual_end_date date Tanggal selesai aktual Standar
status string Draft, Submitted, Not Started, In Process, Completed, Stopped, Cancelled Standar
allow_overproduction decimal Toleransi (%) Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp` | | Standar |

4.5 work_order_operations

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
work_order_id UUID Relasi ke work_orders Standar
operation_id UUID Relasi ke operations Standar
planned_time decimal Durasi rencana Standar
actual_time decimal Durasi aktual Standar
started_at timestamp Waktu mulai aktual Standar
finished_at timestamp Waktu selesai aktual Standar
status string Pending, In Progress, Completed Standar
created_at timestamp Standar
updated_at timestamp Standar

4.6 production_plans

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
plan_code string Nomor plan Standar
plan_date date Tanggal plan Standar
plan_horizon integer Horizon perencanaan Standar
status string Draft, Released, Completed, Cancelled Standar
company_id UUID Relasi ke companies Standar
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp` | | Standar |

4.7 production_plan_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
production_plan_id UUID Relasi ke production_plans Standar
item_id UUID Relasi ke items Standar
source_type string Sales Order, Material Request, Forecast Standar
source_id UUID ID dokumen sumber Standar
qty_demand decimal Kebutuhan Standar
qty_planned decimal Jumlah direncanakan Standar
qty_produced decimal Jumlah realisasi Standar
required_date date Tanggal dibutuhkan Standar
status string Pending, Released, Completed, Cancelled Standar
created_at timestamp Standar
updated_at timestamp` | | Standar |

5. Sales

5.1 Core Sales Tables

5.1.1 sales_orders

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
so_code string Nomor SO Standar
customer_id UUID Relasi ke customers (Channel) Standar (diadaptasi)
sales_person_id UUID Relasi ke sales_persons - PIC saat transaksi dibuat โž• Ditambahkan
posting_date date Tanggal rekap Standar
total_gross decimal Total sebelum diskon Standar
total_fee_amount decimal Total semua biaya (fee, komisi, diskon) โž• Ditambahkan
net_total_after_fee decimal Gross revenue - total_fee_amount โž• Ditambahkan
reseller_name string BMP Custom: Nama reseller (dari Google Sheets) โž• Ditambahkan
channel_order_ref string BMP Custom: Referensi order dari marketplace โž• Ditambahkan
status string Draft, Submitted, Partially Delivered, Completed, Cancelled Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

Catatan Dedup Key:

5.1.2 sales_order_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
sales_order_id UUID Relasi ke sales_orders Standar
item_id UUID Relasi ke items Standar
batch_id UUID BMP Custom: Batch yang dijual (traceability CPKB) โž• Ditambahkan
qty decimal Jumlah Standar
price decimal Harga per unit Standar
discount decimal Diskon per baris Standar
total decimal Total per baris Standar
created_at timestamp Standar
updated_at timestamp` | | Standar |

5.1.3 delivery_notes

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
dn_code string Nomor DN Standar
sales_order_id UUID Relasi ke sales_orders Standar
customer_id UUID Relasi ke customers Standar
posting_date date Tanggal kirim Standar
posting_time time Waktu kirim Standar
total_qty decimal Standar
total_amount decimal Standar
status string Draft, Submitted, Completed, Cancelled Standar
is_return boolean True = retur customer Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

5.1.4 delivery_note_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
delivery_note_id UUID Relasi ke delivery_notes Standar
sales_order_item_id UUID Relasi ke sales_order_items Standar
item_id UUID Relasi ke items Standar
batch_id UUID Relasi ke batches Standar
qty decimal Jumlah dikirim Standar
rate decimal Harga per unit Standar
created_at timestamp Standar
updated_at timestamp Standar

5.1.5 sales_invoices

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
si_code string Nomor SI Standar
sales_order_id UUID Relasi ke sales_orders Standar
delivery_note_id UUID Relasi ke delivery_notes Standar
customer_id UUID Relasi ke customers Standar
posting_date date Tanggal invoice Standar
total_gross decimal Total sebelum PPN Standar
tax_amount decimal PPN 11-12% Standar
total_net decimal Total + PPN Standar
status string Draft, Unpaid, Paid, Overdue, Cancelled Standar
is_return boolean True = credit note Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

5.1.6 sales_invoice_items - TABEL BARU

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
sales_invoice_id UUID Relasi ke sales_invoices โž• Ditambahkan
item_id UUID Relasi ke items โž• Ditambahkan
batch_id UUID Relasi ke batches โž• Ditambahkan
qty decimal Jumlah โž• Ditambahkan
price decimal Harga per unit โž• Ditambahkan
discount decimal Diskon per baris โž• Ditambahkan
total decimal Total per baris โž• Ditambahkan
cogs decimal Cost of Goods Sold per baris (dienkripsi - Cloak) โž• Ditambahkan
gross_profit decimal total - cogs (dienkripsi - Cloak) โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

5.2 Fee Components & Configuration

Filosofi Desain:

BMP menggunakan 1 Price List ("Harga Dasar - IDR"). Semua variasi harga (diskon, markup, fee) ditangani oleh Fee Components.

Konsep Jumlah Fungsi Contoh
Price List 1 saja Menentukan harga jual dasar produk Bluegray = Rp 1.000.000
Komponen Biaya Banyak Mendefinisikan jenis biaya FEE-SHOPEE, COMMISSION
Konfigurasi Biaya Banyak Menentukan nilai biaya per customer dengan effective date Shopee = 3% + Rp 2.000

5.2.1 customer_fee_components (Master Jenis Biaya)

Catatan: Tabel ini adalah master data yang mendefinisikan jenis biaya. Tidak memiliki relasi langsung ke customers karena satu jenis biaya bisa digunakan oleh banyak customer (reusable).

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
component_code string Kode unik komponen (FEE-SHOPEE, COMMISSION) โž• Ditambahkan
component_name string Nama komponen (Fee Shopee, Komisi Reseller) โž• Ditambahkan
component_type string Fee Marketplace, Diskon, Komisi, Lainnya โž• Ditambahkan
account_id UUID Relasi ke accounts (akun beban di CoA) โž• Ditambahkan
is_active boolean โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

5.2.2 customer_fee_configs (Konfigurasi Biaya per Customer)

Catatan: Tabel ini adalah pivot table yang menghubungkan Customer dengan Komponen Biaya dan menentukan nilai biaya yang berlaku untuk customer tersebut. Relasi langsung ke customers ada di sini.

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
customer_id UUID Relasi ke customers โž• Ditambahkan
fee_component_id UUID Relasi ke customer_fee_components โž• Ditambahkan
calculation_type string Percentage, Fixed, Percentage + Fixed โž• Ditambahkan
percentage_value decimal Nilai persentase โž• Ditambahkan
fixed_amount decimal Nilai tetap โž• Ditambahkan
minimum_amount decimal Minimum biaya (opsional) โž• Ditambahkan
maximum_amount decimal Maksimum biaya (opsional) โž• Ditambahkan
calculation_order integer Urutan perhitungan (1, 2, 3, ...) โž• Ditambahkan
effective_date_from date Tanggal mulai berlaku โž• Ditambahkan
effective_date_to date Tanggal berakhir berlaku (null = tanpa batas) โž• Ditambahkan
is_active boolean โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

5.3 Fee Snapshots

Catatan: sales_order_fees adalah tabel snapshot yang menyimpan biaya aktual pada saat Sales Order dibuat. Ini menjaga histori tetap akurat meskipun ada perubahan fee di masa depan (prinsip immutability akuntansi).

5.3.1 sales_order_fees

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
sales_order_id UUID Relasi ke sales_orders โž• Ditambahkan
fee_component_id UUID Relasi ke customer_fee_components โž• Ditambahkan
calculation_type string Snapshot cara hitung โž• Ditambahkan
percentage_value decimal Snapshot persentase โž• Ditambahkan
fixed_amount decimal Snapshot nilai tetap โž• Ditambahkan
base_amount decimal Dasar perhitungan biaya โž• Ditambahkan
fee_amount decimal Jumlah biaya aktual โž• Ditambahkan
description string Keterangan โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

6. Accounting

6.1 Core Accounting

6.1.1 journal_entries

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
je_code string Nomor JE Standar
voucher_type string Journal Entry, Bank Entry, Cash Entry, Contra, Credit Note, Debit Note, Opening Entry Standar
posting_date date Tanggal posting Standar
total_debit decimal Total debit Standar
total_credit decimal Total credit Standar
is_opening boolean True = saldo awal Standar
company_id UUID Relasi ke companies Standar
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

6.1.2 journal_entry_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
journal_entry_id UUID Relasi ke journal_entries Standar
account_id UUID Relasi ke accounts Standar
debit decimal Standar
credit decimal Standar
party_type string Customer, Supplier, Employee Standar
party_id UUID ID party Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_at timestamp Standar
updated_at timestamp` | | Standar |

6.1.3 gl_entries (General Ledger) - Immutable

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
account_id UUID Relasi ke accounts Standar
debit decimal Standar
credit decimal Standar
party_type string Customer, Supplier Standar
party_id UUID ID party Standar
voucher_type string Journal Entry, Payment Entry, Sales Invoice, Purchase Invoice Standar
voucher_no string Nomor dokumen sumber Standar
posting_date date Tanggal posting Standar
is_opening boolean True = saldo awal Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_at timestamp Standar

6.1.4 payment_ledger_entries

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
party_type string Customer, Supplier Standar
party_id UUID ID party Standar
voucher_type string Sales Invoice, Purchase Invoice, Payment Entry Standar
voucher_no string Nomor dokumen Standar
invoice_amount decimal Nilai invoice Standar
paid_amount decimal Sudah dibayar Standar
outstanding_amount decimal Sisa tagihan Standar
due_date date Jatuh tempo Standar
company_id UUID Relasi ke companies Standar
created_at timestamp Standar
updated_at timestamp Standar

6.1.5 payment_terms_templates - TABEL BARU (Hide)

Kolom Tipe Deskripsi Status
id UUID Primary key ๐Ÿ‘๏ธ Ditambahkan (Hide)
name string "Net 30", "Net 60" ๐Ÿ‘๏ธ Ditambahkan
description text ๐Ÿ‘๏ธ Ditambahkan
is_active boolean ๐Ÿ‘๏ธ Ditambahkan
created_at timestamp ๐Ÿ‘๏ธ Ditambahkan
updated_at timestamp ๐Ÿ‘๏ธ Ditambahkan

6.1.6 payment_schedules - TABEL BARU (Hide)

Kolom Tipe Deskripsi Status
id UUID Primary key ๐Ÿ‘๏ธ Ditambahkan (Hide)
voucher_type string Sales Invoice, Purchase Invoice ๐Ÿ‘๏ธ Ditambahkan
voucher_no string Nomor dokumen ๐Ÿ‘๏ธ Ditambahkan
due_date date Tanggal jatuh tempo ๐Ÿ‘๏ธ Ditambahkan
payment_amount decimal Jumlah termin ๐Ÿ‘๏ธ Ditambahkan
paid_amount decimal Sudah dibayar ๐Ÿ‘๏ธ Ditambahkan
outstanding_amount decimal Sisa termin ๐Ÿ‘๏ธ Ditambahkan
created_at timestamp ๐Ÿ‘๏ธ Ditambahkan
updated_at timestamp ๐Ÿ‘๏ธ Ditambahkan

6.2 Payment & Banking

6.2.1 modes_of_payment - TABEL BARU

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
name string "Transfer Bank", "Tunai", "QRIS" โž• Ditambahkan
type string Bank, Cash, Wallet โž• Ditambahkan
default_account_id UUID Relasi ke accounts (akun Bank/Cash default) โž• Ditambahkan
is_active boolean โž• Ditambahkan
company_id UUID Relasi ke companies โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

6.2.2 payment_entries

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
pe_code string Nomor PE Standar
payment_type string Receive, Pay, Internal Transfer Standar
party_type string Customer, Supplier Standar
party_id UUID ID party Standar
mode_of_payment_id UUID Relasi ke modes_of_payment โž• Ditambahkan
posting_date date Tanggal settlement Standar
gross_amount decimal BMP Custom: Total dari marketplace โž• Ditambahkan
net_amount decimal BMP Custom: Jumlah yang benar-benar diterima โž• Ditambahkan
status string Draft, Submitted, Paid, Cancelled Standar
paid_from_account_id UUID Relasi ke accounts - akun sumber dana, snapshot saat submit โž• Ditambahkan
paid_to_account_id UUID Relasi ke accounts - akun tujuan dana, snapshot saat submit โž• Ditambahkan
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

6.2.3 payment_entry_deductions - TABEL BARU

Catatan: Pengganti JSONB deductions untuk memudahkan agregasi laporan.

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
payment_entry_id UUID Relasi ke payment_entries โž• Ditambahkan
fee_component_id UUID Relasi ke customer_fee_components โž• Ditambahkan
account_id UUID Relasi ke accounts โž• Ditambahkan
amount decimal Nilai deduksi โž• Ditambahkan
description string Keterangan โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

Tambah tabel ยง6.2.3a payment_entry_references - BARU:

Kolom Tipe Deskripsi Status
id UUID Primary key โž•
payment_entry_id UUID Relasi ke payment_entries โž•
reference_type string Sales Invoice, Purchase Invoice, Journal Entry โž•
reference_id UUID ID dokumen yang dialokasikan โž•
allocated_amount decimal Jumlah alokasi โž•
created_at timestamp โž•
updated_at timestamp โž•

(payment_entry_deductions ยง6.2.3 tetap - kini satu-satunya rumah deduksi.)

6.2.4 banks - TABEL BARU (Hide)

Kolom Tipe Deskripsi Status
id UUID Primary key ๐Ÿ‘๏ธ Ditambahkan (Hide)
name string Nama bank ๐Ÿ‘๏ธ Ditambahkan
swift_code string Kode SWIFT ๐Ÿ‘๏ธ Ditambahkan
created_at timestamp ๐Ÿ‘๏ธ Ditambahkan
updated_at timestamp ๐Ÿ‘๏ธ Ditambahkan

6.2.5 bank_accounts - TABEL BARU (Hide)

Kolom Tipe Deskripsi Status
id UUID Primary key ๐Ÿ‘๏ธ Ditambahkan (Hide)
bank_id UUID Relasi ke banks ๐Ÿ‘๏ธ Ditambahkan
account_number string Nomor rekening ๐Ÿ‘๏ธ Ditambahkan
account_name string Nama pemilik ๐Ÿ‘๏ธ Ditambahkan
account_id UUID Relasi ke accounts (GL) ๐Ÿ‘๏ธ Ditambahkan
company_id UUID Relasi ke companies ๐Ÿ‘๏ธ Ditambahkan
is_active boolean ๐Ÿ‘๏ธ Ditambahkan
created_at timestamp ๐Ÿ‘๏ธ Ditambahkan
updated_at timestamp` | | ๐Ÿ‘๏ธ Ditambahkan |

6.2.6 bank_transactions - TABEL BARU (Hide)

Kolom Tipe Deskripsi Status
id UUID Primary key ๐Ÿ‘๏ธ Ditambahkan (Hide)
bank_account_id UUID Relasi ke bank_accounts ๐Ÿ‘๏ธ Ditambahkan
transaction_date date Tanggal transaksi ๐Ÿ‘๏ธ Ditambahkan
reference string Referensi bank ๐Ÿ‘๏ธ Ditambahkan
description text Deskripsi ๐Ÿ‘๏ธ Ditambahkan
deposit decimal Debit (masuk) ๐Ÿ‘๏ธ Ditambahkan
withdrawal decimal Kredit (keluar) ๐Ÿ‘๏ธ Ditambahkan
is_reconciled boolean ๐Ÿ‘๏ธ Ditambahkan
payment_entry_id UUID Relasi ke payment_entries ๐Ÿ‘๏ธ Ditambahkan
created_at timestamp ๐Ÿ‘๏ธ Ditambahkan
updated_at timestamp ๐Ÿ‘๏ธ Ditambahkan

6.3 Tax & Withholding

6.3.1 taxes_templates (Sales & Purchase)

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string "PPN 11%" Standar
type string Sales, Purchase Standar
company_id UUID Relasi ke companies Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

6.3.2 tax_template_items

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
tax_template_id UUID Relasi ke taxes_templates Standar
account_id UUID Relasi ke accounts Standar
rate decimal Persentase pajak Standar
charge_type string On Net Total, On Previous Row, Actual Standar
is_inclusive boolean True = harga sudah termasuk pajak Standar
created_at timestamp Standar
updated_at timestamp Standar

6.3.3 tax_withholding_categories

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string PPh 23 (Jasa) Standar
rate decimal Persentase potongan Standar
threshold_amount decimal Ambang batas kumulatif Standar
threshold_period string Monthly, Yearly Standar
created_at timestamp Standar
updated_at timestamp` | | Standar |

6.3.4 tax_withholding_entries - TABEL BARU

Kolom Tipe Deskripsi Status
id UUID Primary key โž• Ditambahkan
purchase_invoice_id UUID Relasi ke purchase_invoices โž• Ditambahkan
supplier_id UUID Relasi ke suppliers โž• Ditambahkan
withholding_category_id UUID Relasi ke tax_withholding_categories โž• Ditambahkan
taxable_amount decimal Jumlah kena pajak โž• Ditambahkan
withholding_amount decimal Jumlah potongan โž• Ditambahkan
period_from date Periode mulai โž• Ditambahkan
period_to date Periode akhir โž• Ditambahkan
created_at timestamp โž• Ditambahkan
updated_at timestamp โž• Ditambahkan

6.4 Budget & Period

6.4.1 budgets - TABEL BARU (Hide)

Kolom Tipe Deskripsi Status
id UUID Primary key ๐Ÿ‘๏ธ Ditambahkan (Hide)
name string "Budget 2026" ๐Ÿ‘๏ธ Ditambahkan
budget_against string Cost Center, Project ๐Ÿ‘๏ธ Ditambahkan
fiscal_year_id UUID Relasi ke fiscal_years ๐Ÿ‘๏ธ Ditambahkan
company_id UUID Relasi ke companies ๐Ÿ‘๏ธ Ditambahkan
status string Draft, Submitted, Completed ๐Ÿ‘๏ธ Ditambahkan
created_by UUID User ID ๐Ÿ‘๏ธ Ditambahkan
created_at timestamp ๐Ÿ‘๏ธ Ditambahkan
updated_at timestamp ๐Ÿ‘๏ธ Ditambahkan

6.4.2 budget_items - TABEL BARU (Hide)

Kolom Tipe Deskripsi Status
id UUID Primary key ๐Ÿ‘๏ธ Ditambahkan (Hide)
budget_id UUID Relasi ke budgets ๐Ÿ‘๏ธ Ditambahkan
account_id UUID Relasi ke accounts ๐Ÿ‘๏ธ Ditambahkan
cost_center_id UUID Relasi ke cost_centers ๐Ÿ‘๏ธ Ditambahkan
budget_amount decimal Jumlah anggaran ๐Ÿ‘๏ธ Ditambahkan
spent_amount decimal Realisasi ๐Ÿ‘๏ธ Ditambahkan
created_at timestamp ๐Ÿ‘๏ธ Ditambahkan
updated_at timestamp ๐Ÿ‘๏ธ Ditambahkan

6.4.3 monthly_distributions - TABEL BARU (Hide)

Kolom Tipe Deskripsi Status
id UUID Primary key ๐Ÿ‘๏ธ Ditambahkan (Hide)
budget_id UUID Relasi ke budgets ๐Ÿ‘๏ธ Ditambahkan
month integer 1-12 ๐Ÿ‘๏ธ Ditambahkan
percentage decimal Persentase alokasi (total 100%) ๐Ÿ‘๏ธ Ditambahkan
created_at timestamp ๐Ÿ‘๏ธ Ditambahkan
updated_at timestamp ๐Ÿ‘๏ธ Ditambahkan

7. Quality

7.1 quality_inspections

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
inspection_code string Nomor inspeksi Standar
item_id UUID Relasi ke items Standar
batch_id UUID Relasi ke batches Standar
template_id UUID Relasi ke quality_templates Standar
reference_type string Purchase Receipt, Stock Entry Manufacture Standar
reference_id UUID ID dokumen sumber Standar
inspected_by UUID User ID Standar
inspection_date date Tanggal inspeksi Standar
status string Pending, Accepted, Rejected Standar
result JSONB Hasil per parameter Standar
notes text Catatan tambahan Standar
company_id UUID Relasi ke companies Standar
created_at timestamp Standar
updated_at timestamp Standar

7.2 quality_templates

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Template A: RM Cairan, Template B: Packaging, Template C: FG Standar
item_type string RM, Packaging, FG Standar
parameters JSONB Daftar parameter uji Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

7.3 non_conformances

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
nc_code string Nomor NC Standar
source_type string Manufacturing, Sales Return, Quality Inspection Standar
source_id UUID ID dokumen sumber Standar
batch_id UUID Relasi ke batches Standar
subject string Subjek deviasi Standar
description text Kronologi Standar
corrective_action text Tindakan kompensasi Standar
preventive_action text Tindakan pencegahan Standar
status string Open, In Progress, Closed Standar
company_id UUID Relasi ke companies Standar
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

8. Asset

8.1 asset_categories

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Mesin Produksi, Kendaraan, Peralatan Kantor Standar
depreciation_method string Straight Line, Written Down Value Standar
useful_life_years integer Umur ekonomis Standar
salvage_value decimal Nilai sisa Standar
frequency string Monthly, Quarterly, Yearly Standar
fixed_asset_account_id UUID Relasi ke accounts Standar
accumulated_depreciation_account_id UUID Relasi ke accounts Standar
depreciation_expense_account_id UUID Relasi ke accounts Standar
created_at timestamp Standar
updated_at timestamp Standar

8.2 assets

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
asset_name string Nama aset Standar
asset_category_id UUID Relasi ke asset_categories Standar
location string Lokasi fisik Standar
custodian string Penanggung jawab Standar
gross_purchase_amount decimal Nilai perolehan Standar
purchase_date date Tanggal beli Standar
available_for_use_date date Tanggal mulai dipakai Standar
status string Draft, In Use, Sold, Scrapped, Cancelled Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_at timestamp Standar
updated_at timestamp Standar

8.3 asset_depreciation_schedules

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
asset_id UUID Relasi ke assets Standar
depreciation_date date Tanggal depresiasi Standar
depreciation_amount decimal Nilai depresiasi Standar
accumulated_depreciation decimal Akumulasi Standar
book_value decimal Nilai buku Standar
is_posted boolean True = sudah di-JE Standar
journal_entry_id UUID Relasi ke journal_entries Standar
created_at timestamp Standar
updated_at timestamp Standar

8.4 asset_movements

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
movement_code string Nomor movement Standar
asset_id UUID Relasi ke assets Standar
from_location string Lokasi asal Standar
to_location string Lokasi tujuan Standar
from_custodian string Penanggung jawab asal Standar
to_custodian string Penanggung jawab tujuan Standar
movement_date date Tanggal pindah Standar
status string Draft, Submitted, Completed Standar
created_at timestamp Standar
updated_at timestamp` | | Standar |

8.5 asset_repairs

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
repair_code string Nomor repair Standar
asset_id UUID Relasi ke assets Standar
failure_date date Tanggal rusak Standar
description text Deskripsi kerusakan Standar
repair_cost decimal Biaya perbaikan Standar
capitalize boolean True = tambah nilai aset Standar
stock_items JSONB Spare part yang dikonsumsi Standar
status string Pending, Completed, Cancelled Standar
created_at timestamp Standar
updated_at timestamp Standar

8.6 asset_maintenances

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
asset_id UUID Relasi ke assets Standar
maintenance_type string Preventive, Calibration Standar
periodicity string Daily, Weekly, Monthly, Quarterly, Yearly Standar
assign_to string Penanggung jawab Standar
next_due_date date Jadwal berikutnya Standar
is_active boolean Standar
created_at timestamp Standar
updated_at timestamp Standar

8.7 asset_maintenance_logs

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
asset_maintenance_id UUID Relasi ke asset_maintenances Standar
asset_id UUID Relasi ke assets Standar
done_by string Pelaksana Standar
done_date date Tanggal eksekusi Standar
notes text Catatan Standar
created_at timestamp Standar
updated_at timestamp Standar

9. HR (Minimalis)

9.1 employees

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
employee_code string NIK karyawan Standar
first_name string Nama depan Standar
last_name string Nama belakang Standar
email string Email (dienkripsi - Cloak) Standar
phone string No HP (dienkripsi - Cloak) Standar
bank_account string Rekening bank (dienkripsi - Cloak ) Standar
bank_name string Nama bank (dienkripsi - Cloak) Standar
tax_id string NPWP (dienkripsi - Cloak) Standar
address text Alamat (dienkripsi - Cloak) Standar
date_of_joining date Tanggal masuk Standar
date_of_leaving date Tanggal keluar Standar
department string Produksi, Admin, Sales, Finance Standar
status string Active, Left Standar
user_id UUID Relasi ke users Standar
created_at timestamp Standar
updated_at timestamp Standar

9.2 attendances

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
employee_id UUID Relasi ke employees Standar
attendance_date date Tanggal Standar
status string Present, Absent, Half Day, On Leave, Work From Home Standar
leave_application_id UUID Relasi ke leave_applications Standar
created_at timestamp Standar
updated_at timestamp Standar

9.3 leave_types

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Cuti Tahunan, Cuti Sakit, Cuti Melahirkan Standar
is_paid boolean True = dibayar Standar
encashable boolean True = bisa dicairkan Standar
max_days integer Maksimum hari Standar
created_at timestamp Standar
updated_at timestamp Standar

9.4 leave_allocations

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
employee_id UUID Relasi ke employees Standar
leave_type_id UUID Relasi ke leave_types Standar
allocation_date date Tanggal jatah Standar
total_days integer Total jatah Standar
used_days integer Sudah dipakai Standar
remaining_days integer Sisa Standar
created_at timestamp Standar
updated_at timestamp Standar

9.5 leave_applications

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
employee_id UUID Relasi ke employees Standar
leave_type_id UUID Relasi ke leave_types Standar
from_date date Tanggal mulai Standar
to_date date Tanggal selesai Standar
total_days integer Jumlah hari Standar
reason text Alasan Standar
status string Pending, Approved, Rejected, Cancelled Standar
created_at timestamp Standar
updated_at timestamp Standar

9.6 salary_structures

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
name string Struktur gaji Standar
employee_id UUID Relasi ke employees Standar
effective_date date Tanggal berlaku Standar
is_active boolean Standar
components JSONB Daftar komponen gaji Standar
created_at timestamp Standar
updated_at timestamp Standar

9.7 payroll_entries

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
pe_code string Nomor payroll Standar
from_date date Awal periode Standar
to_date date Akhir periode Standar
total_gross decimal Total gaji kotor Standar
total_net decimal Total gaji bersih Standar
status string Draft, Submitted, Paid, Cancelled Standar
journal_entry_id UUID Relasi ke journal_entries Standar
company_id UUID Relasi ke companies Standar
cost_center_id UUID Relasi ke cost_centers โž• Ditambahkan
created_by UUID User ID Standar
created_at timestamp Standar
updated_at timestamp Standar

9.8 salary_slips

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
payroll_entry_id UUID Relasi ke payroll_entries Standar
employee_id UUID Relasi ke employees Standar
gross_pay decimal Gaji kotor Standar
total_deduction decimal Total potongan Standar
net_pay decimal Gaji bersih Standar
components JSONB Detail komponen (dienkripsi - Cloak) Standar
created_at timestamp Standar
updated_at timestamp Standar

10. System & Framework

10.1 users

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
email string Email unik Standar
password_hash string Hash password Standar
first_name string Standar
last_name string Standar
roles JSONB Daftar role Standar
is_active boolean Standar
last_login timestamp Standar
created_at timestamp Standar
updated_at timestamp Standar

10.2 permissions

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
role string Nama role Standar
resource_type string Item, SalesOrder, dll Standar
action string Read, Write, Create, Delete, Submit Standar
conditions JSONB Filter tambahan Standar
created_at timestamp Standar
updated_at timestamp Standar

Catatan baru: permission_level dihapus (v1.5). Kerahasiaan data = Cloak (enkripsi at-rest untuk field finansial/PII/resep); kewenangan aksi = Ash.Policy.Authorizer (role ร— resource ร— action, tabel ini); visibilitas menu/UI = konfigurasi workspace (Chapter 5). Tiga lapis, tidak saling tumpang tindih.

10.3 access_logs

Kolom Tipe Deskripsi Status
id UUID Primary key Standar
user_id UUID Relasi ke users Standar
action string Login, View, Create, Update, Delete, Export Standar
resource_type string Item, SalesOrder, dll Standar
resource_id UUID ID resource Standar
ip_address string IP client Standar
metadata JSONB Filter atau parameter Standar
created_at timestamp Standar

11. Relasi Antar Tabel (Tree Structure)

Company

โ”œโ”€โ”€ Account (CoA)

โ”‚ โ”œโ”€โ”€ Akun Beban (Marketplace Fee, Komisi, Diskon, Promosi)

โ”‚ โ””โ”€โ”€ Akun Pajak (PPN, PPh)

โ”œโ”€โ”€ FiscalYear

โ”œโ”€โ”€ AccountingPeriod

โ”œโ”€โ”€ CostCenter

โ”œโ”€โ”€ Budget

โ”œโ”€โ”€ Item

โ”‚ โ”œโ”€โ”€ ItemGroup

โ”‚ โ”œโ”€โ”€ UOM

โ”‚ โ”œโ”€โ”€ PriceList (HANYA 1)

โ”‚ โ”œโ”€โ”€ Batch

โ”‚ โ””โ”€โ”€ BOM

โ”œโ”€โ”€ Customer (Channel)

โ”‚ โ”œโ”€โ”€ CustomerGroup

โ”‚ โ”œโ”€โ”€ CustomerFeeConfig (relasi langsung ke customer)

โ”‚ โ”‚ โ””โ”€โ”€ CustomerFeeComponent (master, tidak langsung ke customer)

โ”‚ โ””โ”€โ”€ SalesOrder

โ”‚ โ”œโ”€โ”€ SalesOrderItem

โ”‚ โ”‚ โ””โ”€โ”€ DeliveryNoteItem

โ”‚ โ”œโ”€โ”€ SalesOrderFee (via SO, snapshot)

โ”‚ โ”‚ โ””โ”€โ”€ CustomerFeeComponent (master, snapshot)

โ”‚ โ”œโ”€โ”€ DeliveryNote

โ”‚ โ”‚ โ””โ”€โ”€ DeliveryNoteItem

โ”‚ โ””โ”€โ”€ SalesInvoice

โ”‚ โ””โ”€โ”€ SalesInvoiceItem

โ”œโ”€โ”€ Supplier

โ”‚ โ”œโ”€โ”€ SupplierGroup

โ”‚ โ”œโ”€โ”€ TaxWithholdingCategory

โ”‚ โ””โ”€โ”€ PurchaseOrder

โ”‚ โ”œโ”€โ”€ PurchaseOrderItem

โ”‚ โ””โ”€โ”€ PurchaseReceipt

โ”‚ โ”œโ”€โ”€ PurchaseReceiptItem

โ”‚ โ”‚ โ””โ”€โ”€ QualityInspection

โ”‚ โ””โ”€โ”€ PurchaseInvoice

โ”‚ โ”œโ”€โ”€ PurchaseInvoiceItem

โ”‚ โ””โ”€โ”€ TaxWithholdingEntry

โ”œโ”€โ”€ Warehouse

โ”œโ”€โ”€ Asset

โ”‚ โ”œโ”€โ”€ AssetCategory

โ”‚ โ”œโ”€โ”€ AssetDepreciationSchedule

โ”‚ โ””โ”€โ”€ AssetMovement

โ”œโ”€โ”€ Employee

โ”‚ โ”œโ”€โ”€ SalesPerson โž• (employee_id)

โ”‚ โ”œโ”€โ”€ Attendance

โ”‚ โ”œโ”€โ”€ LeaveAllocation

โ”‚ โ”œโ”€โ”€ LeaveApplication

โ”‚ โ””โ”€โ”€ SalaryStructure

โ””โ”€โ”€ JournalEntry

โ”œโ”€โ”€ JournalEntryItem

โ””โ”€โ”€ GLEntry

PaymentEntry

โ”œโ”€โ”€ PaymentLedgerEntry

โ”œโ”€โ”€ PaymentEntryReference โž• (child table, pengganti JSONB references)

โ”œโ”€โ”€ PaymentEntryDeduction (child table, pengganti JSONB)

โ””โ”€โ”€ ModeOfPayment

Bank

โ””โ”€โ”€ BankAccount

โ””โ”€โ”€ BankTransaction

โ””โ”€โ”€ PaymentEntry

TaxTemplate

โ””โ”€โ”€ TaxTemplateItem

TaxWithholdingCategory

โ””โ”€โ”€ TaxWithholdingEntry

12. Catatan Implementasi

Aspek Catatan
Primary Key Semua tabel menggunakan UUID sebagai primary key.
Timestamp Semua tabel memiliki created_at dan updated_at (kecuali SLE/GL yang immutabel).
Soft Delete Tidak ada soft delete. Gunakan Ash.Archival untuk soft delete/archive. Data keuangan wajib disimpan 10 tahun.
JSONB Digunakan untuk data dinamis: components, parameters, result, additional_costs, roles, conditions, metadata (hapus references, deductions).
Tree accounts, item_groups, customer_groups, supplier_groups, warehouses, cost_centers menggunakan parent_id.
Batch Traceability batches memiliki parent_batch_id untuk inheritance FG โ† Bulk.
Price List HANYA 1 Price List ("Harga Dasar - IDR"). Semua variasi harga ditangani oleh Fee Components.
Sales Person sales_persons.employee_id โ†’ employees; snapshot per transaksi di sales_orders.sales_person_id.
Dedup Key (Sales Order) (customer_id, item_id, posting_date) - cukup untuk mencegah double import CSV.
Fee Components Master jenis biaya (customer_fee_components) TIDAK punya relasi ke customer. Konfigurasi per customer (customer_fee_configs) yang punya relasi ke customer.
Effective Date customer_fee_configs memiliki effective_date_from dan effective_date_to untuk menangani perubahan fee.
Snapshot sales_order_fees menyimpan snapshot fee saat transaksi terjadi (prinsip immutability akuntansi).
Akun Snapshot Pembayaran paid_from/paid_to_account_id di payment_entries = snapshot akun saat submit; rekonsiliasi bank memfilter PE via kolom ini. modes_of_payment.default_account_id tetap ada sebagai resolver saat submit.
Cloak (Enkripsi) Field rate, amount, twist_notes, dan field finansial/PII dienkripsi at-rest dengan Cloak (menggantikan Chinese Wall). Akses server oleh IT dibatasi lewat pemisahan tanggung jawab organisasi (staf IT per perangkat, hanya Manager IT pegang Server App).
Security Layers (v1.5) Cloak (at-rest) + Ash.Policy.Authorizer (aksi) + konfigurasi workspace (UI); permission_level tidak dipakai.
Akun Beban Wajib Beban Marketplace Fee, Beban Komisi Reseller, Beban Diskon Penjualan, Beban Promosi harus ada di CoA.
Derived State bins = materialized view rebuildable dari SLE.
Referensi USD reference_usd_rate dan reference_usd_price di Purchase untuk memisahkan selisih kurs vs kenaikan harga.
Child Table Deductions payment_entry_deductions sebagai pengganti JSONB deductions untuk memudahkan agregasi di laporan.
Archival Gunakan Ash.Archival untuk memenuhi kewajiban penyimpanan data keuangan 10 tahun.
Oban background_jobs dihapus dari spec. Oban membawa tabelnya sendiri.

Dokumen ini adalah blueprint database untuk implementasi BMP dengan Ash Framework. Versi 1.5 mencakup seluruh keputusan final dari analisis gap, konflik Price List, pengembalian Sales Person, dan penggantian Chinese Wall dengan Cloak.