📘 ProfitMate Complete Guide

Version: 2.0 | Last Updated: November 2025 | System: ProfitMate Multi-Tenant SaaS Platform

🎯 System Overview

ProfitMate is a comprehensive Profit & Loss Management SaaS platform designed for small F&B and Retail businesses in Malaysia. It provides end-to-end business management from product creation to sales, purchases, expenses, and comprehensive reporting.

ProfitMate operates as a multi-tenant SaaS platform where each business organization operates as an independent tenant with complete data isolation, user management, and customizable access controls.

Key Concepts

  • Tenant: An independent business organization using the platform
  • Tenant Admin: The primary administrator of a tenant organization
  • Tenant User: Regular staff members within a tenant organization
  • SuperAdmin: Platform administrators who manage all tenants
  • Multi-Tenancy: Complete data isolation between different tenant organizations

Core Capabilities

📦 Product Management

Complete product catalog with automatic pricing calculations

💰 Sales Management

POS system with invoice generation and profit tracking

🛒 Purchase Management

Purchase order system with stock updates

📊 Expense Tracking

Categorized expense management with receipt attachments

👥 Customer & Supplier

Complete contact management

📈 Reporting & Analytics

Profit & Loss statements, sales summaries, expense breakdowns

🔐 Multi-Tenancy Architecture

Data Isolation

Principle: Complete data isolation between tenants

Implementation:

  • All business tables include tenant_id column
  • BelongsToTenant trait auto-scopes queries
  • Middleware ensures tenant context
  • Database-level isolation

Tenant Resolution

Methods:

  1. Path-based: https://profitmate.tskinvent.com/t/raihan → resolves to tenant with slug "raihan"
  2. Session-based: Tenant ID stored in session after login
Security Feature: Cross-tenant access is prevented at the database level. Users from Tenant A cannot access Tenant B's data.

👥 User Roles & Hierarchy

System Hierarchy

System Hierarchy Structure
graph TD SA[SuperAdmin
Platform Level] --> T[Tenant
Organization Level] T --> TA[Tenant Admin
First User
Full Control] T --> TU[Tenant Users
Staff Members] TU --> M[Manager
with roles] TU --> S[Staff
with roles] TU --> C[Cashier
with roles] style SA fill:#2563eb,stroke:#1e40af,stroke-width:3px,color:#fff style T fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style TA fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff

1. SuperAdmin

Level: Platform Administrator
Access: All tenants, system settings, tenant management

Characteristics:

  • is_superadmin = true
  • tenant_id = null (does not belong to any tenant)
  • Manages all tenants from admin panel
  • Cannot access tenant-specific business data (by design)

What SuperAdmin CAN Do

  • ✅ Manage all tenants
  • ✅ Approve/reject tenant registrations
  • ✅ Configure system settings
  • ✅ Manage email templates
  • ✅ View platform statistics

2. Tenant Admin

Level: Organization Administrator
Access: Full control within their tenant organization

Key Functions:

  • User Management: Create, edit, approve, deactivate, delete tenant users
  • Role Management: Create, edit, assign roles and permissions
  • Settings Management: Configure tenant settings
  • Data Management: Full access to all business data

3. Tenant User

Level: Staff Member
Access: Limited based on assigned roles and permissions

🔄 Tenant Registration Flow

Mobile App Registration Flow

Mdm Siti Raihan Bin Jamaludin

To register and access ProfitMate on mobile device:

  1. Download Mobile App: Scan QR code below or click to download APK (Android APK file)
  2. WhatsApp to Register: Contact +60197013326 (Mdm Siti Raihan Bin Jamaludin) to register as a tenant
  3. Receive Credentials: After approval, you'll receive login credentials (email and password) via WhatsApp
  4. Access System: Open the ProfitMate mobile app on your device, enter your credentials, and start using the system
QR Code for APK Download

Scan QR Code to Download

Or Download Directly

