> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quinnsambal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hpp

<style>
  {`
    [class*="max-w-none"][class*="table"] {
      display: block !important;
      overflow-x: auto !important;
      max-width: 100% !important;
      width: 100% !important;
      flex-grow: 0 !important;
    }
    [class*="max-w-none"][class*="table"] > table {
      width: 100% !important;
      max-width: 100% !important;
      table-layout: fixed !important;
    }
    .mermaid {
      max-width: 100% !important;
      overflow-x: auto !important;
    }
    article svg[role="img"] {
      max-width: 100% !important;
      height: auto !important;
    }
    article img, .prose img {
      max-width: 100% !important;
      height: auto !important;
    }
    img[src*="LOGO"], img[src*="logo"] {
      max-width: 120px !important;
      max-height: 40px !important;
      width: auto !important;
      height: auto !important;
      object-fit: contain !important;
    }
    `}
</style>

***

title: "HPP Calculator"
description: "Kalkulator Harga Pokok Produksi untuk menghitung COGS, bahan baku, tenaga kerja, overhead, dan margin keuntungan."
--------------------------------------------------------------------------------------------------------------------------------

# HPP Calculator

<img src="https://mintcdn.com/quinnofspicy/e4f_upKhVWcjsUmM/docs/mintlify/screenshots/inventory/hpp.png?fit=max&auto=format&n=e4f_upKhVWcjsUmM&q=85&s=75028962e0746de8d36e38ad9ed1ee7d" alt="HPP Calculator" width="1920" height="1080" data-path="docs/mintlify/screenshots/inventory/hpp.png" />

HPP Calculator menghitung **Harga Pokok Produksi** (Cost of Goods Sold / COGS) dari produk yang kamu jual. Kalkulator ini menjumlahkan tiga komponen biaya — bahan baku, tenaga kerja langsung, dan overhead produksi — menjadi satu angka HPP per unit yang akurat. Dengan HPP yang benar, kamu bisa menentukan harga jual yang tepat dan memastikan bisnis tetap profitable.

Banyak pelaku bisnis F\&B yang melewatkan perhitungan HPP dengan benar dan akhirnya salah menentukan harga jual — terlalu rendah (rugi) atau terlalu tinggi (kalah bersaing). Fitur ini menghilangkan tebakan tersebut.

## Arsitektur HPP Calculator

```mermaid theme={null}
graph TB
    subgraph "Input Biaya"
        RM[Bahan Baku<br/>Per Jenis & Jumlah]
        DL[Tenaga Kerja Langsung<br/>Upah per Unit]
        OH[Overhead<br/>Listrik, Sewa, Penyusutan]
    end

    subgraph "Kalkulasi Engine"
        TRM[Total Bahan Baku<br/>Σ qty × harga per bahan]
        TDL[Total Tenaga Kerja<br/>Upah × waktu / 60]
        TOH[Total Overhead<br/>Biaya bulanan / estimasi produksi]
    end

    subgraph "Output"
        HPP[HPP per Unit<br/>TRM + TDL + TOH]
        MARGIN[Margin Keuntungan<br/>Harga Jual - HPP]
        PERCENT["Margin %<br/>(Margin / Harga Jual) × 100%"]
    end

    RM --> TRM
    DL --> TDL
    OH --> TOH
    TRM & TDL & TOH --> HPP
    HPP --> MARGIN --> PERCENT
```

## 3 Komponen HPP

### 1. Biaya Bahan Baku

Input setiap bahan yang digunakan untuk memproduksi satu unit produk:

| Field | Tipe | Deskripsi | Contoh |
| - | - | - | - |
| **Nama Bahan** | Text | Jenis bahan | Cabai Merah |
| **Quantity** | Number | Jumlah yang digunakan | 0.15 kg |
| **Satuan** | Dropdown | Unit pengukuran | kg |
| **Harga per Satuan** | Number | Harga beli per unit | Rp 45.000/kg |
| **Subtotal** | Auto | Qty × Harga | Rp 6.750 |

**Contoh: Bahan Baku Ayam Suwir Petir 150g**

