|
|
|
@ -3,6 +3,9 @@
|
|
|
|
|
namespace App\Http\Controllers; |
|
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
|
|
use Illuminate\Support\Facades\Http; |
|
|
|
|
use App\Models\UserToActivity; |
|
|
|
|
use App\Models\Activity; |
|
|
|
|
use App\Models\AssignMaterial; |
|
|
|
|
use Laravel\Lumen\Routing\Controller as BaseController; |
|
|
|
|
|
|
|
|
|
use App\Models\ReportK3Detail; |
|
|
|
@ -250,7 +253,10 @@ class Controller extends BaseController
|
|
|
|
|
|
|
|
|
|
private function calculateMaterialCost($activity_id, $proyek_id) |
|
|
|
|
{ |
|
|
|
|
$totalCost = AssignMaterial::selectRaw("ISNULL(qty_planning,0)*ISNULL(budget,0) as totalCost")->where("proyek_id", $proyek_id)->where("activity_id", $activity_id)->sum("totalCost"); |
|
|
|
|
$totalCost = AssignMaterial::selectRaw("COALESCE(qty_planning,0)*COALESCE(budget,0) as totalCost") |
|
|
|
|
->where("proyek_id", $proyek_id) |
|
|
|
|
->where("activity_id", $activity_id) |
|
|
|
|
->sum(AssignMaterial::raw("COALESCE(qty_planning, 0) * COALESCE(budget, 0)")); |
|
|
|
|
return $totalCost; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|