Test fixes
Some checks failed
Image optimization / general_image_workflow (push) Has been cancelled
CI / general_module_workflow_php (push) Has been cancelled
CI / general_module_workflow_js (push) Has been cancelled

This commit is contained in:
Dennis Eichhorn 2024-05-16 02:14:54 +00:00
parent 100bc08226
commit a248fc159d
17 changed files with 134 additions and 22 deletions

View File

@ -68,6 +68,20 @@
"en": "Postage", "en": "Postage",
"de": "Porto" "de": "Porto"
} }
},
{
"name": "stationary",
"l11n": {
"en": "Stationary",
"de": "Büromaterial"
}
},
{
"name": "it",
"l11n": {
"en": "IT",
"de": "IT"
}
}, },
{ {
"name": "other", "name": "other",

View File

@ -497,7 +497,7 @@ final class ApiController extends Controller
$this->apiExpenseElementCreate($internalRequest, $internalResponse, $data); $this->apiExpenseElementCreate($internalRequest, $internalResponse, $data);
$elements[] = $internalResponse->getDataArray($internalRequest->uri->__toString())['response']; $elements[] = $internalResponse->getDataArray($internalRequest->uri->__toString())['response'] ?? null;
} }
$this->createStandardCreateResponse($request, $response, $elements); $this->createStandardCreateResponse($request, $response, $elements);
@ -705,7 +705,13 @@ final class ApiController extends Controller
$this->app->moduleManager->get('Billing', 'ApiPurchase')->apiSupplierBillUpload($internalRequest, $internalResponse, $data); $this->app->moduleManager->get('Billing', 'ApiPurchase')->apiSupplierBillUpload($internalRequest, $internalResponse, $data);
$bills = $internalResponse->getDataArray($internalRequest->uri->__toString())['response']; $bills = $internalResponse->getDataArray($internalRequest->uri->__toString())['response'] ?? [];
if (empty($bills)) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidAddResponse($request, $response, $bills);
return;
}
$elementObj = ExpenseElementMapper::get() $elementObj = ExpenseElementMapper::get()
->where('id', $element) ->where('id', $element)

View File

@ -126,7 +126,7 @@ final class BackendController extends Controller
->executeGetArray(); ->executeGetArray();
$view->data['expense-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response); $view->data['expense-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
return $view; return $view;
} }

View File

