518 lines
11 KiB
PHP
518 lines
11 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;
|
|
use App\Ramcar\ModeOfPayment;
|
|
|
|
/**
|
|
* @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", nullable=true)
|
|
*/
|
|
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;
|
|
|
|
// user that processed or is processing the job order
|
|
// used to determine lock
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="job_orders_processed")
|
|
* @ORM\JoinColumn(name="process_user_id", referencedColumnName="id", nullable=true)
|
|
*/
|
|
protected $processed_by;
|
|
|
|
// service type
|
|
/**
|
|
* @ORM\Column(type="string", length=25)
|
|
*/
|
|
protected $service_type;
|
|
|
|
// warranty class
|
|
/**
|
|
* @ORM\Column(type="string", length=25)
|
|
*/
|
|
protected $warranty_class;
|
|
|
|
// 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 hub
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Hub", inversedBy="job_orders")
|
|
* @ORM\JoinColumn(name="hub_id", referencedColumnName="id")
|
|
*/
|
|
protected $hub;
|
|
|
|
// 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 tier I notes
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
protected $tier1_notes;
|
|
|
|
// agent tier II notes
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
protected $tier2_notes;
|
|
|
|
// delivery address
|
|
/**
|
|
* @ORM\Column(type="text")
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $delivery_address;
|
|
|
|
// invoice
|
|
/**
|
|
* @ORM\OneToOne(targetEntity="Invoice", mappedBy="job_order")
|
|
*/
|
|
protected $invoice;
|
|
|
|
// reason for cancel
|
|
/**
|
|
* @ORM\Column(type="string", length=200, nullable=true)
|
|
*/
|
|
protected $cancel_reason;
|
|
|
|
// tickets associated with job order
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="Ticket", mappedBy="job_order")
|
|
*/
|
|
protected $tickets;
|
|
|
|
// reference job order
|
|
/**
|
|
* @ORM\OneToOne(targetEntity="JobOrder")
|
|
* @ORM\JoinColumn(name="ref_jo_id", referencedColumnName="id")
|
|
*/
|
|
protected $ref_jo;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=50)
|
|
*/
|
|
protected $mode_of_payment;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->date_create = new DateTime();
|
|
$this->date_schedule = new DateTime();
|
|
|
|
$this->flag_advance = false;
|
|
$this->source = 'mobile';
|
|
$this->mode_of_payment = ModeOfPayment::CASH;
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setDateCreate(DateTime $date_create)
|
|
{
|
|
$this->date_create = $date_create;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateCreate()
|
|
{
|
|
return $this->date_create;
|
|
}
|
|
|
|
public function setDateSchedule(DateTime $date_schedule)
|
|
{
|
|
$this->date_schedule = $date_schedule;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateSchedule()
|
|
{
|
|
return $this->date_schedule;
|
|
}
|
|
|
|
public function setDateCancel(DateTime $date_cancel)
|
|
{
|
|
$this->date_cancel = $date_cancel;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateCancel()
|
|
{
|
|
return $this->date_cancel;
|
|
}
|
|
|
|
public function setDateFulfill(DateTime $date_fulfill)
|
|
{
|
|
$this->date_fulfill = $date_fulfill;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateFulfill()
|
|
{
|
|
return $this->date_fulfill;
|
|
}
|
|
|
|
public function setDateAssign(DateTime $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 = null)
|
|
{
|
|
$this->assigned_by = $assigned_by;
|
|
return $this;
|
|
}
|
|
|
|
public function getAssignedBy()
|
|
{
|
|
return $this->assigned_by;
|
|
}
|
|
|
|
public function setProcessedBy(User $user = null)
|
|
{
|
|
$this->processed_by = $user;
|
|
return $this;
|
|
}
|
|
|
|
public function getProcessedBy()
|
|
{
|
|
return $this->processed_by;
|
|
}
|
|
|
|
public function setServiceType($service_type)
|
|
{
|
|
$this->service_type = $service_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getServiceType()
|
|
{
|
|
return $this->service_type;
|
|
}
|
|
|
|
public function setWarrantyClass($warranty_class)
|
|
{
|
|
$this->warranty_class = $warranty_class;
|
|
return $this;
|
|
}
|
|
|
|
public function getWarrantyClass()
|
|
{
|
|
return $this->warranty_class;
|
|
}
|
|
|
|
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 setHub(Hub $hub)
|
|
{
|
|
$this->hub = $hub;
|
|
return $this;
|
|
}
|
|
|
|
public function clearHub()
|
|
{
|
|
return $this->hub = null;
|
|
}
|
|
|
|
public function getHub()
|
|
{
|
|
return $this->hub;
|
|
}
|
|
|
|
public function setRider(Rider $rider)
|
|
{
|
|
$this->rider = $rider;
|
|
return $this;
|
|
}
|
|
|
|
public function clearRider()
|
|
{
|
|
return $this->rider = null;
|
|
}
|
|
|
|
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)
|
|
{
|
|
// TODO: validate 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 setTier1Notes($notes)
|
|
{
|
|
$this->tier1_notes = $notes;
|
|
return $this;
|
|
}
|
|
|
|
public function getTier1Notes()
|
|
{
|
|
return $this->tier1_notes;
|
|
}
|
|
|
|
public function setTier2Notes($notes)
|
|
{
|
|
$this->tier2_notes = $notes;
|
|
return $this;
|
|
}
|
|
|
|
public function getTier2Notes()
|
|
{
|
|
return $this->tier2_notes;
|
|
}
|
|
|
|
public function setDeliveryAddress($delivery_address)
|
|
{
|
|
$this->delivery_address = $delivery_address;
|
|
return $this;
|
|
}
|
|
|
|
public function getDeliveryAddress()
|
|
{
|
|
return $this->delivery_address;
|
|
}
|
|
|
|
public function setInvoice(Invoice $invoice)
|
|
{
|
|
$this->invoice = $invoice;
|
|
$invoice->setJobOrder($this);
|
|
return $this;
|
|
}
|
|
|
|
public function getInvoice()
|
|
{
|
|
return $this->invoice;
|
|
}
|
|
|
|
public function setCancelReason($reason)
|
|
{
|
|
$this->cancel_reason = $reason;
|
|
return $this;
|
|
}
|
|
|
|
public function getCancelReason()
|
|
{
|
|
return $this->cancel_reason;
|
|
}
|
|
|
|
public function getTickets()
|
|
{
|
|
return $this->tickets;
|
|
}
|
|
|
|
public function setReferenceJO(JobOrder $ref_jo)
|
|
{
|
|
$this->ref_jo = $ref_jo;
|
|
return $this;
|
|
}
|
|
|
|
public function getReferenceJO()
|
|
{
|
|
return $this->ref_jo;
|
|
}
|
|
|
|
public function setModeOfPayment($mode)
|
|
{
|
|
$this->mode_of_payment = $mode;
|
|
return $this;
|
|
}
|
|
|
|
public function getModeOfPayment()
|
|
{
|
|
return $this->mode_of_payment;
|
|
}
|
|
}
|