Add Documentaion.md
This commit is contained in:
84
Documentaion.md
Normal file
84
Documentaion.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# CorpCentralPurchasing
|
||||
|
||||
## Ringkasan
|
||||
`CorpCentralPurchasing` adalah aplikasi pengadaan terpusat berbasis CodeIgniter 3 untuk mengelola master data, transaksi PO/RO, konfigurasi RS, dan proses konsolidasi data antar rumah sakit.
|
||||
|
||||
## Arsitektur Aplikasi
|
||||
|
||||
### 1) Layer utama (MVC)
|
||||
- `application/controllers`
|
||||
Menangani endpoint web/API, validasi request, orkestrasi proses bisnis.
|
||||
- `application/models`
|
||||
Menangani query database, business rule per modul, pembuatan tabel dinamis RS.
|
||||
- `application/views`
|
||||
Halaman UI (Blade-like PHP view), modal, table list, dan Javascript AJAX.
|
||||
|
||||
### 2) Modul penting
|
||||
- `Master/*`
|
||||
Master data inti (RS, Golongan, Item, Supplier, dll).
|
||||
- `Transaksi/*`
|
||||
Proses transaksi PO/RO dan detail item.
|
||||
- `Laporan/*`
|
||||
Pelaporan pembelian, cost of stock, saving, dll.
|
||||
- `Cron/*`
|
||||
Sinkronisasi data rutin, perhitungan periodik, pemrosesan batch.
|
||||
- `apiccp/*`
|
||||
Endpoint API internal untuk posting/consume data PO/RO dan integrasi.
|
||||
|
||||
### 3) Pola tabel
|
||||
- Tabel master global: contoh `rs`, `rs_config`, `masteritem`, dst.
|
||||
- Tabel dinamis per RS:
|
||||
`po_<koders>`, `po2_<koders>`, `ro_<koders>`, `ro2_<koders>`.
|
||||
- Suffix tabel RS selalu diproses `strtolower(KodeRS)`.
|
||||
|
||||
## Alur Data Kunci
|
||||
|
||||
### Tambah RS Baru
|
||||
1. Controller `Master/Rumahsakit::simpanRS()` menerima input form.
|
||||
2. Model `Master/Rumahsakit_model::simpan_masterrs()` melakukan insert ke `rs`.
|
||||
3. Setelah insert sukses:
|
||||
- Seed konfigurasi default ke `rs_config`.
|
||||
- Provisioning tabel dinamis RS (`po/po2/ro/ro2`).
|
||||
|
||||
### Konfigurasi RS
|
||||
- Konfigurasi disimpan di `rs_config` dengan key `NamaCongfig`.
|
||||
- Nilai awal default untuk RS baru adalah `NilaiConfig = 'N'`.
|
||||
|
||||
## Dokumentasi Perubahan (Fix Terbaru)
|
||||
|
||||
### A. Fix Tambah RS Baru
|
||||
Perubahan di [application/models/Master/Rumahsakit_model.php](/var/www/CorpCentralPurchasing/application/models/Master/Rumahsakit_model.php):
|
||||
|
||||
- Menambahkan seeding default `rs_config` melalui `seed_default_rs_config(...)`.
|
||||
- Menambahkan guard insert/update untuk `rs_config`:
|
||||
- Jika `NamaCongfig` untuk `KodeRS` sudah ada -> `UPDATE`.
|
||||
- Jika belum ada -> `INSERT`.
|
||||
- Menambahkan provisioning tabel otomatis melalui `create_default_rs_tables(...)`:
|
||||
- `po_<koders>`
|
||||
- `po2_<koders>`
|
||||
- `ro_<koders>`
|
||||
- `ro2_<koders>`
|
||||
- Reuse builder tabel dari:
|
||||
- [application/models/Master/Rspo_m.php](/var/www/CorpCentralPurchasing/application/models/Master/Rspo_m.php)
|
||||
- [application/models/Master/Rsro_m.php](/var/www/CorpCentralPurchasing/application/models/Master/Rsro_m.php)
|
||||
|
||||
### B. Aktivasi Field Disable pada Nama Golongan
|
||||
Perubahan pada modul Golongan berfokus agar field nama golongan tidak terkunci permanen saat mode tambah/edit, sehingga user bisa mengisi/memilih nilai sesuai konteks form.
|
||||
|
||||
File terkait:
|
||||
- [application/views/Master/golongan.php](/var/www/CorpCentralPurchasing/application/views/Master/golongan.php)
|
||||
- [application/controllers/Master/Golongan.php](/var/www/CorpCentralPurchasing/application/controllers/Master/Golongan.php)
|
||||
|
||||
Catatan implementasi:
|
||||
- Field yang sebelumnya terkunci di alur tertentu diaktifkan kembali saat reset/clear form.
|
||||
- Mode edit tetap menjaga field yang memang harus readonly (mis. key relasi) agar integritas data tetap aman.
|
||||
|
||||
## Catatan Teknis
|
||||
- Migration CodeIgniter pada konfigurasi saat ini nonaktif (`migration_enabled = FALSE`).
|
||||
- Pembuatan struktur tabel RS baru dilakukan secara runtime via `dbforge`, bukan via migration folder.
|
||||
|
||||
## Referensi Cepat
|
||||
- Controller RS: [application/controllers/Master/Rumahsakit.php](/var/www/CorpCentralPurchasing/application/controllers/Master/Rumahsakit.php)
|
||||
- Model RS: [application/models/Master/Rumahsakit_model.php](/var/www/CorpCentralPurchasing/application/models/Master/Rumahsakit_model.php)
|
||||
- Model builder PO RS: [application/models/Master/Rspo_m.php](/var/www/CorpCentralPurchasing/application/models/Master/Rspo_m.php)
|
||||
- Model builder RO RS: [application/models/Master/Rsro_m.php](/var/www/CorpCentralPurchasing/application/models/Master/Rsro_m.php)
|
||||
Reference in New Issue
Block a user