Browse Source

fix interval, start and close on friday

pull/3/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
d73c1055f6
  1. 13
      app/Http/Controllers/ProjectController.php

13
app/Http/Controllers/ProjectController.php

@ -391,9 +391,10 @@ class ProjectController extends Controller
/* ->max("plan_date"); */ // plan date overlapped with assign_material_to_activity's, it should be m_activity's
/* print_r($maxDate); exit(); */
$begin = new \DateTime($minDate.' Monday');
$end = new \DateTime($maxDate. ' Friday');
$interval = new \DateInterval('P7D');
$begin = new \DateTime($minDate.' Friday');
/* print_r($begin); exit(); */
$end = new \DateTime($maxDate);
$interval = new \DateInterval('P1W');
// timezone problems in KIT case also occurs in here
$period = new \DatePeriod($begin, $interval, $end);
/* $period = new \DatePeriod($begin->modify('-1 days'), $interval, $end); */
@ -417,14 +418,16 @@ class ProjectController extends Controller
->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
->where('ama.proyek_id', '=', $keyGantt['proyek_id'])
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id'])
->whereDate('ama.plan_date', $dt->format("Y-m-d"))
/* ->whereDate('ama.plan_date', $dt->format("Y-m-d")) */
->whereDate('ama.plan_date', '<=',$dt->format("Y-m-d"))
->whereDate('ama.plan_date', '>',$dt->modify('-7 day')->format("Y-m-d"))
->get();
$dataActualM = DB::table('report_activity_material as ram')
->select('ram.activity_id', 'ram.qty', 'ram.report_date', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress')
->join('m_activity as a', 'a.id', '=', 'ram.activity_id')
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id'])
->where('a.proyek_id', '=', $keyGantt['proyek_id'])
->whereDate('ram.report_date', '<',$dt->format("Y-m-d"))
->whereDate('ram.report_date', '<=',$dt->format("Y-m-d"))
->whereDate('ram.report_date', '>',$dt->modify('-7 day')->format("Y-m-d"))
->get();
$dataTempPlan = [];

Loading…
Cancel
Save