@ -1,5 +0,0 @@
# Structure
## ER
![ER](Modules/BusinessExpenses/Docs/Dev/img/er.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

5
Docs/Help/en/SUMMARY.md Normal file
View File

@ -0,0 +1,5 @@
# User Content
* [Expense]({%}&page=Help/expense)
* [Expense Element Type]({%}&page=Help/expense_element_type)
* [Expense Type]({%}&page=Help/expense_type)

21
Docs/Help/en/expense.md Normal file
View File

@ -0,0 +1,21 @@
# Expense
## Overview
In the overview you can see for which person the expense report is, which period it covers and additional general information if provided.
![Expense Overview](Modules/BusinessExpenses/Docs/Help/img/expenses_overview.png)
## Expenses
In the expenses tab you can create and see individual expenses for this expense report.
> Every expense should have it's own separate expense element.
The list shows all days of the expense period, even if no expenses are recorded for a certain day. However, these days are greyed out. Expenses that are outside of the expense period are highlighted in red.
![Expense Overview](Modules/BusinessExpenses/Docs/Help/img/expenses_element_invalid_date.png)
After clicking on the respective expense line you will be able to see the detailed information of that expense.
![Expense Overview](Modules/BusinessExpenses/Docs/Help/img/expenses_element_overview.png)

View File

@ -0,0 +1,17 @@
# Expense Element Type
The expense element type describes the type of expenses. The module provides the following default types:
* Fuel
* Parking
* Entertainment
* Breakfast
* Lunch
* Dinner
* Hotel
* Travelling
* Present
* Postage
* Stationary
* IT
* Other

View File

@ -0,0 +1,10 @@
# Expense Type
The expense type describes the type of expense report. The module provides the following default types:
* Sales (e.g. meeting with customer)
* Supplier (e.g. meeting with supplier)
* Education (e.g. employee training)
* Event
* Affiliate (e.g. shareholder/owner related)
* Other

View File

@ -0,0 +1,21 @@
# Introduction
The **Business Expenses** module lets you create and manage business expenses.
## Target Group
The target group for this module is anyone who has to create and manage business expenses (e.g. travelling sales men).
# Setup
This module doesn't have any additional setup requirements. However, for some automated invoice recognition please make sure you have `tesseract-ocr` installed.
# Features
## Expense Types
Multiple expense types to indicate the type of the expense report.
## Expense Element Types
Multiple expense element types to indicate the type of the expense, such as hotel, dinner, travelling, ...

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

12
Docs/img.json Normal file
View File

@ -0,0 +1,12 @@
[
[
"/businessexpenses/expense/view?id=1",
"//*[@id=\"content\"]/div[2]/div[2]/div[1]/div[2]/div/section",
"/BusinessExpenses/Docs/Help/img/expenses_overview.png"
],
[
"/businessexpenses/expense/element/view?id=1",
"//*[@id=\"content\"]/div[2]/div[2]/div[1]/div/div/section",
"/BusinessExpenses/Docs/Help/img/expenses_element_overview.png"
]
]

View File

@ -21,22 +21,22 @@ return ['BusinessExpenses' => [
'CreatedAt' => 'Erstellt', 'CreatedAt' => 'Erstellt',
'Description' => 'Beschreibung', 'Description' => 'Beschreibung',
'End' => 'Ende', 'End' => 'Ende',
'Element' => 'Element', 'Element' => 'Element',
'Expenses' => 'Kosten', 'Expenses' => 'Kosten',
'From' => 'Von', 'From' => 'Von',
'Gross' => 'Brutto', 'Gross' => 'Brutto',
'Back' => 'Zurück', 'Back' => 'Zurück',
'Files' => 'Dateien', 'Files' => 'Dateien',
'Net' => 'Netto', 'Net' => 'Netto',
'Notes' => 'Notizen', 'Notes' => 'Notizen',
'Paid' => 'Bezahlt', 'Paid' => 'Bezahlt',
'Report' => 'Bericht', 'Report' => 'Bericht',
'Total' => 'Gesamt', 'Total' => 'Gesamt',
'Start' => 'Start', 'Start' => 'Start',
'Status' => 'Status', 'Status' => 'Status',
'Overview' => 'Übersicht', 'Overview' => 'Übersicht',
'Clocking' => 'Zeiterfassung', 'Clocking' => 'Zeiterfassung',
'Type' => 'Typ', 'Type' => 'Typ',
'Costs' => 'Kosten', 'Costs' => 'Kosten',
'Upload' => 'Hochladen', 'Upload' => 'Hochladen',
]]; ]];

View File

@ -21,22 +21,22 @@ return ['BusinessExpenses' => [
'CreatedAt' => 'Created At', 'CreatedAt' => 'Created At',
'Description' => 'Description', 'Description' => 'Description',
'End' => 'End', 'End' => 'End',
'Element' => 'Element', 'Element' => 'Element',
'Expenses' => 'Expenses', 'Expenses' => 'Expenses',
'From' => 'From', 'From' => 'From',
'Gross' => 'Gross', 'Gross' => 'Gross',
'Files' => 'Files', 'Files' => 'Files',
'Back' => 'Back', 'Back' => 'Back',
'Net' => 'Net', 'Net' => 'Net',
'Notes' => 'Notes', 'Notes' => 'Notes',
'Paid' => 'Paid', 'Paid' => 'Paid',
'Report' => 'Report', 'Report' => 'Report',
'Total' => 'Total', 'Total' => 'Total',
'Start' => 'Start', 'Start' => 'Start',
'Status' => 'Status', 'Status' => 'Status',
'Overview' => 'Overview', 'Overview' => 'Overview',
'Clocking' => 'Clocking', 'Clocking' => 'Clocking',
'Type' => 'Type', 'Type' => 'Type',
'Costs' => 'Costs', 'Costs' => 'Costs',
'Upload' => 'Upload', 'Upload' => 'Upload',
]]; ]];

