fixed short invoice calculator (#114)

* fixed money display and address field for InvoiceTemplate entity
* added quick start button for users without active records
* rearranged columns on project and customer admin page
* improved extensions docu
This commit is contained in:
Kevin Papst
2018-01-28 12:08:44 +01:00
committed by GitHub
parent 9bbaf0ec71
commit e35d73eab5
7 changed files with 35 additions and 27 deletions

View File

@@ -156,13 +156,16 @@ $ bin/console doctrine:schema:drop --force && bin/console doctrine:schema:create
That will drop the configured Kimai v2 database schema and re-create it, before importing the data from the `mysql` database at `127.0.0.1` on port `3306` authenticating the user `kimai` with the password `test` for import.
The connection will use the charset `latin1` and the default table prefix `kimai_` for reading data. Imported users can login with the password `test123` and all customer will have the country `de` assigned.
## Extending Kimai 2 with Bundles
## Extensions for Kimai 2
As Kimai 2 was built with extendability in mind, it can be extended like every other Symfony application.
A first example on how to extend Kimai 2 can be found in this [GitHub repository](https://github.com/kevinpapst/kimai2-invoice).
As Kimai 2 was built on top of Symfony, it can be extended like every other Symfony application.
We call these extensions bundles, but you might also know them as add-ons, extensions or plugins.
All available Kimai 2 bundles can be found at the repository [Kimai recipes](https://github.com/kimai/recipes).
There are more options, for example events to hook your own pages into the navigation tree.
As we don't have documentation on this by now, please ask in the issues track or have a look at [this class](https://github.com/kevinpapst/kimai2/blob/master/src/EventSubscriber/MenuSubscriber.php).
An example on how to extend Kimai 2 can be found in this [GitHub repository](https://github.com/kevinpapst/kimai2-invoice).
There are more options, for example events to hook your own links into the navigation tree.
But we don't have documentation on this by now, so please ask in the [issue tracker](https://github.com/kevinpapst/kimai2) or have a look at [this class](https://github.com/kevinpapst/kimai2/blob/master/src/EventSubscriber/MenuSubscriber.php).
## Troubleshooting

View File

@@ -175,7 +175,7 @@ class InvoiceTemplate
* @param string $address
* @return InvoiceTemplate
*/
public function setAddress(string $address)
public function setAddress($address)
{
$this->address = $address;
return $this;

View File

@@ -30,6 +30,7 @@ class ShortInvoiceCalculator extends DefaultCalculator
$timesheet = new Timesheet();
foreach ($this->model->getEntries() as $entry) {
$timesheet->setRate($timesheet->getRate() + $entry->getRate());
$timesheet->setDuration($timesheet->getDuration() + $entry->getDuration());
if ($timesheet->getActivity() === null) {
$timesheet->setActivity($entry->getActivity());

View File

@@ -121,7 +121,7 @@ class Extensions extends \Twig_Extension
*/
public function money($amount, $currency = null)
{
$result = round($amount, 2);
$result = number_format(round($amount, 2), 2);
if ($currency !== null) {
$result .= ' ' . Intl::getCurrencyBundle()->getCurrencySymbol($currency);
}

View File

@@ -13,10 +13,10 @@
{{ tables.data_table_header({
'label.name': '',
'label.customer_number': 'hidden-xs',
'label.project': '',
'label.comment': 'hidden-xs',
'label.country': 'hidden-xs',
'label.customer_number': 'hidden-xs',
'label.currency': 'hidden-xs',
'label.visible': '',
'label.actions': '',
@@ -25,7 +25,6 @@
{% for entry in entries %}
<tr>
<td>{{ entry.name }} {% if entry.company is not empty %}({{ entry.company }}){% endif %}</td>
<td class="hidden-xs">{{ entry.number }}</td>
<td>
{% for project in entry.projects %}
<a href="{{ path('admin_project_edit', {'id' : project.id}) }}">{{ widgets.label_project(project) }}</a>
@@ -33,6 +32,7 @@
</td>
<td class="hidden-xs">{{ entry.comment }}</td>
<td class="hidden-xs">{{ entry.country|country }}</td>
<td class="hidden-xs">{{ entry.number }}</td>
<td class="hidden-xs">{{ entry.currency }} {{ entry.currency|currency }}</td>
<td>{{ widgets.label_visible(entry.visible) }}</td>
<td>

View File

@@ -12,7 +12,6 @@
{% endif %}
{{ tables.data_table_header({
'label.id': 'hidden-xs',
'label.name': '',
'label.customer': '',
'label.comment': 'hidden-xs hidden-sm',
@@ -23,7 +22,6 @@
{% for entry in entries %}
<tr>
<td class="hidden-xs">{{ entry.id }}</td>
<td>{{ entry.name }}</td>
<td>
<a href="{{ path('admin_customer_edit', {'id' : entry.customer.id}) }}">{{ widgets.label_customer(entry.customer) }}</a>

View File

@@ -9,22 +9,28 @@
{{ 'active.entries'|transchoice(entries|length) }}
</li>
<li>
<ul class="menu">
{% for entry in entries %}
<li>
<a href="{{ path('timesheet_stop', {'id' : entry.id}) }}">
<div class="pull-left">
<i class="fa fa-stop-circle fa-2x"></i>
</div>
<h4>
{{ entry.activity.name }}
<small><i class="fa fa-clock-o"></i> {{ entry|durationForEntry }}</small>
</h4>
<p>{{ entry.activity.project.name }} ({{ entry.activity.project.customer.name }})</p>
</a>
</li>
{% endfor %}
</ul>
{% if entries is not empty %}
<ul class="menu">
{% for entry in entries %}
<li>
<a href="{{ path('timesheet_stop', {'id' : entry.id}) }}">
<div class="pull-left">
<i class="fa fa-stop-circle fa-2x"></i>
</div>
<h4>
{{ entry.activity.name }}
<small><i class="fa fa-clock-o"></i> {{ entry|durationForEntry }}</small>
</h4>
<p>{{ entry.activity.project.name }} ({{ entry.activity.project.customer.name }})</p>
</a>
</li>
{% endfor %}
</ul>
{% else %}
<div class="start_record">
<a href="{{ path('timesheet_create') }}"><i class="fa fa-play-circle-o fa-5x"></i></a>
</div>
{% endif %}
</li>
<li class="footer"><a href="{{ path('timesheet_create') }}">{{ 'timesheet.start'|trans }}</a></li>
</ul>