Tutorial: Creating Automated Financial Reports in Compliance with PSAK (Easy & Efficient)
N
Back to Blog

Tutorial: Creating Automated Financial Reports in Compliance with PSAK (Easy & Efficient)

Tutorial
Nugroho Setiawan · Konsultan IT & Full Stack Developer 08 May 2026 7 min baca 2,300 kata 441 views
Learn how to build a PSAK-compliant financial report automation system, designed specifically for healthcare entities and businesses. This tutorial will guide you from basic concepts to technical implementation using the latest technology for operational efficiency.

Accurate and timely financial management is the backbone of every growing organization, especially in complex healthcare sectors such as hospitals and clinics. However, the process of preparing financial statements manually is often a scourge: it takes days, is prone to human error, and is difficult to continuously adapt to evolving accounting standards, such as the Statement of Financial Accounting Standards (PSAK). Imagine an Operations Manager at a hospital with 300+ beds who must consolidate data from the SIMRS, pharmacy, laboratory, and payroll systems every month. This task can consume 3-5 full working days just for data extraction and reconciliation, delaying strategic decision-making and complicating regulatory compliance. This delay is not just about efficiency, but also the risk of fines and reputation. This article aims to provide a comprehensive and practical guide on how to build a PSAK-compliant financial report automation solution, leveraging modern technology to achieve the efficiency and accuracy you need. We will discuss from the basic concepts of PSAK, system architecture, to code examples ready for implementation.

Fundamentals of PSAK and the Need for Financial Report Automation

The Statement of Financial Accounting Standards (PSAK) is the primary guideline in the preparation of financial statements in Indonesia, adopted from the International Financial Reporting Standards (IFRS). Compliance with PSAK, such as PSAK 1 on Presentation of Financial Statements, PSAK 2 on Statement of Cash Flows, or PSAK 23 on Revenue from Contracts with Customers, is vital to ensure transparency, comparability, and accountability of financial statements. For entities such as hospitals or clinic networks, the complexity of transactions is very high. Every patient, every medical procedure, every drug administered, every employee salary, and every asset purchase is a transaction that must be recorded and classified correctly. Doing this recording manually, especially for entities with thousands of daily transactions, is a recipe for inefficiency and errors. A hospital with an average of 500 patient visits per day, for example, will generate thousands of journal entries every week from various data sources such as patient billing from the SIMRS, drug sales from the pharmacy POS system, or inventory purchases from the ERP system. The manual process not only slows down monthly and annual book closing but also increases the risk of non-compliance with PSAK due to incorrect account classification or inaccurate calculations. Inaccurate data can lead to wrong business decisions, problematic audits, and even regulatory sanctions. The need for automation is no longer an option, but a strategic necessity. Automation systems enable fast, consistent data processing and minimize human intervention, thereby reducing the margin of error and ensuring financial statements are always ready in accordance with PSAK standards.

API-Based Financial Report Automation System Architecture

Building a robust and PSAK-compliant financial report automation system requires a well-planned architecture capable of integrating various data sources and implementing complex accounting logic. We recommend a microservices-based architecture with a focus on APIs (Application Programming Interfaces) for flexible and scalable data integration. The core of this architecture is the data integration layer, the transformation and accounting engine layer, and the reporting layer.

Data Integration Layer: Raw data comes from various operational systems. For hospitals, this includes SIMRS (e.g., HospitalRun version 1.2.0 or custom SIMRS), pharmacy or retail Point of Sale (POS) systems, HRIS (Human Resource Information System) for payroll, and ERP systems (e.g., Odoo 16.0 or SAP Business One) for procurement and inventory. We can use RESTful APIs for modern systems. For legacy systems without APIs, database-based data extraction methods (e.g., PostgreSQL 16.x, MySQL 8.x) or flat files (CSV, XML) can be implemented. For high transaction volumes, Message Queues such as Apache Kafka 3.6.1 or RabbitMQ 3.12.10 are highly recommended to ensure reliable real-time data delivery and prevent data loss.

Transformation and Accounting Engine Layer: Incoming data needs to be standardized and processed. Here, a backend application (e.g., built with Laravel 11.x using PHP 8.2+ or Node.js 20 LTS with Express.js) will receive data from the integration layer. This application is responsible for mapping operational transaction data into the Chart of Accounts (COA) that has been defined in accordance with PSAK. The core business logic for applying PSAK rules, such as revenue recognition (PSAK 23), depreciation calculation of fixed assets (PSAK 16), or expense journaling, will be implemented here. Examples of important data points are transaction_id, transaction_date, source_system, account_code_debit, account_code_credit, amount, and description. Relational databases such as PostgreSQL 16.x or MySQL 8.x will be the backbone for storing the structured General Journal (General Ledger) and Ledger.

