Files
be-accone/sql-collections/inventaris-coa-mapping-notes.md

3.8 KiB

Inventaris COA Mapping Notes

Existing Table Purposes

coa is the Chart of Account master. It stores the real account identity:

  • coaID: primary key, use this for mapping.
  • coaAccountNo: account number for display/reporting.
  • coaDescription: account name/description.
  • coaIsInput: marks accounts that can be posted to.
  • coaIsActive: active account flag.
  • coaLevel: account hierarchy level.

coa_group, coa_subgroup, and coa_mapgroup organize COA rows for reporting or account selection:

coa_group
  -> coa_subgroup
      -> coa_mapgroup
          -> coa

Relationship:

coa_group.CoaGroupID
    = coa_subgroup.CoaSubGroupCoa_GroupID

coa_subgroup.CoaSubGroupID
    = coa_mapgroup.CoaMapGroupCoaSubGroupID

coa.coaID
    = coa_mapgroup.CoaMapGroupCoaID

These tables should not be changed for inventaris mapping. They can be used only to filter or help select valid COA rows in the UI.

nat_group and nat_subgroup classify normal item nature/type. They are mainly used by non-inventaris item flows, especially item category 1.

nat_group
  -> nat_subgroup
      -> m_item

Relationship:

nat_group.Nat_GroupID
    = nat_subgroup.Nat_SubGroupNat_GroupID

m_item.M_ItemNat_GroupID
    = nat_group.Nat_GroupID

m_item.M_ItemNat_SubGroupID
    = nat_subgroup.Nat_SubGroupID

nat_subgroup_map, map_nat_group, and map_nat_subgroup connect NAT classification to COA for normal item accounting:

  • nat_subgroup_map: maps NAT subgroup to pendapatan, diskon, and retur COA.
  • map_nat_group: maps NAT group to diskon, retur, DP, and debt/hutang COA.
  • map_nat_subgroup: maps NAT group/subgroup to pendapatan, biaya, and persediaan COA.

Typical normal item accounting flow:

m_item
  -> M_ItemNat_GroupID + M_ItemNat_SubGroupID
      -> map_nat_subgroup / map_nat_group / nat_subgroup_map
          -> coa.coaID

Relationship To m_item

m_item has multiple classification fields:

M_ItemItem_CategoryID
M_ItemNat_GroupID
M_ItemNat_SubGroupID
M_ItemFa_ClassID
M_ItemM_InventarisGolID

For item category 1, NAT group/subgroup is the main accounting classification.

For inventaris item category 2, M_ItemM_InventarisGolID should be the main accounting classification. Do not add COA fields to m_item.

New Inventaris COA Mapping

Use m_inventaris_coa_mapping as the default COA mapping source for inventaris items based on golongan inventaris:

m_item.M_ItemM_InventarisGolID
    -> m_inventaris_coa_mapping.M_InventarisCoaMappingM_InventarisGolID
        -> coa.coaID fields

The mapping table stores coa.coaID, not account number text. Account number and description should be read from coa when displaying or posting journals.

Recommended lookup rule:

1. Check active item-level override in m_inventaris_item_coa_mapping.
2. If no override exists, use active gol-level default in m_inventaris_coa_mapping.
3. If no mapping exists, stop the transaction and show an incomplete COA mapping error.

m_inventaris_item_coa_mapping is optional and only for specific item exceptions. Its COA fields are nullable so one item can override only one account and inherit the rest from the gol-level default.

COA Fields For Inventaris

The default gol-level mapping should provide:

  • CoaAsetID: asset/inventaris account.
  • CoaHutangID: payable account.
  • CoaPembelianID: purchase or acquisition account.
  • CoaBebanPenyusutanID: depreciation expense account.
  • CoaAkumulasiPenyusutanID: accumulated depreciation account.
  • CoaLabaPelepasanID: gain on disposal account.
  • CoaRugiPelepasanID: loss on disposal account.

Use active, postable COA rows where possible:

coa.coaIsActive = 'Y'
AND coa.coaIsInput = 'Y'

coa_group and coa_subgroup may help filter dropdown options, but the saved mapping should still point directly to coa.coaID.