| Bahan | Qty | Satuan | Harga/Satuan | Subtotal |
| - | - | - | - | - |
| Ayam (dada) | 0.10 | kg | Rp 35.000 | Rp 3.500 |
| Cabai Merah | 0.05 | kg | Rp 45.000 | Rp 2.250 |
| Bawang Putih | 0.02 | kg | Rp 30.000 | Rp 600 |
| Minyak Goreng | 0.03 | liter | Rp 16.000 | Rp 480 |
| Garam & Bumbu | 0.01 | kg | Rp 20.000 | Rp 200 |
| Kemasan Pouch | 1 | pcs | Rp 500 | Rp 500 |
| Label Sticker | 1 | pcs | Rp 200 | Rp 200 |
| **Total Bahan Baku** | | | | **Rp 7.730** |

### 2. Biaya Tenaga Kerja Langsung

Upah yang dibayarkan untuk pekerja yang terlibat langsung dalam produksi satu unit:

| Field | Tipe | Deskripsi | Contoh |
| - | - | - | - |
| **Jenis Pekerjaan** | Text | Deskripsi pekerjaan | Memasak & Mengemas |
| **Upah per Jam** | Number | Tarif per jam | Rp 20.000 |
| **Waktu per Unit** | Number | Menit per unit | 5 menit |
| **Biaya per Unit** | Auto | (Upah × Waktu) / 60 | Rp 1.667 |

**Contoh:**

| Pekerjaan | Upah/Jam | Waktu/Unit | Biaya/Unit |
| - | - | - | - |
| Persiapan bahan | Rp 20.000 | 3 menit | Rp 1.000 |
| Memasak | Rp 20.000 | 10 menit | Rp 3.333 |
| Mengemas | Rp 20.000 | 2 menit | Rp 667 |
| **Total Tenaga Kerja** | | | **Rp 5.000** |

### 3. Biaya Overhead

Biaya tidak langsung yang perlu dialokasikan ke setiap unit produksi:

| Field | Tipe | Deskripsi | Contoh |
| - | - | - | - |
| **Jenis Biaya** | Text | Nama biaya | Listrik, Sewa, dll |
| **Biaya per Bulan** | Number | Total biaya bulanan | Rp 2.000.000 |
| **Estimasi Produksi/Bulan** | Number | Jumlah unit per bulan | 1.000 unit |
| **Biaya per Unit** | Auto | Biaya / estimasi produksi | Rp 2.000 |

**Contoh Overhead Bulanan:**

| Jenis Overhead | Biaya/Bulan | Alokasi/Unit (÷1.000) | Kategori |
| - | - | - | - |
| Listrik (kompor, blender, kulkas) | Rp 1.500.000 | Rp 1.500 | Utility |
| Gas LPG | Rp 800.000 | Rp 800 | Utility |
| Sewa tempat (bagian produksi) | Rp 3.000.000 | Rp 3.000 | Fixed |
| Penyusutan alat | Rp 500.000 | Rp 500 | Depreciation |
| Air bersih | Rp 200.000 | Rp 200 | Utility |
| Kemasan sekunder (box, bubble wrap) | Rp 300.000 | Rp 300 | Packaging |
| **Total Overhead** | **Rp 6.300.000** | **Rp 6.300** | |

## Kalkulasi HPP

```mermaid theme={null}
flowchart TD
    A[Total Bahan Baku<br/>Rp 7.730] --> D[HPP per Unit]
    B[Total Tenaga Kerja<br/>Rp 5.000] --> D
    C[Total Overhead<br/>Rp 6.300] --> D
    D --> E["HPP = Rp 19.030"]
    E --> F{Harga Jual}
    F --> G["Rp 25.000"]
    G --> H["Margin = Rp 5.970"]
    H --> I["Margin % = 23.9%"]
```

### Hasil Kalkulasi

| Komponen | Nilai | % dari HPP | Visualisasi |
| - | - | - | - |
| Bahan Baku | Rp 7.730 | 40.6% | ████████░░ |
| Tenaga Kerja | Rp 5.000 | 26.3% | █████░░░░░ |
| Overhead | Rp 6.300 | 33.1% | ██████░░░░ |
| **HPP per Unit** | **Rp 19.030** | **100%** | ██████████ |
| Harga Jual | Rp 25.000 | - | - |
| **Margin** | **Rp 5.970** | - | - |
| **Margin %** | **23.9%** | - | - |

## Perbandingan HPP vs Harga Jual

