Initialer commit

Datumsformat angepasst
InvoiceCalculator für ABG erstellt: Sortierung nach Projekt, Schlagwort, Datum
This commit is contained in:
2023-08-09 16:30:40 +02:00
commit bc9a446e6f
8 changed files with 1803 additions and 0 deletions

1610
config/locales.php Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

View File

@@ -0,0 +1,99 @@
<?php
/*
* This file is derived from the DefaultCalculator which 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\Invoice\Calculator;
use App\Invoice\CalculatorInterface;
use App\Invoice\InvoiceItem;
/**
* Class DefaultCalculator works on all given entries using:
* - the customer currency
* - the invoice template vat rate
* - the entries rate
*/
final class ABGCalculator extends AbstractMergedCalculator implements CalculatorInterface
{
/**
* @return InvoiceItem[]
*/
public function getEntries(): array
{
$entries = [];
foreach ($this->model->getEntries() as $entry) {
$item = new InvoiceItem();
$this->mergeInvoiceItems($item, $entry);
foreach ($entry->getMetaFields() as $field) {
if ($field->getName() === null) {
continue;
}
$item->addAdditionalField($field->getName(), $field->getValue());
}
$entries[] = $item;
}
// sort by project and tags
$sorted_entries = array_values($entries);
usort($sorted_entries, function ($a, $b){
$comp_a = $a->getProject() . implode(',', $a->getTags());
$comp_b = $b->getProject() . implode(',', $b->getTags());
if($comp_a == $comp_b) {
return 0;
}
return ($comp_a < $comp_b) ? -1 : 1;
});
// merge entries from same day and ticketnumber
$merged_entries = [];
$i = 0;
$sorted_entries_len = count($sorted_entries);
while ($i < $sorted_entries_len) {
if ($i + 1 == $sorted_entries_len){
$merged_entries[] = $sorted_entries[$i];
break;
}
else {
$current = $sorted_entries[$i];
$next = $sorted_entries[$i + 1];
$date_curr = date_format($current->getBegin(),"Ymd");
$date_next = date_format($next->getBegin(),"Ymd");
$project_curr = $current->getProject();
$project_next = $next->getProject();
$ticket_curr = trim($current->getAdditionalField("ticketnummer"));
$ticket_next = trim($next->getAdditionalField("ticketnummer"));
if ($date_curr == $date_next &&
$project_curr == $project_next &&
$ticket_curr == $ticket_next) {
$next->setDuration($next->getDuration() + $current->getDuration());
$next->setRate($next->getRate() + $current->getRate());
}
else {
$merged_entries[] = $current;
}
}
$i++;
}
return $merged_entries;
//return $entries;
}
public function getId(): string
{
return 'ABG';
}
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" target-language="de" datatype="plaintext" original="daterangepicker.en.xlf">
<body>
<trans-unit id="s9Hdo7E" resname="daterangepicker.today">
<source>daterangepicker.today</source>
<target>Heute</target>
</trans-unit>
<trans-unit id="gkQA1YG" resname="daterangepicker.yesterday">
<source>daterangepicker.yesterday</source>
<target>Gestern</target>
</trans-unit>
<trans-unit id="CAvVEbc" resname="daterangepicker.lastWeek">
<source>daterangepicker.lastWeek</source>
<target>Letzte Woche</target>
</trans-unit>
<trans-unit id="HfcD1_y" resname="daterangepicker.thisWeek">
<source>daterangepicker.thisWeek</source>
<target>Diese Woche</target>
</trans-unit>
<trans-unit id="AdEC6w4" resname="daterangepicker.lastMonth">
<source>daterangepicker.lastMonth</source>
<target>Letzter Monat</target>
</trans-unit>
<trans-unit id="8f61k.L" resname="daterangepicker.thisMonth">
<source>daterangepicker.thisMonth</source>
<target>Dieser Monat</target>
</trans-unit>
<trans-unit id="_9rEFED" resname="daterangepicker.lastYear">
<source>daterangepicker.lastYear</source>
<target>Letztes Jahr</target>
</trans-unit>
<trans-unit id="XgIrZS3" resname="daterangepicker.thisYear">
<source>daterangepicker.thisYear</source>
<target>Dieses Jahr</target>
</trans-unit>
<trans-unit id="AY_E9UR" resname="daterangepicker.thisYearUntilNow">
<source>daterangepicker.thisYearUntilNow</source>
<target>Dieses Jahr - bis heute</target>
</trans-unit>
<trans-unit id="m0lJOke" resname="daterangepicker.allTime">
<source>daterangepicker.allTime</source>
<target>Gesamter Zeitraum</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" target-language="de" datatype="plaintext" original="invoice-calculator.en.xlf">
<body>
<trans-unit id="MviRJeB" resname="invoice_calculator">
<source>invoice_calculator</source>
<target>Summen Berechnung</target>
</trans-unit>
<trans-unit id="N6juwc4" resname="default">
<source>default</source>
<target>Standard: ein Eintrag pro Zeitmessung</target>
</trans-unit>
<trans-unit id="_bAHi13" resname="short">
<source>short</source>
<target>Stunden: Einträge aufsummiert, nur ein Eintrag</target>
</trans-unit>
<trans-unit id="BPiZbad" resname="user">
<source>user</source>
<target>Benutzer: ein Eintrag pro Benutzer</target>
</trans-unit>
<trans-unit id="BlGGO.X" resname="activity">
<source>activity</source>
<target>Aktivität: ein Eintrag pro Aktivität</target>
</trans-unit>
<trans-unit id="JEIQ5IQ" resname="project">
<source>project</source>
<target>Projekt: ein Eintrag pro Projekt</target>
</trans-unit>
<trans-unit id="DodjLNR" resname="date">
<source>date</source>
<target>Datum: ein Eintrag pro Tag (verwendet Startdatum)</target>
</trans-unit>
<trans-unit id="iFDs7Zh" resname="weekly">
<source>weekly</source>
<target>Wöchentlich: ein Eintrag pro Woche (verwendet Startdatum)</target>
</trans-unit>
<trans-unit id="aDtTH0H" resname="price">
<source>price</source>
<target>Preis: ein Eintrag je Preis</target>
</trans-unit>
<trans-unit id="N6Kuwc5" resname="ABG">
<source>default</source>
<target>ABG: ein Eintrag pro Zeitmessung sortiert nach Schlagwort</target>
</trans-unit>
</body>
</file>
</xliff>