๐Ÿ“š ERP Documentation Viewer

Beautiful, colorful documentation for your ERP system

Notices Controller Documentation

File: /controllers/noticesController.php

Purpose: System notifications and alerts management for inventory, bills, checks, and operational status

Last Updated: December 20, 2024

Total Functions: 15+

Lines of Code: ~817

---

๐Ÿ“‹ Overview

The Notices Controller provides comprehensive business notifications including low inventory alerts, bill due dates, check processing status, workshop delays, and insurance approvals. It serves as a central dashboard for monitoring critical business operations requiring attention.

Primary Functions

---

๐Ÿ—„๏ธ Database Tables

Core Notification Tables

Table NamePurposeKey Columns
**product**Product master dataproductid, productName, productCatId
**storedetail**Inventory quantitiesstoredetailid, productid, storedetailquantity, storeid
**sellbilldetail**Sales transaction detailssellbilldetailproductid, sellbilldetaildate
**datedchecked**Post-dated checksdatedcheckedid, checkvalue, clientnum, addtype, done
**kempiala**Promissory noteskempialaid, kempialadate, kempialavalue
### Workshop & Insurance Tables

Table NamePurposeKey Columns
**toworkshoporder**Workshop orderstoworkshoporderid, deliverworkshopdate, recieveworkshopdate, orderstatus
**bills**Service billsbillid, clientid, insurance, approved, notifseen
**premium**Premium paymentspremiumid, premiumdate, userid
---

๐Ÿ”‘ Key Functions

1. Default Dashboard - System Notifications Overview

Location: Lines 231-291

Purpose: Display comprehensive business notification dashboard

Process Flow:

1. Category Data: Load product categories for filtering

2. Store Loading: Load warehouse/store information

3. Product Analysis: Get low stock and non-selling products

4. Bill Analysis: Check overdue bills and payments

5. Check Processing: Monitor dated checks requiring attention

6. Workshop Orders: Track delayed workshop operations

7. Insurance Bills: Monitor insurance approval status

8. Premium Tracking: Check due premium payments

2. showallproductbystorename() - Store-Specific Product Analysis

Location: Lines 480-510

Purpose: Analyze product levels filtered by store and category

Features:

3. productnotsellbystorename() - Non-Selling Product Detection

Location: Lines 546-582

Purpose: Identify products with no sales in past 7 days by store

4. getToWorkshopOrderNoticeInDetails() - Workshop Delay Monitoring

Location: Lines 658-711

Purpose: Monitor workshop order delays across different stages

Delay Types Monitored:

5. getInsuranceBillNotif() - Insurance Processing Alerts

Location: Lines 723-793

Purpose: Track insurance bill approval status and notifications

Status Types:

6. getPremiumTodays() - Premium Due Notifications

Location: Lines 796-805

Purpose: Get premium payments due today for current user

---

๐Ÿ”„ Workflows

Notification Dashboard Workflow

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
START: Load Notifications Dashboard
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
1Load Basic Data
โ†’ Load product categories
โ†’ Load store/warehouse information
โ”‚ โ””โ”€โ†’ Load user permissions and settings โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
2Analyze Inventory Status
โ†’ showallproductx2() - Low stock products
โ†’ productnotsell() - Non-selling products (7 days)
โ”‚ โ””โ”€โ†’ Apply category and store filters โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
3Check Financial Obligations
โ†’ showallkempila() - Due promissory notes
โ†’ checkforclient() - Client checks due (7 days)
โ”‚ โ””โ”€โ†’ checkforsupplier() - Supplier checks due (7 days) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
4Monitor Operational Issues
โ†’ getToWorkshopOrderNoticeInDetails() - Delays
โ†’ getInsuranceBillNotif() - Insurance status
โ†’ getPremiumTodays() - Due premiums
โ”‚ โ””โ”€โ†’ getProductRequest() - Product requests โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
5Display Notifications Dashboard
โ”‚ โ””โ”€โ†’ noticesview/show.html with all alert counts โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

---

๐ŸŒ URL Routes & Actions

URL ParameterFunctionDescription
`do=` (empty)DefaultMain notifications dashboard
`do=show`Store filterFilter by specific store
`do=showproductnotsell`Non-sellingShow non-selling products by store
`do=editprint`Bill printPrint promissory note details
`do=editprint2`Check printPrint check details
### Filter Parameters

---

๐Ÿงฎ Calculation Methods

Time-Based Calculations

// Workshop delay calculation
function dateTimeDiff($dateTime1, $dateTime2) {
    $dateTime1 = new DateTime($dateTime1);
    $dateTime2 = new DateTime($dateTime2);
    $diff = $dateTime2->diff($dateTime1);
    $hours = $diff->h + ($diff->days * 24);
    return $hours;
}

Product Path Generation

// Recursive category path building
$parentId = $product->productCatId;
$pathArr = getProductPath_recursive1($parentId, $categories, 0);
$request->productName = $product->productName . '/' . $pathArr;

---

๐Ÿ”’ Security & Performance

Performance Considerations

Required Indexes

---

๐Ÿ“š Related Documentation

---

Documented By: AI Assistant

Review Status: โœ… Complete

Next Review: When major changes occur

โ†‘