| Produk | HPP | Harga Jual | Margin | Margin % | Status | Rekomendasi |
| - | - | - | - | - | - | - |
| Ayam Suwir 150g | Rp 19.030 | Rp 25.000 | Rp 5.970 | 23.9% | 🟡 Cukup | Pertahankan |
| Ayam Suwir 300g | Rp 35.500 | Rp 45.000 | Rp 9.500 | 21.1% | 🟡 Cukup | Naikkan sedikit |
| Sambal Matah 100ml | Rp 8.500 | Rp 15.000 | Rp 6.500 | 43.3% | 🟢 Sangat Baik | Optimal |
| Keripik Singkong 100g | Rp 12.000 | Rp 12.500 | Rp 500 | 4.0% | 🔴 Terlalu Rendah | Naikkan harga |

> **Target margin** untuk bisnis F\&B biasanya 30-50%. Jika margin \< 20%, evaluasi harga jual atau efisiensi produksi.

## Simpan & Riwayat

```mermaid theme={null}
flowchart LR
    A[Hitung HPP] --> B{Simpan?}
    B -->|Ya| C[Input Nama Produk]
    C --> D[Save ke Database]
    D --> E[Riwayat Perhitungan]
    B -->|Tidak| F[Continue Editing]
    
    E --> G[Lihat Perhitungan Lama]
    G --> H[Update Harga Bahan]
    H --> I[Re-kalkulasi]
    I --> J[Bandingkan<br/>HPP Lama vs Baru]
```

| Fitur | Detail |
| - | - |
| **Simpan Perhitungan** | Beri nama produk, simpan untuk referensi |
| **Riwayat** | Lihat semua perhitungan yang pernah dibuat |
| **Update** | Update perhitungan saat harga bahan berubah |
| **Bandingkan** | Bandingkan HPP lama vs baru setelah perubahan |
| **Export** | Download hasil ke PDF atau Excel |

## Flow Penggunaan

```mermaid theme={null}
sequenceDiagram
    participant U as User
    participant C as Calculator
    participant DB as Database

    U->>C: Input bahan baku satu per satu
    C->>C: Hitung total bahan baku (Σ qty × harga)
    U->>C: Input tenaga kerja (jenis, upah, waktu)
    C->>C: Hitung total tenaga kerja per unit
    U->>C: Input overhead bulanan
    C->>C: Hitung overhead per unit (÷ estimasi produksi)
    C->>C: Kalkulasi HPP = BB + TK + OH
    U->>C: Input harga jual
    C->>C: Hitung margin & margin %
    U->>C: Review hasil
    U->>DB: Simpan perhitungan
```

## Integrasi dengan Modul Lain

| Modul | Integrasi | Detail |
| - | - | - |
| **Inventory** | Harga bahan baku | Mengambil harga beli terbaru dari stok |
| **POS** | Harga jual | HPP digunakan untuk validasi margin di POS |
| **Manufacturing** | BOM (Bill of Materials) | HPP per produk jadi dari resep produksi |
| **Finance** | COGS reporting | Data HPP untuk laporan laba rugi |

## Cara Akses

Dari sidebar, klik menu **Inventory** > **HPP Calculator**.

## Tips

* **Jangan lewatkan overhead** — biaya yang terlihat kecil (listrik, air, penyusutan) jika diakumulasi bisa menjadi komponen terbesar HPP
* **Review HPP secara rutin** — terutama saat harga bahan baku naik, agar margin keuntungan tetap terjaga
* **Gunakan data aktual** — jangan mengestimasi terlalu rendah. Lebih baik HPP sedikit overestimate daripada rugi tanpa sadar
* **Bandingkan antar variant** — variant dengan margin terendah mungkin perlu dinaikkan harganya atau dioptimasi bahan bakunya
* **Update estimasi produksi/bulan** secara berkala — jika produksi naik, overhead per unit turun dan margin membaik
* **Target margin minimal 30%** untuk bisnis F\&B — jika di bawah itu, fokus pada efisiensi atau naikkan harga jual

***

## Entity Schema & Arsitektur Data

### Entity Relationship Diagram

Berikut adalah relasi antar entitas yang terlibat dalam kalkulasi HPP:

```mermaid theme={null}
erDiagram
    ProductionOrder ||--o| HPPCalculation : "menghasilkan"
    ProductionOrder ||--o{ StockMovement : "konsumsi bahan (out)"
    ProductionOrder ||--o{ StockMovement : "hasil produksi (in)"
    PurchaseOrder ||--o{ StockMovement : "pembelian bahan (in)"
    StockMovement }o--|| CompanyPOSProduct : "referensi produk"
    CompanyPOSProduct ||--o{ StockMovement : "pergerakan stok"
    HPPCalculation }o--|| CompanyPOSProduct : "produk kalkulasi"

    ProductionOrder {
        string id PK
        string company_id FK
        string po_number
        string production_batch_id
        string bom_id FK
        string product_id FK
        string product_sku
        string product_name
        number quantity_to_produce
        number quantity_produced
        number total_material_cost
        number direct_labor_cost
        number overhead_cost
        number total_batch_cost
        number unit_hpp
        string cost_status
        string status
    }

    HPPCalculation {
        string id PK
        string company_id FK
        string product_id FK
        string product_name
        string calculation_method
        date period_start
        date period_end
        array raw_materials
        array direct_labor_costs
        array overhead_costs
        number total_raw_materials
        number total_direct_labor
        number total_overhead
        number total_production_cost
        number units_produced
        number hpp_per_unit
        number profit_margin_percentage
        number suggested_selling_price
        string production_order_id FK
        string production_batch_id
        string cost_status
    }

    StockMovement {
        string id PK
        string company_id FK
        string inventory_id FK
        string product_id FK
        string movement_type
        number quantity
        number unit_cost
        number total_cost
        number unit_price
        number total_revenue
        number profit
        number profit_margin
        string reference_type
        string lot_id
        string allocation_strategy
    }

    CompanyPOSProduct {
        string id PK
        string company_id FK
        string name
        string sku
        number price
        number cost
        number stock
        string product_type
        object channel_pricing
    }

    PurchaseOrder {
        string id PK
        string company_id FK
        string supplier_id FK
        string po_number
        date po_date
        array items
        number total_amount
        string status
        string received_status
    }
```

### Tabel Schema: HPPCalculation

Entitas utama untuk menyimpan hasil kalkulasi HPP per produk per periode.

| Field | Tipe | Required | Default | Deskripsi |
| - | - | - | - | - |
| `id` | string | Ya (auto) | UUID | Primary key |
| `company_id` | string | Tidak | - | ID perusahaan (multi-tenant) |
| `product_id` | string | Tidak | - | ID produk yang dihitung HPP-nya |
| `product_name` | string | **Ya** | - | Nama produk (untuk tampilan) |
| `calculation_method` | enum | Tidak | `Average` | Metode kalkulasi: `FIFO`, `LIFO`, `Average` |
| `period_start` | date | **Ya** | - | Tanggal awal periode kalkulasi |
| `period_end` | date | **Ya** | - | Tanggal akhir periode kalkulasi |
| `raw_materials` | array\[object] | Tidak | - | Daftar bahan baku: `{name, quantity, unit, unit_cost, total_cost}` |
| `direct_labor_costs` | array\[object] | Tidak | - | Daftar tenaga kerja langsung: `{description, hours, rate_per_hour, total_cost}` |
| `overhead_costs` | array\[object] | Tidak | - | Daftar biaya overhead: `{category, description, amount}` |
| `total_raw_materials` | number | Tidak | - | Total biaya bahan baku (Rp) |
| `total_direct_labor` | number | Tidak | - | Total biaya tenaga kerja langsung (Rp) |
| `total_overhead` | number | Tidak | - | Total biaya overhead (Rp) |
| `total_production_cost` | number | Tidak | - | Total biaya produksi = BB + TK + OH (Rp) |
| `units_produced` | number | Tidak | - | Jumlah unit yang diproduksi |
| `hpp_per_unit` | number | Tidak | - | HPP per unit = total\_production\_cost / units\_produced (Rp) |
| `profit_margin_percentage` | number | Tidak | - | Target margin keuntungan (%) |
| `suggested_selling_price` | number | Tidak | - | Harga jual yang disarankan berdasarkan target margin |
| `notes` | string | Tidak | - | Catatan tambahan |
| `production_order_id` | string | Tidak | - | FK ke ProductionOrder terkait (CST-06) |
| `production_batch_id` | string | Tidak | - | Batch ID produksi terkait (CST-06) |
| `cost_status` | enum | Tidak | `complete` | Status kelengkapan biaya: `complete`, `provisional_incomplete`, `zero_output_pending` |