Contact Information:

  • 👤 Contact Person: Mdm Siti Raihan Bin Jamaludin (Pensyarah DH12)
  • 🏫 Institution: Kolej Komuniti Temerloh, Pahang
  • 📍 Address: By Pass Batu 2, Jalan Temerloh, Kg. Chatin Ulu, 28400 Mentakab, Pahang
  • 📞 Phone: 016-2012114 / 09-2701550 / 1557

Note: This system is used for learning purposes in the Keusahawanan/Entrepreneurship subject at Kolej Komuniti Temerloh, Pahang. Mdm Siti Raihan Bin Jamaludin is the admin and owner of the system.

Step-by-Step Registration Process

Tenant Registration Flow
flowchart TD Start([Business Owner]) --> FillForm[Fill Registration Form
Company Name, Subdomain
Admin Details, Business Info] FillForm --> Submit[Submit Registration] Submit --> CreateTenant[System Creates Tenant
status: pending
Admin User: is_active = false] CreateTenant --> NotifySA[Notify SuperAdmins] NotifySA --> Review{SuperAdmin Reviews} Review -->|Approve| Approve[Approve Registration] Review -->|Reject| Reject[Reject Registration
with reason] Approve --> Activate[Activate Tenant
status: approved
Admin User: is_active = true] Activate --> SeedCategories[Seed Expense Categories
12 default categories] SeedCategories --> NotifyAdmin[Notify Tenant Admin] NotifyAdmin --> Login[Tenant Admin Can Login] Login --> Access[Access Full System] Reject --> NotifyRejected[Notify Tenant Admin
with rejection reason] style Start fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style Approve fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style Reject fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff style Login fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style Access fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

1. Registration Request

API Endpoint: POST /api/register/tenant

Required Information:

  • Company/Business Name
  • Subdomain (unique identifier)
  • Admin Name, Email, Password
  • Business details (optional)

2. Tenant Creation

System creates tenant with status = 'pending' and admin user with is_active = false

3. SuperAdmin Review

SuperAdmin reviews and can approve or reject the registration

4. Tenant Admin Login

After approval, Tenant Admin can login and access the full system

🎛️ SuperAdmin Functionality

Tenant Management

API Endpoints:

  • GET /api/admin/tenants - List all tenants
  • POST /api/admin/tenants - Create tenant
  • POST /api/admin/tenants/{id}/approve - Approve tenant
  • POST /api/admin/tenants/{id}/reject - Reject tenant

System Settings

Manage application settings, email configuration, security settings, and feature flags

🎛️ Tenant Admin Functionality

User Management

Create, edit, approve, deactivate, and delete tenant users

Role & Permission Management

Create roles, assign permissions, and manage access control

Tenant Settings

Configure general settings, appearance, notifications, and security

🏗️ Core Business Modules

1. Product Management

Manage product catalog, pricing, costs, and inventory with automatic calculations.

Key Features:

  • Product CRUD operations
  • Automatic cost calculations (Excel formula match)
  • Stock quantity management
  • Low stock alerts
  • Product categories

2. Sales Management

Record sales transactions, generate invoices, track payments, calculate profits.

3. Purchase Management

Manage purchase orders, track supplier purchases, update inventory.

4. Expense Management

Track operating expenses, categorize spending, manage receipts.

🔄 Complete Workflows

Workflow 1: Product Creation & Pricing

Product Creation & Pricing Workflow
flowchart TD Start([User Creates Product]) --> FillForm[Fill Product Form
Basic Info, Costs A+B+C+D
Profit Margin %, Stock] FillForm --> CalcE[System Calculates
Total Cost E = A+B+C+D] CalcE --> CalcG[System Calculates
Profit Margin G = E × F%] CalcG --> CalcH[System Calculates
Selling Price H = E + G] CalcH --> Save[Save Product] Save --> Upload[Upload Image
if provided] Upload --> Log[Log Activity] Log --> Redirect[Redirect to Product Detail] Redirect --> Result([✅ Product Ready]) style Start fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style CalcE fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style CalcG fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style CalcH fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style Result fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

Workflow 2: Sales Transaction (Complete POS Flow)

