resq/src/Ramcar/InvoiceCriteria.php

115 lines
2.2 KiB
PHP

<?php
namespace App\Ramcar;
use App\Entity\Battery;
use App\Entity\Promo;
use App\Entity\CustomerVehicle;
class InvoiceCriteria
{
protected $stype;
protected $promos;
protected $cv;
// entries are battery and trade-in combos
protected $entries;
public function __construct()
{
$this->stype = 0;
$this->promos = [];
$this->entries = [];
$this->cv = null;
}
public function setServiceType($stype)
{
// TODO: validate service type
$this->stype = $stype;
return $this;
}
public function getServiceType()
{
return $this->stype;
}
/*
public function addBattery(Battery $battery, $qty = 1)
{
for ($i = 0; $i < $qty; $i++)
$this->batteries[] = $battery;
return $this;
}
public function getBatteries()
{
return $this->batteries;
}
*/
public function addPromo(Promo $promo)
{
$this->promos[] = $promo;
return $this;
}
public function getPromos()
{
return $this->promos;
}
/*
public function addTradeIn($is_motolite, $qty = 1)
{
// NOTE: this asumes that all the rates for trade-ins are standardized
// for motolite and non-motolite trade-ins
for ($i = 0; $i < $qty; $i++)
{
if ($is_motolite)
$trade_in = 'motolite';
else
$trade_in = 'other';
$this->trade_ins[] = $trade_in;
}
return $this;
}
public function getTradeIns()
{
return $this->trade_ins;
}
*/
public function addEntry($battery, $trade_in, $qty)
{
// trade_in is null if no trade_in specified
$entry = [
'battery' => $battery,
'trade_in' => $trade_in,
'qty' => $qty
];
$this->entries[] = $entry;
}
public function getEntries()
{
return $this->entries;
}
public function setCustomerVehicle(CustomerVehicle $cv)
{
$this->cv = $cv;
return $this;
}
public function getCustomerVehicle()
{
return $this->cv;
}
}