### Tabel Schema: StockMovement (Field Biaya)

Field-field pada StockMovement yang berkaitan dengan kalkulasi HPP dan margin.

| Field | Tipe | Default | Deskripsi |
| - | - | - | - |
| `unit_cost` | number | `0` | Harga modal per unit saat transaksi terjadi |
| `total_cost` | number | `0` | Total modal = quantity × unit\_cost |
| `total_value` | number | `0` | Nilai modal = quantity × unit\_cost (alias untuk total\_cost) |
| `unit_price` | number | `0` | Harga jual per unit (dinamis per channel penjualan) |
| `total_revenue` | number | `0` | Total pendapatan = quantity × unit\_price |
| `profit` | number | `0` | Laba/rugi = total\_revenue - total\_cost |
| `profit_margin` | number | `0` | Margin laba (%) = profit / total\_revenue × 100 |
| `allocation_strategy` | string | - | Strategi alokasi biaya: `fifo`, `fefo`, atau `manual` |
| `override_reason` | string | - | Alasan jika pemilihan lot menyimpang dari FIFO standar (FIFO-03) |

### Tabel Schema: CompanyPOSProduct (Field Biaya)

Field-field pada CompanyPOSProduct yang menyimpan data biaya/modal produk.

| Field | Tipe | Default | Deskripsi |
| - | - | - | - |
| `cost` | number | - | Harga modal/beli produk (Rp) — digunakan sebagai basis HPP |
| `price` | number | - | Harga jual produk (Rp) |
| `channel_pricing` | object | - | Harga khusus per channel: `{offline_pos, marketplace, website, whatsapp, reseller, b2b, grab, social_media}` |
| `product_type` | enum | `finished_good` | Tipe produk: `finished_good`, `raw_material`, `semi_finished`, `packaging_material`, `bundle` |

***

## State Machine: Status Kalkulasi HPP

Field `cost_status` (pada HPPCalculation dan ProductionOrder) menandakan kelengkapan data biaya dalam sebuah batch produksi.

```mermaid theme={null}
stateDiagram-v2
    [*] --> complete: Semua input biaya tercatat lengkap
    [*] --> provisional_incomplete: Ada bahan yang belum ada harga tercatat
    [*] --> zero_output_pending: Output produk baik = 0 (belum bisa hitung HPP)

    provisional_incomplete --> complete: Harga bahan dilengkapi / lot ditemukan
    provisional_incomplete --> zero_output_pending: Output baik ternyata 0

    zero_output_pending --> complete: Output baik masuk setelah QC / rework
    zero_output_pending --> provisional_incomplete: Output baik > 0 tapi masih ada input tanpa harga

    complete --> [*]: HPP per unit finalized, snapshot biaya dikunci
    provisional_incomplete --> [*]: HPP sementara digunakan untuk pricing
    zero_output_pending --> [*]: Beban abnormal diakui, tidak ada HPP unit
```

| Status | Kondisi | Implikasi |
| - | - | - |
| `complete` | Semua bahan baku, tenaga kerja, dan overhead sudah tercatat dengan harga pasti | HPP per unit finalized dan bisa digunakan untuk pricing, laporan laba rugi, dan snapshot biaya dikunci permanen |
| `provisional_incomplete` | Ada satu atau lebih lot bahan yang belum memiliki harga tercatat (misal: barang konsinyasi, harga belum dikonfirmasi supplier) | HPP sementara (provisional) digunakan untuk pricing; akan di-recalculate saat harga lengkap |
| `zero_output_pending` | Jumlah output produk baik = 0 (seluruh produksi gagal atau masih dalam proses QC) | Belum bisa menghitung HPP per unit; beban yang terjadi diakui sebagai beban abnormal |

***

## Diagram Sekuens: Alur Kalkulasi HPP

### HPP dari Perintah Produksi (Manufacturing)