Sales Transaction (POS) Workflow
flowchart TD Start([Create New Sale]) --> SelectCustomer[Select Customer
Existing or Walk-in] SelectCustomer --> AddProducts[Add Products to Sale
Search/Select Product
Enter Quantity
Validate Stock] AddProducts --> CalcSubtotal[Auto-calculate
Subtotal & Profit] CalcSubtotal --> ApplyDiscount{Apply Discount
& Tax?} ApplyDiscount -->|Yes| Discount[Apply Discount & Tax] ApplyDiscount -->|No| SelectPayment Discount --> SelectPayment[Select Payment Method
& Status] SelectPayment --> GenerateInvoice[Generate Invoice Number
INV{YYYYMMDD}-{XXXX}] GenerateInvoice --> CreateSale[Create Sale Record
& Sale Items] CreateSale --> DecreaseStock[Decrease Product Stock] DecreaseStock --> CalcTotals[Calculate Sale Totals] CalcTotals --> LogActivity[Log Activity] LogActivity --> CheckAlerts{Stock Alerts?} CheckAlerts -->|Yes| CreateNotification[Create Notifications] CheckAlerts -->|No| Result CreateNotification --> Result([✅ Sale Complete
Invoice Ready]) style Start fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style GenerateInvoice fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff style DecreaseStock fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style Result fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

Workflow 3: Purchase Order Creation

Purchase Order Creation Workflow
flowchart TD Start([Create Purchase Order]) --> SelectSupplier[Select Supplier
or leave empty] SelectSupplier --> AddProducts[Add Products
Search/Select Product
Enter Quantity & Price] AddProducts --> EnterDetails[Enter Purchase Details
Date, Delivery, Shipping
Tax, Notes] EnterDetails --> UploadProof{Upload Proof
of Purchase?} UploadProof -->|Yes| Upload[Upload Proof File] UploadProof -->|No| SelectPayment Upload --> SelectPayment[Select Payment Method
& Status] SelectPayment --> GeneratePO[Generate PO Number
PO{YYYYMMDD}-{XXXX}] GeneratePO --> CreatePurchase[Create Purchase Record
& Purchase Items] CreatePurchase --> IncreaseStock[Increase Product Stock] IncreaseStock --> CalcTotals[Calculate Purchase Totals] CalcTotals --> LogActivity[Log Activity] LogActivity --> CheckAlerts{Stock Alerts?} CheckAlerts -->|Yes| CreateNotification[Create Notifications] CheckAlerts -->|No| Result CreateNotification --> Result([✅ Purchase Order Created
Stock Updated]) style Start fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style GeneratePO fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff style IncreaseStock fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style Result fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

Workflow 4: Expense Recording

Expense Recording Workflow
flowchart TD Start([Record New Expense]) --> FillForm[Fill Expense Form
Title, Description, Amount] FillForm --> SelectCategory[Select Category
12 Default or Custom] SelectCategory --> EnterDetails[Enter Expense Details
Date, Payment Method
Reference, Vendor, Notes] EnterDetails --> Recurring{Recurring Expense?} Recurring -->|Yes| SetRecurring[Set Recurring Schedule] Recurring -->|No| UploadProof SetRecurring --> UploadProof{Upload Proof?} UploadProof -->|Yes| Upload[Upload Proof File] UploadProof -->|No| CreateExpense Upload --> CreateExpense[Create Expense Record] CreateExpense --> HandleFile{File Uploaded?} HandleFile -->|Yes| ProcessFile[Process File Upload] HandleFile -->|No| LogActivity ProcessFile --> LogActivity[Log Activity] LogActivity --> CheckNotification{Create Notification?} CheckNotification -->|Yes| CreateNotification[Create Notification] CheckNotification -->|No| Result CreateNotification --> Result([✅ Expense Recorded
Ready for P&L]) style Start fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style SelectCategory fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#fff style CreateExpense fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style Result fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

Workflow 5: Profit & Loss Report Generation

