Skip to content

Technical

v.0.121 - May 30, 2023

Overview

This document is organized to make it easier for developers to understand how cooperative application works. This technical content created by Nur Hardyanto, a senior developer in this team. Me as a full-stack developer responsible to implement this design.

Kontrak Pinjaman/Kontrak Simpanan

In every loan activity or change of mandatory fee agreement, all cooperative members are bound by a contract. The type of contract in the application consists of 3 types:

  • Derivative Contract: This is an inherent contract that is attached to the member and is valid during membership. An example is the simpanan pokok contract.
  • Periodical Contract: A mandatory contract for each member that is for a certain period of time and will be renewed in the form of a new contract when the period is over. An example is a simpanan wajib contract per year (per year the nominal is different).
  • Flexible Contract: Contracts that can be flexibly assigned according to the member's needs. For example, Loan contract

The master contract is stored in the ref_loan_contracts table. In the table, there is a handler column which contains the class handler of the contract.

Journal Entry

Journal transaction entries are stored in the trx_journal table. Each entry is attached to the loan/savings contract ID and the corresponding member ID for that transaction, and has two timestamps, namely the transaction period timestamp, and the entry timestamp (Date of transaction entry by admin).

  1. Categories and Transaction Types

    Each journal transaction entry has category and type attributes.

    • Saving category, deposit transaction category
    • Loan category, loan transaction category
    • Service category, cooperative service transaction category (service fee, admin fee, etc.)

    The transaction types are as follows:

    NoCodeTypeDescriptionNominal
    1TGHDeterminationTransaction "billings" of principal/compulsory deposits, or fees to be deposited by membersPositive
    2DCDiscountBill discount transaction, the opposite of determinationNegative
    3DPDepositDeposit transactionNegative
    4WDWithdrawalDeposit withdrawal transactions, as opposed to depositsPositive
    5BNBonusProfit sharing/bonus transactions, similar to deposits, but sourced from profit sharing fundsNegative
    6LNLoanLoan transactionPositive
    7PAYPaymentLoan fee payment transactionNegative
    8RVReversalPayment cancellation transaction, as opposed to paymentPositive
    9PNLPenaltyFine "charge" transactionPositive
    10SLBalanceRecapitulation transaction, only used as a cache to speed up the calculation process, is not a source-of-truth and is the result of calculations from previous transactions.Positive/Negative

    For the recapitulation process, you can do the Summary (SUM) formula for the nominal column in the journal table, if it is negative, it means overpayment (Deposits), if it is positive, it means receivables (underpayment).

  2. Example of Recording Deposits

    Budi is a new employee and has just registered as a cooperative member in 2023. As a new cooperative member, Budi has a mandatory simpanan wajib according to the applicable agreement (In this case, in 2023, for example Rp. 100.000). Budi was registered in the system on February 10, 2023. And just deposit the next day.

    Thus, Budi will be assigned to 2 contracts, namely the simpanan pokok contract (#001) and the simpanan wajib contract (#002). In the following year, the simpanan wajib contract is renewed with a new nominal (ID #003, Rp. 150.000).

ID TRXDateUserContractCategoryTypeNominalDescription
0012023-02-10Budi#001SavingDetermination300.000new Simpanan Pokok
0022023-02-10Budi#002SavingDetermination100.000new Simpanan Wajib
0032023-02-11Budi#001SavingDeposit(-300.000)
0042023-02-11Budi#002SavingDeposit(-100.000)
0052023-03-01Budi#001SavingBalance(-300.000)Simpanan Pokok balance stays the same
0062023-03-01Budi#002SavingBalance(-100.000)
0072023-03-01Budi#002SavingDetermination100.000
------------------------
0xx2023-12-31Budi#002SavingWithdrawal1.100.000
0xx2023-01-01Budi#001SavingBalance(-300.000)Simpanan Pokok balance stays the same
0xx2023-01-02Budi#003SavingDetermination150.000Simpanan Wajib renewal
------------------------
  1. Example of Recording Loans and Service Fees

On March 10, 2023, Budi as applied for a loan of Rp. 12.000.000 in installments over 24 months. Based on the applicable interest rate, a flat monthly service fee of 1% is charged. After that Budi paid installments on April 15 and May 13. In June, Budi forgot to pay the installments so the following month Budi paid the installments and arrears.

Suppose Budi is subject to a loan contract (ID #010).

ID TRXDateUserContractCategoryTypeNominalFlagDescription
0012023-03-10Budi#010LoanLoan12.000.000Loan application
0022023-04-01Budi#010LoanBalance12.000.000No loan payment last month
0032023-04-01Budi#010ServiceBalance0No service fee last month
0042023-04-01Budi#010LoanDetermination500.000Loan fee for this month
0052023-04-01Budi#010ServiceDetermination120.000Service fee for this month
0062023-04-15Budi#010LoanPayment(-500.000)1^
0072023-04-15Budi#010ServicePayment(-120.000)1^
0082023-05-01Budi#010LoanBalance11.500.000
0092023-05-01Budi#010ServiceBalance0Service paid last month
0102023-05-01Budi#010LoanDetermination500.0001^^
0112023-05-01Budi#010ServiceDetermination12.0001^^
0122023-05-13Budi#010LoanPayment(-500.000)1^
0132023-05-13Budi#010ServicePayment(-12.000)1^
0142023-06-01Budi#010LoanBalance11.000.000
0152023-06-01Budi#010ServiceBalance0
0162023-06-01Budi#010LoanDetermination500.0001^^^
0172023-06-01Budi#010ServiceDetermination12.0001^^^
0182023-07-01Budi#010LoanBalance11.000.000Determination was not paid
0192023-07-01Budi#010ServiceBalance12.000Determination was not paid
0202023-07-01Budi#010LoanDetermination500.0001^^^
0212023-07-01Budi#010ServiceDetermination12.0001^^^
0222023-07-20Budi#010LoanPayment(-1.000.000)1^^^paid for 2 months
0232023-07-20Budi#010ServicePayment(-24.000)1^^^paid for 2 months
0242023-08-01Budi#010LoanBalance10.000.000
0252023-08-01Budi#010ServiceBalance0

^ Flagged settle at the time of insert payment on April 15, 2023.
^^ Flagged settle at the time of insert payment on May 13, 2023.
^^^ Flagged settle at the time of insert payment on July 20, 2023 (At the same time pay arrears)

Note: On determination type transactions, the penalty has a settle flag indicating that the bill has been clearly paid.

Released under the MIT License.