# BTM Microbanking System - Technical Specification Document

## Document Information
- **Project Name**: BTM Microbanking System
- **Version**: 1.0
- **Last Updated**: January 27, 2026
- **Document Type**: Technical Specification & Requirements
- **Target Platform**: Web Application (Laravel-based)

---

## Table of Contents
1. [Project Overview](#1-project-overview)
2. [Current System Analysis](#2-current-system-analysis)
3. [Business Rules](#3-business-rules)
4. [System Architecture](#4-system-architecture)
5. [Core Modules](#5-core-modules)
6. [Supporting Modules](#6-supporting-modules)
7. [Workflows](#7-workflows)
8. [Data Migration](#8-data-migration)
9. [Reporting Requirements](#9-reporting-requirements)
10. [User Roles & Permissions](#10-user-roles--permissions)

---

## 1. Project Overview

### 1.1 Organization Profile
- **Entity Name**: BTM (Baitul Maal wat Tamwil)
- **Entity Type**: Cooperative (Koperasi)
- **Core Business**: Sharia-compliant savings and financing (Simpan Pinjam)
- **Primary Focus**: Micro-business financing
- **Operating Principle**: Islamic Finance (Akad Mudharabah)

### 1.2 Current Technology Stack
- **Application Type**: Desktop Application (Windows-based)
- **Application Name**: IBSS (Integrated Banking System Syariah)
- **Programming Language**: Delphi
- **Database**: MySQL
- **Architecture**: Client-Server

### 1.3 Target Technology Stack
- **Application Type**: Web Application
- **Framework**: Laravel (PHP) 
- **Database**: MySQL/PostgreSQL
- **Architecture**: MVC (Model-View-Controller)
- **Frontend**: React (Inertia)
- **Mobile Support**: Responsive design (Progressive Web App consideration)

### 1.4 Project Goals
- Digitize manual processes
- Eliminate paper-based workflows
- Create integrated system with real-time data
- Implement proper audit trails
- Improve operational efficiency
- Enable remote access for field officers
- Generate automated financial reports

---

## 2. Current System Analysis

### 2.1 Operational Characteristics
- **Process Type**: Heavily manual and paper-based
- **Human Intervention**: High dependency
- **Documentation**: Physical documents with limited digital backup
- **Integration Level**: Fragmented, non-integrated systems
- **Technology Adoption**: Minimal (only offline forms)

### 2.2 Current Pain Points

#### 2.2.1 Savings Module Pain Points
- Dual entry system (physical book + Excel spreadsheet)
- No real-time balance visibility
- Manual calculation errors
- Difficult to generate account statements
- No automated transaction receipts

#### 2.2.2 Financing Module Pain Points
- Fully paper-based approval workflow
- No digital tracking of application status
- Survey results documented in hardcopy only
- Manual document archival (scanned files not linked to records)
- Difficult to track approval timeline
- No automated payment schedule generation
- Manual collectibility analysis

#### 2.2.3 Accounting Module Pain Points
- Limited accounting features usage
- Manual journal entries
- Difficult month-end closing process
- No automated financial statements
- Disconnected from transaction modules

---

## 3. Business Rules

### 3.1 Membership Rules

#### 3.1.1 Member Registration
```yaml
requirements:
  - Must register as member before applying for financing
  - Minimum initial savings balance: IDR 5,000
  - Required documents:
    - KTP (National ID Card)
    - KK (Family Card)
    - Recent photo
```

#### 3.1.2 Account Numbering System

##### Current Format
```
Format: XX-XXX-XXXXXX
Example: 06-100-000001
```

##### Proposed New Format (Migration-Friendly)
```yaml
structure:
  format: "YYYY-BB-NNNNNN"
  components:
    YYYY: Year (4 digits)
    BB: Branch/Office code (2 digits)
    NNNNNN: Sequential number (6 digits)
  
examples:
  - "2026-01-000001"
  - "2026-01-000002"
  
migration_mapping:
  old_format: "06-100-000001"
  new_format: "2006-01-000001"
  logic: |
    - First 2 digits (06) → Full year (2006)
    - Next 3 digits (100) → Branch code, take last 2 digits (00 or 01)
    - Last 6 digits remain the same
```

### 3.2 Savings Product Rules

#### 3.2.1 Product Type
```yaml
product_name: "Simpanan Sukarela (Voluntary Savings)"
characteristics:
  - Single savings product only
  - No profit sharing (no bagi hasil)
  - Voluntary deposits and withdrawals
  - No minimum balance requirement (except initial IDR 5,000)
  - No administrative fees
```

#### 3.2.2 Transaction Rules
```yaml
deposits:
  minimum_amount: 0
  maximum_amount: unlimited
  frequency: unlimited
  
withdrawals:
  minimum_amount: 0
  maximum_amount: current_balance
  frequency: unlimited
  restrictions:
    - Cannot withdraw below minimum balance if financing is active
```

### 3.3 Financing Product Rules

#### 3.3.1 Islamic Contract (Akad Mudharabah)
```yaml
akad_type: "Mudharabah"
definition: |
  Profit-sharing business partnership contract where:
  - Shahibul Maal (BTM/Cooperative): Provides 100% capital
  - Mudharib (Member): Manages the business
  
profit_distribution:
  method: "Nisbah (profit sharing ratio)"
  example: "60:40 (60% member, 40% cooperative)"
  
loss_distribution:
  financial_loss: "Borne by capital provider (BTM)"
  operational_loss: "Borne by business manager (Member)"
  exception: "Member liable if loss due to negligence or misconduct"
```

#### 3.3.2 Payment Structure
```yaml
payment_scheme:
  type: "Flat rate daily installment"
  installment_count: 100
  frequency: "Daily"
  profit_margin: "10%"
  
calculation_example:
  loan_amount: 10000000
  profit_margin: 10%
  total_repayment: 11000000
  installment_count: 100
  daily_installment: 110000
  
formula: |
    total_repayment = loan_amount * (1 + profit_margin)
    daily_installment = total_repayment / installment_count
```

#### 3.3.3 Late Payment Policy
```yaml
late_payment:
  penalty_fee: 0
  late_charge: false
  
  consequences:
    - Late payment recorded in system
    - Member receives rating based on payment history
    - Rating affects future financing approval
    
  rating_system:
    metric: "Payment punctuality ratio"
    calculation: "on_time_payments / total_payments"
    impact: "Lower ratio = harder to get future financing"
```

#### 3.3.4 Financing Transaction Numbering
```yaml
format: "Same as savings account format"
current: "06-100-000001"
proposed: "YYYY-BB-NNNNNN"

note: |
  Each financing transaction gets unique number
  Format follows savings account numbering convention
```

### 3.4 Collector Assignment Rules

#### 3.4.1 Territory-Based Assignment
```yaml
assignment_type: "Territory/Area-based"
default_behavior:
  - Collector A → Always assigned to Area A
  - Collector B → Always assigned to Area B
  
flexibility:
  - Assignments can be modified based on circumstances
  - Backup coverage when primary collector unavailable
  
example_scenario:
  situation: "Collector A is sick"
  action: "Collector B or C covers Area A temporarily"
  system_requirement: "Easy reassignment in system"
```

#### 3.4.2 Performance Tracking
```yaml
metrics:
  - Number of members registered by employee
  - Number of financing applications brought by employee
  - Collection success rate
  - Territory coverage
  
purpose: "Employee performance evaluation"
report_frequency: "Monthly/Quarterly"
```

---

## 4. System Architecture

### 4.1 Application Architecture

```yaml
architecture_pattern: "MVC (Model-View-Controller)"
framework: "Laravel"

layers:
  presentation:
    - React.js (Inertia) for interactivity
    - Responsive CSS (Tailwind/Bootstrap)
    - Shadcn UI Library for react component 
    
  business_logic:
    - Controllers
    - Service classes
    - Business rule validators
    - Workflow engines
    
  data_access:
    - Eloquent ORM models
    - Repository pattern
    - Database migrations
    - Seeders
    
  integration:
    - API endpoints (REST)
    - Event broadcasting
    - Queue workers
    - File storage (local/cloud)
```

### 4.2 Database Design Principles

```yaml
principles:
  - Normalized structure (3NF minimum)
  - Proper indexing for performance
  - Foreign key constraints
  - Audit trail tables
  - Soft deletes for critical data
  - Transaction logging
  
key_tables:
  master_data:
    - members
    - users
    - branches
    - products_savings
    - products_financing
    
  transactional:
    - savings_accounts
    - savings_transactions
    - financing_applications
    - financing_accounts
    - financing_payments
    - journal_entries
    
  supporting:
    - collectors
    - territories
    - documents
    - approvals
    - audit_logs
```

### 4.3 Security Architecture

```yaml
authentication:
  method: "Laravel Sanctum/Fortify"
  features:
    - Email/username + password
    - Two-factor authentication (optional)
    - Session management
    - Password policies
    
authorization:
  method: "Role-Based Access Control (RBAC)"
  implementation: "Laravel Gates & Policies"
  
data_security:
  - Encrypted sensitive data
  - HTTPS only
  - SQL injection prevention
  - XSS protection
  - CSRF tokens
  
audit_trail:
  - Every data modification logged
  - User action tracking
  - Login/logout logging
  - Failed authentication attempts
```

---

## 5. Core Modules

### 5.1 Module: Member Management

#### 5.1.1 Module Overview
```yaml
module_id: "MM"
module_name: "Member Management"
description: "Comprehensive member data management system"
priority: "High"
dependencies: []
```

#### 5.1.2 Features

##### Feature MM-01: Member Registration
```yaml
feature_id: "MM-01"
feature_name: "Member Registration"
description: "Register new members with complete profile"

input_fields:
  personal_info:
    - full_name: string(required, max:200)
    - id_card_number: string(required, unique, max:20)
    - date_of_birth: date(required)
    - place_of_birth: string(required, max:100)
    - gender: enum(required, values:[male, female])
    - marital_status: enum(required, values:[single, married, divorced, widowed])
    - phone_number: string(required, max:15)
    - email: string(optional, email)
    
  address_info:
    - street_address: text(required)
    - rt_rw: string(required, max:10)
    - village: string(required, max:100)
    - district: string(required, max:100)
    - city: string(required, max:100)
    - province: string(required, max:100)
    - postal_code: string(required, max:10)
    
  family_info:
    - family_card_number: string(required, max:20)
    - mother_maiden_name: string(required, max:200)
    - emergency_contact_name: string(required, max:200)
    - emergency_contact_phone: string(required, max:15)
    - emergency_contact_relation: string(required, max:50)
    
  business_info:
    - occupation: string(required, max:100)
    - business_name: string(optional, max:200)
    - business_type: string(optional, max:100)
    - business_address: text(optional)
    - monthly_income: decimal(optional, precision:15, scale:2)
    
  documents:
    - id_card_file: file(required, type:image/pdf, max:2MB)
    - family_card_file: file(required, type:image/pdf, max:2MB)
    - photo_file: file(required, type:image, max:1MB)
    - other_documents: file(optional, type:image/pdf, max:2MB, multiple:true)

business_rules:
  - Auto-generate member number
  - Validate ID card number uniqueness
  - Minimum age: 17 years
  - Automatically create savings account
  - Set initial balance to IDR 5,000

output:
  - Member ID (auto-generated)
  - Savings account number (auto-generated)
  - Member profile page
  - Welcome notification

validations:
  - ID card number must be 16 digits
  - Phone number must be valid Indonesian format
  - Email must be unique if provided
  - All required documents must be uploaded
```

##### Feature MM-02: Member Profile View
```yaml
feature_id: "MM-02"
feature_name: "Member Profile View"
description: "View complete member profile with all related data"

display_sections:
  - Personal information
  - Contact information
  - Address details
  - Family information
  - Business information
  - Savings account(s) summary
  - Financing account(s) summary
  - Transaction history
  - Document repository
  - Credit rating/score
  - Relationship officer information

actions_available:
  - Edit profile
  - Update documents
  - View full transaction history
  - Apply for financing
  - Generate member report
  - Deactivate member
```

##### Feature MM-03: Member Search & Filter
```yaml
feature_id: "MM-03"
feature_name: "Member Search & Filter"
description: "Advanced search and filtering for member records"

search_criteria:
  - Member ID
  - Member name (fuzzy search)
  - ID card number
  - Phone number
  - Savings account number
  - Financing account number

filter_options:
  - Member status (active, inactive, suspended)
  - Registration date range
  - Has active financing (yes/no)
  - Territory/area
  - Relationship officer
  - Credit rating range

output:
  - Paginated member list
  - Export to Excel/PDF
  - Bulk action options
```

##### Feature MM-04: Member Update
```yaml
feature_id: "MM-04"
feature_name: "Member Profile Update"
description: "Update existing member information"

editable_fields:
  - All fields from registration (except ID card number)
  - Add/update documents
  - Change status
  - Update notes

business_rules:
  - Require approval for critical field changes
  - Log all changes in audit trail
  - Cannot change ID card number (only by manager)
  
audit_trail:
  - Who made the change
  - When was the change made
  - What was changed (old vs new value)
  - Reason for change
```

##### Feature MM-05: Member Deactivation
```yaml
feature_id: "MM-05"
feature_name: "Member Deactivation"
description: "Deactivate member account"

pre_conditions:
  - No active financing
  - All financing must be paid off or closed
  - Savings balance must be zero (withdrawn)

process:
  - Verify pre-conditions
  - Manager approval required
  - Document reason for deactivation
  - Soft delete (retain data)
  
post_conditions:
  - Member cannot make transactions
  - Member cannot apply for financing
  - Data retained for historical reports
```

---

### 5.2 Module: Savings Management

#### 5.2.1 Module Overview
```yaml
module_id: "SM"
module_name: "Savings Management"
description: "Manage savings accounts and transactions"
priority: "High"
dependencies: ["MM - Member Management"]
```

#### 5.2.2 Features

##### Feature SM-01: Savings Account Creation
```yaml
feature_id: "SM-01"
feature_name: "Create Savings Account"
description: "Create new savings account for member"

input_fields:
  - member_id: integer(required, foreign_key)
  - product_type: string(default: "Simpanan Sukarela")
  - initial_deposit: decimal(required, min:5000)
  - opening_date: date(default: today)

business_rules:
  - Auto-generate account number (format: YYYY-BB-NNNNNN)
  - Initial deposit minimum IDR 5,000
  - One member can have one savings account (simplified version)
  - Account status: Active by default

output:
  - Savings account number
  - Account details page
  - Transaction receipt (printable)
```

##### Feature SM-02: Deposit Transaction
```yaml
feature_id: "SM-02"
feature_name: "Deposit Transaction"
description: "Process cash deposit into savings account"

input_fields:
  - account_number: string(required)
  - deposit_amount: decimal(required, min:1)
  - transaction_date: datetime(default: now)
  - notes: text(optional)
  - teller_id: integer(auto, from session)

business_rules:
  - Amount must be positive
  - Account must be active
  - Real-time balance update
  - Auto-generate transaction ID
  - Print receipt immediately

process_flow:
  1. Validate account
  2. Validate amount
  3. Create transaction record
  4. Update account balance
  5. Create journal entry (debit: Kas, credit: Simpanan)
  6. Generate receipt
  7. Update passbook (if applicable)

output:
  - Transaction ID
  - Updated balance
  - Printed receipt
  - Journal entry created
```

##### Feature SM-03: Withdrawal Transaction
```yaml
feature_id: "SM-03"
feature_name: "Withdrawal Transaction"
description: "Process cash withdrawal from savings account"

input_fields:
  - account_number: string(required)
  - withdrawal_amount: decimal(required, min:1)
  - transaction_date: datetime(default: now)
  - notes: text(optional)
  - teller_id: integer(auto, from session)

business_rules:
  - Amount must not exceed available balance
  - Account must be active
  - Real-time balance update
  - Cannot withdraw if balance < withdrawal + minimum balance
  - Require manager approval if amount > threshold (configurable)

validations:
  - Sufficient balance check
  - Account status check
  - Maximum daily withdrawal limit (if configured)

process_flow:
  1. Validate account
  2. Check sufficient balance
  3. Check withdrawal limits
  4. Request approval if needed
  5. Create transaction record
  6. Update account balance
  7. Create journal entry (debit: Simpanan, credit: Kas)
  8. Generate receipt

output:
  - Transaction ID
  - Updated balance
  - Printed receipt
  - Journal entry created
```

##### Feature SM-04: Account Statement
```yaml
feature_id: "SM-04"
feature_name: "Generate Account Statement"
description: "Generate transaction history for savings account"

input_fields:
  - account_number: string(required)
  - start_date: date(required)
  - end_date: date(required)
  - format: enum(required, values:[pdf, excel])

output_content:
  - Account holder information
  - Account number
  - Statement period
  - Opening balance
  - Transaction list (date, description, debit, credit, balance)
  - Closing balance
  - Generated date and time

business_rules:
  - Maximum date range: 1 year
  - Real-time data
  - Sortable by date
  - Printable/downloadable
```

##### Feature SM-05: Passbook Printing
```yaml
feature_id: "SM-05"
feature_name: "Passbook Printing/Update"
description: "Print transactions on physical passbook"

requirements:
  - Printer connected and configured
  - Passbook template defined
  - Last printed transaction tracked

process:
  1. Read last printed transaction from passbook
  2. Retrieve new transactions since last print
  3. Format transactions for passbook layout
  4. Print on passbook
  5. Update last printed transaction marker

alternative:
  - Generate PDF passbook for digital records
```

---

### 5.3 Module: Financing Management

#### 5.3.1 Module Overview
```yaml
module_id: "FM"
module_name: "Financing Management"
description: "Manage financing applications, approvals, disbursements, and repayments"
priority: "Critical"
dependencies: 
  - "MM - Member Management"
  - "SM - Savings Management"
  - "AM - Accounting Module"
```

#### 5.3.2 Features

##### Feature FM-01: Financing Application
```yaml
feature_id: "FM-01"
feature_name: "Financing Application Submission"
description: "Submit new financing application"

input_fields:
  applicant_info:
    - member_id: integer(required, foreign_key)
    - application_date: date(default: today)
    - requested_amount: decimal(required, min:1000000)
    - purpose: text(required)
    - business_plan: text(required)
    
  collateral_info:
    - collateral_type: string(optional)
    - collateral_description: text(optional)
    - collateral_value: decimal(optional)
    - collateral_photos: file(optional, multiple:true)
    
  guarantor_info:
    - guarantor_name: string(optional)
    - guarantor_id_number: string(optional)
    - guarantor_phone: string(optional)
    - guarantor_address: text(optional)
    - guarantor_relation: string(optional)
    - guarantor_documents: file(optional, multiple:true)
    
  business_info:
    - business_name: string(required)
    - business_type: string(required)
    - business_address: text(required)
    - years_operating: integer(required)
    - monthly_revenue: decimal(required)
    - monthly_expenses: decimal(required)
    - monthly_profit: decimal(required)
    - number_of_employees: integer(optional)
    
  documents:
    - application_form: file(required)
    - business_photos: file(required, multiple:true)
    - additional_documents: file(optional, multiple:true)

business_rules:
  - Member must be registered
  - Member must have active savings account
  - Member must have good payment history (if applicable)
  - Auto-generate application number
  - Initial status: "Pending Survey"

output:
  - Application ID
  - Application number
  - Status: "Pending Survey"
  - Notification to surveyor
```

##### Feature FM-02: Survey Assignment
```yaml
feature_id: "FM-02"
feature_name: "Survey Assignment to Field Officer"
description: "Assign financing application to field officer for survey"

actors:
  - Manager/Admin (assigner)
  - Field Officer/Surveyor (assignee)

input_fields:
  - application_id: integer(required)
  - assigned_to: integer(required, user_id)
  - due_date: date(required)
  - priority: enum(optional, values:[low, medium, high, urgent])
  - notes: text(optional)

business_rules:
  - Only pending applications can be assigned
  - Field officer receives notification
  - Due date must be future date
  - Assignment logged in audit trail

notifications:
  - Email to assigned field officer
  - SMS notification (optional)
  - In-app notification

output:
  - Assignment record created
  - Application status: "Survey Assigned"
  - Notification sent
```

##### Feature FM-03: Field Survey Entry
```yaml
feature_id: "FM-03"
feature_name: "Field Survey Data Entry"
description: "Field officer enters survey results"

input_sections:
  business_verification:
    - business_location_verified: boolean
    - business_operational: boolean
    - business_condition: enum(values:[poor, fair, good, excellent])
    - business_photos_current: file(multiple:true)
    - business_assets: text
    
  character_assessment:
    - honesty_score: integer(1-10)
    - responsibility_score: integer(1-10)
    - community_reputation: text
    - payment_history_verification: text
    
  capacity_assessment:
    - actual_revenue: decimal
    - actual_expenses: decimal
    - debt_to_other_institutions: decimal
    - cash_flow_analysis: text
    
  collateral_verification:
    - collateral_exists: boolean
    - collateral_condition: enum
    - collateral_location: text
    - collateral_ownership_verified: boolean
    - collateral_photos_verified: file(multiple:true)
    
  risk_assessment:
    - overall_risk: enum(values:[low, medium, high])
    - risk_factors: text
    - mitigation_suggestions: text
    
  recommendation:
    - surveyor_recommendation: enum(required, values:[approve, reject, needs_review])
    - recommended_amount: decimal(optional)
    - recommended_terms: integer(optional)
    - notes: text(required)
    - survey_date: date(required)
    - survey_location: string

business_rules:
  - Only assigned surveyor can enter data
  - All mandatory fields must be filled
  - Photos must be uploaded
  - Recommended amount cannot exceed requested amount
  - Survey must be completed before due date

output:
  - Survey record created
  - Application status: "Survey Completed - Pending Approval"
  - Notification to manager for review
```

##### Feature FM-04: Financing Approval Workflow (MVP Version)
```yaml
feature_id: "FM-04"
feature_name: "Financing Approval - Manager Review"
description: "Manager reviews and approves/rejects financing application"

version: "MVP (v1)"
actors:
  - Manager

input_data_available:
  - Member profile
  - Application details
  - Survey results (later in v2)
  - Supporting documents
  - Credit history
  - Current savings balance

approval_actions:
  approve:
    input_fields:
      - approved_amount: decimal(required)
      - installment_terms: integer(default:100)
      - profit_margin: decimal(default:10)
      - disbursement_date: date(required)
      - special_conditions: text(optional)
      - pic_employee: integer(required, user_id)
    
    calculations:
      total_repayment: approved_amount * (1 + profit_margin / 100)
      daily_installment: total_repayment / installment_terms
      
    actions:
      - Update application status to "Approved"
      - Generate payment schedule
      - Create financing account
      - Record PIC employee
      - Send notification to admin for disbursement
  
  reject:
    input_fields:
      - rejection_reason: text(required)
      - rejection_notes: text(optional)
    
    actions:
      - Update application status to "Rejected"
      - Record rejection reason
      - Send notification to applicant
      - Archive application

business_rules:
  - Only Manager can approve/reject
  - Approved amount can be different from requested
  - Approval decision is final
  - All decisions logged with timestamp and user

output:
  - Updated application status
  - Financing account created (if approved)
  - Payment schedule generated (if approved)
  - Notifications sent
```

##### Feature FM-04-V2: Financing Approval Workflow (Final Version)
```yaml
feature_id: "FM-04-V2"
feature_name: "Financing Approval - Multi-Step Workflow"
description: "Complete approval workflow with survey step"

version: "v2 (Future Enhancement)"
note: "Implement after users adapt to web application"

workflow_steps:
  step_1_application:
    actor: "Teller/Admin"
    action: "Submit application"
    status: "Pending Survey Assignment"
    
  step_2_assignment:
    actor: "Manager"
    action: "Assign to field officer"
    status: "Survey Assigned"
    
  step_3_survey:
    actor: "Field Officer"
    action: "Complete survey"
    status: "Survey Completed - Pending Manager Review"
    
  step_4_approval:
    actor: "Manager"
    action: "Final approval/rejection"
    status: "Approved" or "Rejected"

enhancements:
  - Mobile app for field officers
  - GPS location tracking for surveys
  - Offline mode for field data entry
  - Photo upload from mobile device
  - Digital signature on survey reports
```

##### Feature FM-05: Financing Disbursement
```yaml
feature_id: "FM-05"
feature_name: "Financing Disbursement"
description: "Disburse approved financing to member"

pre_conditions:
  - Application status: "Approved"
  - Member has active savings account
  - Financing account created
  - Payment schedule generated

input_fields:
  - financing_account_id: integer(required)
  - disbursement_method: enum(required, values:[cash, transfer_to_savings])
  - disbursement_date: date(default: today)
  - disbursed_by: integer(auto, from session)
  - notes: text(optional)

disbursement_methods:
  cash:
    process:
      - Record cash disbursement
      - Print cash disbursement receipt
      - Require member signature
      
  transfer_to_savings:
    process:
      - Credit to member savings account
      - Create savings transaction record
      - Print transaction receipt

accounting_entries:
  - Debit: Pembiayaan Mudharabah (Financing Receivable)
  - Credit: Kas (if cash) or Simpanan (if transfer)

business_rules:
  - Can only disburse once
  - Amount must match approved amount
  - Disbursement date triggers payment schedule
  - Financing account status: "Active"

output:
  - Disbursement record
  - Transaction receipt (printable)
  - Updated financing account status
  - Journal entries created
  - Payment schedule activated
```

##### Feature FM-06: Payment Collection
```yaml
feature_id: "FM-06"
feature_name: "Financing Payment Collection"
description: "Record financing payment/installment"

input_fields:
  - financing_account_number: string(required)
  - payment_amount: decimal(required)
  - payment_date: date(default: today)
  - payment_method: enum(required, values:[cash, transfer])
  - collector_id: integer(optional, user_id)
  - notes: text(optional)

business_rules:
  - Payment amount can be any positive value
  - Allow partial payments
  - Allow advance payments (multiple installments)
  - Auto-calculate outstanding balance
  - Mark installments as paid in schedule
  - Track payment history

payment_allocation:
  priority:
    1. Overdue installments (oldest first)
    2. Current due installments
    3. Future installments (advance payment)

accounting_entries:
  - Debit: Kas (Cash/Bank)
  - Credit: Pembiayaan Mudharabah (Financing Receivable)
  
  profit_recognition:
    - Calculate profit portion of payment
    - Record profit income

calculations:
  - outstanding_balance -= payment_amount
  - installments_paid = count(paid installments)
  - remaining_installments = total_installments - installments_paid
  - next_due_date = first unpaid installment date

output:
  - Payment receipt (printable)
  - Updated payment schedule
  - Updated financing account balance
  - Journal entries created
```

##### Feature FM-07: Payment Schedule Management
```yaml
feature_id: "FM-07"
feature_name: "Payment Schedule Generation & Management"
description: "Generate and manage daily payment schedule"

schedule_generation:
  inputs:
    - disbursement_date: date
    - total_amount: decimal
    - installment_count: integer(default:100)
    - daily_installment: decimal
    
  schedule_rules:
    - Start from disbursement date + 1 day
    - Skip Sundays (configurable)
    - Skip national holidays (configurable)
    - Generate 100 consecutive business days
    
  schedule_fields:
    - installment_number: integer(1-100)
    - due_date: date
    - installment_amount: decimal
    - status: enum(values:[pending, paid, late, skipped])
    - paid_date: date(nullable)
    - paid_amount: decimal(nullable)

schedule_display:
  - Visual calendar view
  - List view with filters
  - Payment status indicators (color-coded)
  - Overdue highlighting
  - Payment history per installment

actions_available:
  - Mark as paid (manual)
  - Skip installment (with reason)
  - Reschedule (with approval)
  - View payment details
  - Print schedule
```

##### Feature FM-08: Financing Account Management
```yaml
feature_id: "FM-08"
feature_name: "Financing Account Details"
description: "View and manage financing account"

display_sections:
  account_info:
    - Account number
    - Member name
    - Product type (Mudharabah)
    - Approved amount
    - Disbursement date
    - Total repayment amount
    - Daily installment
    - Account status
    
  balance_info:
    - Principal outstanding
    - Profit outstanding
    - Total outstanding
    - Amount paid to date
    - Installments paid
    - Installments remaining
    
  payment_history:
    - Payment date
    - Payment amount
    - Payment method
    - Collector name
    - Receipt number
    
  payment_schedule:
    - Full schedule with status
    - Next due date
    - Overdue installments
    
  documents:
    - Application form
    - Survey report
    - Approval document
    - Disbursement receipt
    - Payment receipts
    - Collateral documents

actions_available:
  - Record payment
  - View payment schedule
  - Print statement
  - Close account (early settlement)
  - Restructure (with approval)
  - Add notes
```

##### Feature FM-09: Early Settlement
```yaml
feature_id: "FM-09"
feature_name: "Early Settlement/Payoff"
description: "Complete financing payment before maturity"

calculation:
  outstanding_principal: remaining principal amount
  outstanding_profit: remaining profit amount
  total_payoff: outstanding_principal + outstanding_profit
  
  optional_discount:
    - Manager can approve profit discount
    - Discount on remaining profit only
    - Discount percentage configurable

input_fields:
  - financing_account_number: string(required)
  - settlement_date: date(default: today)
  - profit_discount_percentage: decimal(optional, max:100)
  - settlement_amount: decimal(calculated)
  - payment_method: enum(required)
  - notes: text(optional)

process:
  1. Calculate total outstanding
  2. Apply discount if approved
  3. Record final payment
  4. Mark all remaining installments as "Settled Early"
  5. Close financing account
  6. Generate settlement certificate

output:
  - Settlement receipt
  - Updated account status: "Closed - Paid Off"
  - Settlement certificate
  - Journal entries
```

##### Feature FM-10: Collectibility Report
```yaml
feature_id: "FM-10"
feature_name: "Financing Collectibility Analysis"
description: "Analyze and report financing portfolio quality"

collectibility_categories:
  lancar (current):
    criteria: "No late payments"
    dpd_range: "0 days"
    
  kurang_lancar (special_mention):
    criteria: "1-30 days past due"
    dpd_range: "1-30 days"
    
  diragukan (substandard):
    criteria: "31-60 days past due"
    dpd_range: "31-60 days"
    
  macet (doubtful):
    criteria: "61-90 days past due"
    dpd_range: "61-90 days"
    
  loss:
    criteria: "Over 90 days past due"
    dpd_range: ">90 days"

dpd_calculation:
  formula: |
    DPD (Days Past Due) = current_date - oldest_unpaid_installment_due_date

report_content:
  summary:
    - Total financing accounts
    - Total outstanding amount
    - Distribution by collectibility
    - NPF (Non-Performing Financing) ratio
    
  detail_per_category:
    - Number of accounts
    - Total outstanding
    - Percentage of portfolio
    - List of accounts

npf_calculation:
  formula: |
    NPF = (Substandard + Doubtful + Loss) / Total Outstanding * 100%

export_formats:
  - PDF report
  - Excel spreadsheet
```

---

### 5.4 Module: Collection Management

#### 5.4.1 Module Overview
```yaml
module_id: "CM"
module_name: "Collection Management"
description: "Manage field collection activities and collector assignments"
priority: "High"
dependencies:
  - "FM - Financing Management"
  - "UM - User Management"
```

#### 5.4.2 Features

##### Feature CM-01: Territory Management
```yaml
feature_id: "CM-01"
feature_name: "Territory/Area Management"
description: "Define and manage collection territories"

input_fields:
  - territory_code: string(required, unique)
  - territory_name: string(required)
  - description: text(optional)
  - coverage_areas: text(required)
  - default_collector: integer(nullable, user_id)
  - status: enum(values:[active, inactive])

business_rules:
  - One territory can have one default collector
  - Members assigned to territories based on address
  - Collectors can be assigned to multiple territories

actions:
  - Create territory
  - Edit territory
  - Assign/reassign collector
  - View members in territory
  - View active financing in territory
```

##### Feature CM-02: Daily Collection Assignment
```yaml
feature_id: "CM-02"
feature_name: "Daily Collection Task Assignment"
description: "Assign daily collection tasks to collectors"

input_fields:
  - assignment_date: date(required)
  - collector_id: integer(required, user_id)
  - territory_ids: array(required)
  - notes: text(optional)

auto_generate_task_list:
  criteria:
    - Active financing accounts
    - Due date = assignment date
    - Territory matches assignment
    - Outstanding balance > 0
    
  task_list_fields:
    - Member name
    - Financing account number
    - Address
    - Due amount
    - Contact phone
    - Previous payment status
    - Notes

output:
  - Collection task list (printable)
  - Mobile-friendly view
  - Route planning suggestions (future)
```

##### Feature CM-03: Collection Recording
```yaml
feature_id: "CM-03"
feature_name: "Record Collection Results"
description: "Record payment collection by field collectors"

input_fields:
  - task_id: integer(required)
  - financing_account_number: string(required)
  - collection_result: enum(required, values:[paid, not_home, refused, promised])
  - amount_collected: decimal(required_if:paid)
  - next_visit_date: date(required_if:promised)
  - notes: text(optional)
  - collection_time: datetime(auto)

business_rules:
  - If paid, create payment transaction
  - If promised, schedule follow-up
  - Track collection success rate
  - Update member payment behavior rating

mobile_support:
  - GPS location recording
  - Photo capture (proof of visit)
  - Offline mode capability
  - Sync when online

output:
  - Collection record saved
  - Payment transaction created (if paid)
  - Updated task status
  - Daily collection report
```

##### Feature CM-04: Collector Performance Report
```yaml
feature_id: "CM-04"
feature_name: "Collector Performance Dashboard"
description: "Track and report collector performance"

metrics:
  daily:
    - Tasks assigned
    - Tasks completed
    - Amount collected
    - Success rate
    
  monthly:
    - Total assigned tasks
    - Collection success rate
    - Amount collected vs target
    - New members acquired
    - Average days past due in territory

report_views:
  - Individual collector performance
  - Comparative analysis (all collectors)
  - Territory performance
  - Trend analysis

export_formats:
  - PDF report
  - Excel spreadsheet
```

---

### 5.5 Module: Accounting & Financial Reporting

#### 5.5.1 Module Overview
```yaml
module_id: "AM"
module_name: "Accounting Module"
description: "Double-entry accounting system with financial reporting"
priority: "Critical"
dependencies:
  - "SM - Savings Management"
  - "FM - Financing Management"
```

#### 5.5.2 Features

##### Feature AM-01: Chart of Accounts
```yaml
feature_id: "AM-01"
feature_name: "Chart of Accounts Management"
description: "Define and manage chart of accounts"

account_structure:
  format: "XXXX-XX-XX"
  levels:
    level_1: "Account Type (4 digits)"
    level_2: "Account Group (2 digits)"
    level_3: "Account Detail (2 digits)"

account_types:
  1000: "Aset (Assets)"
  2000: "Kewajiban (Liabilities)"
  3000: "Modal (Equity)"
  4000: "Pendapatan (Income)"
  5000: "Beban (Expenses)"

sample_accounts:
  assets:
    - 1001-01-01: "Kas"
    - 1001-02-01: "Bank"
    - 1002-01-01: "Piutang Pembiayaan Mudharabah"
    
  liabilities:
    - 2001-01-01: "Simpanan Anggota"
    - 2002-01-01: "Hutang Lain-lain"
    
  equity:
    - 3001-01-01: "Modal Sendiri"
    - 3002-01-01: "Laba Ditahan"
    - 3003-01-01: "Laba Tahun Berjalan"
    
  income:
    - 4001-01-01: "Pendapatan Bagi Hasil Pembiayaan"
    - 4002-01-01: "Pendapatan Lain-lain"
    
  expenses:
    - 5001-01-01: "Beban Gaji"
    - 5001-02-01: "Beban Operasional"

actions:
  - Create account
  - Edit account
  - Deactivate account
  - View account hierarchy
  - Search accounts
```

##### Feature AM-02: Auto Journal Entries
```yaml
feature_id: "AM-02"
feature_name: "Automatic Journal Entry Creation"
description: "Auto-generate journal entries from transactions"

transaction_mapping:
  savings_deposit:
    debit: "1001-01-01 (Kas)"
    credit: "2001-01-01 (Simpanan Anggota)"
    
  savings_withdrawal:
    debit: "2001-01-01 (Simpanan Anggota)"
    credit: "1001-01-01 (Kas)"
    
  financing_disbursement:
    debit: "1002-01-01 (Piutang Pembiayaan)"
    credit: "1001-01-01 (Kas) or 2001-01-01 (Simpanan)"
    
  financing_payment:
    debit: "1001-01-01 (Kas)"
    credit: "1002-01-01 (Piutang Pembiayaan)"
    also:
      debit: "1001-01-01 (Kas)"
      credit: "4001-01-01 (Pendapatan Bagi Hasil)"

business_rules:
  - Auto-generate on transaction completion
  - Cannot be deleted (only reversed)
  - Include transaction reference
  - Include transaction date
  - Include user who created transaction
```

##### Feature AM-03: Manual Journal Entry
```yaml
feature_id: "AM-03"
feature_name: "Manual Journal Entry"
description: "Create manual journal entries for adjustments"

input_fields:
  - entry_date: date(required)
  - reference_number: string(auto-generated)
  - description: text(required)
  - entries: array(required, min:2)
    - account_code: string(required)
    - debit_amount: decimal(optional)
    - credit_amount: decimal(optional)
    - notes: text(optional)

validation_rules:
  - Sum of debits must equal sum of credits
  - At least one debit and one credit entry
  - Account codes must exist
  - Requires manager approval

output:
  - Journal entry number
  - Posted to general ledger
  - Approval notification
```

##### Feature AM-04: Special Journal - Cash In
```yaml
feature_id: "AM-04"
feature_name: "Special Journal - Cash Receipts"
description: "Record special journal for cash inflows"

use_cases:
  - Other income receipts
  - Donations
  - Non-operational income
  - Adjustments

input_fields:
  - transaction_date: date(required)
  - source: string(required)
  - amount: decimal(required)
  - credit_account: string(required, account_code)
  - description: text(required)

journal_entry:
  debit: "1001-01-01 (Kas)"
  credit: "Selected account"

output:
  - Transaction record
  - Journal entry posted
  - Cash position updated
```

##### Feature AM-05: Special Journal - Cash Out
```yaml
feature_id: "AM-05"
feature_name: "Special Journal - Cash Payments"
description: "Record special journal for cash outflows"

use_cases:
  - Operational expenses
  - Salary payments
  - Utilities
  - Other expenses

input_fields:
  - transaction_date: date(required)
  - recipient: string(required)
  - amount: decimal(required)
  - debit_account: string(required, account_code)
  - description: text(required)
  - supporting_document: file(optional)

journal_entry:
  debit: "Selected account"
  credit: "1001-01-01 (Kas)"

output:
  - Transaction record
  - Journal entry posted
  - Cash position updated
```

##### Feature AM-06: Budget Planning
```yaml
feature_id: "AM-06"
feature_name: "Monthly Budget Planning & Realization"
description: "Plan and track monthly budget vs actual"

input_fields:
  - budget_period: date(required, month-year)
  - account_code: string(required)
  - planned_amount: decimal(required)
  - notes: text(optional)

tracking:
  - Planned amount (budget)
  - Actual amount (from transactions)
  - Variance (actual - planned)
  - Variance percentage

report_view:
  - Per account comparison
  - Summary by account type
  - Monthly trend
  - Year-to-date comparison

export:
  - PDF report
  - Excel spreadsheet
```

##### Feature AM-07: Year-End Closing
```yaml
feature_id: "AM-07"
feature_name: "Year-End Closing Entry"
description: "Process year-end closing and transfer profits"

process:
  1. Verify all transactions posted
  2. Generate pre-closing reports
  3. Calculate net income/loss
  4. Create closing entries
  5. Transfer income/expense to equity
  6. Reset temporary accounts
  7. Lock previous year transactions

closing_entries:
  close_income_accounts:
    debit: "All income accounts"
    credit: "3003-01-01 (Laba Tahun Berjalan)"
    
  close_expense_accounts:
    debit: "3003-01-01 (Laba Tahun Berjalan)"
    credit: "All expense accounts"
    
  transfer_profit:
    debit: "3003-01-01 (Laba Tahun Berjalan)"
    credit: "3002-01-01 (Laba Ditahan)"

business_rules:
  - Can only be done once per year
  - Requires manager approval
  - Cannot be undone (only reversed)
  - All reports must be generated before closing

output:
  - Closing entry posted
  - Year locked for editing
  - New fiscal year opened
  - Closing reports generated
```

##### Feature AM-08: Reverse Year-End Closing
```yaml
feature_id: "AM-08"
feature_name: "Reverse Year-End Closing"
description: "Reverse year-end closing if needed"

conditions:
  - Only manager can reverse
  - Must provide valid reason
  - Must be done before new transactions in new year
  - Requires system backup before reversing

process:
  1. Verify no new year transactions
  2. Reverse closing entries
  3. Unlock previous year
  4. Log reversal action

output:
  - Closing reversed
  - Year unlocked
  - Notification sent
```

---

## 6. Supporting Modules

### 6.1 Module: User Management

#### 6.1.1 Module Overview
```yaml
module_id: "UM"
module_name: "User Management"
description: "Manage system users, roles, and permissions"
priority: "High"
dependencies: []
```

#### 6.1.2 User Roles

```yaml
roles:
  manager:
    permissions:
      - Full system access
      - Approve financing applications
      - Approve journal entries
      - View all reports
      - Manage users
      - System configuration
      
  teller:
    permissions:
      - Register members
      - Process savings transactions
      - View member information
      - Print receipts
      - View transaction reports
      
  customer_service:
    permissions:
      - Register members
      - Submit financing applications
      - View member information
      - Update member information
      - View financing status
      
  collector:
    permissions:
      - View assigned collection tasks
      - Record payment collections
      - View member contact information
      - View payment schedules
      - Submit collection reports
      
  back_office:
    permissions:
      - Process financing disbursements
      - Record manual journal entries
      - Generate reports
      - Manage documents
      - View all transactions
```

#### 6.1.3 Features

##### Feature UM-01: User Management
```yaml
feature_id: "UM-01"
feature_name: "User Account Management"
description: "Create and manage user accounts"

input_fields:
  - full_name: string(required)
  - username: string(required, unique)
  - email: string(required, unique, email)
  - phone_number: string(required)
  - role: enum(required)
  - status: enum(values:[active, inactive])
  - branch_id: integer(optional)

actions:
  - Create user
  - Edit user
  - Reset password
  - Activate/deactivate user
  - View user activity log
```

---

### 6.2 Module: Document Management

#### 6.2.1 Module Overview
```yaml
module_id: "DM"
module_name: "Document Management"
description: "Manage and store digital documents"
priority: "Medium"
dependencies: []
```

#### 6.2.2 Features

##### Feature DM-01: Document Upload & Storage
```yaml
feature_id: "DM-01"
feature_name: "Document Upload and Storage"
description: "Upload and organize documents"

document_types:
  - Member KTP
  - Member KK
  - Member Photo
  - Collateral Photos
  - Survey Reports
  - Financing Agreements
  - Payment Receipts
  - Financial Statements

storage_structure:
  path_format: "/{entity_type}/{entity_id}/{document_type}/{filename}"
  example: "/members/00001/ktp/ktp_john_doe.pdf"

file_restrictions:
  allowed_types: ["pdf", "jpg", "jpeg", "png"]
  max_size: "5MB per file"

features:
  - Multiple file upload
  - File preview
  - Download files
  - Delete files (with permission)
  - Search by filename
```

---

### 6.3 Module: Notification System

#### 6.3.1 Module Overview
```yaml
module_id: "NS"
module_name: "Notification System"
description: "Send notifications to users"
priority: "Medium"
dependencies: []
```

#### 6.3.2 Notification Triggers

```yaml
notifications:
  financing_application_submitted:
    recipients: ["manager", "assigned_surveyor"]
    channels: ["in_app", "email"]
    
  financing_approved:
    recipients: ["applicant", "teller"]
    channels: ["in_app", "sms"]
    
  financing_rejected:
    recipients: ["applicant"]
    channels: ["in_app", "email"]
    
  payment_due_reminder:
    recipients: ["member"]
    channels: ["sms"]
    trigger: "1 day before due date"
    
  payment_overdue:
    recipients: ["member", "collector"]
    channels: ["sms", "in_app"]
    trigger: "1 day after due date"
```

---

## 7. Workflows

### 7.1 Workflow: Member Registration

```yaml
workflow_name: "Member Registration Process"
workflow_id: "WF-001"

steps:
  step_1:
    actor: "Teller / Customer Service"
    action: "Collect member information and documents"
    duration: "15-20 minutes"
    
  step_2:
    actor: "Teller / Customer Service"
    action: "Enter data into system"
    system_actions:
      - Validate input fields
      - Check for duplicate ID card
      - Auto-generate member number
      - Create member record
    
  step_3:
    actor: "System"
    action: "Create savings account automatically"
    system_actions:
      - Generate account number
      - Set initial balance (IDR 5,000)
      - Set account status: Active
    
  step_4:
    actor: "Teller"
    action: "Collect initial deposit (IDR 5,000)"
    system_actions:
      - Record deposit transaction
      - Update account balance
      - Create journal entry
    
  step_5:
    actor: "Teller"
    action: "Print membership card / documents"
    outputs:
      - Member ID card
      - Savings account passbook
      - Transaction receipt
    
  step_6:
    actor: "Member"
    action: "Receive membership documents"
    process_complete: true

success_criteria:
  - Member record created
  - Savings account active
  - Initial balance recorded
  - Documents provided to member
```

---

### 7.2 Workflow: Financing Application (MVP Version)

```yaml
workflow_name: "Financing Application Approval (MVP)"
workflow_id: "WF-002-MVP"
version: "1.0 (MVP)"

steps:
  step_1_submission:
    actor: "Teller / Customer Service"
    action: "Submit financing application"
    inputs:
      - Member information
      - Requested amount
      - Business information
      - Supporting documents
    system_actions:
      - Validate member eligibility
      - Generate application number
      - Set status: "Pending Manager Review"
    outputs:
      - Application ID
      - Application number
    duration: "30-45 minutes"
    
  step_2_manager_review:
    actor: "Manager"
    action: "Review application and make decision"
    available_data:
      - Member profile
      - Credit history
      - Current savings balance
      - Application details
      - Supporting documents
    
    decision_approve:
      inputs:
        - Approved amount
        - Installment terms (default: 100)
        - Profit margin (default: 10%)
        - Disbursement date
        - PIC employee assignment
      system_actions:
        - Calculate total repayment
        - Calculate daily installment
        - Generate payment schedule
        - Create financing account
        - Set status: "Approved - Pending Disbursement"
      outputs:
        - Financing account number
        - Payment schedule
        - Approval notification
    
    decision_reject:
      inputs:
        - Rejection reason
        - Notes
      system_actions:
        - Set status: "Rejected"
        - Record rejection details
        - Send notification
      outputs:
        - Rejection notification
    
    duration: "1-2 hours review time"
  
  step_3_disbursement:
    actor: "Teller / Back Office"
    action: "Disburse approved financing"
    pre_conditions:
      - Status: "Approved - Pending Disbursement"
      - Member present (if cash)
    inputs:
      - Disbursement method
      - Disbursement date
    system_actions:
      - Record disbursement
      - Create journal entries
      - Activate payment schedule
      - Set status: "Active"
    outputs:
      - Disbursement receipt
      - Updated account status
    duration: "15-30 minutes"

total_process_time: "2-4 hours (same day possible)"
```

---

### 7.3 Workflow: Financing Application (Final Version)

```yaml
workflow_name: "Financing Application Approval (Complete)"
workflow_id: "WF-002-FULL"
version: "2.0 (Future)"
implementation_phase: "After user adoption of web system"

steps:
  step_1_submission:
    actor: "Teller / Customer Service"
    action: "Submit financing application"
    [Same as MVP version]
    
  step_2_survey_assignment:
    actor: "Manager"
    action: "Assign application to field officer"
    inputs:
      - Select field officer
      - Set due date
      - Priority level
    system_actions:
      - Create survey assignment
      - Set status: "Survey Assigned"
      - Send notification to field officer
    duration: "5-10 minutes"
    
  step_3_field_survey:
    actor: "Field Officer / Collector"
    action: "Conduct field survey"
    tools: "Mobile app (recommended)"
    activities:
      - Visit business location
      - Verify business operations
      - Interview member
      - Assess collateral
      - Take photos
      - Complete survey form
    inputs:
      - Business verification data
      - Character assessment
      - Capacity assessment
      - Collateral verification
      - Risk assessment
      - Recommendation
    system_actions:
      - Upload survey results
      - Upload photos
      - Set status: "Survey Completed - Pending Manager Review"
      - Notify manager
    duration: "1-2 days"
    
  step_4_manager_approval:
    actor: "Manager"
    action: "Review survey and make final decision"
    available_data:
      - All data from step 1
      - Complete survey results
      - Field photos
      - Risk assessment
      - Surveyor recommendation
    [Decision process same as MVP]
    duration: "1-2 hours"
    
  step_5_disbursement:
    [Same as MVP version]

total_process_time: "3-5 days"

enhancements:
  - Mobile app for field officers
  - GPS tracking of survey location
  - Offline capability
  - Photo geotagging
  - Digital signature capture
```

---

### 7.4 Workflow: Daily Collection

```yaml
workflow_name: "Daily Collection Process"
workflow_id: "WF-003"

steps:
  step_1_assignment:
    actor: "Manager / Admin"
    action: "Assign daily collection tasks"
    time: "Morning (before 8 AM)"
    system_actions:
      - Auto-generate task list based on due dates
      - Assign to collectors by territory
      - Print collection sheets
    
  step_2_field_collection:
    actor: "Collector"
    action: "Visit members and collect payments"
    time: "8 AM - 4 PM"
    activities:
      - Follow route plan
      - Visit each member
      - Collect payment
      - Issue receipt
      - Record result in system (mobile)
    
  step_3_cash_handover:
    actor: "Collector"
    action: "Return to office and hand over collected cash"
    time: "End of day (4-5 PM)"
    activities:
      - Count cash collected
      - Submit to teller
      - Reconcile with system records
    
  step_4_verification:
    actor: "Teller"
    action: "Verify and record collections"
    system_actions:
      - Match cash with collection records
      - Post all payments
      - Update member accounts
      - Create journal entries
    
  step_5_reporting:
    actor: "System"
    action: "Generate daily collection report"
    outputs:
      - Total collected per collector
      - Collection success rate
      - Outstanding follow-ups
      - Cash position

daily_cycle: "Repeats every business day"
```

---

## 8. Data Migration

### 8.1 Migration Strategy

```yaml
migration_approach: "Phased migration with parallel run"

phases:
  phase_1_preparation:
    - Analyze current IBSS database structure
    - Map IBSS tables to new schema
    - Identify data cleaning requirements
    - Create migration scripts
    
  phase_2_master_data:
    priority: "High"
    entities:
      - Members
      - Savings accounts
      - Chart of accounts
    validation:
      - Data completeness check
      - Duplicate detection
      - Referential integrity
    
  phase_3_transaction_data:
    priority: "High"
    entities:
      - Savings transactions
      - Financing accounts
      - Financing payments
      - Journal entries
    validation:
      - Balance reconciliation
      - Transaction count verification
      - Date range validation
    
  phase_4_historical_data:
    priority: "Medium"
    entities:
      - Closed accounts
      - Historical reports
      - Archived documents
    
  phase_5_testing:
    activities:
      - User acceptance testing
      - Report comparison (old vs new)
      - Performance testing
      - Security testing

parallel_run:
  duration: "2-4 weeks"
  activities:
    - Run both systems simultaneously
    - Compare daily transactions
    - Reconcile balances
    - Identify discrepancies
    - Fix issues before cutover
```

### 8.2 Account Number Migration

```yaml
migration_rule: "Convert old format to new format"

conversion_logic:
  old_format: "XX-XXX-XXXXXX"
  new_format: "YYYY-BB-NNNNNN"
  
  mapping:
    position_1_2: "Assume year 20XX"
    position_4_6: "Take last 2 digits as branch code"
    position_8_13: "Keep sequential number"
    
  examples:
    - old: "06-100-000001"
      new: "2006-01-000001"
      logic: "06→2006, 100→01, 000001→000001"
      
    - old: "15-200-005432"
      new: "2015-02-005432"
      logic: "15→2015, 200→02, 005432→005432"

migration_steps:
  1. Extract all account numbers from IBSS
  2. Apply conversion logic
  3. Store mapping table (old → new)
  4. Update all references in transactions
  5. Validate no duplicates
  6. Test account number queries

backward_compatibility:
  - Maintain old number reference
  - Search works with both formats
  - Display both formats during transition period
```

### 8.3 Data Validation Checklist

```yaml
pre_migration:
  - [ ] Backup IBSS database
  - [ ] Document current data statistics
  - [ ] Count records per table
  - [ ] Verify data integrity in source
  - [ ] Identify orphan records
  
post_migration:
  - [ ] Record count matches
  - [ ] Balance totals match
  - [ ] No orphan records
  - [ ] Referential integrity intact
  - [ ] Test searches work
  - [ ] Test reports match
  - [ ] Sample transaction verification
  
reconciliation_reports:
  - Total members (old vs new)
  - Total savings balance (old vs new)
  - Total financing outstanding (old vs new)
  - Transaction count by type
  - Account balance verification
```

---

## 9. Reporting Requirements

### 9.1 Savings Reports

```yaml
report_id: "RPT-SAV-01"
report_name: "Savings Transaction Report (Mutasi)"
description: "Detailed transaction report for savings accounts"

parameters:
  - date_from: date(required)
  - date_to: date(required)
  - account_number: string(optional)
  - transaction_type: enum(optional, values:[all, deposit, withdrawal])

columns:
  - Transaction Date
  - Account Number
  - Member Name
  - Transaction Type
  - Reference Number
  - Debit Amount
  - Credit Amount
  - Balance
  - Teller Name

grouping:
  - By account number
  - By date

totals:
  - Total deposits
  - Total withdrawals
  - Net change

formats:
  - PDF (printable)
  - Excel (editable)

sample_location: "./references/reports/mutasi"
```

### 9.2 Financial Reports

#### 9.2.1 Balance Sheet (Neraca)

```yaml
report_id: "RPT-FIN-01"
report_name: "Balance Sheet (Neraca)"
description: "Statement of financial position"

parameters:
  - as_of_date: date(required)
  - comparison_date: date(optional)

structure:
  assets:
    current_assets:
      - Kas (Cash)
      - Bank
      - Piutang Pembiayaan (Financing Receivable)
      - Piutang Lain-lain (Other Receivables)
    fixed_assets:
      - Peralatan (Equipment)
      - Akumulasi Penyusutan (Accumulated Depreciation)
    
  liabilities:
    current_liabilities:
      - Simpanan Anggota (Member Savings)
      - Hutang Jangka Pendek (Short-term Debt)
    long_term_liabilities:
      - Hutang Jangka Panjang (Long-term Debt)
    
  equity:
    - Modal Sendiri (Share Capital)
    - Laba Ditahan (Retained Earnings)
    - Laba Tahun Berjalan (Current Year Profit)

calculation:
  - Total Assets = Current Assets + Fixed Assets
  - Total Liabilities = Current + Long-term
  - Total Equity = Capital + Retained Earnings + Current Profit
  - Balance Check: Assets = Liabilities + Equity

formats:
  - PDF (formatted report)
  - Excel (with formulas)

sample_location: "./references/reports/neraca"
```

#### 9.2.2 Income Statement (Laba Rugi)

```yaml
report_id: "RPT-FIN-02"
report_name: "Income Statement (Laporan Laba Rugi)"
description: "Statement of comprehensive income"

parameters:
  - period_from: date(required)
  - period_to: date(required)
  - comparison_period: boolean(optional)

structure:
  operating_income:
    - Pendapatan Bagi Hasil Pembiayaan (Financing Income)
    - Pendapatan Administrasi (Administrative Income)
    - Pendapatan Operasional Lain (Other Operating Income)
    total: "Total Operating Income"
    
  operating_expenses:
    - Beban Gaji (Salary Expense)
    - Beban Operasional (Operating Expense)
    - Beban Penyusutan (Depreciation Expense)
    - Beban Administrasi (Administrative Expense)
    total: "Total Operating Expenses"
    
  operating_profit:
    formula: "Operating Income - Operating Expenses"
    
  non_operating:
    - Pendapatan Lain-lain (Other Income)
    - Beban Lain-lain (Other Expenses)
    
  net_income:
    formula: "Operating Profit + Other Income - Other Expenses"

formats:
  - PDF
  - Excel
```

### 9.3 Financing Reports

```yaml
report_id: "RPT-FIN-03"
report_name: "Financing Portfolio Report"
description: "Comprehensive financing portfolio analysis"

sections:
  portfolio_summary:
    - Number of active accounts
    - Total outstanding principal
    - Total outstanding profit
    - Total outstanding amount
    - Average financing size
    
  collectibility_distribution:
    - Current (Lancar)
    - Special Mention (Kurang Lancar)
    - Substandard (Diragukan)
    - Doubtful (Macet)
    - Loss
    - NPF Ratio
    
  aging_analysis:
    - 0-30 days
    - 31-60 days
    - 61-90 days
    - Over 90 days
    
  by_collector:
    - Number of accounts per collector
    - Outstanding per collector
    - Collection rate per collector

parameters:
  - as_of_date: date(required)
  - collector_id: integer(optional)
  - territory_id: integer(optional)

formats:
  - PDF
  - Excel
```

### 9.4 Collection Reports

```yaml
report_id: "RPT-COL-01"
report_name: "Daily Collection Report"
description: "Daily collection activity and results"

parameters:
  - collection_date: date(required)
  - collector_id: integer(optional)

content:
  by_collector:
    - Collector name
    - Territory assigned
    - Tasks assigned
    - Tasks completed
    - Amount collected
    - Success rate
    - Members visited
    
  collection_details:
    - Member name
    - Account number
    - Due amount
    - Amount collected
    - Payment status
    - Notes
    
  summary:
    - Total tasks assigned
    - Total completed
    - Total amount collected
    - Overall success rate
    - Cash to be deposited

formats:
  - PDF
  - Excel
```

---

## 10. User Roles & Permissions

### 10.1 Role-Permission Matrix

```yaml
permissions_matrix:

  member_management:
    register_member:
      allowed: [teller, customer_service, manager]
    view_member:
      allowed: [all_roles]
    edit_member:
      allowed: [teller, customer_service, manager]
    deactivate_member:
      allowed: [manager]
      
  savings_transactions:
    deposit:
      allowed: [teller, manager]
    withdrawal:
      allowed: [teller, manager]
    view_transactions:
      allowed: [teller, back_office, manager]
    generate_statement:
      allowed: [teller, customer_service, manager]
      
  financing_management:
    submit_application:
      allowed: [customer_service, manager]
    assign_survey:
      allowed: [manager]
    enter_survey:
      allowed: [collector, manager]
    approve_financing:
      allowed: [manager]
    disburse_financing:
      allowed: [teller, back_office, manager]
    record_payment:
      allowed: [teller, collector, back_office, manager]
      
  collection:
    view_tasks:
      allowed: [collector, manager]
    record_collection:
      allowed: [collector, manager]
    reassign_territory:
      allowed: [manager]
      
  accounting:
    view_journal:
      allowed: [back_office, manager]
    manual_journal:
      allowed: [back_office, manager]
      approval_required: true
    special_journal:
      allowed: [back_office, manager]
    year_end_closing:
      allowed: [manager]
    view_reports:
      allowed: [back_office, manager]
      
  system_admin:
    manage_users:
      allowed: [manager]
    manage_roles:
      allowed: [manager]
    system_config:
      allowed: [manager]
    view_audit_log:
      allowed: [manager]

approval_workflows:
  financing_approval:
    required_role: [manager]
    cannot_self_approve: true
    
  large_withdrawal:
    threshold: 10000000
    required_role: [manager]
    
  manual_journal:
    required_role: [manager]
    
  member_deactivation:
    required_role: [manager]
```

---

## 11. Technical Requirements

### 11.1 System Requirements

```yaml
server_requirements:
  web_server: "Apache 2.4+ or Nginx 1.18+"
  php_version: "PHP 8.1+"
  database: "MySQL 8.0+ or PostgreSQL 13+"
  memory: "4GB RAM minimum, 8GB recommended"
  storage: "50GB minimum, scalable"
  
php_extensions:
  required:
    - PDO
    - Mbstring
    - OpenSSL
    - XML
    - Ctype
    - JSON
    - BCMath
    - Fileinfo
    - GD or Imagick
    
laravel_version: "12"

additional_packages:
  - "barryvdh/laravel-dompdf (PDF generation)"
  - "maatwebsite/excel (Excel export)"
  - "spatie/laravel-permission (RBAC)"
  - "spatie/laravel-activitylog (Audit trail)"
  - "intervention/image (Image processing)"
```

### 11.2 Security Requirements

```yaml
authentication:
  - Password minimum 8 characters
  - Must include: uppercase, lowercase, number
  - Password hashing: bcrypt
  - Session timeout: 30 minutes idle
  - Failed login lockout: 5 attempts
  
data_protection:
  - HTTPS only (SSL certificate required)
  - Database connection encrypted
  - Sensitive data encrypted at rest
  - Regular database backups
  - Backup retention: 30 days minimum
  
access_control:
  - Role-based permissions
  - IP whitelist for admin panel (optional)
  - Activity logging
  - File upload restrictions
  
compliance:
  - GDPR-ready (data privacy)
  - Audit trail for all transactions
  - Data retention policy configurable
```

### 11.3 Performance Requirements

```yaml
response_time:
  page_load: "<2 seconds"
  search_queries: "<1 second"
  report_generation: "<5 seconds for standard reports"
  transaction_processing: "<1 second"
  
scalability:
  concurrent_users: "Support 10-20 concurrent users"
  transaction_volume: "1000+ transactions per day"
  data_growth: "Plan for 5 years of data"
  
availability:
  uptime_target: "99.5%"
  backup_frequency: "Daily automated backups"
  recovery_time: "<4 hours"
```

---

## 12. Implementation Roadmap

### 12.1 Phase 1: Foundation (Month 1-2)

```yaml
deliverables:
  - Database schema design
  - Core authentication system
  - User management
  - Role-based access control
  - Basic dashboard
  
milestones:
  - Database created and seeded
  - Users can login
  - Roles and permissions working
  - Admin can manage users
```

### 12.2 Phase 2: Core Banking (Month 3-4)

```yaml
deliverables:
  - Member management module
  - Savings module (deposit, withdrawal)
  - Transaction receipts
  - Basic reporting
  - Document upload
  
milestones:
  - Members can be registered
  - Savings transactions working
  - Receipts can be printed
  - Basic reports generated
```

### 12.3 Phase 3: Financing (Month 5-7)

```yaml
deliverables:
  - Financing application module
  - Approval workflow (MVP version)
  - Payment schedule generation
  - Disbursement processing
  - Payment collection
  - Collectibility tracking
  
milestones:
  - Financing can be applied
  - Manager can approve
  - Payments can be recorded
  - NPF report available
```

### 12.4 Phase 4: Accounting Integration (Month 8-9)

```yaml
deliverables:
  - Chart of accounts
  - Auto journal entries
  - Manual journal entry
  - Financial reports (Neraca, Laba Rugi)
  - Year-end closing
  
milestones:
  - All transactions create journal entries
  - Financial statements accurate
  - Month-end process works
```

### 12.5 Phase 5: Collection & Enhancement (Month 10-11)

```yaml
deliverables:
  - Collection module
  - Territory management
  - Daily collection assignment
  - Collector performance tracking
  - Enhanced reporting
  
milestones:
  - Collectors receive daily tasks
  - Collection tracking works
  - Performance reports available
```

### 12.6 Phase 6: Migration & Go-Live (Month 12)

```yaml
activities:
  - Data migration from IBSS
  - Parallel run (2-4 weeks)
  - User training
  - System testing
  - Bug fixes
  - Go-live
  
milestones:
  - All data migrated successfully
  - Users trained
  - System stable
  - Production launch
```

---

## 13. Appendices

### 13.1 Glossary

```yaml
terms:
  BTM:
    full: "Baitul Maal wat Tamwil"
    definition: "Islamic microfinance institution / cooperative"
    
  Mudharabah:
    definition: "Islamic profit-sharing contract for business financing"
    
  Shahibul_Maal:
    definition: "Capital provider in Mudharabah contract"
    
  Mudharib:
    definition: "Business manager in Mudharabah contract"
    
  NPF:
    full: "Non-Performing Financing"
    definition: "Financing with payment issues (>30 days past due)"
    
  DPD:
    full: "Days Past Due"
    definition: "Number of days payment is overdue"
    
  Collectibility:
    definition: "Classification of financing quality based on payment status"
    
  Nisbah:
    definition: "Profit-sharing ratio in Islamic financing"
    
  Akad:
    definition: "Contract or agreement in Islamic finance"
```

### 13.2 References

```yaml
documents:
  - Business process documentation (in Indonesian)
  - Current IBSS user manual
  - Sample reports (./references/reports/)
  - Islamic finance guidelines
  - Accounting standards for cooperatives
  
external_resources:
  - Laravel documentation: https://laravel.com/docs
  - Islamic finance standards: AAOIFI
  - Indonesian cooperative regulations: UU No. 25/1992
```

---

## Document Control

```yaml
version_history:
  v1.0:
    date: "2026-01-27"
    author: "System Architect"
    changes: "Initial comprehensive specification"
    
approval:
  prepared_by: "System Architect"
  reviewed_by: "Project Manager"
  approved_by: "BTM Management"
  
distribution:
  - Development Team
  - Project Manager
  - BTM Management
  - System Administrator
```

---

**END OF DOCUMENT**