📒 General Ledger Module (gl_*)
Modul GL adalah jantung keuangan ERP Schema V2. Semua transaksi AR, AP, kas, payroll, dan transaksi lain bermuara ke Universal Journal.
1. Module Purpose
- Menyimpan Chart of Accounts (COA) per company.
- Menyimpan header journal (
gl_entry) sebagai dokumen keuangan. - Menyimpan detail baris jurnal (
gl_line) sebagai universal journal line. - Menjadi single source of truth untuk laporan keuangan dan audit.
2. Tables & Structure
| Tabel | Deskripsi singkat |
|---|---|
gl_coa | Chart of Accounts per company |
gl_entry | Header jurnal keuangan |
gl_line | Baris jurnal (debit/credit) |
3. Key Fields & Relationships
3.1 gl_coa
- Fields utama:
company_id→core_company.idcode(unique per company)nametype(asset, liability, equity, revenue, expense)is_postable(boleh dipost langsung atau hanya header)
3.2 gl_entry
- Fields utama:
company_id→core_company.identry_dateref_type(mis.AR_INV,AP_INV,CASH_TX,PAYROLL)ref_id(FK logis ke tabel sumber)note
3.3 gl_line
-
Fields utama:
entry_id→gl_entry.idcoa_id→gl_coa.iddebit,creditbranch_id(opsional, untuk segmentasi per cabang)cost_center_id(opsional jika ada dimensi tambahan)
-
Aturan kunci:
- Untuk setiap
entry_id, totalSUM(debit) = SUM(credit).
- Untuk setiap
4. Business Flows
4.1 Posting AR Invoice
- AR invoice dibuat di
fi_ar_inv. - Sistem generate
gl_entrydenganref_type = 'AR_INV',ref_id = fi_ar_inv.id. - Sistem generate
gl_line:- Debit: Piutang usaha (COA AR)
- Kredit: Pendapatan (COA revenue)
4.2 Posting AP Invoice
- AP invoice dibuat di
fi_ap_inv. - Sistem generate
gl_entry(ref_type = 'AP_INV'). gl_line:- Debit: Beban/Inventory
- Kredit: Hutang usaha.
4.3 Posting Payment
- Payment AR/AP atau cash transaction memicu
gl_entrybaru dengan kombinasi debit/kredit sesuai mapping COA.
5. Example Reports (SQL)
Query di bawah ini adalah contoh SELECT untuk laporan keuangan dasar.