feat: complete GSB construction ERP implementation with dual-mode MR, capitalization cap engine, single PM rule, and system sign-off documentation

This commit is contained in:
GSB Construction Engineering
2026-08-25 17:08:03 +08:00
parent 778f27e0a5
commit d4e2b468ff
114 changed files with 3923 additions and 10031 deletions

View File

@@ -55,13 +55,10 @@ class ProjectWorkflowService
*/
public function canCreatePurchaseOrder(Project $project): bool
{
// Requisition must exist and be approved
$hasApprovedMr = \Modules\MaterialLogistics\Models\MaterialRequisition::whereHas('items.material', function ($q) use ($project) {
// Check if the material is associated with this project's estimates
$q->whereIn('materials.id', $project->materialsEstimates()->pluck('material_id'));
})
->where('status', 'approved')
->exists();
// Requisition must exist and be approved for this project
$hasApprovedMr = \Modules\MaterialLogistics\Models\MaterialRequisition::where('project_id', $project->id)
->where('status', 'approved')
->exists();
return $hasApprovedMr || $project->status === ProjectStatus::InProgress;
}