Add command to migrate the imported CarFix data into CMBLegacyJobOrder. #460
This commit is contained in:
parent
832d96c171
commit
4e9c503eb2
5 changed files with 560 additions and 135 deletions
|
|
@ -9,7 +9,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\CMBLegacyJobOrder;
|
||||
use App\Entity\CMBLegacyJobOrderRow;
|
||||
|
||||
class ImportCMBLegacyJobOrderCommand extends Command
|
||||
{
|
||||
|
|
@ -114,7 +114,7 @@ class ImportCMBLegacyJobOrderCommand extends Command
|
|||
$status, $customer_name, $customer_mobile, $reference, $odometer, $batt_model, $batt_size,
|
||||
$trade_in, $replaced_by, $remark, $satisfaction);
|
||||
|
||||
$legacy_data = new CMBLegacyJobOrder();
|
||||
$legacy_data = new CMBLegacyJobOrderRow();
|
||||
$legacy_data->setData($data_entry);
|
||||
|
||||
$this->em->persist($legacy_data);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\CMBLegacyJobOrderRow;
|
||||
use App\Entity\CMBLegacyJobOrder;
|
||||
use App\Entity\JobOrder;
|
||||
use App\Entity\VehicleManufacturer;
|
||||
use App\Entity\Vehicle;
|
||||
use App\Entity\BatteryManufacturer;
|
||||
|
|
@ -19,8 +19,6 @@ use App\Entity\BatterySize;
|
|||
use App\Entity\Battery;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\CustomerVehicle;
|
||||
use App\Entity\Invoice;
|
||||
use App\Entity\InvoiceItem;
|
||||
|
||||
use App\Ramcar\CMBServiceType;
|
||||
use App\Ramcar\JOStatus;
|
||||
|
|
@ -31,6 +29,32 @@ use DateTime;
|
|||
|
||||
class MigrateCMBLegacyJobOrderCommand extends Command
|
||||
{
|
||||
/*
|
||||
id = 'entry_num'
|
||||
trans_date = 'created_date'
|
||||
case_number = 'case_number'
|
||||
insurer = 'insurer'
|
||||
plate_number = 'vehicle_number'
|
||||
car_brand and car_make = split the 'car_model'
|
||||
nature_of_call = nature_of_call
|
||||
trans_type = 'service_needed'
|
||||
address = 'location'
|
||||
address = 'state'
|
||||
driver = 'driver'
|
||||
truck = 'truck'
|
||||
workshop_arrival_time => 'workshop_arrival_time'
|
||||
status = 'status'
|
||||
cust_name = 'customer_name'
|
||||
cust_mobile = 'customer_phone_number'
|
||||
reference = 'reference'
|
||||
odometer = 'odometer'
|
||||
batt_model = 'batt_model'
|
||||
batt_size = 'batt_size'
|
||||
is_trade_in = 'batt_trade_in'
|
||||
replaced_by = 'replaced_by'
|
||||
remarks = 'remark'
|
||||
satisfaction => 'satisfaction'
|
||||
*/
|
||||
protected $em;
|
||||
|
||||
protected $bmanu_hash;
|
||||
|
|
@ -67,21 +91,39 @@ class MigrateCMBLegacyJobOrderCommand extends Command
|
|||
{
|
||||
$this->setName('cmblegacyjoborderdata:migrate')
|
||||
->setDescription('Retrieve database cmb legacy job orders and insert into job order.')
|
||||
->setHelp('Creates job orders based on data from imported CSV.');
|
||||
->setHelp('Creates job orders based on data from imported CSV.')
|
||||
->addArgument('output_file', InputArgument::REQUIRED, 'Path to the output CSV file of the entries not added.');
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$csv_file = $input->getArgument('output_file');
|
||||
|
||||
// attempt to open file
|
||||
try
|
||||
{
|
||||
$fh = fopen($csv_file, "w");
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
throw new Exception('The file "' . $csv_file . '" could be opened.');
|
||||
}
|
||||
|
||||
// get all legacy job orders
|
||||
$query = $this->em->createQuery('SELECT legacy_jo FROM App\Entity\CMBLegacyJobOrder legacy_jo');
|
||||
$query = $this->em->createQuery('SELECT legacy_jo_row FROM App\Entity\CMBLegacyJobOrderRow legacy_jo_row');
|
||||
$result = $query->iterate();
|
||||
|
||||
$invalid_entries = [];
|
||||
$added_entries = 0;
|
||||
$total_entries = 0;
|
||||
$total_inv_entries = 0;
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$entry = $row[0];
|
||||
$jo_entry = $entry->getData();
|
||||
|
||||
$total_entries++;
|
||||
|
||||
// get the entry information
|
||||
$entry_num = $jo_entry['entry_num'];
|
||||
$date_create = $jo_entry['created_date'];
|
||||
|
|
@ -112,12 +154,13 @@ class MigrateCMBLegacyJobOrderCommand extends Command
|
|||
$v_status = $this->processVehicleInfo($car_model);
|
||||
if ($v_status != null)
|
||||
{
|
||||
error_log($v_status . ' ' . $car_model);
|
||||
//error_log($v_status . ' ' . $car_model);
|
||||
$invalid_entries[] = $this->addInvalidEntry($entry_num, $date_create, $case_number, $insurer, $plate_number, $car_model,
|
||||
$nature_of_call, $service_needed, $location, $state, $driver, $truck, $workshop_arrival_time,
|
||||
$status, $customer_name, $customer_mobile, $reference, $odometer, $batt_model, $batt_size,
|
||||
$batt_trade_in, $replaced_by, $remark, $satisfaction, $v_status);
|
||||
|
||||
$total_inv_entries++;
|
||||
// move to next entry
|
||||
continue;
|
||||
}
|
||||
|
|
@ -126,66 +169,70 @@ class MigrateCMBLegacyJobOrderCommand extends Command
|
|||
$batt_status = $this->processBatteryInfo($batt_model, $batt_size);
|
||||
if ($batt_status != null)
|
||||
{
|
||||
error_log($batt_status . ' ' . $batt_model . ' ' . $batt_size);
|
||||
//error_log($batt_status . ' ' . $batt_model . ' ' . $batt_size);
|
||||
$invalid_entries[] = $this->addInvalidEntry($entry_num, $date_create, $case_number, $insurer, $plate_number, $car_model,
|
||||
$nature_of_call, $service_needed, $location, $state, $driver, $truck, $workshop_arrival_time,
|
||||
$status, $customer_name, $customer_mobile, $reference, $odometer, $batt_model, $batt_size,
|
||||
$batt_trade_in, $replaced_by, $remark, $satisfaction, $batt_status);
|
||||
|
||||
$total_inv_entries++;
|
||||
// move to next entry
|
||||
continue;
|
||||
}
|
||||
|
||||
// create job order
|
||||
$new_jo = new JobOrder();
|
||||
$cmb_legacy_jo = new CMBLegacyJobOrder();
|
||||
|
||||
// add to metadata
|
||||
// case number, nature of call, workshop arrival time, reference, odometer, replaced by, satisfaction
|
||||
$new_jo->addMeta('case_number', $case_number);
|
||||
$new_jo->addMeta('nature_of_call', $nature_of_call);
|
||||
$new_jo->addMeta('workshop_arrival_time', $workshop_arrival_time);
|
||||
$new_jo->addMeta('reference', $reference);
|
||||
$new_jo->addMeta('odometer', $odometer);
|
||||
$new_jo->addMeta('replaced_by', $replaced_by);
|
||||
$new_jo->addMeta('satisfaction', $satisfaction);
|
||||
// date_create
|
||||
$created_date = DateTime::createFromFormat("d-m-Y H:i", $date_create);
|
||||
$cmb_legacy_jo->setTransDate($created_date);
|
||||
|
||||
// date_create
|
||||
$created_date = DateTime::createFromFormat('d-m-Y H:i', $date_create);
|
||||
$new_jo->setDateCreate($created_date);
|
||||
// parse vehicle info
|
||||
// get vehicle from hash
|
||||
$v_array = explode(' ', $car_model);
|
||||
|
||||
// insurer == responsible_party
|
||||
$new_jo->setResponsibleParty($insurer);
|
||||
// manufacturer
|
||||
$v_manufacturer = trim($v_array[0]);
|
||||
|
||||
// get model
|
||||
$model_info = '';
|
||||
$v_model = '';
|
||||
for ($i = 1; $i < count($v_array); $i++)
|
||||
{
|
||||
$model_info = $model_info . ' ' . trim($v_array[$i]);
|
||||
}
|
||||
|
||||
$v_model = trim($model_info);
|
||||
|
||||
// delivery address = location + state
|
||||
$delivery_address = $location . ', ' . $state;
|
||||
$new_jo->setDeliveryAddress($delivery_address);
|
||||
|
||||
// remarks == tier 1 notes
|
||||
$new_jo->setTier1Notes($remark);
|
||||
// check if trade in
|
||||
$trade_in = false;
|
||||
if (strtolower($batt_trade_in) == 'yes')
|
||||
$trade_in = true;
|
||||
|
||||
// service_needed = service type
|
||||
// check service needed:
|
||||
// Battery == Battery Sales
|
||||
// Battery Warranty Claim == Warranty Claim
|
||||
// Battery Warranty Replacement == Warranty Replacement
|
||||
$service = $this->normalizeName($service_needed);
|
||||
switch ($service)
|
||||
{
|
||||
case 'battery':
|
||||
$new_jo->setServiceType(CMBServiceType::BATTERY_REPLACEMENT_NEW);
|
||||
break;
|
||||
case 'battery warranty claim':
|
||||
$new_jo->setServiceType(CMBServiceType::WARRANTY_CLAIM);
|
||||
break;
|
||||
case 'battery warranty replacement':
|
||||
$new_jo->setServiceType(CMBServiceType::BATTERY_REPLACEMENT_WARRANTY);
|
||||
break;
|
||||
}
|
||||
|
||||
// status set everything to fulfilled
|
||||
// store old status to metadata
|
||||
$new_jo->setStatus(JOStatus::FULFILLED);
|
||||
$new_jo->addMeta('status', $status);
|
||||
$cmb_legacy_jo->setCaseNumber($case_number)
|
||||
->setInsurer($insurer)
|
||||
->setNatureOfCall($nature_of_call)
|
||||
->setTransType($service_needed)
|
||||
->setCarBrand(strtoupper($v_manufacturer))
|
||||
->setCarMake(strtoupper($v_model))
|
||||
->setCustName($customer_name)
|
||||
->setCustMobile($customer_mobile)
|
||||
->setAddress($delivery_address)
|
||||
->setDriver($driver)
|
||||
->setTruck($truck)
|
||||
->setWorkshopArrivalTime($workshop_arrival_time)
|
||||
->setPlateNumber($plate_number)
|
||||
->setStatus($status)
|
||||
->setReference($reference)
|
||||
->setOdometer($odometer)
|
||||
->setBatteryModel(strtoupper($batt_model))
|
||||
->setBatterySize(strtoupper($batt_size))
|
||||
->setIsTradeIn($trade_in)
|
||||
->setReplacedBy($replaced_by)
|
||||
->setSatisfaction($satisfaction);
|
||||
|
||||
// plate number == vehicle_number. Use as key to cv_hash
|
||||
// check if plate number has been added
|
||||
|
|
@ -194,53 +241,60 @@ class MigrateCMBLegacyJobOrderCommand extends Command
|
|||
$cust = $this->addCustomer($customer_name, $customer_mobile);
|
||||
$cv = $this->addCustomerVehicle($plate_number, $car_model, $cust);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get customer vehicle from hash
|
||||
$cv = $this->cv_hash[$plate_number];
|
||||
$cust = $cv->getCustomer();
|
||||
}
|
||||
|
||||
$new_jo->setCustomer($cust)
|
||||
->setCustomerVehicle($cv);
|
||||
|
||||
// create the invoice
|
||||
$invoice_item = new InvoiceItem();
|
||||
$invoice = new Invoice();
|
||||
|
||||
// get the battery
|
||||
// cannot get the battery from the hash since we have no manufacturer data
|
||||
// have to find the battery using model and size
|
||||
$b_model = $this->bmodel_hash[$batt_model];
|
||||
$b_size = $this->bsize_hash[$batt_size];
|
||||
|
||||
$battery = $this->findBattery($b_model, $b_size);
|
||||
if ($battery != null)
|
||||
{
|
||||
// assume quantity of 1
|
||||
$invoice_item->setBattery($battery)
|
||||
->setPrice($battery->getSellingPrice())
|
||||
->setQuantity(1)
|
||||
->setInvoice($invoice);
|
||||
}
|
||||
|
||||
// TODO: invoice need to check if entry was cancelled or fulfilled
|
||||
// if fulfilled, set date_paid else set date_cancel
|
||||
// check if trade_in
|
||||
// set InvoiceStatus to fulfilled if fulfilled, cancelled if cancelled
|
||||
// compute totals
|
||||
|
||||
$invoice->setJobOrder($new_jo);
|
||||
|
||||
|
||||
//$this->em->persist($new_jo);
|
||||
|
||||
$this->em->persist($cmb_legacy_jo);
|
||||
$this->em->detach($row[0]);
|
||||
|
||||
$added_entries++;
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
$this->em->clear();
|
||||
|
||||
// output the entries that were not added
|
||||
if (count($invalid_entries) > 0)
|
||||
{
|
||||
fputcsv($fh, [
|
||||
'Entry Num',
|
||||
'Created Date',
|
||||
'Case Number',
|
||||
'Insurer',
|
||||
'Vehicle Number',
|
||||
'Car Model',
|
||||
'Nature of Call',
|
||||
'Service Needed',
|
||||
'Location',
|
||||
'State',
|
||||
'Driver',
|
||||
'Truck',
|
||||
'Workshop Arrival Time',
|
||||
'Status',
|
||||
'Customer Name',
|
||||
'Customer Phone Number',
|
||||
'Reference',
|
||||
'Odometer',
|
||||
'Batt Model',
|
||||
'Batt Size',
|
||||
'Batt Trade In',
|
||||
'Replaced By',
|
||||
'Remark',
|
||||
'Satisfaction',
|
||||
'Reason',
|
||||
|
||||
]);
|
||||
|
||||
foreach($invalid_entries as $row)
|
||||
{
|
||||
fputcsv($fh, $row);
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fh);
|
||||
|
||||
error_log('Processed ' . $total_entries . ' entries.');
|
||||
error_log('Added ' . $added_entries . ' entries.');
|
||||
error_log('Did not add ' . $total_inv_entries . ' entries.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -383,30 +437,6 @@ class MigrateCMBLegacyJobOrderCommand extends Command
|
|||
return $new_cv;
|
||||
}
|
||||
|
||||
protected function findBattery($batt_model, $batt_size)
|
||||
{
|
||||
$battery = null;
|
||||
$b_query = $this->em->createQuery('SELECT battery from App\Entity\Battery battery
|
||||
INNER JOIN battery.model bm
|
||||
INNER JOIN battery.size bs
|
||||
WHERE battery.model = :bmodel
|
||||
AND battery.size = :bsize');
|
||||
$b_query->setParameter('bmodel', $batt_model)
|
||||
->setParameter('bsize', $batt_size);
|
||||
|
||||
$b_results = $b_query->iterate();
|
||||
|
||||
foreach ($b_results as $b_result)
|
||||
{
|
||||
$battery = $b_result[0];
|
||||
//error_log($battery->getID() . ' ' . $battery->getProductCode());
|
||||
|
||||
$this->em->detach($b_result[0]);
|
||||
}
|
||||
|
||||
return $battery;
|
||||
}
|
||||
|
||||
protected function loadBatteryManufacturers()
|
||||
{
|
||||
$this->bmanu_hash = [];
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="legacy_cmb_job_order")
|
||||
* @ORM\Table(name="cmb_legacy_job_order")
|
||||
*/
|
||||
class CMBLegacyJobOrder
|
||||
{
|
||||
// unique id
|
||||
// legacy internal id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
|
|
@ -18,40 +19,377 @@ class CMBLegacyJobOrder
|
|||
*/
|
||||
protected $id;
|
||||
|
||||
// data from csv file
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
protected $data;
|
||||
protected $trans_date;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=30, nullable=true)
|
||||
*/
|
||||
protected $case_number;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=30, nullable=true)
|
||||
*/
|
||||
protected $insurer;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=20, nullable=true)
|
||||
*/
|
||||
protected $plate_number;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $trans_type;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=20, nullable=true)
|
||||
*/
|
||||
protected $car_brand;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $car_make;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=30, nullable=true)
|
||||
*/
|
||||
protected $nature_of_call;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=400, nullable=true)
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $driver;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=20, nullable=true)
|
||||
*/
|
||||
protected $truck;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $workshop_arrival_time;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=100, nullable=true)
|
||||
*/
|
||||
protected $cust_name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $cust_mobile;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=20, nullable=true)
|
||||
*/
|
||||
protected $reference;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $odometer;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $batt_model;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $batt_size;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default":false})
|
||||
*/
|
||||
protected $flag_trade_in;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $replaced_by;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=4000, nullable=true)
|
||||
*/
|
||||
protected $remarks;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=50, nullable=true)
|
||||
*/
|
||||
protected $satisfaction;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->data = [];
|
||||
$this->trans_date = new DateTime();
|
||||
}
|
||||
|
||||
public function addData($id, $value)
|
||||
public function setID($id)
|
||||
{
|
||||
$this->data[$id] = $value;
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setData(array $data_array)
|
||||
public function getID()
|
||||
{
|
||||
$this->data = $data_array;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setTransDate(DateTime $trans_date)
|
||||
{
|
||||
$this->trans_date = $trans_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDataById($id)
|
||||
public function getTransDate()
|
||||
{
|
||||
// return null if we don't have it
|
||||
if (!isset($this->data[$id]))
|
||||
return null;
|
||||
|
||||
return $this->data[$id];
|
||||
return $this->trans_date;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
public function setTransType($trans_type)
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
$this->trans_type = $trans_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTransType()
|
||||
{
|
||||
return $this->trans_type;
|
||||
}
|
||||
|
||||
public function setCaseNumber($case_number)
|
||||
{
|
||||
$this->case_number = $case_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCaseNumber()
|
||||
{
|
||||
return $this->case_number;
|
||||
}
|
||||
|
||||
public function setInsurer($insurer)
|
||||
{
|
||||
$this->insurer = $insurer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInsurer()
|
||||
{
|
||||
return $this->insurer;
|
||||
}
|
||||
|
||||
public function setNatureOfCall($nature_of_call)
|
||||
{
|
||||
$this->nature_of_call = $nature_of_call;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNatureOfCall()
|
||||
{
|
||||
return $this->nature_of_call;
|
||||
}
|
||||
|
||||
public function setPlateNumber($plate_number)
|
||||
{
|
||||
$this->plate_number = $plate_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlateNumber()
|
||||
{
|
||||
return $this->plate_number;
|
||||
}
|
||||
|
||||
public function setCarBrand($car_brand)
|
||||
{
|
||||
$this->car_brand = $car_brand;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCarBrand()
|
||||
{
|
||||
return $this->car_brand;
|
||||
}
|
||||
|
||||
public function setCarMake($car_make)
|
||||
{
|
||||
$this->car_make = $car_make;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCarMake()
|
||||
{
|
||||
return $this->car_make;
|
||||
}
|
||||
|
||||
public function setAddress($address)
|
||||
{
|
||||
$this->address = $address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
public function setDriver($driver)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDriver()
|
||||
{
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
public function setTruck($truck)
|
||||
{
|
||||
$this->truck = $truck;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTruck()
|
||||
{
|
||||
return $this->truck;
|
||||
}
|
||||
|
||||
public function setWorkshopArrivalTime($workshop_arrival_time)
|
||||
{
|
||||
$this->workshop_arrival_time = $workshop_arrival_time;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWorkshopArrivalTime()
|
||||
{
|
||||
return $this->workshop_arrival_time;
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setCustName($cust_name)
|
||||
{
|
||||
$this->cust_name = $cust_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustName()
|
||||
{
|
||||
return $this->cust_name;
|
||||
}
|
||||
|
||||
public function setCustMobile($cust_mobile)
|
||||
{
|
||||
$this->cust_mobile = $cust_mobile;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustMobile()
|
||||
{
|
||||
return $this->cust_mobile;
|
||||
}
|
||||
|
||||
public function setReference($reference)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReference()
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
public function setOdometer($odometer)
|
||||
{
|
||||
$this->odometer = $odometer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOdometer()
|
||||
{
|
||||
return $this->odometer;
|
||||
}
|
||||
|
||||
public function setBatteryModel($batt_model)
|
||||
{
|
||||
$this->batt_model = $batt_model;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBatteryModel()
|
||||
{
|
||||
return $this->batt_model;
|
||||
}
|
||||
|
||||
public function setBatterySize($batt_size)
|
||||
{
|
||||
$this->batt_size = $batt_size;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBatterySize()
|
||||
{
|
||||
return $this->batt_size;
|
||||
}
|
||||
|
||||
public function setIsTradeIn($flag_trade_in = true)
|
||||
{
|
||||
$this->flag_trade_in = $flag_trade_in;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isTradeIn()
|
||||
{
|
||||
return $this->flag_trade_in;
|
||||
}
|
||||
|
||||
public function setReplacedBy($replaced_by)
|
||||
{
|
||||
$this->replaced_by = $replaced_by;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReplacedBy()
|
||||
{
|
||||
return $this->replaced_by;
|
||||
}
|
||||
|
||||
public function setSatisfaction($satisfaction)
|
||||
{
|
||||
$this->satisfaction = $satisfaction;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSatisfaction()
|
||||
{
|
||||
return $this->satisfaction;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
57
src/Entity/CMBLegacyJobOrderRow.php
Normal file
57
src/Entity/CMBLegacyJobOrderRow.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="cmb_legacy_job_order_row")
|
||||
*/
|
||||
class CMBLegacyJobOrderRow
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// data from csv file
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->data = [];
|
||||
}
|
||||
|
||||
public function addData($id, $value)
|
||||
{
|
||||
$this->data[$id] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setData(array $data_array)
|
||||
{
|
||||
$this->data = $data_array;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDataById($id)
|
||||
{
|
||||
// return null if we don't have it
|
||||
if (!isset($this->data[$id]))
|
||||
return null;
|
||||
|
||||
return $this->data[$id];
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ class Customer
|
|||
|
||||
// first name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @ORM\Column(type="string", length=100)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $first_name;
|
||||
|
|
@ -65,7 +65,7 @@ class Customer
|
|||
|
||||
// mobile phone
|
||||
/**
|
||||
* @ORM\Column(type="string", length=30)
|
||||
* @ORM\Column(type="string", length=50)
|
||||
*/
|
||||
protected $phone_mobile;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue