๐Ÿ“š ERP Documentation Viewer

Beautiful, colorful documentation for your ERP system

Project Material Returns Controller Documentation

File: /controllers/projectoperationControllerreturn.php

Purpose: Manage material returns from projects with inventory restoration and reverse accounting

Last Updated: 2024-12-20

---

๐Ÿ“‹ Overview

Primary Functions

Related Controllers

---

๐Ÿ—„๏ธ Database Tables

Primary Tables

Table NamePurposeKey Columns
projectexchmaterialreturnReturn transaction headerid, serilno, projectid, storeid, totalbuyprice
projectexchmaterialdetailreturnReturn transaction linesprojectexchid, productid, pronumber, probuyprice
### Secondary Tables (Referenced)

Same as projectoperationController.php with return-specific variants

---

๐Ÿ”ง Key Functions

1. add($id)

Purpose: Process material returns with inventory and accounting restoration

Business Logic:

// Reverse accounting entry
$dailyEntry->entryComment = 'ุชู… ุงุฑุฌุงุน ุตุฑู ู…ูˆุงุฏ ู„ู„ู…ุดุฑูˆุน';

// Increase inventory quantities (opposite of issue)
$productquantityFromAfter = increaseProductQuantity($storedetailFromId, $productquantityFromBefore, $productnumber);

// Create return audit trail
insertStorereport($productid, $storeid, $productnumber, $productquantityFromBefore, $productquantityFromAfter, 0, $projmaterialid, "ู…ุฑุชุฌุน ุตุฑู ู…ูˆุงุฏ ู„ู„ู…ุดุฑูˆุน " . $projectName,"projectoperationControllerreturn.php");

2. Accounting Integration

Return Entry Logic:

DR: Goods Under Settlement     $amount
    CR: Project Account            $amount

Comment: "ุชู… ุงุฑุฌุงุน ุตุฑู ู…ูˆุงุฏ ู„ู„ู…ุดุฑูˆุน"

---

โš ๏ธ Known Issues & Fixes

Issue 1: Same Tree Creation Bug (Line 417)

Problem: Uses undefined $txtName instead of $projectName

Cause: Copy-paste from material issue controller

Fix: Replace with correct variable

File: Line 417

---

๐Ÿ“š Related Documentation

โ†‘