Add get job order history for this month and last month. #421
This commit is contained in:
parent
b41b5ea29b
commit
760fa7acf3
1 changed files with 13 additions and 11 deletions
|
|
@ -33,6 +33,7 @@ use App\Entity\BatterySize;
|
|||
use App\Entity\JobOrder;
|
||||
|
||||
use DateTime;
|
||||
use DateInterval;
|
||||
|
||||
class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||
{
|
||||
|
|
@ -305,25 +306,24 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
// get JOs assigned to rider for the month given
|
||||
// setup start date and end dates
|
||||
// get current year
|
||||
$month = $req->query->get('month');
|
||||
$year = $req->query->get('year');
|
||||
|
||||
$current_date = new DateTime();
|
||||
$current_year = $current_date->format('Y');
|
||||
|
||||
if ($period == 'thismonth')
|
||||
if ($period == 'lastmonth')
|
||||
{
|
||||
$month = $current_date->format('m');
|
||||
$date_interval = new DateInterval('P1M');
|
||||
$period_date = $current_date->sub($date_interval);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
$period_date = $current_date;
|
||||
|
||||
$period_year = $period_date->format('Y');
|
||||
$period_month = $period_date->format('m');
|
||||
|
||||
// get number of days in month requested
|
||||
$last_day = cal_days_in_month(CAL_GREGORIAN, $month, $current_year);
|
||||
$last_day = cal_days_in_month(CAL_GREGORIAN, $period_month, $period_year);
|
||||
|
||||
$s_date = $current_year . '-' . $month . '-01 00:00:00';
|
||||
$e_date = $current_year . '-' . $month . '-' . $last_day . ' 23:59:59';
|
||||
$s_date = $period_year . '-' . $period_month . '-01 00:00:00';
|
||||
$e_date = $period_year . '-' . $period_month . '-' . $last_day . ' 23:59:59';
|
||||
|
||||
$qb = $this->em->getRepository(JobOrder::class)->createQueryBuilder('j');
|
||||
|
||||
|
|
@ -767,6 +767,8 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
|
||||
$jo->requeue();
|
||||
|
||||
// TODO: do we leave JO as assigned to rider?
|
||||
|
||||
// add event log
|
||||
$rider = $this->session->getRider();
|
||||
$event = new JOEvent();
|
||||
|
|
|
|||
Loading…
Reference in a new issue