Profit & Loss Report Generation Workflow
flowchart TD Start([Generate P&L Report]) --> SelectRange[Select Date Range
Today, Week, Month, Year, Custom] SelectRange --> QuerySales[Query Sales in Date Range] QuerySales --> CalcRevenue[Calculate Revenue
sum of sale.total_amount] CalcRevenue --> CalcCOGS[Calculate COGS
sum of sale.total_cost] CalcCOGS --> CalcGrossProfit[Calculate Gross Profit
Revenue - COGS] QuerySales --> QueryExpenses[Query Expenses in Date Range] QueryExpenses --> GroupExpenses[Group Expenses by Category] GroupExpenses --> CalcTotalExpenses[Calculate Total Expenses
sum of expense.amount] CalcGrossProfit --> CalcNetProfit[Calculate Net Profit
Gross Profit - Total Expenses] CalcTotalExpenses --> CalcNetProfit CalcNetProfit --> DisplayReport[Display Report
Revenue, COGS, Gross Profit
Expenses, Net Profit] DisplayReport --> Export{Export Options?} Export -->|PDF| ExportPDF[Export to PDF] Export -->|Print| Print[Print Report] Export -->|None| Result ExportPDF --> Result Print --> Result([✅ P&L Report Generated]) style Start fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style CalcRevenue fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style CalcGrossProfit fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style CalcNetProfit fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style Result fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

🔀 Business Flows

Flow 1: Complete Product Lifecycle

Product Lifecycle Flow
flowchart LR A[Product Creation
Set Costs A+B+C+D
Set Margin %] --> B[System Calculates
E, G, H] B --> C[Stock Management
Initial Stock Set] C --> D{Purchases & Sales} D -->|Purchase| E[Stock Increases] D -->|Sale| F[Stock Decreases] E --> G[Low Stock Monitoring] F --> G G --> H{Stock Alert?} H -->|Yes| I[Send Notification] H -->|No| J[Continue Operations] I --> J J --> K[Pricing Updates
Cost/Margin Changes] K --> L[Recalculate E, G, H] L --> M[Product Analysis
Sales Performance
Stock Analysis] style A fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style B fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style E fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style F fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff style M fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#fff

Flow 2: Complete Sales-to-Cash Flow

Sales-to-Cash Flow
flowchart LR A[Product Selection
Check Stock] --> B[Sale Creation
Generate Invoice
Create Items] B --> C[Calculate Totals
Decrease Stock] C --> D[Payment Processing
Select Method
Set Status] D --> E[Invoice Generation
Receipt or A4 Format] E --> F[Profit Calculation
Per Item & Total] F --> G{Payment Status} G -->|Paid| H[✅ Complete] G -->|Partial| I[Track Remaining] G -->|Unpaid| J[Follow-up Actions] I --> J J --> H style A fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style B fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style C fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff style F fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style H fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

Flow 3: Complete Purchase-to-Stock Flow

Purchase-to-Stock Flow
flowchart LR A[Purchase Order Creation
Select Supplier
Add Products] --> B[Purchase Processing
Generate PO Number
Create Items] B --> C[Calculate Totals
Increase Stock] C --> D[Payment Tracking
Set Status
Record Payment] D --> E[Delivery Tracking
Expected & Actual Dates] E --> F[Stock Update Confirmation
Check Alerts] F --> G[✅ Purchase Complete] style A fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style B fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style C fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style G fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

Flow 4: Expense-to-P&L Flow

Expense-to-P&L Flow
flowchart LR A[Expense Recording
Categorize
Enter Amount
Upload Proof] --> B[Expense Storage
Create Record
Link to Category] B --> C[P&L Calculation
Group by Category
Calculate Totals] C --> D[Include in Net Profit
Gross Profit - Expenses] D --> E[Reporting
Expense Breakdown
P&L Statement] E --> F[✅ Report Generated] style A fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style B fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style C fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff style D fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#fff style F fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

🔗 Data Relationships

Entity Relationship Diagram