```mermaid theme={null}
sequenceDiagram
    participant OP as Operator Produksi
    participant PO as ProductionOrder
    participant SM as StockMovement
    participant HPP as HPPCalculation
    participant DB as Database

    OP->>PO: Buat perintah produksi (BOM, qty, tanggal)
    PO->>PO: Status = planned
    OP->>PO: Mulai produksi (start)
    PO->>PO: Status = in_progress

    loop Konsumsi setiap bahan baku
        PO->>SM: Catat pengeluaran bahan (movement_type = out)
        SM->>SM: Tentukan lot FIFO/FEFO
        SM->>SM: Catat unit_cost dari lot yang dipilih
        SM->>SM: total_cost = qty × unit_cost
        SM->>DB: Simpan StockMovement
    end

    PO->>PO: Hitung total_material_cost dari semua konsumsi
    PO->>PO: Catat direct_labor_cost (operator × durasi)
    PO->>PO: Catat overhead_cost (alokasi batch)

    OP->>PO: Selesaikan produksi + laporan QC
    PO->>PO: Hitung total_batch_cost
    PO->>PO: unit_hpp = allocated_cost_to_good / quantity_produced

    alt quantity_produced > 0
        PO->>PO: cost_status = complete
        PO->>HPP: Buat record HPPCalculation
        HPP->>HPP: hpp_per_unit = total_production_cost / units_produced
        HPP->>HPP: suggested_selling_price = hpp / (1 - margin%)
        HPP->>DB: Simpan hasil kalkulasi
    else quantity_produced = 0
        PO->>PO: cost_status = zero_output_pending
        PO->>PO: abnormal_loss_amount = total_batch_cost
        Note over PO: Tidak ada HPP per unit
    end
```

### HPP dari Pembelian (Purchase — FIFO)

```mermaid theme={null}
sequenceDiagram
    participant SP as Supplier
    participant PUR as PurchaseOrder
    participant WH as Gudang
    participant SM as StockMovement
    participant INV as CompanyPOSProduct
    participant SALE as Penjualan

    SP->>PUR: Kirim bahan baku
    PUR->>PUR: Status = received
    PUR->>WH: Terima barang, buat lot/batch baru
    WH->>SM: Catat movement_type = in, reference_type = purchase
    SM->>SM: unit_cost = harga beli dari PO
    SM->>SM: total_cost = qty × unit_cost
    SM->>INV: Update stok produk (stock += qty)

    Note over SALE: Saat terjadi penjualan...

    SALE->>SM: Catat movement_type = out, reference_type = sale
    SM->>SM: Cari lot tertua (FIFO)
    SM->>SM: unit_cost = cost dari lot FIFO tertua
    SM->>SM: total_cost = qty_jual × unit_cost
    SM->>SM: profit = total_revenue - total_cost
    SM->>SM: profit_margin = profit / total_revenue × 100
    SM->>INV: Update stok produk (stock -= qty)
```

### HPP Weighted Average

```mermaid theme={null}
sequenceDiagram
    participant A as Stok Awal
    participant B as Pembelian Baru
    participant C as Kalkulasi Average
    participant D as Penjualan

    A->>C: Stok lama = 100 unit × Rp 10.000 = Rp 1.000.000
    B->>C: Pembelian baru = 50 unit × Rp 12.000 = Rp 600.000
    C->>C: Total nilai = Rp 1.000.000 + Rp 600.000 = Rp 1.600.000
    C->>C: Total unit = 100 + 50 = 150 unit
    C->>C: HPP rata-rata = Rp 1.600.000 / 150 = Rp 10.667/unit

    D->>C: Jual 30 unit
    C->>C: total_cost = 30 × Rp 10.667 = Rp 320.010
    C->>C: HPP rata-rata tetap Rp 10.667 sampai pembelian berikutnya
```

***

## Tabel Enum

### Enum: `calculation_method`

Metode kalkulasi HPP yang tersedia pada entitas HPPCalculation.

| Nilai | Deskripsi | Kapan Digunakan |
| - | - | - |
| `FIFO` | First In First Out — biaya bahan dari lot yang paling pertama masuk digunakan pertama | Bisnis F\&B dengan bahan perishable (cabai, daging, susu); memastikan bahan lama terpakai duluan |
| `LIFO` | Last In First Out — biaya bahan dari lot terbaru digunakan pertama | Jarang digunakan di F\&B; lebih umum di bisnis non-perishable |
| `Average` | Weighted Average — biaya rata-rata tertimbang dari semua lot yang tersedia | Default sistem; cocok untuk produk dengan banyak batch bahan yang bercampur (bumbu, sambal) |

