361 lines
7.5 KiB
PHP
361 lines
7.5 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
|
use DateTime;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="job_order")
|
|
*/
|
|
class JobOrder
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// date job order was created
|
|
/**
|
|
* @ORM\Column(type="datetime")
|
|
*/
|
|
protected $date_create;
|
|
|
|
// date and time of schedule
|
|
// defaults to current date / time
|
|
/**
|
|
* @ORM\Column(type="datetime")
|
|
*/
|
|
protected $date_schedule;
|
|
|
|
// date that the job order was fulfilled / delivered
|
|
/**
|
|
* @ORM\Column(type="datetime", nullable=true)
|
|
*/
|
|
protected $date_fulfill;
|
|
|
|
// date that the job order was cancelled
|
|
/**
|
|
* @ORM\Column(type="datetime", nullable=true)
|
|
*/
|
|
protected $date_cancel;
|
|
|
|
// date job order was assigned to a rider
|
|
/**
|
|
* @ORM\Column(type="datetime", nullable=true)
|
|
*/
|
|
protected $date_assign;
|
|
|
|
// coordinates of the customer vehicle that needs service
|
|
/**
|
|
* @ORM\Column(type="point")
|
|
*/
|
|
protected $coordinates;
|
|
|
|
// is it an advanced order (future date)
|
|
/**
|
|
* @ORM\Column(type="boolean")
|
|
*/
|
|
protected $flag_advance;
|
|
|
|
// user that created the job order
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="job_orders_created")
|
|
* @ORM\JoinColumn(name="create_user_id", referencedColumnName="id")
|
|
*/
|
|
protected $created_by;
|
|
|
|
// user that assigned the job order to a rider
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="job_orders_assigned")
|
|
* @ORM\JoinColumn(name="assign_user_id", referencedColumnName="id", nullable=true)
|
|
*/
|
|
protected $assigned_by;
|
|
|
|
// service type
|
|
/**
|
|
* @ORM\Column(type="string", length=25)
|
|
*/
|
|
protected $service_type;
|
|
|
|
// customer that requested job order
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="job_orders")
|
|
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $customer;
|
|
|
|
// customer vehicle that needs servicing
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="CustomerVehicle", inversedBy="job_orders")
|
|
* @ORM\JoinColumn(name="cvehicle_id", referencedColumnName="id")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $cus_vehicle;
|
|
|
|
// assigned outlet
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Outlet", inversedBy="job_orders")
|
|
* @ORM\JoinColumn(name="outlet_id", referencedColumnName="id")
|
|
*/
|
|
protected $outlet;
|
|
|
|
// assigned rider
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Rider", inversedBy="job_orders")
|
|
* @ORM\JoinColumn(name="rider_id", referencedColumnName="id")
|
|
*/
|
|
protected $rider;
|
|
|
|
// where requested job order came from (mobile or web)
|
|
/**
|
|
* @ORM\Column(type="string", length=10)
|
|
*/
|
|
protected $source;
|
|
|
|
// status of the job order
|
|
/**
|
|
* @ORM\Column(type="string", length=15)
|
|
*/
|
|
protected $status;
|
|
|
|
// delivery instructions
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
protected $delivery_instructions;
|
|
|
|
// agent notes
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
protected $agent_notes;
|
|
|
|
// delivery address
|
|
/**
|
|
* @ORM\Column(type="text")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $delivery_address;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->date_create = new DateTime();
|
|
$this->date_schedule = new DateTime();
|
|
|
|
$this->flag_advance = false;
|
|
$this->source = 'mobile';
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setDateCreate($date_create)
|
|
{
|
|
$this->date_create = $date_create;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateCreate()
|
|
{
|
|
return $this->date_create;
|
|
}
|
|
|
|
public function setDateSchedule($date_schedule)
|
|
{
|
|
$this->date_schedule = $date_schedule;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateSchedule()
|
|
{
|
|
return $this->date_schedule;
|
|
}
|
|
|
|
public function setDateFulfill($date_fulfill)
|
|
{
|
|
$this->date_fulfill = $date_fulfill;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateFulfill()
|
|
{
|
|
return $this->date_fulfill;
|
|
}
|
|
|
|
public function setDateAssign($date_assign)
|
|
{
|
|
$this->date_assign = $date_assign;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateAssign()
|
|
{
|
|
return $this->date_assign;
|
|
}
|
|
|
|
public function setCoordinates(Point $point)
|
|
{
|
|
$this->coordinates = $point;
|
|
return $this;
|
|
}
|
|
|
|
public function getCoordinates()
|
|
{
|
|
return $this->coordinates;
|
|
}
|
|
|
|
public function setAdvanceOrder($flag_advance)
|
|
{
|
|
$this->flag_advance = $flag_advance;
|
|
return $this;
|
|
}
|
|
|
|
public function isAdvanceOrder()
|
|
{
|
|
return $this->flag_advance;
|
|
}
|
|
|
|
public function setCreatedBy(User $created_by)
|
|
{
|
|
$this->created_by = $created_by;
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedBy()
|
|
{
|
|
return $this->created_by;
|
|
}
|
|
|
|
public function setAssignedBy(User $assigned_by)
|
|
{
|
|
$this->assigned_by = $assigned_by;
|
|
return $this;
|
|
}
|
|
|
|
public function getAssignedBy()
|
|
{
|
|
return $this->assigned_by;
|
|
}
|
|
|
|
public function setServiceType($service_type)
|
|
{
|
|
$this->service_type = $service_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getServiceType()
|
|
{
|
|
return $this->service_type;
|
|
}
|
|
|
|
public function setCustomer(Customer $customer)
|
|
{
|
|
$this->customer = $customer;
|
|
return $this;
|
|
}
|
|
|
|
public function getCustomer()
|
|
{
|
|
return $this->customer;
|
|
}
|
|
|
|
public function setCustomerVehicle(CustomerVehicle $cus_vehicle)
|
|
{
|
|
$this->cus_vehicle = $cus_vehicle;
|
|
return $this;
|
|
}
|
|
|
|
public function getCustomerVehicle()
|
|
{
|
|
return $this->cus_vehicle;
|
|
}
|
|
|
|
public function setOutlet(Outlet $outlet)
|
|
{
|
|
$this->outlet = $outlet;
|
|
return $this;
|
|
}
|
|
|
|
public function getOutlet()
|
|
{
|
|
return $this->outlet;
|
|
}
|
|
|
|
public function setRider(Rider $rider)
|
|
{
|
|
$this->rider = $rider;
|
|
return $this;
|
|
}
|
|
|
|
public function getRider()
|
|
{
|
|
return $this->rider;
|
|
}
|
|
|
|
public function setSource($source)
|
|
{
|
|
$this->source = $source;
|
|
return $this;
|
|
}
|
|
|
|
public function getSource()
|
|
{
|
|
return $this->source;
|
|
}
|
|
|
|
public function setStatus($status)
|
|
{
|
|
$this->status = $status;
|
|
return $this;
|
|
}
|
|
|
|
public function getStatus()
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
public function setDeliveryInstructions($delivery_instructions)
|
|
{
|
|
$this->delivery_instructions = $delivery_instructions;
|
|
return $this;
|
|
}
|
|
|
|
public function getDeliveryInstructions()
|
|
{
|
|
return $this->delivery_instructions;
|
|
}
|
|
|
|
public function setAgentNotes($agent_notes)
|
|
{
|
|
$this->agent_notes = $agent_notes;
|
|
return $this;
|
|
}
|
|
|
|
public function getAgentNotes()
|
|
{
|
|
return $this->agent_notes;
|
|
}
|
|
|
|
public function setDeliveryAddress($delivery_address)
|
|
{
|
|
$this->delivery_address = $delivery_address;
|
|
return $this;
|
|
}
|
|
|
|
public function getDeliveryAddress()
|
|
{
|
|
return $this->delivery_address;
|
|
}
|
|
}
|