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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user