### Enum: `cost_status`

Status kelengkapan data biaya pada HPPCalculation dan ProductionOrder.

| Nilai | Deskripsi | Tindakan yang Diperlukan |
| - | - | - |
| `complete` | Semua komponen biaya (bahan, tenaga kerja, overhead) tercatat dengan harga pasti | Tidak ada tindakan; HPP finalized dan bisa digunakan |
| `provisional_incomplete` | Ada komponen biaya yang masih menggunakan estimasi atau harga belum dikonfirmasi | Follow up supplier untuk harga pasti; recalculate saat data lengkap |
| `zero_output_pending` | Output produk baik = 0, belum bisa menghitung HPP per unit | Tunggu hasil QC atau acknowledge sebagai beban abnormal |

***

## Komponen Biaya HPP

Tabel berikut merinci semua komponen yang masuk dalam perhitungan HPP pada sistem QUINNOFSPICY:

| Komponen | Field Sumber | Entitas | Deskripsi | Contoh (Rp) |
| - | - | - | - | - |
| **Bahan Baku Direct** | `direct_raw_material_cost` | ProductionOrder | Biaya bahan mentah langsung (daging, cabai, bawang) | 7.730 |
| **Bahan Semi-Finished** | `semi_finished_cost` | ProductionOrder | Biaya bahan intermediate dari produksi sebelumnya (pasta cabai, bumbu dasar) | 2.000 |
| **Bahan Kemasan** | `packaging_cost` | ProductionOrder | Biaya kemasan primer & sekunder (pouch, label, box, bubble wrap) | 700 |
| **Tenaga Kerja Langsung** | `direct_labor_cost` | ProductionOrder | Upah operator produksi untuk batch tersebut (memasak, mengemas) | 5.000 |
| **Overhead Pabrik** | `overhead_cost` | ProductionOrder | Alokasi biaya tidak langsung: listrik, gas, sewa, penyusutan alat | 6.300 |
| **Total Biaya Batch** | `total_batch_cost` | ProductionOrder | Jumlah semua biaya aktual satu batch produksi | 21.730 |
| **Kredit By-Product** | `byproduct_credit` | ProductionOrder | Pengurang biaya dari nilai sisa/by-product yang bisa dijual | -500 |
| **Beban Abnormal** | `abnormal_loss_amount` | ProductionOrder | Kerugian abnormal yang di-exclude dari HPP produk baik (gagal produksi, cacat) | 0 |
| **Biaya Dialokasi ke Produk Baik** | `allocated_cost_to_good` | ProductionOrder | total\_batch\_cost - byproduct\_credit - abnormal\_loss\_amount | 21.230 |
| **HPP per Unit** | `unit_hpp` | ProductionOrder | allocated\_cost\_to\_good / quantity\_produced (produk baik) | 10.615 |
| **Residual Pembulatan** | `rounding_residual` | ProductionOrder | Selisih pembulatan alokasi biaya (harus ≈ 0) | 0 |

### Metrik Rendemen & Produktivitas (CST-04)

| Metrik | Field | Deskripsi | Contoh |
| - | - | - | - |
| **Rendemen Massa** | `mass_yield_percentage` | Persentase output vs input (mengukur susut produksi) | 85% (15% susut) |
| **Rasio Produktivitas** | `productivity_ratio` | Unit output per kg input | 4.0 botol/kg |
| **Label Produktivitas** | `productivity_label` | Representasi tekstual rasio | "4.00 botol/kg" |

### Snapshot Biaya (CST-05)

Field `cost_snapshot` pada ProductionOrder menyimpan snapshot permanen yang mencakup:

* Komponen biaya terperinci (bahan, tenaga kerja, overhead)
* Sumber harga per lot (dari PO mana, harga berapa)
* Metode alokasi yang digunakan (FIFO/FEFO/manual)
* Waktu finalisasi kalkulasi

Snapshot ini bersifat **read-only** setelah dikunci dan digunakan untuk audit trail serta perbandingan HPP antar periode.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.