chore: update document approval workflow and bug fixes

This commit is contained in:
2026-05-25 13:05:20 +08:00
parent d573c02893
commit 39a8e1d4cd
910 changed files with 49994 additions and 1010 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace Modules\MaterialLogistics\Models;
use Modules\MasterData\Models\Material;
use Modules\MasterData\Models\MaterialGroup;
use App\Traits\HasPublicIdentifier;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\ProjectManagement\Models\Project;
class ProjectInventory extends Model
{
use HasPublicIdentifier;
protected $table = 'project_inventories';
protected $fillable = [
'project_id', 'material_id',
'on_hand_qty', 'floated_qty', 'allocated_qty', 'consumed_qty', 'unit_cost',
];
protected function casts(): array
{
return [
'on_hand_qty' => 'decimal:2',
'floated_qty' => 'decimal:2',
'allocated_qty' => 'decimal:2',
'consumed_qty' => 'decimal:2',
'unit_cost' => 'decimal:2',
];
}
public function project(): BelongsTo
{
return $this->belongsTo(Project::class);
}
public function material(): BelongsTo
{
return $this->belongsTo(Material::class);
}
public function getAvailableQtyAttribute(): float
{
return (float) $this->on_hand_qty - (float) $this->allocated_qty;
}
}