search and export from invoice archive (#2408)

This commit is contained in:
Kevin Papst
2021-03-10 01:50:27 +01:00
committed by GitHub
parent c34e9f576d
commit db1344573f
22 changed files with 544 additions and 72 deletions

View File

@@ -67,7 +67,7 @@ class InvoiceTemplateForm extends AbstractType
'label' => 'label.due_days',
])
->add('vat', NumberType::class, [
'label' => 'label.vat',
'label' => 'label.tax_rate',
'scale' => 2,
])
->add('renderer', InvoiceRendererType::class)

View File

@@ -0,0 +1,44 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Form\Toolbar;
use App\Form\Type\InvoiceStatusType;
use App\Repository\Query\InvoiceArchiveQuery;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Defines the form used for filtering timesheet entries for invoices.
*/
class InvoiceArchiveForm extends AbstractToolbarForm
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->addSearchTermInputField($builder);
$this->addDateRange($builder, ['timezone' => $options['timezone']]);
$this->addCustomerMultiChoice($builder, ['required' => false, 'start_date_param' => null, 'end_date_param' => null, 'ignore_date' => true, 'placeholder' => ''], true);
$builder->add('status', InvoiceStatusType::class);
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => InvoiceArchiveQuery::class,
'csrf_protection' => false,
'timezone' => date_default_timezone_get(),
]);
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Form\Type;
use App\Entity\Invoice;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Custom form field type to select an invoice template.
*/
class InvoiceStatusType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'label' => 'label.status',
'multiple' => true,
'choices' => [
'status.' . Invoice::STATUS_NEW => Invoice::STATUS_NEW,
'status.' . Invoice::STATUS_PENDING => Invoice::STATUS_PENDING,
'status.' . Invoice::STATUS_PAID => Invoice::STATUS_PAID,
],
]);
}
/**
* {@inheritdoc}
*/
public function getParent()
{
return ChoiceType::class;
}
}