View File

@ -17,8 +17,8 @@ use Modules\BusinessExpenses\Models\NullExpense;
use phpOMS\Uri\UriFactory; use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */ /** @var \phpOMS\Views\View $this */
$element = $this->data['element'] ?? new NullExpense(); $element = $this->data['element'] ?? new NullExpense();
$isNew = $element->id === 0; $isNew = $element->id === 0;
echo $this->data['nav']->render(); ?> echo $this->data['nav']->render(); ?>
<div class="tabview tab-2"> <div class="tabview tab-2">

View File

@ -26,7 +26,7 @@ $sessions = $this->data['sessions'] ?? [];
$isNew = $expense->id === 0; $isNew = $expense->id === 0;
echo $this->data['nav']->render(); ?> echo $this->data['nav']->render(); ?>
<div class="tabview tab-2"> <div id="iExpenseView" class="tabview tab-2 url-rewrite">
<?php if (!$isNew) : ?> <?php if (!$isNew) : ?>
<div class="box"> <div class="box">
<ul class="tab-links"> <ul class="tab-links">
@ -54,6 +54,7 @@ echo $this->data['nav']->render(); ?>
</section> </section>
</div> </div>
<!--
<div class="col-xs-12 col-lg-6"> <div class="col-xs-12 col-lg-6">
<section class="portlet hl-3"> <section class="portlet hl-3">
<div class="portlet-body"> <div class="portlet-body">
@ -66,6 +67,7 @@ echo $this->data['nav']->render(); ?>
</div> </div>
</section> </section>
</div> </div>
-->
</div> </div>
<div class="row"> <div class="row">
@ -123,8 +125,8 @@ echo $this->data['nav']->render(); ?>
<?php <?php
$costs = [ $costs = [
'total' => new FloatInt(), 'total' => new FloatInt(),
'week' => new FloatInt(), 'week' => new FloatInt(),
'day' => new FloatInt(), 'day' => new FloatInt(),
]; ];
$elements = $expense->elements; $elements = $expense->elements;
@ -190,6 +192,15 @@ echo $this->data['nav']->render(); ?>
<td colspan="3" class="empty"> <td colspan="3" class="empty">
<?php endif; ?> <?php endif; ?>
<?php endwhile; ?> <?php endwhile; ?>
<?php while (($element = \next($elements)) !== false) :
$url = UriFactory::build('{/base}/businessexpenses/expense/element/view?{?}&id=' . $element->id);
?>
<tr data-href="<?= $url; ?>" class="hl-1">
<td><a href="<?= $url; ?>"><?= $element->start->format('Y-m-d H:i'); ?></a>
<td><a href="<?= $url; ?>"><?= $element->end?->format('Y-m-d H:i'); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($element->type->l11n); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($element->gross, symbol: ''); ?></a>
<?php endwhile; ?>
<tr class="hl-3"> <tr class="hl-3">
<td colspan="3"><?= $this->getHtml('Total'); ?> <td colspan="3"><?= $this->getHtml('Total'); ?>
<td><?= $costs['total']->getAmount(); ?> <td><?= $costs['total']->getAmount(); ?>

View File

@ -12,7 +12,7 @@
}, },
"creator": { "creator": {
"name": "Jingga", "name": "Jingga",
"website": "jingga.app" "website": "https://jingga.app"
}, },
"directory": "BusinessExpenses", "directory": "BusinessExpenses",
"dependencies": { "dependencies": {