Entity Relationship Diagram
erDiagram TENANT ||--o{ PRODUCTS : has TENANT ||--o{ CUSTOMERS : has TENANT ||--o{ SUPPLIERS : has TENANT ||--o{ SALES : has TENANT ||--o{ PURCHASES : has TENANT ||--o{ EXPENSES : has TENANT ||--o{ EXPENSE_CATEGORIES : has TENANT ||--o{ PRODUCT_CATEGORIES : has TENANT ||--o{ USERS : has PRODUCT ||--o{ PRODUCT_COSTS : has PRODUCT ||--o{ SALE_ITEMS : "used in" PRODUCT ||--o{ PURCHASE_ITEMS : "purchased in" PRODUCT }o--|| PRODUCT_CATEGORY : belongs_to CUSTOMER ||--o{ SALES : "makes" SUPPLIER ||--o{ PURCHASES : "supplies" SALE ||--o{ SALE_ITEMS : contains SALE }o--|| CUSTOMER : "sold to" SALE }o--|| USER : "served_by" PURCHASE ||--o{ PURCHASE_ITEMS : contains PURCHASE }o--|| SUPPLIER : "from" PURCHASE }o--|| USER : "ordered_by" EXPENSE }o--|| EXPENSE_CATEGORY : belongs_to USER }o--o{ ROLES : "has" TENANT { int id PK string slug UK string name string status } PRODUCT { int id PK int tenant_id FK string name decimal selling_price int stock_quantity } SALE { int id PK int tenant_id FK string invoice_no decimal total_amount } PURCHASE { int id PK int tenant_id FK string purchase_no decimal total_amount }

Key Relationships

  1. Tenant → Products: One tenant has many products
  2. Product → SaleItems: One product can be in many sales
  3. Product → PurchaseItems: One product can be in many purchases
  4. Sale → SaleItems: One sale has many items
  5. Purchase → PurchaseItems: One purchase has many items
  6. Customer → Sales: One customer can have many sales
  7. Supplier → Purchases: One supplier can have many purchases
  8. Expense → ExpenseCategory: One expense belongs to one category

Integration Points

1. Product-Sale Integration

Trigger: Sale creation
Action: Stock decrease, profit calculation

Product-Sale Integration Flow
flowchart TD A[Sale Created] --> B[For each SaleItem] B --> C[Get Product] C --> D[Decrease Stock
stock_quantity -= quantity] D --> E[Calculate Profit
unit_price - unit_cost × quantity] E --> F{Stock Alert?} F -->|Low Stock| G[Create Low Stock Notification] F -->|Out of Stock| H[Create Out of Stock Notification] F -->|OK| I[✅ Complete] G --> I H --> I style A fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style D fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff style E fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style I fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

2. Product-Purchase Integration

Trigger: Purchase creation
Action: Stock increase, cost tracking

Product-Purchase Integration Flow
flowchart TD A[Purchase Created] --> B[For each PurchaseItem] B --> C[Get Product] C --> D[Increase Stock
stock_quantity += quantity] D --> E{Update Average Cost?} E -->|Yes| F[Calculate Average Cost
from Purchase History] E -->|No| G[✅ Complete] F --> G style A fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style D fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style F fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#fff style G fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

3. Sale-Expense Integration

Trigger: P&L Report generation
Action: Combine sales and expenses, calculate net profit

Sale-Expense Integration (P&L Calculation)
flowchart TD A[P&L Report Requested] --> B[Query Sales
in Date Range] B --> C[Calculate Revenue
sum of sale.total_amount] C --> D[Calculate COGS
sum of sale.total_cost] D --> E[Calculate Gross Profit
Revenue - COGS] A --> F[Query Expenses
in Date Range] F --> G[Group by Category] G --> H[Calculate Total Expenses
sum of expense.amount] E --> I[Calculate Net Profit
Gross Profit - Total Expenses] H --> I I --> J[✅ P&L Report Generated] style A fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style C fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style E fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style I fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#fff style J fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

4. Notification Integration

Notification System Integration
flowchart TD A[System Event] --> B{Event Type?} B -->|Low Stock| C[Low Stock Detection] B -->|Out of Stock| D[Out of Stock Detection] B -->|Large Sale| E[Large Sale Detection] B -->|Purchase Due| F[Purchase Payment Due] B -->|Registration| G[Tenant Registration] C --> H[Create Notification Record] D --> H E --> H F --> H G --> H H --> I{Email Enabled?} I -->|Yes| J[Send Email Notification] I -->|No| K[Send In-App Notification] J --> K K --> L[✅ Notification Sent] style A fill:#2563eb,stroke:#1e40af,stroke-width:2px,color:#fff style C fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff style D fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff style E fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff style H fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#fff style L fill:#10b981,stroke:#059669,stroke-width:3px,color:#fff

Triggers:

  • Low stock detection
  • Out of stock detection
  • Large sale detection
  • Purchase payment due
  • Tenant registration

Actions:

  • Create notification record
  • Send in-app notification
  • Send email notification (if enabled)

💰 Financial Calculations

Product Pricing

Formula:

Total Cost (E) = A + B + C + D
Profit Margin Amount (G) = E × (F / 100)
Selling Price (H) = E + G

Example:

If A = 5.00, B = 2.00, C = 1.00, D = 0.50, F = 30%
Then E = 8.50, G = 2.55, H = 11.05

Sale Profit

Profit = (Price - Cost) × Quantity

Profit & Loss Statement

Revenue = sum of all sale.total_amount
COGS = sum of all sale.total_cost
Gross Profit = Revenue - COGS
Operating Expenses = sum of all expense.amount
Net Profit = Gross Profit - Operating Expenses

📦 Stock Management Flow

Stock Update Triggers

  • Stock Increases: Purchase Order Created → Stock increases
  • Stock Decreases: Sale Created → Stock decreases
  • Stock Recalculation: Manual recalculation available

Stock Alert System

  • Low Stock Alert: When stock_quantity <= low_stock_alert
  • Out of Stock Alert: When stock_quantity <= 0

👥 User Management & RBAC

Role-Based Access Control

Structure:

Permission (Granular)
    ↓
Role (Collection of Permissions)
    ↓
User (Assigned Roles)
    ↓
Access Control

Permission Categories

  • Products (create, edit, delete, view)
  • Sales (create, edit, delete, view)
  • Purchases (create, edit, delete, view)
  • Expenses (create, edit, delete, view)
  • Customers, Suppliers, Reports, Settings, Users, Roles

🔒 Data Isolation & Security

Data Isolation Mechanisms

  1. Database Level: tenant_id column on all business tables
  2. Application Level: Global scopes on models, middleware validation
  3. Session Level: Tenant ID stored in session

Security Features

  • Email/password authentication
  • Laravel Sanctum for API tokens
  • Role-based access control
  • Cross-tenant access prevention
  • SQL injection protection (Eloquent ORM)
  • XSS protection (Blade templating)

📊 Summary

Key Differences Between User Roles

Aspect SuperAdmin Tenant Admin Tenant User
Tenant Association None Belongs to tenant Belongs to tenant
Tenant Management ✅ Full ❌ None ❌ None
User Management ❌ None ✅ Full ❌ None
Business Data ❌ Cannot access ✅ Full access ⚠️ Limited by roles
📚 Complete Documentation: For the full comprehensive guide including all workflows, API endpoints, data models, and detailed explanations, please refer to the PROFITMATE_COMPLETE_GUIDE.md file in the project repository.

📞 Registration & Contact Information

Mdm Siti Raihan Bin Jamaludin

Mdm Siti Raihan Bin Jamaludin

Pensyarah DH12 | Kolej Komuniti Temerloh

To register as a tenant, please contact:

  • 📱 WhatsApp: +60197013326
  • 👤 Contact Person: Mdm Siti Raihan Bin Jamaludin
  • 🏫 Institution: Kolej Komuniti Temerloh, Pahang
  • 📍 Address: By Pass Batu 2, Jalan Temerloh, Kg. Chatin Ulu, 28400 Mentakab, Pahang
  • 📞 Phone: 016-2012114 / 09-2701550 / 1557

Note: This system is used for learning purposes in the Keusahawanan/Entrepreneurship subject at Kolej Komuniti Temerloh, Pahang. Mdm Siti Raihan Bin Jamaludin is the admin and owner of the system.