@@ -226,7 +226,7 @@ class InvoiceController extends AbstractController
|
||||
*/
|
||||
public function invoiceAction(InvoiceModel $model)
|
||||
{
|
||||
return $this->render('invoice/print.html.twig', [
|
||||
return $this->render('invoice/renderer/print.html.twig', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class InvoiceController extends AbstractController
|
||||
*/
|
||||
public function timesheetAction(InvoiceModel $model)
|
||||
{
|
||||
return $this->render('invoice/timesheet.html.twig', [
|
||||
return $this->render('invoice/renderer/timesheet.html.twig', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,14 @@ class Project
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="order_number", type="text", length=20, nullable=true)
|
||||
* @Assert\Length(max=20)
|
||||
*/
|
||||
private $orderNumber;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -68,7 +76,7 @@ class Project
|
||||
private $visible = true;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="budget", type="decimal", precision=10, scale=2, nullable=false)
|
||||
* @Assert\NotNull()
|
||||
@@ -114,13 +122,11 @@ class Project
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Project
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -138,13 +144,11 @@ class Project
|
||||
* Set comment
|
||||
*
|
||||
* @param string $comment
|
||||
*
|
||||
* @return Project
|
||||
*/
|
||||
public function setComment($comment)
|
||||
{
|
||||
$this->comment = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -162,13 +166,11 @@ class Project
|
||||
* Set visible
|
||||
*
|
||||
* @param boolean $visible
|
||||
*
|
||||
* @return Project
|
||||
*/
|
||||
public function setVisible($visible)
|
||||
{
|
||||
$this->visible = $visible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -185,21 +187,19 @@ class Project
|
||||
/**
|
||||
* Set budget
|
||||
*
|
||||
* @param string $budget
|
||||
*
|
||||
* @param float $budget
|
||||
* @return Project
|
||||
*/
|
||||
public function setBudget($budget)
|
||||
{
|
||||
$this->budget = $budget;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get budget
|
||||
*
|
||||
* @return string
|
||||
* @return float
|
||||
*/
|
||||
public function getBudget()
|
||||
{
|
||||
@@ -208,12 +208,11 @@ class Project
|
||||
|
||||
/**
|
||||
* @param Activity[] $activities
|
||||
* @return $this
|
||||
* @return Project
|
||||
*/
|
||||
public function setActivities($activities)
|
||||
{
|
||||
$this->activities = $activities;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -225,6 +224,24 @@ class Project
|
||||
return $this->activities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOrderNumber(): ?string
|
||||
{
|
||||
return $this->orderNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $orderNumber
|
||||
* @return Project
|
||||
*/
|
||||
public function setOrderNumber($orderNumber)
|
||||
{
|
||||
$this->orderNumber = $orderNumber;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -45,29 +45,30 @@ class ProjectEditForm extends AbstractType
|
||||
}
|
||||
|
||||
$builder
|
||||
// string - length 255
|
||||
->add('name', TextType::class, [
|
||||
'label' => 'label.name',
|
||||
])
|
||||
// text
|
||||
->add('comment', TextareaType::class, [
|
||||
'label' => 'label.comment',
|
||||
'required' => false,
|
||||
])
|
||||
->add('orderNumber', TextType::class, [
|
||||
'label' => 'label.order_number',
|
||||
'required' => false,
|
||||
])
|
||||
// customer
|
||||
->add('customer', CustomerType::class, [
|
||||
'label' => 'label.customer',
|
||||
'query_builder' => function (CustomerRepository $repo) use ($customer) {
|
||||
return $repo->builderForEntityType($customer);
|
||||
},
|
||||
])
|
||||
// boolean
|
||||
->add('visible', VisibilityType::class, [
|
||||
'label' => 'label.visible',
|
||||
])
|
||||
// string
|
||||
->add('budget', MoneyType::class, [
|
||||
'label' => 'label.budget',
|
||||
'currency' => $builder->getOption('currency'),
|
||||
'currency' => $customer ? $customer->getCurrency() : $builder->getOption('currency'),
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai package.
|
||||
*
|
||||
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Invoice;
|
||||
|
||||
use App\Model\InvoiceModel;
|
||||
|
||||
/**
|
||||
* Class RandomNumberGenerator is meant for testing purpose only.
|
||||
*
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class RandomNumberGenerator implements NumberGeneratorInterface
|
||||
{
|
||||
/**
|
||||
* @var InvoiceModel
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* @param InvoiceModel $model
|
||||
*/
|
||||
public function setModel(InvoiceModel $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceNumber(): string
|
||||
{
|
||||
return rand(1000000, 9999999);
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,8 @@ class InvoiceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not use this method for rendering the invoice, use InvoiceModel::getCalculator()->getEntries() instead.
|
||||
*
|
||||
* @return Timesheet[]
|
||||
*/
|
||||
public function getEntries(): array
|
||||
@@ -146,17 +148,6 @@ class InvoiceModel
|
||||
return new \DateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CalculatorInterface $calculator
|
||||
* @return InvoiceModel
|
||||
*/
|
||||
public function setCalculator(CalculatorInterface $calculator)
|
||||
{
|
||||
$this->calculator = $calculator;
|
||||
$this->calculator->setModel($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param NumberGeneratorInterface $generator
|
||||
* @return InvoiceModel
|
||||
@@ -176,6 +167,17 @@ class InvoiceModel
|
||||
return $this->generator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CalculatorInterface $calculator
|
||||
* @return InvoiceModel
|
||||
*/
|
||||
public function setCalculator(CalculatorInterface $calculator)
|
||||
{
|
||||
$this->calculator = $calculator;
|
||||
$this->calculator->setModel($this);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CalculatorInterface
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user