Reporting Layer: After data is processed and journalized, financial reports can be generated. The reporting module can use libraries such as PHPSpreadsheet for Excel export, Dompdf for PDF, or render custom HTML for interactive web display. The generated reports must include the Balance Sheet, Income Statement, Cash Flow Statement, Statement of Changes in Equity, and Notes to Financial Statements, all in accordance with the format and content regulated by PSAK. Security aspects, such as authentication (OAuth2, JWT) and authorization (Role-Based Access Control), must be strictly implemented at every layer to protect sensitive financial data.

Technical Implementation: Database Structure and Automatic Journal Logic

In technical implementation, a solid database structure and accurate journaling logic are key. We will use PostgreSQL 16.x as the database and PHP (Laravel 11.x) as the backend programming language for this example. A well-structured Chart of Accounts (COA) design is the foundation, followed by a flexible journal table to accommodate transactions.

Database Structure (PostgreSQL 16.x):

-- Chart of Accounts (COA) Table / Account List
CREATE TABLE coa (
id SERIAL PRIMARY KEY,
account_code VARCHAR(10) UNIQUE NOT NULL,
account_name VARCHAR(100) NOT NULL,
account_type VARCHAR(50) NOT NULL, -- e.g., 'Asset', 'Liability', 'Equity', 'Revenue', 'Expense'
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- General Journal Table
CREATE TABLE journals (
id SERIAL PRIMARY KEY,
transaction_id VARCHAR(100) NOT NULL, -- Unique ID from the source system (e.g., invoice_id, payment_id)
transaction_date DATE NOT NULL,
description TEXT,
source_system VARCHAR(50), -- e.g., 'SIMRS', 'POS_Farmasi', 'HRIS'
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Journal Detail Table (Debit/Credit)
CREATE TABLE journal_details (
id SERIAL PRIMARY KEY,
journal_id INTEGER NOT NULL REFERENCES journals(id) ON DELETE CASCADE,
coa_id INTEGER NOT NULL REFERENCES coa(id),
debit_amount DECIMAL(18, 2) DEFAULT 0.00,
credit_amount DECIMAL(18, 2) DEFAULT 0.00,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Indexes for performance
CREATE INDEX idx_journals_transaction_date ON journals(transaction_date);
CREATE INDEX idx_journal_details_coa_id ON journal_details(coa_id);

The structure above separates the journal into a `journals` table for general transaction information and `journal_details` for debit/credit entries per account. This supports the double-entry bookkeeping principle and flexibility. The `coa` table defines all accounts used, such as '111001' for Cash Bank or '410101' for Medical Service Revenue.

Automatic Journal Logic (PHP - Laravel 11.x):

<?php

namespace App\'Services;

use App\Models\Journal;
use App\Models\JournalDetail;
use App\Models\Coa;
use Illuminate\Support\Facades\DB;

class FinancialJournalService
{
public function postPatientPayment(array $paymentData): Journal
{
DB::beginTransaction();
try {
// Validate input data
$this->validatePaymentData($paymentData);

// Find COA for Cash/Bank and Service Revenue
$cashBankCoa = Coa::where('account_code', '111001')->firstOrFail(); // Example: Cash/Bank
$revenueServiceCoa = Coa::where('account_code', '410101')->firstOrFail(); // Example: Medical Service Revenue

// Create main journal entry
$journal = Journal::create([
'transaction_id' => $paymentData['transaction_id'],
'transaction_date' => $paymentData['transaction_date'],
'description' => 'Patient payment for medical services: ' . $paymentData['patient_name'],
'source_system' => 'SIMRS',
]);

// Debit Cash/Bank
JournalDetail::create([
'journal_id' => $journal->id,
'coa_id' => $cashBankCoa->id,
'debit_amount' => $paymentData['amount'],
'credit_amount' => 0.00,
]);

// Credit Service Revenue
JournalDetail::create([
'journal_id' => $journal->id,
'coa_id' => $revenueServiceCoa->id,
'debit_amount' => 0.00,
'credit_amount' => $paymentData['amount'],
]);

DB::commit();
return $journal;

} catch (\Exception $e) {
DB::rollBack();
throw new \Exception('Failed to post patient payment: ' . $e->getMessage());
}
}

private function validatePaymentData(array $data)
{
// Implement data validation, for example ensuring 'amount' is a positive number
if (!isset($data['amount']) || !is_numeric($data['amount']) || $data['amount'] <= 0) {
throw new \InvalidArgumentException('Invalid payment amount.');
}
// ... other validations
}
}

The PHP code above shows how automatic journal entries are created when a patient payment is received. The postPatientPayment function receives payment data, then looks up the relevant COA accounts (for example, Cash/Bank and Medical Service Revenue). Next, it creates a journal entry in the journals table and two detail entries in journal_details: one to debit the Cash/Bank account and one to credit the Medical Service Revenue account. The use of database transactions (DB::beginTransaction(), DB::commit(), DB::rollBack()) ensures that all journal entries are saved atomically; if any part fails, the entire transaction is canceled, maintaining the integrity of financial data. This is a fundamental example for any type of transaction, such as inventory purchases (debit Inventory, credit Cash/Payable), salary payments (debit Salary Expense, credit Cash), or asset depreciation (debit Depreciation Expense, credit Accumulated Depreciation), all adjusted to the relevant PSAK.

Data Integration and Error Handling in Financial Reporting

Data integration is a vital bridge between operational systems and financial reporting systems. However, this process is highly prone to failure, whether due to invalid data from the source, connectivity issues, or logic errors. Effective error handling is key to maintaining data integrity and ensuring financial reports remain accurate. We will present an example transaction data payload from SIMRS/POS and how to handle potential errors.

Example Payment Transaction Payload from SIMRS/POS:

The payload is typically in JSON form with fields such as transaction_id, patient_id, amount, payment_method, service_code, and timestamp. Before processing, strict validation must be performed: ensure amount is numeric and positive, service_code is registered in the service master, and payment_method has a mapping to the correct COA account. If validation fails, do not immediately save the data; log the error to the integration_logs table along with the original payload, error message, and status.

For failures during the journal posting process, use a retry pattern with exponential backoff for temporary errors (for example, a dropped database connection), but do not retry for validation errors. Wrap each operation in a try-catch block and ensure DB::rollBack() is called in the catch block. After that, send a notification to the admin via email or WhatsApp if the error is critical. That way, data integration remains under control and financial reports are not contaminated by half-finished transactions.

Practical Tips for Building Reliable Automated Financial Reporting

First, apply the single source of truth principle. All financial transactions must come from the same general journal, not from different operational tables. Create one centralized service (for example, JournalService) responsible for creating journal entries for all modules: sales, purchases, payroll, and depreciation. In this way, you only need to maintain one journaling logic, so PSAK consistency is easier to maintain and the audit trail is clear.

Second, perform automatic reconciliation regularly. Create a daily scheduler that compares the total debits and credits in journal_details with the balances in the general ledger. If a discrepancy is found, the system must flag and send a warning. In addition, implement monthly closing period: lock journals for periods that have been closed, so that no retroactive changes can damage already published reports.

Third, optimize query performance for reports. Use indexes on the account_id, journal_date, and transaction_id columns. For income statements and balance sheets, take advantage of materialized views or summary tables that are updated on a schedule. Avoid SELECT * and use aggregation at the database level. Do not forget to perform load testing, especially if transaction data has reached millions of rows, so that reports remain quickly accessible when needed.

FAQ

Can this system be used for trading and service companies at the same time?

Yes. As long as the chart of accounts (COA) and journaling rules are designed flexibly, you can add an inventory module for trading companies and a service revenue module for service companies. The key is to separate account configurations per transaction type, so that the PSAK applicable to each industry can be applied without changing the core system.

What if there is duplicate payment data from SIMRS/POS?

Use the unique transaction_id from the source as an idempotent key. Before processing, check whether that ID has ever been stored in the journal table. If it already exists, skip the process and record it as a duplicate. That way, data integration remains safe even if the payload is resent.

Are the generated reports automatically compliant with the latest PSAK?

The system can be designed to follow PSAK, but final compliance still requires validation by an accountant. Ensure the report formats (balance sheet, income statement, cash flow, changes in equity) refer to the applicable standards, and conduct regular reviews whenever there is a PSAK amendment. Automation speeds up preparation, not replaces the role of professional judgment.

How long does implementation take?

Depending on the complexity of the business. For a small scale with limited modules, a basic implementation can take 2–4 weeks. For an enterprise with many branches and SIMRS/POS integration, a timeframe of 2–3 months is a reasonable estimate, including testing and user training.

Building automated financial reports in accordance with PSAK is not just a technology project, but a governance investment. With a well-structured journal architecture, error-resistant data integration, and the practical tips above, you can produce reports that are accurate, auditable, and timely. Don't let manual processes hinder your business growth. Consult your financial system needs now with our team of experts to get a design that suits your scale and industry. Contact us via email or WhatsApp for a free discussion session, and start the step toward more efficient financial reporting today.

This article is part of the knowledge base of Nugroho Setiawan, an IT consultant in Jogja (Yogyakarta). Related solutions: PilarPOS SIMRS (Hospital Information System) Clinic Management System. Need a free consultation?

Terakhir diperbarui 18 Oct 2026

Komentar

Komentar ditinjau sebelum tampil.

Belum ada komentar. Jadilah yang pertama!

Butuh bantuan implementasi atau dashboard data?

Saya membantu konsultasi IT, pengembangan aplikasi, dan visualisasi data untuk rumah sakit, klinik, dan bisnis di Yogyakarta (DIY), Magelang, dan sekitarnya.

WhatsApp Jasa Visualisasi Data Demo VizStudio
Produk & Solusi SIMRS ERP Portfolio Konsultasi Gratis