Showing AI reviews for army
Project AI Score ?
67%
Quality Avg ?
72%
Security Avg ?
54%
Reviews ?
37

Review Result ?

jattin01/army · a9fd74a6
The commit introduces a multi-file update to the AttendanceReportExport class and several controllers related to admin and finance functionalities. The AttendanceReportExport class offers structured data export to Excel with formatting and headings which enhances readability and usability. However, the commit message is uninformative and contains typos, reducing clarity. Some raw SQL queries and external dependencies are used that could be potential bug or security risks if not properly sanitized. The code shows reasonable data validation but lacks comments and consistent error handling across all changes.
Quality ?
75%
Security ?
50%
Business Value ?
70%
Maintainability ?
73%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Non Descriptive And Contains Typo
Where commit message
Issue / Evidence non-descriptive and contains typo
Suggested Fix provide a clear, descriptive, and typo-free commit message explaining the purpose of changes
Mixed Logic For Leave Status In Mapping
Where app/Exports/AttendanceReportExport.php:19
Issue / Evidence mixed logic for leave status in mapping
Suggested Fix consider refactoring with clearer function/method separation to improve readability and testability
Raw Sql Query Without Parameterization
Where app/Http/Controllers/Adm/FinPowersController.php:18
Issue / Evidence raw SQL query without parameterization
Suggested Fix use parameterized queries or ORM to reduce SQL injection risk
Raw Sql Query To Get Max Grantid
Where app/Http/Controllers/Adm/FundTransactionController.php:18
Issue / Evidence raw SQL query to get max GrantID
Suggested Fix validate input and consider locking or transaction to avoid race conditions
Raw Sql For Existence Check
Where app/Http/Controllers/Adm/FundTransactionController.php:53
Issue / Evidence raw SQL for existence check
Suggested Fix use ORM/parameter binding consistently
Throwing Generic Untimeexception
Where app/Http/Controllers/Admin/StaffController.php:468
Issue / Evidence throwing generic untimeexception
Suggested Fix define and use custom exceptions for domain-specific errors for better error handling
Missing Validation
Where app/Http/Controllers/Admin/StaffController.php:688
Issue / Evidence rowValueAny method lacks input validation and comments
Suggested Fix add validation for $row structure and document usage
Missing Validation
Where app/Http/Controllers/Admin/StaffController.php:731
Issue / Evidence normalizePayMatrixValue uses regex without full validation
Suggested Fix sanitize inputs tightly to avoid potential injection or malformed data
Paymatrixentry Returns Null On Missing Par...
Where app/Http/Controllers/Admin/StaffController.php:732
Issue / Evidence payMatrixEntry returns null on missing params
Suggested Fix consider logging or handling to improve debuggability
Code Change Preview · app/Exports/AttendanceReportExport.php ?
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Exports;
+ 
+ use Illuminate\Support\Collection;
+ use Maatwebsite\Excel\Concerns\FromCollection;
+ use Maatwebsite\Excel\Concerns\WithHeadings;
+ 
+ class AttendanceReportExport implements FromCollection, WithHeadings
+ {
+     public function __construct(private Collection $attendances)
+     {
+     }
+ 
+     public function collection()
+     {
+         return $this->attendances->map(function ($attendance) {
+             $employee = $attendance->employee;
Removed / Before Commit
- {
- $request = $this->request;
- 
-         $query = Complaint::with(['assignedTo', 'natureOfComplaint', 'group']);
- 
- if ($request->filled('date_from')) {
- $query->whereDate('complaint_date', '>=', $request->date_from);
- return [
- 'Complaint No' => $complaint->complaint_number,
- 'Group' => optional($complaint->group)->name,
- 'Nature Of Complaint' => optional($complaint->natureOfComplaint)->name,
- 'Assigned To' => optional($complaint->assignedTo)->name,
- 'User Status' => $complaint->user_status,
- 'Resolver Status' => $complaint->resolver_status,
- 'Admin Status' => $complaint->admin_status ?: 'Pending',
- return [
- 'Complaint No',
- 'Group',
Added / After Commit
+ {
+ $request = $this->request;
+ 
+         $query = Complaint::with(['assignedTo', 'resolver', 'natureOfComplaint', 'group', 'subGroup']);
+ 
+ if ($request->filled('date_from')) {
+ $query->whereDate('complaint_date', '>=', $request->date_from);
+ return [
+ 'Complaint No' => $complaint->complaint_number,
+ 'Group' => optional($complaint->group)->name,
+                 'Sub Section' => optional($complaint->subGroup)->name,
+ 'Nature Of Complaint' => optional($complaint->natureOfComplaint)->name,
+                 'Complaint Description' => $complaint->complaint_description,
+ 'Assigned To' => optional($complaint->assignedTo)->name,
+                 'Resolver Name' => optional($complaint->resolver)->name,
+                 'Fault Diagnosis' => $complaint->resolver_remark,
+ 'User Status' => $complaint->user_status,
+ 'Resolver Status' => $complaint->resolver_status,
Removed / Before Commit
- 
- public function index()
- {
-         $grants       = DB::select("SELECT GrantID, GrantName FROM Grants ORDER BY GrantName");
- $designations = DB::select("SELECT DesignationID, `Designation` FROM designation ORDER BY `Designation`");
-         $finPowers    = DB::select("SELECT fp.FinPowerID, g.GrantName, d.`Designation`, fp.Inherent, fp.WithIFA, fp.CreatedDate FROM finpower fp INNER JOIN Grants g ON fp.GrantID=g.GrantID INNER JOIN designation d ON fp.DesignationID=d.DesignationID ORDER BY g.GrantName, fp.Inherent");
- return view('adm.fin-powers', compact('grants','designations','finPowers'));
- }
Added / After Commit
+ 
+ public function index()
+ {
+         $grants       = DB::select("SELECT GrantID, GrantName FROM new_grants ORDER BY GrantName");
+ $designations = DB::select("SELECT DesignationID, `Designation` FROM designation ORDER BY `Designation`");
+         $finPowers    = DB::select("SELECT fp.FinPowerID, g.GrantName, d.`Designation`, fp.Inherent, fp.WithIFA, fp.CreatedDate FROM finpower fp INNER JOIN new_grants g ON fp.GrantID=g.GrantID INNER JOIN designation d ON fp.DesignationID=d.DesignationID ORDER BY g.GrantName, fp.Inherent");
+ return view('adm.fin-powers', compact('grants','designations','finPowers'));
+ }
Removed / Before Commit
- 
- private function nextGrantId(): int
- {
-         return (int) (DB::selectOne("SELECT COALESCE(MAX(GrantID), 0) + 1 AS id FROM Grants")->id ?? 1);
- }
- 
- public function index()
- {
-         $grants       = DB::select("SELECT GrantID, GrantName FROM Grants ORDER BY GrantName");
- $designations = DB::select("SELECT DesignationID, `Designation` FROM designation ORDER BY `Designation`");
-         $transactions = DB::select("SELECT g.GrantName, ft.TransactionType, ft.Amount, ft.Authority, ft.AuthorityDate, ft.TransactionDate FROM fundtransactions ft INNER JOIN Grants g ON ft.GrantID=g.GrantID ORDER BY ft.TransactionDate DESC LIMIT 50");
- return view('adm.fund-transaction', compact('grants','designations','transactions'));
- }
- 
- $grantName = trim($request->GrantName ?? '');
- if (!$grantName) return back()->with('error', 'Please enter Grant Name.');
- 
-         $exists = DB::selectOne("SELECT COUNT(*) AS cnt FROM Grants WHERE GrantName=?", [$grantName])->cnt;
Added / After Commit
+ 
+ private function nextGrantId(): int
+ {
+         return (int) (DB::selectOne("SELECT COALESCE(MAX(GrantID), 0) + 1 AS id FROM new_grants")->id ?? 1);
+ }
+ 
+ public function index()
+ {
+         $grants       = DB::select("SELECT GrantID, GrantName FROM new_grants ORDER BY GrantName");
+ $designations = DB::select("SELECT DesignationID, `Designation` FROM designation ORDER BY `Designation`");
+         $transactions = DB::select("SELECT g.GrantName, ft.TransactionType, ft.Amount, ft.Authority, ft.AuthorityDate, ft.TransactionDate FROM fundtransactions ft INNER JOIN new_grants g ON ft.GrantID=g.GrantID ORDER BY ft.TransactionDate DESC LIMIT 50");
+ return view('adm.fund-transaction', compact('grants','designations','transactions'));
+ }
+ 
+ $grantName = trim($request->GrantName ?? '');
+ if (!$grantName) return back()->with('error', 'Please enter Grant Name.');
+ 
+         $exists = DB::selectOne("SELECT COUNT(*) AS cnt FROM new_grants WHERE GrantName=?", [$grantName])->cnt;
Removed / Before Commit
- {
- private function nextVendorId(): int
- {
-         return (int) (DB::selectOne("SELECT COALESCE(MAX(VendorID), 0) + 1 AS id FROM Vendors")->id ?? 1);
- }
- 
- public function index(Request $request)
- if ($request->filled('edit')) {
- $editRow = DB::selectOne(
- "SELECT VendorID,VendorName,ContactPerson,Email,Phone,Address,IsDPSU,IsActive,CreatedDate
-                  FROM Vendors WHERE VendorID = ?",
- [(int) $request->query('edit')]
- );
- }
- 
-         $vendors = DB::select("SELECT VendorID,VendorName,ContactPerson,Email,Phone,Address,IsDPSU,IsActive,CreatedDate FROM Vendors ORDER BY VendorName");
- return view('adm.vendor-entry', compact('vendors', 'editRow'));
- }
Added / After Commit
+ {
+ private function nextVendorId(): int
+ {
+         return (int) (DB::selectOne("SELECT COALESCE(MAX(VendorID), 0) + 1 AS id FROM vendors")->id ?? 1);
+ }
+ 
+ public function index(Request $request)
+ if ($request->filled('edit')) {
+ $editRow = DB::selectOne(
+ "SELECT VendorID,VendorName,ContactPerson,Email,Phone,Address,IsDPSU,IsActive,CreatedDate
+                  FROM vendors WHERE VendorID = ?",
+ [(int) $request->query('edit')]
+ );
+ }
+ 
+         $vendors = DB::select("SELECT VendorID,VendorName,ContactPerson,Email,Phone,Address,IsDPSU,IsActive,CreatedDate FROM vendors ORDER BY VendorName");
+ return view('adm.vendor-entry', compact('vendors', 'editRow'));
+ }
Removed / Before Commit
- use App\Models\FinancePaymentRecovery;
- use App\Models\FinanceStaffDetail;
- use App\Models\FinanceStaffTax;
- use App\Services\LeaveValidationService;
- use Illuminate\Support\Facades\Storage;
- use App\Imports\StaffImport;
- use Maatwebsite\Excel\Facades\Excel;
- use Carbon\Carbon;
- use Illuminate\Support\Facades\DB;
- use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
- use PhpOffice\PhpSpreadsheet\IOFactory;
- use PhpOffice\PhpSpreadsheet\Shared\Date;
- $this->manmasterFinanceDetailData($row, $staff)
- );
- 
- FinancePaymentRecovery::updateOrCreate(
- ['staff_id' => $staff->id],
-                         $this->manmasterPaymentRecoveryData($row, $staff)
Added / After Commit
+ use App\Models\FinancePaymentRecovery;
+ use App\Models\FinanceStaffDetail;
+ use App\Models\FinanceStaffTax;
+ use App\Models\FinanceSupplementaryPayment;
+ use App\Models\PayMatrix;
+ use App\Services\LeaveValidationService;
+ use Illuminate\Support\Facades\Storage;
+ use App\Imports\StaffImport;
+ use Maatwebsite\Excel\Facades\Excel;
+ use Carbon\Carbon;
+ use Illuminate\Support\Facades\DB;
+ use Illuminate\Validation\ValidationException;
+ use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
+ use PhpOffice\PhpSpreadsheet\IOFactory;
+ use PhpOffice\PhpSpreadsheet\Shared\Date;
+ $this->manmasterFinanceDetailData($row, $staff)
+ );
+ 
Removed / Before Commit
- public function index(Request $request)
- {
- $caseId    = (int)$request->query('CaseID', 0);
-         $cases     = DB::select("SELECT CaseID, CaseNo FROM Cases ORDER BY CaseNo");
- $procRules = DB::select("SELECT ProcRuleID, ProcRule FROM ProcRules ORDER BY ProcRule");
- 
- $aonRows   = [];
- $aonRows = DB::select("SELECT SP.Section, SP.PartNo, SP.Nomenclature, AU.AUName AS AU,
- SUM(LPS.Qty) AS Qty, LPS.ProposalPrice AS Rate, LPS.GST, LPS.OtherCharges,
- SUM(LPS.TotalAONAmount) AS Amount, GROUP_CONCAT(J.JobNo SEPARATOR ', ') AS JobNos
-                 FROM Cases C INNER JOIN LPRs L ON C.CaseID=L.CaseNoID
-                 INNER JOIN LPRspares LPS ON L.LPRID=LPS.LPRID
-                 INNER JOIN Spares SP ON LPS.SpareID=SP.SpareID
- INNER JOIN au AU ON SP.AUID=AU.AUID
-                 INNER JOIN Jobs J ON LPS.JobID=J.JobID
- WHERE C.CaseID=? AND LPS.Qty>0
- GROUP BY SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName,LPS.ProposalPrice,LPS.GST,LPS.OtherCharges
- ORDER BY SP.Section,SP.PartNo", [$caseId]);
Added / After Commit
+ public function index(Request $request)
+ {
+ $caseId    = (int)$request->query('CaseID', 0);
+         $cases     = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo");
+ $procRules = DB::select("SELECT ProcRuleID, ProcRule FROM ProcRules ORDER BY ProcRule");
+ 
+ $aonRows   = [];
+ $aonRows = DB::select("SELECT SP.Section, SP.PartNo, SP.Nomenclature, AU.AUName AS AU,
+ SUM(LPS.Qty) AS Qty, LPS.ProposalPrice AS Rate, LPS.GST, LPS.OtherCharges,
+ SUM(LPS.TotalAONAmount) AS Amount, GROUP_CONCAT(J.JobNo SEPARATOR ', ') AS JobNos
+                 FROM cases C INNER JOIN new_lprs L ON C.CaseID=L.CaseNoID
+                 INNER JOIN lprspares LPS ON L.LPRID=LPS.LPRID
+                 INNER JOIN spares SP ON LPS.SpareID=SP.SpareID
+ INNER JOIN au AU ON SP.AUID=AU.AUID
+                 INNER JOIN jobs J ON LPS.JobID=J.JobID
+ WHERE C.CaseID=? AND LPS.Qty>0
+ GROUP BY SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName,LPS.ProposalPrice,LPS.GST,LPS.OtherCharges
+ ORDER BY SP.Section,SP.PartNo", [$caseId]);
Removed / Before Commit
- use App\Models\Staff;
- use App\Models\Department;
- use App\Models\Designation;
- use App\Models\Shift;
- use App\Models\Group;
- use App\Models\LeaveType;
- use App\Models\Leave;
- use App\Services\LeaveValidationService;
- use Maatwebsite\Excel\Facades\Excel;
- use PhpOffice\PhpSpreadsheet\Shared\Date as ExcelDate;
- */
- public function index(Request $request)
- {
-     $query = Attendance::query()
-         ->with([
-             'employee',
-             'leave',
-             'leave.leaveType'
Added / After Commit
+ use App\Models\Staff;
+ use App\Models\Department;
+ use App\Models\Designation;
+ use App\Models\EmployeeCategory;
+ use App\Models\Shift;
+ use App\Models\Group;
+ use App\Models\LeaveType;
+ use App\Models\Leave;
+ use App\Exports\AttendanceReportExport;
+ use App\Services\LeaveValidationService;
+ use Maatwebsite\Excel\Facades\Excel;
+ use PhpOffice\PhpSpreadsheet\Shared\Date as ExcelDate;
+ */
+ public function index(Request $request)
+ {
+     $query = $this->attendanceReportQuery($request);
+ 
+     if ($request->get('export') === 'excel') {
Removed / Before Commit
- public function index(Request $request)
- {
- $caseId   = (int)$request->query('CaseID', 0);
-         $cases    = DB::select("SELECT CaseID, CaseNo FROM Cases ORDER BY CaseNo");
- $bidData  = null;
- $bidSpares = [];
- 
- if ($caseId) {
-             $bidData = DB::selectOne("SELECT AONDate,BidNo,BidDate,BidOpeningDate,BidExtnDate FROM Cases WHERE CaseID=?", [$caseId]);
- if ($bidData) {
- foreach (['AONDate','BidDate','BidOpeningDate','BidExtnDate'] as $col) {
- if (!empty($bidData->$col)) $bidData->$col = LpoHelper::fmtDate($bidData->$col);
- }
- }
-             $bidSpares = DB::select("SELECT SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName AS AU,SUM(LPS.Qty) AS Qty,AVG(LPS.ProposalPrice) AS Rate,GROUP_CONCAT(J.JobNo SEPARATOR ', ') AS JobNos FROM Cases C INNER JOIN LPRs L ON C.CaseID=L.CaseNoID INNER JOIN LPRspares LPS ON L.LPRID=LPS.LPRID INNER JOIN Spares SP ON LPS.SpareID=SP.SpareID INNER JOIN au AU ON SP.AUID=AU.AUID INNER JOIN Jobs J ON LPS.JobID=J.JobID WHERE C.CaseID=? GROUP BY SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName ORDER BY SP.Section,SP.PartNo", [$caseId]);
- }
- 
- return view('bid.entry', compact('caseId','cases','bidData','bidSpares'));
Added / After Commit
+ public function index(Request $request)
+ {
+ $caseId   = (int)$request->query('CaseID', 0);
+         $cases    = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo");
+ $bidData  = null;
+ $bidSpares = [];
+ 
+ if ($caseId) {
+             $bidData = DB::selectOne("SELECT AONDate,BidNo,BidDate,BidOpeningDate,BidExtnDate FROM cases WHERE CaseID=?", [$caseId]);
+ if ($bidData) {
+ foreach (['AONDate','BidDate','BidOpeningDate','BidExtnDate'] as $col) {
+ if (!empty($bidData->$col)) $bidData->$col = LpoHelper::fmtDate($bidData->$col);
+ }
+ }
+             $bidSpares = DB::select("SELECT SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName AS AU,SUM(LPS.Qty) AS Qty,AVG(LPS.ProposalPrice) AS Rate,GROUP_CONCAT(J.JobNo SEPARATOR ', ') AS JobNos FROM cases C INNER JOIN new_lprs L ON C.CaseID=L.CaseNoID INNER JOIN lprspares LPS ON L.LPRID=LPS.LPRID INNER JOIN spares SP ON LPS.SpareID=SP.SpareID INNER JOIN au AU ON SP.AUID=AU.AUID INNER JOIN jobs J ON LPS.JobID=J.JobID WHERE C.CaseID=? GROUP BY SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName ORDER BY SP.Section,SP.PartNo", [$caseId]);
+ }
+ 
+ return view('bid.entry', compact('caseId','cases','bidData','bidSpares'));
Removed / Before Commit
- protected function loadView(Request $request, string $view): \Illuminate\View\View
- {
- $caseId = (int)$request->query('CaseID', 0);
-         $cases  = DB::select("SELECT CaseID, CaseNo FROM Cases ORDER BY CaseNo");
- $csData = [];
- $v1Name = $v2Name = $v3Name = '';
- 
- if ($caseId) {
- $hasSaved = DB::selectOne("SELECT COUNT(*) AS cnt FROM comparativestatements WHERE CaseID=?", [$caseId])->cnt;
- if ($hasSaved) {
-                 $csData = DB::select("SELECT ls.LPRSpareID,c.CaseID,COALESCE(s.Section,'') AS Section,COALESCE(s.PartNo,'') AS PartNo,COALESCE(s.Nomenclature,'') AS Nomenclature,COALESCE(s.AUID,'EA') AS AU,ls.Qty,COALESCE(cs.Vendor1Name,'') AS Vendor1Name,COALESCE(cs.Vendor2Name,'') AS Vendor2Name,COALESCE(cs.Vendor3Name,'') AS Vendor3Name,COALESCE(cs.Vendor1Rate,0) AS V1Rate,COALESCE(cs.Vendor1GST,0) AS V1GST,COALESCE(cs.Vendor2Rate,0) AS V2Rate,COALESCE(cs.Vendor2GST,0) AS V2GST,COALESCE(cs.Vendor3Rate,0) AS V3Rate,COALESCE(cs.Vendor3GST,0) AS V3GST,COALESCE(cs.LPP,0) AS LPP,COALESCE(cs.LPPGST,0) AS LPPGST,COALESCE(cs.L1Vendor,'') AS L1Vendor,COALESCE(cs.L1Rate,0) AS L1Rate FROM LPRspares ls INNER JOIN LPRs l ON ls.LPRID=l.LPRID INNER JOIN Cases c ON l.CaseNoID=c.CaseID INNER JOIN comparativestatements cs ON cs.LPRSpareID=ls.LPRSpareID AND cs.CaseID=c.CaseID LEFT JOIN Spares s ON ls.SpareID=s.SpareID WHERE c.CaseID=? AND ls.Qty>0 ORDER BY COALESCE(s.Section,'ZZZ'),COALESCE(s.PartNo,'ZZZ')", [$caseId]);
- $v1Name = $csData[0]->Vendor1Name ?? '';
- $v2Name = $csData[0]->Vendor2Name ?? '';
- $v3Name = $csData[0]->Vendor3Name ?? '';
- } else {
-                 $csData = DB::select("SELECT ls.LPRSpareID,c.CaseID,COALESCE(s.Section,'') AS Section,COALESCE(s.PartNo,'') AS PartNo,COALESCE(s.Nomenclature,'') AS Nomenclature,COALESCE(s.AUID,'EA') AS AU,ls.Qty FROM LPRspares ls INNER JOIN LPRs l ON ls.LPRID=l.LPRID INNER JOIN Cases c ON l.CaseNoID=c.CaseID LEFT JOIN Spares s ON ls.SpareID=s.SpareID WHERE c.CaseID=? ORDER BY COALESCE(s.Section,'ZZZ'),COALESCE(s.PartNo,'ZZZ')", [$caseId]);
- foreach ($csData as $r) {
- $r->V1Rate = $r->V1GST = $r->V2Rate = $r->V2GST = $r->V3Rate = $r->V3GST = $r->LPP = $r->LPPGST = $r->L1Rate = 0;
Added / After Commit
+ protected function loadView(Request $request, string $view): \Illuminate\View\View
+ {
+ $caseId = (int)$request->query('CaseID', 0);
+         $cases  = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo");
+ $csData = [];
+ $v1Name = $v2Name = $v3Name = '';
+ 
+ if ($caseId) {
+ $hasSaved = DB::selectOne("SELECT COUNT(*) AS cnt FROM comparativestatements WHERE CaseID=?", [$caseId])->cnt;
+ if ($hasSaved) {
+                 $csData = DB::select("SELECT ls.LPRSpareID,c.CaseID,COALESCE(s.Section,'') AS Section,COALESCE(s.PartNo,'') AS PartNo,COALESCE(s.Nomenclature,'') AS Nomenclature,COALESCE(s.AUID,'EA') AS AU,ls.Qty,COALESCE(cs.Vendor1Name,'') AS Vendor1Name,COALESCE(cs.Vendor2Name,'') AS Vendor2Name,COALESCE(cs.Vendor3Name,'') AS Vendor3Name,COALESCE(cs.Vendor1Rate,0) AS V1Rate,COALESCE(cs.Vendor1GST,0) AS V1GST,COALESCE(cs.Vendor2Rate,0) AS V2Rate,COALESCE(cs.Vendor2GST,0) AS V2GST,COALESCE(cs.Vendor3Rate,0) AS V3Rate,COALESCE(cs.Vendor3GST,0) AS V3GST,COALESCE(cs.LPP,0) AS LPP,COALESCE(cs.LPPGST,0) AS LPPGST,COALESCE(cs.L1Vendor,'') AS L1Vendor,COALESCE(cs.L1Rate,0) AS L1Rate FROM lprspares ls INNER JOIN new_lprs l ON ls.LPRID=l.LPRID INNER JOIN cases c ON l.CaseNoID=c.CaseID INNER JOIN comparativestatements cs ON cs.LPRSpareID=ls.LPRSpareID AND cs.CaseID=c.CaseID LEFT JOIN spares s ON ls.SpareID=s.SpareID WHERE c.CaseID=? AND ls.Qty>0 ORDER BY COALESCE(s.Section,'ZZZ'),COALESCE(s.PartNo,'ZZZ')", [$caseId]);
+ $v1Name = $csData[0]->Vendor1Name ?? '';
+ $v2Name = $csData[0]->Vendor2Name ?? '';
+ $v3Name = $csData[0]->Vendor3Name ?? '';
+ } else {
+                 $csData = DB::select("SELECT ls.LPRSpareID,c.CaseID,COALESCE(s.Section,'') AS Section,COALESCE(s.PartNo,'') AS PartNo,COALESCE(s.Nomenclature,'') AS Nomenclature,COALESCE(s.AUID,'EA') AS AU,ls.Qty FROM lprspares ls INNER JOIN new_lprs l ON ls.LPRID=l.LPRID INNER JOIN cases c ON l.CaseNoID=c.CaseID LEFT JOIN spares s ON ls.SpareID=s.SpareID WHERE c.CaseID=? ORDER BY COALESCE(s.Section,'ZZZ'),COALESCE(s.PartNo,'ZZZ')", [$caseId]);
+ foreach ($csData as $r) {
+ $r->V1Rate = $r->V1GST = $r->V2Rate = $r->V2GST = $r->V3Rate = $r->V3GST = $r->LPP = $r->LPPGST = $r->L1Rate = 0;
Removed / Before Commit
- {
- public function index()
- {
-         $cases   = DB::select("SELECT CaseID, CaseNo FROM Cases ORDER BY CaseNo DESC");
-         $vendors = DB::select("SELECT VendorID, VendorName FROM Vendors WHERE IsActive=1 ORDER BY VendorName");
- return view('boo.form.financial-opening', compact('cases', 'vendors'));
- }
- 
- public function loadCase(int $caseId)
- {
-         $case = DB::selectOne("SELECT * FROM Cases WHERE CaseID=?", [$caseId]);
- if (!$case) return response()->json(['success' => false, 'error' => 'Case not found'], 404);
- 
- // Format dates for date inputs (Y-m-d)
- COALESCE(ls.TotalAONAmount,0) AS TotalAONAmount,
- COALESCE(ls.BidAmount,0)     AS BidAmount,
- ls.L1VendorID
-              FROM Cases c
Added / After Commit
+ {
+ public function index()
+ {
+         $cases   = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo DESC");
+         $vendors = DB::select("SELECT VendorID, VendorName FROM vendors WHERE IsActive=1 ORDER BY VendorName");
+ return view('boo.form.financial-opening', compact('cases', 'vendors'));
+ }
+ 
+ public function loadCase(int $caseId)
+ {
+         $case = DB::selectOne("SELECT * FROM cases WHERE CaseID=?", [$caseId]);
+ if (!$case) return response()->json(['success' => false, 'error' => 'Case not found'], 404);
+ 
+ // Format dates for date inputs (Y-m-d)
+ COALESCE(ls.TotalAONAmount,0) AS TotalAONAmount,
+ COALESCE(ls.BidAmount,0)     AS BidAmount,
+ ls.L1VendorID
+              FROM cases c
Removed / Before Commit
- {
- public function index()
- {
-         $cases = DB::select("SELECT CaseID, CaseNo FROM Cases ORDER BY CaseNo DESC");
- return view('boo.form.price-negotiation', compact('cases'));
- }
- 
- public function loadCase(int $caseId)
- {
-         $case = DB::selectOne("SELECT BidNo,BidDate,BidOpeningDate,PNCDate,PNCMode,FirmRep,OutCome,PNCPart1OrderNo,PNCPart1OrderDate,PNCRecommendations FROM Cases WHERE CaseID=?", [$caseId]);
- if (!$case) return response()->json(['success' => false, 'error' => 'Case not found'], 404);
- 
- foreach (['BidDate','BidOpeningDate','PNCDate','PNCPart1OrderDate'] as $col) {
- if (!empty($case->$col)) $case->$col = LpoHelper::fmtDate($case->$col);
- }
- 
-         $grid = DB::select("SELECT ls.LPRSpareID, COALESCE(s.Section,'') AS Section, COALESCE(s.PartNo,'') AS PartNo, COALESCE(s.Nomenclature,'') AS Nomenclature, COALESCE(a.AUName,'') AS AUID, COALESCE(ls.Qty,0) AS Qty, COALESCE(ls.TotalAONAmount,0) AS TotalAONAmount, COALESCE(ls.BidAmount,0) AS BidAmount, COALESCE(ls.DiscountPrice,0) AS DiscountPrice, CASE WHEN COALESCE(ls.DiscountPrice,0)=0 THEN COALESCE(ls.BidAmount,0) ELSE COALESCE(ls.BidAmount,0)-COALESCE(ls.DiscountPrice,0) END AS PriceAfterPNC FROM Cases c INNER JOIN LPRs l ON c.CaseID=l.CaseNoID INNER JOIN LPRspares ls ON l.LPRID=ls.LPRID INNER JOIN Spares s ON ls.SpareID=s.SpareID LEFT JOIN au a ON s.AUID=a.AUID WHERE c.CaseID=? AND ls.Qty>0 ORDER BY s.Section,s.PartNo", [$caseId]);
- 
Added / After Commit
+ {
+ public function index()
+ {
+         $cases = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo DESC");
+ return view('boo.form.price-negotiation', compact('cases'));
+ }
+ 
+ public function loadCase(int $caseId)
+ {
+         $case = DB::selectOne("SELECT BidNo,BidDate,BidOpeningDate,PNCDate,PNCMode,FirmRep,OutCome,PNCPart1OrderNo,PNCPart1OrderDate,PNCRecommendations FROM cases WHERE CaseID=?", [$caseId]);
+ if (!$case) return response()->json(['success' => false, 'error' => 'Case not found'], 404);
+ 
+ foreach (['BidDate','BidOpeningDate','PNCDate','PNCPart1OrderDate'] as $col) {
+ if (!empty($case->$col)) $case->$col = LpoHelper::fmtDate($case->$col);
+ }
+ 
+         $grid = DB::select("SELECT ls.LPRSpareID, COALESCE(s.Section,'') AS Section, COALESCE(s.PartNo,'') AS PartNo, COALESCE(s.Nomenclature,'') AS Nomenclature, COALESCE(a.AUName,'') AS AUID, COALESCE(ls.Qty,0) AS Qty, COALESCE(ls.TotalAONAmount,0) AS TotalAONAmount, COALESCE(ls.BidAmount,0) AS BidAmount, COALESCE(ls.DiscountPrice,0) AS DiscountPrice, CASE WHEN COALESCE(ls.DiscountPrice,0)=0 THEN COALESCE(ls.BidAmount,0) ELSE COALESCE(ls.BidAmount,0)-COALESCE(ls.DiscountPrice,0) END AS PriceAfterPNC FROM cases c INNER JOIN new_lprs l ON c.CaseID=l.CaseNoID INNER JOIN lprspares ls ON l.LPRID=ls.LPRID INNER JOIN spares s ON ls.SpareID=s.SpareID LEFT JOIN au a ON s.AUID=a.AUID WHERE c.CaseID=? AND ls.Qty>0 ORDER BY s.Section,s.PartNo", [$caseId]);
+ 
Removed / Before Commit
- {
- public function index()
- {
-         $cases   = DB::select("SELECT CaseID, CaseNo FROM Cases ORDER BY CaseNo DESC");
-         $vendors = DB::select("SELECT VendorID, VendorName FROM Vendors ORDER BY VendorName");
- return view('boo.form.vendors-participation', compact('cases', 'vendors'));
- }
- 
- "SELECT CaseID, CaseNo, BidNo, BidDate, BidOpeningDate, BidOpenedOn,
- TECPart1OrderNo, TECPart1OrderDate,
- NoofBids, AcceptedBids, RejectedBids, TECApprovalDate
-              FROM Cases WHERE CaseID=?",
- [$caseId]
- );
- if (!$case) return response()->json(['success' => false, 'error' => 'Case not found'], 404);
- "SELECT vp.ID, vp.VendorID, v.VendorName, vp.FieldOnGrid,
- vp.AcceptedQRs, vp.BidAccepted, vp.Status, vp.Remarks
- FROM vendorsparticipation vp
Added / After Commit
+ {
+ public function index()
+ {
+         $cases   = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo DESC");
+         $vendors = DB::select("SELECT VendorID, VendorName FROM vendors ORDER BY VendorName");
+ return view('boo.form.vendors-participation', compact('cases', 'vendors'));
+ }
+ 
+ "SELECT CaseID, CaseNo, BidNo, BidDate, BidOpeningDate, BidOpenedOn,
+ TECPart1OrderNo, TECPart1OrderDate,
+ NoofBids, AcceptedBids, RejectedBids, TECApprovalDate
+              FROM cases WHERE CaseID=?",
+ [$caseId]
+ );
+ if (!$case) return response()->json(['success' => false, 'error' => 'Case not found'], 404);
+ "SELECT vp.ID, vp.VendorID, v.VendorName, vp.FieldOnGrid,
+ vp.AcceptedQRs, vp.BidAccepted, vp.Status, vp.Remarks
+ FROM vendorsparticipation vp
Removed / Before Commit
- 
- $month = (int) $validated['month'];
- $year = (int) $validated['year'];
-         $force = true;
- 
- $batch = FinanceSalaryBatch::create([
- 'month' => $month,
- $items = [];
- 
- foreach ($staffs as $staff) {
-                     $snapshot = $salaryService->generateForStaff($staff, $month, $year, $force, true);
- $items[] = [
- 'batch_id' => $batch->id,
- 'salary_snapshot_id' => $snapshot->id,
- 'misc_nps' => $salary['allowances']['MISC NPS/UPS (GOVT)'] ?? 0,
- 'misc_pay' => $salary['allowances']['MISC PAY'] ?? 0,
- 'gross' => $salary['totals']['gross_total'] ?? 0,
- 
Added / After Commit
+ 
+ $month = (int) $validated['month'];
+ $year = (int) $validated['year'];
+         $force = false;
+ 
+ $batch = FinanceSalaryBatch::create([
+ 'month' => $month,
+ $items = [];
+ 
+ foreach ($staffs as $staff) {
+                     $snapshot = $salaryService->generateForStaff($staff, $month, $year, $force);
+ $items[] = [
+ 'batch_id' => $batch->id,
+ 'salary_snapshot_id' => $snapshot->id,
+ 'misc_nps' => $salary['allowances']['MISC NPS/UPS (GOVT)'] ?? 0,
+ 'misc_pay' => $salary['allowances']['MISC PAY'] ?? 0,
+ 'gross' => $salary['totals']['gross_total'] ?? 0,
+             'da_arr' => $salary['allowances']['DA ARR'] ?? 0,
Removed / Before Commit
- use Carbon\Carbon;
- use App\Models\User;
- use App\Models\Group;
- use App\Models\ProductionYear;
- use App\Exports\ComplaintReportExport;
- use Maatwebsite\Excel\Facades\Excel;
- // Check if user is admin (role = null or empty) or regular user (role != null)
- if ($currentUser->role != null && $currentUser->role != '') {
- // Regular user - filter by their group_id
-             $complaintsQuery->where('group_id', $currentUser->group_id);
- }
- // If role is null or empty (admin), show all complaints - no additional filtering needed
- 
- 
- public function show(Complaint $complaint)
- {
-         $complaint->load(['resolver', 'assignedBy', 'assignedTo', 'natureOfComplaint', 'feedbackHistory' => function($query) {
- $query->orderBy('feedback_date', 'desc');
Added / After Commit
+ use Carbon\Carbon;
+ use App\Models\User;
+ use App\Models\Group;
+ use App\Models\SubGroup;
+ use App\Models\ProductionYear;
+ use App\Exports\ComplaintReportExport;
+ use Maatwebsite\Excel\Facades\Excel;
+ // Check if user is admin (role = null or empty) or regular user (role != null)
+ if ($currentUser->role != null && $currentUser->role != '') {
+ // Regular user - filter by their group_id
+             $complaintsQuery->where(function ($query) use ($currentUser) {
+                 $query->where('group_id', $currentUser->group_id)
+                     ->orWhere('user_id', $currentUser->id);
+             });
+ }
+ // If role is null or empty (admin), show all complaints - no additional filtering needed
+ 
+ 
Removed / Before Commit
- {
- public function index()
- {
-         $cases   = DB::select("SELECT CaseID, CaseNo FROM Cases ORDER BY CaseNo DESC");
-         $vendors = DB::select("SELECT VendorID, VendorName FROM Vendors WHERE IsActive=1 ORDER BY VendorName");
- return view('eas.form', compact('cases', 'vendors'));
- }
- 
- public function loadCase(int $caseId)
- {
-         $case = DB::selectOne("SELECT c.BidNo,c.BidDate,c.BidOpeningDate, COALESCE(c.RANo,'') AS RANo, c.RADt, COALESCE(c.UONo,'') AS UONo, c.UODate, COALESCE(c.NoteNo,'') AS NoteNo, COALESCE(c.SpecialRemarks,'') AS SpecialRemarks, COALESCE(d.Designation,'') AS CFA, COALESCE(c.FinPower,'') AS FinPower FROM Cases c LEFT JOIN designation d ON c.DesignationID=d.DesignationID WHERE c.CaseID=?", [$caseId]);
- if (!$case) return response()->json(['success' => false, 'error' => 'Case not found'], 404);
- 
- foreach (['BidDate','BidOpeningDate','RADt','UODate'] as $col) {
- if (!empty($case->$col)) $case->$col = LpoHelper::fmtDate($case->$col);
- }
- 
-         $grid = DB::select("SELECT ls.LPRSpareID, COALESCE(s.Section,'') AS Section, COALESCE(s.PartNo,'') AS PartNo, COALESCE(s.Nomenclature,'') AS Nomenclature, COALESCE(a.AUName,'') AS AUID, COALESCE(ls.Qty,0) AS Qty, COALESCE(ls.TotalAONAmount,0) AS TotalAONAmount, ls.FinalGST, COALESCE(ls.OrderPrice,0) AS OrderPrice, COALESCE(ls.TotalOrderAmount,0) AS TotalOrderAmount, COALESCE(ls.L1VendorID,0) AS L1VendorID FROM Cases c INNER JOIN LPRs l ON c.CaseID=l.CaseNoID INNER JOIN LPRspares ls ON l.LPRID=ls.LPRID INNER JOIN Spares s ON ls.SpareID=s.SpareID LEFT JOIN au a ON s.AUID=a.AUID WHERE c.CaseID=? AND ls.Qty>0 ORDER BY s.Section,s.PartNo", [$caseId]);
Added / After Commit
+ {
+ public function index()
+ {
+         $cases   = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo DESC");
+         $vendors = DB::select("SELECT VendorID, VendorName FROM vendors WHERE IsActive=1 ORDER BY VendorName");
+ return view('eas.form', compact('cases', 'vendors'));
+ }
+ 
+ public function loadCase(int $caseId)
+ {
+         $case = DB::selectOne("SELECT c.BidNo,c.BidDate,c.BidOpeningDate, COALESCE(c.RANo,'') AS RANo, c.RADt, COALESCE(c.UONo,'') AS UONo, c.UODate, COALESCE(c.NoteNo,'') AS NoteNo, COALESCE(c.SpecialRemarks,'') AS SpecialRemarks, COALESCE(d.Designation,'') AS CFA, COALESCE(c.FinPower,'') AS FinPower FROM cases c LEFT JOIN designation d ON c.DesignationID=d.DesignationID WHERE c.CaseID=?", [$caseId]);
+ if (!$case) return response()->json(['success' => false, 'error' => 'Case not found'], 404);
+ 
+ foreach (['BidDate','BidOpeningDate','RADt','UODate'] as $col) {
+ if (!empty($case->$col)) $case->$col = LpoHelper::fmtDate($case->$col);
+ }
+ 
+         $grid = DB::select("SELECT ls.LPRSpareID, COALESCE(s.Section,'') AS Section, COALESCE(s.PartNo,'') AS PartNo, COALESCE(s.Nomenclature,'') AS Nomenclature, COALESCE(a.AUName,'') AS AUID, COALESCE(ls.Qty,0) AS Qty, COALESCE(ls.TotalAONAmount,0) AS TotalAONAmount, ls.FinalGST, COALESCE(ls.OrderPrice,0) AS OrderPrice, COALESCE(ls.TotalOrderAmount,0) AS TotalOrderAmount, COALESCE(ls.L1VendorID,0) AS L1VendorID FROM cases c INNER JOIN new_lprs l ON c.CaseID=l.CaseNoID INNER JOIN lprspares ls ON l.LPRID=ls.LPRID INNER JOIN spares s ON ls.SpareID=s.SpareID LEFT JOIN au a ON s.AUID=a.AUID WHERE c.CaseID=? AND ls.Qty>0 ORDER BY s.Section,s.PartNo", [$caseId]);
Removed / Before Commit
- 'misc_nps' => 'MISC NPS',
- 'misc_pay' => 'MISC PAY',
- 'gross' => 'GROSS',
-             'cgeis' => 'CGEIS',
- 'house_rent' => 'HOUSE RENT',
- 'gpf_cpf_nps_amt' => 'GPF/CPF/NPS AMT',
- 'nps_govt_cont' => 'NPS GOVT CONT',
Added / After Commit
+ 'misc_nps' => 'MISC NPS',
+ 'misc_pay' => 'MISC PAY',
+ 'gross' => 'GROSS',
+             'cgeis' => 'CGEGIS',
+ 'house_rent' => 'HOUSE RENT',
+ 'gpf_cpf_nps_amt' => 'GPF/CPF/NPS AMT',
+ 'nps_govt_cont' => 'NPS GOVT CONT',
Removed / Before Commit
- 'sec80g' => 'SEC 80G',
- 'gpf_nps' => 'GPF/NPS',
- 'misc_amt' => 'MISC AMT',
-             'cgeis' => 'CGEIS',
- 'cghs' => 'CGHS',
- 'sss' => 'SSS',
- 'lic_pli_ulip' => 'LIC/PLI',
Added / After Commit
+ 'sec80g' => 'SEC 80G',
+ 'gpf_nps' => 'GPF/NPS',
+ 'misc_amt' => 'MISC AMT',
+             'cgeis' => 'CGEGIS',
+ 'cghs' => 'CGHS',
+ 'sss' => 'SSS',
+ 'lic_pli_ulip' => 'LIC/PLI',
Removed / Before Commit
- namespace App\Http\Controllers;
- 
- use App\Models\EmployeeCategory;
- use App\Models\FinancePaymentRecovery;
- use App\Models\FinanceStaffDetail;
- use App\Models\Staff;
- use Illuminate\Http\Request;
- 
- public function paymentRecovery(Staff $staff)
- {
- $staff->load(['employeeCategory', 'user.group', 'financePaymentRecovery']);
- 
- return view('finance-staff-details.payment-recovery', [
- 'staff' => $staff,
- 'paymentRecovery' => $staff->financePaymentRecovery,
- 'readonlyData' => $this->readonlyData($staff),
- 'fieldGroups' => $this->paymentRecoveryFieldGroups(),
- ]);
Added / After Commit
+ namespace App\Http\Controllers;
+ 
+ use App\Models\EmployeeCategory;
+ use App\Models\DaRate;
+ use App\Models\FinancePaymentRecovery;
+ use App\Models\FinanceStaffDetail;
+ use App\Models\FinanceSupplementaryPayment;
+ use App\Models\Staff;
+ use Illuminate\Http\Request;
+ 
+ public function paymentRecovery(Staff $staff)
+ {
+ $staff->load(['employeeCategory', 'user.group', 'financePaymentRecovery']);
+         $supplementaryPayment = FinanceSupplementaryPayment::where('staff_id', $staff->id)
+             ->where('month', now()->month)
+             ->where('year', now()->year)
+             ->first();
+ 
Removed / Before Commit
- 'gross' => 'GROSS',
- 'gpf_amt' => 'GPF AMT',
- 'misc_amt' => 'MISC AMT',
-             'cgeis' => 'CGEIS',
- 'sss' => 'SSS',
- 'tds' => 'TDS',
- 'cghs' => 'CGHS',
Added / After Commit
+ 'gross' => 'GROSS',
+ 'gpf_amt' => 'GPF AMT',
+ 'misc_amt' => 'MISC AMT',
+             'cgeis' => 'CGEGIS',
+ 'sss' => 'SSS',
+ 'tds' => 'TDS',
+ 'cghs' => 'CGHS',
Removed / Before Commit
- $staff = collect();
- $groupedLeaves = collect();
- $leaveIds = collect();
- 
- if ($request->filled('staff_part_2_no') || $request->filled('existing_do_2_part_no')) {
- $validated = $request->validate([
- $leaveIds = $groupedLeaves->flatten(1)->pluck('id');
- }
- } else {
- $groupedLeaves = Leave::with(['employee', 'leaveType'])
- ->where('do_2_part_no', $validated['existing_do_2_part_no'])
- ->whereBetween('from_date', [$validated['start_date'], $validated['end_date']])
- }
- }
- 
-         return view('leave.part-2-no', compact('filters', 'searchType', 'yearStart', 'yearEnd', 'staff', 'groupedLeaves', 'leaveIds'));
- }
- 
Added / After Commit
+ $staff = collect();
+ $groupedLeaves = collect();
+ $leaveIds = collect();
+         $doPartAppliedDate = null;
+ 
+ if ($request->filled('staff_part_2_no') || $request->filled('existing_do_2_part_no')) {
+ $validated = $request->validate([
+ $leaveIds = $groupedLeaves->flatten(1)->pluck('id');
+ }
+ } else {
+                 $history = DB::table('leave_part_2_no_history')
+                     ->where('do_2_part_no', $validated['existing_do_2_part_no'])
+                     ->orderByDesc('created_at')
+                     ->first();
+                 $doPartAppliedDate = $history?->created_at;
+ 
+ $groupedLeaves = Leave::with(['employee', 'leaveType'])
+ ->where('do_2_part_no', $validated['existing_do_2_part_no'])
Removed / Before Commit
- $currentFY = $fy['fy'];
- 
- // ── Dropdown lists for FY selectors ──────────────────────────────
-         $lprFYs   = DB::select("SELECT DISTINCT YEAR(LPRDate) AS FYYear FROM LPRs WHERE LPRDate IS NOT NULL ORDER BY FYYear DESC");
- $orderFYs = DB::select("SELECT DISTINCT YEAR(OrderDate) AS FYYear FROM SupplyOrders WHERE OrderDate IS NOT NULL ORDER BY FYYear DESC");
- $fundFYs  = DB::select("SELECT DISTINCT FYYear FROM (
- SELECT YEAR(AuthorityDate) AS FYYear FROM FundTransactions WHERE AuthorityDate IS NOT NULL
- ) FY ORDER BY FYYear DESC");
- 
- // ── KPI Cards ─────────────────────────────────────────────────────
-         $totalLPRs      = DB::selectOne("SELECT COUNT(*) AS cnt FROM LPRs WHERE LPRDate >= ? AND LPRDate <= ?", [$fyStart, $fyEnd])->cnt;
-         $sparesDemanded = DB::selectOne("SELECT COUNT(DISTINCT CONCAT(ls.LPRID,'|',ls.SpareID)) AS cnt FROM LPRSpares ls JOIN LPRs l ON ls.LPRID=l.LPRID WHERE l.LPRDate >= ? AND l.LPRDate <= ? AND ls.LPRID IS NOT NULL AND ls.SpareID IS NOT NULL", [$fyStart, $fyEnd])->cnt;
-         $sparesIssued   = DB::selectOne("SELECT COUNT(DISTINCT CONCAT(ls.LPRID,'|',ls.SpareID)) AS cnt FROM LPRSpares ls JOIN LPRs l ON ls.LPRID=l.LPRID WHERE l.LPRDate >= ? AND l.LPRDate <= ? AND ls.CRVDate IS NOT NULL", [$fyStart, $fyEnd])->cnt;
- $orderPlaced    = DB::selectOne("SELECT COUNT(*) AS cnt FROM SupplyOrders WHERE OrderDate >= ? AND OrderDate <= ?", [$fyStart, $fyEnd])->cnt;
-         $sparesSupplied = DB::selectOne("SELECT COUNT(DISTINCT CONCAT(ls.LPRID,'|',ls.SpareID)) AS cnt FROM LPRSpares ls JOIN LPRs l ON ls.LPRID=l.LPRID WHERE l.LPRDate >= ? AND l.LPRDate <= ? AND ls.ChallanDate IS NOT NULL", [$fyStart, $fyEnd])->cnt;
-         $onTimeCount    = DB::selectOne("SELECT COUNT(DISTINCT CONCAT(ls.LPRID,'|',ls.SpareID)) AS cnt FROM LPRSpares ls JOIN LPRs l ON ls.LPRID=l.LPRID WHERE l.LPRDate >= ? AND l.LPRDate <= ? AND ls.ChallanDate IS NOT NULL AND ls.ChallanDate <= ls.DeliveryPeriod", [$fyStart, $fyEnd])->cnt;
- $onTimePct      = $sparesSupplied > 0 ? round($onTimeCount * 100 / $sparesSupplied) : 0;
- 
Added / After Commit
+ $currentFY = $fy['fy'];
+ 
+ // ── Dropdown lists for FY selectors ──────────────────────────────
+         $lprFYs   = DB::select("SELECT DISTINCT YEAR(LPRDate) AS FYYear FROM new_lprs WHERE LPRDate IS NOT NULL ORDER BY FYYear DESC");
+ $orderFYs = DB::select("SELECT DISTINCT YEAR(OrderDate) AS FYYear FROM SupplyOrders WHERE OrderDate IS NOT NULL ORDER BY FYYear DESC");
+ $fundFYs  = DB::select("SELECT DISTINCT FYYear FROM (
+ SELECT YEAR(AuthorityDate) AS FYYear FROM FundTransactions WHERE AuthorityDate IS NOT NULL
+ ) FY ORDER BY FYYear DESC");
+ 
+ // ── KPI Cards ─────────────────────────────────────────────────────
+         $totalLPRs      = DB::selectOne("SELECT COUNT(*) AS cnt FROM new_lprs WHERE LPRDate >= ? AND LPRDate <= ?", [$fyStart, $fyEnd])->cnt;
+         $sparesDemanded = DB::selectOne("SELECT COUNT(DISTINCT CONCAT(ls.LPRID,'|',ls.SpareID)) AS cnt FROM lprspares ls JOIN new_lprs l ON ls.LPRID=l.LPRID WHERE l.LPRDate >= ? AND l.LPRDate <= ? AND ls.LPRID IS NOT NULL AND ls.SpareID IS NOT NULL", [$fyStart, $fyEnd])->cnt;
+         $sparesIssued   = DB::selectOne("SELECT COUNT(DISTINCT CONCAT(ls.LPRID,'|',ls.SpareID)) AS cnt FROM lprspares ls JOIN new_lprs l ON ls.LPRID=l.LPRID WHERE l.LPRDate >= ? AND l.LPRDate <= ? AND ls.CRVDate IS NOT NULL", [$fyStart, $fyEnd])->cnt;
+ $orderPlaced    = DB::selectOne("SELECT COUNT(*) AS cnt FROM SupplyOrders WHERE OrderDate >= ? AND OrderDate <= ?", [$fyStart, $fyEnd])->cnt;
+         $sparesSupplied = DB::selectOne("SELECT COUNT(DISTINCT CONCAT(ls.LPRID,'|',ls.SpareID)) AS cnt FROM lprspares ls JOIN new_lprs l ON ls.LPRID=l.LPRID WHERE l.LPRDate >= ? AND l.LPRDate <= ? AND ls.ChallanDate IS NOT NULL", [$fyStart, $fyEnd])->cnt;
+         $onTimeCount    = DB::selectOne("SELECT COUNT(DISTINCT CONCAT(ls.LPRID,'|',ls.SpareID)) AS cnt FROM lprspares ls JOIN new_lprs l ON ls.LPRID=l.LPRID WHERE l.LPRDate >= ? AND l.LPRDate <= ? AND ls.ChallanDate IS NOT NULL AND ls.ChallanDate <= ls.DeliveryPeriod", [$fyStart, $fyEnd])->cnt;
+ $onTimePct      = $sparesSupplied > 0 ? round($onTimeCount * 100 / $sparesSupplied) : 0;
+ 
Removed / Before Commit
- public function index()
- {
- $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
-         $spares     = DB::select("SELECT SpareID, Nomenclature FROM Spares ORDER BY Nomenclature");
-         $jobs       = DB::select("SELECT JobID, JobNo FROM Jobs ORDER BY JobNo");
- return view('lpr.edit', compact('userGroups', 'spares', 'jobs'));
- }
- 
- $jtId       = (int)$request->query('JobTypeID', 0);
- 
- $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
-     $jobTypes   = DB::select("SELECT JobTypeID, JobType FROM JobTypes ORDER BY JobType");
- 
- $where  = ['1=1'];
- $params = [];
- SUM(IFNULL(LS.Qty,0)) AS TotalQty,
- SUM(IFNULL(LS.TotalOrderAmount,0)) AS TotalValue,
- L.CaseNoID
Added / After Commit
+ public function index()
+ {
+ $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
+         $spares     = DB::select("SELECT SpareID, Nomenclature FROM spares ORDER BY Nomenclature");
+         $jobs       = DB::select("SELECT JobID, JobNo FROM jobs ORDER BY JobNo");
+ return view('lpr.edit', compact('userGroups', 'spares', 'jobs'));
+ }
+ 
+ $jtId       = (int)$request->query('JobTypeID', 0);
+ 
+ $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
+     $jobTypes   = DB::select("SELECT JobTypeID, JobType FROM jobtypes ORDER BY JobType");
+ 
+ $where  = ['1=1'];
+ $params = [];
+ SUM(IFNULL(LS.Qty,0)) AS TotalQty,
+ SUM(IFNULL(LS.TotalOrderAmount,0)) AS TotalValue,
+ L.CaseNoID
Removed / Before Commit
- public function create()
- {
- $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
-         $grants     = DB::select("SELECT GrantID, GrantName FROM Grants ORDER BY GrantName");
- $aus        = DB::select("SELECT AUID, AUName FROM au ORDER BY AUName");
- $units      = DB::select("SELECT id as UnitID, name as UnitName FROM units ORDER BY UnitName");
- $eqpts      = DB::select("SELECT EqptID, EqptName FROM eqpts ORDER BY EqptName");
-         $jobTypes   = DB::select("SELECT JobTypeID, JobType FROM JobTypes ORDER BY JobType");
-         $spares     = DB::select("SELECT SpareID, Nomenclature, PartNo, MaterialNo, Section FROM Spares ORDER BY Nomenclature");
-         $jobs       = DB::select("SELECT JobID, JobNo, JobDate FROM Jobs ORDER BY JobDate DESC");
- 
- return view('lpr.entry', compact('userGroups','grants','aus','units','eqpts','jobTypes','spares','jobs'));
- }
- 
- try {
- $lprId = DB::transaction(function () use ($request) {
-                 DB::statement("INSERT INTO LPRs (UserGroupID,UrgencyNo,UrgencyDate,LPRNo,LPRDate,GrantID,NACNo,NACDate,NACValidity) VALUES (?,?,?,?,?,?,?,?,?)", [
- $request->UserGroupID,
Added / After Commit
+ public function create()
+ {
+ $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
+         $grants     = DB::select("SELECT GrantID, GrantName FROM new_grants ORDER BY GrantName");
+ $aus        = DB::select("SELECT AUID, AUName FROM au ORDER BY AUName");
+ $units      = DB::select("SELECT id as UnitID, name as UnitName FROM units ORDER BY UnitName");
+ $eqpts      = DB::select("SELECT EqptID, EqptName FROM eqpts ORDER BY EqptName");
+         $jobTypes   = DB::select("SELECT JobTypeID, JobType FROM jobtypes ORDER BY JobType");
+         $spares     = DB::select("SELECT SpareID, Nomenclature, PartNo, MaterialNo, Section FROM spares ORDER BY Nomenclature");
+         $jobs       = DB::select("SELECT JobID, JobNo, JobDate FROM jobs ORDER BY JobDate DESC");
+ 
+ return view('lpr.entry', compact('userGroups','grants','aus','units','eqpts','jobTypes','spares','jobs'));
+ }
+ 
+ try {
+ $lprId = DB::transaction(function () use ($request) {
+                 DB::statement("INSERT INTO new_lprs (UserGroupID,UrgencyNo,UrgencyDate,LPRNo,LPRDate,GrantID,NACNo,NACDate,NACValidity) VALUES (?,?,?,?,?,?,?,?,?)", [
+ $request->UserGroupID,
Removed / Before Commit
- public function index()
- {
- $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
-         $jobTypes   = DB::select("SELECT JobTypeID, JobType FROM JobTypes ORDER BY JobType");
- return view('lpr.pending', compact('userGroups', 'jobTypes'));
- }
- 
- {
- $sql = "SELECT L.LPRID, L.LPRNo, DATE_FORMAT(L.LPRDate, '%Y-%m-%d') AS LPRDate,
- UG.UserGroupName,
-                     (SELECT COUNT(*) FROM LPRspares LS WHERE LS.LPRID = L.LPRID) AS TotalSpares,
-                     COALESCE((SELECT JT.JobType FROM LPRspares LS2
-                         INNER JOIN Jobs J2 ON LS2.JobID=J2.JobID
-                         INNER JOIN JobTypes JT ON J2.JobTypeID=JT.JobTypeID
- WHERE LS2.LPRID=L.LPRID LIMIT 1), 'N/A') AS JobType
-                 FROM LPRs L
- INNER JOIN UserGroups UG ON L.UserGroupID=UG.UserGroupID
- WHERE L.CaseNoID IS NULL";
Added / After Commit
+ public function index()
+ {
+ $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
+         $jobTypes   = DB::select("SELECT JobTypeID, JobType FROM jobtypes ORDER BY JobType");
+ return view('lpr.pending', compact('userGroups', 'jobTypes'));
+ }
+ 
+ {
+ $sql = "SELECT L.LPRID, L.LPRNo, DATE_FORMAT(L.LPRDate, '%Y-%m-%d') AS LPRDate,
+ UG.UserGroupName,
+                     (SELECT COUNT(*) FROM lprspares LS WHERE LS.LPRID = L.LPRID) AS TotalSpares,
+                     COALESCE((SELECT JT.JobType FROM lprspares LS2
+                         INNER JOIN jobs J2 ON LS2.JobID=J2.JobID
+                         INNER JOIN jobtypes JT ON J2.JobTypeID=JT.JobTypeID
+ WHERE LS2.LPRID=L.LPRID LIMIT 1), 'N/A') AS JobType
+                 FROM new_lprs L
+ INNER JOIN UserGroups UG ON L.UserGroupID=UG.UserGroupID
+ WHERE L.CaseNoID IS NULL";
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use App\Models\Group;
+ use App\Models\NewEquipment;
+ use App\Models\NewSubAssyEquipment;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\Auth;
+ use Illuminate\Support\Facades\DB;
+ use PhpOffice\PhpSpreadsheet\IOFactory;
+ 
+ class NewEquipmentUploadController extends Controller
+ {
+     public function index()
+     {
+         $equipments = NewEquipment::withCount('subAssyEquipments')
+             ->with('group')
Removed / Before Commit
- public function index(Request $request)
- {
- $orderNo      = trim($request->query('OrderNo', ''));
-         $orderNos     = DB::select("SELECT DISTINCT OrderNo FROM LPRspares WHERE OrderNo IS NOT NULL AND TRIM(OrderNo)!='' ORDER BY OrderNo");
- $orderDetails = null;
- $challanRows  = [];
- 
- COALESCE(MAX(c.CaseNo),'') AS CaseNo,
- COALESCE(MAX(g.GrantName),'') AS GrantName,
- COALESCE(MAX(pr.ProcRule),'') AS ProcType
-                 FROM LPRspares lp
-                 INNER JOIN LPRs l ON lp.LPRID=l.LPRID
-                 LEFT JOIN Cases c ON l.CaseNoID=c.CaseID
-                 LEFT JOIN Vendors v ON lp.L1VendorID=v.VendorID
-                 LEFT JOIN Grants g ON l.GrantID=g.GrantID
- LEFT JOIN ProcRules pr ON c.ProcRuleID=pr.ProcRuleID
- WHERE lp.OrderNo=?
- GROUP BY lp.OrderNo
Added / After Commit
+ public function index(Request $request)
+ {
+ $orderNo      = trim($request->query('OrderNo', ''));
+         $orderNos     = DB::select("SELECT DISTINCT OrderNo FROM lprspares WHERE OrderNo IS NOT NULL AND TRIM(OrderNo)!='' ORDER BY OrderNo");
+ $orderDetails = null;
+ $challanRows  = [];
+ 
+ COALESCE(MAX(c.CaseNo),'') AS CaseNo,
+ COALESCE(MAX(g.GrantName),'') AS GrantName,
+ COALESCE(MAX(pr.ProcRule),'') AS ProcType
+                 FROM lprspares lp
+                 INNER JOIN new_lprs l ON lp.LPRID=l.LPRID
+                 LEFT JOIN cases c ON l.CaseNoID=c.CaseID
+                 LEFT JOIN vendors v ON lp.L1VendorID=v.VendorID
+                 LEFT JOIN new_grants g ON l.GrantID=g.GrantID
+ LEFT JOIN ProcRules pr ON c.ProcRuleID=pr.ProcRuleID
+ WHERE lp.OrderNo=?
+ GROUP BY lp.OrderNo
Removed / Before Commit
- public function index(Request $request)
- {
- $orderNo      = trim($request->query('OrderNo', ''));
-         $orderNos     = DB::select("SELECT DISTINCT OrderNo FROM LPRspares WHERE OrderNo IS NOT NULL AND TRIM(OrderNo)!='' ORDER BY OrderNo");
- $orderDetails = null;
- $gridRows     = [];
- 
- DATE_FORMAT(MAX(lp.DeliveryPeriod), '%d-%m-%Y') AS DeliveryPeriod,
- SUM(COALESCE(lp.Qty,0) * COALESCE(lp.OrderPrice,0)) AS OrderAmount,
- COALESCE(MAX(v.VendorName),'') AS VendorName
-                 FROM LPRspares lp
-                 LEFT JOIN Vendors v ON lp.L1VendorID = v.VendorID
- WHERE lp.OrderNo = ?
- GROUP BY lp.OrderNo
- LIMIT 1
- ", [$orderNo]);
-             $gridRows     = DB::select("SELECT lp.LPRSpareID, lp.Qty, COALESCE(lp.SuppliedQty,0) AS SuppliedQty, COALESCE(lp.SuitableQty,0) AS SuitableQty, lp.SuitabilityDate, lp.CRVNo, lp.CRVDate, lp.SpareOrderStatus, COALESCE(s.Section,'') AS Section, COALESCE(s.PartNo,'') AS PartNo, COALESCE(s.Nomenclature,'') AS Nomenclature FROM LPRspares lp LEFT JOIN Spares s ON lp.SpareID=s.SpareID WHERE lp.OrderNo=? ORDER BY COALESCE(s.Section,''),COALESCE(s.PartNo,'')", [$orderNo]);
- foreach ($gridRows as $r) {
Added / After Commit
+ public function index(Request $request)
+ {
+ $orderNo      = trim($request->query('OrderNo', ''));
+         $orderNos     = DB::select("SELECT DISTINCT OrderNo FROM lprspares WHERE OrderNo IS NOT NULL AND TRIM(OrderNo)!='' ORDER BY OrderNo");
+ $orderDetails = null;
+ $gridRows     = [];
+ 
+ DATE_FORMAT(MAX(lp.DeliveryPeriod), '%d-%m-%Y') AS DeliveryPeriod,
+ SUM(COALESCE(lp.Qty,0) * COALESCE(lp.OrderPrice,0)) AS OrderAmount,
+ COALESCE(MAX(v.VendorName),'') AS VendorName
+                 FROM lprspares lp
+                 LEFT JOIN vendors v ON lp.L1VendorID = v.VendorID
+ WHERE lp.OrderNo = ?
+ GROUP BY lp.OrderNo
+ LIMIT 1
+ ", [$orderNo]);
+             $gridRows     = DB::select("SELECT lp.LPRSpareID, lp.Qty, COALESCE(lp.SuppliedQty,0) AS SuppliedQty, COALESCE(lp.SuitableQty,0) AS SuitableQty, lp.SuitabilityDate, lp.CRVNo, lp.CRVDate, lp.SpareOrderStatus, COALESCE(s.Section,'') AS Section, COALESCE(s.PartNo,'') AS PartNo, COALESCE(s.Nomenclature,'') AS Nomenclature FROM lprspares lp LEFT JOIN spares s ON lp.SpareID=s.SpareID WHERE lp.OrderNo=? ORDER BY COALESCE(s.Section,''),COALESCE(s.PartNo,'')", [$orderNo]);
+ foreach ($gridRows as $r) {
Removed / Before Commit
- DATE_FORMAT(MAX(lp.ExtendedDeliveryPeriod), '%d-%m-%Y') AS ExtendedDeliveryPeriodStr,
- COALESCE(MAX(lp.NoteNo), '') AS NoteNo,
- COALESCE(MAX(lp.LDStatus), '') AS LDStatus
-              FROM LPRspares lp
-              LEFT JOIN Vendors v ON lp.L1VendorID = v.VendorID
- WHERE lp.OrderNo = ?",
- [$orderNo]
- );
- COALESCE(lp.LDStatus,'') AS LDStatus,
- DATE_FORMAT(lp.ExtendedDeliveryPeriod, '%d-%m-%Y') AS ExtendedDeliveryPeriod,
- lp.ExtensionGranted
-              FROM LPRspares lp
-              LEFT JOIN Spares s ON lp.SpareID = s.SpareID
-              LEFT JOIN Jobs j ON lp.JobID = j.JobID
- WHERE lp.OrderNo = ?
- ORDER BY COALESCE(j.JobNo,''), COALESCE(s.Section,''), COALESCE(s.PartNo,'')",
- [$orderNo]
- {
Added / After Commit
+ DATE_FORMAT(MAX(lp.ExtendedDeliveryPeriod), '%d-%m-%Y') AS ExtendedDeliveryPeriodStr,
+ COALESCE(MAX(lp.NoteNo), '') AS NoteNo,
+ COALESCE(MAX(lp.LDStatus), '') AS LDStatus
+              FROM lprspares lp
+              LEFT JOIN vendors v ON lp.L1VendorID = v.VendorID
+ WHERE lp.OrderNo = ?",
+ [$orderNo]
+ );
+ COALESCE(lp.LDStatus,'') AS LDStatus,
+ DATE_FORMAT(lp.ExtendedDeliveryPeriod, '%d-%m-%Y') AS ExtendedDeliveryPeriod,
+ lp.ExtensionGranted
+              FROM lprspares lp
+              LEFT JOIN spares s ON lp.SpareID = s.SpareID
+              LEFT JOIN jobs j ON lp.JobID = j.JobID
+ WHERE lp.OrderNo = ?
+ ORDER BY COALESCE(j.JobNo,''), COALESCE(s.Section,''), COALESCE(s.PartNo,'')",
+ [$orderNo]
+ {
Removed / Before Commit
- MAX(pr.ProcRule) AS ProcType,
- MAX(g.GrantName) AS GrantName,
- MAX(c.FinPower) AS FinPower
-                  FROM LPRspares lp
-                  INNER JOIN LPRs l ON lp.LPRID = l.LPRID
-                  LEFT JOIN Cases c ON l.CaseNoID = c.CaseID
- LEFT JOIN ProcRules pr ON c.ProcRuleID = pr.ProcRuleID
-                  LEFT JOIN Grants g ON l.GrantID = g.GrantID
-                  LEFT JOIN Vendors v ON lp.L1VendorID = v.VendorID
- WHERE lp.OrderNo = ?) active
- CROSS JOIN
- (SELECT
- MAX(g.GrantName) AS GrantName,
- MAX(c.FinPower) AS FinPower
- FROM cancelledorderitems coi
-                  INNER JOIN LPRspares lp ON coi.LPRSpareID = lp.LPRSpareID
-                  INNER JOIN LPRs l ON lp.LPRID = l.LPRID
-                  LEFT JOIN Cases c ON l.CaseNoID = c.CaseID
Added / After Commit
+ MAX(pr.ProcRule) AS ProcType,
+ MAX(g.GrantName) AS GrantName,
+ MAX(c.FinPower) AS FinPower
+                  FROM lprspares lp
+                  INNER JOIN new_lprs l ON lp.LPRID = l.LPRID
+                  LEFT JOIN cases c ON l.CaseNoID = c.CaseID
+ LEFT JOIN ProcRules pr ON c.ProcRuleID = pr.ProcRuleID
+                  LEFT JOIN new_grants g ON l.GrantID = g.GrantID
+                  LEFT JOIN vendors v ON lp.L1VendorID = v.VendorID
+ WHERE lp.OrderNo = ?) active
+ CROSS JOIN
+ (SELECT
+ MAX(g.GrantName) AS GrantName,
+ MAX(c.FinPower) AS FinPower
+ FROM cancelledorderitems coi
+                  INNER JOIN lprspares lp ON coi.LPRSpareID = lp.LPRSpareID
+                  INNER JOIN new_lprs l ON lp.LPRID = l.LPRID
+                  LEFT JOIN cases c ON l.CaseNoID = c.CaseID
Removed / Before Commit
- 
- $orderNos = DB::select(
- "SELECT DISTINCT ls.OrderNo
-              FROM LPRspares ls
-              INNER JOIN LPRs  l ON ls.LPRID   = l.LPRID
-              INNER JOIN Cases c ON l.CaseNoID = c.CaseID
- WHERE ls.OrderNo IS NOT NULL AND TRIM(OrderNo) != ''
- ORDER BY ls.OrderNo"
- );
- COALESCE(v.VendorName,'N/A')                           AS VendorName,
- DATE_FORMAT(MAX(ls.OrderDate), '%d-%m-%Y')              AS OrderDate,
- COALESCE(SUM(ls.Qty * ls.OrderPrice), 0)               AS OrderAmount
-                  FROM LPRspares ls
-                  INNER JOIN LPRs   l  ON ls.LPRID      = l.LPRID
-                  INNER JOIN Cases  c  ON l.CaseNoID    = c.CaseID
-                  LEFT  JOIN Vendors v ON ls.L1VendorID = v.VendorID
- WHERE ls.OrderNo = ?
- GROUP BY v.VendorName
Added / After Commit
+ 
+ $orderNos = DB::select(
+ "SELECT DISTINCT ls.OrderNo
+              FROM lprspares ls
+              INNER JOIN new_lprs  l ON ls.LPRID   = l.LPRID
+              INNER JOIN cases c ON l.CaseNoID = c.CaseID
+ WHERE ls.OrderNo IS NOT NULL AND TRIM(OrderNo) != ''
+ ORDER BY ls.OrderNo"
+ );
+ COALESCE(v.VendorName,'N/A')                           AS VendorName,
+ DATE_FORMAT(MAX(ls.OrderDate), '%d-%m-%Y')              AS OrderDate,
+ COALESCE(SUM(ls.Qty * ls.OrderPrice), 0)               AS OrderAmount
+                  FROM lprspares ls
+                  INNER JOIN new_lprs   l  ON ls.LPRID      = l.LPRID
+                  INNER JOIN cases  c  ON l.CaseNoID    = c.CaseID
+                  LEFT  JOIN vendors v ON ls.L1VendorID = v.VendorID
+ WHERE ls.OrderNo = ?
+ GROUP BY v.VendorName
Removed / Before Commit
- public function index(Request $request)
- {
- $caseId      = (int)$request->query('CaseID', 0);
-         $cases       = DB::select("SELECT CaseID, CaseNo FROM Cases ORDER BY CaseNo");
- $caseDetails = null;
- $orderRows   = [];
- $orderSummary = [];
- 
- if ($caseId) {
-             $caseDetails  = DB::selectOne("SELECT c.BidNo,c.BidDate,c.BidOpeningDate AS BidOpenedOn, COALESCE(c.RANo,'') AS RANo, c.RADt, COALESCE(d.Designation,'') AS CFA, COALESCE(c.FinPower,'') AS FinPower FROM Cases c LEFT JOIN designation d ON c.DesignationID=d.DesignationID WHERE c.CaseID=?", [$caseId]);
-             $orderRows    = DB::select("SELECT ls.LPRSpareID, COALESCE(s.Section,'') AS Section, COALESCE(s.PartNo,'') AS PartNo, COALESCE(s.Nomenclature,'') AS Nomenclature, COALESCE(s.AUID,'') AS AUID, COALESCE(ls.Qty,0) AS Qty, COALESCE(ls.OrderPrice,0) AS OrderPrice, COALESCE(ls.Qty,0)*COALESCE(ls.OrderPrice,0) AS TotalOrderAmount, COALESCE(v.VendorName,'') AS L1Vendor, COALESCE(ls.GEMCNo,'') AS GEMCNo, COALESCE(ls.OrderNo,'') AS OrderNo, ls.OrderDate, ls.NoOfDays, ls.DeliveryPeriod, COALESCE(g.GrantName,'') AS GrantName FROM Cases c INNER JOIN LPRs l ON c.CaseID=l.CaseNoID INNER JOIN LPRspares ls ON l.LPRID=ls.LPRID INNER JOIN Spares s ON ls.SpareID=s.SpareID LEFT JOIN Vendors v ON ls.L1VendorID=v.VendorID LEFT JOIN Grants g ON l.GrantID=g.GrantID WHERE c.CaseID=? ORDER BY COALESCE(s.Section,''),s.PartNo", [$caseId]);
-             $orderSummary = DB::select("SELECT ls.OrderNo, MAX(ls.OrderDate) AS OrderDate, COALESCE(v.VendorName,'Various') AS VendorName, SUM(ls.Qty*ls.OrderPrice) AS TotalAmount FROM Cases c INNER JOIN LPRs l ON c.CaseID=l.CaseNoID INNER JOIN LPRspares ls ON l.LPRID=ls.LPRID LEFT JOIN Vendors v ON ls.L1VendorID=v.VendorID WHERE c.CaseID=? AND ls.OrderNo IS NOT NULL AND TRIM(OrderNo)!='' AND ls.OrderPrice IS NOT NULL AND ls.Qty IS NOT NULL GROUP BY ls.OrderNo,v.VendorName ORDER BY MAX(ls.OrderDate) DESC,ls.OrderNo", [$caseId]);
- 
- // Format dates
- foreach ($orderRows as $r) {
- 
- // Auto-format order number: GrantName/Serial/FY
- if ($orderNo && $orderDate) {
Added / After Commit
+ public function index(Request $request)
+ {
+ $caseId      = (int)$request->query('CaseID', 0);
+         $cases       = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo");
+ $caseDetails = null;
+ $orderRows   = [];
+ $orderSummary = [];
+ 
+ if ($caseId) {
+             $caseDetails  = DB::selectOne("SELECT c.BidNo,c.BidDate,c.BidOpeningDate AS BidOpenedOn, COALESCE(c.RANo,'') AS RANo, c.RADt, COALESCE(d.Designation,'') AS CFA, COALESCE(c.FinPower,'') AS FinPower FROM cases c LEFT JOIN designation d ON c.DesignationID=d.DesignationID WHERE c.CaseID=?", [$caseId]);
+             $orderRows    = DB::select("SELECT ls.LPRSpareID, COALESCE(s.Section,'') AS Section, COALESCE(s.PartNo,'') AS PartNo, COALESCE(s.Nomenclature,'') AS Nomenclature, COALESCE(s.AUID,'') AS AUID, COALESCE(ls.Qty,0) AS Qty, COALESCE(ls.OrderPrice,0) AS OrderPrice, COALESCE(ls.Qty,0)*COALESCE(ls.OrderPrice,0) AS TotalOrderAmount, COALESCE(v.VendorName,'') AS L1Vendor, COALESCE(ls.GEMCNo,'') AS GEMCNo, COALESCE(ls.OrderNo,'') AS OrderNo, ls.OrderDate, ls.NoOfDays, ls.DeliveryPeriod, COALESCE(g.GrantName,'') AS GrantName FROM cases c INNER JOIN new_lprs l ON c.CaseID=l.CaseNoID INNER JOIN lprspares ls ON l.LPRID=ls.LPRID INNER JOIN spares s ON ls.SpareID=s.SpareID LEFT JOIN vendors v ON ls.L1VendorID=v.VendorID LEFT JOIN new_grants g ON l.GrantID=g.GrantID WHERE c.CaseID=? ORDER BY COALESCE(s.Section,''),s.PartNo", [$caseId]);
+             $orderSummary = DB::select("SELECT ls.OrderNo, MAX(ls.OrderDate) AS OrderDate, COALESCE(v.VendorName,'Various') AS VendorName, SUM(ls.Qty*ls.OrderPrice) AS TotalAmount FROM cases c INNER JOIN new_lprs l ON c.CaseID=l.CaseNoID INNER JOIN lprspares ls ON l.LPRID=ls.LPRID LEFT JOIN vendors v ON ls.L1VendorID=v.VendorID WHERE c.CaseID=? AND ls.OrderNo IS NOT NULL AND TRIM(OrderNo)!='' AND ls.OrderPrice IS NOT NULL AND ls.Qty IS NOT NULL GROUP BY ls.OrderNo,v.VendorName ORDER BY MAX(ls.OrderDate) DESC,ls.OrderNo", [$caseId]);
+ 
+ // Format dates
+ foreach ($orderRows as $r) {
+ 
+ // Auto-format order number: GrantName/Serial/FY
+ if ($orderNo && $orderDate) {
Removed / Before Commit
- 
- class PayMatrixController extends Controller
- {
- /**
- * Display pay matrix in a table format
- */
- */
- public function getCellsByLevel($level)
- {
- $cells = PayMatrix::where('level', $level)
- ->orderBy('cell')
- ->pluck('cell');
- */
- public function getBasicByLevelAndCell($level, $cell)
- {
- $payMatrix = PayMatrix::where('level', $level)
- ->where('cell', $cell)
- ->first();
Added / After Commit
+ 
+ class PayMatrixController extends Controller
+ {
+     private function normalizePayMatrixValue($value): string
+     {
+         if (preg_match('/\d+/', (string) $value, $matches)) {
+             return $matches[0];
+         }
+ 
+         return trim((string) $value);
+     }
+ 
+ /**
+ * Display pay matrix in a table format
+ */
+ */
+ public function getCellsByLevel($level)
+ {
Removed / Before Commit
- // ── Shared case loader ─────────────────────────────────────────────────
- private function caseData(int $caseId): object
- {
-         $case = DB::selectOne("SELECT c.*, d.Designation AS CFA, d.ICNo, d.Rank, d.OffrsName, g.GrantName, pr.ProcRule FROM Cases c LEFT JOIN (SELECT l.GrantID FROM LPRs l WHERE l.CaseNoID=? LIMIT 1) lg ON 1=1 LEFT JOIN designation d ON c.DesignationID=d.DesignationID LEFT JOIN Grants g ON lg.GrantID=g.GrantID LEFT JOIN ProcRules pr ON c.ProcRuleID=pr.ProcRuleID WHERE c.CaseID=?", [$caseId, $caseId]);
- abort_if(!$case, 404, 'Case not found');
- return $case;
- }
- 
- private function caseSpares(int $caseId): array
- {
-         return DB::select("SELECT SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName AS AU,SUM(LPS.Qty) AS Qty,LPS.ProposalPrice AS Rate,LPS.GST,LPS.OtherCharges,SUM(LPS.TotalAONAmount) AS Amount,GROUP_CONCAT(J.JobNo SEPARATOR ', ') AS JobNos FROM Cases C INNER JOIN LPRs L ON C.CaseID=L.CaseNoID INNER JOIN LPRspares LPS ON L.LPRID=LPS.LPRID INNER JOIN Spares SP ON LPS.SpareID=SP.SpareID INNER JOIN au AU ON SP.AUID=AU.AUID INNER JOIN Jobs J ON LPS.JobID=J.JobID WHERE C.CaseID=? AND LPS.Qty>0 GROUP BY SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName,LPS.ProposalPrice,LPS.GST,LPS.OtherCharges ORDER BY SP.Section,SP.PartNo", [$caseId]);
- }
- 
- private function easSpares(int $caseId): array
- {
-         return DB::select("SELECT SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName AS AU,LPS.Qty,LPS.OrderPrice,LPS.FinalGST,LPS.TotalOrderAmount,V.VendorName FROM Cases C INNER JOIN LPRs L ON C.CaseID=L.CaseNoID INNER JOIN LPRspares LPS ON L.LPRID=LPS.LPRID INNER JOIN Spares SP ON LPS.SpareID=SP.SpareID INNER JOIN au AU ON SP.AUID=AU.AUID LEFT JOIN Vendors V ON LPS.L1VendorID=V.VendorID WHERE C.CaseID=? AND LPS.Qty>0 ORDER BY SP.Section,SP.PartNo", [$caseId]);
- }
- 
Added / After Commit
+ // ── Shared case loader ─────────────────────────────────────────────────
+ private function caseData(int $caseId): object
+ {
+         $case = DB::selectOne("SELECT c.*, d.Designation AS CFA, d.ICNo, d.Rank, d.OffrsName, g.GrantName, pr.ProcRule FROM cases c LEFT JOIN (SELECT l.GrantID FROM new_lprs l WHERE l.CaseNoID=? LIMIT 1) lg ON 1=1 LEFT JOIN designation d ON c.DesignationID=d.DesignationID LEFT JOIN new_grants g ON lg.GrantID=g.GrantID LEFT JOIN ProcRules pr ON c.ProcRuleID=pr.ProcRuleID WHERE c.CaseID=?", [$caseId, $caseId]);
+ abort_if(!$case, 404, 'Case not found');
+ return $case;
+ }
+ 
+ private function caseSpares(int $caseId): array
+ {
+         return DB::select("SELECT SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName AS AU,SUM(LPS.Qty) AS Qty,LPS.ProposalPrice AS Rate,LPS.GST,LPS.OtherCharges,SUM(LPS.TotalAONAmount) AS Amount,GROUP_CONCAT(J.JobNo SEPARATOR ', ') AS JobNos FROM cases C INNER JOIN new_lprs L ON C.CaseID=L.CaseNoID INNER JOIN lprspares LPS ON L.LPRID=LPS.LPRID INNER JOIN spares SP ON LPS.SpareID=SP.SpareID INNER JOIN au AU ON SP.AUID=AU.AUID INNER JOIN jobs J ON LPS.JobID=J.JobID WHERE C.CaseID=? AND LPS.Qty>0 GROUP BY SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName,LPS.ProposalPrice,LPS.GST,LPS.OtherCharges ORDER BY SP.Section,SP.PartNo", [$caseId]);
+ }
+ 
+ private function easSpares(int $caseId): array
+ {
+         return DB::select("SELECT SP.Section,SP.PartNo,SP.Nomenclature,AU.AUName AS AU,LPS.Qty,LPS.OrderPrice,LPS.FinalGST,LPS.TotalOrderAmount,V.VendorName FROM cases C INNER JOIN new_lprs L ON C.CaseID=L.CaseNoID INNER JOIN lprspares LPS ON L.LPRID=LPS.LPRID INNER JOIN spares SP ON LPS.SpareID=SP.SpareID INNER JOIN au AU ON SP.AUID=AU.AUID LEFT JOIN vendors V ON LPS.L1VendorID=V.VendorID WHERE C.CaseID=? AND LPS.Qty>0 ORDER BY SP.Section,SP.PartNo", [$caseId]);
+ }
+ 
Removed / Before Commit
- SUM(COALESCE(ls.Qty, 0)) AS TotalQty,
- AVG(COALESCE(ls.OrderPrice, 0)) AS AvgOrderPrice,
- SUM(COALESCE(ls.TotalOrderAmount, COALESCE(ls.Qty, 0) * COALESCE(ls.OrderPrice, 0), 0)) AS TotalOrderAmount
-                 FROM LPRspares ls
-                 INNER JOIN LPRs l ON ls.LPRID = l.LPRID
-                 LEFT JOIN Grants g ON l.GrantID = g.GrantID
-                 LEFT JOIN Spares sp ON ls.SpareID = sp.SpareID
- LEFT JOIN au au ON sp.AUID = au.AUID
-                 LEFT JOIN Jobs j ON ls.JobID = j.JobID
-                 LEFT JOIN JobTypes jt ON j.JobTypeID = jt.JobTypeID
- LEFT JOIN UserGroups ug ON l.UserGroupID = ug.UserGroupID
- LEFT JOIN eqpts e ON j.EqptID = e.EqptID
- WHERE l.LPRDate IS NOT NULL
Added / After Commit
+ SUM(COALESCE(ls.Qty, 0)) AS TotalQty,
+ AVG(COALESCE(ls.OrderPrice, 0)) AS AvgOrderPrice,
+ SUM(COALESCE(ls.TotalOrderAmount, COALESCE(ls.Qty, 0) * COALESCE(ls.OrderPrice, 0), 0)) AS TotalOrderAmount
+                 FROM lprspares ls
+                 INNER JOIN new_lprs l ON ls.LPRID = l.LPRID
+                 LEFT JOIN new_grants g ON l.GrantID = g.GrantID
+                 LEFT JOIN spares sp ON ls.SpareID = sp.SpareID
+ LEFT JOIN au au ON sp.AUID = au.AUID
+                 LEFT JOIN jobs j ON ls.JobID = j.JobID
+                 LEFT JOIN jobtypes jt ON j.JobTypeID = jt.JobTypeID
+ LEFT JOIN UserGroups ug ON l.UserGroupID = ug.UserGroupID
+ LEFT JOIN eqpts e ON j.EqptID = e.EqptID
+ WHERE l.LPRDate IS NOT NULL
Removed / Before Commit
- $fy       = trim($request->query('FY', ''));
- $status   = trim($request->query('status', ''));
- 
-         $grants  = DB::select("SELECT 0 AS GrantID,'-- All Grants --' AS GrantName UNION SELECT GrantID,GrantName FROM Grants ORDER BY GrantName");
-         $vendors = DB::select("SELECT 0 AS VendorID,'-- All Vendors --' AS VendorName UNION SELECT VendorID,VendorName FROM Vendors WHERE IsActive=1 ORDER BY VendorName");
- $ugroups = DB::select("SELECT 0 AS UserGroupID,'-- All Groups --' AS UserGroupName UNION SELECT UserGroupID,UserGroupName FROM UserGroups ORDER BY UserGroupName");
-         $fyList  = DB::select("SELECT DISTINCT YEAR(OrderDate) AS FY FROM LPRspares WHERE OrderDate IS NOT NULL AND YEAR(OrderDate)>=YEAR(CURDATE())-10 ORDER BY FY DESC");
- 
- $where  = ["ls.OrderNo IS NOT NULL", "TRIM(ls.OrderNo)!=''"];
- $params = [];
- ls.Qty,
- ls.OrderPrice,
- c.CaseNo
-              FROM LPRspares ls
-              INNER JOIN Spares s ON ls.SpareID=s.SpareID
-              LEFT JOIN LPRs l ON ls.LPRID=l.LPRID
-              LEFT JOIN Grants g ON l.GrantID=g.GrantID
- LEFT JOIN UserGroups ug ON l.UserGroupID=ug.UserGroupID
Added / After Commit
+ $fy       = trim($request->query('FY', ''));
+ $status   = trim($request->query('status', ''));
+ 
+         $grants  = DB::select("SELECT 0 AS GrantID,'-- All Grants --' AS GrantName UNION SELECT GrantID,GrantName FROM new_grants ORDER BY GrantName");
+         $vendors = DB::select("SELECT 0 AS VendorID,'-- All Vendors --' AS VendorName UNION SELECT VendorID,VendorName FROM vendors WHERE IsActive=1 ORDER BY VendorName");
+ $ugroups = DB::select("SELECT 0 AS UserGroupID,'-- All Groups --' AS UserGroupName UNION SELECT UserGroupID,UserGroupName FROM UserGroups ORDER BY UserGroupName");
+         $fyList  = DB::select("SELECT DISTINCT YEAR(OrderDate) AS FY FROM lprspares WHERE OrderDate IS NOT NULL AND YEAR(OrderDate)>=YEAR(CURDATE())-10 ORDER BY FY DESC");
+ 
+ $where  = ["ls.OrderNo IS NOT NULL", "TRIM(ls.OrderNo)!=''"];
+ $params = [];
+ ls.Qty,
+ ls.OrderPrice,
+ c.CaseNo
+              FROM lprspares ls
+              INNER JOIN spares s ON ls.SpareID=s.SpareID
+              LEFT JOIN new_lprs l ON ls.LPRID=l.LPRID
+              LEFT JOIN new_grants g ON l.GrantID=g.GrantID
+ LEFT JOIN UserGroups ug ON l.UserGroupID=ug.UserGroupID
Removed / Before Commit
- 
- // Get basic salary from employee
- $basicSalary = $employee->basic_salary ?? 0;
-         $hra = $employee->hra ?? 0;
- $da = $employee->da ?? 0;
- 
- // Store basic values for formula calculations
- 
- $componentValues = [];
- $basicSalary = $employee->basic_salary ?? 0;
-         $hra = $employee->hra ?? 0;
- $da = $employee->da ?? 0;
- 
- $componentValues['BASIC'] = $basicSalary;
- 
- // Get basic salary components from employee
- $basicSalary = $employee->basic_salary ?? 0;
-         $hra = $employee->hra ?? 0;
Added / After Commit
+ 
+ // Get basic salary from employee
+ $basicSalary = $employee->basic_salary ?? 0;
+         $hra = round(((float) ($employee->basic_salary ?? 0)) * 0.20, 2);
+ $da = $employee->da ?? 0;
+ 
+ // Store basic values for formula calculations
+ 
+ $componentValues = [];
+ $basicSalary = $employee->basic_salary ?? 0;
+         $hra = round(((float) ($employee->basic_salary ?? 0)) * 0.20, 2);
+ $da = $employee->da ?? 0;
+ 
+ $componentValues['BASIC'] = $basicSalary;
+ 
+ // Get basic salary components from employee
+ $basicSalary = $employee->basic_salary ?? 0;
+         $hra = round(((float) ($employee->basic_salary ?? 0)) * 0.20, 2);
Removed / Before Commit
- use App\Models\Staff;
- use App\Models\Department;
- use App\Models\Designation;
- use App\Models\Shift;
- use App\Models\EmployeeCategory;
- use Maatwebsite\Excel\Concerns\ToModel;
- use Maatwebsite\Excel\Concerns\WithHeadingRow;
- use Maatwebsite\Excel\Concerns\WithEvents;
- {
- $normalizedRow = [];
- foreach ($row as $key => $value) {
-             // Convert key to lowercase and replace spaces with underscores
-             $normalizedKey = strtolower(trim(str_replace(' ', '_', $key)));
- $normalizedRow[$normalizedKey] = $value;
- }
- 
- $row = $this->normalizeRowKeys($row);
- 
Added / After Commit
+ use App\Models\Staff;
+ use App\Models\Department;
+ use App\Models\Designation;
+ use App\Models\FinancePaymentRecovery;
+ use App\Models\FinanceStaffDetail;
+ use App\Models\FinanceSupplementaryPayment;
+ use App\Models\Shift;
+ use App\Models\EmployeeCategory;
+ use App\Models\PayMatrix;
+ use Maatwebsite\Excel\Concerns\ToModel;
+ use Maatwebsite\Excel\Concerns\WithHeadingRow;
+ use Maatwebsite\Excel\Concerns\WithEvents;
+ {
+ $normalizedRow = [];
+ foreach ($row as $key => $value) {
+             $normalizedKey = strtolower((string) $key);
+             $normalizedKey = preg_replace('/[^a-z0-9]+/', '_', $normalizedKey);
+             $normalizedKey = trim($normalizedKey, '_');
Removed / Before Commit
- return $this->belongsTo(Group::class);
- }
- 
- public function natureOfComplaint(): BelongsTo
- {
- return $this->belongsTo(NatureOfComplaint::class, 'nature_of_complaint', 'id');
- $groupName = $natureOfComplaint->group->name;
- $productionYear = $activeProductionYear->financial_year;
- 
-         // Get the last complaint number for this group and production year
-         $lastComplaint = self::whereHas('natureOfComplaint', function($query) use ($natureOfComplaintId) {
-                 $query->where('id', $natureOfComplaintId);
- })
-             ->where('complaint_number', 'like', '%/' . $groupName . '/' . $productionYear)
-             ->orderBy('complaint_number', 'desc')
-             ->first();
- 
-         $sequence = 1;
Added / After Commit
+ return $this->belongsTo(Group::class);
+ }
+ 
+     public function subGroup(): BelongsTo
+     {
+         return $this->belongsTo(SubGroup::class, 'sub_group_id');
+     }
+ 
+ public function natureOfComplaint(): BelongsTo
+ {
+ return $this->belongsTo(NatureOfComplaint::class, 'nature_of_complaint', 'id');
+ $groupName = $natureOfComplaint->group->name;
+ $productionYear = $activeProductionYear->financial_year;
+ 
+         $maxSequence = self::where('complaint_number', 'like', '%/' . $groupName . '/' . $productionYear)
+             ->pluck('complaint_number')
+             ->map(function ($number) {
+                 $parts = explode('/', (string) $number);
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class FinanceSupplementaryPayment extends Model
+ {
+     use HasFactory;
+ 
+     protected $fillable = [
+         'staff_id',
+         'month',
+         'year',
+         'da_arrear',
+         'tuition_fee',
+         'arrears_of_pay',
Removed / Before Commit
- {
- use HasFactory;
- 
- protected $fillable = [
- 'name',
- 'status',
Added / After Commit
+ {
+ use HasFactory;
+ 
+     protected $table = 'grants';
+ 
+ protected $fillable = [
+ 'name',
+ 'status',
Removed / Before Commit
- {
- use HasFactory;
- 
-     protected $table = 'LPRs';
- protected $primaryKey = 'LPRID';
- public $incrementing = true;
- protected $keyType = 'int';
Added / After Commit
+ {
+ use HasFactory;
+ 
+     protected $table = 'new_lprs';
+ protected $primaryKey = 'LPRID';
+ public $incrementing = true;
+ protected $keyType = 'int';
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ 
+ class NewEquipment extends Model
+ {
+     protected $table = 'new_equipments';
+ 
+     protected $fillable = ['id', 'name', 'code', 'subgroup_id', 'group_id'];
+ 
+     public function subgroup()
+     {
+         return $this->belongsTo(SubGroup::class, 'subgroup_id');
+     }
+ 
+     public function group()
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Model;
+ use Illuminate\Database\Eloquent\SoftDeletes;
+ 
+ class NewSubAssyEquipment extends Model
+ {
+     use SoftDeletes;
+ 
+     protected $table = 'new_sub_assy_equipments';
+ 
+     protected $fillable = [
+         'equipment_id',
+         'id',
+         'sub_equipment_name',
+         'time_allot',
Removed / Before Commit
- return $this->hasOne(FinancePaymentRecovery::class, 'staff_id');
- }
- 
- public function financeSalarySnapshots()
- {
- return $this->hasMany(FinanceSalarySnapshot::class, 'employee_id');
Added / After Commit
+ return $this->hasOne(FinancePaymentRecovery::class, 'staff_id');
+ }
+ 
+     public function financeSupplementaryPayments()
+     {
+         return $this->hasMany(FinanceSupplementaryPayment::class, 'staff_id');
+     }
+ 
+ public function financeSalarySnapshots()
+ {
+ return $this->hasMany(FinanceSalarySnapshot::class, 'employee_id');
Removed / Before Commit
- 'route' => 'finance-staff-details',
- 'children' => collect(),
- ],
- ]);
- };
Added / After Commit
+ 'route' => 'finance-staff-details',
+ 'children' => collect(),
+ ],
+                     (object) [
+                         'name' => 'DA Rates',
+                         'icon' => '<i class="fas fa-percent"></i>',
+                         'route' => 'da',
+                         'children' => collect(),
+                     ],
+ ]);
+ };
Removed / Before Commit
- use App\Models\FinanceDeductionTitle;
- use App\Models\FinanceInduDeduction;
- use App\Models\FinanceSalarySnapshot;
- use App\Models\Staff;
- use Carbon\Carbon;
- use Illuminate\Support\Facades\DB;
- 
- class SalaryCalculationService
- {
- private ?array $rules = null;
- 
- public function generateForStaff(Staff $staff, int $month, int $year, bool $force = false, bool $deductionsRecoveriesOnly = false): FinanceSalarySnapshot
- {
- ->where('year', $year)
- ->first();
- 
-         if ($existing && (!$force || !$this->isCurrentPeriod($month, $year))) {
-             return $existing;
Added / After Commit
+ use App\Models\FinanceDeductionTitle;
+ use App\Models\FinanceInduDeduction;
+ use App\Models\FinanceSalarySnapshot;
+ use App\Models\FinanceSupplementaryPayment;
+ use App\Models\Staff;
+ use Carbon\Carbon;
+ use Illuminate\Support\Facades\DB;
+ 
+ class SalaryCalculationService
+ {
+ private ?array $rules = null;
+     private array $supplementaryPaymentCache = [];
+ 
+ public function generateForStaff(Staff $staff, int $month, int $year, bool $force = false, bool $deductionsRecoveriesOnly = false): FinanceSalarySnapshot
+ {
+ ->where('year', $year)
+ ->first();
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         Schema::create('new_equipments', function (Blueprint $table) {
+             $table->id();
+             $table->string('name');
+             $table->string('code')->unique();
+             $table->foreignId('subgroup_id')->nullable();
+             $table->unsignedBigInteger('group_id')->nullable();
+             $table->timestamps();
+         });
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         Schema::create('new_sub_assy_equipments', function (Blueprint $table) {
+             $table->id();
+             $table->foreignId('equipment_id')->constrained('new_equipments')->onDelete('cascade');
+             $table->string('sub_equipment_name');
+             $table->integer('time_allot')->default(0);
+             $table->string('sub_assy_type')->nullable();
+             $table->unsignedBigInteger('created_by');
+             $table->unsignedBigInteger('updated_by')->nullable();
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Support\Facades\DB;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         if (!DB::table('menus')->where('route', 'da')->exists()) {
+             DB::table('menus')->insert([
+                 'name' => 'DA Rates',
+                 'icon' => '<i class="fas fa-percent"></i>',
+                 'route' => 'da',
+                 'parent_id' => null,
+                 'only_view' => false,
+                 'created_at' => now(),
+                 'updated_at' => now(),
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ use Illuminate\Database\Migrations\Migration;
+ use Illuminate\Database\Schema\Blueprint;
+ use Illuminate\Support\Facades\Schema;
+ 
+ return new class extends Migration
+ {
+     public function up(): void
+     {
+         Schema::create('finance_supplementary_payments', function (Blueprint $table) {
+             $table->id();
+             $table->foreignId('staff_id')->constrained('staff')->cascadeOnDelete();
+             $table->unsignedTinyInteger('month');
+             $table->unsignedSmallInteger('year');
+             $table->decimal('da_arrear', 12, 2)->default(0);
+             $table->decimal('tuition_fee', 12, 2)->default(0);
+             $table->decimal('arrears_of_pay', 12, 2)->default(0);
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Adm;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ 
+ class FinPowersController extends Controller
+ {
+     private function nextFinPowerId(): int
+     {
+         return (int) (DB::selectOne("SELECT COALESCE(MAX(FinPowerID), 0) + 1 AS id FROM finpower")->id ?? 1);
+     }
+ 
+     public function index()
+     {
+         $grants       = DB::select("SELECT GrantID, GrantName FROM new_grants ORDER BY GrantName");
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Adm;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ 
+ class FundTransactionController extends Controller
+ {
+     private function nextFundTransactionId(): int
+     {
+         return (int) (DB::selectOne("SELECT COALESCE(MAX(FundTransactionID), 0) + 1 AS id FROM fundtransactions")->id ?? 1);
+     }
+ 
+     private function nextGrantId(): int
+     {
+         return (int) (DB::selectOne("SELECT COALESCE(MAX(GrantID), 0) + 1 AS id FROM new_grants")->id ?? 1);
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Adm;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ 
+ class VendorController extends Controller
+ {
+     private function nextVendorId(): int
+     {
+         return (int) (DB::selectOne("SELECT COALESCE(MAX(VendorID), 0) + 1 AS id FROM vendors")->id ?? 1);
+     }
+ 
+     public function index(Request $request)
+     {
+         $editRow = null;
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Aon;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class AonController extends Controller
+ {
+     public function index(Request $request)
+     {
+         $caseId    = (int)$request->query('CaseID', 0);
+         $cases     = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo");
+         $procRules = DB::select("SELECT ProcRuleID, ProcRule FROM ProcRules ORDER BY ProcRule");
+ 
+         $aonRows   = [];
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Bid;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class BidController extends Controller
+ {
+     public function index(Request $request)
+     {
+         $caseId   = (int)$request->query('CaseID', 0);
+         $cases    = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo");
+         $bidData  = null;
+         $bidSpares = [];
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Boo;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ /**
+  * Benchmarking and Comparative Statement share identical DB logic;
+  * the only difference is whether the LPP (Last Purchase Price) column appears.
+  */
+ abstract class CsBaseController extends Controller
+ {
+     protected bool $showLPP = false;
+ 
+     protected function loadView(Request $request, string $view): \Illuminate\View\View
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Boo;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class FinancialOpeningController extends Controller
+ {
+     public function index()
+     {
+         $cases   = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo DESC");
+         $vendors = DB::select("SELECT VendorID, VendorName FROM vendors WHERE IsActive=1 ORDER BY VendorName");
+         return view('boo.form.financial-opening', compact('cases', 'vendors'));
+     }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Boo;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class PriceNegotiationController extends Controller
+ {
+     public function index()
+     {
+         $cases = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo DESC");
+         return view('boo.form.price-negotiation', compact('cases'));
+     }
+ 
+     public function loadCase(int $caseId)
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Boo;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class VendorsParticipationController extends Controller
+ {
+     public function index()
+     {
+         $cases   = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo DESC");
+         $vendors = DB::select("SELECT VendorID, VendorName FROM vendors ORDER BY VendorName");
+         return view('boo.form.vendors-participation', compact('cases', 'vendors'));
+     }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Eas;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class EasController extends Controller
+ {
+     public function index()
+     {
+         $cases   = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo DESC");
+         $vendors = DB::select("SELECT VendorID, VendorName FROM vendors WHERE IsActive=1 ORDER BY VendorName");
+         return view('eas.form', compact('cases', 'vendors'));
+     }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class LPODashboardController extends Controller
+ {
+     public function index(Request $request)
+     {
+         $fy      = LpoHelper::getFYDates($request->query('fy'));
+         $fyStart = $fy['start'];
+         $fyEnd   = $fy['end'];
+         $currentFY = $fy['fy'];
+ 
+         // ── Dropdown lists for FY selectors ──────────────────────────────
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Lpr;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class LprEditController extends Controller
+ {
+     /** GET /lpr/edit – search form */
+     public function index()
+     {
+         $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
+         $spares     = DB::select("SELECT SpareID, Nomenclature FROM spares ORDER BY Nomenclature");
+         $jobs       = DB::select("SELECT JobID, JobNo FROM jobs ORDER BY JobNo");
+         return view('lpr.edit', compact('userGroups', 'spares', 'jobs'));
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Lpr;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use Illuminate\Support\Facades\Schema;
+ use App\Helpers\LpoHelper;
+ use Carbon\Carbon;
+ 
+ class LprEntryController extends Controller
+ {
+     private function nextId(string $table, string $column): int
+     {
+         return ((int) DB::table($table)->max($column)) + 1;
+     }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Lpr;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class PendingLprController extends Controller
+ {
+     public function index()
+     {
+         $userGroups = DB::select("SELECT UserGroupID, UserGroupName FROM UserGroups ORDER BY UserGroupName");
+         $jobTypes   = DB::select("SELECT JobTypeID, JobType FROM jobtypes ORDER BY JobType");
+         return view('lpr.pending', compact('userGroups', 'jobTypes'));
+     }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Order;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class ChallanController extends Controller
+ {
+     public function index(Request $request)
+     {
+         $orderNo      = trim($request->query('OrderNo', ''));
+         $orderNos     = DB::select("SELECT DISTINCT OrderNo FROM lprspares WHERE OrderNo IS NOT NULL AND TRIM(OrderNo)!='' ORDER BY OrderNo");
+         $orderDetails = null;
+         $challanRows  = [];
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Order;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class CrvController extends Controller
+ {
+     public function index(Request $request)
+     {
+         $orderNo      = trim($request->query('OrderNo', ''));
+         $orderNos     = DB::select("SELECT DISTINCT OrderNo FROM lprspares WHERE OrderNo IS NOT NULL AND TRIM(OrderNo)!='' ORDER BY OrderNo");
+         $orderDetails = null;
+         $gridRows     = [];
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Order;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ 
+ class DeliveryPeriodController extends Controller
+ {
+     private function getOrderDetails(string $orderNo): ?object
+     {
+         return DB::selectOne(
+             "SELECT
+                 DATE_FORMAT(MAX(lp.OrderDate), '%d-%m-%Y') AS OrderDate,
+                 DATE_FORMAT(MAX(lp.DeliveryPeriod), '%d-%m-%Y') AS DeliveryPeriodStr,
+                 COALESCE(SUM(lp.Qty * lp.OrderPrice), 0) AS OrderAmount,
+                 COALESCE(GROUP_CONCAT(DISTINCT v.VendorName ORDER BY v.VendorName SEPARATOR ', '), 'N/A') AS VendorName,
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Order;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ 
+ class OrderCancellationController extends Controller
+ {
+     private function getOrderDetails(string $orderNo): ?object
+     {
+         return DB::selectOne(
+             "SELECT
+                 COALESCE(active.OrderDate, archived.OrderDate) AS OrderDate,
+                 COALESCE(active.GEMCNo, archived.GEMCNo) AS GEMCNo,
+                 COALESCE(active.DeliveryPeriod, archived.DeliveryPeriod) AS DeliveryPeriod,
+                 COALESCE(active.OrderAmount, archived.OrderAmount, 0) AS OrderAmount,
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Order;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ 
+ class SubmitBillController extends Controller
+ {
+     private function nextBillId(): int
+     {
+         return (int) (DB::selectOne("SELECT COALESCE(MAX(BillID), 0) + 1 AS id FROM vendorbills")->id ?? 1);
+     }
+ 
+     public function index(Request $request)
+     {
+         $selectedOrder = trim($request->query('OrderNo', ''));
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Order;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class SupplyOrderController extends Controller
+ {
+     public function index(Request $request)
+     {
+         $caseId      = (int)$request->query('CaseID', 0);
+         $cases       = DB::select("SELECT CaseID, CaseNo FROM cases ORDER BY CaseNo");
+         $caseDetails = null;
+         $orderRows   = [];
+         $orderSummary = [];
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers;
+ 
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class PrintController extends Controller
+ {
+     // ── Shared case loader ─────────────────────────────────────────────────
+     private function caseData(int $caseId): object
+     {
+         $case = DB::selectOne("SELECT c.*, d.Designation AS CFA, d.ICNo, d.Rank, d.OffrsName, g.GrantName, pr.ProcRule FROM cases c LEFT JOIN (SELECT l.GrantID FROM new_lprs l WHERE l.CaseNoID=? LIMIT 1) lg ON 1=1 LEFT JOIN designation d ON c.DesignationID=d.DesignationID LEFT JOIN new_grants g ON lg.GrantID=g.GrantID LEFT JOIN ProcRules pr ON c.ProcRuleID=pr.ProcRuleID WHERE c.CaseID=?", [$caseId, $caseId]);
+         abort_if(!$case, 404, 'Case not found');
+         return $case;
+     }
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Reports;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ use App\Helpers\LpoHelper;
+ 
+ class AbcReportController extends Controller
+ {
+     private const PAGE_SIZE = 15;
+ 
+     private function abcSourceSql(): string
+     {
+         return "SELECT
+                     COALESCE(g.GrantName, '') AS GrantName,
+                     COALESCE(sp.AUID, '') AS AUID,
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Http\Controllers\Reports;
+ 
+ use App\Http\Controllers\Controller;
+ use Illuminate\Http\Request;
+ use Illuminate\Support\Facades\DB;
+ 
+ class OrderStateController extends Controller
+ {
+     public function index(Request $request)
+     {
+         $grantId  = (int)$request->query('GrantID', 0);
+         $vendorId = (int)$request->query('VendorID', 0);
+         $ugId     = (int)$request->query('UserGroupID', 0);
+         $fy       = trim($request->query('FY', ''));
+         $status   = trim($request->query('status', ''));
+ 
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ use Illuminate\Database\Eloquent\Relations\HasMany;
+ 
+ class Grant extends Model
+ {
+     use HasFactory;
+ 
+     protected $table = 'grants';
+ 
+     protected $fillable = [
+         'name',
+         'status',
+     ];
Removed / Before Commit

                                                
Added / After Commit
+ <?php
+ 
+ namespace App\Models;
+ 
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
+ use Illuminate\Database\Eloquent\Model;
+ use App\Models\FinancialPower;
+ 
+ class Lpr extends Model
+ {
+     use HasFactory;
+ 
+     protected $table = 'new_lprs';
+     protected $primaryKey = 'LPRID';
+     public $incrementing = true;
+     protected $keyType = 'int';
+     public $timestamps = false;
+ 
Removed / Before Commit
- <div class="row mb-3">
- {{-- Level Dropdown from Pay Matrix --}}
- <div class="col-md-6">
-                                         <label for="pay_level" class="form-label">Level</label>
-                                         <select name="pay_level" id="pay_level" class="form-select">
- <option value="">Select Level...</option>
- @php
- $levels = \App\Models\PayMatrix::select('level')->distinct()->orderBy('level')->pluck('level');
- 
- {{-- Cell Dropdown --}}
- <div class="col-md-6">
-                                         <label for="pay_cell" class="form-label">Cell</label>
-                                         <select name="pay_cell" id="pay_cell" class="form-select" {{ isset($staff->pay_level) ? '' : 'disabled' }}>
- <option value="">Select Cell...</option>
- @if(isset($staff->pay_cell))
- <option value="{{ $staff->pay_cell }}" selected>Cell {{ $staff->pay_cell }}</option>
Added / After Commit
+ <div class="row mb-3">
+ {{-- Level Dropdown from Pay Matrix --}}
+ <div class="col-md-6">
+                                         <label for="pay_level" class="form-label">Level <span class="text-danger">*</span></label>
+                                         <select name="pay_level" id="pay_level" class="form-select" required>
+ <option value="">Select Level...</option>
+ @php
+ $levels = \App\Models\PayMatrix::select('level')->distinct()->orderBy('level')->pluck('level');
+ 
+ {{-- Cell Dropdown --}}
+ <div class="col-md-6">
+                                         <label for="pay_cell" class="form-label">Cell <span class="text-danger">*</span></label>
+                                         <select name="pay_cell" id="pay_cell" class="form-select" required {{ isset($staff->pay_level) ? '' : 'disabled' }}>
+ <option value="">Select Cell...</option>
+ @if(isset($staff->pay_cell))
+ <option value="{{ $staff->pay_cell }}" selected>Cell {{ $staff->pay_cell }}</option>
Removed / Before Commit
- </select>
- </div>
- 
- <!-- Status -->
- <div class="col-xl-2 col-lg-3 col-md-4">
- <label class="filter-label">Status</label>
- </div>
- </div>
- 
- </div>
- </form>
- </div>
- <tr>
- <th>Employee Code</th>
- <th>Name</th>
- <th>Group</th>
- <th>Department</th>
- <th>Designation</th>
Added / After Commit
+ </select>
+ </div>
+ 
+                 <!-- Category -->
+                 <div class="col-xl-2 col-lg-3 col-md-4">
+                     <label class="filter-label">Category</label>
+                     <select name="category" class="form-select select2 filter-field" data-placeholder="All">
+                         <option value="" selected>All</option>
+                         @foreach($employeeCategories as $category)
+                             <option value="{{ $category->id }}"
+                                 {{ request('category') == $category->id ? 'selected' : '' }}>
+                                 {{ $category->name }}
+                             </option>
+                         @endforeach
+                     </select>
+                 </div>
+ 
+ <!-- Status -->
Removed / Before Commit
- 
- // fetch subgroup users
- $.ajax({
-                 url: '/complaints/get-subgroup-users/' + subgroupId,
- type: 'GET',
- success: function (users) {
Added / After Commit
+ 
+ // fetch subgroup users
+ $.ajax({
+                 url: '{{ route('complaints.subgroup-users', ':subGroup') }}'.replace(':subGroup', subgroupId),
+ type: 'GET',
+ success: function (users) {
Removed / Before Commit
- </div>
- <div class="field">
- <label>Sec:</label>
-                 <span class="field-value">{{ 'WSG/'.$complaint->natureOfComplaint->group->name ?? '' }}</span>
- </div>
- <div class="field">
- <label>Date:</label>
- <label>Group/Sec:</label>
- <span class="field-value">{{ $complaint->group->name ?? '' }}</span>
- </div>
- <div class="field">
- <label>Location:</label>
- <span class="field-value">{{ $complaint->location ?? '' }}</span>
- <div>
- <div class="section-title">Work Completed By:</div>
- <div class="items-list">
-                         <div class="item">1. <span class="field-value" style="display: inline-block; width: 300px;"></span></div>
- <div class="item">2. <span class="field-value" style="display: inline-block; width: 300px;"></span></div>
Added / After Commit
+ </div>
+ <div class="field">
+ <label>Sec:</label>
+                 <span class="field-value">{{ 'WSG/' . ($complaint->natureOfComplaint?->group?->name ?? '') }}</span>
+ </div>
+ <div class="field">
+ <label>Date:</label>
+ <label>Group/Sec:</label>
+ <span class="field-value">{{ $complaint->group->name ?? '' }}</span>
+ </div>
+             <div class="field">
+                 <label>Sub Sec:</label>
+                 <span class="field-value">{{ $complaint->subGroup->name ?? '' }}</span>
+             </div>
+ <div class="field">
+ <label>Location:</label>
+ <span class="field-value">{{ $complaint->location ?? '' }}</span>
+ <div>
Removed / Before Commit
- 
- <!-- Complaint Table -->
- <div class="table-responsive" style="overflow-x: auto; max-height: 70vh; overflow-y: auto;">
-                 <table class="table table-striped table-hover table-bordered sticky-header" id="complaintTable" style="min-width: 1600px;">
- <thead>
- <tr>
- <th>#</th>
- <th>Complaint No</th>
- <th>Complainer Group</th>
- 
- <th>Resolver Group</th>
- <th>Nature Of Complaint</th>
- 
- <th>Assigned To</th>
- <th width="150px">Date & Time</th>
- <th>Complainer Status</th>
- <th>Resolver Status</th>
- <th>Admin Status</th>
Added / After Commit
+ 
+ <!-- Complaint Table -->
+ <div class="table-responsive" style="overflow-x: auto; max-height: 70vh; overflow-y: auto;">
+                 <table class="table table-striped table-hover table-bordered sticky-header" id="complaintTable" style="min-width: 2200px;">
+ <thead>
+ <tr>
+ <th>#</th>
+ <th>Complaint No</th>
+ <th>Complainer Group</th>
+                             <th>Sub Section</th>
+ 
+ <th>Resolver Group</th>
+ <th>Nature Of Complaint</th>
+                             <th>Complaint Description</th>
+ 
+ <th>Assigned To</th>
+                             <th>Resolver Name</th>
+ <th width="150px">Date & Time</th>
Removed / Before Commit
- echo '<th colspan="6" class="divider">****** DEDUCTIONS ******</th>';
- echo '</tr>';
- echo '<tr>';
-         foreach (['SER','T/NO','RANK','NAME','GROUP','EOL','ML','LATE','WP','GPF/CPF/NPS','CGEIS','FES CODE','CGHS','TDS','10% ARR TOT DED'] as $index => $label) {
- echo '<th class="' . ($index === 9 ? 'divider' : '') . '">' . $label . '</th>';
- }
- echo '</tr>';
- $cell($row, 'fourteen_arr_net_pay');
- echo '</tr>';
- 
- echo '<tr>';
- echo '<td></td><td></td><td></td>';
- $cell($row, 'days_da');
Added / After Commit
+ echo '<th colspan="6" class="divider">****** DEDUCTIONS ******</th>';
+ echo '</tr>';
+ echo '<tr>';
+         foreach (['SER','T/NO','RANK','NAME','GROUP','EOL','ML','LATE','WP','GPF/CPF/NPS','CGEGIS','FES CODE','CGHS','TDS','10% ARR TOT DED'] as $index => $label) {
+ echo '<th class="' . ($index === 9 ? 'divider' : '') . '">' . $label . '</th>';
+ }
+ echo '</tr>';
+ $cell($row, 'fourteen_arr_net_pay');
+ echo '</tr>';
+ 
+         $supl = function ($label, $value) {
+             return $label . ':' . number_format((float) $value, 0);
+         };
+ 
+         echo '<tr>';
+         echo '<td></td><td></td><td class="left">SUPL</td>';
+         echo '<td>' . e($supl('DA ARR', $row['da_arr'] ?? 0)) . '</td>';
+         echo '<td>' . e($supl('TUT FEE', $row['tuition_fee'] ?? 0)) . '</td>';
Removed / Before Commit
- <th>MISC PAY</th>
- <th>DA TPT</th>
- <th>GROSS</th>
-                     <th>CGEIS</th>
- <th>CGHS</th>
- <th>TDS</th>
- <th>HR REC</th>
Added / After Commit
+ <th>MISC PAY</th>
+ <th>DA TPT</th>
+ <th>GROSS</th>
+                     <th>CGEGIS</th>
+ <th>CGHS</th>
+ <th>TDS</th>
+ <th>HR REC</th>
Removed / Before Commit
- @php
- $salary = $snapshot->salary_json;
- $monthNames = [1=>'JAN',2=>'FEB',3=>'MAR',4=>'APR',5=>'MAY',6=>'JUN',7=>'JUL',8=>'AUG',9=>'SEP',10=>'OCT',11=>'NOV',12=>'DEC'];
-     $schemeLabel = array_key_exists('UPS GOVT CONT', $salary['allowances'] ?? []) ? 'UPS' : 'NPS';
- $monthlyTitles = $salary['deductions_meta']['monthly_titles'] ?? [];
- $allowanceRows = [
- ['MONTH', ($monthNames[$salary['period']['month']] ?? $salary['period']['month']) . ' ' . $salary['period']['year']],
- ['HRA', $salary['allowances']['HRA'] ?? 0],
- ['TPT', $salary['allowances']['SPL PAY/TPT'] ?? 0],
- ['DA TPT', $salary['allowances']['DA TPT'] ?? 0],
-         ['GOVT NPS Cont', $salary['allowances']['NPS GOVT CONT'] ?? ($salary['allowances']['UPS GOVT CONT'] ?? 0)],
- ['EOL', 0],
- ['LATE MINUTES', 0],
- ['MISC PAY', $salary['allowances']['MISC PAY'] ?? 0],
Added / After Commit
+ @php
+ $salary = $snapshot->salary_json;
+ $monthNames = [1=>'JAN',2=>'FEB',3=>'MAR',4=>'APR',5=>'MAY',6=>'JUN',7=>'JUL',8=>'AUG',9=>'SEP',10=>'OCT',11=>'NOV',12=>'DEC'];
+     $schemeLabel = array_key_exists('UPS (GOVT)', $salary['deductions'] ?? []) ? 'UPS' : 'NPS';
+ $monthlyTitles = $salary['deductions_meta']['monthly_titles'] ?? [];
+ $allowanceRows = [
+ ['MONTH', ($monthNames[$salary['period']['month']] ?? $salary['period']['month']) . ' ' . $salary['period']['year']],
+ ['HRA', $salary['allowances']['HRA'] ?? 0],
+ ['TPT', $salary['allowances']['SPL PAY/TPT'] ?? 0],
+ ['DA TPT', $salary['allowances']['DA TPT'] ?? 0],
+ ['EOL', 0],
+ ['LATE MINUTES', 0],
+ ['MISC PAY', $salary['allowances']['MISC PAY'] ?? 0],
Removed / Before Commit
- $dob = !empty($salary['employee']['dob']) ? \Carbon\Carbon::parse($salary['employee']['dob'])->format('d/M/Y') : '-';
- $doa = !empty($salary['employee']['joining_date']) ? \Carbon\Carbon::parse($salary['employee']['joining_date'])->format('d/M/Y') : '-';
- $dor = !empty($salary['employee']['dob']) ? \Carbon\Carbon::parse($salary['employee']['dob'])->addYears(60)->format('d/M/Y') : '-';
-     $govtContribution = $salary['allowances']['NPS GOVT CONT'] ?? ($salary['allowances']['UPS GOVT CONT'] ?? 0);
- $govtDeduction = $salary['deductions']['NPS/(GOVT)'] ?? ($salary['deductions']['UPS (GOVT)'] ?? 0);
- $cghsEis = ($salary['deductions']['CGHS'] ?? 0) + ($salary['deductions']['CGEGIS'] ?? 0);
- $monthlyTitles = $salary['deductions_meta']['monthly_titles'] ?? [];
- <td></td><td class="amount"></td>
- </tr>
- <tr>
-             <td>NPS CONT</td><td class="amount">{{ number_format($govtContribution, 0) }}</td>
- <td>VEH ADV</td><td class="amount">{{ number_format($salary['deductions']['VEH ADV'] ?? 0, 0) }}</td>
- <td>PUNIS/TB</td><td class="amount">{{ number_format($salary['recoveries']['PUNIS/TB'] ?? 0, 0) }}</td>
- </tr>
Added / After Commit
+ $dob = !empty($salary['employee']['dob']) ? \Carbon\Carbon::parse($salary['employee']['dob'])->format('d/M/Y') : '-';
+ $doa = !empty($salary['employee']['joining_date']) ? \Carbon\Carbon::parse($salary['employee']['joining_date'])->format('d/M/Y') : '-';
+ $dor = !empty($salary['employee']['dob']) ? \Carbon\Carbon::parse($salary['employee']['dob'])->addYears(60)->format('d/M/Y') : '-';
+ $govtDeduction = $salary['deductions']['NPS/(GOVT)'] ?? ($salary['deductions']['UPS (GOVT)'] ?? 0);
+ $cghsEis = ($salary['deductions']['CGHS'] ?? 0) + ($salary['deductions']['CGEGIS'] ?? 0);
+ $monthlyTitles = $salary['deductions_meta']['monthly_titles'] ?? [];
+ <td></td><td class="amount"></td>
+ </tr>
+ <tr>
+             <td>NPS CONT</td><td class="amount">0</td>
+ <td>VEH ADV</td><td class="amount">{{ number_format($salary['deductions']['VEH ADV'] ?? 0, 0) }}</td>
+ <td>PUNIS/TB</td><td class="amount">{{ number_format($salary['recoveries']['PUNIS/TB'] ?? 0, 0) }}</td>
+ </tr>
Removed / Before Commit
- value="{{ old('cr_no', $financeDetail->cr_no ?? '') }}">
- </div>
- <div class="col-md-3">
-                             <label class="form-label d-block">Handicap</label>
- <div class="form-check form-switch">
- <input type="hidden" name="handicap" value="0">
- <input class="form-check-input" type="checkbox" name="handicap" value="1"
- @checked(old('handicap', $financeDetail->handicap ?? $staff->is_handicapped ?? false))>
- </div>
- </div>
- <div class="col-md-3">
-                             <label class="form-label d-block">Govt Accommodation</label>
- <div class="form-check form-switch">
- <input type="hidden" name="govt_accommodation" value="0">
- <input class="form-check-input" type="checkbox" name="govt_accommodation" value="1"
- <div class="card-body">
- <div class="row g-3">
- <div class="col-md-4">
Added / After Commit
+ value="{{ old('cr_no', $financeDetail->cr_no ?? '') }}">
+ </div>
+ <div class="col-md-3">
+                             <label class="form-label d-block">Handicapped</label>
+ <div class="form-check form-switch">
+ <input type="hidden" name="handicap" value="0">
+ <input class="form-check-input" type="checkbox" name="handicap" value="1"
+ @checked(old('handicap', $financeDetail->handicap ?? $staff->is_handicapped ?? false))>
+ </div>
+ </div>
+ <div class="col-md-3">
+                             <label class="form-label d-block">Govt Acc</label>
+ <div class="form-check form-switch">
+ <input type="hidden" name="govt_accommodation" value="0">
+ <input class="form-check-input" type="checkbox" name="govt_accommodation" value="1"
+ <div class="card-body">
+ <div class="row g-3">
+ <div class="col-md-4">
Removed / Before Commit
- @extends('layouts.app')
- 
- @section('content')
- @php
- $displayDate = function ($date) {
- </div>
- </div>
- 
-         <form method="POST" action="{{ route('finance-staff-details.payment-recovery.update', $staff) }}">
- @csrf
- @method('PUT')
- 
- @foreach($group['fields'] as $name => $field)
- @php
- $type = $field['type'] ?? 'number';
-                                             $value = old($name, $paymentRecovery->{$name} ?? '');
- if ($type === 'date' && $value) {
- $value = \Carbon\Carbon::parse($value)->format('Y-m-d');
Added / After Commit
+ @extends('layouts.app')
+ 
+ @php
+     $supplementaryFields = [
+         'da_arrear',
+         'tuition_fee',
+         'arrears_of_pay',
+         'lve_ench',
+         'ot',
+         'nda',
+         'bonus',
+         'medical_claim',
+         'misc_supplementary',
+         'misc_supplementary_remark',
+     ];
+ @endphp
+ 
+ @section('content')
Removed / Before Commit
- <div class="card mb-3" id="leavePart2PrintArea">
- <div class="card-body">
- <div class="d-flex justify-content-between align-items-center mb-3">
- <h5 class="mb-0">
- {{ $isStaffSearch ? 'Pending Leaves Before DO 2 Part No' : 'Applied DO 2 Part No Leaves' }}
- @if($selectedPartNo)
Added / After Commit
+ <div class="card mb-3" id="leavePart2PrintArea">
+ <div class="card-body">
+ <div class="d-flex justify-content-between align-items-center mb-3">
+                     <div class="fw-bold">
+                         @if(!$isStaffSearch && !empty($doPartAppliedDate))
+                             {{ \Carbon\Carbon::parse($doPartAppliedDate)->format('d/M/Y') }}
+                         @endif
+                     </div>
+ <h5 class="mb-0">
+ {{ $isStaffSearch ? 'Pending Leaves Before DO 2 Part No' : 'Applied DO 2 Part No Leaves' }}
+ @if($selectedPartNo)
Removed / Before Commit

                                                
Added / After Commit
+ @extends('layouts.app')
+ 
+ @section('content')
+ <div class="row">
+     <div class="col">
+         <div class="card">
+             <div class="card-header py-3">
+                 <div class="row align-items-center">
+                     <div class="col-md-6">
+                         <h4 class="mb-0"><b>New Equipment Upload</b></h4>
+                     </div>
+                     <div class="col-md-6">
+                         <form method="POST" action="{{ route('new-equipment-upload.upload') }}" enctype="multipart/form-data" class="d-flex justify-content-end gap-2">
+                             @csrf
+                             <input type="file" name="file" class="form-control" accept=".xls,.xlsx,.csv" required>
+                             <button type="submit" class="btn btn-primary">
+                                 <i class="fa fa-upload me-1"></i> Upload
+                             </button>
Removed / Before Commit
- use App\Http\Controllers\WorkOrderController;
- use App\Http\Controllers\RepairClassController;
- use App\Http\Controllers\EquipmentController;
- use App\Http\Controllers\VIRController;
- use App\Http\Controllers\SubAssyEquipmentController;
- use App\Http\Controllers\QADecisionController;
- Route::post('equipments/update/{id}', [EquipmentController::class, 'update']);
- Route::delete('equipments/delete/{id}', [EquipmentController::class, 'destroy']);
- Route::post('/equipments/import', [EquipmentController::class, 'import'])->name('equipments.import');
- 
- Route::get('/group/{id}/equipments', [EquipmentController::class, 'getByGroup']);
- Route::get('/get-subassy/{equipmentId}', [EquipmentController::class, 'getSubAssy']);
- Route::get('/', [ComplaintController::class, 'index'])->name('complaints.index');
- Route::get('/create', [ComplaintController::class, 'create'])->name('complaints.create');
- Route::post('/', [ComplaintController::class, 'store'])->name('complaints.store');
- Route::get('/{complaint}', [ComplaintController::class, 'show'])->name('complaints.show');
- Route::get('/{complaint}/edit', [ComplaintController::class, 'edit'])->name('complaints.edit');
- Route::put('/{complaint}', [ComplaintController::class, 'update'])->name('complaints.update');
Added / After Commit
+ use App\Http\Controllers\WorkOrderController;
+ use App\Http\Controllers\RepairClassController;
+ use App\Http\Controllers\EquipmentController;
+ use App\Http\Controllers\NewEquipmentUploadController;
+ use App\Http\Controllers\VIRController;
+ use App\Http\Controllers\SubAssyEquipmentController;
+ use App\Http\Controllers\QADecisionController;
+ Route::post('equipments/update/{id}', [EquipmentController::class, 'update']);
+ Route::delete('equipments/delete/{id}', [EquipmentController::class, 'destroy']);
+ Route::post('/equipments/import', [EquipmentController::class, 'import'])->name('equipments.import');
+         Route::get('/new-equipment-upload', [NewEquipmentUploadController::class, 'index'])->name('new-equipment-upload.index');
+         Route::post('/new-equipment-upload', [NewEquipmentUploadController::class, 'upload'])->name('new-equipment-upload.upload');
+ 
+ Route::get('/group/{id}/equipments', [EquipmentController::class, 'getByGroup']);
+ Route::get('/get-subassy/{equipmentId}', [EquipmentController::class, 'getSubAssy']);
+ Route::get('/', [ComplaintController::class, 'index'])->name('complaints.index');
+ Route::get('/create', [ComplaintController::class, 'create'])->name('complaints.create');
+ Route::post('/', [ComplaintController::class, 'store'])->name('complaints.store');